@grapesjs/studio-sdk-plugins 1.0.35 → 1.0.36

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 (88) hide show
  1. package/dist/accordionComponent/index.cjs.js +7 -7
  2. package/dist/accordionComponent/index.es.js +175 -162
  3. package/dist/accordionComponent/index.umd.js +7 -7
  4. package/dist/aiChat/index.cjs.js +64 -64
  5. package/dist/aiChat/index.es.js +5785 -5757
  6. package/dist/aiChat/index.js +64 -64
  7. package/dist/aiChat/index.umd.js +63 -63
  8. package/dist/animationComponent/index.cjs.js +3 -3
  9. package/dist/animationComponent/index.es.js +204 -191
  10. package/dist/animationComponent/index.umd.js +3 -3
  11. package/dist/canvasAbsoluteMode/index.cjs.js +1 -1
  12. package/dist/canvasAbsoluteMode/index.es.js +183 -170
  13. package/dist/canvasAbsoluteMode/index.umd.js +1 -1
  14. package/dist/canvasEmptyState/index.cjs.js +1 -1
  15. package/dist/canvasEmptyState/index.es.js +134 -121
  16. package/dist/canvasEmptyState/index.umd.js +1 -1
  17. package/dist/canvasFullSize/index.cjs.js +9 -9
  18. package/dist/canvasFullSize/index.es.js +165 -152
  19. package/dist/canvasFullSize/index.umd.js +9 -9
  20. package/dist/canvasGridMode/index.cjs.js +5 -5
  21. package/dist/canvasGridMode/index.es.js +245 -232
  22. package/dist/canvasGridMode/index.umd.js +4 -4
  23. package/dist/canvasScreenshot/index.cjs.js +1 -1
  24. package/dist/canvasScreenshot/index.es.js +155 -142
  25. package/dist/canvasScreenshot/index.umd.js +1 -1
  26. package/dist/dataSourceEjs/index.cjs.js +9 -9
  27. package/dist/dataSourceEjs/index.es.js +257 -244
  28. package/dist/dataSourceEjs/index.umd.js +9 -9
  29. package/dist/dataSourceHandlebars/index.cjs.js +8 -8
  30. package/dist/dataSourceHandlebars/index.es.js +216 -203
  31. package/dist/dataSourceHandlebars/index.umd.js +7 -7
  32. package/dist/dialogComponent/index.cjs.js +14 -14
  33. package/dist/dialogComponent/index.es.js +141 -128
  34. package/dist/dialogComponent/index.umd.js +14 -14
  35. package/dist/flexComponent/index.cjs.js +13 -13
  36. package/dist/flexComponent/index.es.js +484 -471
  37. package/dist/flexComponent/index.umd.js +13 -13
  38. package/dist/fsLightboxComponent/index.cjs.js +3 -3
  39. package/dist/fsLightboxComponent/index.es.js +173 -160
  40. package/dist/fsLightboxComponent/index.umd.js +3 -3
  41. package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
  42. package/dist/googleFontsAssetProvider/index.es.js +160 -147
  43. package/dist/googleFontsAssetProvider/index.umd.js +1 -1
  44. package/dist/iconifyComponent/index.cjs.js +2 -2
  45. package/dist/iconifyComponent/index.es.js +196 -183
  46. package/dist/iconifyComponent/index.umd.js +2 -2
  47. package/dist/index.cjs.js +25 -25
  48. package/dist/index.es.js +121 -108
  49. package/dist/index.umd.js +18 -18
  50. package/dist/layoutSidebarButtons/index.cjs.js +1 -1
  51. package/dist/layoutSidebarButtons/index.es.js +157 -144
  52. package/dist/layoutSidebarButtons/index.umd.js +1 -1
  53. package/dist/lightGalleryComponent/index.cjs.js +1 -1
  54. package/dist/lightGalleryComponent/index.es.js +245 -232
  55. package/dist/lightGalleryComponent/index.umd.js +1 -1
  56. package/dist/linkImageComponent/index.cjs.js +2 -2
  57. package/dist/linkImageComponent/index.es.js +106 -93
  58. package/dist/linkImageComponent/index.umd.js +2 -2
  59. package/dist/listPagesComponent/index.cjs.js +5 -5
  60. package/dist/listPagesComponent/index.es.js +157 -144
  61. package/dist/listPagesComponent/index.umd.js +5 -5
  62. package/dist/presetPrintable/index.cjs.js +3 -3
  63. package/dist/presetPrintable/index.es.js +181 -168
  64. package/dist/presetPrintable/index.umd.js +3 -3
  65. package/dist/prosemirror/index.cjs.js +7 -7
  66. package/dist/prosemirror/index.es.js +385 -372
  67. package/dist/prosemirror/index.umd.js +8 -8
  68. package/dist/rendererReact/index.cjs.js +1 -1
  69. package/dist/rendererReact/index.es.js +200 -187
  70. package/dist/rendererReact/index.js +1 -1
  71. package/dist/rendererReact/index.umd.js +1 -1
  72. package/dist/rteTinyMce/index.cjs.js +2 -2
  73. package/dist/rteTinyMce/index.es.js +118 -105
  74. package/dist/rteTinyMce/index.umd.js +2 -2
  75. package/dist/shapeDividerComponent/index.cjs.js +4 -4
  76. package/dist/shapeDividerComponent/index.es.js +129 -116
  77. package/dist/shapeDividerComponent/index.umd.js +4 -4
  78. package/dist/swiperComponent/index.cjs.js +9 -9
  79. package/dist/swiperComponent/index.es.js +203 -190
  80. package/dist/swiperComponent/index.umd.js +7 -7
  81. package/dist/tableComponent/index.cjs.js +1 -1
  82. package/dist/tableComponent/index.es.js +257 -244
  83. package/dist/tableComponent/index.umd.js +1 -1
  84. package/dist/types.d.ts +1 -1
  85. package/dist/youtubeAssetProvider/index.cjs.js +1 -1
  86. package/dist/youtubeAssetProvider/index.es.js +121 -108
  87. package/dist/youtubeAssetProvider/index.umd.js +1 -1
  88. package/package.json +1 -1
@@ -1,10 +1,10 @@
1
- (function(rn,sr){typeof exports=="object"&&typeof module<"u"?module.exports=sr(require("@ai-sdk/react"),require("ai"),require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-dom/client"),require("marked"),require("react-markdown"),require("remark-gfm")):typeof define=="function"&&define.amd?define(["@ai-sdk/react","ai","react/jsx-runtime","react","react-dom","react-dom/client","marked","react-markdown","remark-gfm"],sr):(rn=typeof globalThis<"u"?globalThis:rn||self,rn.StudioSdkPlugins_aiChat=sr(rn.AiSdkReact,rn.Ai,rn.jsxRuntime,rn.React,rn.ReactDOM,rn.ReactDOMClient,rn.Marked,rn.ReactMarkdown,rn.RemarkGfm))})(this,function(rn,sr,c,h,Fn,_S,AS,LS,MS){"use strict";function Kh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const nt=Kh(h),NS=Kh(Fn),Zh="app.grapesjs.com",Yh="app-stage.grapesjs.com",Xh=[Zh,"app2.grapesjs.com",Yh,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],Jh="license:check:start",Fu="license:check:end",Tr=()=>typeof window<"u",ps=e=>e&&e.stopPropagation(),$S=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),kS=(e,t)=>{const n=r=>r.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},IS=(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)},VS=e=>kS("Escape",e),HS=(e,t={})=>{const n=ct(e)?{id:e,src:e}:e;return new Promise((r,o)=>{var p,g;const{loadedScripts:s}=t,{id:a,src:i}=n,l=document.querySelector(`script[src="${i}"]`);if(l){if((p=t.onScript)==null||p.call(t,l),s&&!s.get(i)){l.addEventListener("load",()=>r(a)),l.addEventListener("error",()=>o(a));return}return r(a)}const u=window.define;window.define=void 0;const d=()=>{s==null||s.set(i,!0),window.define=u},f=document.createElement("script");f.src=i,f.onload=()=>{r(a),d()},f.onerror=()=>{o(a),d()},document.head.appendChild(f),(g=t.onScript)==null||g.call(t,f)})},jS=e=>{const t=e.map(n=>HS(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 Qh(e){const t=r=>{var o;if(r.length){const s=r.shift(),a=DS(s);a.onerror=a.onload=t.bind(null,r),(o=s.parentNode)==null||o.replaceChild(a,s)}},n=Array.from(e.querySelectorAll("script"));t(n)}const Rh=e=>new DOMParser().parseFromString(e,"text/html"),FS=(e="")=>Rh(`<body>${e}</body>`).body.innerHTML,BS=(e="")=>Rh(`<head>${e}</head>`).head.innerHTML,zS=(e="",t)=>{const r=new DOMParser().parseFromString(e,"text/html");if(t){const s=r.querySelectorAll("svg")[0].style||{},a=ZS(t)?`${t}px`:t;s.width=a,s.height=a,s.fill="currentColor"}return new XMLSerializer().serializeToString(r)},Bu=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?Yh:Zh}`}/${n?"platform-api":"api"}`,US=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},eg=(e={})=>{const{width:t=300,height:n,text:r="IMAGE",bg:o="777",fg:s="white"}=e,a=n?`x${n}`:"";return`https://placehold.co/${t}${a}/${o}/${s}.png?text=${r}`},WS=eg(),zu=()=>{const e=Tr()&&window.location.hostname;return!!e&&(Xh.includes(e)||Xh.some(t=>e.endsWith(t)))},Pr=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),GS=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),qS=()=>{},KS=240,Ht=e=>typeof e<"u",ct=e=>typeof e=="string",ZS=e=>typeof e=="number";function et(e){return typeof e=="function"}function Rr(e){return e&&!Array.isArray(e)&&typeof e=="object"}const YS=e=>!e||Object.keys(e).length===0,Zs=(e,t)=>{const n=(e||"").toLocaleLowerCase(),r=(t||"").toLocaleLowerCase();return n.includes(r)},XS=(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",r=n.length;for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*r));return t},QS=e=>!!e.Components.getType("mjml"),Sl=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),RS=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(s,a)=>{const i=a.trim();return!i||!n.has(i)?"":`__var__${i}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(s,a)=>`{{ ${a} }}`)};async function eC({path:e,baseApiUrl:t,method:n="GET",headers:r={},params:o,body:s}){const i=`${t||Bu({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...r}};s&&(l.body=JSON.stringify(s));const u=o?new URLSearchParams(o).toString():"",d=u?`?${u}`:"",f=await fetch(`${i}${d}`,l);if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}var Ys=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Ys||{}),on=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(on||{}),re=(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.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))(re||{}),Pn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(Pn||{}),So=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(So||{}),xt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(xt||{});const tg={[Ys.free]:0,[Ys.startup]:10,[Ys.business]:20,[Ys.enterprise]:30};function tC(e){const t=e;return t.init=n=>r=>e(r,n),t}const nC=e=>tC(e);async function rC({editor:e,plan:t,pluginName:n,licenseKey:r,onLicenseCheckResponse:o,cleanup:s}){let a="",i=!1;const l=zu(),u=f=>{console.warn("Cleanup plugin:",n,"Reason:",f),s()},d=(f={})=>{var b;const{error:p,sdkLicense:g}=f,m=(b=f.plan)==null?void 0:b.category;if(!(g||f.license)||p)u(p||"Invalid license");else if(m){const w=tg[t],y=tg[m];w>y&&u({pluginRequiredPlan:t,licensePlan:m})}};e.on(Jh,f=>{a=f==null?void 0:f.baseApiUrl,i=!0}),e.on(Fu,f=>{o==null||o(f),d(f)}),setTimeout(async()=>{if(!i){if(l)return;if(r){const f=await oC({licenseKey:r,pluginName:n,baseApiUrl:a});o==null||o(f),f&&d(f)}else u("The `licenseKey` option not provided")}},2e3)}async function oC(e){const{licenseKey:t,pluginName:n,baseApiUrl:r}=e;try{return(await eC({baseApiUrl:r,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}var sC="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",aC="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",iC="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",lC="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",cC="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",uC="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",dC="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",fC="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",pC="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",hC="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",gC="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",mC="M3,21V3H21V21H3M5,5V19H19V5H5Z",vC="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",bC="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",yC="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",wC="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",SC="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",ng="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",xC="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",EC="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",TC="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",PC="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",OC="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",rg="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",_C="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",AC="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",LC="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",MC="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",NC="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",$C="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",kC="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",IC="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",VC="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",HC="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",jC="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",DC="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",BC="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",zC="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",UC="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",WC="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",GC="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",qC="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",KC="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",ZC="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",YC="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",XC="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",QC="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",RC="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",e2="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",t2="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",n2="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",r2="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",o2="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",s2="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",a2="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",i2="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",l2="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",c2="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",u2="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",d2="M11 15H6L13 1V9H18L11 23V15Z",f2="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",p2="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",h2="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",g2="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",m2="M7,10L12,15L17,10H7Z",v2="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",b2="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",y2="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",w2="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",S2="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",og="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",x2="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",E2="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",T2="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",P2="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",O2="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",_2="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",A2="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",L2="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",M2="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",N2="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",$2="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",k2="M18,18H6V6H18V18Z",I2="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",V2="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",H2="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",j2="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",D2="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",B2="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",z2="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",U2="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",W2="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",G2="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",q2="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",K2="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",Z2="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 ae=Z;function Z(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(o=>typeof o=="string"?o.split(" ").map(s=>{if(s=s.replace(/gjs-/g,"gs-utl-"),!s.includes("gs-utl-")&&!s.startsWith("gs-")){const a=s.split(":"),i=a.pop(),l=a.join(":"),u=i==null?void 0:i.startsWith("!"),f=`gs-utl-${u?i==null?void 0:i.slice(1):i}`,p=u?`!${f}`:f;return l?`${l}:${p}`:p}return s}):o).join(" ")}const I=h.forwardRef(function({as:t,children:n,className:r,col:o,revert:s,full:a,nowrap:i,space:l,gap:u,justify:d,items:f,...p},g){const m=t||"div";return c.jsx(m,{ref:g,className:Z([r,"gs-utl-flex",o&&!s&&"gs-utl-flex-col",o&&s&&"gs-utl-flex-col-reverse",!o&&s&&"gs-utl-flex-row-reverse",a&&!o&&"gs-utl-w-full",a&&o&&"gs-utl-h-full",i?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(o?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(o?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(o?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(o?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(o?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(o?"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",f==="start"&&"gs-utl-items-start",f==="end"&&"gs-utl-items-end",f==="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"]),...p,children:n})}),B=h.forwardRef(function({children:t,className:n,grow:r,...o},s){return c.jsx("div",{ref:s,className:Z([n,r&&"flex-1"]),...o,children:t})});function Uu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Wu={exports:{}},Gu,sg;function Y2(){if(sg)return Gu;sg=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Gu=e,Gu}var qu,ag;function X2(){if(ag)return qu;ag=1;var e=Y2();function t(){}function n(){}return n.resetWarningCache=t,qu=function(){function r(a,i,l,u,d,f){if(f!==e){var p=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 p.name="Invariant Violation",p}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},qu}var ig;function J2(){return ig||(ig=1,Wu.exports=X2()()),Wu.exports}var Q2=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(r,o,s){n.o(r,o)||Object.defineProperty(r,o,{enumerable:!0,get:s})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,o){if(1&o&&(r=n(r)),8&o||4&o&&typeof r=="object"&&r&&r.__esModule)return r;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),2&o&&typeof r!="string")for(var a in r)n.d(s,a,(function(i){return r[i]}).bind(null,a));return s},n.n=function(r){var o=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(o,"a",o),o},n.o=function(r,o){return Object.prototype.hasOwnProperty.call(r,o)},n.p="",n(n.s=2)}([function(e,t){e.exports=J2()},function(e,t){e.exports=h},function(e,t,n){n.r(t);var r=n(1),o=n(0),s=function(){return(s=Object.assign||function(m){for(var v,b=1,w=arguments.length;b<w;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},a=function(m,v){var b={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&v.indexOf(w)<0&&(b[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)v.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(b[w[y]]=m[w[y]])}return b},i=0,l=r.forwardRef(function(m,v){var b=m.title,w=b===void 0?null:b,y=m.description,S=y===void 0?null:y,C=m.size,x=C===void 0?null:C,E=m.color,T=E===void 0?"currentColor":E,_=m.horizontal,O=_===void 0?null:_,P=m.vertical,A=P===void 0?null:P,M=m.rotate,$=M===void 0?null:M,j=m.spin,L=j===void 0?null:j,D=m.style,W=D===void 0?{}:D,F=m.children,k=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);i++;var H,V=L!==null&&L,U=r.Children.map(F,function(Q){var ee=Q;V!==!0&&(V=(L===null?ee.props.spin:L)===!0);var G=ee.props.size;typeof x=="number"&&typeof ee.props.size=="number"&&(G=ee.props.size/x);var R={size:G,color:T===null?ee.props.color:T,horizontal:O===null?ee.props.horizontal:O,vertical:A===null?ee.props.vertical:A,rotate:$===null?ee.props.rotate:$,spin:L===null?ee.props.spin:L,inStack:!0};return r.cloneElement(ee,R)});x!==null&&(W.width=typeof x=="string"?x:1.5*x+"rem");var J,Y="stack_labelledby_"+i,X="stack_describedby_"+i;if(w)H=S?Y+" "+X:Y;else if(J="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:v,viewBox:"0 0 24 24",style:W,role:J,"aria-labelledby":H},k),w&&r.createElement("title",{id:Y},w),S&&r.createElement("desc",{id:X},S),V&&r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),U)});l.displayName="Stack",l.propTypes={size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),children:o.oneOfType([o.arrayOf(o.node),o.node]).isRequired,className:o.string,style:o.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,w=arguments.length;b<w;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},f=function(m,v){var b={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&v.indexOf(w)<0&&(b[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)v.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(b[w[y]]=m[w[y]])}return b},p=0,g=r.forwardRef(function(m,v){var b=m.path,w=m.id,y=w===void 0?++p:w,S=m.title,C=S===void 0?null:S,x=m.description,E=x===void 0?null:x,T=m.size,_=T===void 0?null:T,O=m.color,P=O===void 0?"currentColor":O,A=m.horizontal,M=A!==void 0&&A,$=m.vertical,j=$!==void 0&&$,L=m.rotate,D=L===void 0?0:L,W=m.spin,F=W!==void 0&&W,k=m.style,H=k===void 0?{}:k,V=m.inStack,U=V!==void 0&&V,J=f(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Y={},X=[];_!==null&&(U?X.push("scale("+_+")"):(H.width=typeof _=="string"?_:1.5*_+"rem",H.height=H.width)),M&&X.push("scaleX(-1)"),j&&X.push("scaleY(-1)"),D!==0&&X.push("rotate("+D+"deg)"),P!==null&&(Y.fill=P);var Q=r.createElement("path",d({d:b,style:Y},U?J:{})),ee=Q;X.length>0&&(H.transform=X.join(" "),H.transformOrigin="center",U&&(ee=r.createElement("g",{style:H},Q,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var G,R=ee,le=F===!0||typeof F!="number"?2:F,ge=!U&&(M||j);if(le<0&&(ge=!ge),F&&(R=r.createElement("g",{style:{animation:"spin"+(ge?"-inverse":"")+" linear "+Math.abs(le)+"s infinite",transformOrigin:"center"}},ee,!(M||j||D!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),U)return R;var Ee,Ce="icon_labelledby_"+y,tt="icon_describedby_"+y;if(C)G=E?Ce+" "+tt:Ce;else if(Ee="presentation",E)throw new Error("title attribute required when description is set");return r.createElement("svg",d({ref:v,viewBox:"0 0 24 24",style:H,role:Ee,"aria-labelledby":G},J),C&&r.createElement("title",{id:Ce},C),E&&r.createElement("desc",{id:tt},E),!U&&F&&(ge?r.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),R)});g.displayName="Icon",g.propTypes={path:o.string.isRequired,size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),style:o.object,inStack:o.bool,className:o.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const Ba=Uu(Q2);var lg={exports:{}};/*!
1
+ (function(on,ar){typeof exports=="object"&&typeof module<"u"?module.exports=ar(require("@ai-sdk/react"),require("ai"),require("react/jsx-runtime"),require("react"),require("react-dom"),require("react-dom/client"),require("marked"),require("react-markdown"),require("remark-gfm")):typeof define=="function"&&define.amd?define(["@ai-sdk/react","ai","react/jsx-runtime","react","react-dom","react-dom/client","marked","react-markdown","remark-gfm"],ar):(on=typeof globalThis<"u"?globalThis:on||self,on.StudioSdkPlugins_aiChat=ar(on.AiSdkReact,on.Ai,on.jsxRuntime,on.React,on.ReactDOM,on.ReactDOMClient,on.Marked,on.ReactMarkdown,on.RemarkGfm))})(this,function(on,ar,c,h,zn,AS,LS,MS,NS){"use strict";function Zh(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const nt=Zh(h),kS=Zh(zn),Yh="app.grapesjs.com",Xh="app-stage.grapesjs.com",Jh=[Yh,"app2.grapesjs.com",Xh,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],$S="license:check:start",Bu="license:check:end",Or=()=>typeof window<"u",hs=e=>e&&e.stopPropagation(),IS=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),VS=(e,t)=>{const n=r=>r.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},HS=(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)},jS=e=>VS("Escape",e),DS=(e,t={})=>{const n=ct(e)?{id:e,src:e}:e;return new Promise((r,o)=>{var f,g;const{loadedScripts:s}=t,{id:a,src:i}=n,l=document.querySelector(`script[src="${i}"]`);if(l){if((f=t.onScript)==null||f.call(t,l),s&&!s.get(i)){l.addEventListener("load",()=>r(a)),l.addEventListener("error",()=>o(a));return}return r(a)}const u=window.define;window.define=void 0;const d=()=>{s==null||s.set(i,!0),window.define=u},p=document.createElement("script");p.src=i,p.onload=()=>{r(a),d()},p.onerror=()=>{o(a),d()},document.head.appendChild(p),(g=t.onScript)==null||g.call(t,p)})},FS=e=>{const t=e.map(n=>DS(n));return Promise.allSettled(t)};function BS(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 Qh(e){const t=r=>{var o;if(r.length){const s=r.shift(),a=BS(s);a.onerror=a.onload=t.bind(null,r),(o=s.parentNode)==null||o.replaceChild(a,s)}},n=Array.from(e.querySelectorAll("script"));t(n)}const Rh=e=>new DOMParser().parseFromString(e,"text/html"),zS=(e="")=>Rh(`<body>${e}</body>`).body.innerHTML,US=(e="")=>Rh(`<head>${e}</head>`).head.innerHTML,WS=(e="",t)=>{const r=new DOMParser().parseFromString(e,"text/html");if(t){const s=r.querySelectorAll("svg")[0].style||{},a=XS(t)?`${t}px`:t;s.width=a,s.height=a,s.fill="currentColor"}return new XMLSerializer().serializeToString(r)},zu=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?Xh:Yh}`}/${n?"platform-api":"api"}`,GS=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},eg=(e={})=>{const{width:t=300,height:n,text:r="IMAGE",bg:o="777",fg:s="white"}=e,a=n?`x${n}`:"";return`https://placehold.co/${t}${a}/${o}/${s}.png?text=${r}`},qS=eg(),Uu=()=>{const e=Or()&&window.location.hostname;return!!e&&(Jh.includes(e)||Jh.some(t=>e.endsWith(t)))},_r=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),KS=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),ZS=()=>{},YS=240,Vt=e=>typeof e<"u",ct=e=>typeof e=="string",XS=e=>typeof e=="number";function et(e){return typeof e=="function"}function to(e){return e&&!Array.isArray(e)&&typeof e=="object"}const JS=e=>!e||Object.keys(e).length===0,Ys=(e,t)=>{const n=(e||"").toLocaleLowerCase(),r=(t||"").toLocaleLowerCase();return n.includes(r)},QS=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},RS=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length;for(let o=0;o<e;o++)t+=n.charAt(Math.floor(Math.random()*r));return t},eC=e=>!!e.Components.getType("mjml"),Cl=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),tC=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(s,a)=>{const i=a.trim();return!i||!n.has(i)?"":`__var__${i}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(s,a)=>`{{ ${a} }}`)};async function nC({path:e,baseApiUrl:t,method:n="GET",headers:r={},params:o,body:s}){const i=`${t||zu({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...r}};s&&(l.body=JSON.stringify(s));const u=o?new URLSearchParams(o).toString():"",d=u?`?${u}`:"",p=await fetch(`${i}${d}`,l);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var Xs=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Xs||{}),sn=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(sn||{}),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||{}),On=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(On||{}),xo=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(xo||{}),xt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(xt||{});const tg={[Xs.free]:0,[Xs.startup]:10,[Xs.business]:20,[Xs.enterprise]:30};function rC(e){const t=e;return t.init=n=>r=>e(r,n),t}const oC=e=>rC(e);async function sC({editor:e,plan:t,pluginName:n,licenseKey:r,onLicenseCheckResponse:o,cleanup:s}){let a="",i;const l=p=>{console.warn("Cleanup plugin:",n,"Reason:",p),s()},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 w=tg[t],y=tg[m];w>y&&l({pluginRequiredPlan:t,licensePlan:m})}};e.Commands.has(ne.settings)&&(i=e.runCommand(ne.settings),a=(i==null?void 0:i.baseUrl)||"");const d=p=>{o==null||o(p),p&&u(p)};if(!i){e.onReady(async()=>{if(!Uu())if(r){const p=await iC({licenseKey:r,pluginName:n,baseApiUrl:a});d(p)}else l("The `licenseKey` option not provided")});return}if(i.licensePlan||i.licenseError){const p=aC(i);d(p);return}e.on(Bu,p=>d(p))}const aC=e=>({sdkLicense:e.license,license:e.license,error:e.licenseError,plan:e.licensePlan});async function iC(e){const{licenseKey:t,pluginName:n,baseApiUrl:r}=e;try{return(await nC({baseApiUrl:r,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(o){return console.error("Error during SDK license check:",o),!1}}var lC="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",cC="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",uC="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",dC="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",pC="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",fC="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",hC="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",gC="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",mC="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",vC="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",bC="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",yC="M3,21V3H21V21H3M5,5V19H19V5H5Z",wC="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",SC="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",CC="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",xC="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",EC="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",ng="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",TC="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",PC="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",OC="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",_C="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",AC="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",LC="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",rg="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",MC="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",kC="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",$C="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",IC="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",VC="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",HC="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",jC="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",DC="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",FC="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",BC="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",zC="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",UC="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",WC="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",qC="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",KC="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",ZC="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",JC="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",QC="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",RC="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",e2="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",t2="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",n2="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",r2="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",o2="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",s2="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",a2="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",i2="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",l2="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",c2="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",u2="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",d2="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",p2="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",f2="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",h2="M11 15H6L13 1V9H18L11 23V15Z",g2="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",m2="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",v2="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",b2="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",y2="M7,10L12,15L17,10H7Z",w2="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",S2="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",C2="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",x2="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",E2="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",og="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",T2="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",P2="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",O2="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",_2="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",A2="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",L2="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",M2="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",k2="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",$2="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",I2="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",V2="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",H2="M18,18H6V6H18V18Z",j2="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",D2="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",F2="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",B2="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",z2="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",U2="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",W2="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",q2="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",K2="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",Z2="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",J2="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 ae=Z;function Z(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(o=>typeof o=="string"?o.split(" ").map(s=>{if(s=s.replace(/gjs-/g,"gs-utl-"),!s.includes("gs-utl-")&&!s.startsWith("gs-")){const a=s.split(":"),i=a.pop(),l=a.join(":"),u=i==null?void 0:i.startsWith("!"),p=`gs-utl-${u?i==null?void 0:i.slice(1):i}`,f=u?`!${p}`:p;return l?`${l}:${f}`:f}return s}):o).join(" ")}const Q2=Number.parseInt(h.version,10)||0,qt=e=>{if(Q2>=19){const t=n=>e(n,n.ref??null);return t.displayName=e.displayName??e.name,t}return h.forwardRef(e)},I=qt(function({as:t,children:n,className:r,col:o,revert:s,full:a,nowrap:i,space:l,gap:u,justify:d,items:p,...f},g){const m=t||"div";return c.jsx(m,{ref:g,className:Z([r,"gs-utl-flex",o&&!s&&"gs-utl-flex-col",o&&s&&"gs-utl-flex-col-reverse",!o&&s&&"gs-utl-flex-row-reverse",a&&!o&&"gs-utl-w-full",a&&o&&"gs-utl-h-full",i?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(o?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(o?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(o?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(o?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(o?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(o?"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})}),B=qt(function({children:t,className:n,grow:r,...o},s){return c.jsx("div",{ref:s,className:Z([n,r&&"flex-1"]),...o,children:t})});function Wu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Gu={exports:{}},qu,sg;function R2(){if(sg)return qu;sg=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return qu=e,qu}var Ku,ag;function ex(){if(ag)return Ku;ag=1;var e=R2();function t(){}function n(){}return n.resetWarningCache=t,Ku=function(){function r(a,i,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}}r.isRequired=r;function o(){return r}var s={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:o,element:r,elementType:r,instanceOf:o,node:r,objectOf:o,oneOf:o,oneOfType:o,shape:o,exact:o,checkPropTypes:n,resetWarningCache:t};return s.PropTypes=s,s},Ku}var ig;function tx(){return ig||(ig=1,Gu.exports=ex()()),Gu.exports}var nx=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(r,o,s){n.o(r,o)||Object.defineProperty(r,o,{enumerable:!0,get:s})},n.r=function(r){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(r,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(r,"__esModule",{value:!0})},n.t=function(r,o){if(1&o&&(r=n(r)),8&o||4&o&&typeof r=="object"&&r&&r.__esModule)return r;var s=Object.create(null);if(n.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:r}),2&o&&typeof r!="string")for(var a in r)n.d(s,a,(function(i){return r[i]}).bind(null,a));return s},n.n=function(r){var o=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(o,"a",o),o},n.o=function(r,o){return Object.prototype.hasOwnProperty.call(r,o)},n.p="",n(n.s=2)}([function(e,t){e.exports=tx()},function(e,t){e.exports=h},function(e,t,n){n.r(t);var r=n(1),o=n(0),s=function(){return(s=Object.assign||function(m){for(var v,b=1,w=arguments.length;b<w;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},a=function(m,v){var b={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&v.indexOf(w)<0&&(b[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)v.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(b[w[y]]=m[w[y]])}return b},i=0,l=r.forwardRef(function(m,v){var b=m.title,w=b===void 0?null:b,y=m.description,S=y===void 0?null:y,C=m.size,x=C===void 0?null:C,E=m.color,T=E===void 0?"currentColor":E,_=m.horizontal,O=_===void 0?null:_,P=m.vertical,A=P===void 0?null:P,M=m.rotate,k=M===void 0?null:M,j=m.spin,L=j===void 0?null:j,D=m.style,W=D===void 0?{}:D,F=m.children,$=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);i++;var H,V=L!==null&&L,U=r.Children.map(F,function(Q){var ee=Q;V!==!0&&(V=(L===null?ee.props.spin:L)===!0);var G=ee.props.size;typeof x=="number"&&typeof ee.props.size=="number"&&(G=ee.props.size/x);var R={size:G,color:T===null?ee.props.color:T,horizontal:O===null?ee.props.horizontal:O,vertical:A===null?ee.props.vertical:A,rotate:k===null?ee.props.rotate:k,spin:L===null?ee.props.spin:L,inStack:!0};return r.cloneElement(ee,R)});x!==null&&(W.width=typeof x=="string"?x:1.5*x+"rem");var J,Y="stack_labelledby_"+i,X="stack_describedby_"+i;if(w)H=S?Y+" "+X:Y;else if(J="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:v,viewBox:"0 0 24 24",style:W,role:J,"aria-labelledby":H},$),w&&r.createElement("title",{id:Y},w),S&&r.createElement("desc",{id:X},S),V&&r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),U)});l.displayName="Stack",l.propTypes={size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),children:o.oneOfType([o.arrayOf(o.node),o.node]).isRequired,className:o.string,style:o.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,w=arguments.length;b<w;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 w in m)Object.prototype.hasOwnProperty.call(m,w)&&v.indexOf(w)<0&&(b[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)v.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(b[w[y]]=m[w[y]])}return b},f=0,g=r.forwardRef(function(m,v){var b=m.path,w=m.id,y=w===void 0?++f:w,S=m.title,C=S===void 0?null:S,x=m.description,E=x===void 0?null:x,T=m.size,_=T===void 0?null:T,O=m.color,P=O===void 0?"currentColor":O,A=m.horizontal,M=A!==void 0&&A,k=m.vertical,j=k!==void 0&&k,L=m.rotate,D=L===void 0?0:L,W=m.spin,F=W!==void 0&&W,$=m.style,H=$===void 0?{}:$,V=m.inStack,U=V!==void 0&&V,J=p(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Y={},X=[];_!==null&&(U?X.push("scale("+_+")"):(H.width=typeof _=="string"?_:1.5*_+"rem",H.height=H.width)),M&&X.push("scaleX(-1)"),j&&X.push("scaleY(-1)"),D!==0&&X.push("rotate("+D+"deg)"),P!==null&&(Y.fill=P);var Q=r.createElement("path",d({d:b,style:Y},U?J:{})),ee=Q;X.length>0&&(H.transform=X.join(" "),H.transformOrigin="center",U&&(ee=r.createElement("g",{style:H},Q,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var G,R=ee,le=F===!0||typeof F!="number"?2:F,ge=!U&&(M||j);if(le<0&&(ge=!ge),F&&(R=r.createElement("g",{style:{animation:"spin"+(ge?"-inverse":"")+" linear "+Math.abs(le)+"s infinite",transformOrigin:"center"}},ee,!(M||j||D!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),U)return R;var Te,Ce="icon_labelledby_"+y,tt="icon_describedby_"+y;if(C)G=E?Ce+" "+tt:Ce;else if(Te="presentation",E)throw new Error("title attribute required when description is set");return r.createElement("svg",d({ref:v,viewBox:"0 0 24 24",style:H,role:Te,"aria-labelledby":G},J),C&&r.createElement("title",{id:Ce},C),E&&r.createElement("desc",{id:tt},E),!U&&F&&(ge?r.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),R)});g.displayName="Icon",g.propTypes={path:o.string.isRequired,size:o.oneOfType([o.number,o.string]),color:o.string,horizontal:o.bool,vertical:o.bool,rotate:o.number,spin:o.oneOfType([o.bool,o.number]),style:o.object,inStack:o.bool,className:o.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const za=Wu(nx);var lg={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 s="",a=0;a<arguments.length;a++){var i=arguments[a];i&&(s=o(s,r(i)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var i in s)t.call(s,i)&&s[i]&&(a=o(a,i));return a}function o(s,a){return a?s?s+" "+a:s+a:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(lg);var R2=lg.exports;const N=Uu(R2);var Yt={NODE_ENV:"production"};function We(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];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 ex={};function Cl(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:ex}var cg=Object.assign,xl=Object.getOwnPropertyDescriptor,Or=Object.defineProperty,za=Object.prototype,Ku=[];Object.freeze(Ku);var ug={};Object.freeze(ug);var tx=typeof Proxy<"u",nx=Object.toString();function dg(){tx||We("Proxy not available")}function fg(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Xs=function(){};function ar(e){return typeof e=="function"}function hs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function El(e){return e!==null&&typeof e=="object"}function eo(e){if(!El(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()===nx}function pg(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Ua(e,t,n){Or(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function hg(e,t,n){Or(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Co(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return El(r)&&r[n]===!0}}function Js(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function rx(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function to(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var gg=typeof Object.getOwnPropertySymbols<"u";function ox(e){var t=Object.keys(e);if(!gg)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return za.propertyIsEnumerable.call(e,r)})):t}var Qs=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:gg?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function mg(e){return e===null?null:typeof e=="object"?""+e:e}function no(e,t){return za.hasOwnProperty.call(e,t)}var sx=Object.getOwnPropertyDescriptors||function(t){var n={};return Qs(t).forEach(function(r){n[r]=xl(t,r)}),n};function On(e,t){return!!(e&t)}function _n(e,t,n){return n?e|=t:e&=~t,e}function vg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ax(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,lx(r.key),r)}}function Rs(e,t,n){return t&&ax(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ea(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=cx(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}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 gs(){return gs=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},gs.apply(null,arguments)}function bg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Zu(e,t)}function Zu(e,t){return Zu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Zu(e,t)}function ix(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function lx(e){var t=ix(e,"string");return typeof t=="symbol"?t:t+""}function cx(e,t){if(e){if(typeof e=="string")return vg(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)?vg(e,t):void 0}}var ir=Symbol("mobx-stored-annotations");function _r(e){function t(n,r){if(Ga(r))return e.decorate_20223_(n,r);Wa(n,r,e)}return Object.assign(t,e)}function Wa(e,t,n){no(e,ir)||Ua(e,ir,gs({},e[ir])),bx(n)||(e[ir][t]=n)}function ux(e){return no(e,ir)||Ua(e,ir,gs({},e[ir])),e[ir]}function Ga(e){return typeof e=="object"&&typeof e.kind=="string"}var xe=Symbol("mobx administration"),xo=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_=Xe.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(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Hg(this)},t.reportChanged=function(){Bn(),jg(this),zn()},t.toString=function(){return this.name_},Rs(e,[{key:"isBeingObserved",get:function(){return On(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=_n(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return On(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=_n(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return On(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=_n(this.flags_,e.diffValueMask_,r===1)}}])}();xo.isBeingObservedMask_=1,xo.isPendingUnobservationMask_=2,xo.diffValueMask_=4;var Yu=Co("Atom",xo);function yg(e,t,n){t===void 0&&(t=Xs),n===void 0&&(n=Xs);var r=new xo(e);return t!==Xs&&xE(r,t),n!==Xs&&Ug(r,n),r}function dx(e,t){return e===t}function fx(e,t){return hd(e,t)}function px(e,t){return hd(e,t,1)}function hx(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Tl={identity:dx,structural:fx,default:hx,shallow:px};function ms(e,t,n){return ld(e)?e:Array.isArray(e)?qt.array(e,{name:n}):eo(e)?qt.object(e,void 0,{name:n}):Js(e)?qt.map(e,{name:n}):to(e)?qt.set(e,{name:n}):typeof e=="function"&&!Xa(e)&&!Ja(e)?pg(e)?ws(e):Ya(n,e):e}function gx(e,t,n){if(e==null||ti(e)||ei(e)||Oo(e)||fr(e))return e;if(Array.isArray(e))return qt.array(e,{name:n,deep:!1});if(eo(e))return qt.object(e,void 0,{name:n,deep:!1});if(Js(e))return qt.map(e,{name:n,deep:!1});if(to(e))return qt.set(e,{name:n,deep:!1})}function Pl(e){return e}function mx(e,t){return hd(e,t)?t:e}var vx="override";function bx(e){return e.annotationType_===vx}function qa(e,t){return{annotationType_:e,options_:t,make_:yx,extend_:wx,decorate_20223_:Sx}}function yx(e,t,n,r){var o;if((o=this.options_)!=null&&o.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Xa(n.value))return 1;var s=wg(e,this,t,n,!1);return Or(r,t,s),2}function wx(e,t,n,r){var o=wg(e,this,t,n);return e.defineProperty_(t,o,r)}function Sx(e,t){var n=t.kind,r=t.name,o=t.addInitializer,s=this,a=function(u){var d,f,p,g;return vs((d=(f=s.options_)==null?void 0:f.name)!=null?d:r.toString(),u,(p=(g=s.options_)==null?void 0:g.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,d=l;return Xa(d)||(d=a(d)),(u=s.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var i;return Xa(e)||(e=a(e)),(i=this.options_)!=null&&i.bound&&o(function(){var l=this,u=l[r].bind(l);u.isMobxAction=!0,l[r]=u}),e}We("Cannot apply '"+s.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
7
- '`+s.annotationType_+"' can only be used on properties with a function value."))}function Cx(e,t,n,r){t.annotationType_,r.value}function wg(e,t,n,r,o){var s,a,i,l,u,d,f;o===void 0&&(o=fe.safeDescriptors),Cx(e,t,n,r);var p=r.value;if((s=t.options_)!=null&&s.bound){var g;p=p.bind((g=e.proxy_)!=null?g:e.target_)}return{value:vs((a=(i=t.options_)==null?void 0:i.name)!=null?a:n.toString(),p,(l=(u=t.options_)==null?void 0:u.autoAction)!=null?l:!1,(d=t.options_)!=null&&d.bound?(f=e.proxy_)!=null?f:e.target_:void 0),configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Sg(e,t){return{annotationType_:e,options_:t,make_:xx,extend_:Ex,decorate_20223_:Tx}}function xx(e,t,n,r){var o;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((o=this.options_)!=null&&o.bound&&(!no(e.target_,t)||!Ja(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Ja(n.value))return 1;var s=Cg(e,this,t,n,!1,!1);return Or(r,t,s),2}function Ex(e,t,n,r){var o,s=Cg(e,this,t,n,(o=this.options_)==null?void 0:o.bound);return e.defineProperty_(t,s,r)}function Tx(e,t){var n,r=t.name,o=t.addInitializer;return Ja(e)||(e=ws(e)),(n=this.options_)!=null&&n.bound&&o(function(){var s=this,a=s[r].bind(s);a.isMobXFlow=!0,s[r]=a}),e}function Px(e,t,n,r){t.annotationType_,r.value}function Cg(e,t,n,r,o,s){s===void 0&&(s=fe.safeDescriptors),Px(e,t,n,r);var a=r.value;if(Ja(a)||(a=ws(a)),o){var i;a=a.bind((i=e.proxy_)!=null?i:e.target_),a.isMobXFlow=!0}return{value:a,configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function Xu(e,t){return{annotationType_:e,options_:t,make_:Ox,extend_:_x,decorate_20223_:Ax}}function Ox(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function _x(e,t,n,r){return Lx(e,this,t,n),e.defineComputedProperty_(t,gs({},this.options_,{get:n.get,set:n.set}),r)}function Ax(e,t){var n=this,r=t.name,o=t.addInitializer;return o(function(){var s=Ss(this)[xe],a=gs({},n.options_,{get:e,context:this});a.name||(a.name="ObservableObject."+r.toString()),s.values_.set(r,new lr(a))}),function(){return this[xe].getObservablePropValue_(r)}}function Lx(e,t,n,r){t.annotationType_,r.get}function Ol(e,t){return{annotationType_:e,options_:t,make_:Mx,extend_:Nx,decorate_20223_:$x}}function Mx(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Nx(e,t,n,r){var o,s;return kx(e,this),e.defineObservableProperty_(t,n.value,(o=(s=this.options_)==null?void 0:s.enhancer)!=null?o:ms,r)}function $x(e,t){var n=this,r=t.kind,o=t.name,s=new WeakSet;function a(i,l){var u,d,f=Ss(i)[xe],p=new Eo(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:ms,"ObservableObject."+o.toString(),!1);f.values_.set(o,p),s.add(i)}if(r=="accessor")return{get:function(){return s.has(this)||a(this,e.get.call(this)),this[xe].getObservablePropValue_(o)},set:function(l){return s.has(this)||a(this,l),this[xe].setObservablePropValue_(o,l)},init:function(l){return s.has(this)||a(this,l),l}}}function kx(e,t,n,r){t.annotationType_}var Ix="true",Vx=xg();function xg(e){return{annotationType_:Ix,options_:e,make_:Hx,extend_:jx,decorate_20223_:Dx}}function Hx(e,t,n,r){var o,s;if(n.get)return Ll.make_(e,t,n,r);if(n.set){var a=vs(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(Or(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value=="function"){var i;if(pg(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?ws.bound:ws;return u.make_(e,t,n,r)}var d=(i=this.options_)!=null&&i.autoBind?Ya.bound:Ya;return d.make_(e,t,n,r)}var f=((o=this.options_)==null?void 0:o.deep)===!1?qt.ref:qt;if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return f.make_(e,t,n,r)}function jx(e,t,n,r){var o,s;if(n.get)return Ll.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:fe.safeDescriptors?e.isPlainObject_:!0,set:vs(t.toString(),n.set)},r);if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var a;n.value=n.value.bind((a=e.proxy_)!=null?a:e.target_)}var i=((s=this.options_)==null?void 0:s.deep)===!1?qt.ref:qt;return i.extend_(e,t,n,r)}function Dx(e,t){We("'"+this.annotationType_+"' cannot be used as a decorator")}var Fx="observable",Bx="observable.ref",zx="observable.shallow",Ux="observable.struct",Eg={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Eg);function _l(e){return e||Eg}var Ju=Ol(Fx),Wx=Ol(Bx,{enhancer:Pl}),Gx=Ol(zx,{enhancer:gx}),qx=Ol(Ux,{enhancer:mx}),Tg=_r(Ju);function Al(e){return e.deep===!0?ms:e.deep===!1?Pl:Zx(e.defaultDecorator)}function Kx(e){var t;return e?(t=e.defaultDecorator)!=null?t:xg(e):void 0}function Zx(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:ms}function Pg(e,t,n){if(Ga(t))return Ju.decorate_20223_(e,t);if(hs(t)){Wa(e,t,Ju);return}return ld(e)?e:eo(e)?qt.object(e,t,n):Array.isArray(e)?qt.array(e,t):Js(e)?qt.map(e,t):to(e)?qt.set(e,t):typeof e=="object"&&e!==null?e:qt.box(e,t)}cg(Pg,Tg);var Yx={box:function(t,n){var r=_l(n);return new Eo(t,Al(r),r.name,!0,r.equals)},array:function(t,n){var r=_l(n);return(fe.useProxies===!1||r.proxy===!1?ZE:jE)(t,Al(r),r.name)},map:function(t,n){var r=_l(n);return new Jg(t,Al(r),r.name)},set:function(t,n){var r=_l(n);return new Rg(t,Al(r),r.name)},object:function(t,n,r){return _o(function(){return Gg(fe.useProxies===!1||(r==null?void 0:r.proxy)===!1?Ss({},r):kE({},r),t,n)})},ref:_r(Wx),shallow:_r(Gx),deep:Tg,struct:_r(qx)},qt=cg(Pg,Yx),Og="computed",Xx="computed.struct",Qu=Xu(Og),Jx=Xu(Xx,{equals:Tl.structural}),Ll=function(t,n){if(Ga(n))return Qu.decorate_20223_(t,n);if(hs(n))return Wa(t,n,Qu);if(eo(t))return _r(Xu(Og,t));var r=eo(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new lr(r)};Object.assign(Ll,Qu),Ll.struct=_r(Jx);var _g,Ag,Ml=0,Qx=1,Rx=(_g=(Ag=xl(function(){},"name"))==null?void 0:Ag.configurable)!=null?_g:!1,Lg={value:"action",configurable:!0,writable:!1,enumerable:!1};function vs(e,t,n,r){n===void 0&&(n=!1);function o(){return eE(e,n,t,r||this,arguments)}return o.isMobxAction=!0,o.toString=function(){return t.toString()},Rx&&(Lg.value=e,Or(o,"name",Lg)),o}function eE(e,t,n,r,o){var s=tE(e,t);try{return n.apply(r,o)}catch(a){throw s.error_=a,a}finally{nE(s)}}function tE(e,t,n,r){var o=Yt.NODE_ENV!=="production",s=0,a=fe.trackingDerivation,i=!t||!a;Bn();var l=fe.allowStateChanges;i&&(bs(),l=Ru(!0));var u=rd(!0),d={runAsAction_:i,prevDerivation_:a,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:o,startTime_:s,actionId_:Qx++,parentActionId_:Ml};return Ml=d.actionId_,d}function nE(e){Ml!==e.actionId_&&We(30),Ml=e.parentActionId_,e.error_!==void 0&&(fe.suppressReactionErrors=!0),ed(e.prevAllowStateChanges_),Za(e.prevAllowStateReads_),zn(),e.runAsAction_&&ro(e.prevDerivation_),fe.suppressReactionErrors=!1}function Ru(e){var t=fe.allowStateChanges;return fe.allowStateChanges=e,t}function ed(e){fe.allowStateChanges=e}var Eo=function(e){function t(r,o,s,a,i){var l;return s===void 0&&(s="ObservableValue"),i===void 0&&(i=Tl.default),l=e.call(this,s)||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=o,l.name_=s,l.equals=i,l.value_=o(r,void 0,s),l}bg(t,e);var n=t.prototype;return n.dehanceValue=function(o){return this.dehancer!==void 0?this.dehancer(o):o},n.set=function(o){this.value_,o=this.prepareNewValue_(o),o!==fe.UNCHANGED&&this.setNewValue_(o)},n.prepareNewValue_=function(o){if(Un(this)){var s=Wn(this,{object:this,type:Ar,newValue:o});if(!s)return fe.UNCHANGED;o=s.newValue}return o=this.enhancer(o,this.value_,this.name_),this.equals(this.value_,o)?fe.UNCHANGED:o},n.setNewValue_=function(o){var s=this.value_;this.value_=o,this.reportChanged(),cr(this)&&ur(this,{type:Ar,object:this,newValue:o,oldValue:s})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(o){return Qa(this,o)},n.observe_=function(o,s){return s&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:Ar,newValue:this.value_,oldValue:void 0}),Ra(this,o)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return mg(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(xo),rE=Co("ObservableValue",Eo),lr=function(){function e(n){this.dependenciesState_=Xe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Xe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new $l(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Nl.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||We(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=vs("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Tl.structural:Tl.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){lE(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&We(32,this.name_,this.derivation),fe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)td(this)&&(this.warnAboutUntrackedRead_(),Bn(),this.value_=this.computeValue_(!1),zn());else if(Hg(this),td(this)){var r=fe.trackingContext;this.keepAlive_&&!r&&(fe.trackingContext=this),this.trackAndCompute()&&iE(this),fe.trackingContext=r}var o=this.value_;if(kl(o))throw o.cause;return o},t.set=function(r){if(this.setter_){this.isRunningSetter&&We(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else We(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,o=this.dependenciesState_===Xe.NOT_TRACKING_,s=this.computeValue_(!0),a=o||kl(r)||kl(s)||!this.equals_(r,s);return a&&(this.value_=s),a},t.computeValue_=function(r){this.isComputing=!0;var o=Ru(!1),s;if(r)s=Mg(this,this.derivation,this.scope_);else if(fe.disableErrorBoundaries===!0)s=this.derivation.call(this.scope_);else try{s=this.derivation.call(this.scope_)}catch(a){s=new $l(a)}return ed(o),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(nd(this),this.value_=void 0)},t.observe_=function(r,o){var s=this,a=!0,i=void 0;return bE(function(){var l=s.get();if(!a||o){var u=bs();r({observableKind:"computed",debugObjectName:s.name_,type:Ar,object:s,newValue:l,oldValue:i}),ro(u)}a=!1,i=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return mg(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Rs(e,[{key:"isComputing",get:function(){return On(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=_n(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return On(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=_n(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return On(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=_n(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return On(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=_n(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return On(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=_n(this.flags_,e.diffValueMask_,r===1)}}])}();lr.isComputingMask_=1,lr.isRunningSetterMask_=2,lr.isBeingObservedMask_=4,lr.isPendingUnobservationMask_=8,lr.diffValueMask_=16;var Ka=Co("ComputedValue",lr),Xe;(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_"})(Xe||(Xe={}));var Nl;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Nl||(Nl={}));var $l=function(t){this.cause=void 0,this.cause=t};function kl(e){return e instanceof $l}function td(e){switch(e.dependenciesState_){case Xe.UP_TO_DATE_:return!1;case Xe.NOT_TRACKING_:case Xe.STALE_:return!0;case Xe.POSSIBLY_STALE_:{for(var t=rd(!0),n=bs(),r=e.observing_,o=r.length,s=0;s<o;s++){var a=r[s];if(Ka(a)){if(fe.disableErrorBoundaries)a.get();else try{a.get()}catch{return ro(n),Za(t),!0}if(e.dependenciesState_===Xe.STALE_)return ro(n),Za(t),!0}}return $g(e),ro(n),Za(t),!1}}}function QH(e){}function Mg(e,t,n){var r=rd(!0);$g(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++fe.runId;var o=fe.trackingDerivation;fe.trackingDerivation=e,fe.inBatch++;var s;if(fe.disableErrorBoundaries===!0)s=t.call(n);else try{s=t.call(n)}catch(a){s=new $l(a)}return fe.inBatch--,fe.trackingDerivation=o,oE(e),Za(r),s}function oE(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=Xe.UP_TO_DATE_,o=0,s=e.unboundDepsCount_,a=0;a<s;a++){var i=n[a];i.diffValue===0&&(i.diffValue=1,o!==a&&(n[o]=i),o++),i.dependenciesState_>r&&(r=i.dependenciesState_)}for(n.length=o,e.newObserving_=null,s=t.length;s--;){var l=t[s];l.diffValue===0&&Ig(l,e),l.diffValue=0}for(;o--;){var u=n[o];u.diffValue===1&&(u.diffValue=0,aE(u,e))}r!==Xe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function nd(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Ig(t[n],e);e.dependenciesState_=Xe.NOT_TRACKING_}function Ng(e){var t=bs();try{return e()}finally{ro(t)}}function bs(){var e=fe.trackingDerivation;return fe.trackingDerivation=null,e}function ro(e){fe.trackingDerivation=e}function rd(e){var t=fe.allowStateReads;return fe.allowStateReads=e,t}function Za(e){fe.allowStateReads=e}function $g(e){if(e.dependenciesState_!==Xe.UP_TO_DATE_){e.dependenciesState_=Xe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Xe.UP_TO_DATE_}}var Il=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},Vl=!0,kg=!1,fe=function(){var e=Cl();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Vl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Il().version&&(Vl=!1),Vl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Il):(setTimeout(function(){kg||We(35)},1),new Il)}();function sE(){if((fe.pendingReactions.length||fe.inBatch||fe.isRunningReactions)&&We(36),kg=!0,Vl){var e=Cl();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),fe=new Il}}function aE(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Ig(e,t){e.observers_.delete(t),e.observers_.size===0&&Vg(e)}function Vg(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,fe.pendingUnobservations.push(e))}function Bn(){fe.inBatch++}function zn(){if(--fe.inBatch===0){Dg();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 lr&&n.suspend_())}fe.pendingUnobservations=[]}}function Hg(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&&Vg(e),!1)}function jg(e){e.lowestObserverState_!==Xe.STALE_&&(e.lowestObserverState_=Xe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Xe.STALE_}))}function iE(e){e.lowestObserverState_!==Xe.STALE_&&(e.lowestObserverState_=Xe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.POSSIBLY_STALE_?t.dependenciesState_=Xe.STALE_:t.dependenciesState_===Xe.UP_TO_DATE_&&(e.lowestObserverState_=Xe.UP_TO_DATE_)}))}function lE(e){e.lowestObserverState_===Xe.UP_TO_DATE_&&(e.lowestObserverState_=Xe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.UP_TO_DATE_&&(t.dependenciesState_=Xe.POSSIBLY_STALE_,t.onBecomeStale_())}))}var oo=function(){function e(n,r,o,s){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_=Xe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Nl.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=o,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,fe.pendingReactions.push(this),Dg())},t.runReaction_=function(){if(!this.isDisposed){Bn(),this.isScheduled=!1;var r=fe.trackingContext;if(fe.trackingContext=this,td(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Yt.NODE_ENV!=="production"&&this.isTrackPending&&ys()}catch(o){this.reportExceptionInDerivation_(o)}}fe.trackingContext=r,zn()}},t.track=function(r){if(!this.isDisposed){Bn(),this.isRunning=!0;var o=fe.trackingContext;fe.trackingContext=this;var s=Mg(this,r,void 0);fe.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&nd(this),kl(s)&&this.reportExceptionInDerivation_(s.cause),zn()}},t.reportExceptionInDerivation_=function(r){var o=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(fe.disableErrorBoundaries)throw r;var s="[mobx] uncaught error in '"+this+"'";fe.suppressReactionErrors||console.error(s,r),fe.globalReactionErrorHandlers.forEach(function(a){return a(r,o)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Bn(),nd(this),zn()))},t.getDisposer_=function(r){var o=this,s=function a(){o.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",s),s[xe]=this,s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},Rs(e,[{key:"isDisposed",get:function(){return On(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=_n(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return On(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=_n(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return On(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=_n(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return On(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=_n(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return On(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=_n(this.flags_,e.diffValueMask_,r===1)}}])}();oo.isDisposedMask_=1,oo.isScheduledMask_=2,oo.isTrackPendingMask_=4,oo.isRunningMask_=8,oo.diffValueMask_=16;var cE=100,od=function(t){return t()};function Dg(){fe.inBatch>0||fe.isRunningReactions||od(uE)}function uE(){fe.isRunningReactions=!0;for(var e=fe.pendingReactions,t=0;e.length>0;){++t===cE&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction_()}fe.isRunningReactions=!1}var Hl=Co("Reaction",oo);function dE(e){var t=od;od=function(r){return e(function(){return t(r)})}}function ys(){return Yt.NODE_ENV!=="production"}function RH(e){}function ej(e){}function tj(e){}function fE(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Fg="action",pE="action.bound",Bg="autoAction",hE="autoAction.bound",gE="<unnamed action>",sd=qa(Fg),mE=qa(pE,{bound:!0}),ad=qa(Bg,{autoAction:!0}),vE=qa(hE,{autoAction:!0,bound:!0});function zg(e){var t=function(r,o){if(ar(r))return vs(r.name||gE,r,e);if(ar(o))return vs(r,o,e);if(Ga(o))return(e?ad:sd).decorate_20223_(r,o);if(hs(o))return Wa(r,o,e?ad:sd);if(hs(r))return _r(qa(e?Bg:Fg,{name:r,autoAction:e}))};return t}var ta=zg(!1);Object.assign(ta,sd);var Ya=zg(!0);Object.assign(Ya,ad),ta.bound=_r(mE),Ya.bound=_r(vE);function Xa(e){return ar(e)&&e.isMobxAction===!0}function bE(e,t){var n,r,o,s;t===void 0&&(t=ug);var a=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",i=!t.scheduler&&!t.delay,l;if(i)l=new oo(a,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=wE(t),d=!1;l=new oo(a,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(f)}))},t.onError,t.requiresObservable)}function f(){e(l)}return(o=t)!=null&&(o=o.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((s=t)==null?void 0:s.signal)}var yE=function(t){return t()};function wE(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:yE}var SE="onBO",CE="onBUO";function xE(e,t,n){return Wg(SE,e,t,n)}function Ug(e,t,n){return Wg(CE,e,t,n)}function Wg(e,t,n,r){var o=zl(t),s=ar(r)?r:n,a=e+"L";return o[a]?o[a].add(s):o[a]=new Set([s]),function(){var i=o[a];i&&(i.delete(s),i.size===0&&delete o[a])}}var EE="never",jl="always",TE="observed";function PE(e){e.isolateGlobalState===!0&&sE();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(fe.useProxies=t===jl?!0:t===EE?!1:typeof Proxy<"u"),t==="ifavailable"&&(fe.verifyProxies=!0),n!==void 0){var r=n===jl?jl:n===TE;fe.enforceActions=r,fe.allowStateChanges=!(r===!0||r===jl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(o){o in e&&(fe[o]=!!e[o])}),fe.allowStateReads=!fe.observableRequiresReaction,e.reactionScheduler&&dE(e.reactionScheduler)}function Gg(e,t,n,r){var o=sx(t);return _o(function(){var s=Ss(e,r)[xe];Qs(o).forEach(function(a){s.extend_(a,o[a],n&&a in n?n[a]:!0)})}),e}function OE(e,t){return qg(zl(e,t))}function qg(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=_E(e.observing_).map(qg)),t}function _E(e){return Array.from(new Set(e))}var AE=0;function Kg(){this.message="FLOW_CANCELLED"}Kg.prototype=Object.create(Error.prototype);var id=Sg("flow"),LE=Sg("flow.bound",{bound:!0}),ws=Object.assign(function(t,n){if(Ga(n))return id.decorate_20223_(t,n);if(hs(n))return Wa(t,n,id);var r=t,o=r.name||"<unnamed flow>",s=function(){var i=this,l=arguments,u=++AE,d=ta(o+" - runid: "+u+" - init",r).apply(i,l),f,p=void 0,g=new Promise(function(m,v){var b=0;f=v;function w(C){p=void 0;var x;try{x=ta(o+" - runid: "+u+" - yield "+b++,d.next).call(d,C)}catch(E){return v(E)}S(x)}function y(C){p=void 0;var x;try{x=ta(o+" - runid: "+u+" - yield "+b++,d.throw).call(d,C)}catch(E){return v(E)}S(x)}function S(C){if(ar(C==null?void 0:C.then)){C.then(S,v);return}return C.done?m(C.value):(p=Promise.resolve(C.value),p.then(w,y))}w(void 0)});return g.cancel=ta(o+" - runid: "+u+" - cancel",function(){try{p&&Zg(p);var m=d.return(void 0),v=Promise.resolve(m.value);v.then(Xs,Xs),Zg(v),f(new Kg)}catch(b){f(b)}}),g};return s.isMobXFlow=!0,s},id);ws.bound=_r(LE);function Zg(e){ar(e.cancel)&&e.cancel()}function Ja(e){return(e==null?void 0:e.isMobXFlow)===!0}function ME(e,t){return e?ti(e)||!!e[xe]||Yu(e)||Hl(e)||Ka(e):!1}function ld(e){return ME(e)}function NE(e){if(ti(e))return e[xe].ownKeys_();We(38)}function Dl(e,t,n){return e.set(t,n),n}function na(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ld(e))return e;if(rE(e)||Ka(e))return na(e.get(),t);if(t.has(e))return t.get(e);if(ei(e)){var n=Dl(t,e,new Array(e.length));return e.forEach(function(a,i){n[i]=na(a,t)}),n}if(fr(e)){var r=Dl(t,e,new Set);return e.forEach(function(a){r.add(na(a,t))}),r}if(Oo(e)){var o=Dl(t,e,new Map);return e.forEach(function(a,i){o.set(i,na(a,t))}),o}else{var s=Dl(t,e,{});return NE(e).forEach(function(a){za.propertyIsEnumerable.call(e,a)&&(s[a]=na(e[a],t))}),s}}function To(e,t){return na(e,new Map)}function so(e,t){t===void 0&&(t=void 0),Bn();try{return e.apply(t)}finally{zn()}}function ra(e){return e[xe]}var $E={has:function(t,n){return ra(t).has_(n)},get:function(t,n){return ra(t).get_(n)},set:function(t,n,r){var o;return hs(n)?(o=ra(t).set_(n,r,!0))!=null?o:!0:!1},deleteProperty:function(t,n){var r;return hs(n)?(r=ra(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var o;return(o=ra(t).defineProperty_(n,r))!=null?o:!0},ownKeys:function(t){return ra(t).ownKeys_()},preventExtensions:function(t){We(13)}};function kE(e,t){var n,r;return dg(),e=Ss(e,t),(r=(n=e[xe]).proxy_)!=null?r:n.proxy_=new Proxy(e,$E)}function Un(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Qa(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),fg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Wn(e,t){var n=bs();try{for(var r=[].concat(e.interceptors_||[]),o=0,s=r.length;o<s&&(t=r[o](t),t&&!t.type&&We(14),!!t);o++);return t}finally{ro(n)}}function cr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function Ra(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),fg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function ur(e,t){var n=bs(),r=e.changeListeners_;if(r){r=r.slice();for(var o=0,s=r.length;o<s;o++)r[o](t);ro(n)}}function IE(e,t,n){return _o(function(){var r,o=Ss(e,n)[xe];Yt.NODE_ENV!=="production"&&t&&e[ir],(r=t)!=null||(t=ux(e)),Qs(t).forEach(function(s){return o.make_(s,t[s])})}),e}var cd=Symbol("mobx-keys");function sn(e,t,n){return eo(e)?Gg(e,e,t,n):(_o(function(){var r=Ss(e,n)[xe];if(!e[cd]){var o=Object.getPrototypeOf(e),s=new Set([].concat(Qs(e),Qs(o)));s.delete("constructor"),s.delete(xe),Ua(o,cd,s)}e[cd].forEach(function(a){return r.make_(a,t&&a in t?t[a]:!0)})}),e)}var Yg="splice",Ar="update",VE=1e4,HE={get:function(t,n){var r=t[xe];return n===xe?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):no(Fl,n)?Fl[n]:t[n]},set:function(t,n,r){var o=t[xe];return n==="length"&&o.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:o.set_(parseInt(n),r),!0},preventExtensions:function(){We(15)}},ud=function(){function e(n,r,o,s){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_=o,this.legacyMode_=s,this.atom_=new xo(n),this.enhancer_=function(a,i){return r(a,i,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Qa(this,r)},t.observe_=function(r,o){return o===void 0&&(o=!1),o&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),Ra(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&We("Out of range: "+r);var o=this.values_.length;if(r!==o)if(r>o){for(var s=new Array(r-o),a=0;a<r-o;a++)s[a]=void 0;this.spliceWithArray_(o,0,s)}else this.spliceWithArray_(r,o-r)},t.updateArrayLength_=function(r,o){r!==this.lastKnownLength_&&We(16),this.lastKnownLength_+=o,this.legacyMode_&&o>0&&l1(r+o+1)},t.spliceWithArray_=function(r,o,s){var a=this;this.atom_;var i=this.values_.length;if(r===void 0?r=0:r>i?r=i:r<0&&(r=Math.max(0,i+r)),arguments.length===1?o=i-r:o==null?o=0:o=Math.max(0,Math.min(o,i-r)),s===void 0&&(s=Ku),Un(this)){var l=Wn(this,{object:this.proxy_,type:Yg,index:r,removedCount:o,added:s});if(!l)return Ku;o=l.removedCount,s=l.added}if(s=s.length===0?s:s.map(function(f){return a.enhancer_(f,void 0)}),this.legacyMode_||Yt.NODE_ENV!=="production"){var u=s.length-o;this.updateArrayLength_(i,u)}var d=this.spliceItemsIntoValues_(r,o,s);return(o!==0||s.length!==0)&&this.notifyArraySplice_(r,s,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,o,s){if(s.length<VE){var a;return(a=this.values_).splice.apply(a,[r,o].concat(s))}else{var i=this.values_.slice(r,r+o),l=this.values_.slice(r+o);this.values_.length+=s.length-o;for(var u=0;u<s.length;u++)this.values_[r+u]=s[u];for(var d=0;d<l.length;d++)this.values_[r+s.length+d]=l[d];return i}},t.notifyArrayChildUpdate_=function(r,o,s){var a=!this.owned_&&ys(),i=cr(this),l=i||a?{observableKind:"array",object:this.proxy_,type:Ar,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:s}:null;this.atom_.reportChanged(),i&&ur(this,l)},t.notifyArraySplice_=function(r,o,s){var a=!this.owned_&&ys(),i=cr(this),l=i||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Yg,index:r,removed:s,added:o,removedCount:s.length,addedCount:o.length}:null;this.atom_.reportChanged(),i&&ur(this,l)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,o){var s=this.values_;if(this.legacyMode_&&r>s.length&&We(17,r,s.length),r<s.length){this.atom_;var a=s[r];if(Un(this)){var i=Wn(this,{type:Ar,object:this.proxy_,index:r,newValue:o});if(!i)return;o=i.newValue}o=this.enhancer_(o,a);var l=o!==a;l&&(s[r]=o,this.notifyArrayChildUpdate_(r,o,a))}else{for(var u=new Array(r+1-s.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=o,this.spliceWithArray_(s.length,0,u)}},e}();function jE(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),dg(),_o(function(){var o=new ud(n,t,r,!1);hg(o.values_,xe,o);var s=new Proxy(o.values_,HE);return o.proxy_=s,e&&e.length&&o.spliceWithArray_(0,0,e),s})}var Fl={clear:function(){return this.splice(0)},replace:function(t){var n=this[xe];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];var a=this[xe];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(t);case 2:return a.spliceWithArray_(t,n)}return a.spliceWithArray_(t,n,o)},spliceWithArray:function(t,n,r){return this[xe].spliceWithArray_(t,n,r)},push:function(){for(var t=this[xe],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[xe].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[xe],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return fe.trackingDerivation&&We(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){fe.trackingDerivation&&We(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[xe],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};vt("at",An),vt("concat",An),vt("flat",An),vt("includes",An),vt("indexOf",An),vt("join",An),vt("lastIndexOf",An),vt("slice",An),vt("toString",An),vt("toLocaleString",An),vt("toSorted",An),vt("toSpliced",An),vt("with",An),vt("every",dr),vt("filter",dr),vt("find",dr),vt("findIndex",dr),vt("findLast",dr),vt("findLastIndex",dr),vt("flatMap",dr),vt("forEach",dr),vt("map",dr),vt("some",dr),vt("toReversed",dr),vt("reduce",Xg),vt("reduceRight",Xg);function vt(e,t){typeof Array.prototype[e]=="function"&&(Fl[e]=t(e))}function An(e){return function(){var t=this[xe];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function dr(e){return function(t,n){var r=this,o=this[xe];o.atom_.reportObserved();var s=o.dehanceValues_(o.values_);return s[e](function(a,i){return t.call(n,a,i,r)})}}function Xg(e){return function(){var t=this,n=this[xe];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),o=arguments[0];return arguments[0]=function(s,a,i){return o(s,a,i,t)},r[e].apply(r,arguments)}}var DE=Co("ObservableArrayAdministration",ud);function ei(e){return El(e)&&DE(e[xe])}var FE={},Po="add",Bl="delete",Jg=function(){function e(n,r,o){var s=this;r===void 0&&(r=ms),o===void 0&&(o="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[xe]=FE,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_=r,this.name_=o,ar(Map)||We(18),_o(function(){s.keysAtom_=yg(Yt.NODE_ENV!=="production"?s.name_+".keys()":"ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,n&&s.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var o=this;if(!fe.trackingDerivation)return this.has_(r);var s=this.hasMap_.get(r);if(!s){var a=s=new Eo(this.has_(r),Pl,"ObservableMap.key?",!1);this.hasMap_.set(r,a),Ug(a,function(){return o.hasMap_.delete(r)})}return s.get()},t.set=function(r,o){var s=this.has_(r);if(Un(this)){var a=Wn(this,{type:s?Ar:Po,object:this,newValue:o,name:r});if(!a)return this;o=a.newValue}return s?this.updateValue_(r,o):this.addValue_(r,o),this},t.delete=function(r){var o=this;if(this.keysAtom_,Un(this)){var s=Wn(this,{type:Bl,object:this,name:r});if(!s)return!1}if(this.has_(r)){var a=ys(),i=cr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Bl,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return so(function(){var u;o.keysAtom_.reportChanged(),(u=o.hasMap_.get(r))==null||u.setNewValue_(!1);var d=o.data_.get(r);d.setNewValue_(void 0),o.data_.delete(r)}),i&&ur(this,l),!0}return!1},t.updateValue_=function(r,o){var s=this.data_.get(r);if(o=s.prepareNewValue_(o),o!==fe.UNCHANGED){var a=ys(),i=cr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Ar,object:this,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&ur(this,l)}},t.addValue_=function(r,o){var s=this;this.keysAtom_,so(function(){var u,d=new Eo(o,s.enhancer_,"ObservableMap.key",!1);s.data_.set(r,d),o=d.value_,(u=s.hasMap_.get(r))==null||u.setNewValue_(!0),s.keysAtom_.reportChanged()});var a=ys(),i=cr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Po,object:this,name:r,newValue:o}:null;i&&ur(this,l)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,o=this.keys();return Qg({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:r.get(l)}}})},t.entries=function(){var r=this,o=this.keys();return Qg({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,o){for(var s=ea(this),a;!(a=s()).done;){var i=a.value,l=i[0],u=i[1];r.call(o,u,l,this)}},t.merge=function(r){var o=this;return Oo(r)&&(r=new Map(r)),so(function(){eo(r)?ox(r).forEach(function(s){return o.set(s,r[s])}):Array.isArray(r)?r.forEach(function(s){var a=s[0],i=s[1];return o.set(a,i)}):Js(r)?(rx(r)||We(19,r),r.forEach(function(s,a){return o.set(a,s)})):r!=null&&We(20,r)}),this},t.clear=function(){var r=this;so(function(){Ng(function(){for(var o=ea(r.keys()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.replace=function(r){var o=this;return so(function(){for(var s=BE(r),a=new Map,i=!1,l=ea(o.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!s.has(d)){var f=o.delete(d);if(f)i=!0;else{var p=o.data_.get(d);a.set(d,p)}}}for(var g=ea(s.entries()),m;!(m=g()).done;){var v=m.value,b=v[0],w=v[1],y=o.data_.has(b);if(o.set(b,w),o.data_.has(b)){var S=o.data_.get(b);a.set(b,S),y||(i=!0)}}if(!i)if(o.data_.size!==a.size)o.keysAtom_.reportChanged();else for(var C=o.data_.keys(),x=a.keys(),E=C.next(),T=x.next();!E.done;){if(E.value!==T.value){o.keysAtom_.reportChanged();break}E=C.next(),T=x.next()}o.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,o){return Ra(this,r)},t.intercept_=function(r){return Qa(this,r)},Rs(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Oo=Co("ObservableMap",Jg);function Qg(e){return e[Symbol.toStringTag]="MapIterator",md(e)}function BE(e){if(Js(e)||Oo(e))return e;if(Array.isArray(e))return new Map(e);if(eo(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return We(21,e)}var zE={},Rg=function(){function e(n,r,o){var s=this;r===void 0&&(r=ms),o===void 0&&(o="ObservableSet"),this.name_=void 0,this[xe]=zE,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_=o,ar(Set)||We(22),this.enhancer_=function(a,i){return r(a,i,o)},_o(function(){s.atom_=yg(s.name_),n&&s.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;so(function(){Ng(function(){for(var o=ea(r.data_.values()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.forEach=function(r,o){for(var s=ea(this),a;!(a=s()).done;){var i=a.value;r.call(o,i,i,this)}},t.add=function(r){var o=this;if(this.atom_,Un(this)){var s=Wn(this,{type:Po,object:this,newValue:r});if(!s)return this}if(!this.has(r)){so(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var a=Yt.NODE_ENV!=="production",i=cr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Po,object:this,newValue:r}:null;i&&ur(this,l)}return this},t.delete=function(r){var o=this;if(Un(this)){var s=Wn(this,{type:Bl,object:this,oldValue:r});if(!s)return!1}if(this.has(r)){var a=Yt.NODE_ENV!=="production",i=cr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Bl,object:this,oldValue:r}:null;return so(function(){o.atom_.reportChanged(),o.data_.delete(r)}),i&&ur(this,l),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,o=Array.from(this.keys()),s=Array.from(this.values());return e1({next:function(){var i=r;return r+=1,i<s.length?{value:[o[i],s[i]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,o=0,s=Array.from(this.data_.values());return e1({next:function(){return o<s.length?{value:r.dehanceValue_(s[o++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(r){if(to(r)&&!fr(r))return r.intersection(this);var o=new Set(this);return o.intersection(r)},t.union=function(r){if(to(r)&&!fr(r))return r.union(this);var o=new Set(this);return o.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(to(r)&&!fr(r))return r.symmetricDifference(this);var o=new Set(this);return o.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(to(r)&&!fr(r))return r.isDisjointFrom(this);var o=new Set(this);return o.isDisjointFrom(r)},t.replace=function(r){var o=this;return fr(r)&&(r=new Set(r)),so(function(){Array.isArray(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):to(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):r!=null&&We("Cannot initialize set from "+r)}),this},t.observe_=function(r,o){return Ra(this,r)},t.intercept_=function(r){return Qa(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Rs(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),fr=Co("ObservableSet",Rg);function e1(e){return e[Symbol.toStringTag]="SetIterator",md(e)}var t1=Object.create(null),n1="remove",r1=function(){function e(n,r,o,s){r===void 0&&(r=new Map),s===void 0&&(s=Vx),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_=r,this.name_=o,this.defaultAnnotation_=s,this.keysAtom_=new xo("ObservableObject.keys"),this.isPlainObject_=eo(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,o){var s=this.values_.get(r);if(s instanceof lr)return s.set(o),!0;if(Un(this)){var a=Wn(this,{type:Ar,object:this.proxy_||this.target_,name:r,newValue:o});if(!a)return null;o=a.newValue}if(o=s.prepareNewValue_(o),o!==fe.UNCHANGED){var i=cr(this),l=Yt.NODE_ENV!=="production",u=i||l?{type:Ar,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&ur(this,u)}return!0},t.get_=function(r){return fe.trackingDerivation&&!no(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,o,s){return s===void 0&&(s=!1),no(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,o):s?Reflect.set(this.target_,r,o):(this.target_[r]=o,!0):this.extend_(r,{value:o,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,s)},t.has_=function(r){if(!fe.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var o=this.pendingKeys_.get(r);return o||(o=new Eo(r in this.target_,Pl,"ObservableObject.key?",!1),this.pendingKeys_.set(r,o)),o.get()},t.make_=function(r,o){if(o===!0&&(o=this.defaultAnnotation_),o!==!1){if(!(r in this.target_)){var s;if((s=this.target_[ir])!=null&&s[r])return;We(1,o.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==za;){var i=xl(a,r);if(i){var l=o.make_(this,r,i,a);if(l===0)return;if(l===1)break}a=Object.getPrototypeOf(a)}s1(this,o,r)}},t.extend_=function(r,o,s,a){if(a===void 0&&(a=!1),s===!0&&(s=this.defaultAnnotation_),s===!1)return this.defineProperty_(r,o,a);var i=s.extend_(this,r,o,a);return i&&s1(this,s,r),i},t.defineProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Bn();var a=this.delete_(r);if(!a)return a;if(Un(this)){var i=Wn(this,{object:this.proxy_||this.target_,name:r,type:Po,newValue:o.value});if(!i)return null;var l=i.newValue;o.value!==l&&(o=gs({},o,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,r,o))return!1}else Or(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{zn()}return!0},t.defineObservableProperty_=function(r,o,s,a){a===void 0&&(a=!1),this.keysAtom_;try{Bn();var i=this.delete_(r);if(!i)return i;if(Un(this)){var l=Wn(this,{object:this.proxy_||this.target_,name:r,type:Po,newValue:o});if(!l)return null;o=l.newValue}var u=o1(r),d={configurable:fe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Or(this.target_,r,d);var f=new Eo(o,s,Yt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,f),this.notifyPropertyAddition_(r,f.value_)}finally{zn()}return!0},t.defineComputedProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Bn();var a=this.delete_(r);if(!a)return a;if(Un(this)){var i=Wn(this,{object:this.proxy_||this.target_,name:r,type:Po,newValue:void 0});if(!i)return null}o.name||(o.name=Yt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),o.context=this.proxy_||this.target_;var l=o1(r),u={configurable:fe.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(s){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Or(this.target_,r,u);this.values_.set(r,new lr(o)),this.notifyPropertyAddition_(r,void 0)}finally{zn()}return!0},t.delete_=function(r,o){if(o===void 0&&(o=!1),this.keysAtom_,!no(this.target_,r))return!0;if(Un(this)){var s=Wn(this,{object:this.proxy_||this.target_,name:r,type:n1});if(!s)return null}try{var a;Bn();var i=cr(this),l=Yt.NODE_ENV!=="production"&&ys(),u=this.values_.get(r),d=void 0;if(!u&&(i||l)){var f;d=(f=xl(this.target_,r))==null?void 0:f.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(Yt.NODE_ENV,u&&(this.values_.delete(r),u instanceof Eo&&(d=u.value_),jg(u)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(r in this.target_),i||l){var p={type:n1,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};Yt.NODE_ENV,i&&ur(this,p),Yt.NODE_ENV}}finally{zn()}return!0},t.observe_=function(r,o){return Ra(this,r)},t.intercept_=function(r){return Qa(this,r)},t.notifyPropertyAddition_=function(r,o){var s,a=cr(this),i=Yt.NODE_ENV!=="production";if(a||i){var l=a||i?{type:Po,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;a&&ur(this,l)}(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Qs(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ss(e,t){var n;if(no(e,xe))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",o=new r1(e,new Map,String(r),Kx(t));return Ua(e,xe,o),e}var UE=Co("ObservableObjectAdministration",r1);function o1(e){return t1[e]||(t1[e]={get:function(){return this[xe].getObservablePropValue_(e)},set:function(n){return this[xe].setObservablePropValue_(e,n)}})}function ti(e){return El(e)?UE(e[xe]):!1}function s1(e,t,n){var r;(r=e.target_[ir])==null||delete r[n]}var WE=i1(0),GE=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),dd=0,a1=function(){};function qE(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}qE(a1,Array.prototype);var fd=function(e){function t(r,o,s,a){var i;return s===void 0&&(s="ObservableArray"),a===void 0&&(a=!1),i=e.call(this)||this,_o(function(){var l=new ud(s,o,a,!0);l.proxy_=i,hg(i,xe,l),r&&r.length&&i.spliceWithArray(0,0,r),GE&&Object.defineProperty(i,"0",WE)}),i}bg(t,e);var n=t.prototype;return n.concat=function(){this[xe].atom_.reportObserved();for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return Array.prototype.concat.apply(this.slice(),s.map(function(i){return ei(i)?i.slice():i}))},n[Symbol.iterator]=function(){var r=this,o=0;return md({next:function(){return o<r.length?{value:r[o++],done:!1}:{done:!0,value:void 0}}})},Rs(t,[{key:"length",get:function(){return this[xe].getArrayLength_()},set:function(o){this[xe].setArrayLength_(o)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(a1);Object.entries(Fl).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Ua(fd.prototype,t,n)});function i1(e){return{enumerable:!1,configurable:!0,get:function(){return this[xe].get_(e)},set:function(n){this[xe].set_(e,n)}}}function KE(e){Or(fd.prototype,""+e,i1(e))}function l1(e){if(e>dd){for(var t=dd;t<e+100;t++)KE(t);dd=e}}l1(1e3);function ZE(e,t,n){return new fd(e,t,n)}function zl(e,t){if(typeof e=="object"&&e!==null){if(ei(e))return t!==void 0&&We(23),e[xe].atom_;if(fr(e))return e.atom_;if(Oo(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||We(25,t,pd(e)),n}if(ti(e)){if(!t)return We(26);var r=e[xe].values_.get(t);return r||We(27,t,pd(e)),r}if(Yu(e)||Ka(e)||Hl(e))return e}else if(ar(e)&&Hl(e[xe]))return e[xe];We(28)}function YE(e,t){if(e||We(29),Yu(e)||Ka(e)||Hl(e)||Oo(e)||fr(e))return e;if(e[xe])return e[xe];We(24,e)}function pd(e,t){var n;if(t!==void 0)n=zl(e,t);else{if(Xa(e))return e.name;ti(e)||Oo(e)||fr(e)?n=YE(e):n=zl(e)}return n.name_}function _o(e){var t=bs(),n=Ru(!0);Bn();try{return e()}finally{zn(),ed(n),ro(t)}}var c1=za.toString;function hd(e,t,n){return n===void 0&&(n=-1),gd(e,t,n)}function gd(e,t,n,r,o){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var s=typeof e;if(s!=="function"&&s!=="object"&&typeof t!="object")return!1;var a=c1.call(e);if(a!==c1.call(t))return!1;switch(a){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=u1(e),t=u1(t);var i=a==="[object Array]";if(!i){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(ar(l)&&l instanceof l&&ar(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],o=o||[];for(var d=r.length;d--;)if(r[d]===e)return o[d]===t;if(r.push(e),o.push(t),i){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!gd(e[d],t[d],n-1,r,o))return!1}else{var f=Object.keys(e),p;if(d=f.length,Object.keys(t).length!==d)return!1;for(;d--;)if(p=f[d],!(no(t,p)&&gd(e[p],t[p],n-1,r,o)))return!1}return r.pop(),o.pop(),!0}function u1(e){return ei(e)?e.slice():Js(e)||Oo(e)||to(e)||fr(e)?Array.from(e.entries()):e}var d1,XE=((d1=Cl().Iterator)==null?void 0:d1.prototype)||{};function md(e){return e[Symbol.iterator]=JE,Object.assign(Object.create(XE),e)}function JE(){return this}if(["Symbol","Map","Set"].forEach(function(e){var t=Cl();typeof t[e]>"u"&&We("MobX requires global '"+e+"' to be available or polyfilled")}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:fE,extras:{getDebugName:pd},$mobx:xe}),!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!IE)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function QE(e){e()}function RE(e){e||(e=QE),PE({reactionScheduler:e})}function eT(e){return OE(e)}var tT=1e4,nT=1e4,rT=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(r){r===void 0&&(r=tT),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var o=Date.now();n.registrations.forEach(function(s,a){o-s.registeredAt>=r&&(n.finalize(s.value),n.registrations.delete(a))}),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,r){this.registrations.set(r,{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,nT))}}),e}(),oT=typeof FinalizationRegistry<"u"?FinalizationRegistry:rT,vd=new oT(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),f1={exports:{}},bd={};/**
5
+ */(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var s="",a=0;a<arguments.length;a++){var i=arguments[a];i&&(s=o(s,r(i)))}return s}function r(s){if(typeof s=="string"||typeof s=="number")return s;if(typeof s!="object")return"";if(Array.isArray(s))return n.apply(null,s);if(s.toString!==Object.prototype.toString&&!s.toString.toString().includes("[native code]"))return s.toString();var a="";for(var i in s)t.call(s,i)&&s[i]&&(a=o(a,i));return a}function o(s,a){return a?s?s+" "+a:s+a:s}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(lg);var rx=lg.exports;const N=Wu(rx);var Xt={NODE_ENV:"production"};function We(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];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 ox={};function xl(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:ox}var cg=Object.assign,El=Object.getOwnPropertyDescriptor,Ar=Object.defineProperty,Ua=Object.prototype,Zu=[];Object.freeze(Zu);var ug={};Object.freeze(ug);var sx=typeof Proxy<"u",ax=Object.toString();function dg(){sx||We("Proxy not available")}function pg(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var Js=function(){};function ir(e){return typeof e=="function"}function gs(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function Tl(e){return e!==null&&typeof e=="object"}function no(e){if(!Tl(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()===ax}function fg(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Wa(e,t,n){Ar(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function hg(e,t,n){Ar(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Eo(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(r){return Tl(r)&&r[n]===!0}}function Qs(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function ix(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),r=Object.getPrototypeOf(n);return r===null}function ro(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var gg=typeof Object.getOwnPropertySymbols<"u";function lx(e){var t=Object.keys(e);if(!gg)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(r){return Ua.propertyIsEnumerable.call(e,r)})):t}var Rs=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:gg?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function mg(e){return e===null?null:typeof e=="object"?""+e:e}function oo(e,t){return Ua.hasOwnProperty.call(e,t)}var cx=Object.getOwnPropertyDescriptors||function(t){var n={};return Rs(t).forEach(function(r){n[r]=El(t,r)}),n};function _n(e,t){return!!(e&t)}function An(e,t,n){return n?e|=t:e&=~t,e}function vg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ux(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,px(r.key),r)}}function ea(e,t,n){return t&&ux(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ta(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=fx(e))||t){n&&(e=n);var r=0;return function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}}}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 ms(){return ms=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)({}).hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},ms.apply(null,arguments)}function bg(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,Yu(e,t)}function Yu(e,t){return Yu=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,r){return n.__proto__=r,n},Yu(e,t)}function dx(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t);if(typeof r!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function px(e){var t=dx(e,"string");return typeof t=="symbol"?t:t+""}function fx(e,t){if(e){if(typeof e=="string")return vg(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)?vg(e,t):void 0}}var lr=Symbol("mobx-stored-annotations");function Lr(e){function t(n,r){if(qa(r))return e.decorate_20223_(n,r);Ga(n,r,e)}return Object.assign(t,e)}function Ga(e,t,n){oo(e,lr)||Wa(e,lr,ms({},e[lr])),Cx(n)||(e[lr][t]=n)}function hx(e){return oo(e,lr)||Wa(e,lr,ms({},e[lr])),e[lr]}function qa(e){return typeof e=="object"&&typeof e.kind=="string"}var Ee=Symbol("mobx administration"),To=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_=Xe.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(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.reportObserved=function(){return Hg(this)},t.reportChanged=function(){Un(),jg(this),Wn()},t.toString=function(){return this.name_},ea(e,[{key:"isBeingObserved",get:function(){return _n(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=An(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return _n(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=An(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return _n(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=An(this.flags_,e.diffValueMask_,r===1)}}])}();To.isBeingObservedMask_=1,To.isPendingUnobservationMask_=2,To.diffValueMask_=4;var Xu=Eo("Atom",To);function yg(e,t,n){t===void 0&&(t=Js),n===void 0&&(n=Js);var r=new To(e);return t!==Js&&OE(r,t),n!==Js&&Ug(r,n),r}function gx(e,t){return e===t}function mx(e,t){return gd(e,t)}function vx(e,t){return gd(e,t,1)}function bx(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var Pl={identity:gx,structural:mx,default:bx,shallow:vx};function vs(e,t,n){return cd(e)?e:Array.isArray(e)?Kt.array(e,{name:n}):no(e)?Kt.object(e,void 0,{name:n}):Qs(e)?Kt.map(e,{name:n}):ro(e)?Kt.set(e,{name:n}):typeof e=="function"&&!Ja(e)&&!Qa(e)?fg(e)?Ss(e):Xa(n,e):e}function yx(e,t,n){if(e==null||ni(e)||ti(e)||_o(e)||hr(e))return e;if(Array.isArray(e))return Kt.array(e,{name:n,deep:!1});if(no(e))return Kt.object(e,void 0,{name:n,deep:!1});if(Qs(e))return Kt.map(e,{name:n,deep:!1});if(ro(e))return Kt.set(e,{name:n,deep:!1})}function Ol(e){return e}function wx(e,t){return gd(e,t)?t:e}var Sx="override";function Cx(e){return e.annotationType_===Sx}function Ka(e,t){return{annotationType_:e,options_:t,make_:xx,extend_:Ex,decorate_20223_:Tx}}function xx(e,t,n,r){var o;if((o=this.options_)!=null&&o.bound)return this.extend_(e,t,n,!1)===null?0:1;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(Ja(n.value))return 1;var s=wg(e,this,t,n,!1);return Ar(r,t,s),2}function Ex(e,t,n,r){var o=wg(e,this,t,n);return e.defineProperty_(t,o,r)}function Tx(e,t){var n=t.kind,r=t.name,o=t.addInitializer,s=this,a=function(u){var d,p,f,g;return bs((d=(p=s.options_)==null?void 0:p.name)!=null?d:r.toString(),u,(f=(g=s.options_)==null?void 0:g.autoAction)!=null?f:!1)};if(n=="field")return function(l){var u,d=l;return Ja(d)||(d=a(d)),(u=s.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var i;return Ja(e)||(e=a(e)),(i=this.options_)!=null&&i.bound&&o(function(){var l=this,u=l[r].bind(l);u.isMobxAction=!0,l[r]=u}),e}We("Cannot apply '"+s.annotationType_+"' to '"+String(r)+"' (kind: "+n+"):"+(`
7
+ '`+s.annotationType_+"' can only be used on properties with a function value."))}function Px(e,t,n,r){t.annotationType_,r.value}function wg(e,t,n,r,o){var s,a,i,l,u,d,p;o===void 0&&(o=pe.safeDescriptors),Px(e,t,n,r);var f=r.value;if((s=t.options_)!=null&&s.bound){var g;f=f.bind((g=e.proxy_)!=null?g:e.target_)}return{value:bs((a=(i=t.options_)==null?void 0:i.name)!=null?a: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:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Sg(e,t){return{annotationType_:e,options_:t,make_:Ox,extend_:_x,decorate_20223_:Ax}}function Ox(e,t,n,r){var o;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((o=this.options_)!=null&&o.bound&&(!oo(e.target_,t)||!Qa(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(Qa(n.value))return 1;var s=Cg(e,this,t,n,!1,!1);return Ar(r,t,s),2}function _x(e,t,n,r){var o,s=Cg(e,this,t,n,(o=this.options_)==null?void 0:o.bound);return e.defineProperty_(t,s,r)}function Ax(e,t){var n,r=t.name,o=t.addInitializer;return Qa(e)||(e=Ss(e)),(n=this.options_)!=null&&n.bound&&o(function(){var s=this,a=s[r].bind(s);a.isMobXFlow=!0,s[r]=a}),e}function Lx(e,t,n,r){t.annotationType_,r.value}function Cg(e,t,n,r,o,s){s===void 0&&(s=pe.safeDescriptors),Lx(e,t,n,r);var a=r.value;if(Qa(a)||(a=Ss(a)),o){var i;a=a.bind((i=e.proxy_)!=null?i:e.target_),a.isMobXFlow=!0}return{value:a,configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function Ju(e,t){return{annotationType_:e,options_:t,make_:Mx,extend_:Nx,decorate_20223_:kx}}function Mx(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Nx(e,t,n,r){return $x(e,this,t,n),e.defineComputedProperty_(t,ms({},this.options_,{get:n.get,set:n.set}),r)}function kx(e,t){var n=this,r=t.name,o=t.addInitializer;return o(function(){var s=Cs(this)[Ee],a=ms({},n.options_,{get:e,context:this});a.name||(a.name="ObservableObject."+r.toString()),s.values_.set(r,new cr(a))}),function(){return this[Ee].getObservablePropValue_(r)}}function $x(e,t,n,r){t.annotationType_,r.get}function _l(e,t){return{annotationType_:e,options_:t,make_:Ix,extend_:Vx,decorate_20223_:Hx}}function Ix(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function Vx(e,t,n,r){var o,s;return jx(e,this),e.defineObservableProperty_(t,n.value,(o=(s=this.options_)==null?void 0:s.enhancer)!=null?o:vs,r)}function Hx(e,t){var n=this,r=t.kind,o=t.name,s=new WeakSet;function a(i,l){var u,d,p=Cs(i)[Ee],f=new Po(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:vs,"ObservableObject."+o.toString(),!1);p.values_.set(o,f),s.add(i)}if(r=="accessor")return{get:function(){return s.has(this)||a(this,e.get.call(this)),this[Ee].getObservablePropValue_(o)},set:function(l){return s.has(this)||a(this,l),this[Ee].setObservablePropValue_(o,l)},init:function(l){return s.has(this)||a(this,l),l}}}function jx(e,t,n,r){t.annotationType_}var Dx="true",Fx=xg();function xg(e){return{annotationType_:Dx,options_:e,make_:Bx,extend_:zx,decorate_20223_:Ux}}function Bx(e,t,n,r){var o,s;if(n.get)return Ml.make_(e,t,n,r);if(n.set){var a=bs(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:pe.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(Ar(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value=="function"){var i;if(fg(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?Ss.bound:Ss;return u.make_(e,t,n,r)}var d=(i=this.options_)!=null&&i.autoBind?Xa.bound:Xa;return d.make_(e,t,n,r)}var p=((o=this.options_)==null?void 0:o.deep)===!1?Kt.ref:Kt;if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var f;n.value=n.value.bind((f=e.proxy_)!=null?f:e.target_)}return p.make_(e,t,n,r)}function zx(e,t,n,r){var o,s;if(n.get)return Ml.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:pe.safeDescriptors?e.isPlainObject_:!0,set:bs(t.toString(),n.set)},r);if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var a;n.value=n.value.bind((a=e.proxy_)!=null?a:e.target_)}var i=((s=this.options_)==null?void 0:s.deep)===!1?Kt.ref:Kt;return i.extend_(e,t,n,r)}function Ux(e,t){We("'"+this.annotationType_+"' cannot be used as a decorator")}var Wx="observable",Gx="observable.ref",qx="observable.shallow",Kx="observable.struct",Eg={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Eg);function Al(e){return e||Eg}var Qu=_l(Wx),Zx=_l(Gx,{enhancer:Ol}),Yx=_l(qx,{enhancer:yx}),Xx=_l(Kx,{enhancer:wx}),Tg=Lr(Qu);function Ll(e){return e.deep===!0?vs:e.deep===!1?Ol:Qx(e.defaultDecorator)}function Jx(e){var t;return e?(t=e.defaultDecorator)!=null?t:xg(e):void 0}function Qx(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:vs}function Pg(e,t,n){if(qa(t))return Qu.decorate_20223_(e,t);if(gs(t)){Ga(e,t,Qu);return}return cd(e)?e:no(e)?Kt.object(e,t,n):Array.isArray(e)?Kt.array(e,t):Qs(e)?Kt.map(e,t):ro(e)?Kt.set(e,t):typeof e=="object"&&e!==null?e:Kt.box(e,t)}cg(Pg,Tg);var Rx={box:function(t,n){var r=Al(n);return new Po(t,Ll(r),r.name,!0,r.equals)},array:function(t,n){var r=Al(n);return(pe.useProxies===!1||r.proxy===!1?QE:zE)(t,Ll(r),r.name)},map:function(t,n){var r=Al(n);return new Jg(t,Ll(r),r.name)},set:function(t,n){var r=Al(n);return new Rg(t,Ll(r),r.name)},object:function(t,n,r){return Ao(function(){return Gg(pe.useProxies===!1||(r==null?void 0:r.proxy)===!1?Cs({},r):jE({},r),t,n)})},ref:Lr(Zx),shallow:Lr(Yx),deep:Tg,struct:Lr(Xx)},Kt=cg(Pg,Rx),Og="computed",eE="computed.struct",Ru=Ju(Og),tE=Ju(eE,{equals:Pl.structural}),Ml=function(t,n){if(qa(n))return Ru.decorate_20223_(t,n);if(gs(n))return Ga(t,n,Ru);if(no(t))return Lr(Ju(Og,t));var r=no(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new cr(r)};Object.assign(Ml,Ru),Ml.struct=Lr(tE);var _g,Ag,Nl=0,nE=1,rE=(_g=(Ag=El(function(){},"name"))==null?void 0:Ag.configurable)!=null?_g:!1,Lg={value:"action",configurable:!0,writable:!1,enumerable:!1};function bs(e,t,n,r){n===void 0&&(n=!1);function o(){return oE(e,n,t,r||this,arguments)}return o.isMobxAction=!0,o.toString=function(){return t.toString()},rE&&(Lg.value=e,Ar(o,"name",Lg)),o}function oE(e,t,n,r,o){var s=sE(e,t);try{return n.apply(r,o)}catch(a){throw s.error_=a,a}finally{aE(s)}}function sE(e,t,n,r){var o=Xt.NODE_ENV!=="production",s=0,a=pe.trackingDerivation,i=!t||!a;Un();var l=pe.allowStateChanges;i&&(ys(),l=ed(!0));var u=od(!0),d={runAsAction_:i,prevDerivation_:a,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:o,startTime_:s,actionId_:nE++,parentActionId_:Nl};return Nl=d.actionId_,d}function aE(e){Nl!==e.actionId_&&We(30),Nl=e.parentActionId_,e.error_!==void 0&&(pe.suppressReactionErrors=!0),td(e.prevAllowStateChanges_),Ya(e.prevAllowStateReads_),Wn(),e.runAsAction_&&so(e.prevDerivation_),pe.suppressReactionErrors=!1}function ed(e){var t=pe.allowStateChanges;return pe.allowStateChanges=e,t}function td(e){pe.allowStateChanges=e}var Po=function(e){function t(r,o,s,a,i){var l;return s===void 0&&(s="ObservableValue"),i===void 0&&(i=Pl.default),l=e.call(this,s)||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=o,l.name_=s,l.equals=i,l.value_=o(r,void 0,s),l}bg(t,e);var n=t.prototype;return n.dehanceValue=function(o){return this.dehancer!==void 0?this.dehancer(o):o},n.set=function(o){this.value_,o=this.prepareNewValue_(o),o!==pe.UNCHANGED&&this.setNewValue_(o)},n.prepareNewValue_=function(o){if(Gn(this)){var s=qn(this,{object:this,type:Mr,newValue:o});if(!s)return pe.UNCHANGED;o=s.newValue}return o=this.enhancer(o,this.value_,this.name_),this.equals(this.value_,o)?pe.UNCHANGED:o},n.setNewValue_=function(o){var s=this.value_;this.value_=o,this.reportChanged(),dr(this)&&pr(this,{type:Mr,object:this,newValue:o,oldValue:s})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(o){return Ra(this,o)},n.observe_=function(o,s){return s&&o({observableKind:"value",debugObjectName:this.name_,object:this,type:Mr,newValue:this.value_,oldValue:void 0}),ei(this,o)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return mg(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(To),iE=Eo("ObservableValue",Po),cr=function(){function e(n){this.dependenciesState_=Xe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Xe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new $l(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=kl.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||We(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=bs("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?Pl.structural:Pl.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){pE(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(r){return r()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(r){return r()})},t.get=function(){if(this.isComputing&&We(32,this.name_,this.derivation),pe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)nd(this)&&(this.warnAboutUntrackedRead_(),Un(),this.value_=this.computeValue_(!1),Wn());else if(Hg(this),nd(this)){var r=pe.trackingContext;this.keepAlive_&&!r&&(pe.trackingContext=this),this.trackAndCompute()&&dE(this),pe.trackingContext=r}var o=this.value_;if(Il(o))throw o.cause;return o},t.set=function(r){if(this.setter_){this.isRunningSetter&&We(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else We(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,o=this.dependenciesState_===Xe.NOT_TRACKING_,s=this.computeValue_(!0),a=o||Il(r)||Il(s)||!this.equals_(r,s);return a&&(this.value_=s),a},t.computeValue_=function(r){this.isComputing=!0;var o=ed(!1),s;if(r)s=Mg(this,this.derivation,this.scope_);else if(pe.disableErrorBoundaries===!0)s=this.derivation.call(this.scope_);else try{s=this.derivation.call(this.scope_)}catch(a){s=new $l(a)}return td(o),this.isComputing=!1,s},t.suspend_=function(){this.keepAlive_||(rd(this),this.value_=void 0)},t.observe_=function(r,o){var s=this,a=!0,i=void 0;return CE(function(){var l=s.get();if(!a||o){var u=ys();r({observableKind:"computed",debugObjectName:s.name_,type:Mr,object:s,newValue:l,oldValue:i}),so(u)}a=!1,i=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return mg(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},ea(e,[{key:"isComputing",get:function(){return _n(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=An(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return _n(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=An(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return _n(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=An(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return _n(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=An(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return _n(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=An(this.flags_,e.diffValueMask_,r===1)}}])}();cr.isComputingMask_=1,cr.isRunningSetterMask_=2,cr.isBeingObservedMask_=4,cr.isPendingUnobservationMask_=8,cr.diffValueMask_=16;var Za=Eo("ComputedValue",cr),Xe;(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_"})(Xe||(Xe={}));var kl;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(kl||(kl={}));var $l=function(t){this.cause=void 0,this.cause=t};function Il(e){return e instanceof $l}function nd(e){switch(e.dependenciesState_){case Xe.UP_TO_DATE_:return!1;case Xe.NOT_TRACKING_:case Xe.STALE_:return!0;case Xe.POSSIBLY_STALE_:{for(var t=od(!0),n=ys(),r=e.observing_,o=r.length,s=0;s<o;s++){var a=r[s];if(Za(a)){if(pe.disableErrorBoundaries)a.get();else try{a.get()}catch{return so(n),Ya(t),!0}if(e.dependenciesState_===Xe.STALE_)return so(n),Ya(t),!0}}return kg(e),so(n),Ya(t),!1}}}function nj(e){}function Mg(e,t,n){var r=od(!0);kg(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++pe.runId;var o=pe.trackingDerivation;pe.trackingDerivation=e,pe.inBatch++;var s;if(pe.disableErrorBoundaries===!0)s=t.call(n);else try{s=t.call(n)}catch(a){s=new $l(a)}return pe.inBatch--,pe.trackingDerivation=o,lE(e),Ya(r),s}function lE(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=Xe.UP_TO_DATE_,o=0,s=e.unboundDepsCount_,a=0;a<s;a++){var i=n[a];i.diffValue===0&&(i.diffValue=1,o!==a&&(n[o]=i),o++),i.dependenciesState_>r&&(r=i.dependenciesState_)}for(n.length=o,e.newObserving_=null,s=t.length;s--;){var l=t[s];l.diffValue===0&&Ig(l,e),l.diffValue=0}for(;o--;){var u=n[o];u.diffValue===1&&(u.diffValue=0,uE(u,e))}r!==Xe.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function rd(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Ig(t[n],e);e.dependenciesState_=Xe.NOT_TRACKING_}function Ng(e){var t=ys();try{return e()}finally{so(t)}}function ys(){var e=pe.trackingDerivation;return pe.trackingDerivation=null,e}function so(e){pe.trackingDerivation=e}function od(e){var t=pe.allowStateReads;return pe.allowStateReads=e,t}function Ya(e){pe.allowStateReads=e}function kg(e){if(e.dependenciesState_!==Xe.UP_TO_DATE_){e.dependenciesState_=Xe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Xe.UP_TO_DATE_}}var Vl=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},Hl=!0,$g=!1,pe=function(){var e=xl();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Hl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Vl().version&&(Hl=!1),Hl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Vl):(setTimeout(function(){$g||We(35)},1),new Vl)}();function cE(){if((pe.pendingReactions.length||pe.inBatch||pe.isRunningReactions)&&We(36),$g=!0,Hl){var e=xl();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),pe=new Vl}}function uE(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Ig(e,t){e.observers_.delete(t),e.observers_.size===0&&Vg(e)}function Vg(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,pe.pendingUnobservations.push(e))}function Un(){pe.inBatch++}function Wn(){if(--pe.inBatch===0){Dg();for(var e=pe.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 cr&&n.suspend_())}pe.pendingUnobservations=[]}}function Hg(e){var t=pe.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&pe.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&pe.inBatch>0&&Vg(e),!1)}function jg(e){e.lowestObserverState_!==Xe.STALE_&&(e.lowestObserverState_=Xe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Xe.STALE_}))}function dE(e){e.lowestObserverState_!==Xe.STALE_&&(e.lowestObserverState_=Xe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.POSSIBLY_STALE_?t.dependenciesState_=Xe.STALE_:t.dependenciesState_===Xe.UP_TO_DATE_&&(e.lowestObserverState_=Xe.UP_TO_DATE_)}))}function pE(e){e.lowestObserverState_===Xe.UP_TO_DATE_&&(e.lowestObserverState_=Xe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Xe.UP_TO_DATE_&&(t.dependenciesState_=Xe.POSSIBLY_STALE_,t.onBecomeStale_())}))}var ao=function(){function e(n,r,o,s){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_=Xe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=kl.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=o,this.requiresObservable_=s}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,pe.pendingReactions.push(this),Dg())},t.runReaction_=function(){if(!this.isDisposed){Un(),this.isScheduled=!1;var r=pe.trackingContext;if(pe.trackingContext=this,nd(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Xt.NODE_ENV!=="production"&&this.isTrackPending&&ws()}catch(o){this.reportExceptionInDerivation_(o)}}pe.trackingContext=r,Wn()}},t.track=function(r){if(!this.isDisposed){Un(),this.isRunning=!0;var o=pe.trackingContext;pe.trackingContext=this;var s=Mg(this,r,void 0);pe.trackingContext=o,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&rd(this),Il(s)&&this.reportExceptionInDerivation_(s.cause),Wn()}},t.reportExceptionInDerivation_=function(r){var o=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(pe.disableErrorBoundaries)throw r;var s="[mobx] uncaught error in '"+this+"'";pe.suppressReactionErrors||console.error(s,r),pe.globalReactionErrorHandlers.forEach(function(a){return a(r,o)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Un(),rd(this),Wn()))},t.getDisposer_=function(r){var o=this,s=function a(){o.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",s),s[Ee]=this,s},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},ea(e,[{key:"isDisposed",get:function(){return _n(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=An(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return _n(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=An(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return _n(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=An(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return _n(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=An(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return _n(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=An(this.flags_,e.diffValueMask_,r===1)}}])}();ao.isDisposedMask_=1,ao.isScheduledMask_=2,ao.isTrackPendingMask_=4,ao.isRunningMask_=8,ao.diffValueMask_=16;var fE=100,sd=function(t){return t()};function Dg(){pe.inBatch>0||pe.isRunningReactions||sd(hE)}function hE(){pe.isRunningReactions=!0;for(var e=pe.pendingReactions,t=0;e.length>0;){++t===fE&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,o=n.length;r<o;r++)n[r].runReaction_()}pe.isRunningReactions=!1}var jl=Eo("Reaction",ao);function gE(e){var t=sd;sd=function(r){return e(function(){return t(r)})}}function ws(){return Xt.NODE_ENV!=="production"}function rj(e){}function oj(e){}function sj(e){}function mE(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Fg="action",vE="action.bound",Bg="autoAction",bE="autoAction.bound",yE="<unnamed action>",ad=Ka(Fg),wE=Ka(vE,{bound:!0}),id=Ka(Bg,{autoAction:!0}),SE=Ka(bE,{autoAction:!0,bound:!0});function zg(e){var t=function(r,o){if(ir(r))return bs(r.name||yE,r,e);if(ir(o))return bs(r,o,e);if(qa(o))return(e?id:ad).decorate_20223_(r,o);if(gs(o))return Ga(r,o,e?id:ad);if(gs(r))return Lr(Ka(e?Bg:Fg,{name:r,autoAction:e}))};return t}var na=zg(!1);Object.assign(na,ad);var Xa=zg(!0);Object.assign(Xa,id),na.bound=Lr(wE),Xa.bound=Lr(SE);function Ja(e){return ir(e)&&e.isMobxAction===!0}function CE(e,t){var n,r,o,s;t===void 0&&(t=ug);var a=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",i=!t.scheduler&&!t.delay,l;if(i)l=new ao(a,function(){this.track(p)},t.onError,t.requiresObservable);else{var u=EE(t),d=!1;l=new ao(a,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(p)}))},t.onError,t.requiresObservable)}function p(){e(l)}return(o=t)!=null&&(o=o.signal)!=null&&o.aborted||l.schedule_(),l.getDisposer_((s=t)==null?void 0:s.signal)}var xE=function(t){return t()};function EE(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:xE}var TE="onBO",PE="onBUO";function OE(e,t,n){return Wg(TE,e,t,n)}function Ug(e,t,n){return Wg(PE,e,t,n)}function Wg(e,t,n,r){var o=Ul(t),s=ir(r)?r:n,a=e+"L";return o[a]?o[a].add(s):o[a]=new Set([s]),function(){var i=o[a];i&&(i.delete(s),i.size===0&&delete o[a])}}var _E="never",Dl="always",AE="observed";function LE(e){e.isolateGlobalState===!0&&cE();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(pe.useProxies=t===Dl?!0:t===_E?!1:typeof Proxy<"u"),t==="ifavailable"&&(pe.verifyProxies=!0),n!==void 0){var r=n===Dl?Dl:n===AE;pe.enforceActions=r,pe.allowStateChanges=!(r===!0||r===Dl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(o){o in e&&(pe[o]=!!e[o])}),pe.allowStateReads=!pe.observableRequiresReaction,e.reactionScheduler&&gE(e.reactionScheduler)}function Gg(e,t,n,r){var o=cx(t);return Ao(function(){var s=Cs(e,r)[Ee];Rs(o).forEach(function(a){s.extend_(a,o[a],n&&a in n?n[a]:!0)})}),e}function ME(e,t){return qg(Ul(e,t))}function qg(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=NE(e.observing_).map(qg)),t}function NE(e){return Array.from(new Set(e))}var kE=0;function Kg(){this.message="FLOW_CANCELLED"}Kg.prototype=Object.create(Error.prototype);var ld=Sg("flow"),$E=Sg("flow.bound",{bound:!0}),Ss=Object.assign(function(t,n){if(qa(n))return ld.decorate_20223_(t,n);if(gs(n))return Ga(t,n,ld);var r=t,o=r.name||"<unnamed flow>",s=function(){var i=this,l=arguments,u=++kE,d=na(o+" - runid: "+u+" - init",r).apply(i,l),p,f=void 0,g=new Promise(function(m,v){var b=0;p=v;function w(C){f=void 0;var x;try{x=na(o+" - runid: "+u+" - yield "+b++,d.next).call(d,C)}catch(E){return v(E)}S(x)}function y(C){f=void 0;var x;try{x=na(o+" - runid: "+u+" - yield "+b++,d.throw).call(d,C)}catch(E){return v(E)}S(x)}function S(C){if(ir(C==null?void 0:C.then)){C.then(S,v);return}return C.done?m(C.value):(f=Promise.resolve(C.value),f.then(w,y))}w(void 0)});return g.cancel=na(o+" - runid: "+u+" - cancel",function(){try{f&&Zg(f);var m=d.return(void 0),v=Promise.resolve(m.value);v.then(Js,Js),Zg(v),p(new Kg)}catch(b){p(b)}}),g};return s.isMobXFlow=!0,s},ld);Ss.bound=Lr($E);function Zg(e){ir(e.cancel)&&e.cancel()}function Qa(e){return(e==null?void 0:e.isMobXFlow)===!0}function IE(e,t){return e?ni(e)||!!e[Ee]||Xu(e)||jl(e)||Za(e):!1}function cd(e){return IE(e)}function VE(e){if(ni(e))return e[Ee].ownKeys_();We(38)}function Fl(e,t,n){return e.set(t,n),n}function ra(e,t){if(e==null||typeof e!="object"||e instanceof Date||!cd(e))return e;if(iE(e)||Za(e))return ra(e.get(),t);if(t.has(e))return t.get(e);if(ti(e)){var n=Fl(t,e,new Array(e.length));return e.forEach(function(a,i){n[i]=ra(a,t)}),n}if(hr(e)){var r=Fl(t,e,new Set);return e.forEach(function(a){r.add(ra(a,t))}),r}if(_o(e)){var o=Fl(t,e,new Map);return e.forEach(function(a,i){o.set(i,ra(a,t))}),o}else{var s=Fl(t,e,{});return VE(e).forEach(function(a){Ua.propertyIsEnumerable.call(e,a)&&(s[a]=ra(e[a],t))}),s}}function ur(e,t){return ra(e,new Map)}function io(e,t){t===void 0&&(t=void 0),Un();try{return e.apply(t)}finally{Wn()}}function oa(e){return e[Ee]}var HE={has:function(t,n){return oa(t).has_(n)},get:function(t,n){return oa(t).get_(n)},set:function(t,n,r){var o;return gs(n)?(o=oa(t).set_(n,r,!0))!=null?o:!0:!1},deleteProperty:function(t,n){var r;return gs(n)?(r=oa(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var o;return(o=oa(t).defineProperty_(n,r))!=null?o:!0},ownKeys:function(t){return oa(t).ownKeys_()},preventExtensions:function(t){We(13)}};function jE(e,t){var n,r;return dg(),e=Cs(e,t),(r=(n=e[Ee]).proxy_)!=null?r:n.proxy_=new Proxy(e,HE)}function Gn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Ra(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),pg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function qn(e,t){var n=ys();try{for(var r=[].concat(e.interceptors_||[]),o=0,s=r.length;o<s&&(t=r[o](t),t&&!t.type&&We(14),!!t);o++);return t}finally{so(n)}}function dr(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ei(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),pg(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function pr(e,t){var n=ys(),r=e.changeListeners_;if(r){r=r.slice();for(var o=0,s=r.length;o<s;o++)r[o](t);so(n)}}function DE(e,t,n){return Ao(function(){var r,o=Cs(e,n)[Ee];Xt.NODE_ENV!=="production"&&t&&e[lr],(r=t)!=null||(t=hx(e)),Rs(t).forEach(function(s){return o.make_(s,t[s])})}),e}var ud=Symbol("mobx-keys");function an(e,t,n){return no(e)?Gg(e,e,t,n):(Ao(function(){var r=Cs(e,n)[Ee];if(!e[ud]){var o=Object.getPrototypeOf(e),s=new Set([].concat(Rs(e),Rs(o)));s.delete("constructor"),s.delete(Ee),Wa(o,ud,s)}e[ud].forEach(function(a){return r.make_(a,t&&a in t?t[a]:!0)})}),e)}var Yg="splice",Mr="update",FE=1e4,BE={get:function(t,n){var r=t[Ee];return n===Ee?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):oo(Bl,n)?Bl[n]:t[n]},set:function(t,n,r){var o=t[Ee];return n==="length"&&o.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:o.set_(parseInt(n),r),!0},preventExtensions:function(){We(15)}},dd=function(){function e(n,r,o,s){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_=o,this.legacyMode_=s,this.atom_=new To(n),this.enhancer_=function(a,i){return r(a,i,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.dehanceValues_=function(r){return this.dehancer!==void 0&&r.length>0?r.map(this.dehancer):r},t.intercept_=function(r){return Ra(this,r)},t.observe_=function(r,o){return o===void 0&&(o=!1),o&&r({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),ei(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&We("Out of range: "+r);var o=this.values_.length;if(r!==o)if(r>o){for(var s=new Array(r-o),a=0;a<r-o;a++)s[a]=void 0;this.spliceWithArray_(o,0,s)}else this.spliceWithArray_(r,o-r)},t.updateArrayLength_=function(r,o){r!==this.lastKnownLength_&&We(16),this.lastKnownLength_+=o,this.legacyMode_&&o>0&&l1(r+o+1)},t.spliceWithArray_=function(r,o,s){var a=this;this.atom_;var i=this.values_.length;if(r===void 0?r=0:r>i?r=i:r<0&&(r=Math.max(0,i+r)),arguments.length===1?o=i-r:o==null?o=0:o=Math.max(0,Math.min(o,i-r)),s===void 0&&(s=Zu),Gn(this)){var l=qn(this,{object:this.proxy_,type:Yg,index:r,removedCount:o,added:s});if(!l)return Zu;o=l.removedCount,s=l.added}if(s=s.length===0?s:s.map(function(p){return a.enhancer_(p,void 0)}),this.legacyMode_||Xt.NODE_ENV!=="production"){var u=s.length-o;this.updateArrayLength_(i,u)}var d=this.spliceItemsIntoValues_(r,o,s);return(o!==0||s.length!==0)&&this.notifyArraySplice_(r,s,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,o,s){if(s.length<FE){var a;return(a=this.values_).splice.apply(a,[r,o].concat(s))}else{var i=this.values_.slice(r,r+o),l=this.values_.slice(r+o);this.values_.length+=s.length-o;for(var u=0;u<s.length;u++)this.values_[r+u]=s[u];for(var d=0;d<l.length;d++)this.values_[r+s.length+d]=l[d];return i}},t.notifyArrayChildUpdate_=function(r,o,s){var a=!this.owned_&&ws(),i=dr(this),l=i||a?{observableKind:"array",object:this.proxy_,type:Mr,debugObjectName:this.atom_.name_,index:r,newValue:o,oldValue:s}:null;this.atom_.reportChanged(),i&&pr(this,l)},t.notifyArraySplice_=function(r,o,s){var a=!this.owned_&&ws(),i=dr(this),l=i||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Yg,index:r,removed:s,added:o,removedCount:s.length,addedCount:o.length}:null;this.atom_.reportChanged(),i&&pr(this,l)},t.get_=function(r){if(this.legacyMode_&&r>=this.values_.length){console.warn("[mobx] Out of bounds read: "+r);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[r])},t.set_=function(r,o){var s=this.values_;if(this.legacyMode_&&r>s.length&&We(17,r,s.length),r<s.length){this.atom_;var a=s[r];if(Gn(this)){var i=qn(this,{type:Mr,object:this.proxy_,index:r,newValue:o});if(!i)return;o=i.newValue}o=this.enhancer_(o,a);var l=o!==a;l&&(s[r]=o,this.notifyArrayChildUpdate_(r,o,a))}else{for(var u=new Array(r+1-s.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=o,this.spliceWithArray_(s.length,0,u)}},e}();function zE(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),dg(),Ao(function(){var o=new dd(n,t,r,!1);hg(o.values_,Ee,o);var s=new Proxy(o.values_,BE);return o.proxy_=s,e&&e.length&&o.spliceWithArray_(0,0,e),s})}var Bl={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 r=arguments.length,o=new Array(r>2?r-2:0),s=2;s<r;s++)o[s-2]=arguments[s];var a=this[Ee];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(t);case 2:return a.spliceWithArray_(t,n)}return a.spliceWithArray_(t,n,o)},spliceWithArray:function(t,n,r){return this[Ee].spliceWithArray_(t,n,r)},push:function(){for(var t=this[Ee],n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(t.values_.length,0,r),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,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return pe.trackingDerivation&&We(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){pe.trackingDerivation&&We(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Ee],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};vt("at",Ln),vt("concat",Ln),vt("flat",Ln),vt("includes",Ln),vt("indexOf",Ln),vt("join",Ln),vt("lastIndexOf",Ln),vt("slice",Ln),vt("toString",Ln),vt("toLocaleString",Ln),vt("toSorted",Ln),vt("toSpliced",Ln),vt("with",Ln),vt("every",fr),vt("filter",fr),vt("find",fr),vt("findIndex",fr),vt("findLast",fr),vt("findLastIndex",fr),vt("flatMap",fr),vt("forEach",fr),vt("map",fr),vt("some",fr),vt("toReversed",fr),vt("reduce",Xg),vt("reduceRight",Xg);function vt(e,t){typeof Array.prototype[e]=="function"&&(Bl[e]=t(e))}function Ln(e){return function(){var t=this[Ee];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function fr(e){return function(t,n){var r=this,o=this[Ee];o.atom_.reportObserved();var s=o.dehanceValues_(o.values_);return s[e](function(a,i){return t.call(n,a,i,r)})}}function Xg(e){return function(){var t=this,n=this[Ee];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),o=arguments[0];return arguments[0]=function(s,a,i){return o(s,a,i,t)},r[e].apply(r,arguments)}}var UE=Eo("ObservableArrayAdministration",dd);function ti(e){return Tl(e)&&UE(e[Ee])}var WE={},Oo="add",zl="delete",Jg=function(){function e(n,r,o){var s=this;r===void 0&&(r=vs),o===void 0&&(o="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ee]=WE,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_=r,this.name_=o,ir(Map)||We(18),Ao(function(){s.keysAtom_=yg(Xt.NODE_ENV!=="production"?s.name_+".keys()":"ObservableMap.keys()"),s.data_=new Map,s.hasMap_=new Map,n&&s.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var o=this;if(!pe.trackingDerivation)return this.has_(r);var s=this.hasMap_.get(r);if(!s){var a=s=new Po(this.has_(r),Ol,"ObservableMap.key?",!1);this.hasMap_.set(r,a),Ug(a,function(){return o.hasMap_.delete(r)})}return s.get()},t.set=function(r,o){var s=this.has_(r);if(Gn(this)){var a=qn(this,{type:s?Mr:Oo,object:this,newValue:o,name:r});if(!a)return this;o=a.newValue}return s?this.updateValue_(r,o):this.addValue_(r,o),this},t.delete=function(r){var o=this;if(this.keysAtom_,Gn(this)){var s=qn(this,{type:zl,object:this,name:r});if(!s)return!1}if(this.has_(r)){var a=ws(),i=dr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:zl,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return io(function(){var u;o.keysAtom_.reportChanged(),(u=o.hasMap_.get(r))==null||u.setNewValue_(!1);var d=o.data_.get(r);d.setNewValue_(void 0),o.data_.delete(r)}),i&&pr(this,l),!0}return!1},t.updateValue_=function(r,o){var s=this.data_.get(r);if(o=s.prepareNewValue_(o),o!==pe.UNCHANGED){var a=ws(),i=dr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Mr,object:this,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&pr(this,l)}},t.addValue_=function(r,o){var s=this;this.keysAtom_,io(function(){var u,d=new Po(o,s.enhancer_,"ObservableMap.key",!1);s.data_.set(r,d),o=d.value_,(u=s.hasMap_.get(r))==null||u.setNewValue_(!0),s.keysAtom_.reportChanged()});var a=ws(),i=dr(this),l=i||a?{observableKind:"map",debugObjectName:this.name_,type:Oo,object:this,name:r,newValue:o}:null;i&&pr(this,l)},t.get=function(r){return this.has(r)?this.dehanceValue_(this.data_.get(r).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var r=this,o=this.keys();return Qg({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:r.get(l)}}})},t.entries=function(){var r=this,o=this.keys();return Qg({next:function(){var a=o.next(),i=a.done,l=a.value;return{done:i,value:i?void 0:[l,r.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,o){for(var s=ta(this),a;!(a=s()).done;){var i=a.value,l=i[0],u=i[1];r.call(o,u,l,this)}},t.merge=function(r){var o=this;return _o(r)&&(r=new Map(r)),io(function(){no(r)?lx(r).forEach(function(s){return o.set(s,r[s])}):Array.isArray(r)?r.forEach(function(s){var a=s[0],i=s[1];return o.set(a,i)}):Qs(r)?(ix(r)||We(19,r),r.forEach(function(s,a){return o.set(a,s)})):r!=null&&We(20,r)}),this},t.clear=function(){var r=this;io(function(){Ng(function(){for(var o=ta(r.keys()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.replace=function(r){var o=this;return io(function(){for(var s=GE(r),a=new Map,i=!1,l=ta(o.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!s.has(d)){var p=o.delete(d);if(p)i=!0;else{var f=o.data_.get(d);a.set(d,f)}}}for(var g=ta(s.entries()),m;!(m=g()).done;){var v=m.value,b=v[0],w=v[1],y=o.data_.has(b);if(o.set(b,w),o.data_.has(b)){var S=o.data_.get(b);a.set(b,S),y||(i=!0)}}if(!i)if(o.data_.size!==a.size)o.keysAtom_.reportChanged();else for(var C=o.data_.keys(),x=a.keys(),E=C.next(),T=x.next();!E.done;){if(E.value!==T.value){o.keysAtom_.reportChanged();break}E=C.next(),T=x.next()}o.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,o){return ei(this,r)},t.intercept_=function(r){return Ra(this,r)},ea(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),_o=Eo("ObservableMap",Jg);function Qg(e){return e[Symbol.toStringTag]="MapIterator",vd(e)}function GE(e){if(Qs(e)||_o(e))return e;if(Array.isArray(e))return new Map(e);if(no(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return We(21,e)}var qE={},Rg=function(){function e(n,r,o){var s=this;r===void 0&&(r=vs),o===void 0&&(o="ObservableSet"),this.name_=void 0,this[Ee]=qE,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_=o,ir(Set)||We(22),this.enhancer_=function(a,i){return r(a,i,o)},Ao(function(){s.atom_=yg(s.name_),n&&s.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(r){return this.dehancer!==void 0?this.dehancer(r):r},t.clear=function(){var r=this;io(function(){Ng(function(){for(var o=ta(r.data_.values()),s;!(s=o()).done;){var a=s.value;r.delete(a)}})})},t.forEach=function(r,o){for(var s=ta(this),a;!(a=s()).done;){var i=a.value;r.call(o,i,i,this)}},t.add=function(r){var o=this;if(this.atom_,Gn(this)){var s=qn(this,{type:Oo,object:this,newValue:r});if(!s)return this}if(!this.has(r)){io(function(){o.data_.add(o.enhancer_(r,void 0)),o.atom_.reportChanged()});var a=Xt.NODE_ENV!=="production",i=dr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:Oo,object:this,newValue:r}:null;i&&pr(this,l)}return this},t.delete=function(r){var o=this;if(Gn(this)){var s=qn(this,{type:zl,object:this,oldValue:r});if(!s)return!1}if(this.has(r)){var a=Xt.NODE_ENV!=="production",i=dr(this),l=i||a?{observableKind:"set",debugObjectName:this.name_,type:zl,object:this,oldValue:r}:null;return io(function(){o.atom_.reportChanged(),o.data_.delete(r)}),i&&pr(this,l),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,o=Array.from(this.keys()),s=Array.from(this.values());return e1({next:function(){var i=r;return r+=1,i<s.length?{value:[o[i],s[i]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,o=0,s=Array.from(this.data_.values());return e1({next:function(){return o<s.length?{value:r.dehanceValue_(s[o++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(r){if(ro(r)&&!hr(r))return r.intersection(this);var o=new Set(this);return o.intersection(r)},t.union=function(r){if(ro(r)&&!hr(r))return r.union(this);var o=new Set(this);return o.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(ro(r)&&!hr(r))return r.symmetricDifference(this);var o=new Set(this);return o.symmetricDifference(r)},t.isSubsetOf=function(r){return new Set(this).isSubsetOf(r)},t.isSupersetOf=function(r){return new Set(this).isSupersetOf(r)},t.isDisjointFrom=function(r){if(ro(r)&&!hr(r))return r.isDisjointFrom(this);var o=new Set(this);return o.isDisjointFrom(r)},t.replace=function(r){var o=this;return hr(r)&&(r=new Set(r)),io(function(){Array.isArray(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):ro(r)?(o.clear(),r.forEach(function(s){return o.add(s)})):r!=null&&We("Cannot initialize set from "+r)}),this},t.observe_=function(r,o){return ei(this,r)},t.intercept_=function(r){return Ra(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},ea(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),hr=Eo("ObservableSet",Rg);function e1(e){return e[Symbol.toStringTag]="SetIterator",vd(e)}var t1=Object.create(null),n1="remove",r1=function(){function e(n,r,o,s){r===void 0&&(r=new Map),s===void 0&&(s=Fx),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_=r,this.name_=o,this.defaultAnnotation_=s,this.keysAtom_=new To("ObservableObject.keys"),this.isPlainObject_=no(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,o){var s=this.values_.get(r);if(s instanceof cr)return s.set(o),!0;if(Gn(this)){var a=qn(this,{type:Mr,object:this.proxy_||this.target_,name:r,newValue:o});if(!a)return null;o=a.newValue}if(o=s.prepareNewValue_(o),o!==pe.UNCHANGED){var i=dr(this),l=Xt.NODE_ENV!=="production",u=i||l?{type:Mr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:s.value_,name:r,newValue:o}:null;s.setNewValue_(o),i&&pr(this,u)}return!0},t.get_=function(r){return pe.trackingDerivation&&!oo(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,o,s){return s===void 0&&(s=!1),oo(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,o):s?Reflect.set(this.target_,r,o):(this.target_[r]=o,!0):this.extend_(r,{value:o,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,s)},t.has_=function(r){if(!pe.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var o=this.pendingKeys_.get(r);return o||(o=new Po(r in this.target_,Ol,"ObservableObject.key?",!1),this.pendingKeys_.set(r,o)),o.get()},t.make_=function(r,o){if(o===!0&&(o=this.defaultAnnotation_),o!==!1){if(!(r in this.target_)){var s;if((s=this.target_[lr])!=null&&s[r])return;We(1,o.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==Ua;){var i=El(a,r);if(i){var l=o.make_(this,r,i,a);if(l===0)return;if(l===1)break}a=Object.getPrototypeOf(a)}s1(this,o,r)}},t.extend_=function(r,o,s,a){if(a===void 0&&(a=!1),s===!0&&(s=this.defaultAnnotation_),s===!1)return this.defineProperty_(r,o,a);var i=s.extend_(this,r,o,a);return i&&s1(this,s,r),i},t.defineProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Un();var a=this.delete_(r);if(!a)return a;if(Gn(this)){var i=qn(this,{object:this.proxy_||this.target_,name:r,type:Oo,newValue:o.value});if(!i)return null;var l=i.newValue;o.value!==l&&(o=ms({},o,{value:l}))}if(s){if(!Reflect.defineProperty(this.target_,r,o))return!1}else Ar(this.target_,r,o);this.notifyPropertyAddition_(r,o.value)}finally{Wn()}return!0},t.defineObservableProperty_=function(r,o,s,a){a===void 0&&(a=!1),this.keysAtom_;try{Un();var i=this.delete_(r);if(!i)return i;if(Gn(this)){var l=qn(this,{object:this.proxy_||this.target_,name:r,type:Oo,newValue:o});if(!l)return null;o=l.newValue}var u=o1(r),d={configurable:pe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,r,d))return!1}else Ar(this.target_,r,d);var p=new Po(o,s,Xt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,p),this.notifyPropertyAddition_(r,p.value_)}finally{Wn()}return!0},t.defineComputedProperty_=function(r,o,s){s===void 0&&(s=!1),this.keysAtom_;try{Un();var a=this.delete_(r);if(!a)return a;if(Gn(this)){var i=qn(this,{object:this.proxy_||this.target_,name:r,type:Oo,newValue:void 0});if(!i)return null}o.name||(o.name=Xt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),o.context=this.proxy_||this.target_;var l=o1(r),u={configurable:pe.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(s){if(!Reflect.defineProperty(this.target_,r,u))return!1}else Ar(this.target_,r,u);this.values_.set(r,new cr(o)),this.notifyPropertyAddition_(r,void 0)}finally{Wn()}return!0},t.delete_=function(r,o){if(o===void 0&&(o=!1),this.keysAtom_,!oo(this.target_,r))return!0;if(Gn(this)){var s=qn(this,{object:this.proxy_||this.target_,name:r,type:n1});if(!s)return null}try{var a;Un();var i=dr(this),l=Xt.NODE_ENV!=="production"&&ws(),u=this.values_.get(r),d=void 0;if(!u&&(i||l)){var p;d=(p=El(this.target_,r))==null?void 0:p.value}if(o){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(Xt.NODE_ENV,u&&(this.values_.delete(r),u instanceof Po&&(d=u.value_),jg(u)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(r in this.target_),i||l){var f={type:n1,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};Xt.NODE_ENV,i&&pr(this,f),Xt.NODE_ENV}}finally{Wn()}return!0},t.observe_=function(r,o){return ei(this,r)},t.intercept_=function(r){return Ra(this,r)},t.notifyPropertyAddition_=function(r,o){var s,a=dr(this),i=Xt.NODE_ENV!=="production";if(a||i){var l=a||i?{type:Oo,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:o}:null;a&&pr(this,l)}(s=this.pendingKeys_)==null||(s=s.get(r))==null||s.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),Rs(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Cs(e,t){var n;if(oo(e,Ee))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",o=new r1(e,new Map,String(r),Jx(t));return Wa(e,Ee,o),e}var KE=Eo("ObservableObjectAdministration",r1);function o1(e){return t1[e]||(t1[e]={get:function(){return this[Ee].getObservablePropValue_(e)},set:function(n){return this[Ee].setObservablePropValue_(e,n)}})}function ni(e){return Tl(e)?KE(e[Ee]):!1}function s1(e,t,n){var r;(r=e.target_[lr])==null||delete r[n]}var ZE=i1(0),YE=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),pd=0,a1=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(a1,Array.prototype);var fd=function(e){function t(r,o,s,a){var i;return s===void 0&&(s="ObservableArray"),a===void 0&&(a=!1),i=e.call(this)||this,Ao(function(){var l=new dd(s,o,a,!0);l.proxy_=i,hg(i,Ee,l),r&&r.length&&i.spliceWithArray(0,0,r),YE&&Object.defineProperty(i,"0",ZE)}),i}bg(t,e);var n=t.prototype;return n.concat=function(){this[Ee].atom_.reportObserved();for(var o=arguments.length,s=new Array(o),a=0;a<o;a++)s[a]=arguments[a];return Array.prototype.concat.apply(this.slice(),s.map(function(i){return ti(i)?i.slice():i}))},n[Symbol.iterator]=function(){var r=this,o=0;return vd({next:function(){return o<r.length?{value:r[o++],done:!1}:{done:!0,value:void 0}}})},ea(t,[{key:"length",get:function(){return this[Ee].getArrayLength_()},set:function(o){this[Ee].setArrayLength_(o)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(a1);Object.entries(Bl).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Wa(fd.prototype,t,n)});function i1(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ee].get_(e)},set:function(n){this[Ee].set_(e,n)}}}function JE(e){Ar(fd.prototype,""+e,i1(e))}function l1(e){if(e>pd){for(var t=pd;t<e+100;t++)JE(t);pd=e}}l1(1e3);function QE(e,t,n){return new fd(e,t,n)}function Ul(e,t){if(typeof e=="object"&&e!==null){if(ti(e))return t!==void 0&&We(23),e[Ee].atom_;if(hr(e))return e.atom_;if(_o(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||We(25,t,hd(e)),n}if(ni(e)){if(!t)return We(26);var r=e[Ee].values_.get(t);return r||We(27,t,hd(e)),r}if(Xu(e)||Za(e)||jl(e))return e}else if(ir(e)&&jl(e[Ee]))return e[Ee];We(28)}function RE(e,t){if(e||We(29),Xu(e)||Za(e)||jl(e)||_o(e)||hr(e))return e;if(e[Ee])return e[Ee];We(24,e)}function hd(e,t){var n;if(t!==void 0)n=Ul(e,t);else{if(Ja(e))return e.name;ni(e)||_o(e)||hr(e)?n=RE(e):n=Ul(e)}return n.name_}function Ao(e){var t=ys(),n=ed(!0);Un();try{return e()}finally{Wn(),td(n),so(t)}}var c1=Ua.toString;function gd(e,t,n){return n===void 0&&(n=-1),md(e,t,n)}function md(e,t,n,r,o){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var s=typeof e;if(s!=="function"&&s!=="object"&&typeof t!="object")return!1;var a=c1.call(e);if(a!==c1.call(t))return!1;switch(a){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=u1(e),t=u1(t);var i=a==="[object Array]";if(!i){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(ir(l)&&l instanceof l&&ir(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],o=o||[];for(var d=r.length;d--;)if(r[d]===e)return o[d]===t;if(r.push(e),o.push(t),i){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!md(e[d],t[d],n-1,r,o))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],!(oo(t,f)&&md(e[f],t[f],n-1,r,o)))return!1}return r.pop(),o.pop(),!0}function u1(e){return ti(e)?e.slice():Qs(e)||_o(e)||ro(e)||hr(e)?Array.from(e.entries()):e}var d1,eT=((d1=xl().Iterator)==null?void 0:d1.prototype)||{};function vd(e){return e[Symbol.iterator]=tT,Object.assign(Object.create(eT),e)}function tT(){return this}if(["Symbol","Map","Set"].forEach(function(e){var t=xl();typeof t[e]>"u"&&We("MobX requires global '"+e+"' to be available or polyfilled")}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:mE,extras:{getDebugName:hd},$mobx:Ee}),!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!DE)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function nT(e){e()}function rT(e){e||(e=nT),LE({reactionScheduler:e})}function oT(e){return ME(e)}var sT=1e4,aT=1e4,iT=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(r){r===void 0&&(r=sT),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var o=Date.now();n.registrations.forEach(function(s,a){o-s.registeredAt>=r&&(n.finalize(s.value),n.registrations.delete(a))}),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,r){this.registrations.set(r,{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,aT))}}),e}(),lT=typeof FinalizationRegistry<"u"?FinalizationRegistry:iT,bd=new lT(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),p1={exports:{}},yd={};/**
8
8
  * @license React
9
9
  * use-sync-external-store-shim.production.min.js
10
10
  *
@@ -12,34 +12,34 @@ 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 p1;function sT(){if(p1)return bd;p1=1;var e=h;function t(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function i(f,p){var g=p(),m=r({inst:{value:g,getSnapshot:p}}),v=m[0].inst,b=m[1];return s(function(){v.value=g,v.getSnapshot=p,l(v)&&b({inst:v})},[f,g,p]),o(function(){return l(v)&&b({inst:v}),f(function(){l(v)&&b({inst:v})})},[f]),a(g),g}function l(f){var p=f.getSnapshot;f=f.value;try{var g=p();return!n(f,g)}catch{return!0}}function u(f,p){return p()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:i;return bd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,bd}f1.exports=sT();var aT=f1.exports;function h1(e){e.reaction=new oo("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function iT(e,t){t===void 0&&(t="observed");var n=h.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(i){return vd.unregister(r),r.onStoreChange=i,r.reaction||(h1(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var o=n.current;o.reaction||(h1(o),vd.register(n,o,o)),h.useDebugValue(o.reaction,eT),aT.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot);var s,a;if(o.reaction.track(function(){try{s=e()}catch(i){a=i}}),a)throw a;return s}var yd,wd,g1=typeof Symbol=="function"&&Symbol.for,lT=(wd=(yd=Object.getOwnPropertyDescriptor(function(){},"name"))===null||yd===void 0?void 0:yd.configurable)!==null&&wd!==void 0?wd:!1,m1=g1?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,v1=g1?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function ce(e,t){var n;if(v1&&e.$$typeof===v1)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 r=(n=void 0)!==null&&n!==void 0?n:!1,o=e,s=e.displayName||e.name;if(m1&&e.$$typeof===m1&&(r=!0,o=e.render,typeof o!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a=function(i,l){return iT(function(){return o(i,l)},s)};return a.displayName=e.displayName,lT&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),r&&(a=h.forwardRef(a)),a=h.memo(a),uT(e,a),a}var cT={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function uT(e,t){Object.keys(e).forEach(function(n){cT[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Sd;RE(Fn.unstable_batchedUpdates),Sd=vd.finalizeAllImmediately;const b1=new Map,dT=(e,t)=>`${t}-${e}`,y1=h.forwardRef(function({svg:t,iconSize:n,...r},o){const s=dT(t,n);let a=b1.get(s);return a||(a=zS(t,n),b1.set(s,a)),c.jsx("div",{...r,ref:o,dangerouslySetInnerHTML:{__html:a}})});let w1;const fT=e=>{w1=e},pT=()=>w1;var q=(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))(q||{});const Ul={alertRhombus:sC,alignHorizontalCenter:aC,alignHorizontalLeft:iC,alignHorizontalRight:lC,applicationBracketsOutline:cC,arrowDown:uC,arrowExpandAll:dC,arrowRight:fC,arrowULeftTop:pC,arrowURightTop:hC,borderAllVariant:mC,borderRadius:vC,borderStyle:bC,calendar:yC,cellphoneLink:wC,check:ng,checkBold:CC,checkboxBlank:xC,chevronUp:OC,chevronDown:EC,chevronLeft:TC,chevronRight:PC,close:rg,codeBraces:AC,cog:NC,contentCopy:$C,contentSave:kC,delete:BC,dotsVertical:zC,email:UC,emailOutline:WC,eye:GC,eyedropperVariant:YC,eyeOff:qC,eyeOffOutline:KC,eyeOutline:ZC,fire:JC,flare:QC,floppy:RC,folder:e2,fullscreen:t2,gradientVertical:n2,helpCircle:r2,home:o2,image:s2,information:i2,informationVariant:l2,layers:c2,link:f2,lock:h2,lockOpenVariant:g2,menuDown:m2,newspaperVariantOutline:y2,openInNew:og,paletteSwatch:C2,panVertical:x2,pencil:E2,phone:T2,plus:P2,plusBox:O2,powerPlug:_2,refresh:A2,rhombusOutline:L2,rhombusSplit:M2,rhombusSplitOutline:N2,tag:I2,target:V2,targetVariant:H2,textBoxMultiple:j2,trayArrowDown:B2,unfoldLessHorizontal:z2,unfoldMoreHorizontal:U2,viewDayOutline:G2,viewGridPlus:q2,web:K2,xml:Z2,database:VC,databaseOutline:DC,databaseOutlineOn:jC,databaseOutlineOff:HC,databaseOutlineRemove:FC,codeBrackets:LC,toggleSwitchOutline:F2,toggleSwitchOffOutline:D2,null:w2,string:MC,number:S2,cloudUpload:_C,chat:SC,creation:IC,viewDashboard:W2,rocketLaunch:$2,lightningBolt:d2,stop:k2,arrowUp:gC},hT="gs-cmp-icon",ne=ce(function({className:t,icon:n,size:r,rotate:o,horizontal:s,vertical:a}){const i=pT(),l=(i==null?void 0:i[n])||(Ul==null?void 0:Ul[n])||n,u=[s&&"scaleX(-1)",a&&"scaleY(-1)",o&&`rotate(${o}deg)`].filter(f=>!!f).join(" ");if(!l)return null;const d=N(hT,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(y1,{className:d,style:{transform:u||void 0},svg:l,iconSize:r}):c.jsx(Ba,{className:d,path:l,size:r,rotate:o,horizontal:s,vertical:a})}),Cd=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"},S1={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"},gT={...{enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},...{leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"}},Te={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"},xd={bg:z.bg,bgH:z.bgH},C1={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"},ni={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"},se={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Pe={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"},Ao={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"},mn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},vn={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"},mT={all:"gs-utl-break-all"},ao="gs-utl-my-2",vT="gs-utl-my-3",x1=` gs-utl-rounded ${vn.xs} ${mn.mono} ${z.bgH25}`,E1=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${ao} gs-utl-ml-1`,jt={h1:`${vn.xl2} ${mn.bold} ${vT}`,h2:`${vn.xl} ${mn.bold} ${ao}`,h3:`${vn.lg} ${mn.semibold} ${ao}`,h4:`${vn.base} ${mn.semibold} ${ao}`,h5:`${vn.sm} ${mn.semibold} ${ao}`,h6:`${vn.xs} ${mn.semibold} ${ao}`,strong:mn.bold,em:mn.italic,ul:`gs-utl-list-disc ${E1}`,ol:`gs-utl-list-decimal ${E1}`,codeInline:`${x1} gs-utl-px-1 gs-utl-py-0.5`,pre:`${x1} gs-utl-p-3 gs-utl-overflow-x-auto ${ao}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${ao} ${mn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${ao}`,thead:`${z.bgH2}`,tr:`gs-utl-border-b ${z.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${mn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},Wl={s:"gs-utl-size-5",m:"gs-utl-size-10"},Ed={itemList:({index:e=0,open:t=!1,length:n=0}={})=>Z(z.bgH2,Te.xyS,z.br,e&&te.bt,(t||e===n-1)&&te.bb)},T1=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),P1=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},O1=({variant:e,size:t="m",className:n,disabledClassName:r,active:o,border:s=!0,rounded:a=!0,disabled:i=!1,withBg:l,block:u,full:d})=>{const f=e==="pr",p=e==="out",g=e==="out-clear",m=e==="warn",v=e==="danger",b=s&&(p||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,a&&te.rnd,l&&z.bg,b?Z(te.b,z.br,p&&z.bA,p&&z.tAo,!i&&z.hBgH):Z(te.b,te.bT),m&&Z(z.bgW,!i&&z.hBgW,"gs-utl-text-white"),v&&Z(z.bgRed,!i&&z.hBgRed,"gs-utl-text-white"),f&&Z(z.bgA2,!i&&z.hBgAct),o&&z.bgA,i&&(r??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",ni.focus]};function Ke({children:e,...t}){const{variant:n,size:r,active:o,border:s,rounded:a,block:i,full:l,className:u,icon:d,loading:f,withBg:p,disabled:g,type:m="button",disabledClassName:v,...b}=t,w=f?{icon:p2,size:"18px",className:Z("animate-spin-fast")}:ct(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:Z(O1(t)),disabled:g||f,type:m,...b,children:w?c.jsxs(I,{className:Z("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(B,{children:c.jsx(ne,{...w})}),e&&c.jsx(B,{children:e})]}):e})}function Lo({full:e,abs:t,small:n,size:r,className:o,bg:s,currentColor:a}){const i=N(e&&"gs-utl-w-full gs-utl-h-full",t?Pe.coverAbs:"gs-utl-relative",o),l=N(!r&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),r==="x2s"&&"gs-utl-size-3",r==="xs"&&"gs-utl-size-4",r==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",te.pill,te.bS,a?"gs-utl-border-current":te.bA);return c.jsxs(I,{className:i,items:"center",justify:"center",children:[!!s&&c.jsx("div",{className:N(Pe.coverAbs,z.bg,Pe.disabled)}),c.jsx("div",{className:l})]})}const Xt={accessToken:""},bT=()=>{Xt.timeout&&(clearTimeout(Xt.timeout),Xt.timeout=void 0),Xt.accessToken="",Xt.license=void 0},_1=async()=>{var t;let e={accessToken:""};try{const n=await((t=Xt.getAccessToken)==null?void 0:t.call(Xt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Xt.getAccessToken&&console.error("Failed to get access token");return}if(Xt.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Xt.timeout||void 0),Xt.timeout=setTimeout(_1,n-Date.now()-1)}},A1=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},oa=e=>A1(e)==="email",yT=e=>{var o;const t=M1(e),n=oa(e),r=e.getWrapper();return t.length>1?!1:n?((o=r==null?void 0:r.findFirstType("mj-body"))==null?void 0:o.components().length)===0:(r==null?void 0:r.components().length)===0},L1=(e,t={})=>{const{selectedComponents:n=[],withPageContent:r,imageUrls:o=[]}=t,s=e.Pages.getSelected(),a=e.getSelected(),i=A1(e),l=M1(e),u=yT(e),d=s?{id:s.getId(),name:s.getName(),content:r?TT(e):void 0}:void 0,f=a?{id:a.getId(),content:a.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:f,selectedComponents:n.map(p=>({id:p.getId(),content:""})),projectType:i,availablePages:l,globalStyles:wT(e),installedPlugins:ST(e),devices:ET(e),isEmail:i==="email",imageUrls:o}},Td=(e,t,n)=>{const{layoutComponents:r}=n||{},o=t,s=o.type,a=s?r==null?void 0:r[s]:void 0;return a?{...o,...a({editor:e,props:t})}:t},Jt=(e,t,n)=>{const r=Td(e,t,n);return e.runCommand(re.layoutComponentRender,{components:r})};function wT(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
16
- `)}const M1=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),ST=e=>{const t=xT(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},CT=e=>e.getModel().get("customData")??{},xT=e=>e&&CT(e).plugins||[];function ET(e){return e.Devices.getAll().map(t=>t.toJSON())}function Gl(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const ql=(e="",t,n={})=>{!t||!e||(t.innerHTML=Gl(e),!n.skipScroll&&(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var r;return(r=t==null?void 0:t.lastElementChild)==null?void 0:r.scrollIntoView({block:"nearest"})})))},N1=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function Kl(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function Zl(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function TT(e){const t=e.getWrapper(),n=N1(t);return`${oa(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const PT=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],r=new Map,o=document.createElement("div");o.setAttribute("data-temp-els","true");const s=(a,i)=>{try{i.innerHTML=a.innerHTML,Array.from(a.attributes).forEach(l=>i.setAttribute(l.name,l.value))}catch{}};return{cleanup(){o==null||o.remove()},update:a=>{var p;const i=new DOMParser,l=Gl(a),u=i.parseFromString(`<body>${l}</body>`,"text/html"),d=Array.from(u.body.children),f=e.getWrapper();return(p=f==null?void 0:f.getEl())==null||p.appendChild(o),d.forEach(g=>{var v,b;let m=g.id;if(m){const w=r.get(m),y=t.getById(m),S=y==null?void 0:y.getEl();S&&(s(g,S),!w&&requestAnimationFrame(()=>S==null?void 0:S.scrollIntoView({block:"nearest"}))),r.set(m,{cmp:y,cmpEl:S,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 w=(b=r.get(m))==null?void 0:b.newNode;w?s(g,w):(o.appendChild(g),r.set(m,{newNode:g}))}}),r}}},OT=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:r,Css:o}=n,{html:s,css:a}=r.parseHtml(t,{returnArray:!0}),i=s[0];e.getId()===((u=i==null?void 0:i.attributes)==null?void 0:u.id)?(e.components().reset(i.components),e.addAttributes({...i==null?void 0:i.attributes,class:(d=i==null?void 0:i.classes)==null?void 0:d.join(" ")}),a&&o.addCollection(a,{extend:!0})):e.components(t)};function _T(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const Gn="gs-cmp-ai-chat-tool-generate-image",AT=e=>{var x;const{editor:t,part:n,chatContext:r,isProcessing:o}=e,s=(E,T)=>t.t(`aiChat.message.tool.generateImage.${E}`,T),a=n.input||{},i=r.toolStatusProgress.get(n.toolCallId),l=(x=i==null?void 0:i.content)==null?void 0:x.trim(),u=l||s("generating"),d=Math.min(Math.max(a.n||1,1),4),f=_T(n.output),p=oa(t),g=E=>{const T=t.getSelected(),_=p?"mj-image":"image",O={type:_,attributes:{src:E}};let P;if(T!=null&&T.is(_)){T.addAttributes({src:E});return}if(T&&t.Components.canMove(T,O))P=T.append(O)[0];else if(!T){const A=t.getWrapper(),M=p?A==null?void 0:A.findFirstType("mj-column"):A;P=M==null?void 0:M.append(O)[0]}P&&t.select(P,{scroll:!0})},m=E=>{t.Canvas.startDrag({content:{type:p?"mj-image":"image",attributes:{src:E}}})},v=()=>{t.Canvas.endDrag()},b=N(`${Gn}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),w=N(`${Gn}__item`,te.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=N(`${Gn}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),S=N(`${Gn}__item-actions`,Pe.hoverGroup,"gs-utl-absolute gs-utl-left-1 gs-utl-right-1 gs-utl-bottom-1");let C=null;return o?C=c.jsxs(c.Fragment,{children:[!!u&&c.jsx("div",{className:N(`${Gn}__status`,vn.xs,z.txtLowEmphasis),children:u}),c.jsx("div",{className:N(`${Gn}__placeholders`,b),children:Array.from({length:d}).map((E,T)=>c.jsx(I,{className:N(`${Gn}__placeholder`,w,z.bgH50,z.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(Lo,{className:`${Gn}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${T}`))})]}):f.length?C=c.jsx("div",{className:N(`${Gn}__output`,b),children:f.map((E,T)=>c.jsxs("div",{className:w,children:[c.jsx("img",{className:y,src:E,alt:s("imageAlt",{num:T+1}),draggable:!0,onDragStart:()=>m(E),onDragEnd:v}),c.jsx(I,{className:S,children:c.jsx(Ke,{full:!0,variant:"pr",className:N(`${Gn}__btn-use`),onClick:()=>g(E),children:s("useImage")})})]},E))}):l&&(C=c.jsx("div",{className:N(`${Gn}__status`,vn.xs,z.txtLowEmphasis),children:l})),c.jsx(I,{className:Gn,col:!0,gap:"xs",children:C})};function LT(e){return{type:"custom",component:()=>c.jsx(AT,{...e})}}var Cs=(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))(Cs||{}),io=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(io||{}),ri=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(ri||{}),pr=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(pr||{});function MT(e){const t=oa(e),n=o=>e.t(`aiChat.message.tool.command.${o}`),r={[ri.SHOW_CODE]:{label:({isExecuted:o})=>n(o?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(re.dialogExportCode)},[ri.IMPORT_CODE]:{label:({isExecuted:o})=>n(o?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(re.dialogImportCode)},[ri.PREVIEW]:{label:({isExecuted:o})=>n(o?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(r[ri.PAGE_SETTINGS]={label:({isExecuted:o})=>n(o?"pageSettings.done":"pageSettings.pending"),execute:()=>{const o=e.Pages.getSelected();e.runCommand(re.setPageSettings,{page:o,isOpen:!0})}}),r}function $1(e,t={}){const{skipDefault:n,commands:r={}}=t,o=new Map(Object.entries(n?{}:MT(e))),s=(a,i)=>e.t(`aiChat.message.tool.command.${a}`,i);return Object.entries(r).forEach(([a,i])=>{if(!i)return;const l=a,u=o.get(l);o.set(l,{execute:i.execute??(u==null?void 0:u.execute),label:i.label??(u==null?void 0:u.label)})}),{async execute(a,i){const l=o.get(a.commandId);if(!l)throw new Error(s("notFound",{id:a.commandId}));if(!l.execute)throw new Error(s("missingHandler",{id:a.commandId}));return await new Promise(d=>setTimeout(d,1500)),await l.execute({editor:e,input:a,context:i})??{success:!0}},layoutToolLabel:({part:a})=>{const i=a.input,l=i!=null&&i.commandId?o.get(i.commandId):void 0;if(!(l!=null&&l.label))return;const u=a.state==="output-available";return l.label({isExecuted:u})}}}function NT(e){const t={async execute(i){const{componentId:l}=i,u=e.Components.getById(l);return u?(u.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${l}'`}}},n={async execute(i){const{sourceId:l,targetId:u,targetIndex:d}=i,f=e.Components.getById(l),p=e.Components.getById(u);return f?p?(p.append(f,{at:d}),e.select(f,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${u}'`}:{success:!1,error:`Source component not found with ID '${l}'`}}},r={async execute(i){const{pageId:l}=i,u=e.Pages.get(l),d=u==null?void 0:u.getMainComponent();return d?{content:N1(d)}:{success:!1,error:"Page not found"}}},o={async execute(){return{pages:e.Pages.getAll().map(l=>({id:l.getId(),name:l.getName()}))}}},s={layoutToolResult:i=>LT(i)},a=$1(e);return{[Cs.REMOVE_COMPONENT]:t,[Cs.MOVE_COMPONENT]:n,[Cs.GET_PAGE_CONTENT]:r,[Cs.LIST_PAGES]:o,[Cs.GENERATE_IMAGE]:s,[Cs.RUN_COMMAND]:a}}function $T(e,t){var w;const{componentId:n,position:r}=t,o=oa(e),s=e.getWrapper(),a=o?s.findFirstType("mj-body"):s;Kl(e);const i=document.createElement("div");i.style.display="contents";const{Components:l}=e;let d=l.getById(n)||a;o&&d===s&&(d=a);const f=d==null?void 0:d.parent(),p=d==null?void 0:d.index(),g=d==null?void 0:d.getEl();let m="afterend",v;switch(r){case"before":f?(m="beforebegin",d=f,v=p):(m="afterbegin",v=0);break;case"beforeInside":m="afterbegin",v=0;break;case"afterInside":m="beforeend";break;case"after":f?(m="afterend",d=f,v=(p??0)+1):m="beforeend";break}return g?g==null||g.insertAdjacentElement(m,i):(w=f==null?void 0:f.getEl())==null||w.appendChild(i),{target:d,at:v,domPosition:m,tempTargetEl:g,tempDOM:i,updatePreview:y=>{let S=y;o&&(S=HT(e,d,y,v)),ql(S,i,{skipScroll:!0})},cleanUp(){i==null||i.remove(),Zl(e)}}}const Yl="mjml",kT="mj-head",Pd="gs-ai-chat-mjml-preview";function k1(e){var n;const t=((n=e.__attrToString)==null?void 0:n.call(e,{}))||"";return t?`<${e.tagName} ${t}>`:`<${e.tagName}>`}function IT(e,t){const r=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");return Array.from(r.body.children).forEach(o=>{const a=[o.getAttribute("css-class"),t].filter(Boolean).join(" ").trim();o.setAttribute("css-class",a)}),r.body.innerHTML}function VT(e,t,n){var p,g;const r=e.closestType(Yl),o=((p=r==null?void 0:r.findFirstType(kT))==null?void 0:p.toHTML())||"",s=e.components().map(m=>m.toHTML()),a=typeof n=="number"?Math.max(0,Math.min(n,s.length)):s.length;s.splice(a,0,t);const i=s.join(""),l=[];let u=e.parent();for(;u&&u.tagName!==Yl;)(g=u.tagName)!=null&&g.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>k1(m)).join(""),f=l.map(m=>`</${m.tagName}>`).join("");return`<${Yl}>${o}${d}${k1(e)}${i}</${e.tagName}>${f}</${Yl}>`}function HT(e,t,n,r){var s;const o=Gl(n);if(!(o!=null&&o.trim()))return"";try{const a=IT(o,Pd),i=VT(t,a,r),l=(s=e.runCommand(I1,{mjml:i}))==null?void 0:s.html;if(!l)return"";const d=new DOMParser().parseFromString(l,"text/html"),f=Array.from(d.querySelectorAll(`.${Pd}`));return f.length?f.map(p=>(p.classList.remove(Pd),p.outerHTML)).join(""):""}catch{return""}}function jT(e,t,n){const{target:r,at:o}=t,s=r==null?void 0:r.append(n,{at:o})[0];return s&&setTimeout(()=>e.select(s,{scroll:!0}),50),s}function DT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:io.ADD_COMPONENT_CODE,toolSetup:$T(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.updatePreview(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;jT(t,i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function FT(e){Kl(e);const t=PT(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),Zl(e)}}}function BT(e,t){const n=e.getWrapper();t.mapUpdates.forEach(r=>{const{cmp:o,newNode:s}=r,{outerHTML:a}=s;o?OT(o,a):n==null||n.append(a)})}function zT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:io.EDIT_COMPONENT_CODE,toolSetup:FT(t),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content),BT(t,i.toolSetup),i.completed=!0,l()}if(a==="error"){l();return}}function UT(e,t){const{name:n}=t,{Pages:r,Components:o}=e;Kl(e);const s=r.add({name:n,component:"<h1></h1>"},{select:!0}),a=s.getMainComponent();return a.once(o.events.render,()=>{const i=a.getEl();i&&ql(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
15
+ */var f1;function cT(){if(f1)return yd;f1=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,r=e.useState,o=e.useEffect,s=e.useLayoutEffect,a=e.useDebugValue;function i(p,f){var g=f(),m=r({inst:{value:g,getSnapshot:f}}),v=m[0].inst,b=m[1];return s(function(){v.value=g,v.getSnapshot=f,l(v)&&b({inst:v})},[p,g,f]),o(function(){return l(v)&&b({inst:v}),p(function(){l(v)&&b({inst:v})})},[p]),a(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:i;return yd.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,yd}p1.exports=cT();var uT=p1.exports;function h1(e){e.reaction=new ao("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function dT(e,t){t===void 0&&(t="observed");var n=h.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(i){return bd.unregister(r),r.onStoreChange=i,r.reaction||(h1(r),r.stateVersion=Symbol()),function(){var l;r.onStoreChange=null,(l=r.reaction)===null||l===void 0||l.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var o=n.current;o.reaction||(h1(o),bd.register(n,o,o)),h.useDebugValue(o.reaction,oT),uT.useSyncExternalStore(o.subscribe,o.getSnapshot,o.getSnapshot);var s,a;if(o.reaction.track(function(){try{s=e()}catch(i){a=i}}),a)throw a;return s}var wd,Sd,g1=typeof Symbol=="function"&&Symbol.for,pT=(Sd=(wd=Object.getOwnPropertyDescriptor(function(){},"name"))===null||wd===void 0?void 0:wd.configurable)!==null&&Sd!==void 0?Sd:!1,m1=g1?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,v1=g1?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function ce(e,t){var n;if(v1&&e.$$typeof===v1)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 r=(n=void 0)!==null&&n!==void 0?n:!1,o=e,s=e.displayName||e.name;if(m1&&e.$$typeof===m1&&(r=!0,o=e.render,typeof o!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a=function(i,l){return dT(function(){return o(i,l)},s)};return a.displayName=e.displayName,pT&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),r&&(a=h.forwardRef(a)),a=h.memo(a),hT(e,a),a}var fT={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function hT(e,t){Object.keys(e).forEach(function(n){fT[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Cd;rT(zn.unstable_batchedUpdates),Cd=bd.finalizeAllImmediately;const b1=new Map,gT=(e,t)=>`${t}-${e}`,y1=qt(function({svg:t,iconSize:n,...r},o){const s=gT(t,n);let a=b1.get(s);return a||(a=WS(t,n),b1.set(s,a)),c.jsx("div",{...r,ref:o,dangerouslySetInnerHTML:{__html:a}})});let w1;const mT=e=>{w1=e},vT=()=>w1;var q=(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))(q||{});const Wl={alertRhombus:lC,alignHorizontalCenter:cC,alignHorizontalLeft:uC,alignHorizontalRight:dC,applicationBracketsOutline:pC,arrowDown:fC,arrowExpandAll:hC,arrowRight:gC,arrowULeftTop:mC,arrowURightTop:vC,borderAllVariant:yC,borderRadius:wC,borderStyle:SC,calendar:CC,cellphoneLink:xC,check:ng,checkBold:TC,checkboxBlank:PC,chevronUp:LC,chevronDown:OC,chevronLeft:_C,chevronRight:AC,close:rg,codeBraces:NC,cog:IC,contentCopy:VC,contentSave:HC,delete:WC,dotsVertical:GC,email:qC,emailOutline:KC,eye:ZC,eyedropperVariant:QC,eyeOff:YC,eyeOffOutline:XC,eyeOutline:JC,fire:e2,flare:t2,floppy:n2,folder:r2,fullscreen:o2,gradientVertical:s2,helpCircle:a2,home:i2,image:l2,information:u2,informationVariant:d2,layers:p2,link:g2,lock:v2,lockOpenVariant:b2,menuDown:y2,newspaperVariantOutline:C2,openInNew:og,paletteSwatch:T2,panVertical:P2,pencil:O2,phone:_2,plus:A2,plusBox:L2,powerPlug:M2,refresh:N2,rhombusOutline:k2,rhombusSplit:$2,rhombusSplitOutline:I2,tag:j2,target:D2,targetVariant:F2,textBoxMultiple:B2,trayArrowDown:W2,unfoldLessHorizontal:G2,unfoldMoreHorizontal:q2,viewDayOutline:Z2,viewGridPlus:Y2,web:X2,xml:J2,database:DC,databaseOutline:zC,databaseOutlineOn:BC,databaseOutlineOff:FC,databaseOutlineRemove:UC,codeBrackets:kC,toggleSwitchOutline:U2,toggleSwitchOffOutline:z2,null:x2,string:$C,number:E2,cloudUpload:MC,chat:EC,creation:jC,viewDashboard:K2,rocketLaunch:V2,lightningBolt:h2,stop:H2,arrowUp:bC},bT="gs-cmp-icon",re=ce(function({className:t,icon:n,size:r,rotate:o,horizontal:s,vertical:a}){const i=vT(),l=(i==null?void 0:i[n])||(Wl==null?void 0:Wl[n])||n,u=[s&&"scaleX(-1)",a&&"scaleY(-1)",o&&`rotate(${o}deg)`].filter(p=>!!p).join(" ");if(!l)return null;const d=N(bT,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(y1,{className:d,style:{transform:u||void 0},svg:l,iconSize:r}):c.jsx(za,{className:d,path:l,size:r,rotate:o,horizontal:s,vertical:a})}),xd=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"},S1={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"},yT={...{enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},...{leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"}},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"},Ed={bg:z.bg,bgH:z.bgH},C1={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"},ri={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"},se={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Oe={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"},Lo={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"},bn={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"},wT={all:"gs-utl-break-all"},lo="gs-utl-my-2",ST="gs-utl-my-3",x1=` gs-utl-rounded ${bn.xs} ${vn.mono} ${z.bgH25}`,E1=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${lo} gs-utl-ml-1`,Ht={h1:`${bn.xl2} ${vn.bold} ${ST}`,h2:`${bn.xl} ${vn.bold} ${lo}`,h3:`${bn.lg} ${vn.semibold} ${lo}`,h4:`${bn.base} ${vn.semibold} ${lo}`,h5:`${bn.sm} ${vn.semibold} ${lo}`,h6:`${bn.xs} ${vn.semibold} ${lo}`,strong:vn.bold,em:vn.italic,ul:`gs-utl-list-disc ${E1}`,ol:`gs-utl-list-decimal ${E1}`,codeInline:`${x1} gs-utl-px-1 gs-utl-py-0.5`,pre:`${x1} gs-utl-p-3 gs-utl-overflow-x-auto ${lo}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${lo} ${vn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${lo}`,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"},Gl={s:"gs-utl-size-5",m:"gs-utl-size-10"},Td={itemList:({index:e=0,open:t=!1,length:n=0}={})=>Z(z.bgH2,Pe.xyS,z.br,e&&te.bt,(t||e===n-1)&&te.bb)},T1=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),P1=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},O1=({variant:e,size:t="m",className:n,disabledClassName:r,active:o,border:s=!0,rounded:a=!0,disabled:i=!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=s&&(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,a&&te.rnd,l&&z.bg,b?Z(te.b,z.br,f&&z.bA,f&&z.tAo,!i&&z.hBgH):Z(te.b,te.bT),m&&Z(z.bgW,!i&&z.hBgW,"gs-utl-text-white"),v&&Z(z.bgRed,!i&&z.hBgRed,"gs-utl-text-white"),p&&Z(z.bgA2,!i&&z.hBgAct),o&&z.bgA,i&&(r??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",ri.focus]};function Ke({children:e,...t}){const{variant:n,size:r,active:o,border:s,rounded:a,block:i,full:l,className:u,icon:d,loading:p,withBg:f,disabled:g,type:m="button",disabledClassName:v,...b}=t,w=p?{icon:m2,size:"18px",className:Z("animate-spin-fast")}:ct(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:Z(O1(t)),disabled:g||p,type:m,...b,children:w?c.jsxs(I,{className:Z("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(B,{children:c.jsx(re,{...w})}),e&&c.jsx(B,{children:e})]}):e})}function Mo({full:e,abs:t,small:n,size:r,className:o,bg:s,currentColor:a}){const i=N(e&&"gs-utl-w-full gs-utl-h-full",t?Oe.coverAbs:"gs-utl-relative",o),l=N(!r&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),r==="x2s"&&"gs-utl-size-3",r==="xs"&&"gs-utl-size-4",r==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",te.pill,te.bS,a?"gs-utl-border-current":te.bA);return c.jsxs(I,{className:i,items:"center",justify:"center",children:[!!s&&c.jsx("div",{className:N(Oe.coverAbs,z.bg,Oe.disabled)}),c.jsx("div",{className:l})]})}const Jt={accessToken:""},CT=()=>{Jt.timeout&&(clearTimeout(Jt.timeout),Jt.timeout=void 0),Jt.accessToken="",Jt.license=void 0},_1=async()=>{var t;let e={accessToken:""};try{const n=await((t=Jt.getAccessToken)==null?void 0:t.call(Jt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Jt.getAccessToken&&console.error("Failed to get access token");return}if(Jt.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Jt.timeout||void 0),Jt.timeout=setTimeout(_1,n-Date.now()-1)}},A1=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},sa=e=>A1(e)==="email",xT=e=>{var o;const t=M1(e),n=sa(e),r=e.getWrapper();return t.length>1?!1:n?((o=r==null?void 0:r.findFirstType("mj-body"))==null?void 0:o.components().length)===0:(r==null?void 0:r.components().length)===0},L1=(e,t={})=>{const{selectedComponents:n=[],withPageContent:r,imageUrls:o=[]}=t,s=e.Pages.getSelected(),a=e.getSelected(),i=A1(e),l=M1(e),u=xT(e),d=s?{id:s.getId(),name:s.getName(),content:r?AT(e):void 0}:void 0,p=a?{id:a.getId(),content:a.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:p,selectedComponents:n.map(f=>({id:f.getId(),content:""})),projectType:i,availablePages:l,globalStyles:ET(e),installedPlugins:TT(e),devices:_T(e),isEmail:i==="email",imageUrls:o}},Pd=(e,t,n)=>{const{layoutComponents:r}=n||{},o=t,s=o.type,a=s?r==null?void 0:r[s]:void 0;return a?{...o,...a({editor:e,props:t})}:t},Qt=(e,t,n)=>{const r=Pd(e,t,n);return e.runCommand(ne.layoutComponentRender,{components:r})};function ET(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
16
+ `)}const M1=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),TT=e=>{const t=OT(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},PT=e=>e.getModel().get("customData")??{},OT=e=>e&&PT(e).plugins||[];function _T(e){return e.Devices.getAll().map(t=>t.toJSON())}function ql(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const Kl=(e="",t,n={})=>{!t||!e||(t.innerHTML=ql(e),!n.skipScroll&&(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var r;return(r=t==null?void 0:t.lastElementChild)==null?void 0:r.scrollIntoView({block:"nearest"})})))},N1=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function Zl(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function Yl(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function AT(e){const t=e.getWrapper(),n=N1(t);return`${sa(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const LT=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],r=new Map,o=document.createElement("div");o.setAttribute("data-temp-els","true");const s=(a,i)=>{try{i.innerHTML=a.innerHTML,Array.from(a.attributes).forEach(l=>i.setAttribute(l.name,l.value))}catch{}};return{cleanup(){o==null||o.remove()},update:a=>{var f;const i=new DOMParser,l=ql(a),u=i.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(o),d.forEach(g=>{var v,b;let m=g.id;if(m){const w=r.get(m),y=t.getById(m),S=y==null?void 0:y.getEl();S&&(s(g,S),!w&&requestAnimationFrame(()=>S==null?void 0:S.scrollIntoView({block:"nearest"}))),r.set(m,{cmp:y,cmpEl:S,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 w=(b=r.get(m))==null?void 0:b.newNode;w?s(g,w):(o.appendChild(g),r.set(m,{newNode:g}))}}),r}}},MT=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:r,Css:o}=n,{html:s,css:a}=r.parseHtml(t,{returnArray:!0}),i=s[0];e.getId()===((u=i==null?void 0:i.attributes)==null?void 0:u.id)?(e.components().reset(i.components),e.addAttributes({...i==null?void 0:i.attributes,class:(d=i==null?void 0:i.classes)==null?void 0:d.join(" ")}),a&&o.addCollection(a,{extend:!0})):e.components(t)};function NT(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const Kn="gs-cmp-ai-chat-tool-generate-image",kT=e=>{var x;const{editor:t,part:n,chatContext:r,isProcessing:o}=e,s=(E,T)=>t.t(`aiChat.message.tool.generateImage.${E}`,T),a=n.input||{},i=r.toolStatusProgress.get(n.toolCallId),l=(x=i==null?void 0:i.content)==null?void 0:x.trim(),u=l||s("generating"),d=Math.min(Math.max(a.n||1,1),4),p=NT(n.output),f=sa(t),g=E=>{const T=t.getSelected(),_=f?"mj-image":"image",O={type:_,attributes:{src:E}};let P;if(T!=null&&T.is(_)){T.addAttributes({src:E});return}if(T&&t.Components.canMove(T,O))P=T.append(O)[0];else if(!T){const A=t.getWrapper(),M=f?A==null?void 0:A.findFirstType("mj-column"):A;P=M==null?void 0:M.append(O)[0]}P&&t.select(P,{scroll:!0})},m=E=>{t.Canvas.startDrag({content:{type:f?"mj-image":"image",attributes:{src:E}}})},v=()=>{t.Canvas.endDrag()},b=N(`${Kn}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),w=N(`${Kn}__item`,te.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=N(`${Kn}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),S=N(`${Kn}__item-actions`,Oe.hoverGroup,"gs-utl-absolute gs-utl-left-1 gs-utl-right-1 gs-utl-bottom-1");let C=null;return o?C=c.jsxs(c.Fragment,{children:[!!u&&c.jsx("div",{className:N(`${Kn}__status`,bn.xs,z.txtLowEmphasis),children:u}),c.jsx("div",{className:N(`${Kn}__placeholders`,b),children:Array.from({length:d}).map((E,T)=>c.jsx(I,{className:N(`${Kn}__placeholder`,w,z.bgH50,z.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(Mo,{className:`${Kn}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${T}`))})]}):p.length?C=c.jsx("div",{className:N(`${Kn}__output`,b),children:p.map((E,T)=>c.jsxs("div",{className:w,children:[c.jsx("img",{className:y,src:E,alt:s("imageAlt",{num:T+1}),draggable:!0,onDragStart:()=>m(E),onDragEnd:v}),c.jsx(I,{className:S,children:c.jsx(Ke,{full:!0,variant:"pr",className:N(`${Kn}__btn-use`),onClick:()=>g(E),children:s("useImage")})})]},E))}):l&&(C=c.jsx("div",{className:N(`${Kn}__status`,bn.xs,z.txtLowEmphasis),children:l})),c.jsx(I,{className:Kn,col:!0,gap:"xs",children:C})};function $T(e){return{type:"custom",component:()=>c.jsx(kT,{...e})}}var xs=(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))(xs||{}),co=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(co||{}),oi=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(oi||{}),gr=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(gr||{});function IT(e){const t=sa(e),n=o=>e.t(`aiChat.message.tool.command.${o}`),r={[oi.SHOW_CODE]:{label:({isExecuted:o})=>n(o?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(ne.dialogExportCode)},[oi.IMPORT_CODE]:{label:({isExecuted:o})=>n(o?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(ne.dialogImportCode)},[oi.PREVIEW]:{label:({isExecuted:o})=>n(o?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(r[oi.PAGE_SETTINGS]={label:({isExecuted:o})=>n(o?"pageSettings.done":"pageSettings.pending"),execute:()=>{const o=e.Pages.getSelected();e.runCommand(ne.setPageSettings,{page:o,isOpen:!0})}}),r}function k1(e,t={}){const{skipDefault:n,commands:r={}}=t,o=new Map(Object.entries(n?{}:IT(e))),s=(a,i)=>e.t(`aiChat.message.tool.command.${a}`,i);return Object.entries(r).forEach(([a,i])=>{if(!i)return;const l=a,u=o.get(l);o.set(l,{execute:i.execute??(u==null?void 0:u.execute),label:i.label??(u==null?void 0:u.label)})}),{async execute(a,i){const l=o.get(a.commandId);if(!l)throw new Error(s("notFound",{id:a.commandId}));if(!l.execute)throw new Error(s("missingHandler",{id:a.commandId}));return await new Promise(d=>setTimeout(d,1500)),await l.execute({editor:e,input:a,context:i})??{success:!0}},layoutToolLabel:({part:a})=>{const i=a.input,l=i!=null&&i.commandId?o.get(i.commandId):void 0;if(!(l!=null&&l.label))return;const u=a.state==="output-available";return l.label({isExecuted:u})}}}function VT(e){const t={async execute(i){const{componentId:l}=i,u=e.Components.getById(l);return u?(u.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${l}'`}}},n={async execute(i){const{sourceId:l,targetId:u,targetIndex:d}=i,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}'`}}},r={async execute(i){const{pageId:l}=i,u=e.Pages.get(l),d=u==null?void 0:u.getMainComponent();return d?{content:N1(d)}:{success:!1,error:"Page not found"}}},o={async execute(){return{pages:e.Pages.getAll().map(l=>({id:l.getId(),name:l.getName()}))}}},s={layoutToolResult:i=>$T(i)},a=k1(e);return{[xs.REMOVE_COMPONENT]:t,[xs.MOVE_COMPONENT]:n,[xs.GET_PAGE_CONTENT]:r,[xs.LIST_PAGES]:o,[xs.GENERATE_IMAGE]:s,[xs.RUN_COMMAND]:a}}function HT(e,t){var w;const{componentId:n,position:r}=t,o=sa(e),s=e.getWrapper(),a=o?s.findFirstType("mj-body"):s;Zl(e);const i=document.createElement("div");i.style.display="contents";const{Components:l}=e;let d=l.getById(n)||a;o&&d===s&&(d=a);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(r){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,i):(w=p==null?void 0:p.getEl())==null||w.appendChild(i),{target:d,at:v,domPosition:m,tempTargetEl:g,tempDOM:i,updatePreview:y=>{let S=y;o&&(S=BT(e,d,y,v)),Kl(S,i,{skipScroll:!0})},cleanUp(){i==null||i.remove(),Yl(e)}}}const Xl="mjml",jT="mj-head",Od="gs-ai-chat-mjml-preview";function $1(e){var n;const t=((n=e.__attrToString)==null?void 0:n.call(e,{}))||"";return t?`<${e.tagName} ${t}>`:`<${e.tagName}>`}function DT(e,t){const r=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");return Array.from(r.body.children).forEach(o=>{const a=[o.getAttribute("css-class"),t].filter(Boolean).join(" ").trim();o.setAttribute("css-class",a)}),r.body.innerHTML}function FT(e,t,n){var f,g;const r=e.closestType(Xl),o=((f=r==null?void 0:r.findFirstType(jT))==null?void 0:f.toHTML())||"",s=e.components().map(m=>m.toHTML()),a=typeof n=="number"?Math.max(0,Math.min(n,s.length)):s.length;s.splice(a,0,t);const i=s.join(""),l=[];let u=e.parent();for(;u&&u.tagName!==Xl;)(g=u.tagName)!=null&&g.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>$1(m)).join(""),p=l.map(m=>`</${m.tagName}>`).join("");return`<${Xl}>${o}${d}${$1(e)}${i}</${e.tagName}>${p}</${Xl}>`}function BT(e,t,n,r){var s;const o=ql(n);if(!(o!=null&&o.trim()))return"";try{const a=DT(o,Od),i=FT(t,a,r),l=(s=e.runCommand(I1,{mjml:i}))==null?void 0:s.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 zT(e,t,n){const{target:r,at:o}=t,s=r==null?void 0:r.append(n,{at:o})[0];return s&&setTimeout(()=>e.select(s,{scroll:!0}),50),s}function UT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:co.ADD_COMPONENT_CODE,toolSetup:HT(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.updatePreview(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;zT(t,i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function WT(e){Zl(e);const t=LT(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),Yl(e)}}}function GT(e,t){const n=e.getWrapper();t.mapUpdates.forEach(r=>{const{cmp:o,newNode:s}=r,{outerHTML:a}=s;o?MT(o,a):n==null||n.append(a)})}function qT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){i||(i={type:co.EDIT_COMPONENT_CODE,toolSetup:WT(t),content:""},r.set(s,i)),a==="streaming"&&o.content&&(i.content=o.content,i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content));return}if(a==="done"&&i&&o.content){if(i.completed)return;i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(o.content),GT(t,i.toolSetup),i.completed=!0,l()}if(a==="error"){l();return}}function KT(e,t){const{name:n}=t,{Pages:r,Components:o}=e;Zl(e);const s=r.add({name:n,component:"<h1></h1>"},{select:!0}),a=s.getMainComponent();return a.once(o.events.render,()=>{const i=a.getEl();i&&Kl(`<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>`,i,{skipScroll:!0})}),{pageId:s.getId(),cmpRoot:a,cleanUp(){Zl(e)}}}function WT(e,t){const{cmpRoot:n}=e;n.components(t)}function GT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:io.ADD_PAGE_CODE,toolSetup:UT(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const u=i.toolSetup.cmpRoot.getEl();u&&ql(o.content,u,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;WT(i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function qT(e){Kl(e);const t=e.getWrapper(),n=L1(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){Zl(e)}}}function KT(e,t,n){var o;const{Pages:r}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(o=r.getSelected())==null||o.setName(n)}const I1="mjml-code-to-html";function ZT(e){var u;const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:io.ADD_PROJECT_PAGE_CODE,toolSetup:qT(t),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const{isEmail:d,cmpRoot:f}=i.toolSetup,p=f.getEl();let g=o.content;if(d){const m=Gl(g);try{const v=(u=t.runCommand(I1,{mjml:m}))==null?void 0:u.html;v&&(g=v)}catch{}}p&&ql(g,p,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;KT(t,o.content,o.input.name),i.completed=!0,l()}if(a==="error"){l();return}}const V1={[io.ADD_COMPONENT_CODE]:DT,[io.EDIT_COMPONENT_CODE]:zT,[io.ADD_PAGE_CODE]:GT,[io.ADD_PROJECT_PAGE_CODE]:ZT},YT=({editor:e,data:t,toolStatusProgress:n,tools:r,chatApi:o})=>{var u;if(t.type!=="data-tool-status")return;const s=t,a=((u=s.data)==null?void 0:u.name)||"",i=V1[a];i?i({editor:e,toolStatus:s,toolStatusProgress:n}):XT({toolStatus:s,toolStatusProgress:n});const l=r[a];if(!(!(l!=null&&l.onData)||!o))try{l.onData({editor:e,chatApi:o,toolStatus:s,toolStatusProgress:n})}catch(d){o.setError(d)}};function XT({toolStatus:e,toolStatusProgress:t}){const{id:n,data:r}=e;if(!n||!r)return;const{status:o,content:s}=r;let a=t.get(n);a||(a={type:"generic",content:"",completed:!1},t.set(n,a)),o==="streaming"&&s&&(a.content=s),o==="done"&&(s&&(a.content=s),t.delete(n)),o==="error"&&t.delete(n)}var JT={NODE_ENV:"production"};class QT{constructor(t,n){var s;this.chatStates=new Map,this.editor=t,this.options=n;const r=NT(t);this.tools=((s=n.tools)==null?void 0:s.call(n,{defaultTools:r,createCommandTool:a=>$1(t,a),editor:t}))||r;const{chat:o}=this.createChat();this.currentChatId=o.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 r=this.createChat();this.currentChatId=r.chat.id}}}createChat(t){const n=this.editor,r=new Map,o=new Set,s=new Set,{tools:a}=this,{chatApi:i,onTool:l,body:u,defaultTransportOptions:d={},chatOptions:f={},onMessagesUpdate:p,messages:g}=this.options,{onFinish:m,onData:v,...b}=f,w=typeof g=="function",y=[],S=new rn.Chat({id:t,messages:Array.isArray(g)?g:void 0,sendAutomaticallyWhen:sr.lastAssistantMessageIsCompleteWithToolCalls,transport:new sr.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:O,messages:P,body:A,id:M,trigger:$,credentials:j}){var U;const L={...A,id:M,trigger:$,messages:P.slice(-10),projectContext:L1(n,{withPageContent:!0,selectedComponents:Array.from(s)}),userPrompt:""},D=typeof u=="function"?u({editor:n,body:L,messages:P}):u,{accessToken:W,license:F}=Xt,k=JT.NODE_ENV!=="production",H=`${Bu({isDev:k,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!F||["enterprise","business"].includes(((U=F==null?void 0:F.plan)==null?void 0:U.category)??"free"))&&typeof i<"u"?typeof i=="function"?i():i:H,headers:{...O,...W?{Authorization:`Bearer ${W}`}:{}},credentials:j,body:{...L,...D}}}}),onToolCall:async({toolCall:O})=>{l==null||l({toolCall:O});const P=!!V1[O.toolName];if(O.dynamic||P)return;const{toolName:A,input:M,toolCallId:$}=O,j=a[A];if(j&&j.execute){const L=new AbortController;o.add(L);try{const{messages:D}=S,W=await Promise.race([j.execute(M||{},{editor:n,messages:D,lastUserMessage:D.findLast(F=>F.role==="user"),toolCallId:$,abortController:L}),new Promise((F,k)=>{L.signal.addEventListener("abort",()=>k(new Error("Aborted")))})]);if(W&&typeof W.error=="string")throw new Error(W.error);S.addToolOutput({tool:A,toolCallId:$,output:W})}catch(D){S.addToolOutput({tool:A,toolCallId:$,state:"output-error",errorText:D instanceof Error?D.message:"Unknown error"})}finally{o.delete(L)}}},onData(O){v==null||v(O),YT({editor:n,data:O,toolStatusProgress:r,tools:a,chatApi:x})},onFinish(O){p==null||p({messages:O.messages,editor:n}),O.isAbort&&(r.forEach(P=>{"toolSetup"in P&&P.toolSetup.cleanUp()}),r.clear()),m==null||m(O)},...b}),C=new Set,x={get messages(){return S.messages},get lastMessage(){return S.lastMessage},get status(){return S.status},get error(){return S.error},sendMessage:(...O)=>E.isMessagesLoaded?S.sendMessage(...O):(y.push(O),Promise.resolve()),setMessages:O=>{S.messages=O},clearError:()=>S.clearError(),stop:()=>S.stop(),setError:O=>{const P=O instanceof Error?O:new Error(String(O));S.setStatus({status:"error",error:P})}},E={chat:S,chatApi:x,isMessagesLoaded:!w,toolStatusProgress:r,toolAbortControllers:o,contextComponents:s,onUpdate:O=>(C.add(O),()=>{C.delete(O)}),emitUpdate:()=>{C.forEach(O=>O())}},T=async()=>{if(!E.isMessagesLoaded||y.length===0)return;const O=y.splice(0);for(const P of O)await S.sendMessage(...P)};this.chatStates.set(S.id,E);const _=()=>{S["~registerMessagesCallback"](()=>{S.status==="ready"&&(p==null||p({messages:S.messages,editor:n}))})};return w?g({editor:n}).then(O=>{S.messages=O,_()}).catch(O=>x.setError(O)).finally(()=>{E.isMessagesLoaded=!0,T().catch(O=>x.setError(O)),E.emitUpdate()}):_(),E}}const RT=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],e5=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],sa="gs-cmp-ai-chat-empty",t5=({className:e,style:t,chatContext:n,editor:r,suggestions:o})=>{const{sendMessage:s}=n,a="aiChat.emptyState",i=N(sa,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=r.t(`${a}.title`),u=r.t(`${a}.subtitle`),d=oa(r)?e5:RT,f=o??d;return c.jsxs(I,{className:i,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(I,{className:`${sa}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:N(`${sa}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:N(`${sa}__subtitle`,z.txtLowEmphasis),children:u})]}),c.jsx(I,{col:!0,className:`${sa}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:f.map(p=>{const g=r.t(`${a}.suggestions.${p.id}`)||p.label,m=p.prompt??g;return c.jsx(Ke,{className:`${sa}__suggestion`,onClick:()=>s({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},p.id)})})]})},oi="gs-cmp-ai-chat-error",n5=({className:e,style:t,chatContext:n,editor:r})=>{var i;const o=N(oi,e,z.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),s=`${oi}__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(I,{className:o,style:t,gap:"xs",col:!0,children:[c.jsxs(I,{className:`${oi}__header`,items:"center",gap:"xs",children:[c.jsx(B,{className:`${oi}__header-title`,grow:!0,children:r.t("aiChat.error.title")}),c.jsx(Ke,{className:`${oi}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(B,{className:s,grow:!0,children:(i=n.error)==null?void 0:i.message})]})},Od="gs-cmp-ai-chat-header",r5=({className:e,chatContext:t,title:n,editor:r,layoutBefore:o,layoutAfter:s,clearButtonProps:a,onClear:i,...l})=>{const[u,d]=h.useState(!1),{messages:f,setMessages:p,status:g}=t,m=N(Od,e,te.bb,z.br,Te.s),v=g==="streaming"||g==="submitted",b="aiChat.header",w=r.runCommand(pr.getChatApi),y={isClearing:u,setIsClearing:d},S=()=>{d(!0),p([])},{className:C,children:x,...E}=a||{},T={chatApi:w,messages:f,state:y},_=o==null?void 0:o(T),O=s==null?void 0:s(T),P=async A=>{if(!u)try{i?await i({...T,clear:S,event:A}):S()}catch(M){t.setError(M instanceof Error?M:new Error(String(M)))}finally{d(!1)}};return c.jsxs(I,{className:m,items:"center",gap:"s",...l,children:[_&&Jt(r,_),c.jsx(B,{className:`${Od}__title`,grow:!0,children:n??r.t(`${b}.title`)}),f.length>0&&c.jsx(Ke,{className:N(`${Od}__btn-clear`,C,Pe.hover,te.none),onClick:P,size:"xs",border:!1,icon:"delete",loading:u,disabled:v,...E,children:x??r.t(`${b}.clear`)}),O&&Jt(r,O)]})};function aa(e,t,n){let r=n.initialDeps??[],o;return()=>{var s,a,i,l;let u;n.key&&((s=n.debug)!=null&&s.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((g,m)=>r[m]!==g)))return o;r=d;let p;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(p=Date.now()),o=t(...d),n.key&&((i=n.debug)!=null&&i.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-p)*100)/100,v=m/16,b=(w,y)=>{for(w=String(w);w.length<y;)w=" "+w;return w};console.info(`%c⏱ ${b(m,5)} /${b(g,5)} ms`,`
18
+ </h1>`,i,{skipScroll:!0})}),{pageId:s.getId(),cmpRoot:a,cleanUp(){Yl(e)}}}function ZT(e,t){const{cmpRoot:n}=e;n.components(t)}function YT(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:co.ADD_PAGE_CODE,toolSetup:KT(t,o.input),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const u=i.toolSetup.cmpRoot.getEl();u&&Kl(o.content,u,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;ZT(i.toolSetup,o.content),i.completed=!0,l()}if(a==="error"){l();return}}function XT(e){Zl(e);const t=e.getWrapper(),n=L1(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){Yl(e)}}}function JT(e,t,n){var o;const{Pages:r}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(o=r.getSelected())==null||o.setName(n)}const I1="mjml-code-to-html";function QT(e){var u;const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:o,id:s}=n,{status:a}=o;let i=r.get(s);const l=()=>{i==null||i.toolSetup.cleanUp(),r.delete(s)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:co.ADD_PROJECT_PAGE_CODE,toolSetup:XT(t),content:""},r.set(s,i)),a==="streaming"&&o.content){i.content=o.content;const{isEmail:d,cmpRoot:p}=i.toolSetup,f=p.getEl();let g=o.content;if(d){const m=ql(g);try{const v=(u=t.runCommand(I1,{mjml:m}))==null?void 0:u.html;v&&(g=v)}catch{}}f&&Kl(g,f,{skipScroll:!0})}return}if(a==="done"&&i&&o.content){if(i.completed)return;JT(t,o.content,o.input.name),i.completed=!0,l()}if(a==="error"){l();return}}const V1={[co.ADD_COMPONENT_CODE]:UT,[co.EDIT_COMPONENT_CODE]:qT,[co.ADD_PAGE_CODE]:YT,[co.ADD_PROJECT_PAGE_CODE]:QT},RT=({editor:e,data:t,toolStatusProgress:n,tools:r,chatApi:o})=>{var u;if(t.type!=="data-tool-status")return;const s=t,a=((u=s.data)==null?void 0:u.name)||"",i=V1[a];i?i({editor:e,toolStatus:s,toolStatusProgress:n}):e5({toolStatus:s,toolStatusProgress:n});const l=r[a];if(!(!(l!=null&&l.onData)||!o))try{l.onData({editor:e,chatApi:o,toolStatus:s,toolStatusProgress:n})}catch(d){o.setError(d)}};function e5({toolStatus:e,toolStatusProgress:t}){const{id:n,data:r}=e;if(!n||!r)return;const{status:o,content:s}=r;let a=t.get(n);a||(a={type:"generic",content:"",completed:!1},t.set(n,a)),o==="streaming"&&s&&(a.content=s),o==="done"&&(s&&(a.content=s),t.delete(n)),o==="error"&&t.delete(n)}var t5={NODE_ENV:"production"};class n5{constructor(t,n){var s;this.chatStates=new Map,this.editor=t,this.options=n;const r=VT(t);this.tools=((s=n.tools)==null?void 0:s.call(n,{defaultTools:r,createCommandTool:a=>k1(t,a),editor:t}))||r;const{chat:o}=this.createChat();this.currentChatId=o.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 r=this.createChat();this.currentChatId=r.chat.id}}}createChat(t){const n=this.editor,r=new Map,o=new Set,s=new Set,{tools:a}=this,{chatApi:i,onTool:l,body:u,defaultTransportOptions:d={},chatOptions:p={},onMessagesUpdate:f,messages:g}=this.options,{onFinish:m,onData:v,...b}=p,w=typeof g=="function",y=[],S=new on.Chat({id:t,messages:Array.isArray(g)?g:void 0,sendAutomaticallyWhen:ar.lastAssistantMessageIsCompleteWithToolCalls,transport:new ar.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:O,messages:P,body:A,id:M,trigger:k,credentials:j}){var U;const L={...A,id:M,trigger:k,messages:P.slice(-10),projectContext:L1(n,{withPageContent:!0,selectedComponents:Array.from(s)}),userPrompt:""},D=typeof u=="function"?u({editor:n,body:L,messages:P}):u,{accessToken:W,license:F}=Jt,$=t5.NODE_ENV!=="production",H=`${zu({isDev:$,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!F||["enterprise","business"].includes(((U=F==null?void 0:F.plan)==null?void 0:U.category)??"free"))&&typeof i<"u"?typeof i=="function"?i():i:H,headers:{...O,...W?{Authorization:`Bearer ${W}`}:{}},credentials:j,body:{...L,...D}}}}),onToolCall:async({toolCall:O})=>{l==null||l({toolCall:O});const P=!!V1[O.toolName];if(O.dynamic||P)return;const{toolName:A,input:M,toolCallId:k}=O,j=a[A];if(j&&j.execute){const L=new AbortController;o.add(L);try{const{messages:D}=S,W=await Promise.race([j.execute(M||{},{editor:n,messages:D,lastUserMessage:D.findLast(F=>F.role==="user"),toolCallId:k,abortController:L}),new Promise((F,$)=>{L.signal.addEventListener("abort",()=>$(new Error("Aborted")))})]);if(W&&typeof W.error=="string")throw new Error(W.error);S.addToolOutput({tool:A,toolCallId:k,output:W})}catch(D){S.addToolOutput({tool:A,toolCallId:k,state:"output-error",errorText:D instanceof Error?D.message:"Unknown error"})}finally{o.delete(L)}}},onData(O){v==null||v(O),RT({editor:n,data:O,toolStatusProgress:r,tools:a,chatApi:x})},onFinish(O){f==null||f({messages:O.messages,editor:n}),O.isAbort&&(r.forEach(P=>{"toolSetup"in P&&P.toolSetup.cleanUp()}),r.clear()),m==null||m(O)},...b}),C=new Set,x={get messages(){return S.messages},get lastMessage(){return S.lastMessage},get status(){return S.status},get error(){return S.error},sendMessage:(...O)=>E.isMessagesLoaded?S.sendMessage(...O):(y.push(O),Promise.resolve()),setMessages:O=>{S.messages=O},clearError:()=>S.clearError(),stop:()=>S.stop(),setError:O=>{const P=O instanceof Error?O:new Error(String(O));S.setStatus({status:"error",error:P})}},E={chat:S,chatApi:x,isMessagesLoaded:!w,toolStatusProgress:r,toolAbortControllers:o,contextComponents:s,onUpdate:O=>(C.add(O),()=>{C.delete(O)}),emitUpdate:()=>{C.forEach(O=>O())}},T=async()=>{if(!E.isMessagesLoaded||y.length===0)return;const O=y.splice(0);for(const P of O)await S.sendMessage(...P)};this.chatStates.set(S.id,E);const _=()=>{S["~registerMessagesCallback"](()=>{S.status==="ready"&&(f==null||f({messages:S.messages,editor:n}))})};return w?g({editor:n}).then(O=>{S.messages=O,_()}).catch(O=>x.setError(O)).finally(()=>{E.isMessagesLoaded=!0,T().catch(O=>x.setError(O)),E.emitUpdate()}):_(),E}}const r5=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],o5=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],aa="gs-cmp-ai-chat-empty",s5=({className:e,style:t,chatContext:n,editor:r,suggestions:o})=>{const{sendMessage:s}=n,a="aiChat.emptyState",i=N(aa,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=r.t(`${a}.title`),u=r.t(`${a}.subtitle`),d=sa(r)?o5:r5,p=o??d;return c.jsxs(I,{className:i,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(I,{className:`${aa}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:N(`${aa}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:N(`${aa}__subtitle`,z.txtLowEmphasis),children:u})]}),c.jsx(I,{col:!0,className:`${aa}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:p.map(f=>{const g=r.t(`${a}.suggestions.${f.id}`)||f.label,m=f.prompt??g;return c.jsx(Ke,{className:`${aa}__suggestion`,onClick:()=>s({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},f.id)})})]})},si="gs-cmp-ai-chat-error",a5=({className:e,style:t,chatContext:n,editor:r})=>{var i;const o=N(si,e,z.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),s=`${si}__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(I,{className:o,style:t,gap:"xs",col:!0,children:[c.jsxs(I,{className:`${si}__header`,items:"center",gap:"xs",children:[c.jsx(B,{className:`${si}__header-title`,grow:!0,children:r.t("aiChat.error.title")}),c.jsx(Ke,{className:`${si}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(B,{className:s,grow:!0,children:(i=n.error)==null?void 0:i.message})]})},_d="gs-cmp-ai-chat-header",i5=({className:e,chatContext:t,title:n,editor:r,layoutBefore:o,layoutAfter:s,clearButtonProps:a,onClear:i,...l})=>{const[u,d]=h.useState(!1),{messages:p,setMessages:f,status:g}=t,m=N(_d,e,te.bb,z.br,Pe.s),v=g==="streaming"||g==="submitted",b="aiChat.header",w=r.runCommand(gr.getChatApi),y={isClearing:u,setIsClearing:d},S=()=>{d(!0),f([])},{className:C,children:x,...E}=a||{},T={chatApi:w,messages:p,state:y},_=o==null?void 0:o(T),O=s==null?void 0:s(T),P=async A=>{if(!u)try{i?await i({...T,clear:S,event:A}):S()}catch(M){t.setError(M instanceof Error?M:new Error(String(M)))}finally{d(!1)}};return c.jsxs(I,{className:m,items:"center",gap:"s",...l,children:[_&&Qt(r,_),c.jsx(B,{className:`${_d}__title`,grow:!0,children:n??r.t(`${b}.title`)}),p.length>0&&c.jsx(Ke,{className:N(`${_d}__btn-clear`,C,Oe.hover,te.none),onClick:P,size:"xs",border:!1,icon:"delete",loading:u,disabled:v,...E,children:x??r.t(`${b}.clear`)}),O&&Qt(r,O)]})};function ia(e,t,n){let r=n.initialDeps??[],o;return()=>{var s,a,i,l;let u;n.key&&((s=n.debug)!=null&&s.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((g,m)=>r[m]!==g)))return o;r=d;let f;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(f=Date.now()),o=t(...d),n.key&&((i=n.debug)!=null&&i.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-f)*100)/100,v=m/16,b=(w,y)=>{for(w=String(w);w.length<y;)w=" "+w;return w};console.info(`%c⏱ ${b(m,5)} /${b(g,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,o),o}}function _d(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const o5=(e,t)=>Math.abs(e-t)<1,s5=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};var si={NODE_ENV:"production"};const a5=e=>e,i5=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},l5=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:i,height:l}=a;t({width:Math.round(i),height:Math.round(l)})};if(o(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const i=a[0];if(i!=null&&i.borderBoxSize){const l=i.borderBoxSize[0];if(l){o({width:l.inlineSize,height:l.blockSize});return}}o(n.getBoundingClientRect())});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},H1={passive:!0},c5=typeof window>"u"?!0:"onscrollend"in window,u5=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=c5?()=>{}:s5(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=u=>()=>{const{horizontal:d,isRtl:f}=e.options;o=d?n.scrollLeft*(f&&-1||1):n.scrollTop,s(),t(o,u)},i=a(!0),l=a(!1);return l(),n.addEventListener("scroll",i,H1),n.addEventListener("scrollend",l,H1),()=>{n.removeEventListener("scroll",i),n.removeEventListener("scrollend",l)}},d5=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},f5=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const a=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class p5{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 r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{this._measureElement(s.target,s)})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:a5,rangeExtractor:i5,onChange:()=>{},measureElement:d5,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 r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=aa(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:si.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 r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,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(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,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,r)=>{const o=new Map,s=new Map;for(let a=r-1;a>=0;a--){const i=n[a];if(o.has(i.lane))continue;const l=s.get(i.lane);if(l==null||i.end>l.end?s.set(i.lane,i):i.end<l.end&&o.set(i.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=aa(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,o,s,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a}),{key:!1}),this.getMeasurements=aa(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a},i)=>{if(!a)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 f=s(d),p=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=p?p.end+this.options.gap:r+o,m=i.get(f),v=typeof m=="number"?m:this.options.estimateSize(d),b=g+v,w=p?p.lane:d%this.options.lanes;u[d]={index:d,start:g,size:v,end:b,key:f,lane:w}}return this.measurementsCache=u,u},{key:si.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=aa(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,o)=>this.range=n.length>0&&r>0?h5({measurements:n,outerSize:r,scrollOffset:o}):null,{key:si.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=aa(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,o,s)=>r===null?[]:n({startIndex:r.startIndex,endIndex:r.endIndex,overscan:o,count:s}),{key:si.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),s=this.measurementsCache[o];if(!s)return;const a=s.key,i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const s=this.itemSizeCache.get(o.key)??o.size,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=aa(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,a=n.length;s<a;s++){const i=n[s],l=r[i];o.push(l)}return o},{key:si.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return _d(r[j1(0,r.length-1,o=>_d(r[o]).start,n)])},this.getOffsetForAlignment=(n,r)=>{const o=this.getSize(),s=this.getScrollOffset();r==="auto"&&(n<=s?r="start":n>=s+o?r="end":r="start"),r==="start"?n=n:r==="end"?n=n-o:r==="center"&&(n=n-o/2);const a=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-o;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const s=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(o.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const i=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,r),r]},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:r="start",behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,i]=s;this._scrollToOffset(a,{adjustments:void 0,behavior:o}),o!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=_d(this.getOffsetForIndex(n,i));o5(u,this.getScrollOffset())||this.scrollToIndex(n,{align:i,behavior:o})}else this.scrollToIndex(n,{align:i,behavior:o})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="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:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;return r.length===0?o=this.options.paddingStart:o=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(s=>s.end)),Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const j1=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function h5({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,s=j1(0,r,i=>e[i].start,n);let a=s;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:s,endIndex:a}}const g5=typeof document<"u"?nt.useLayoutEffect:nt.useEffect;function m5(e){const t=nt.useReducer(()=>({}),{})[1],n={...e,onChange:(o,s)=>{var a;s?Fn.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,s)}},[r]=nt.useState(()=>new p5(n));return r.setOptions(n),nt.useEffect(()=>r._didMount(),[]),g5(()=>r._willUpdate()),r}function v5(e){return m5({observeElementRect:l5,observeElementOffset:u5,scrollToFn:f5,...e})}var b5=Object.defineProperty,y5=(e,t,n)=>t in e?b5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ad=(e,t,n)=>(y5(e,typeof t!="symbol"?t+"":t,n),n);let w5=class{constructor(){Ad(this,"current",this.detect()),Ad(this,"handoffState","pending"),Ad(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"}},lo=new w5,Ze=(e,t)=>{lo.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function Dt(e){let t=h.useRef(e);return Ze(()=>{t.current=e},[e]),t}function ai(e,t){let[n,r]=h.useState(e),o=Dt(e);return Ze(()=>r(o.current),[o,r,...t]),n}let oe=function(e){let t=Dt(e);return h.useCallback((...n)=>t.current(...n),[t])};function Xl(e,t,n){let[r,o]=h.useState(n),s=e!==void 0,a=h.useRef(s),i=h.useRef(!1),l=h.useRef(!1);return s&&!a.current&&!i.current?(i.current=!0,a.current=s,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.")):!s&&a.current&&!l.current&&(l.current=!0,a.current=s,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.")),[s?e:r,oe(u=>(s||o(u),t==null?void 0:t(u)))]}function Ld(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Lr(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Ld(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Lr();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function hr(){let[e]=h.useState(Lr);return h.useEffect(()=>()=>e.dispose(),[e]),e}function S5(){let e=typeof document>"u";return"useSyncExternalStore"in nt?(t=>t.useSyncExternalStore)(nt)(()=>()=>{},()=>!1,()=>!e):!1}function Jl(){let e=S5(),[t,n]=nt.useState(lo.isHandoffComplete);return t&&lo.isHandoffComplete===!1&&n(!1),nt.useEffect(()=>{t!==!0&&n(!0)},[t]),nt.useEffect(()=>lo.handoff(),[]),e?!1:t}var D1;let Et=(D1=h.useId)!=null?D1:function(){let e=Jl(),[t,n]=h.useState(e?()=>lo.nextId():null);return Ze(()=>{t===null&&n(lo.nextId())},[t]),t!=null?""+t:void 0};function ke(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ke),r}function Mo(e){return lo.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Md=["[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 _t=(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))(_t||{}),Mr=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(Mr||{}),C5=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(C5||{});function Ql(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Md)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Rl=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Rl||{});function Nd(e,t=0){var n;return e===((n=Mo(e))==null?void 0:n.body)?!1:ke(t,{0(){return e.matches(Md)},1(){let r=e;for(;r!==null;){if(r.matches(Md))return!0;r=r.parentElement}return!1}})}var x5=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(x5||{});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 E5=["textarea","input"].join(",");function T5(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,E5))!=null?n:!1}function co(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let a=o.compareDocumentPosition(s);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function an(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?co(e):e:Ql(e);o.length>0&&a.length>1&&(a=a.filter(g=>!o.includes(g))),r=r??s.activeElement;let i=(()=>{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,a.indexOf(r))-1;if(t&4)return Math.max(0,a.indexOf(r))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,f=a.length,p;do{if(d>=f||d+f<=0)return 0;let g=l+d;if(t&16)g=(g+f)%f;else{if(g<0)return 3;if(g>=f)return 1}p=a[g],p==null||p.focus(u),d+=i}while(p!==s.activeElement);return t&6&&T5(p)&&p.select(),2}function P5(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function O5(){return/Android/gi.test(window.navigator.userAgent)}function F1(){return P5()||O5()}function ec(e,t,n){let r=Dt(t);h.useEffect(()=>{function o(s){r.current(s)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function B1(e,t,n){let r=Dt(t);h.useEffect(()=>{function o(s){r.current(s)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function $d(e,t,n=!0){let r=h.useRef(!1);h.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(a,i){if(!r.current||a.defaultPrevented)return;let l=i(a);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function d(f){return typeof f=="function"?d(f()):Array.isArray(f)||f instanceof Set?f:[f]}(e);for(let d of u){if(d===null)continue;let f=d instanceof HTMLElement?d:d.current;if(f!=null&&f.contains(l)||a.composed&&a.composedPath().includes(f))return}return!Nd(l,Rl.Loose)&&l.tabIndex!==-1&&a.preventDefault(),t(a,l)}let s=h.useRef(null);ec("pointerdown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),ec("mousedown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),ec("click",a=>{F1()||s.current&&(o(a,()=>s.current),s.current=null)},!0),ec("touchend",a=>o(a,()=>a.target instanceof HTMLElement?a.target:null),!0),B1("blur",a=>o(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function xs(...e){return h.useMemo(()=>Mo(...e),[...e])}function z1(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 ia(e,t){let[n,r]=h.useState(()=>z1(e));return Ze(()=>{r(z1(e))},[e.type,e.as]),Ze(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let U1=Symbol();function kd(e,t=!0){return Object.assign(e,{[U1]:t})}function Ye(...e){let t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]);let n=oe(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[U1]))?void 0:n}function W1(e){return[e.screenX,e.screenY]}function G1(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=W1(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=W1(t)}}}function q1({container:e,accept:t,walk:n,enabled:r=!0}){let o=h.useRef(t),s=h.useRef(n);h.useEffect(()=>{o.current=t,s.current=n},[t,n]),Ze(()=>{if(!e||!r)return;let a=Mo(e);if(!a)return;let i=o.current,l=s.current,u=Object.assign(f=>i(f),{acceptNode:i}),d=a.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,r,o,s])}function K1(e,t){let n=h.useRef([]),r=oe(e);h.useEffect(()=>{let o=[...n.current];for(let[s,a]of t.entries())if(n.current[s]!==a){let i=r(t,o);return n.current=t,i}},[r,...t])}function tc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var bn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(bn||{}),No=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(No||{});function Be({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:a,mergeRefs:i}){i=i??_5;let l=Z1(t,e);if(s)return nc(l,n,r,a,i);let u=o??0;if(u&2){let{static:d=!1,...f}=l;if(d)return nc(f,n,r,a,i)}if(u&1){let{unmount:d=!0,...f}=l;return ke(d?0:1,{0(){return null},1(){return nc({...f,hidden:!0,style:{display:"none"}},n,r,a,i)}})}return nc(l,n,r,a,i)}function nc(e,t={},n,r,o){let{as:s=n,children:a,refName:i="ref",...l}=Vd(e,["unmount","static"]),u=e.ref!==void 0?{[i]:e.ref}:{},d=typeof a=="function"?a(t):a;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let f={};if(t){let p=!1,g=[];for(let[m,v]of Object.entries(t))typeof v=="boolean"&&(p=!0),v===!0&&g.push(m);p&&(f["data-headlessui-state"]=g.join(" "))}if(s===h.Fragment&&Object.keys(la(l)).length>0){if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(v=>` - ${v}`).join(`
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,o),o}}function Ad(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const l5=(e,t)=>Math.abs(e-t)<1,c5=(e,t,n)=>{let r;return function(...o){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,o),n)}};var ai={NODE_ENV:"production"};const u5=e=>e,d5=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let o=t;o<=n;o++)r.push(o);return r},p5=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const o=a=>{const{width:i,height:l}=a;t({width:Math.round(i),height:Math.round(l)})};if(o(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const s=new r.ResizeObserver(a=>{const i=a[0];if(i!=null&&i.borderBoxSize){const l=i.borderBoxSize[0];if(l){o({width:l.inlineSize,height:l.blockSize});return}}o(n.getBoundingClientRect())});return s.observe(n,{box:"border-box"}),()=>{s.unobserve(n)}},H1={passive:!0},f5=typeof window>"u"?!0:"onscrollend"in window,h5=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let o=0;const s=f5?()=>{}:c5(r,()=>{t(o,!1)},e.options.isScrollingResetDelay),a=u=>()=>{const{horizontal:d,isRtl:p}=e.options;o=d?n.scrollLeft*(p&&-1||1):n.scrollTop,s(),t(o,u)},i=a(!0),l=a(!1);return l(),n.addEventListener("scroll",i,H1),n.addEventListener("scrollend",l,H1),()=>{n.removeEventListener("scroll",i),n.removeEventListener("scrollend",l)}},g5=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const r=t.borderBoxSize[0];if(r)return Math.round(r[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},m5=(e,{adjustments:t=0,behavior:n},r)=>{var o,s;const a=e+t;(s=(o=r.scrollElement)==null?void 0:o.scrollTo)==null||s.call(o,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class v5{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 r=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(o=>{o.forEach(s=>{this._measureElement(s.target,s)})}));return{disconnect:()=>{var o;(o=r())==null||o.disconnect(),n=null},observe:o=>{var s;return(s=r())==null?void 0:s.observe(o,{box:"border-box"})},unobserve:o=>{var s;return(s=r())==null?void 0:s.unobserve(o)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,o])=>{typeof o>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:u5,rangeExtractor:d5,onChange:()=>{},measureElement:g5,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 r,o;(o=(r=this.options).onChange)==null||o.call(r,this,n)},this.maybeNotify=ia(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:ai.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 r=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==r){if(this.cleanup(),!r){this.maybeNotify();return}this.scrollElement=r,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(o=>{this.observer.observe(o)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,o=>{this.scrollRect=o,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(o,s)=>{this.scrollAdjustments=0,this.scrollDirection=s?this.getScrollOffset()<o?"forward":"backward":null,this.scrollOffset=o,this.isScrolling=s,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,r)=>{const o=new Map,s=new Map;for(let a=r-1;a>=0;a--){const i=n[a];if(o.has(i.lane))continue;const l=s.get(i.lane);if(l==null||i.end>l.end?s.set(i.lane,i):i.end<l.end&&o.set(i.lane,!0),o.size===this.options.lanes)break}return s.size===this.options.lanes?Array.from(s.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=ia(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,o,s,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a}),{key:!1}),this.getMeasurements=ia(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:o,getItemKey:s,enabled:a},i)=>{if(!a)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=s(d),f=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=f?f.end+this.options.gap:r+o,m=i.get(p),v=typeof m=="number"?m:this.options.estimateSize(d),b=g+v,w=f?f.lane:d%this.options.lanes;u[d]={index:d,start:g,size:v,end:b,key:p,lane:w}}return this.measurementsCache=u,u},{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=ia(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,o)=>this.range=n.length>0&&r>0?b5({measurements:n,outerSize:r,scrollOffset:o}):null,{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=ia(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,o,s)=>r===null?[]:n({startIndex:r.startIndex,endIndex:r.endIndex,overscan:o,count:s}),{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,o=n.getAttribute(r);return o?parseInt(o,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const o=this.indexFromElement(n),s=this.measurementsCache[o];if(!s)return;const a=s.key,i=this.elementsCache.get(a);i!==n&&(i&&this.observer.unobserve(i),this.observer.observe(n),this.elementsCache.set(a,n)),n.isConnected&&this.resizeItem(o,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const o=this.measurementsCache[n];if(!o)return;const s=this.itemSizeCache.get(o.key)??o.size,a=r-s;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(o,a,this):o.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(o.index),this.itemSizeCache=new Map(this.itemSizeCache.set(o.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,o)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(o))});return}this._measureElement(n,void 0)},this.getVirtualItems=ia(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{const o=[];for(let s=0,a=n.length;s<a;s++){const i=n[s],l=r[i];o.push(l)}return o},{key:ai.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Ad(r[j1(0,r.length-1,o=>Ad(r[o]).start,n)])},this.getOffsetForAlignment=(n,r)=>{const o=this.getSize(),s=this.getScrollOffset();r==="auto"&&(n<=s?r="start":n>=s+o?r="end":r="start"),r==="start"?n=n:r==="end"?n=n-o:r==="center"&&(n=n-o/2);const a=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-o;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const o=this.measurementsCache[n];if(!o)return;const s=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(o.end>=a+s-this.options.scrollPaddingEnd)r="end";else if(o.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const i=r==="end"?o.end+this.options.scrollPaddingEnd:o.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(i,r),r]},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:r="start",behavior:o}={})=>{this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,r),{adjustments:void 0,behavior:o})},this.scrollToIndex=(n,{align:r="auto",behavior:o}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),o==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const s=this.getOffsetForIndex(n,r);if(!s)return;const[a,i]=s;this._scrollToOffset(a,{adjustments:void 0,behavior:o}),o!=="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,i));l5(u,this.getScrollOffset())||this.scrollToIndex(n,{align:i,behavior:o})}else this.scrollToIndex(n,{align:i,behavior:o})}))},this.scrollBy=(n,{behavior:r}={})=>{this.cancelScrollToIndex(),r==="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:r})},this.getTotalSize=()=>{var n;const r=this.getMeasurements();let o;return r.length===0?o=this.options.paddingStart:o=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(s=>s.end)),Math.max(o-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:o})=>{this.options.scrollToFn(n,{behavior:o,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const j1=(e,t,n,r)=>{for(;e<=t;){const o=(e+t)/2|0,s=n(o);if(s<r)e=o+1;else if(s>r)t=o-1;else return o}return e>0?e-1:0};function b5({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,s=j1(0,r,i=>e[i].start,n);let a=s;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:s,endIndex:a}}const y5=typeof document<"u"?nt.useLayoutEffect:nt.useEffect;function w5(e){const t=nt.useReducer(()=>({}),{})[1],n={...e,onChange:(o,s)=>{var a;s?zn.flushSync(t):t(),(a=e.onChange)==null||a.call(e,o,s)}},[r]=nt.useState(()=>new v5(n));return r.setOptions(n),nt.useEffect(()=>r._didMount(),[]),y5(()=>r._willUpdate()),r}function S5(e){return w5({observeElementRect:p5,observeElementOffset:h5,scrollToFn:m5,...e})}var C5=Object.defineProperty,x5=(e,t,n)=>t in e?C5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Ld=(e,t,n)=>(x5(e,typeof t!="symbol"?t+"":t,n),n);let E5=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"}},uo=new E5,Ze=(e,t)=>{uo.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function jt(e){let t=h.useRef(e);return Ze(()=>{t.current=e},[e]),t}function ii(e,t){let[n,r]=h.useState(e),o=jt(e);return Ze(()=>r(o.current),[o,r,...t]),n}let oe=function(e){let t=jt(e);return h.useCallback((...n)=>t.current(...n),[t])};function Jl(e,t,n){let[r,o]=h.useState(n),s=e!==void 0,a=h.useRef(s),i=h.useRef(!1),l=h.useRef(!1);return s&&!a.current&&!i.current?(i.current=!0,a.current=s,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.")):!s&&a.current&&!l.current&&(l.current=!0,a.current=s,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.")),[s?e:r,oe(u=>(s||o(u),t==null?void 0:t(u)))]}function Md(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Nr(){let e=[],t={addEventListener(n,r,o,s){return n.addEventListener(r,o,s),t.add(()=>n.removeEventListener(r,o,s))},requestAnimationFrame(...n){let r=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(r))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let r=setTimeout(...n);return t.add(()=>clearTimeout(r))},microTask(...n){let r={current:!0};return Md(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,o){let s=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:o}),this.add(()=>{Object.assign(n.style,{[r]:s})})},group(n){let r=Nr();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let o of e.splice(r,1))o()}},dispose(){for(let n of e.splice(0))n()}};return t}function mr(){let[e]=h.useState(Nr);return h.useEffect(()=>()=>e.dispose(),[e]),e}function T5(){let e=typeof document>"u";return"useSyncExternalStore"in nt?(t=>t.useSyncExternalStore)(nt)(()=>()=>{},()=>!1,()=>!e):!1}function Ql(){let e=T5(),[t,n]=nt.useState(uo.isHandoffComplete);return t&&uo.isHandoffComplete===!1&&n(!1),nt.useEffect(()=>{t!==!0&&n(!0)},[t]),nt.useEffect(()=>uo.handoff(),[]),e?!1:t}var D1;let Et=(D1=h.useId)!=null?D1:function(){let e=Ql(),[t,n]=h.useState(e?()=>uo.nextId():null);return Ze(()=>{t===null&&n(uo.nextId())},[t]),t!=null?""+t:void 0};function $e(e,t,...n){if(e in t){let o=t[e];return typeof o=="function"?o(...n):o}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(o=>`"${o}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,$e),r}function No(e){return uo.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Nd=["[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 _t=(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))(_t||{}),kr=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(kr||{}),P5=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(P5||{});function Rl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Nd)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var ec=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(ec||{});function kd(e,t=0){var n;return e===((n=No(e))==null?void 0:n.body)?!1:$e(t,{0(){return e.matches(Nd)},1(){let r=e;for(;r!==null;){if(r.matches(Nd))return!0;r=r.parentElement}return!1}})}var O5=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(O5||{});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 _5=["textarea","input"].join(",");function A5(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,_5))!=null?n:!1}function po(e,t=n=>n){return e.slice().sort((n,r)=>{let o=t(n),s=t(r);if(o===null||s===null)return 0;let a=o.compareDocumentPosition(s);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ln(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:o=[]}={}){let s=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?po(e):e:Rl(e);o.length>0&&a.length>1&&(a=a.filter(g=>!o.includes(g))),r=r??s.activeElement;let i=(()=>{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,a.indexOf(r))-1;if(t&4)return Math.max(0,a.indexOf(r))+1;if(t&8)return a.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,p=a.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=a[g],f==null||f.focus(u),d+=i}while(f!==s.activeElement);return t&6&&A5(f)&&f.select(),2}function L5(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function M5(){return/Android/gi.test(window.navigator.userAgent)}function F1(){return L5()||M5()}function tc(e,t,n){let r=jt(t);h.useEffect(()=>{function o(s){r.current(s)}return document.addEventListener(e,o,n),()=>document.removeEventListener(e,o,n)},[e,n])}function B1(e,t,n){let r=jt(t);h.useEffect(()=>{function o(s){r.current(s)}return window.addEventListener(e,o,n),()=>window.removeEventListener(e,o,n)},[e,n])}function $d(e,t,n=!0){let r=h.useRef(!1);h.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function o(a,i){if(!r.current||a.defaultPrevented)return;let l=i(a);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)||a.composed&&a.composedPath().includes(p))return}return!kd(l,ec.Loose)&&l.tabIndex!==-1&&a.preventDefault(),t(a,l)}let s=h.useRef(null);tc("pointerdown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),tc("mousedown",a=>{var i,l;r.current&&(s.current=((l=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:l[0])||a.target)},!0),tc("click",a=>{F1()||s.current&&(o(a,()=>s.current),s.current=null)},!0),tc("touchend",a=>o(a,()=>a.target instanceof HTMLElement?a.target:null),!0),B1("blur",a=>o(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Es(...e){return h.useMemo(()=>No(...e),[...e])}function z1(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 la(e,t){let[n,r]=h.useState(()=>z1(e));return Ze(()=>{r(z1(e))},[e.type,e.as]),Ze(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let U1=Symbol();function Id(e,t=!0){return Object.assign(e,{[U1]:t})}function Ye(...e){let t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]);let n=oe(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r)});return e.every(r=>r==null||(r==null?void 0:r[U1]))?void 0:n}function W1(e){return[e.screenX,e.screenY]}function G1(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=W1(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=W1(t)}}}function q1({container:e,accept:t,walk:n,enabled:r=!0}){let o=h.useRef(t),s=h.useRef(n);h.useEffect(()=>{o.current=t,s.current=n},[t,n]),Ze(()=>{if(!e||!r)return;let a=No(e);if(!a)return;let i=o.current,l=s.current,u=Object.assign(p=>i(p),{acceptNode:i}),d=a.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,r,o,s])}function K1(e,t){let n=h.useRef([]),r=oe(e);h.useEffect(()=>{let o=[...n.current];for(let[s,a]of t.entries())if(n.current[s]!==a){let i=r(t,o);return n.current=t,i}},[r,...t])}function nc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var yn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(yn||{}),ko=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(ko||{});function Be({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:o,visible:s=!0,name:a,mergeRefs:i}){i=i??N5;let l=Z1(t,e);if(s)return rc(l,n,r,a,i);let u=o??0;if(u&2){let{static:d=!1,...p}=l;if(d)return rc(p,n,r,a,i)}if(u&1){let{unmount:d=!0,...p}=l;return $e(d?0:1,{0(){return null},1(){return rc({...p,hidden:!0,style:{display:"none"}},n,r,a,i)}})}return rc(l,n,r,a,i)}function rc(e,t={},n,r,o){let{as:s=n,children:a,refName:i="ref",...l}=Hd(e,["unmount","static"]),u=e.ref!==void 0?{[i]:e.ref}:{},d=typeof a=="function"?a(t):a;"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(s===h.Fragment&&Object.keys(ca(l)).length>0){if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${r} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(v=>` - ${v}`).join(`
22
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(`
23
23
  `)].join(`
24
- `));let p=d.props,g=typeof(p==null?void 0:p.className)=="function"?(...v)=>tc(p==null?void 0:p.className(...v),l.className):tc(p==null?void 0:p.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},Z1(d.props,la(Vd(l,["ref"]))),f,u,{ref:o(d.ref,u.ref)},m))}return h.createElement(s,Object.assign({},Vd(l,["ref"]),s!==h.Fragment&&u,s!==h.Fragment&&f),d)}function Id(){let e=h.useRef([]),t=h.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function _5(...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 Z1(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...s){let a=n[r];for(let i of a){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;i(o,...s)}}});return t}function ze(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function la(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Vd(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let A5="div";var gr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(gr||{});function L5(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&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",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Be({ourProps:s,theirProps:o,slot:{},defaultTag:A5,name:"Hidden"})}let mr=ze(L5),Hd=h.createContext(null);Hd.displayName="OpenClosedContext";var ft=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(ft||{});function Es(){return h.useContext(Hd)}function ii({value:e,children:t}){return h.createElement(Hd.Provider,{value:e},t)}function M5(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Ts=[];M5(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Ts[0]!==t.target&&(Ts.unshift(t.target),Ts=Ts.filter(n=>n!=null&&n.isConnected),Ts.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 $o(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&N5(n)?!1:r}function N5(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function $5(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 jd(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:$5(e)}}function rc(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))X1(n,Y1(t,r),o);return n}function Y1(e,t){return e?e+"["+t+"]":t}function X1(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())X1(e,Y1(t,r.toString()),o);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,""]):rc(n,t,e)}function J1(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}var ve=(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))(ve||{}),k5={NODE_ENV:"production"},I5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(I5||{}),V5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(V5||{}),H5=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(H5||{}),j5=(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))(j5||{});function Dd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((a,i)=>a.dataRef.current.order-i.dataRef.current.order):co(r,a=>a.dataRef.current.domRef.current),s=n?o.indexOf(n):null;return s===-1&&(s=null),{options:o,activeOptionIndex:s}}let D5={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 r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,s,a;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Je.Specific?t.idx:jd(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var p,g;return(g=(p=e.activeOptionIndex)!=null?p:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),f=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===d&&e.activationTrigger===f?e:{...e,activeOptionIndex:d,activationTrigger:f}}let i=Dd(e);if(i.activeOptionIndex===null){let d=i.options.findIndex(f=>!f.dataRef.current.disabled);d!==-1&&(i.activeOptionIndex=d)}let l=t.focus===Je.Specific?t.idx:jd(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(a=t.trigger)!=null?a:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...i,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let s=t.payload,a=Dd(e,l=>(l.push(s),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(s));let i={...e,...a,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(i.activeOptionIndex=0),i},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Dd(e,o=>{let s=o.findIndex(a=>a.id===t.id);return s!==-1&&o.splice(s,1),o});return{...e,...r,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 r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},Fd=h.createContext(null);Fd.displayName="ComboboxActionsContext";function li(e){let t=h.useContext(Fd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,li),n}return t}let Q1=h.createContext(null);function F5(e){var t;let n=Ps("VirtualProvider"),[r,o]=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]),s=v5({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[a,i]=h.useState(0);return Ze(()=>{i(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),h.createElement(Q1.Provider,{value:s},h.createElement("div",{style:{position:"relative",width:"100%",height:`${s.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&k5.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&s.scrollToIndex(n.activeOptionIndex)}}},s.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:`${a}-${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 Bd=h.createContext(null);Bd.displayName="ComboboxDataContext";function Ps(e){let t=h.useContext(Bd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ps),n}return t}function B5(e,t){return ke(t.type,D5,e,t)}let z5=h.Fragment;function U5(e,t){let{value:n,defaultValue:r,onChange:o,form:s,name:a,by:i=null,disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:f=!1,immediate:p=!1,virtual:g=null,...m}=e,v=!1,b=null,[w=f?[]:void 0,y]=Xl(n,o,r),[S,C]=h.useReducer(B5,{dataRef:h.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),x=h.useRef(!1),E=h.useRef({static:!1,hold:!1}),T=h.useRef(null),_=h.useRef(null),O=h.useRef(null),P=h.useRef(null),A=oe(typeof i=="string"?(R,le)=>{let ge=i;return(R==null?void 0:R[ge])===(le==null?void 0:le[ge])}:i??((R,le)=>R===le)),M=oe(R=>S.options.findIndex(le=>A(le.dataRef.current.value,R))),$=h.useCallback(R=>ke(L.mode,{1:()=>w.some(le=>A(le,R)),0:()=>A(w,R)}),[w]),j=oe(R=>S.activeOptionIndex===M(R)),L=h.useMemo(()=>({...S,immediate:v,optionsPropsRef:E,labelRef:T,inputRef:_,buttonRef:O,optionsRef:P,value:w,defaultValue:r,disabled:l,mode:f?1:0,virtual:S.virtual,get activeOptionIndex(){if(x.current&&S.activeOptionIndex===null&&S.options.length>0){let R=S.options.findIndex(le=>!le.dataRef.current.disabled);if(R!==-1)return R}return S.activeOptionIndex},calculateIndex:M,compare:A,isSelected:$,isActive:j,nullable:d,__demoMode:u}),[w,r,l,f,d,u,S,b]);Ze(()=>{},[b,void 0]),Ze(()=>{S.dataRef.current=L},[L]),$d([L.buttonRef,L.inputRef,L.optionsRef],()=>X.closeCombobox(),L.comboboxState===0);let D=h.useMemo(()=>{var R,le,ge;return{open:L.comboboxState===0,disabled:l,activeIndex:L.activeOptionIndex,activeOption:L.activeOptionIndex===null?null:L.virtual?L.virtual.options[(R=L.activeOptionIndex)!=null?R:0]:(ge=(le=L.options[L.activeOptionIndex])==null?void 0:le.dataRef.current.value)!=null?ge:null,value:w}},[L,l,w]),W=oe(()=>{if(L.activeOptionIndex!==null){if(L.virtual)J(L.virtual.options[L.activeOptionIndex]);else{let{dataRef:R}=L.options[L.activeOptionIndex];J(R.current.value)}X.goToOption(Je.Specific,L.activeOptionIndex)}}),F=oe(()=>{C({type:0}),x.current=!0}),k=oe(()=>{C({type:1}),x.current=!1}),H=oe((R,le,ge)=>(x.current=!1,R===Je.Specific?C({type:2,focus:Je.Specific,idx:le,trigger:ge}):C({type:2,focus:R,trigger:ge}))),V=oe((R,le)=>(C({type:3,payload:{id:R,dataRef:le}}),()=>{L.isActive(le.current.value)&&(x.current=!0),C({type:4,id:R})})),U=oe(R=>(C({type:5,id:R}),()=>C({type:5,id:null}))),J=oe(R=>ke(L.mode,{0(){return y==null?void 0:y(R)},1(){let le=L.value.slice(),ge=le.findIndex(Ee=>A(Ee,R));return ge===-1?le.push(R):le.splice(ge,1),y==null?void 0:y(le)}})),Y=oe(R=>{C({type:6,trigger:R})}),X=h.useMemo(()=>({onChange:J,registerOption:V,registerLabel:U,goToOption:H,closeCombobox:k,openCombobox:F,setActivationTrigger:Y,selectActiveOption:W}),[]),Q=t===null?{}:{ref:t},ee=h.useRef(null),G=hr();return h.useEffect(()=>{ee.current&&r!==void 0&&G.addEventListener(ee.current,"reset",()=>{y==null||y(r)})},[ee,y]),h.createElement(Fd.Provider,{value:X},h.createElement(Bd.Provider,{value:L},h.createElement(ii,{value:ke(L.comboboxState,{0:ft.Open,1:ft.Closed})},a!=null&&w!=null&&rc({[a]:w}).map(([R,le],ge)=>h.createElement(mr,{features:gr.Hidden,ref:ge===0?Ee=>{var Ce;ee.current=(Ce=Ee==null?void 0:Ee.closest("form"))!=null?Ce:null}:void 0,...la({key:R,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:R,value:le})})),Be({ourProps:Q,theirProps:m,slot:D,defaultTag:z5,name:"Combobox"}))))}let W5="input";function G5(e,t){var n,r,o,s,a;let i=Et(),{id:l=`headlessui-combobox-input-${i}`,onChange:u,displayValue:d,type:f="text",...p}=e,g=Ps("Combobox.Input"),m=li("Combobox.Input"),v=Ye(g.inputRef,t),b=xs(g.inputRef),w=h.useRef(!1),y=hr(),S=oe(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Je.Nothing)}),C=function(){var L;return typeof d=="function"&&g.value!==void 0?(L=d(g.value))!=null?L:"":typeof g.value=="string"?g.value:""}();K1(([L,D],[W,F])=>{if(w.current)return;let k=g.inputRef.current;k&&((F===0&&D===1||L!==W)&&(k.value=L),requestAnimationFrame(()=>{if(w.current||!k||(b==null?void 0:b.activeElement)!==k)return;let{selectionStart:H,selectionEnd:V}=k;Math.abs((V??0)-(H??0))===0&&H===0&&k.setSelectionRange(k.value.length,k.value.length)}))},[C,g.comboboxState,b]),K1(([L],[D])=>{if(L===0&&D===1){if(w.current)return;let W=g.inputRef.current;if(!W)return;let F=W.value,{selectionStart:k,selectionEnd:H,selectionDirection:V}=W;W.value="",W.value=F,V!==null?W.setSelectionRange(k,H,V):W.setSelectionRange(k,H)}},[g.comboboxState]);let x=h.useRef(!1),E=oe(()=>{x.current=!0}),T=oe(()=>{y.nextFrame(()=>{x.current=!1})}),_=oe(L=>{switch(w.current=!0,L.key){case ve.Enter:if(w.current=!1,g.comboboxState!==0||x.current)return;if(L.preventDefault(),L.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case ve.ArrowDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),ke(g.comboboxState,{0:()=>m.goToOption(Je.Next),1:()=>m.openCombobox()});case ve.ArrowUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),ke(g.comboboxState,{0:()=>m.goToOption(Je.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Je.Last)})}});case ve.Home:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case ve.PageUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case ve.End:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case ve.PageDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case ve.Escape:return w.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&&S(),m.closeCombobox());case ve.Tab:if(w.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),O=oe(L=>{u==null||u(L),g.nullable&&g.mode===0&&L.target.value===""&&S(),m.openCombobox()}),P=oe(L=>{var D,W,F;let k=(D=L.relatedTarget)!=null?D:Ts.find(H=>H!==L.currentTarget);if(w.current=!1,!((W=g.optionsRef.current)!=null&&W.contains(k))&&!((F=g.buttonRef.current)!=null&&F.contains(k))&&g.comboboxState===0)return L.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),A=oe(L=>{var D,W,F;let k=(D=L.relatedTarget)!=null?D:Ts.find(H=>H!==L.currentTarget);(W=g.buttonRef.current)!=null&&W.contains(k)||(F=g.optionsRef.current)!=null&&F.contains(k)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),M=ai(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),$=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),j={ref:v,id:l,role:"combobox",type:f,"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?(r=g.options.find(L=>{var D;return!((D=g.virtual)!=null&&D.disabled(L.dataRef.current.value))&&g.compare(L.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:r.id:(o=g.options[g.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":M,"aria-autocomplete":"list",defaultValue:(a=(s=e.defaultValue)!=null?s:g.defaultValue!==void 0?d==null?void 0:d(g.defaultValue):null)!=null?a:g.defaultValue,disabled:g.disabled,onCompositionStart:E,onCompositionEnd:T,onKeyDown:_,onChange:O,onFocus:A,onBlur:P};return Be({ourProps:j,theirProps:p,slot:$,defaultTag:W5,name:"Combobox.Input"})}let q5="button";function K5(e,t){var n;let r=Ps("Combobox.Button"),o=li("Combobox.Button"),s=Ye(r.buttonRef,t),a=Et(),{id:i=`headlessui-combobox-button-${a}`,...l}=e,u=hr(),d=oe(v=>{switch(v.key){case ve.ArrowDown:return v.preventDefault(),v.stopPropagation(),r.comboboxState===1&&o.openCombobox(),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case ve.ArrowUp:return v.preventDefault(),v.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),u.nextFrame(()=>{r.value||o.goToOption(Je.Last)})),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case ve.Escape:return r.comboboxState!==0?void 0:(v.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&v.stopPropagation(),o.closeCombobox(),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})}));default:return}}),f=oe(v=>{if($o(v.currentTarget))return v.preventDefault();r.comboboxState===0?o.closeCombobox():(v.preventDefault(),o.openCombobox()),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})})}),p=ai(()=>{if(r.labelId)return[r.labelId,i].join(" ")},[r.labelId,i]),g=h.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),m={ref:s,id:i,type:ia(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":p,disabled:r.disabled,onClick:f,onKeyDown:d};return Be({ourProps:m,theirProps:l,slot:g,defaultTag:q5,name:"Combobox.Button"})}let Z5="label";function Y5(e,t){let n=Et(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,s=Ps("Combobox.Label"),a=li("Combobox.Label"),i=Ye(s.labelRef,t);Ze(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled}),[s]);return Be({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:Z5,name:"Combobox.Label"})}let X5="ul",J5=bn.RenderStrategy|bn.Static;function Q5(e,t){let n=Et(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...s}=e,a=Ps("Combobox.Options"),i=Ye(a.optionsRef,t),l=Es(),u=l!==null?(l&ft.Open)===ft.Open:a.comboboxState===0;Ze(()=>{var g;a.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[a.optionsPropsRef,e.static]),Ze(()=>{a.optionsPropsRef.current.hold=o},[a.optionsPropsRef,o]),q1({container:a.optionsRef.current,enabled:a.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=ai(()=>{var g,m;return(m=a.labelId)!=null?m:(g=a.buttonRef.current)==null?void 0:g.id},[a.labelId,a.buttonRef.current]),f=h.useMemo(()=>({open:a.comboboxState===0,option:void 0}),[a]),p={"aria-labelledby":d,role:"listbox","aria-multiselectable":a.mode===1?!0:void 0,id:r,ref:i};return a.virtual&&a.comboboxState===0&&Object.assign(s,{children:h.createElement(F5,null,s.children)}),Be({ourProps:p,theirProps:s,slot:f,defaultTag:X5,features:J5,visible:u,name:"Combobox.Options"})}let R5="li";function eP(e,t){var n;let r=Et(),{id:o=`headlessui-combobox-option-${r}`,disabled:s=!1,value:a,order:i=null,...l}=e,u=Ps("Combobox.Option"),d=li("Combobox.Option"),f=u.virtual?u.activeOptionIndex===u.calculateIndex(a):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===o,p=u.isSelected(a),g=h.useRef(null),m=Dt({disabled:s,value:a,domRef:g,order:i}),v=h.useContext(Q1),b=Ye(t,g,v?v.measureElement:null),w=oe(()=>d.onChange(a));Ze(()=>d.registerOption(o,m),[m,o]);let y=h.useRef(!(u.virtual||u.__demoMode));Ze(()=>{if(!u.virtual||!u.__demoMode)return;let P=Lr();return P.requestAnimationFrame(()=>{y.current=!0}),P.dispose},[u.virtual,u.__demoMode]),Ze(()=>{if(!y.current||u.comboboxState!==0||!f||u.activationTrigger===0)return;let P=Lr();return P.requestAnimationFrame(()=>{var A,M;(M=(A=g.current)==null?void 0:A.scrollIntoView)==null||M.call(A,{block:"nearest"})}),P.dispose},[g,f,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let S=oe(P=>{var A;if(s||(A=u.virtual)!=null&&A.disabled(a))return P.preventDefault();w(),F1()||requestAnimationFrame(()=>{var M;return(M=u.inputRef.current)==null?void 0:M.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),C=oe(()=>{var P;if(s||(P=u.virtual)!=null&&P.disabled(a))return d.goToOption(Je.Nothing);let A=u.calculateIndex(a);d.goToOption(Je.Specific,A)}),x=G1(),E=oe(P=>x.update(P)),T=oe(P=>{var A;if(!x.wasMoved(P)||s||(A=u.virtual)!=null&&A.disabled(a)||f)return;let M=u.calculateIndex(a);d.goToOption(Je.Specific,M,0)}),_=oe(P=>{var A;x.wasMoved(P)&&(s||(A=u.virtual)!=null&&A.disabled(a)||f&&(u.optionsPropsRef.current.hold||d.goToOption(Je.Nothing)))}),O=h.useMemo(()=>({active:f,selected:p,disabled:s}),[f,p,s]);return Be({ourProps:{id:o,ref:b,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:S,onFocus:C,onPointerEnter:E,onMouseEnter:E,onPointerMove:T,onMouseMove:T,onPointerLeave:_,onMouseLeave:_},theirProps:l,slot:O,defaultTag:R5,name:"Combobox.Option"})}let tP=ze(U5),nP=ze(K5),rP=ze(G5),oP=ze(Y5),sP=ze(Q5),aP=ze(eP),ca=Object.assign(tP,{Input:rP,Button:nP,Label:oP,Options:sP,Option:aP});function iP(e,t,n,r){let o=Dt(n);h.useEffect(()=>{e=e??window;function s(a){o.current(a)}return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)},[e,t,r])}function oc(){let e=h.useRef(!1);return Ze(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function lP(e){let t=oe(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ld(()=>{n.current&&t()})}),[t])}var uo=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(uo||{});function R1(){let e=h.useRef(0);return B1("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let cP=h.createContext(!1);function uP(){return h.useContext(cP)}function dP(e){let t=uP(),n=h.useContext(em),r=xs(e),[o,s]=h.useState(()=>{if(!t&&n!==null||lo.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let i=r.createElement("div");return i.setAttribute("id","headlessui-portal-root"),r.body.appendChild(i)});return h.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),h.useEffect(()=>{t||n!==null&&s(n.current)},[n,s,t]),o}let fP=h.Fragment;function pP(e,t){let n=e,r=h.useRef(null),o=Ye(kd(d=>{r.current=d}),t),s=xs(r),a=dP(r),[i]=h.useState(()=>{var d;return lo.isServer?null:(d=s==null?void 0:s.createElement("div"))!=null?d:null}),l=h.useContext(zd),u=Jl();return Ze(()=>{!a||!i||a.contains(i)||(i.setAttribute("data-headlessui-portal",""),a.appendChild(i))},[a,i]),Ze(()=>{if(i&&l)return l.register(i)},[l,i]),lP(()=>{var d;!a||!i||(i instanceof Node&&a.contains(i)&&a.removeChild(i),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))}),u?!a||!i?null:Fn.createPortal(Be({ourProps:{ref:o},theirProps:n,defaultTag:fP,name:"Portal"}),i):null}let hP=h.Fragment,em=h.createContext(null);function gP(e,t){let{target:n,...r}=e,o={ref:Ye(t)};return h.createElement(em.Provider,{value:n},Be({ourProps:o,theirProps:r,defaultTag:hP,name:"Popover.Group"}))}let zd=h.createContext(null);function mP(){let e=h.useContext(zd),t=h.useRef([]),n=oe(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=oe(s=>{let a=t.current.indexOf(s);a!==-1&&t.current.splice(a,1),e&&e.unregister(s)}),o=h.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,h.useMemo(()=>function({children:s}){return h.createElement(zd.Provider,{value:o},s)},[o])]}let vP=ze(pP),bP=ze(gP);Object.assign(vP,{Group:bP});function yP({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let o=h.useRef((r=n==null?void 0:n.current)!=null?r:null),s=xs(o),a=oe(()=>{var i,l,u;let d=[];for(let f of e)f!==null&&(f instanceof HTMLElement?d.push(f):"current"in f&&f.current instanceof HTMLElement&&d.push(f.current));if(t!=null&&t.current)for(let f of t.current)d.push(f);for(let f of(i=s==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?i:[])f!==document.body&&f!==document.head&&f instanceof HTMLElement&&f.id!=="headlessui-portal-root"&&(f.contains(o.current)||f.contains((u=(l=o.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(p=>f.contains(p))||d.push(f));return d});return{resolveContainers:a,contains:oe(i=>a().some(l=>l.contains(i))),mainTreeNodeRef:o,MainTreeNode:h.useMemo(()=>function(){return n!=null?null:h.createElement(mr,{features:gr.Hidden,ref:o})},[o,n])}}function wP(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(mr,{features:gr.Hidden,ref:e})},[e])}}let tm=h.createContext(null);function nm(){let e=h.useContext(tm);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,nm),t}return e}function Ud(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=h.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return h.createElement(tm.Provider,{value:o},n.children)},[t])]}let SP="p";function CP(e,t){let n=Et(),{id:r=`headlessui-description-${n}`,...o}=e,s=nm(),a=Ye(t);Ze(()=>s.register(r),[r,s.register]);let i={ref:a,...s.props,id:r};return Be({ourProps:i,theirProps:o,slot:s.slot||{},defaultTag:SP,name:s.name||"Description"})}let xP=ze(CP),rm=Object.assign(xP,{});var om;let EP=(om=h.startTransition)!=null?om:function(e){e()};var TP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(TP||{}),PP=(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))(PP||{});let OP={0:e=>({...e,disclosureState:ke(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}}},Wd=h.createContext(null);Wd.displayName="DisclosureContext";function Gd(e){let t=h.useContext(Wd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gd),n}return t}let qd=h.createContext(null);qd.displayName="DisclosureAPIContext";function sm(e){let t=h.useContext(qd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,sm),n}return t}let Kd=h.createContext(null);Kd.displayName="DisclosurePanelContext";function _P(){return h.useContext(Kd)}function AP(e,t){return ke(t.type,OP,e,t)}let LP=h.Fragment;function MP(e,t){let{defaultOpen:n=!1,...r}=e,o=h.useRef(null),s=Ye(t,kd(b=>{o.current=b},e.as===void 0||e.as===h.Fragment)),a=h.useRef(null),i=h.useRef(null),l=h.useReducer(AP,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:i,panelRef:a,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},f]=l,p=oe(b=>{f({type:1});let w=Mo(o);if(!w||!d)return;let y=b?b instanceof HTMLElement?b:b.current instanceof HTMLElement?b.current:w.getElementById(d):w.getElementById(d);y==null||y.focus()}),g=h.useMemo(()=>({close:p}),[p]),m=h.useMemo(()=>({open:u===0,close:p}),[u,p]),v={ref:s};return h.createElement(Wd.Provider,{value:l},h.createElement(qd.Provider,{value:g},h.createElement(ii,{value:ke(u,{0:ft.Open,1:ft.Closed})},Be({ourProps:v,theirProps:r,slot:m,defaultTag:LP,name:"Disclosure"}))))}let NP="button";function $P(e,t){let n=Et(),{id:r=`headlessui-disclosure-button-${n}`,...o}=e,[s,a]=Gd("Disclosure.Button"),i=_P(),l=i===null?!1:i===s.panelId,u=h.useRef(null),d=Ye(u,t,l?null:s.buttonRef),f=Id();h.useEffect(()=>{if(!l)return a({type:2,buttonId:r}),()=>{a({type:2,buttonId:null})}},[r,a,l]);let p=oe(y=>{var S;if(l){if(s.disclosureState===1)return;switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),a({type:0}),(S=s.buttonRef.current)==null||S.focus();break}}else switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),a({type:0});break}}),g=oe(y=>{switch(y.key){case ve.Space:y.preventDefault();break}}),m=oe(y=>{var S;$o(y.currentTarget)||e.disabled||(l?(a({type:0}),(S=s.buttonRef.current)==null||S.focus()):a({type:0}))}),v=h.useMemo(()=>({open:s.disclosureState===0}),[s]),b=ia(e,u),w=l?{ref:d,type:b,onKeyDown:p,onClick:m}:{ref:d,id:r,type:b,"aria-expanded":s.disclosureState===0,"aria-controls":s.linkedPanel?s.panelId:void 0,onKeyDown:p,onKeyUp:g,onClick:m};return Be({mergeRefs:f,ourProps:w,theirProps:o,slot:v,defaultTag:NP,name:"Disclosure.Button"})}let kP="div",IP=bn.RenderStrategy|bn.Static;function VP(e,t){let n=Et(),{id:r=`headlessui-disclosure-panel-${n}`,...o}=e,[s,a]=Gd("Disclosure.Panel"),{close:i}=sm("Disclosure.Panel"),l=Id(),u=Ye(t,s.panelRef,m=>{EP(()=>a({type:m?4:5}))});h.useEffect(()=>(a({type:3,panelId:r}),()=>{a({type:3,panelId:null})}),[r,a]);let d=Es(),f=d!==null?(d&ft.Open)===ft.Open:s.disclosureState===0,p=h.useMemo(()=>({open:s.disclosureState===0,close:i}),[s,i]),g={ref:u,id:r};return h.createElement(Kd.Provider,{value:s.panelId},Be({mergeRefs:l,ourProps:g,theirProps:o,slot:p,defaultTag:kP,features:IP,visible:f,name:"Disclosure.Panel"}))}let HP=ze(MP),jP=ze($P),DP=ze(VP),Zd=Object.assign(HP,{Button:jP,Panel:DP}),am=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function im(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!(o instanceof HTMLElement))return r;let s=!1;for(let i of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))i.remove(),s=!0;let a=s?(n=o.innerText)!=null?n:"":r;return am.test(a)&&(a=a.replace(am,"")),a}function FP(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let a=s.getAttribute("aria-label");return typeof a=="string"?a.trim():im(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return im(e).trim()}function BP(e){let t=h.useRef(""),n=h.useRef("");return oe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=FP(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var zP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(zP||{}),UP=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(UP||{}),WP=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(WP||{}),GP=(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))(GP||{});function Yd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=co(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let qP={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,r=e.options.findIndex(o=>n(o.dataRef.current.value));return r!==-1&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=Yd(e),o=jd(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:o,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,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(a=>{var i;return!a.dataRef.current.disabled&&((i=a.dataRef.current.textValue)==null?void 0:i.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,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},r=Yd(e,o=>[...o,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...e,...r}},6:(e,t)=>{let n=Yd(e,r=>{let o=r.findIndex(s=>s.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},Xd=h.createContext(null);Xd.displayName="ListboxActionsContext";function ci(e){let t=h.useContext(Xd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ci),n}return t}let Jd=h.createContext(null);Jd.displayName="ListboxDataContext";function ui(e){let t=h.useContext(Jd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ui),n}return t}function KP(e,t){return ke(t.type,qP,e,t)}let ZP=h.Fragment;function YP(e,t){let{value:n,defaultValue:r,form:o,name:s,onChange:a,by:i=(Y,X)=>Y===X,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...f}=e;const p=u?"horizontal":"vertical";let g=Ye(t),[m=d?[]:void 0,v]=Xl(n,a,r),[b,w]=h.useReducer(KP,{dataRef:h.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=h.useRef({static:!1,hold:!1}),S=h.useRef(null),C=h.useRef(null),x=h.useRef(null),E=oe(typeof i=="string"?(Y,X)=>{let Q=i;return(Y==null?void 0:Y[Q])===(X==null?void 0:X[Q])}:i),T=h.useCallback(Y=>ke(_.mode,{1:()=>m.some(X=>E(X,Y)),0:()=>E(m,Y)}),[m]),_=h.useMemo(()=>({...b,value:m,disabled:l,mode:d?1:0,orientation:p,compare:E,isSelected:T,optionsPropsRef:y,labelRef:S,buttonRef:C,optionsRef:x}),[m,l,d,b]);Ze(()=>{b.dataRef.current=_},[_]),$d([_.buttonRef,_.optionsRef],(Y,X)=>{var Q;w({type:1}),Nd(X,Rl.Loose)||(Y.preventDefault(),(Q=_.buttonRef.current)==null||Q.focus())},_.listboxState===0);let O=h.useMemo(()=>({open:_.listboxState===0,disabled:l,value:m}),[_,l,m]),P=oe(Y=>{let X=_.options.find(Q=>Q.id===Y);X&&W(X.dataRef.current.value)}),A=oe(()=>{if(_.activeOptionIndex!==null){let{dataRef:Y,id:X}=_.options[_.activeOptionIndex];W(Y.current.value),w({type:2,focus:Je.Specific,id:X})}}),M=oe(()=>w({type:0})),$=oe(()=>w({type:1})),j=oe((Y,X,Q)=>Y===Je.Specific?w({type:2,focus:Je.Specific,id:X,trigger:Q}):w({type:2,focus:Y,trigger:Q})),L=oe((Y,X)=>(w({type:5,id:Y,dataRef:X}),()=>w({type:6,id:Y}))),D=oe(Y=>(w({type:7,id:Y}),()=>w({type:7,id:null}))),W=oe(Y=>ke(_.mode,{0(){return v==null?void 0:v(Y)},1(){let X=_.value.slice(),Q=X.findIndex(ee=>E(ee,Y));return Q===-1?X.push(Y):X.splice(Q,1),v==null?void 0:v(X)}})),F=oe(Y=>w({type:3,value:Y})),k=oe(()=>w({type:4})),H=h.useMemo(()=>({onChange:W,registerOption:L,registerLabel:D,goToOption:j,closeListbox:$,openListbox:M,selectActiveOption:A,selectOption:P,search:F,clearSearch:k}),[]),V={ref:g},U=h.useRef(null),J=hr();return h.useEffect(()=>{U.current&&r!==void 0&&J.addEventListener(U.current,"reset",()=>{v==null||v(r)})},[U,v]),h.createElement(Xd.Provider,{value:H},h.createElement(Jd.Provider,{value:_},h.createElement(ii,{value:ke(_.listboxState,{0:ft.Open,1:ft.Closed})},s!=null&&m!=null&&rc({[s]:m}).map(([Y,X],Q)=>h.createElement(mr,{features:gr.Hidden,ref:Q===0?ee=>{var G;U.current=(G=ee==null?void 0:ee.closest("form"))!=null?G:null}:void 0,...la({key:Y,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Y,value:X})})),Be({ourProps:V,theirProps:f,slot:O,defaultTag:ZP,name:"Listbox"}))))}let XP="button";function JP(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-button-${r}`,...s}=e,a=ui("Listbox.Button"),i=ci("Listbox.Button"),l=Ye(a.buttonRef,t),u=hr(),d=oe(b=>{switch(b.key){case ve.Space:case ve.Enter:case ve.ArrowDown:b.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Je.First)});break;case ve.ArrowUp:b.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Je.Last)});break}}),f=oe(b=>{switch(b.key){case ve.Space:b.preventDefault();break}}),p=oe(b=>{if($o(b.currentTarget))return b.preventDefault();a.listboxState===0?(i.closeListbox(),u.nextFrame(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})})):(b.preventDefault(),i.openListbox())}),g=ai(()=>{if(a.labelId)return[a.labelId,o].join(" ")},[a.labelId,o]),m=h.useMemo(()=>({open:a.listboxState===0,disabled:a.disabled,value:a.value}),[a]),v={ref:l,id:o,type:ia(e,a.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=a.optionsRef.current)==null?void 0:n.id,"aria-expanded":a.listboxState===0,"aria-labelledby":g,disabled:a.disabled,onKeyDown:d,onKeyUp:f,onClick:p};return Be({ourProps:v,theirProps:s,slot:m,defaultTag:XP,name:"Listbox.Button"})}let QP="label";function RP(e,t){let n=Et(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,s=ui("Listbox.Label"),a=ci("Listbox.Label"),i=Ye(s.labelRef,t);Ze(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:s.listboxState===0,disabled:s.disabled}),[s]);return Be({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:QP,name:"Listbox.Label"})}let eO="ul",tO=bn.RenderStrategy|bn.Static;function nO(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-options-${r}`,...s}=e,a=ui("Listbox.Options"),i=ci("Listbox.Options"),l=Ye(a.optionsRef,t),u=hr(),d=hr(),f=Es(),p=f!==null?(f&ft.Open)===ft.Open:a.listboxState===0;h.useEffect(()=>{var w;let y=a.optionsRef.current;y&&a.listboxState===0&&y!==((w=Mo(y))==null?void 0:w.activeElement)&&y.focus({preventScroll:!0})},[a.listboxState,a.optionsRef]);let g=oe(w=>{switch(d.dispose(),w.key){case ve.Space:if(a.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),i.search(w.key);case ve.Enter:if(w.preventDefault(),w.stopPropagation(),a.activeOptionIndex!==null){let{dataRef:y}=a.options[a.activeOptionIndex];i.onChange(y.current.value)}a.mode===0&&(i.closeListbox(),Lr().nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case ke(a.orientation,{vertical:ve.ArrowDown,horizontal:ve.ArrowRight}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Next);case ke(a.orientation,{vertical:ve.ArrowUp,horizontal:ve.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Previous);case ve.Home:case ve.PageUp:return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.First);case ve.End:case ve.PageDown:return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Last);case ve.Escape:return w.preventDefault(),w.stopPropagation(),i.closeListbox(),u.nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case ve.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(i.search(w.key),d.setTimeout(()=>i.clearSearch(),350));break}}),m=ai(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.id},[a.buttonRef.current]),v=h.useMemo(()=>({open:a.listboxState===0}),[a]),b={"aria-activedescendant":a.activeOptionIndex===null||(n=a.options[a.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":a.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":a.orientation,id:o,onKeyDown:g,role:"listbox",tabIndex:0,ref:l};return Be({ourProps:b,theirProps:s,slot:v,defaultTag:eO,features:tO,visible:p,name:"Listbox.Options"})}let rO="li";function oO(e,t){let n=Et(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...a}=e,i=ui("Listbox.Option"),l=ci("Listbox.Option"),u=i.activeOptionIndex!==null?i.options[i.activeOptionIndex].id===r:!1,d=i.isSelected(s),f=h.useRef(null),p=BP(f),g=Dt({disabled:o,value:s,domRef:f,get textValue(){return p()}}),m=Ye(t,f);Ze(()=>{if(i.listboxState!==0||!u||i.activationTrigger===0)return;let E=Lr();return E.requestAnimationFrame(()=>{var T,_;(_=(T=f.current)==null?void 0:T.scrollIntoView)==null||_.call(T,{block:"nearest"})}),E.dispose},[f,u,i.listboxState,i.activationTrigger,i.activeOptionIndex]),Ze(()=>l.registerOption(r,g),[g,r]);let v=oe(E=>{if(o)return E.preventDefault();l.onChange(s),i.mode===0&&(l.closeListbox(),Lr().nextFrame(()=>{var T;return(T=i.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})}))}),b=oe(()=>{if(o)return l.goToOption(Je.Nothing);l.goToOption(Je.Specific,r)}),w=G1(),y=oe(E=>w.update(E)),S=oe(E=>{w.wasMoved(E)&&(o||u||l.goToOption(Je.Specific,r,0))}),C=oe(E=>{w.wasMoved(E)&&(o||u&&l.goToOption(Je.Nothing))}),x=h.useMemo(()=>({active:u,selected:d,disabled:o}),[u,d,o]);return Be({ourProps:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:v,onFocus:b,onPointerEnter:y,onMouseEnter:y,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C},theirProps:a,slot:x,defaultTag:rO,name:"Listbox.Option"})}let sO=ze(YP),aO=ze(JP),iO=ze(RP),lO=ze(nO),cO=ze(oO),di=Object.assign(sO,{Button:aO,Label:iO,Options:lO,Option:cO});var uO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(uO||{}),dO=(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))(dO||{});let fO={0:e=>{let t={...e,popoverState:ke(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}}},Qd=h.createContext(null);Qd.displayName="PopoverContext";function sc(e){let t=h.useContext(Qd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,sc),n}return t}let Rd=h.createContext(null);Rd.displayName="PopoverAPIContext";function ef(e){let t=h.useContext(Rd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ef),n}return t}let tf=h.createContext(null);tf.displayName="PopoverGroupContext";function lm(){return h.useContext(tf)}let ac=h.createContext(null);ac.displayName="PopoverPanelContext";function pO(){return h.useContext(ac)}function hO(e,t){return ke(t.type,fO,e,t)}let gO="div";function mO(e,t){var n;let{__demoMode:r=!1,...o}=e,s=h.useRef(null),a=Ye(t,kd(D=>{s.current=D})),i=h.useRef([]),l=h.useReducer(hO,{__demoMode:r,popoverState:r?0:1,buttons:i,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:h.createRef(),afterPanelSentinel:h.createRef()}),[{popoverState:u,button:d,buttonId:f,panel:p,panelId:g,beforePanelSentinel:m,afterPanelSentinel:v},b]=l,w=xs((n=s.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!p)return!1;for(let U of document.querySelectorAll("body > *"))if(Number(U==null?void 0:U.contains(d))^Number(U==null?void 0:U.contains(p)))return!0;let D=Ql(),W=D.indexOf(d),F=(W+D.length-1)%D.length,k=(W+1)%D.length,H=D[F],V=D[k];return!p.contains(H)&&!p.contains(V)},[d,p]),S=Dt(f),C=Dt(g),x=h.useMemo(()=>({buttonId:S,panelId:C,close:()=>b({type:1})}),[S,C,b]),E=lm(),T=E==null?void 0:E.registerPopover,_=oe(()=>{var D;return(D=E==null?void 0:E.isFocusWithinPopoverGroup())!=null?D:(w==null?void 0:w.activeElement)&&((d==null?void 0:d.contains(w.activeElement))||(p==null?void 0:p.contains(w.activeElement)))});h.useEffect(()=>T==null?void 0:T(x),[T,x]);let[O,P]=mP(),A=yP({mainTreeNodeRef:E==null?void 0:E.mainTreeNodeRef,portals:O,defaultContainers:[d,p]});iP(w==null?void 0:w.defaultView,"focus",D=>{var W,F,k,H;D.target!==window&&D.target instanceof HTMLElement&&u===0&&(_()||d&&p&&(A.contains(D.target)||(F=(W=m.current)==null?void 0:W.contains)!=null&&F.call(W,D.target)||(H=(k=v.current)==null?void 0:k.contains)!=null&&H.call(k,D.target)||b({type:1})))},!0),$d(A.resolveContainers,(D,W)=>{b({type:1}),Nd(W,Rl.Loose)||(D.preventDefault(),d==null||d.focus())},u===0);let M=oe(D=>{b({type:1});let W=D?D instanceof HTMLElement?D:"current"in D&&D.current instanceof HTMLElement?D.current:d:d;W==null||W.focus()}),$=h.useMemo(()=>({close:M,isPortalled:y}),[M,y]),j=h.useMemo(()=>({open:u===0,close:M}),[u,M]),L={ref:a};return h.createElement(ac.Provider,{value:null},h.createElement(Qd.Provider,{value:l},h.createElement(Rd.Provider,{value:$},h.createElement(ii,{value:ke(u,{0:ft.Open,1:ft.Closed})},h.createElement(P,null,Be({ourProps:L,theirProps:o,slot:j,defaultTag:gO,name:"Popover"}),h.createElement(A.MainTreeNode,null))))))}let vO="button";function bO(e,t){let n=Et(),{id:r=`headlessui-popover-button-${n}`,...o}=e,[s,a]=sc("Popover.Button"),{isPortalled:i}=ef("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${Et()}`,d=lm(),f=d==null?void 0:d.closeOthers,p=pO()!==null;h.useEffect(()=>{if(!p)return a({type:3,buttonId:r}),()=>{a({type:3,buttonId:null})}},[p,r,a]);let[g]=h.useState(()=>Symbol()),m=Ye(l,t,p?null:A=>{if(A)s.buttons.current.push(g);else{let M=s.buttons.current.indexOf(g);M!==-1&&s.buttons.current.splice(M,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),A&&a({type:2,button:A})}),v=Ye(l,t),b=xs(l),w=oe(A=>{var M,$,j;if(p){if(s.popoverState===1)return;switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),($=(M=A.target).click)==null||$.call(M),a({type:1}),(j=s.button)==null||j.focus();break}}else switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),A.stopPropagation(),s.popoverState===1&&(f==null||f(s.buttonId)),a({type:0});break;case ve.Escape:if(s.popoverState!==0)return f==null?void 0:f(s.buttonId);if(!l.current||b!=null&&b.activeElement&&!l.current.contains(b.activeElement))return;A.preventDefault(),A.stopPropagation(),a({type:1});break}}),y=oe(A=>{p||A.key===ve.Space&&A.preventDefault()}),S=oe(A=>{var M,$;$o(A.currentTarget)||e.disabled||(p?(a({type:1}),(M=s.button)==null||M.focus()):(A.preventDefault(),A.stopPropagation(),s.popoverState===1&&(f==null||f(s.buttonId)),a({type:0}),($=s.button)==null||$.focus()))}),C=oe(A=>{A.preventDefault(),A.stopPropagation()}),x=s.popoverState===0,E=h.useMemo(()=>({open:x}),[x]),T=ia(e,l),_=p?{ref:v,type:T,onKeyDown:w,onClick:S}:{ref:m,id:s.buttonId,type:T,"aria-expanded":s.popoverState===0,"aria-controls":s.panel?s.panelId:void 0,onKeyDown:w,onKeyUp:y,onClick:S,onMouseDown:C},O=R1(),P=oe(()=>{let A=s.panel;if(!A)return;function M(){ke(O.current,{[uo.Forwards]:()=>an(A,_t.First),[uo.Backwards]:()=>an(A,_t.Last)})===Mr.Error&&an(Ql().filter($=>$.dataset.headlessuiFocusGuard!=="true"),ke(O.current,{[uo.Forwards]:_t.Next,[uo.Backwards]:_t.Previous}),{relativeTo:s.button})}M()});return h.createElement(h.Fragment,null,Be({ourProps:_,theirProps:o,slot:E,defaultTag:vO,name:"Popover.Button"}),x&&!p&&i&&h.createElement(mr,{id:u,features:gr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let yO="div",wO=bn.RenderStrategy|bn.Static;function SO(e,t){let n=Et(),{id:r=`headlessui-popover-overlay-${n}`,...o}=e,[{popoverState:s},a]=sc("Popover.Overlay"),i=Ye(t),l=Es(),u=l!==null?(l&ft.Open)===ft.Open:s===0,d=oe(p=>{if($o(p.currentTarget))return p.preventDefault();a({type:1})}),f=h.useMemo(()=>({open:s===0}),[s]);return Be({ourProps:{ref:i,id:r,"aria-hidden":!0,onClick:d},theirProps:o,slot:f,defaultTag:yO,features:wO,visible:u,name:"Popover.Overlay"})}let CO="div",xO=bn.RenderStrategy|bn.Static;function EO(e,t){let n=Et(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,...s}=e,[a,i]=sc("Popover.Panel"),{close:l,isPortalled:u}=ef("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Et()}`,f=`headlessui-focus-sentinel-after-${Et()}`,p=h.useRef(null),g=Ye(p,t,_=>{i({type:4,panel:_})}),m=xs(p),v=Id();Ze(()=>(i({type:5,panelId:r}),()=>{i({type:5,panelId:null})}),[r,i]);let b=Es(),w=b!==null?(b&ft.Open)===ft.Open:a.popoverState===0,y=oe(_=>{var O;switch(_.key){case ve.Escape:if(a.popoverState!==0||!p.current||m!=null&&m.activeElement&&!p.current.contains(m.activeElement))return;_.preventDefault(),_.stopPropagation(),i({type:1}),(O=a.button)==null||O.focus();break}});h.useEffect(()=>{var _;e.static||a.popoverState===1&&((_=e.unmount)==null||_)&&i({type:4,panel:null})},[a.popoverState,e.unmount,e.static,i]),h.useEffect(()=>{if(a.__demoMode||!o||a.popoverState!==0||!p.current)return;let _=m==null?void 0:m.activeElement;p.current.contains(_)||an(p.current,_t.First)},[a.__demoMode,o,p,a.popoverState]);let S=h.useMemo(()=>({open:a.popoverState===0,close:l}),[a,l]),C={ref:g,id:r,onKeyDown:y,onBlur:o&&a.popoverState===0?_=>{var O,P,A,M,$;let j=_.relatedTarget;j&&p.current&&((O=p.current)!=null&&O.contains(j)||(i({type:1}),((A=(P=a.beforePanelSentinel.current)==null?void 0:P.contains)!=null&&A.call(P,j)||($=(M=a.afterPanelSentinel.current)==null?void 0:M.contains)!=null&&$.call(M,j))&&j.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=R1(),E=oe(()=>{let _=p.current;if(!_)return;function O(){ke(x.current,{[uo.Forwards]:()=>{var P;an(_,_t.First)===Mr.Error&&((P=a.afterPanelSentinel.current)==null||P.focus())},[uo.Backwards]:()=>{var P;(P=a.button)==null||P.focus({preventScroll:!0})}})}O()}),T=oe(()=>{let _=p.current;if(!_)return;function O(){ke(x.current,{[uo.Forwards]:()=>{var P;if(!a.button)return;let A=Ql(),M=A.indexOf(a.button),$=A.slice(0,M+1),j=[...A.slice(M+1),...$];for(let L of j.slice())if(L.dataset.headlessuiFocusGuard==="true"||(P=a.panel)!=null&&P.contains(L)){let D=j.indexOf(L);D!==-1&&j.splice(D,1)}an(j,_t.First,{sorted:!1})},[uo.Backwards]:()=>{var P;an(_,_t.Previous)===Mr.Error&&((P=a.button)==null||P.focus())}})}O()});return h.createElement(ac.Provider,{value:r},w&&u&&h.createElement(mr,{id:d,ref:a.beforePanelSentinel,features:gr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),Be({mergeRefs:v,ourProps:C,theirProps:s,slot:S,defaultTag:CO,features:xO,visible:w,name:"Popover.Panel"}),w&&u&&h.createElement(mr,{id:f,ref:a.afterPanelSentinel,features:gr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let TO="div";function PO(e,t){let n=h.useRef(null),r=Ye(n,t),[o,s]=h.useState([]),a=wP(),i=oe(v=>{s(b=>{let w=b.indexOf(v);if(w!==-1){let y=b.slice();return y.splice(w,1),y}return b})}),l=oe(v=>(s(b=>[...b,v]),()=>i(v))),u=oe(()=>{var v;let b=Mo(n);if(!b)return!1;let w=b.activeElement;return(v=n.current)!=null&&v.contains(w)?!0:o.some(y=>{var S,C;return((S=b.getElementById(y.buttonId.current))==null?void 0:S.contains(w))||((C=b.getElementById(y.panelId.current))==null?void 0:C.contains(w))})}),d=oe(v=>{for(let b of o)b.buttonId.current!==v&&b.close()}),f=h.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:a.mainTreeNodeRef}),[l,i,u,d,a.mainTreeNodeRef]),p=h.useMemo(()=>({}),[]),g=e,m={ref:r};return h.createElement(tf.Provider,{value:f},Be({ourProps:m,theirProps:g,slot:p,defaultTag:TO,name:"Popover.Group"}),h.createElement(a.MainTreeNode,null))}let OO=ze(mO),_O=ze(bO),AO=ze(SO),LO=ze(EO),MO=ze(PO),nf=Object.assign(OO,{Button:_O,Overlay:AO,Panel:LO,Group:MO}),cm=h.createContext(null);function um(){let e=h.useContext(cm);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,um),t}return e}function rf(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=h.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return h.createElement(cm.Provider,{value:o},n.children)},[t])]}let NO="label";function $O(e,t){let n=Et(),{id:r=`headlessui-label-${n}`,passive:o=!1,...s}=e,a=um(),i=Ye(t);Ze(()=>a.register(r),[r,a.register]);let l={ref:i,...a.props,id:r};return o&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in s&&delete s.onClick),Be({ourProps:l,theirProps:s,slot:a.slot||{},defaultTag:NO,name:a.name||"Label"})}let kO=ze($O),dm=Object.assign(kO,{});function fm(e=0){let[t,n]=h.useState(e),r=oc(),o=h.useCallback(l=>{r.current&&n(u=>u|l)},[t,r]),s=h.useCallback(l=>!!(t&l),[t]),a=h.useCallback(l=>{r.current&&n(u=>u&~l)},[n,r]),i=h.useCallback(l=>{r.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:o,hasFlag:s,removeFlag:a,toggleFlag:i}}var IO=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(IO||{});let VO={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:co(n,r=>r.element.current)}},1(e,t){let n=e.options.slice(),r=e.options.findIndex(o=>o.id===t.id);return r===-1?e:(n.splice(r,1),{...e,options:n})}},of=h.createContext(null);of.displayName="RadioGroupDataContext";function pm(e){let t=h.useContext(of);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,pm),n}return t}let sf=h.createContext(null);sf.displayName="RadioGroupActionsContext";function hm(e){let t=h.useContext(sf);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,hm),n}return t}function HO(e,t){return ke(t.type,VO,e,t)}let jO="div";function DO(e,t){let n=Et(),{id:r=`headlessui-radiogroup-${n}`,value:o,defaultValue:s,form:a,name:i,onChange:l,by:u=(k,H)=>k===H,disabled:d=!1,...f}=e,p=oe(typeof u=="string"?(k,H)=>{let V=u;return(k==null?void 0:k[V])===(H==null?void 0:H[V])}:u),[g,m]=h.useReducer(HO,{options:[]}),v=g.options,[b,w]=rf(),[y,S]=Ud(),C=h.useRef(null),x=Ye(C,t),[E,T]=Xl(o,l,s),_=h.useMemo(()=>v.find(k=>!k.propsRef.current.disabled),[v]),O=h.useMemo(()=>v.some(k=>p(k.propsRef.current.value,E)),[v,E]),P=oe(k=>{var H;if(d||p(k,E))return!1;let V=(H=v.find(U=>p(U.propsRef.current.value,k)))==null?void 0:H.propsRef.current;return V!=null&&V.disabled?!1:(T==null||T(k),!0)});q1({container:C.current,accept(k){return k.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:k.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(k){k.setAttribute("role","none")}});let A=oe(k=>{let H=C.current;if(!H)return;let V=Mo(H),U=v.filter(J=>J.propsRef.current.disabled===!1).map(J=>J.element.current);switch(k.key){case ve.Enter:J1(k.currentTarget);break;case ve.ArrowLeft:case ve.ArrowUp:if(k.preventDefault(),k.stopPropagation(),an(U,_t.Previous|_t.WrapAround)===Mr.Success){let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break;case ve.ArrowRight:case ve.ArrowDown:if(k.preventDefault(),k.stopPropagation(),an(U,_t.Next|_t.WrapAround)===Mr.Success){let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break;case ve.Space:{k.preventDefault(),k.stopPropagation();let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break}}),M=oe(k=>(m({type:0,...k}),()=>m({type:1,id:k.id}))),$=h.useMemo(()=>({value:E,firstOption:_,containsCheckedOption:O,disabled:d,compare:p,...g}),[E,_,O,d,p,g]),j=h.useMemo(()=>({registerOption:M,change:P}),[M,P]),L={ref:x,id:r,role:"radiogroup","aria-labelledby":b,"aria-describedby":y,onKeyDown:A},D=h.useMemo(()=>({value:E}),[E]),W=h.useRef(null),F=hr();return h.useEffect(()=>{W.current&&s!==void 0&&F.addEventListener(W.current,"reset",()=>{P(s)})},[W,P]),h.createElement(S,{name:"RadioGroup.Description"},h.createElement(w,{name:"RadioGroup.Label"},h.createElement(sf.Provider,{value:j},h.createElement(of.Provider,{value:$},i!=null&&E!=null&&rc({[i]:E}).map(([k,H],V)=>h.createElement(mr,{features:gr.Hidden,ref:V===0?U=>{var J;W.current=(J=U==null?void 0:U.closest("form"))!=null?J:null}:void 0,...la({key:k,as:"input",type:"radio",checked:H!=null,hidden:!0,readOnly:!0,form:a,disabled:d,name:k,value:H})})),Be({ourProps:L,theirProps:f,slot:D,defaultTag:jO,name:"RadioGroup"})))))}var FO=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(FO||{});let BO="div";function zO(e,t){var n;let r=Et(),{id:o=`headlessui-radiogroup-option-${r}`,value:s,disabled:a=!1,...i}=e,l=h.useRef(null),u=Ye(l,t),[d,f]=rf(),[p,g]=Ud(),{addFlag:m,removeFlag:v,hasFlag:b}=fm(1),w=Dt({value:s,disabled:a}),y=pm("RadioGroup.Option"),S=hm("RadioGroup.Option");Ze(()=>S.registerOption({id:o,element:l,propsRef:w}),[o,S,l,w]);let C=oe(M=>{var $;if($o(M.currentTarget))return M.preventDefault();S.change(s)&&(m(2),($=l.current)==null||$.focus())}),x=oe(M=>{if($o(M.currentTarget))return M.preventDefault();m(2)}),E=oe(()=>v(2)),T=((n=y.firstOption)==null?void 0:n.id)===o,_=y.disabled||a,O=y.compare(y.value,s),P={ref:u,id:o,role:"radio","aria-checked":O?"true":"false","aria-labelledby":d,"aria-describedby":p,"aria-disabled":_?!0:void 0,tabIndex:_?-1:O||!y.containsCheckedOption&&T?0:-1,onClick:_?void 0:C,onFocus:_?void 0:x,onBlur:_?void 0:E},A=h.useMemo(()=>({checked:O,disabled:_,active:b(2)}),[O,_,b]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(f,{name:"RadioGroup.Label"},Be({ourProps:P,theirProps:i,slot:A,defaultTag:BO,name:"RadioGroup.Option"})))}let UO=ze(DO),WO=ze(zO),gm=Object.assign(UO,{Option:WO,Label:dm,Description:rm}),af=h.createContext(null);af.displayName="GroupContext";let GO=h.Fragment;function qO(e){var t;let[n,r]=h.useState(null),[o,s]=rf(),[a,i]=Ud(),l=h.useMemo(()=>({switch:n,setSwitch:r,labelledby:o,describedby:a}),[n,r,o,a]),u={},d=e;return h.createElement(i,{name:"Switch.Description"},h.createElement(s,{name:"Switch.Label",props:{htmlFor:(t=l.switch)==null?void 0:t.id,onClick(f){n&&(f.currentTarget.tagName==="LABEL"&&f.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},h.createElement(af.Provider,{value:l},Be({ourProps:u,theirProps:d,defaultTag:GO,name:"Switch.Group"}))))}let KO="button";function ZO(e,t){var n;let r=Et(),{id:o=`headlessui-switch-${r}`,checked:s,defaultChecked:a=!1,onChange:i,disabled:l=!1,name:u,value:d,form:f,...p}=e,g=h.useContext(af),m=h.useRef(null),v=Ye(m,t,g===null?null:g.setSwitch),[b,w]=Xl(s,i,a),y=oe(()=>w==null?void 0:w(!b)),S=oe(O=>{if($o(O.currentTarget))return O.preventDefault();O.preventDefault(),y()}),C=oe(O=>{O.key===ve.Space?(O.preventDefault(),y()):O.key===ve.Enter&&J1(O.currentTarget)}),x=oe(O=>O.preventDefault()),E=h.useMemo(()=>({checked:b}),[b]),T={id:o,ref:v,role:"switch",type:ia(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:S,onKeyUp:C,onKeyPress:x},_=hr();return h.useEffect(()=>{var O;let P=(O=m.current)==null?void 0:O.closest("form");P&&a!==void 0&&_.addEventListener(P,"reset",()=>{w(a)})},[m,w]),h.createElement(h.Fragment,null,u!=null&&b&&h.createElement(mr,{features:gr.Hidden,...la({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:f,checked:b,name:u,value:d})}),Be({ourProps:T,theirProps:p,slot:E,defaultTag:KO,name:"Switch"}))}let YO=ze(ZO),XO=qO,lf=Object.assign(YO,{Group:XO,Label:dm,Description:rm});function JO({onFocus:e}){let[t,n]=h.useState(!0),r=oc();return t?h.createElement(mr,{as:"button",type:"button",features:gr.Focusable,onFocus:o=>{o.preventDefault();let s,a=50;function i(){if(a--<=0){s&&cancelAnimationFrame(s);return}if(e()){if(cancelAnimationFrame(s),!r.current)return;n(!1);return}s=requestAnimationFrame(i)}s=requestAnimationFrame(i)}}):null}const mm=nt.createContext(null);function QO(){return{groups:new Map,get(e,t){var n;let r=this.groups.get(e);r||(r=new Map,this.groups.set(e,r));let o=(n=r.get(t))!=null?n:0;r.set(t,o+1);let s=Array.from(r.keys()).indexOf(t);function a(){let i=r.get(t);i>1?r.set(t,i-1):r.delete(t)}return[s,a]}}}function RO({children:e}){let t=nt.useRef(QO());return nt.createElement(mm.Provider,{value:t},e)}function vm(e){let t=nt.useContext(mm);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=e_(),[r,o]=t.current.get(e,n);return nt.useEffect(()=>o,[]),r}function e_(){var e,t,n;let r=(n=(t=(e=nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!r)return Symbol();let o=[],s=r;for(;s;)o.push(s.index),s=s.return;return"$."+o.join(".")}var t_=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(t_||{}),n_=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(n_||{}),r_=(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))(r_||{});let o_={0(e,t){var n;let r=co(e.tabs,d=>d.current),o=co(e.panels,d=>d.current),s=r.filter(d=>{var f;return!((f=d.current)!=null&&f.hasAttribute("disabled"))}),a={...e,tabs:r,panels:o};if(t.index<0||t.index>r.length-1){let d=ke(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>ke(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(s.length===0)return a;let f=ke(d,{0:()=>r.indexOf(s[0]),1:()=>r.indexOf(s[s.length-1])});return{...a,selectedIndex:f===-1?e.selectedIndex:f}}let i=r.slice(0,t.index),l=[...r.slice(t.index),...i].find(d=>s.includes(d));if(!l)return a;let u=(n=r.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...a,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],r=co([...e.tabs,t.tab],s=>s.current),o=e.selectedIndex;return e.info.current.isControlled||(o=r.indexOf(n),o===-1&&(o=e.selectedIndex)),{...e,tabs:r,selectedIndex:o}},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:co([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},cf=h.createContext(null);cf.displayName="TabsDataContext";function ua(e){let t=h.useContext(cf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ua),n}return t}let uf=h.createContext(null);uf.displayName="TabsActionsContext";function df(e){let t=h.useContext(uf);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,df),n}return t}function s_(e,t){return ke(t.type,o_,e,t)}let a_=h.Fragment;function i_(e,t){let{defaultIndex:n=0,vertical:r=!1,manual:o=!1,onChange:s,selectedIndex:a=null,...i}=e;const l=r?"vertical":"horizontal",u=o?"manual":"auto";let d=a!==null,f=Dt({isControlled:d}),p=Ye(t),[g,m]=h.useReducer(s_,{info:f,selectedIndex:a??n,tabs:[],panels:[]}),v=h.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),b=Dt(s||(()=>{})),w=Dt(g.tabs),y=h.useMemo(()=>({orientation:l,activation:u,...g}),[l,u,g]),S=oe(O=>(m({type:1,tab:O}),()=>m({type:2,tab:O}))),C=oe(O=>(m({type:3,panel:O}),()=>m({type:4,panel:O}))),x=oe(O=>{E.current!==O&&b.current(O),d||m({type:0,index:O})}),E=Dt(d?e.selectedIndex:g.selectedIndex),T=h.useMemo(()=>({registerTab:S,registerPanel:C,change:x}),[]);Ze(()=>{m({type:0,index:a??n})},[a]),Ze(()=>{if(E.current===void 0||g.tabs.length<=0)return;let O=co(g.tabs,P=>P.current);O.some((P,A)=>g.tabs[A]!==P)&&x(O.indexOf(g.tabs[E.current]))});let _={ref:p};return h.createElement(RO,null,h.createElement(uf.Provider,{value:T},h.createElement(cf.Provider,{value:y},y.tabs.length<=0&&h.createElement(JO,{onFocus:()=>{var O,P;for(let A of w.current)if(((O=A.current)==null?void 0:O.tabIndex)===0)return(P=A.current)==null||P.focus(),!0;return!1}}),Be({ourProps:_,theirProps:i,slot:v,defaultTag:a_,name:"Tabs"}))))}let l_="div";function c_(e,t){let{orientation:n,selectedIndex:r}=ua("Tab.List"),o=Ye(t);return Be({ourProps:{ref:o,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:r},defaultTag:l_,name:"Tabs.List"})}let u_="button";function d_(e,t){var n,r;let o=Et(),{id:s=`headlessui-tabs-tab-${o}`,...a}=e,{orientation:i,activation:l,selectedIndex:u,tabs:d,panels:f}=ua("Tab"),p=df("Tab"),g=ua("Tab"),m=h.useRef(null),v=Ye(m,t);Ze(()=>p.registerTab(m),[p,m]);let b=vm("tabs"),w=d.indexOf(m);w===-1&&(w=b);let y=w===u,S=oe(P=>{var A;let M=P();if(M===Mr.Success&&l==="auto"){let $=(A=Mo(m))==null?void 0:A.activeElement,j=g.tabs.findIndex(L=>L.current===$);j!==-1&&p.change(j)}return M}),C=oe(P=>{let A=d.map(M=>M.current).filter(Boolean);if(P.key===ve.Space||P.key===ve.Enter){P.preventDefault(),P.stopPropagation(),p.change(w);return}switch(P.key){case ve.Home:case ve.PageUp:return P.preventDefault(),P.stopPropagation(),S(()=>an(A,_t.First));case ve.End:case ve.PageDown:return P.preventDefault(),P.stopPropagation(),S(()=>an(A,_t.Last))}if(S(()=>ke(i,{vertical(){return P.key===ve.ArrowUp?an(A,_t.Previous|_t.WrapAround):P.key===ve.ArrowDown?an(A,_t.Next|_t.WrapAround):Mr.Error},horizontal(){return P.key===ve.ArrowLeft?an(A,_t.Previous|_t.WrapAround):P.key===ve.ArrowRight?an(A,_t.Next|_t.WrapAround):Mr.Error}}))===Mr.Success)return P.preventDefault()}),x=h.useRef(!1),E=oe(()=>{var P;x.current||(x.current=!0,(P=m.current)==null||P.focus({preventScroll:!0}),p.change(w),Ld(()=>{x.current=!1}))}),T=oe(P=>{P.preventDefault()}),_=h.useMemo(()=>{var P;return{selected:y,disabled:(P=e.disabled)!=null?P:!1}},[y,e.disabled]),O={ref:v,onKeyDown:C,onMouseDown:T,onClick:E,id:s,role:"tab",type:ia(e,m),"aria-controls":(r=(n=f[w])==null?void 0:n.current)==null?void 0:r.id,"aria-selected":y,tabIndex:y?0:-1};return Be({ourProps:O,theirProps:a,slot:_,defaultTag:u_,name:"Tabs.Tab"})}let f_="div";function p_(e,t){let{selectedIndex:n}=ua("Tab.Panels"),r=Ye(t),o=h.useMemo(()=>({selectedIndex:n}),[n]);return Be({ourProps:{ref:r},theirProps:e,slot:o,defaultTag:f_,name:"Tabs.Panels"})}let h_="div",g_=bn.RenderStrategy|bn.Static;function m_(e,t){var n,r,o,s;let a=Et(),{id:i=`headlessui-tabs-panel-${a}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:f,panels:p}=ua("Tab.Panel"),g=df("Tab.Panel"),m=h.useRef(null),v=Ye(m,t);Ze(()=>g.registerPanel(m),[g,m,i]);let b=vm("panels"),w=p.indexOf(m);w===-1&&(w=b);let y=w===d,S=h.useMemo(()=>({selected:y}),[y]),C={ref:v,id:i,role:"tabpanel","aria-labelledby":(r=(n=f[w])==null?void 0:n.current)==null?void 0:r.id,tabIndex:y?l:-1};return!y&&((o=u.unmount)==null||o)&&!((s=u.static)!=null&&s)?h.createElement(mr,{as:"span","aria-hidden":"true",...C}):Be({ourProps:C,theirProps:u,slot:S,defaultTag:h_,features:g_,visible:y,name:"Tabs.Panel"})}let v_=ze(d_),b_=ze(i_),y_=ze(c_),w_=ze(p_),S_=ze(m_),fi=Object.assign(v_,{Group:b_,List:y_,Panels:w_,Panel:S_});function C_(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ff(e,...t){e&&t.length>0&&e.classList.add(...t)}function pf(e,...t){e&&t.length>0&&e.classList.remove(...t)}function x_(e,t){let n=Lr();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[s,a]=[r,o].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,f)=>f-d);return u}),i=s+a;if(i!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},i),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 E_(e,t,n,r){let o=n?"enter":"leave",s=Lr(),a=r!==void 0?C_(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let i=ke(o,{enter:()=>t.enter,leave:()=>t.leave}),l=ke(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=ke(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return pf(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ff(e,...t.base,...i,...u),s.nextFrame(()=>{pf(e,...t.base,...i,...u),ff(e,...t.base,...i,...l),x_(e,()=>(pf(e,...t.base,...i),ff(e,...t.base,...t.entered),a()))}),s.dispose}function T_({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:s}){let a=oc(),i=hr(),l=Dt(n);Ze(()=>{e&&(l.current="enter")},[e]),Ze(()=>{let u=Lr();i.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&a.current)return u.dispose(),o.current(l.current),u.add(E_(d,r.current,l.current==="enter",()=>{u.dispose(),s.current(l.current)})),u.dispose},[n])}function ko(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let ic=h.createContext(null);ic.displayName="TransitionContext";var P_=(e=>(e.Visible="visible",e.Hidden="hidden",e))(P_||{});function O_(){let e=h.useContext(ic);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function __(){let e=h.useContext(lc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let lc=h.createContext(null);lc.displayName="NestingContext";function cc(e){return"children"in e?cc(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function bm(e,t){let n=Dt(e),r=h.useRef([]),o=oc(),s=hr(),a=oe((g,m=No.Hidden)=>{let v=r.current.findIndex(({el:b})=>b===g);v!==-1&&(ke(m,{[No.Unmount](){r.current.splice(v,1)},[No.Hidden](){r.current[v].state="hidden"}}),s.microTask(()=>{var b;!cc(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),i=oe(g=>{let m=r.current.find(({el:v})=>v===g);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:g,state:"visible"}),()=>a(g,No.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),f=oe((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(([w,y])=>y)).then(()=>b())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(m)):v(m)}),p=oe((g,m,v)=>{Promise.all(d.current[m].splice(0).map(([b,w])=>w)).then(()=>{var b;(b=l.current.shift())==null||b()}).then(()=>v(m))});return h.useMemo(()=>({children:r,register:i,unregister:a,onStart:f,onStop:p,wait:u,chains:d}),[i,a,r,f,p,d,u])}function A_(){}let L_=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function ym(e){var t;let n={};for(let r of L_)n[r]=(t=e[r])!=null?t:A_;return n}function M_(e){let t=h.useRef(ym(e));return h.useEffect(()=>{t.current=ym(e)},[e]),t}let N_="div",wm=bn.RenderStrategy;function $_(e,t){var n,r;let{beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i,enter:l,enterFrom:u,enterTo:d,entered:f,leave:p,leaveFrom:g,leaveTo:m,...v}=e,b=h.useRef(null),w=Ye(b,t),y=(n=v.unmount)==null||n?No.Unmount:No.Hidden,{show:S,appear:C,initial:x}=O_(),[E,T]=h.useState(S?"visible":"hidden"),_=__(),{register:O,unregister:P}=_;h.useEffect(()=>O(b),[O,b]),h.useEffect(()=>{if(y===No.Hidden&&b.current){if(S&&E!=="visible"){T("visible");return}return ke(E,{hidden:()=>P(b),visible:()=>O(b)})}},[E,b,O,P,S,y]);let A=Dt({base:ko(v.className),enter:ko(l),enterFrom:ko(u),enterTo:ko(d),entered:ko(f),leave:ko(p),leaveFrom:ko(g),leaveTo:ko(m)}),M=M_({beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i}),$=Jl();h.useEffect(()=>{if($&&E==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,E,$]);let j=x&&!C,L=C&&S&&x,D=!$||j?"idle":S?"enter":"leave",W=fm(0),F=oe(Y=>ke(Y,{enter:()=>{W.addFlag(ft.Opening),M.current.beforeEnter()},leave:()=>{W.addFlag(ft.Closing),M.current.beforeLeave()},idle:()=>{}})),k=oe(Y=>ke(Y,{enter:()=>{W.removeFlag(ft.Opening),M.current.afterEnter()},leave:()=>{W.removeFlag(ft.Closing),M.current.afterLeave()},idle:()=>{}})),H=bm(()=>{T("hidden"),P(b)},_),V=h.useRef(!1);T_({immediate:L,container:b,classes:A,direction:D,onStart:Dt(Y=>{V.current=!0,H.onStart(b,Y,F)}),onStop:Dt(Y=>{V.current=!1,H.onStop(b,Y,k),Y==="leave"&&!cc(H)&&(T("hidden"),P(b))})});let U=v,J={ref:w};return L?U={...U,className:tc(v.className,...A.current.enter,...A.current.enterFrom)}:V.current&&(U.className=tc(v.className,(r=b.current)==null?void 0:r.className),U.className===""&&delete U.className),h.createElement(lc.Provider,{value:H},h.createElement(ii,{value:ke(E,{visible:ft.Open,hidden:ft.Closed})|W.flags},Be({ourProps:J,theirProps:U,defaultTag:N_,features:wm,visible:E==="visible",name:"Transition.Child"})))}function k_(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,a=h.useRef(null),i=Ye(a,t);Jl();let l=Es();if(n===void 0&&l!==null&&(n=(l&ft.Open)===ft.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"),f=bm(()=>{d("hidden")}),[p,g]=h.useState(!0),m=h.useRef([n]);Ze(()=>{p!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),g(!1))},[m,n]);let v=h.useMemo(()=>({show:n,appear:r,initial:p}),[n,r,p]);h.useEffect(()=>{if(n)d("visible");else if(!cc(f))d("hidden");else{let S=a.current;if(!S)return;let C=S.getBoundingClientRect();C.x===0&&C.y===0&&C.width===0&&C.height===0&&d("hidden")}},[n,f]);let b={unmount:o},w=oe(()=>{var S;p&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),y=oe(()=>{var S;p&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return h.createElement(lc.Provider,{value:f},h.createElement(ic.Provider,{value:v},Be({ourProps:{...b,as:h.Fragment,children:h.createElement(Sm,{ref:i,...b,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:wm,visible:u==="visible",name:"Transition"})))}function I_(e,t){let n=h.useContext(ic)!==null,r=Es()!==null;return h.createElement(h.Fragment,null,!n&&r?h.createElement(hf,{ref:t,...e}):h.createElement(Sm,{ref:t,...e}))}let hf=ze(k_),Sm=ze($_),V_=ze(I_),gf=Object.assign(hf,{Child:V_,Root:hf});var Cm=function(t){return t.reduce(function(n,r){var o=r[0],s=r[1];return n[o]=s,n},{})},xm=typeof window<"u"&&window.document&&window.document.createElement?nt.useLayoutEffect:nt.useEffect,yn="top",qn="bottom",Kn="right",wn="left",mf="auto",pi=[yn,qn,Kn,wn],da="start",hi="end",H_="clippingParents",Em="viewport",gi="popper",j_="reference",Tm=pi.reduce(function(e,t){return e.concat([t+"-"+da,t+"-"+hi])},[]),Pm=[].concat(pi,[mf]).reduce(function(e,t){return e.concat([t,t+"-"+da,t+"-"+hi])},[]),D_="beforeRead",F_="read",B_="afterRead",z_="beforeMain",U_="main",W_="afterMain",G_="beforeWrite",q_="write",K_="afterWrite",Z_=[D_,F_,B_,z_,U_,W_,G_,q_,K_];function Nr(e){return e?(e.nodeName||"").toLowerCase():null}function Ln(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function Os(e){var t=Ln(e).Element;return e instanceof t||e instanceof Element}function Zn(e){var t=Ln(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function vf(e){if(typeof ShadowRoot>"u")return!1;var t=Ln(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function Y_(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Zn(s)||!Nr(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(a){var i=o[a];i===!1?s.removeAttribute(a):s.setAttribute(a,i===!0?"":i)}))})}function X_(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(r){var o=t.elements[r],s=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),i=a.reduce(function(l,u){return l[u]="",l},{});!Zn(o)||!Nr(o)||(Object.assign(o.style,i),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const J_={name:"applyStyles",enabled:!0,phase:"write",fn:Y_,effect:X_,requires:["computeStyles"]};function $r(e){return e.split("-")[0]}var _s=Math.max,uc=Math.min,fa=Math.round;function bf(){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 Om(){return!/^((?!chrome|android).)*safari/i.test(bf())}function pa(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Zn(e)&&(o=e.offsetWidth>0&&fa(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&fa(r.height)/e.offsetHeight||1);var a=Os(e)?Ln(e):window,i=a.visualViewport,l=!Om()&&n,u=(r.left+(l&&i?i.offsetLeft:0))/o,d=(r.top+(l&&i?i.offsetTop:0))/s,f=r.width/o,p=r.height/s;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function yf(e){var t=pa(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function _m(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&vf(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function fo(e){return Ln(e).getComputedStyle(e)}function Q_(e){return["table","td","th"].indexOf(Nr(e))>=0}function Io(e){return((Os(e)?e.ownerDocument:e.document)||window.document).documentElement}function dc(e){return Nr(e)==="html"?e:e.assignedSlot||e.parentNode||(vf(e)?e.host:null)||Io(e)}function Am(e){return!Zn(e)||fo(e).position==="fixed"?null:e.offsetParent}function R_(e){var t=/firefox/i.test(bf()),n=/Trident/i.test(bf());if(n&&Zn(e)){var r=fo(e);if(r.position==="fixed")return null}var o=dc(e);for(vf(o)&&(o=o.host);Zn(o)&&["html","body"].indexOf(Nr(o))<0;){var s=fo(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function mi(e){for(var t=Ln(e),n=Am(e);n&&Q_(n)&&fo(n).position==="static";)n=Am(n);return n&&(Nr(n)==="html"||Nr(n)==="body"&&fo(n).position==="static")?t:n||R_(e)||t}function wf(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function vi(e,t,n){return _s(e,uc(t,n))}function eA(e,t,n){var r=vi(e,t,n);return r>n?n:r}function Lm(){return{top:0,right:0,bottom:0,left:0}}function Mm(e){return Object.assign({},Lm(),e)}function Nm(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var tA=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Mm(typeof t!="number"?t:Nm(t,pi))};function nA(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,i=$r(n.placement),l=wf(i),u=[wn,Kn].indexOf(i)>=0,d=u?"height":"width";if(!(!s||!a)){var f=tA(o.padding,n),p=yf(s),g=l==="y"?yn:wn,m=l==="y"?qn:Kn,v=n.rects.reference[d]+n.rects.reference[l]-a[l]-n.rects.popper[d],b=a[l]-n.rects.reference[l],w=mi(s),y=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0,S=v/2-b/2,C=f[g],x=y-p[d]-f[m],E=y/2-p[d]/2+S,T=vi(C,E,x),_=l;n.modifiersData[r]=(t={},t[_]=T,t.centerOffset=T-E,t)}}function rA(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||_m(t.elements.popper,o)&&(t.elements.arrow=o))}const oA={name:"arrow",enabled:!0,phase:"main",fn:nA,effect:rA,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ha(e){return e.split("-")[1]}var sA={top:"auto",right:"auto",bottom:"auto",left:"auto"};function aA(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:fa(n*o)/o||0,y:fa(r*o)/o||0}}function $m(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,a=e.offsets,i=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,f=e.isFixed,p=a.x,g=p===void 0?0:p,m=a.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 w=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),S=wn,C=yn,x=window;if(u){var E=mi(n),T="clientHeight",_="clientWidth";if(E===Ln(n)&&(E=Io(n),fo(E).position!=="static"&&i==="absolute"&&(T="scrollHeight",_="scrollWidth")),E=E,o===yn||(o===wn||o===Kn)&&s===hi){C=qn;var O=f&&E===x&&x.visualViewport?x.visualViewport.height:E[T];v-=O-r.height,v*=l?1:-1}if(o===wn||(o===yn||o===qn)&&s===hi){S=Kn;var P=f&&E===x&&x.visualViewport?x.visualViewport.width:E[_];g-=P-r.width,g*=l?1:-1}}var A=Object.assign({position:i},u&&sA),M=d===!0?aA({x:g,y:v},Ln(n)):{x:g,y:v};if(g=M.x,v=M.y,l){var $;return Object.assign({},A,($={},$[C]=y?"0":"",$[S]=w?"0":"",$.transform=(x.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",$))}return Object.assign({},A,(t={},t[C]=y?v+"px":"",t[S]=w?g+"px":"",t.transform="",t))}function iA(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,a=s===void 0?!0:s,i=n.roundOffsets,l=i===void 0?!0:i,u={placement:$r(t.placement),variation:ha(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,$m(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,$m(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 lA={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:iA,data:{}};var fc={passive:!0};function cA(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,a=r.resize,i=a===void 0?!0:a,l=Ln(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&u.forEach(function(d){d.addEventListener("scroll",n.update,fc)}),i&&l.addEventListener("resize",n.update,fc),function(){s&&u.forEach(function(d){d.removeEventListener("scroll",n.update,fc)}),i&&l.removeEventListener("resize",n.update,fc)}}const uA={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:cA,data:{}};var dA={left:"right",right:"left",bottom:"top",top:"bottom"};function pc(e){return e.replace(/left|right|bottom|top/g,function(t){return dA[t]})}var fA={start:"end",end:"start"};function km(e){return e.replace(/start|end/g,function(t){return fA[t]})}function Sf(e){var t=Ln(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Cf(e){return pa(Io(e)).left+Sf(e).scrollLeft}function pA(e,t){var n=Ln(e),r=Io(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;var u=Om();(u||!u&&t==="fixed")&&(i=o.offsetLeft,l=o.offsetTop)}return{width:s,height:a,x:i+Cf(e),y:l}}function hA(e){var t,n=Io(e),r=Sf(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=_s(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=_s(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),i=-r.scrollLeft+Cf(e),l=-r.scrollTop;return fo(o||n).direction==="rtl"&&(i+=_s(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:i,y:l}}function xf(e){var t=fo(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Im(e){return["html","body","#document"].indexOf(Nr(e))>=0?e.ownerDocument.body:Zn(e)&&xf(e)?e:Im(dc(e))}function bi(e,t){var n;t===void 0&&(t=[]);var r=Im(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Ln(r),a=o?[s].concat(s.visualViewport||[],xf(r)?r:[]):r,i=t.concat(a);return o?i:i.concat(bi(dc(a)))}function Ef(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function gA(e,t){var n=pa(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 Vm(e,t,n){return t===Em?Ef(pA(e,n)):Os(t)?gA(t,n):Ef(hA(Io(e)))}function mA(e){var t=bi(dc(e)),n=["absolute","fixed"].indexOf(fo(e).position)>=0,r=n&&Zn(e)?mi(e):e;return Os(r)?t.filter(function(o){return Os(o)&&_m(o,r)&&Nr(o)!=="body"}):[]}function vA(e,t,n,r){var o=t==="clippingParents"?mA(e):[].concat(t),s=[].concat(o,[n]),a=s[0],i=s.reduce(function(l,u){var d=Vm(e,u,r);return l.top=_s(d.top,l.top),l.right=uc(d.right,l.right),l.bottom=uc(d.bottom,l.bottom),l.left=_s(d.left,l.left),l},Vm(e,a,r));return i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}function Hm(e){var t=e.reference,n=e.element,r=e.placement,o=r?$r(r):null,s=r?ha(r):null,a=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2,l;switch(o){case yn:l={x:a,y:t.y-n.height};break;case qn:l={x:a,y:t.y+t.height};break;case Kn:l={x:t.x+t.width,y:i};break;case wn:l={x:t.x-n.width,y:i};break;default:l={x:t.x,y:t.y}}var u=o?wf(o):null;if(u!=null){var d=u==="y"?"height":"width";switch(s){case da:l[u]=l[u]-(t[d]/2-n[d]/2);break;case hi:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function yi(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,a=s===void 0?e.strategy:s,i=n.boundary,l=i===void 0?H_:i,u=n.rootBoundary,d=u===void 0?Em:u,f=n.elementContext,p=f===void 0?gi:f,g=n.altBoundary,m=g===void 0?!1:g,v=n.padding,b=v===void 0?0:v,w=Mm(typeof b!="number"?b:Nm(b,pi)),y=p===gi?j_:gi,S=e.rects.popper,C=e.elements[m?y:p],x=vA(Os(C)?C:C.contextElement||Io(e.elements.popper),l,d,a),E=pa(e.elements.reference),T=Hm({reference:E,element:S,strategy:"absolute",placement:o}),_=Ef(Object.assign({},S,T)),O=p===gi?_:E,P={top:x.top-O.top+w.top,bottom:O.bottom-x.bottom+w.bottom,left:x.left-O.left+w.left,right:O.right-x.right+w.right},A=e.modifiersData.offset;if(p===gi&&A){var M=A[o];Object.keys(P).forEach(function($){var j=[Kn,qn].indexOf($)>=0?1:-1,L=[yn,qn].indexOf($)>=0?"y":"x";P[$]+=M[L]*j})}return P}function bA(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,a=n.padding,i=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?Pm:l,d=ha(r),f=d?i?Tm:Tm.filter(function(m){return ha(m)===d}):pi,p=f.filter(function(m){return u.indexOf(m)>=0});p.length===0&&(p=f);var g=p.reduce(function(m,v){return m[v]=yi(e,{placement:v,boundary:o,rootBoundary:s,padding:a})[$r(v)],m},{});return Object.keys(g).sort(function(m,v){return g[m]-g[v]})}function yA(e){if($r(e)===mf)return[];var t=pc(e);return[km(e),t,km(t)]}function wA(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!0:a,l=n.fallbackPlacements,u=n.padding,d=n.boundary,f=n.rootBoundary,p=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,v=n.allowedAutoPlacements,b=t.options.placement,w=$r(b),y=w===b,S=l||(y||!m?[pc(b)]:yA(b)),C=[b].concat(S).reduce(function(Y,X){return Y.concat($r(X)===mf?bA(t,{placement:X,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:v}):X)},[]),x=t.rects.reference,E=t.rects.popper,T=new Map,_=!0,O=C[0],P=0;P<C.length;P++){var A=C[P],M=$r(A),$=ha(A)===da,j=[yn,qn].indexOf(M)>=0,L=j?"width":"height",D=yi(t,{placement:A,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),W=j?$?Kn:wn:$?qn:yn;x[L]>E[L]&&(W=pc(W));var F=pc(W),k=[];if(s&&k.push(D[M]<=0),i&&k.push(D[W]<=0,D[F]<=0),k.every(function(Y){return Y})){O=A,_=!1;break}T.set(A,k)}if(_)for(var H=m?3:1,V=function(X){var Q=C.find(function(ee){var G=T.get(ee);if(G)return G.slice(0,X).every(function(R){return R})});if(Q)return O=Q,"break"},U=H;U>0;U--){var J=V(U);if(J==="break")break}t.placement!==O&&(t.modifiersData[r]._skip=!0,t.placement=O,t.reset=!0)}}const SA={name:"flip",enabled:!0,phase:"main",fn:wA,requiresIfExists:["offset"],data:{_skip:!1}};function jm(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 Dm(e){return[yn,Kn,qn,wn].some(function(t){return e[t]>=0})}function CA(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=yi(t,{elementContext:"reference"}),i=yi(t,{altBoundary:!0}),l=jm(a,r),u=jm(i,o,s),d=Dm(l),f=Dm(u);t.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const xA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:CA};function EA(e,t,n){var r=$r(e),o=[wn,yn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=s[0],i=s[1];return a=a||0,i=(i||0)*o,[wn,Kn].indexOf(r)>=0?{x:i,y:a}:{x:a,y:i}}function TA(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=Pm.reduce(function(d,f){return d[f]=EA(f,t.rects,s),d},{}),i=a[t.placement],l=i.x,u=i.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}const PA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:TA};function OA(e){var t=e.state,n=e.name;t.modifiersData[n]=Hm({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const _A={name:"popperOffsets",enabled:!0,phase:"read",fn:OA,data:{}};function AA(e){return e==="x"?"y":"x"}function LA(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!1:a,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,f=n.padding,p=n.tether,g=p===void 0?!0:p,m=n.tetherOffset,v=m===void 0?0:m,b=yi(t,{boundary:l,rootBoundary:u,padding:f,altBoundary:d}),w=$r(t.placement),y=ha(t.placement),S=!y,C=wf(w),x=AA(C),E=t.modifiersData.popperOffsets,T=t.rects.reference,_=t.rects.popper,O=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,P=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(E){if(s){var $,j=C==="y"?yn:wn,L=C==="y"?qn:Kn,D=C==="y"?"height":"width",W=E[C],F=W+b[j],k=W-b[L],H=g?-_[D]/2:0,V=y===da?T[D]:_[D],U=y===da?-_[D]:-T[D],J=t.elements.arrow,Y=g&&J?yf(J):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Lm(),Q=X[j],ee=X[L],G=vi(0,T[D],Y[D]),R=S?T[D]/2-H-G-Q-P.mainAxis:V-G-Q-P.mainAxis,le=S?-T[D]/2+H+G+ee+P.mainAxis:U+G+ee+P.mainAxis,ge=t.elements.arrow&&mi(t.elements.arrow),Ee=ge?C==="y"?ge.clientTop||0:ge.clientLeft||0:0,Ce=($=A==null?void 0:A[C])!=null?$:0,tt=W+R-Ce-Ee,Qe=W+le-Ce,Ot=vi(g?uc(F,tt):F,W,g?_s(k,Qe):k);E[C]=Ot,M[C]=Ot-W}if(i){var ut,Se=C==="x"?yn:wn,ot=C==="x"?qn:Kn,st=E[x],wt=x==="y"?"height":"width",Ne=st+b[Se],mt=st-b[ot],dt=[yn,wn].indexOf(w)!==-1,Ue=(ut=A==null?void 0:A[x])!=null?ut:0,en=dt?Ne:st-T[wt]-_[wt]-Ue+P.altAxis,he=dt?st+T[wt]+_[wt]-Ue-P.altAxis:mt,De=g&&dt?eA(en,st,he):vi(g?en:Ne,st,g?he:mt);E[x]=De,M[x]=De-st}t.modifiersData[r]=M}}const MA={name:"preventOverflow",enabled:!0,phase:"main",fn:LA,requiresIfExists:["offset"]};function NA(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function $A(e){return e===Ln(e)||!Zn(e)?Sf(e):NA(e)}function kA(e){var t=e.getBoundingClientRect(),n=fa(t.width)/e.offsetWidth||1,r=fa(t.height)/e.offsetHeight||1;return n!==1||r!==1}function IA(e,t,n){n===void 0&&(n=!1);var r=Zn(t),o=Zn(t)&&kA(t),s=Io(t),a=pa(e,o,n),i={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Nr(t)!=="body"||xf(s))&&(i=$A(t)),Zn(t)?(l=pa(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=Cf(s))),{x:a.left+i.scrollLeft-l.x,y:a.top+i.scrollTop-l.y,width:a.width,height:a.height}}function VA(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var a=[].concat(s.requires||[],s.requiresIfExists||[]);a.forEach(function(i){if(!n.has(i)){var l=t.get(i);l&&o(l)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function HA(e){var t=VA(e);return Z_.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function jA(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function DA(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Fm={placement:"bottom",modifiers:[],strategy:"absolute"};function Bm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function FA(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?Fm:o;return function(i,l,u){u===void 0&&(u=s);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Fm,s),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},f=[],p=!1,g={state:d,setOptions:function(w){var y=typeof w=="function"?w(d.options):w;v(),d.options=Object.assign({},s,d.options,y),d.scrollParents={reference:Os(i)?bi(i):i.contextElement?bi(i.contextElement):[],popper:bi(l)};var S=HA(DA([].concat(r,d.options.modifiers)));return d.orderedModifiers=S.filter(function(C){return C.enabled}),m(),g.update()},forceUpdate:function(){if(!p){var w=d.elements,y=w.reference,S=w.popper;if(Bm(y,S)){d.rects={reference:IA(y,mi(S),d.options.strategy==="fixed"),popper:yf(S)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(P){return d.modifiersData[P.name]=Object.assign({},P.data)});for(var C=0;C<d.orderedModifiers.length;C++){if(d.reset===!0){d.reset=!1,C=-1;continue}var x=d.orderedModifiers[C],E=x.fn,T=x.options,_=T===void 0?{}:T,O=x.name;typeof E=="function"&&(d=E({state:d,options:_,name:O,instance:g})||d)}}}},update:jA(function(){return new Promise(function(b){g.forceUpdate(),b(d)})}),destroy:function(){v(),p=!0}};if(!Bm(i,l))return g;g.setOptions(u).then(function(b){!p&&u.onFirstUpdate&&u.onFirstUpdate(b)});function m(){d.orderedModifiers.forEach(function(b){var w=b.name,y=b.options,S=y===void 0?{}:y,C=b.effect;if(typeof C=="function"){var x=C({state:d,name:w,instance:g,options:S}),E=function(){};f.push(x||E)}})}function v(){f.forEach(function(b){return b()}),f=[]}return g}}var BA=[uA,_A,lA,J_,PA,SA,MA,oA,xA],zA=FA({defaultModifiers:BA}),UA=typeof Element<"u",WA=typeof Map=="function",GA=typeof Set=="function",qA=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,r,o;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!hc(e[r],t[r]))return!1;return!0}var s;if(WA&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;for(s=e.entries();!(r=s.next()).done;)if(!hc(r.value[1],t.get(r.value[0])))return!1;return!0}if(GA&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(qA&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])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(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;if(UA&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&e.$$typeof)&&!hc(e[o[r]],t[o[r]]))return!1;return!0}return e!==e&&t!==t}var KA=function(t,n){try{return hc(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const ZA=Uu(KA);var YA=[],wi=function(t,n,r){r===void 0&&(r={});var o=nt.useRef(null),s={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||YA},a=nt.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),i=a[0],l=a[1],u=nt.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,v=Object.keys(m.elements);NS.flushSync(function(){l({styles:Cm(v.map(function(b){return[b,m.styles[b]||{}]})),attributes:Cm(v.map(function(b){return[b,m.attributes[b]]}))})})},requires:["computeStyles"]}},[]),d=nt.useMemo(function(){var p={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[u,{name:"applyStyles",enabled:!1}])};return ZA(o.current,p)?o.current||p:(o.current=p,p)},[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,u]),f=nt.useRef();return xm(function(){f.current&&f.current.setOptions(d)},[d]),xm(function(){if(!(t==null||n==null)){var p=r.createPopper||zA,g=p(t,n,d);return f.current=g,function(){g.destroy(),f.current=null}}},[t,n,r.createPopper]),{state:f.current?f.current.state:null,styles:i.styles,attributes:i.attributes,update:f.current?f.current.update:null,forceUpdate:f.current?f.current.forceUpdate:null}};const Yn=h.forwardRef(function({children:t,title:n,onClose:r,icon:o,skipOverflow:s,shadow:a=!0,padding:i=!0,border:l=!0,round:u=!0,className:d,classNameBody:f,size:p="m",titleClass:g=Z("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:v,...b},w){const y=Rr(o)?o:{};return c.jsxs("div",{...b,ref:w,style:m,className:Z(["gs-utl-card",d,v||xd.bg,te.b,u&&te.rnd,l?z.br:te.bT,!s&&"gs-utl-overflow-auto",a&&"gs-utl-shadow-md",i&&p==="l"&&"gs-utl-p-5",i&&p==="m"&&"gs-utl-px-4 gs-utl-py-2",i&&p==="s"&&"gs-utl-px-2 gs-utl-py-1",i&&p==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",i&&p==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&c.jsxs(I,{className:Z("gs-utl-card-title",g),items:"center",children:[c.jsx(B,{className:Z("truncate"),grow:!0,children:n}),(r||o)&&c.jsx(B,{onClick:r,className:Z("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(ne,{icon:(ct(o)?o:"")||q.close,size:"18px",...y})})]}),c.jsx("div",{className:Z("gs-utl-card-body",f),children:t})]})});var gc,XA=new Uint8Array(16);function JA(){if(!gc&&(gc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!gc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return gc(XA)}const QA=/^(?:[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 RA(e){return typeof e=="string"&&QA.test(e)}for(var Kt=[],Tf=0;Tf<256;++Tf)Kt.push((Tf+256).toString(16).substr(1));function e3(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(!RA(n))throw TypeError("Stringified UUID is invalid");return n}function zm(e,t,n){e=e||{};var r=e.random||(e.rng||JA)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,e3(r)}class t3 extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Si=async(e,{onError:t,onLoading:n,onResult:r,params:o,rawText:s,...a})=>{try{n==null||n(!0);const i=o?new URLSearchParams(o).toString():"",l=i?`?${i}`:"",u=await fetch(`${e}${l}`,a);if(!u.ok){const f=await u.json();throw new t3(f.error||"Request failed!",f.errorData)}let d;if(s)d=await u.text();else try{d=await u.json()}catch{d=void 0}return r==null||r(d),d}catch(i){const l=i instanceof Error?i:new Error(i);if(t==null||t(l),a.throwError)throw l;return l}finally{n==null||n(!1)}};class kr{static async get(t,n){return Si(t,{...n,method:"GET"})}static async post(t,n){return Si(t,{...n,method:"POST"})}static async put(t,n){return Si(t,{...n,method:"PUT"})}static async patch(t,n){return Si(t,{...n,method:"PATCH"})}static async delete(t,n){return Si(t,{...n,method:"DELETE"})}}var mc=(e=>(e.Projects="projects",e.Settings="settings",e))(mc||{}),Um=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(Um||{});const Wm={},n3=1,r3=(e={})=>new Promise((t,n)=>{const r=(e==null?void 0:e.db)||"gjs",o=r==="gjs-studio"?n3:1,s=Wm[r];if(s)t(s);else{if(!Tr())return n(new Error("window context not found"));const a=window.indexedDB.open(r,o);a.onerror=n,a.onsuccess=()=>{const i=a.result;i.onerror=n,Wm[r]=i,t(i)},a.onupgradeneeded=()=>{const i=a.result;i.objectStoreNames.contains("projects")||i.createObjectStore("projects"),i.objectStoreNames.contains("settings")||i.createObjectStore("settings")}}}),Pf=async(e,t)=>(await r3(t)).transaction([e],"readwrite").objectStore(e),o3=async(e,t)=>{const n=await Pf(e,t);return new Promise((r,o)=>{const s=[],a=n.openCursor();a.onerror=o,a.onsuccess=function(i){const u=i.target.result;if(u){const d=u.primaryKey,f=u.value;s.push({key:d,data:f}),u.continue()}else r(s)}})},s3=async(e,t,n)=>{const r=await Pf(e,n);return new Promise((o,s)=>{const a=r.get(t);a.onerror=s,a.onsuccess=()=>o(a.result)})},a3=async(e,t,n)=>{const r=await Pf(e,n);return new Promise((o,s)=>{const a=r.delete(t);a.onerror=s,a.onsuccess=()=>o()})};var Ci=(e=>(e.Existing="existing",e.Templates="templates",e))(Ci||{});const i3=e=>{const t=K3();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},l3=(e,t)=>kr.get(i3(e),{...t}),c3=async e=>{try{const t=await l3(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},Gm=async(e=xt.web)=>typeof window>"u"?[]:(await o3(mc.Projects)).map(({key:r,data:o})=>{var s;return{id:`${r}`,name:`${((s=o.custom)==null?void 0:s.projectName)||r}`,data:o}}).filter(r=>{var o;return((o=r.data.custom)==null?void 0:o.projectType)===e}),qm=new Set,Mn=new WeakMap,ga=new WeakMap,As=new WeakMap,Of=new WeakMap,u3=new WeakMap,ma=new WeakMap,vc=new WeakMap;let Vo;const Ls="__aa_tgt",_f="__aa_del",d3=e=>{const t=m3(e);t&&t.forEach(n=>v3(n))},f3=e=>{e.forEach(t=>{t.target===Vo&&h3(),Mn.has(t.target)&&Ms(t.target)})};function p3(e){const t=Of.get(e);t==null||t.disconnect();let n=Mn.get(e),r=0;const o=5;n||(n=ba(e),Mn.set(e,n));const{offsetWidth:s,offsetHeight:a}=Vo,l=[n.top-o,s-(n.left+o+n.width),a-(n.top+o+n.height),n.left-o].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++r>1&&Ms(e)},{root:Vo,threshold:1,rootMargin:l});u.observe(e),Of.set(e,u)}function Ms(e){clearTimeout(vc.get(e));const t=bc(e),n=typeof t=="function"?500:t.duration;vc.set(e,setTimeout(()=>{const r=As.get(e);(!r||r.finished)&&(Mn.set(e,ba(e)),p3(e))},n))}function h3(){clearTimeout(vc.get(Vo)),vc.set(Vo,setTimeout(()=>{qm.forEach(e=>Ym(e,t=>Km(()=>Ms(t))))},100))}function g3(e){setTimeout(()=>{u3.set(e,setInterval(()=>Km(Ms.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Km(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Af,va;typeof window<"u"&&(Vo=document.documentElement,Af=new MutationObserver(d3),va=new ResizeObserver(f3),va.observe(Vo));function m3(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Lf(n.target),!t.has(n.target)){t.add(n.target);for(let r=0;r<n.target.children.length;r++){const o=n.target.children.item(r);if(o){if(_f in o)return!1;Lf(n.target,o),t.add(o)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const o=n.removedNodes[r];if(_f in o)return!1;o instanceof Element&&(t.add(o),Lf(n.target,o),ga.set(o,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Lf(e,t){!t&&!(Ls in e)?Object.defineProperty(e,Ls,{value:e}):t&&!(Ls in t)&&Object.defineProperty(t,Ls,{value:e})}function v3(e){var t;const n=Vo.contains(e),r=Mn.has(e);n&&ga.has(e)&&ga.delete(e),As.has(e)&&((t=As.get(e))===null||t===void 0||t.cancel()),r&&n?b3(e):r&&!n?w3(e):y3(e)}function Ir(e){return Number(e.replace(/[^0-9.\-]/g,""))}function ba(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function Zm(e,t,n){let r=t.width,o=t.height,s=n.width,a=n.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const u=Ir(i.paddingTop)+Ir(i.paddingBottom)+Ir(i.borderTopWidth)+Ir(i.borderBottomWidth),d=Ir(i.paddingLeft)+Ir(i.paddingRight)+Ir(i.borderRightWidth)+Ir(i.borderLeftWidth);r-=d,s-=d,o-=u,a-=u}return[r,s,o,a].map(Math.round)}function bc(e){return Ls in e&&ma.has(e[Ls])?ma.get(e[Ls]):{duration:250,easing:"ease-in-out"}}function Ym(e,...t){t.forEach(n=>n(e,ma.has(e)));for(let n=0;n<e.children.length;n++){const r=e.children.item(n);r&&t.forEach(o=>o(r,ma.has(r)))}}function b3(e){const t=Mn.get(e),n=ba(e);let r;if(!t)return;const o=bc(e);if(typeof o!="function"){const s=t.left-n.left,a=t.top-n.top,[i,l,u,d]=Zm(e,t,n),f={transform:`translate(${s}px, ${a}px)`},p={transform:"translate(0, 0)"};i!==l&&(f.width=`${i}px`,p.width=`${l}px`),u!==d&&(f.height=`${u}px`,p.height=`${d}px`),r=e.animate([f,p],o)}else r=new Animation(o(e,"remain",t,n)),r.play();As.set(e,r),Mn.set(e,n),r.addEventListener("finish",Ms.bind(null,e))}function y3(e){const t=ba(e);Mn.set(e,t);const n=bc(e);let r;typeof n!="function"?r=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"}):(r=new Animation(n(e,"add",t)),r.play()),As.set(e,r),r.addEventListener("finish",Ms.bind(null,e))}function w3(e){if(!ga.has(e)||!Mn.has(e))return;const[t,n]=ga.get(e);Object.defineProperty(e,_f,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[r,o,s,a]=S3(e),i=bc(e),l=Mn.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${r}px`,left:`${o}px`,width:`${s}px`,height:`${a}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof i!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:i.duration,easing:"ease-out"}):(u=new Animation(i(e,"remove",l)),u.play()),As.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),Mn.delete(e),ga.delete(e),As.delete(e),(d=Of.get(e))===null||d===void 0||d.disconnect()})}function S3(e){const t=Mn.get(e),[n,,r]=Zm(e,t,ba(e));let o=e.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const s=getComputedStyle(o),a=Mn.get(o)||ba(o),i=Math.round(t.top-a.top)-Ir(s.borderTopWidth),l=Math.round(t.left-a.left)-Ir(s.borderLeftWidth);return[i,l,n,r]}function C3(e,t={}){Af&&va&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),Ym(e,Ms,g3,n=>va==null?void 0:va.observe(n)),typeof t=="function"?ma.set(e,t):ma.set(e,{duration:250,easing:"ease-in-out",...t}),Af.observe(e,{childList:!0}),qm.add(e))}function x3(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&C3(t.current,e)},[t]),t}const E3={[on.Info]:z.bgA,[on.Error]:"bg-red-500",[on.Success]:"bg-green-500",[on.Warning]:"bg-orange-400"},T3=h.forwardRef(function(t,n){const r={[on.Info]:q.informationVariant,[on.Error]:q.fire,[on.Success]:q.checkBold,[on.Warning]:q.alertRhombus},{children:o,className:s,content:a,id:i,buttons:l=[],variant:u=on.Info,autoHideTimeout:d=3e3}=t,f=h.useRef(null),p=h.useRef(),g=r[u],m=E3[u];h.useImperativeHandle(n,()=>f.current,[]);const v=()=>{var S;return(S=t.onDismiss)==null?void 0:S.call(t,i)},b=()=>{d&&(p.current=setTimeout(v,d))},w=()=>p.current&&clearTimeout(p.current);h.useEffect(()=>(b(),w),[]);const y=a||o;return c.jsx(Yn,{className:ae(s,"overflow-hidden relative"),ref:f,onPointerEnter:w,onPointerLeave:b,children:c.jsxs(I,{space:"m",items:"center",className:ae(Te.y),children:[c.jsx(B,{className:ae(m,te.pill,"text-white gjs-p-1"),children:c.jsx(ne,{icon:g,size:se.s})}),c.jsx(B,{grow:!0,className:ae("gjs-pr-3"),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(B,{className:ae("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(B,{className:ae(z.txtLowEmphasis),children:y}),!!l.length&&c.jsx(I,{space:"m",justify:"end",children:l.map(({id:S,...C})=>c.jsx(Ke,{...C},S))})]})}),c.jsx(B,{className:ae("absolute top-1 right-1"),children:c.jsx(Ct,{onClick:v,border:!1,children:c.jsx(ne,{icon:q.close,size:se.s})})})]})})});ce(h.forwardRef(function({className:t,toasts:n,onDismiss:r,...o},s){const a=x3({});return c.jsx("div",{className:ae(t,"w-80 gs-utl-z-30"),...o,ref:a,children:n.map(i=>c.jsx(T3,{...i,className:ae("gjs-mb-2"),onDismiss:r},i.uuid||i.id))})}));var Mf=(e=>(e.self="self",e.cloud="cloud",e))(Mf||{}),Ns=(e=>(e.image="image",e.video="video",e))(Ns||{}),vr=(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))(vr||{}),Nf=(e=>(e.canvas="canvas",e.layers="layers",e))(Nf||{}),Ho=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(Ho||{}),Bt=(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))(Bt||{}),$f=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))($f||{});const xi=e=>e.replaceAll('"',"").replaceAll("'",""),$s=e=>e.includes(",")?e:/\s/.test(e)?`'${xi(e)}'`:xi(e),Xm=(e,t,n)=>({family:e,variant:t,...n}),Ei=(e,t)=>{e=$s(e);const{menuVariant:n,variants:r}=t;return{family:e,familyLabel:xi(e),menuVariant:n&&Xm($s(`menuFont-${xi(e)}`),"regular",n),variants:Object.assign({},...Object.entries(r).map(([o,s])=>({[o]:Xm(e,o,s)})))}},kf=(e,t)=>{var i;const n=Ei(e.family,e),r=n.menuVariant??((i=Object.values(n.variants))==null?void 0:i[0]);if(!r)return"Arial, Helvetica, sans-serif";const{source:o,descriptors:s}=r,a=xi(r.family);if(!t){const l=new FontFace(a,`url("${o}")`,s),u=Array.from(document.fonts.values()).filter(d=>d.family===a);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return $s(a)},Vr=", sans-serif",Jm=["Arial, Helvetica"+Vr,"Arial Black, Gadget"+Vr,"Brush Script MT"+Vr,"Comic Sans MS, cursive"+Vr,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Vr,"Impact, Charcoal"+Vr,"Lucida Sans Unicode, Lucida Grande"+Vr,"Tahoma, Geneva"+Vr,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Vr,"Verdana, Geneva"+Vr].map(e=>({id:e,label:e.split(",")[0]})),P3=String.raw,po=(e,t)=>{if(!t)return"";const n=e[0],r=e[1];return`${n}${t}${r}`},O3=({family:e,source:t,descriptors:n})=>{const{display:r,ascentOverride:o,descentOverride:s,featureSettings:a,lineGapOverride:i,stretch:l,style:u,unicodeRange:d,weight:f}=n??{},p=[po`font-ascent-override: ${o};`,po`font-display: ${r};`,po`font-descent-override: ${s};`,po`font-feature-settings: ${a};`,po`font-line-gap-override: ${i};`,po`font-stretch: ${l};`,po`font-style: ${u};`,po`font-unicode-range: ${d};`,po`font-weight: ${f};`].filter(Boolean);return P3`
24
+ `));let f=d.props,g=typeof(f==null?void 0:f.className)=="function"?(...v)=>nc(f==null?void 0:f.className(...v),l.className):nc(f==null?void 0:f.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},Z1(d.props,ca(Hd(l,["ref"]))),p,u,{ref:o(d.ref,u.ref)},m))}return h.createElement(s,Object.assign({},Hd(l,["ref"]),s!==h.Fragment&&u,s!==h.Fragment&&p),d)}function Vd(){let e=h.useRef([]),t=h.useCallback(n=>{for(let r of e.current)r!=null&&(typeof r=="function"?r(n):r.current=n)},[]);return(...n)=>{if(!n.every(r=>r==null))return e.current=n,t}}function N5(...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 Z1(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let o in r)o.startsWith("on")&&typeof r[o]=="function"?(n[o]!=null||(n[o]=[]),n[o].push(r[o])):t[o]=r[o];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(r=>[r,void 0])));for(let r in n)Object.assign(t,{[r](o,...s){let a=n[r];for(let i of a){if((o instanceof Event||(o==null?void 0:o.nativeEvent)instanceof Event)&&o.defaultPrevented)return;i(o,...s)}}});return t}function ze(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function ca(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function Hd(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let k5="div";var vr=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(vr||{});function $5(e,t){var n;let{features:r=1,...o}=e,s={ref:t,"aria-hidden":(r&2)===2?!0:(n=o["aria-hidden"])!=null?n:void 0,hidden:(r&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",...(r&4)===4&&(r&2)!==2&&{display:"none"}}};return Be({ourProps:s,theirProps:o,slot:{},defaultTag:k5,name:"Hidden"})}let br=ze($5),jd=h.createContext(null);jd.displayName="OpenClosedContext";var pt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(pt||{});function Ts(){return h.useContext(jd)}function li({value:e,children:t}){return h.createElement(jd.Provider,{value:e},t)}function I5(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let Ps=[];I5(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&Ps[0]!==t.target&&(Ps.unshift(t.target),Ps=Ps.filter(n=>n!=null&&n.isConnected),Ps.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 $o(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let r=(t==null?void 0:t.getAttribute("disabled"))==="";return r&&V5(n)?!1:r}function V5(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 Dd(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),o=r??-1;switch(e.focus){case 0:{for(let s=0;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 1:{for(let s=o-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 2:{for(let s=o+1;s<n.length;++s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 3:{for(let s=n.length-1;s>=0;--s)if(!t.resolveDisabled(n[s],s,n))return s;return r}case 4:{for(let s=0;s<n.length;++s)if(t.resolveId(n[s],s,n)===e.id)return s;return r}case 5:return null;default:H5(e)}}function oc(e={},t=null,n=[]){for(let[r,o]of Object.entries(e))X1(n,Y1(t,r),o);return n}function Y1(e,t){return e?e+"["+t+"]":t}function X1(e,t,n){if(Array.isArray(n))for(let[r,o]of n.entries())X1(e,Y1(t,r.toString()),o);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,""]):oc(n,t,e)}function J1(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let o of r.elements)if(o!==e&&(o.tagName==="INPUT"&&o.type==="submit"||o.tagName==="BUTTON"&&o.type==="submit"||o.nodeName==="INPUT"&&o.type==="image")){o.click();return}(n=r.requestSubmit)==null||n.call(r)}}var ve=(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))(ve||{}),j5={NODE_ENV:"production"},D5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(D5||{}),F5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(F5||{}),B5=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(B5||{}),z5=(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))(z5||{});function Fd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),o=r.length>0&&r[0].dataRef.current.order!==null?r.sort((a,i)=>a.dataRef.current.order-i.dataRef.current.order):po(r,a=>a.dataRef.current.domRef.current),s=n?o.indexOf(n):null;return s===-1&&(s=null),{options:o,activeOptionIndex:s}}let U5={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 r=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(r!==-1)return{...e,activeOptionIndex:r,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,r,o,s,a;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((o=e.dataRef.current)!=null&&o.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Je.Specific?t.idx:Dd(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=(s=t.trigger)!=null?s:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p}}let i=Fd(e);if(i.activeOptionIndex===null){let d=i.options.findIndex(p=>!p.dataRef.current.disabled);d!==-1&&(i.activeOptionIndex=d)}let l=t.focus===Je.Specific?t.idx:Dd(t,{resolveItems:()=>i.options,resolveActiveIndex:()=>i.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(a=t.trigger)!=null?a:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...i,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,r,o;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let s=t.payload,a=Fd(e,l=>(l.push(s),l));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(s));let i={...e,...a,activationTrigger:2};return(o=e.dataRef.current)!=null&&o.__demoMode&&e.dataRef.current.value===void 0&&(i.activeOptionIndex=0),i},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(o=>o.id!==t.id)};let r=Fd(e,o=>{let s=o.findIndex(a=>a.id===t.id);return s!==-1&&o.splice(s,1),o});return{...e,...r,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 r=e.activeOptionIndex;if(e.activeOptionIndex!==null){let o=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);o!==-1?r=o:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},Bd=h.createContext(null);Bd.displayName="ComboboxActionsContext";function ci(e){let t=h.useContext(Bd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ci),n}return t}let Q1=h.createContext(null);function W5(e){var t;let n=Os("VirtualProvider"),[r,o]=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]),s=S5({scrollPaddingStart:r,scrollPaddingEnd:o,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[a,i]=h.useState(0);return Ze(()=>{i(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),h.createElement(Q1.Provider,{value:s},h.createElement("div",{style:{position:"relative",width:"100%",height:`${s.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&j5.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&s.scrollToIndex(n.activeOptionIndex)}}},s.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:`${a}-${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 zd=h.createContext(null);zd.displayName="ComboboxDataContext";function Os(e){let t=h.useContext(zd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Os),n}return t}function G5(e,t){return $e(t.type,U5,e,t)}let q5=h.Fragment;function K5(e,t){let{value:n,defaultValue:r,onChange:o,form:s,name:a,by:i=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,[w=p?[]:void 0,y]=Jl(n,o,r),[S,C]=h.useReducer(G5,{dataRef:h.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),x=h.useRef(!1),E=h.useRef({static:!1,hold:!1}),T=h.useRef(null),_=h.useRef(null),O=h.useRef(null),P=h.useRef(null),A=oe(typeof i=="string"?(R,le)=>{let ge=i;return(R==null?void 0:R[ge])===(le==null?void 0:le[ge])}:i??((R,le)=>R===le)),M=oe(R=>S.options.findIndex(le=>A(le.dataRef.current.value,R))),k=h.useCallback(R=>$e(L.mode,{1:()=>w.some(le=>A(le,R)),0:()=>A(w,R)}),[w]),j=oe(R=>S.activeOptionIndex===M(R)),L=h.useMemo(()=>({...S,immediate:v,optionsPropsRef:E,labelRef:T,inputRef:_,buttonRef:O,optionsRef:P,value:w,defaultValue:r,disabled:l,mode:p?1:0,virtual:S.virtual,get activeOptionIndex(){if(x.current&&S.activeOptionIndex===null&&S.options.length>0){let R=S.options.findIndex(le=>!le.dataRef.current.disabled);if(R!==-1)return R}return S.activeOptionIndex},calculateIndex:M,compare:A,isSelected:k,isActive:j,nullable:d,__demoMode:u}),[w,r,l,p,d,u,S,b]);Ze(()=>{},[b,void 0]),Ze(()=>{S.dataRef.current=L},[L]),$d([L.buttonRef,L.inputRef,L.optionsRef],()=>X.closeCombobox(),L.comboboxState===0);let D=h.useMemo(()=>{var R,le,ge;return{open:L.comboboxState===0,disabled:l,activeIndex:L.activeOptionIndex,activeOption:L.activeOptionIndex===null?null:L.virtual?L.virtual.options[(R=L.activeOptionIndex)!=null?R:0]:(ge=(le=L.options[L.activeOptionIndex])==null?void 0:le.dataRef.current.value)!=null?ge:null,value:w}},[L,l,w]),W=oe(()=>{if(L.activeOptionIndex!==null){if(L.virtual)J(L.virtual.options[L.activeOptionIndex]);else{let{dataRef:R}=L.options[L.activeOptionIndex];J(R.current.value)}X.goToOption(Je.Specific,L.activeOptionIndex)}}),F=oe(()=>{C({type:0}),x.current=!0}),$=oe(()=>{C({type:1}),x.current=!1}),H=oe((R,le,ge)=>(x.current=!1,R===Je.Specific?C({type:2,focus:Je.Specific,idx:le,trigger:ge}):C({type:2,focus:R,trigger:ge}))),V=oe((R,le)=>(C({type:3,payload:{id:R,dataRef:le}}),()=>{L.isActive(le.current.value)&&(x.current=!0),C({type:4,id:R})})),U=oe(R=>(C({type:5,id:R}),()=>C({type:5,id:null}))),J=oe(R=>$e(L.mode,{0(){return y==null?void 0:y(R)},1(){let le=L.value.slice(),ge=le.findIndex(Te=>A(Te,R));return ge===-1?le.push(R):le.splice(ge,1),y==null?void 0:y(le)}})),Y=oe(R=>{C({type:6,trigger:R})}),X=h.useMemo(()=>({onChange:J,registerOption:V,registerLabel:U,goToOption:H,closeCombobox:$,openCombobox:F,setActivationTrigger:Y,selectActiveOption:W}),[]),Q=t===null?{}:{ref:t},ee=h.useRef(null),G=mr();return h.useEffect(()=>{ee.current&&r!==void 0&&G.addEventListener(ee.current,"reset",()=>{y==null||y(r)})},[ee,y]),h.createElement(Bd.Provider,{value:X},h.createElement(zd.Provider,{value:L},h.createElement(li,{value:$e(L.comboboxState,{0:pt.Open,1:pt.Closed})},a!=null&&w!=null&&oc({[a]:w}).map(([R,le],ge)=>h.createElement(br,{features:vr.Hidden,ref:ge===0?Te=>{var Ce;ee.current=(Ce=Te==null?void 0:Te.closest("form"))!=null?Ce:null}:void 0,...ca({key:R,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:l,name:R,value:le})})),Be({ourProps:Q,theirProps:m,slot:D,defaultTag:q5,name:"Combobox"}))))}let Z5="input";function Y5(e,t){var n,r,o,s,a;let i=Et(),{id:l=`headlessui-combobox-input-${i}`,onChange:u,displayValue:d,type:p="text",...f}=e,g=Os("Combobox.Input"),m=ci("Combobox.Input"),v=Ye(g.inputRef,t),b=Es(g.inputRef),w=h.useRef(!1),y=mr(),S=oe(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Je.Nothing)}),C=function(){var L;return typeof d=="function"&&g.value!==void 0?(L=d(g.value))!=null?L:"":typeof g.value=="string"?g.value:""}();K1(([L,D],[W,F])=>{if(w.current)return;let $=g.inputRef.current;$&&((F===0&&D===1||L!==W)&&($.value=L),requestAnimationFrame(()=>{if(w.current||!$||(b==null?void 0:b.activeElement)!==$)return;let{selectionStart:H,selectionEnd:V}=$;Math.abs((V??0)-(H??0))===0&&H===0&&$.setSelectionRange($.value.length,$.value.length)}))},[C,g.comboboxState,b]),K1(([L],[D])=>{if(L===0&&D===1){if(w.current)return;let W=g.inputRef.current;if(!W)return;let F=W.value,{selectionStart:$,selectionEnd:H,selectionDirection:V}=W;W.value="",W.value=F,V!==null?W.setSelectionRange($,H,V):W.setSelectionRange($,H)}},[g.comboboxState]);let x=h.useRef(!1),E=oe(()=>{x.current=!0}),T=oe(()=>{y.nextFrame(()=>{x.current=!1})}),_=oe(L=>{switch(w.current=!0,L.key){case ve.Enter:if(w.current=!1,g.comboboxState!==0||x.current)return;if(L.preventDefault(),L.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case ve.ArrowDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),$e(g.comboboxState,{0:()=>m.goToOption(Je.Next),1:()=>m.openCombobox()});case ve.ArrowUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),$e(g.comboboxState,{0:()=>m.goToOption(Je.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Je.Last)})}});case ve.Home:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case ve.PageUp:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.First);case ve.End:if(L.shiftKey)break;return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case ve.PageDown:return w.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Je.Last);case ve.Escape:return w.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&&S(),m.closeCombobox());case ve.Tab:if(w.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),O=oe(L=>{u==null||u(L),g.nullable&&g.mode===0&&L.target.value===""&&S(),m.openCombobox()}),P=oe(L=>{var D,W,F;let $=(D=L.relatedTarget)!=null?D:Ps.find(H=>H!==L.currentTarget);if(w.current=!1,!((W=g.optionsRef.current)!=null&&W.contains($))&&!((F=g.buttonRef.current)!=null&&F.contains($))&&g.comboboxState===0)return L.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),A=oe(L=>{var D,W,F;let $=(D=L.relatedTarget)!=null?D:Ps.find(H=>H!==L.currentTarget);(W=g.buttonRef.current)!=null&&W.contains($)||(F=g.optionsRef.current)!=null&&F.contains($)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),M=ii(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),k=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),j={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?(r=g.options.find(L=>{var D;return!((D=g.virtual)!=null&&D.disabled(L.dataRef.current.value))&&g.compare(L.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:r.id:(o=g.options[g.activeOptionIndex])==null?void 0:o.id,"aria-labelledby":M,"aria-autocomplete":"list",defaultValue:(a=(s=e.defaultValue)!=null?s:g.defaultValue!==void 0?d==null?void 0:d(g.defaultValue):null)!=null?a:g.defaultValue,disabled:g.disabled,onCompositionStart:E,onCompositionEnd:T,onKeyDown:_,onChange:O,onFocus:A,onBlur:P};return Be({ourProps:j,theirProps:f,slot:k,defaultTag:Z5,name:"Combobox.Input"})}let X5="button";function J5(e,t){var n;let r=Os("Combobox.Button"),o=ci("Combobox.Button"),s=Ye(r.buttonRef,t),a=Et(),{id:i=`headlessui-combobox-button-${a}`,...l}=e,u=mr(),d=oe(v=>{switch(v.key){case ve.ArrowDown:return v.preventDefault(),v.stopPropagation(),r.comboboxState===1&&o.openCombobox(),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case ve.ArrowUp:return v.preventDefault(),v.stopPropagation(),r.comboboxState===1&&(o.openCombobox(),u.nextFrame(()=>{r.value||o.goToOption(Je.Last)})),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case ve.Escape:return r.comboboxState!==0?void 0:(v.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&v.stopPropagation(),o.closeCombobox(),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})}));default:return}}),p=oe(v=>{if($o(v.currentTarget))return v.preventDefault();r.comboboxState===0?o.closeCombobox():(v.preventDefault(),o.openCombobox()),u.nextFrame(()=>{var b;return(b=r.inputRef.current)==null?void 0:b.focus({preventScroll:!0})})}),f=ii(()=>{if(r.labelId)return[r.labelId,i].join(" ")},[r.labelId,i]),g=h.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),m={ref:s,id:i,type:la(e,r.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=r.optionsRef.current)==null?void 0:n.id,"aria-expanded":r.comboboxState===0,"aria-labelledby":f,disabled:r.disabled,onClick:p,onKeyDown:d};return Be({ourProps:m,theirProps:l,slot:g,defaultTag:X5,name:"Combobox.Button"})}let Q5="label";function R5(e,t){let n=Et(),{id:r=`headlessui-combobox-label-${n}`,...o}=e,s=Os("Combobox.Label"),a=ci("Combobox.Label"),i=Ye(s.labelRef,t);Ze(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled}),[s]);return Be({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:Q5,name:"Combobox.Label"})}let eP="ul",tP=yn.RenderStrategy|yn.Static;function nP(e,t){let n=Et(),{id:r=`headlessui-combobox-options-${n}`,hold:o=!1,...s}=e,a=Os("Combobox.Options"),i=Ye(a.optionsRef,t),l=Ts(),u=l!==null?(l&pt.Open)===pt.Open:a.comboboxState===0;Ze(()=>{var g;a.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[a.optionsPropsRef,e.static]),Ze(()=>{a.optionsPropsRef.current.hold=o},[a.optionsPropsRef,o]),q1({container:a.optionsRef.current,enabled:a.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=ii(()=>{var g,m;return(m=a.labelId)!=null?m:(g=a.buttonRef.current)==null?void 0:g.id},[a.labelId,a.buttonRef.current]),p=h.useMemo(()=>({open:a.comboboxState===0,option:void 0}),[a]),f={"aria-labelledby":d,role:"listbox","aria-multiselectable":a.mode===1?!0:void 0,id:r,ref:i};return a.virtual&&a.comboboxState===0&&Object.assign(s,{children:h.createElement(W5,null,s.children)}),Be({ourProps:f,theirProps:s,slot:p,defaultTag:eP,features:tP,visible:u,name:"Combobox.Options"})}let rP="li";function oP(e,t){var n;let r=Et(),{id:o=`headlessui-combobox-option-${r}`,disabled:s=!1,value:a,order:i=null,...l}=e,u=Os("Combobox.Option"),d=ci("Combobox.Option"),p=u.virtual?u.activeOptionIndex===u.calculateIndex(a):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===o,f=u.isSelected(a),g=h.useRef(null),m=jt({disabled:s,value:a,domRef:g,order:i}),v=h.useContext(Q1),b=Ye(t,g,v?v.measureElement:null),w=oe(()=>d.onChange(a));Ze(()=>d.registerOption(o,m),[m,o]);let y=h.useRef(!(u.virtual||u.__demoMode));Ze(()=>{if(!u.virtual||!u.__demoMode)return;let P=Nr();return P.requestAnimationFrame(()=>{y.current=!0}),P.dispose},[u.virtual,u.__demoMode]),Ze(()=>{if(!y.current||u.comboboxState!==0||!p||u.activationTrigger===0)return;let P=Nr();return P.requestAnimationFrame(()=>{var A,M;(M=(A=g.current)==null?void 0:A.scrollIntoView)==null||M.call(A,{block:"nearest"})}),P.dispose},[g,p,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let S=oe(P=>{var A;if(s||(A=u.virtual)!=null&&A.disabled(a))return P.preventDefault();w(),F1()||requestAnimationFrame(()=>{var M;return(M=u.inputRef.current)==null?void 0:M.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),C=oe(()=>{var P;if(s||(P=u.virtual)!=null&&P.disabled(a))return d.goToOption(Je.Nothing);let A=u.calculateIndex(a);d.goToOption(Je.Specific,A)}),x=G1(),E=oe(P=>x.update(P)),T=oe(P=>{var A;if(!x.wasMoved(P)||s||(A=u.virtual)!=null&&A.disabled(a)||p)return;let M=u.calculateIndex(a);d.goToOption(Je.Specific,M,0)}),_=oe(P=>{var A;x.wasMoved(P)&&(s||(A=u.virtual)!=null&&A.disabled(a)||p&&(u.optionsPropsRef.current.hold||d.goToOption(Je.Nothing)))}),O=h.useMemo(()=>({active:p,selected:f,disabled:s}),[p,f,s]);return Be({ourProps:{id:o,ref:b,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":f,disabled:void 0,onClick:S,onFocus:C,onPointerEnter:E,onMouseEnter:E,onPointerMove:T,onMouseMove:T,onPointerLeave:_,onMouseLeave:_},theirProps:l,slot:O,defaultTag:rP,name:"Combobox.Option"})}let sP=ze(K5),aP=ze(J5),iP=ze(Y5),lP=ze(R5),cP=ze(nP),uP=ze(oP),ua=Object.assign(sP,{Input:iP,Button:aP,Label:lP,Options:cP,Option:uP});function dP(e,t,n,r){let o=jt(n);h.useEffect(()=>{e=e??window;function s(a){o.current(a)}return e.addEventListener(t,s,r),()=>e.removeEventListener(t,s,r)},[e,t,r])}function sc(){let e=h.useRef(!1);return Ze(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function pP(e){let t=oe(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,Md(()=>{n.current&&t()})}),[t])}var fo=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(fo||{});function R1(){let e=h.useRef(0);return B1("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let fP=h.createContext(!1);function hP(){return h.useContext(fP)}function gP(e){let t=hP(),n=h.useContext(em),r=Es(e),[o,s]=h.useState(()=>{if(!t&&n!==null||uo.isServer)return null;let a=r==null?void 0:r.getElementById("headlessui-portal-root");if(a)return a;if(r===null)return null;let i=r.createElement("div");return i.setAttribute("id","headlessui-portal-root"),r.body.appendChild(i)});return h.useEffect(()=>{o!==null&&(r!=null&&r.body.contains(o)||r==null||r.body.appendChild(o))},[o,r]),h.useEffect(()=>{t||n!==null&&s(n.current)},[n,s,t]),o}let mP=h.Fragment;function vP(e,t){let n=e,r=h.useRef(null),o=Ye(Id(d=>{r.current=d}),t),s=Es(r),a=gP(r),[i]=h.useState(()=>{var d;return uo.isServer?null:(d=s==null?void 0:s.createElement("div"))!=null?d:null}),l=h.useContext(Ud),u=Ql();return Ze(()=>{!a||!i||a.contains(i)||(i.setAttribute("data-headlessui-portal",""),a.appendChild(i))},[a,i]),Ze(()=>{if(i&&l)return l.register(i)},[l,i]),pP(()=>{var d;!a||!i||(i instanceof Node&&a.contains(i)&&a.removeChild(i),a.childNodes.length<=0&&((d=a.parentElement)==null||d.removeChild(a)))}),u?!a||!i?null:zn.createPortal(Be({ourProps:{ref:o},theirProps:n,defaultTag:mP,name:"Portal"}),i):null}let bP=h.Fragment,em=h.createContext(null);function yP(e,t){let{target:n,...r}=e,o={ref:Ye(t)};return h.createElement(em.Provider,{value:n},Be({ourProps:o,theirProps:r,defaultTag:bP,name:"Popover.Group"}))}let Ud=h.createContext(null);function wP(){let e=h.useContext(Ud),t=h.useRef([]),n=oe(s=>(t.current.push(s),e&&e.register(s),()=>r(s))),r=oe(s=>{let a=t.current.indexOf(s);a!==-1&&t.current.splice(a,1),e&&e.unregister(s)}),o=h.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,h.useMemo(()=>function({children:s}){return h.createElement(Ud.Provider,{value:o},s)},[o])]}let SP=ze(vP),CP=ze(yP);Object.assign(SP,{Group:CP});function xP({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let o=h.useRef((r=n==null?void 0:n.current)!=null?r:null),s=Es(o),a=oe(()=>{var i,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(i=s==null?void 0:s.querySelectorAll("html > *, body > *"))!=null?i:[])p!==document.body&&p!==document.head&&p instanceof HTMLElement&&p.id!=="headlessui-portal-root"&&(p.contains(o.current)||p.contains((u=(l=o.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(f=>p.contains(f))||d.push(p));return d});return{resolveContainers:a,contains:oe(i=>a().some(l=>l.contains(i))),mainTreeNodeRef:o,MainTreeNode:h.useMemo(()=>function(){return n!=null?null:h.createElement(br,{features:vr.Hidden,ref:o})},[o,n])}}function EP(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(br,{features:vr.Hidden,ref:e})},[e])}}let tm=h.createContext(null);function nm(){let e=h.useContext(tm);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,nm),t}return e}function Wd(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=h.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return h.createElement(tm.Provider,{value:o},n.children)},[t])]}let TP="p";function PP(e,t){let n=Et(),{id:r=`headlessui-description-${n}`,...o}=e,s=nm(),a=Ye(t);Ze(()=>s.register(r),[r,s.register]);let i={ref:a,...s.props,id:r};return Be({ourProps:i,theirProps:o,slot:s.slot||{},defaultTag:TP,name:s.name||"Description"})}let OP=ze(PP),rm=Object.assign(OP,{});var om;let _P=(om=h.startTransition)!=null?om:function(e){e()};var AP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(AP||{}),LP=(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))(LP||{});let MP={0:e=>({...e,disclosureState:$e(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}}},Gd=h.createContext(null);Gd.displayName="DisclosureContext";function qd(e){let t=h.useContext(Gd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,qd),n}return t}let Kd=h.createContext(null);Kd.displayName="DisclosureAPIContext";function sm(e){let t=h.useContext(Kd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,sm),n}return t}let Zd=h.createContext(null);Zd.displayName="DisclosurePanelContext";function NP(){return h.useContext(Zd)}function kP(e,t){return $e(t.type,MP,e,t)}let $P=h.Fragment;function IP(e,t){let{defaultOpen:n=!1,...r}=e,o=h.useRef(null),s=Ye(t,Id(b=>{o.current=b},e.as===void 0||e.as===h.Fragment)),a=h.useRef(null),i=h.useRef(null),l=h.useReducer(kP,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:i,panelRef:a,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},p]=l,f=oe(b=>{p({type:1});let w=No(o);if(!w||!d)return;let y=b?b instanceof HTMLElement?b:b.current instanceof HTMLElement?b.current:w.getElementById(d):w.getElementById(d);y==null||y.focus()}),g=h.useMemo(()=>({close:f}),[f]),m=h.useMemo(()=>({open:u===0,close:f}),[u,f]),v={ref:s};return h.createElement(Gd.Provider,{value:l},h.createElement(Kd.Provider,{value:g},h.createElement(li,{value:$e(u,{0:pt.Open,1:pt.Closed})},Be({ourProps:v,theirProps:r,slot:m,defaultTag:$P,name:"Disclosure"}))))}let VP="button";function HP(e,t){let n=Et(),{id:r=`headlessui-disclosure-button-${n}`,...o}=e,[s,a]=qd("Disclosure.Button"),i=NP(),l=i===null?!1:i===s.panelId,u=h.useRef(null),d=Ye(u,t,l?null:s.buttonRef),p=Vd();h.useEffect(()=>{if(!l)return a({type:2,buttonId:r}),()=>{a({type:2,buttonId:null})}},[r,a,l]);let f=oe(y=>{var S;if(l){if(s.disclosureState===1)return;switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),a({type:0}),(S=s.buttonRef.current)==null||S.focus();break}}else switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),a({type:0});break}}),g=oe(y=>{switch(y.key){case ve.Space:y.preventDefault();break}}),m=oe(y=>{var S;$o(y.currentTarget)||e.disabled||(l?(a({type:0}),(S=s.buttonRef.current)==null||S.focus()):a({type:0}))}),v=h.useMemo(()=>({open:s.disclosureState===0}),[s]),b=la(e,u),w=l?{ref:d,type:b,onKeyDown:f,onClick:m}:{ref:d,id:r,type:b,"aria-expanded":s.disclosureState===0,"aria-controls":s.linkedPanel?s.panelId:void 0,onKeyDown:f,onKeyUp:g,onClick:m};return Be({mergeRefs:p,ourProps:w,theirProps:o,slot:v,defaultTag:VP,name:"Disclosure.Button"})}let jP="div",DP=yn.RenderStrategy|yn.Static;function FP(e,t){let n=Et(),{id:r=`headlessui-disclosure-panel-${n}`,...o}=e,[s,a]=qd("Disclosure.Panel"),{close:i}=sm("Disclosure.Panel"),l=Vd(),u=Ye(t,s.panelRef,m=>{_P(()=>a({type:m?4:5}))});h.useEffect(()=>(a({type:3,panelId:r}),()=>{a({type:3,panelId:null})}),[r,a]);let d=Ts(),p=d!==null?(d&pt.Open)===pt.Open:s.disclosureState===0,f=h.useMemo(()=>({open:s.disclosureState===0,close:i}),[s,i]),g={ref:u,id:r};return h.createElement(Zd.Provider,{value:s.panelId},Be({mergeRefs:l,ourProps:g,theirProps:o,slot:f,defaultTag:jP,features:DP,visible:p,name:"Disclosure.Panel"}))}let BP=ze(IP),zP=ze(HP),UP=ze(FP),Yd=Object.assign(BP,{Button:zP,Panel:UP}),am=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function im(e){var t,n;let r=(t=e.innerText)!=null?t:"",o=e.cloneNode(!0);if(!(o instanceof HTMLElement))return r;let s=!1;for(let i of o.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))i.remove(),s=!0;let a=s?(n=o.innerText)!=null?n:"":r;return am.test(a)&&(a=a.replace(am,"")),a}function WP(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let r=n.split(" ").map(o=>{let s=document.getElementById(o);if(s){let a=s.getAttribute("aria-label");return typeof a=="string"?a.trim():im(s).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return im(e).trim()}function GP(e){let t=h.useRef(""),n=h.useRef("");return oe(()=>{let r=e.current;if(!r)return"";let o=r.innerText;if(t.current===o)return n.current;let s=WP(r).trim().toLowerCase();return t.current=o,n.current=s,s})}var qP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(qP||{}),KP=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(KP||{}),ZP=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(ZP||{}),YP=(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))(YP||{});function Xd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=po(t(e.options.slice()),s=>s.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let XP={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,r=e.options.findIndex(o=>n(o.dataRef.current.value));return r!==-1&&(t=r),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let r=Xd(e),o=Dd(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:s=>s.id,resolveDisabled:s=>s.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:o,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,r=e.searchQuery+t.value.toLowerCase(),o=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(a=>{var i;return!a.dataRef.current.disabled&&((i=a.dataRef.current.textValue)==null?void 0:i.startsWith(r))}),s=o?e.options.indexOf(o):-1;return s===-1||s===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:s,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},r=Xd(e,o=>[...o,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(r.activeOptionIndex=r.options.indexOf(n)),{...e,...r}},6:(e,t)=>{let n=Xd(e,r=>{let o=r.findIndex(s=>s.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},Jd=h.createContext(null);Jd.displayName="ListboxActionsContext";function ui(e){let t=h.useContext(Jd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ui),n}return t}let Qd=h.createContext(null);Qd.displayName="ListboxDataContext";function di(e){let t=h.useContext(Qd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,di),n}return t}function JP(e,t){return $e(t.type,XP,e,t)}let QP=h.Fragment;function RP(e,t){let{value:n,defaultValue:r,form:o,name:s,onChange:a,by:i=(Y,X)=>Y===X,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...p}=e;const f=u?"horizontal":"vertical";let g=Ye(t),[m=d?[]:void 0,v]=Jl(n,a,r),[b,w]=h.useReducer(JP,{dataRef:h.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=h.useRef({static:!1,hold:!1}),S=h.useRef(null),C=h.useRef(null),x=h.useRef(null),E=oe(typeof i=="string"?(Y,X)=>{let Q=i;return(Y==null?void 0:Y[Q])===(X==null?void 0:X[Q])}:i),T=h.useCallback(Y=>$e(_.mode,{1:()=>m.some(X=>E(X,Y)),0:()=>E(m,Y)}),[m]),_=h.useMemo(()=>({...b,value:m,disabled:l,mode:d?1:0,orientation:f,compare:E,isSelected:T,optionsPropsRef:y,labelRef:S,buttonRef:C,optionsRef:x}),[m,l,d,b]);Ze(()=>{b.dataRef.current=_},[_]),$d([_.buttonRef,_.optionsRef],(Y,X)=>{var Q;w({type:1}),kd(X,ec.Loose)||(Y.preventDefault(),(Q=_.buttonRef.current)==null||Q.focus())},_.listboxState===0);let O=h.useMemo(()=>({open:_.listboxState===0,disabled:l,value:m}),[_,l,m]),P=oe(Y=>{let X=_.options.find(Q=>Q.id===Y);X&&W(X.dataRef.current.value)}),A=oe(()=>{if(_.activeOptionIndex!==null){let{dataRef:Y,id:X}=_.options[_.activeOptionIndex];W(Y.current.value),w({type:2,focus:Je.Specific,id:X})}}),M=oe(()=>w({type:0})),k=oe(()=>w({type:1})),j=oe((Y,X,Q)=>Y===Je.Specific?w({type:2,focus:Je.Specific,id:X,trigger:Q}):w({type:2,focus:Y,trigger:Q})),L=oe((Y,X)=>(w({type:5,id:Y,dataRef:X}),()=>w({type:6,id:Y}))),D=oe(Y=>(w({type:7,id:Y}),()=>w({type:7,id:null}))),W=oe(Y=>$e(_.mode,{0(){return v==null?void 0:v(Y)},1(){let X=_.value.slice(),Q=X.findIndex(ee=>E(ee,Y));return Q===-1?X.push(Y):X.splice(Q,1),v==null?void 0:v(X)}})),F=oe(Y=>w({type:3,value:Y})),$=oe(()=>w({type:4})),H=h.useMemo(()=>({onChange:W,registerOption:L,registerLabel:D,goToOption:j,closeListbox:k,openListbox:M,selectActiveOption:A,selectOption:P,search:F,clearSearch:$}),[]),V={ref:g},U=h.useRef(null),J=mr();return h.useEffect(()=>{U.current&&r!==void 0&&J.addEventListener(U.current,"reset",()=>{v==null||v(r)})},[U,v]),h.createElement(Jd.Provider,{value:H},h.createElement(Qd.Provider,{value:_},h.createElement(li,{value:$e(_.listboxState,{0:pt.Open,1:pt.Closed})},s!=null&&m!=null&&oc({[s]:m}).map(([Y,X],Q)=>h.createElement(br,{features:vr.Hidden,ref:Q===0?ee=>{var G;U.current=(G=ee==null?void 0:ee.closest("form"))!=null?G:null}:void 0,...ca({key:Y,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Y,value:X})})),Be({ourProps:V,theirProps:p,slot:O,defaultTag:QP,name:"Listbox"}))))}let eO="button";function tO(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-button-${r}`,...s}=e,a=di("Listbox.Button"),i=ui("Listbox.Button"),l=Ye(a.buttonRef,t),u=mr(),d=oe(b=>{switch(b.key){case ve.Space:case ve.Enter:case ve.ArrowDown:b.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Je.First)});break;case ve.ArrowUp:b.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(Je.Last)});break}}),p=oe(b=>{switch(b.key){case ve.Space:b.preventDefault();break}}),f=oe(b=>{if($o(b.currentTarget))return b.preventDefault();a.listboxState===0?(i.closeListbox(),u.nextFrame(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})})):(b.preventDefault(),i.openListbox())}),g=ii(()=>{if(a.labelId)return[a.labelId,o].join(" ")},[a.labelId,o]),m=h.useMemo(()=>({open:a.listboxState===0,disabled:a.disabled,value:a.value}),[a]),v={ref:l,id:o,type:la(e,a.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=a.optionsRef.current)==null?void 0:n.id,"aria-expanded":a.listboxState===0,"aria-labelledby":g,disabled:a.disabled,onKeyDown:d,onKeyUp:p,onClick:f};return Be({ourProps:v,theirProps:s,slot:m,defaultTag:eO,name:"Listbox.Button"})}let nO="label";function rO(e,t){let n=Et(),{id:r=`headlessui-listbox-label-${n}`,...o}=e,s=di("Listbox.Label"),a=ui("Listbox.Label"),i=Ye(s.labelRef,t);Ze(()=>a.registerLabel(r),[r]);let l=oe(()=>{var d;return(d=s.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:s.listboxState===0,disabled:s.disabled}),[s]);return Be({ourProps:{ref:i,id:r,onClick:l},theirProps:o,slot:u,defaultTag:nO,name:"Listbox.Label"})}let oO="ul",sO=yn.RenderStrategy|yn.Static;function aO(e,t){var n;let r=Et(),{id:o=`headlessui-listbox-options-${r}`,...s}=e,a=di("Listbox.Options"),i=ui("Listbox.Options"),l=Ye(a.optionsRef,t),u=mr(),d=mr(),p=Ts(),f=p!==null?(p&pt.Open)===pt.Open:a.listboxState===0;h.useEffect(()=>{var w;let y=a.optionsRef.current;y&&a.listboxState===0&&y!==((w=No(y))==null?void 0:w.activeElement)&&y.focus({preventScroll:!0})},[a.listboxState,a.optionsRef]);let g=oe(w=>{switch(d.dispose(),w.key){case ve.Space:if(a.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),i.search(w.key);case ve.Enter:if(w.preventDefault(),w.stopPropagation(),a.activeOptionIndex!==null){let{dataRef:y}=a.options[a.activeOptionIndex];i.onChange(y.current.value)}a.mode===0&&(i.closeListbox(),Nr().nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case $e(a.orientation,{vertical:ve.ArrowDown,horizontal:ve.ArrowRight}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Next);case $e(a.orientation,{vertical:ve.ArrowUp,horizontal:ve.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Previous);case ve.Home:case ve.PageUp:return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.First);case ve.End:case ve.PageDown:return w.preventDefault(),w.stopPropagation(),i.goToOption(Je.Last);case ve.Escape:return w.preventDefault(),w.stopPropagation(),i.closeListbox(),u.nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case ve.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(i.search(w.key),d.setTimeout(()=>i.clearSearch(),350));break}}),m=ii(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.id},[a.buttonRef.current]),v=h.useMemo(()=>({open:a.listboxState===0}),[a]),b={"aria-activedescendant":a.activeOptionIndex===null||(n=a.options[a.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":a.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":a.orientation,id:o,onKeyDown:g,role:"listbox",tabIndex:0,ref:l};return Be({ourProps:b,theirProps:s,slot:v,defaultTag:oO,features:sO,visible:f,name:"Listbox.Options"})}let iO="li";function lO(e,t){let n=Et(),{id:r=`headlessui-listbox-option-${n}`,disabled:o=!1,value:s,...a}=e,i=di("Listbox.Option"),l=ui("Listbox.Option"),u=i.activeOptionIndex!==null?i.options[i.activeOptionIndex].id===r:!1,d=i.isSelected(s),p=h.useRef(null),f=GP(p),g=jt({disabled:o,value:s,domRef:p,get textValue(){return f()}}),m=Ye(t,p);Ze(()=>{if(i.listboxState!==0||!u||i.activationTrigger===0)return;let E=Nr();return E.requestAnimationFrame(()=>{var T,_;(_=(T=p.current)==null?void 0:T.scrollIntoView)==null||_.call(T,{block:"nearest"})}),E.dispose},[p,u,i.listboxState,i.activationTrigger,i.activeOptionIndex]),Ze(()=>l.registerOption(r,g),[g,r]);let v=oe(E=>{if(o)return E.preventDefault();l.onChange(s),i.mode===0&&(l.closeListbox(),Nr().nextFrame(()=>{var T;return(T=i.buttonRef.current)==null?void 0:T.focus({preventScroll:!0})}))}),b=oe(()=>{if(o)return l.goToOption(Je.Nothing);l.goToOption(Je.Specific,r)}),w=G1(),y=oe(E=>w.update(E)),S=oe(E=>{w.wasMoved(E)&&(o||u||l.goToOption(Je.Specific,r,0))}),C=oe(E=>{w.wasMoved(E)&&(o||u&&l.goToOption(Je.Nothing))}),x=h.useMemo(()=>({active:u,selected:d,disabled:o}),[u,d,o]);return Be({ourProps:{id:r,ref:m,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:v,onFocus:b,onPointerEnter:y,onMouseEnter:y,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C},theirProps:a,slot:x,defaultTag:iO,name:"Listbox.Option"})}let cO=ze(RP),uO=ze(tO),dO=ze(rO),pO=ze(aO),fO=ze(lO),pi=Object.assign(cO,{Button:uO,Label:dO,Options:pO,Option:fO});var hO=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(hO||{}),gO=(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))(gO||{});let mO={0:e=>{let t={...e,popoverState:$e(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}}},Rd=h.createContext(null);Rd.displayName="PopoverContext";function ac(e){let t=h.useContext(Rd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,ac),n}return t}let ep=h.createContext(null);ep.displayName="PopoverAPIContext";function tp(e){let t=h.useContext(ep);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,tp),n}return t}let np=h.createContext(null);np.displayName="PopoverGroupContext";function lm(){return h.useContext(np)}let ic=h.createContext(null);ic.displayName="PopoverPanelContext";function vO(){return h.useContext(ic)}function bO(e,t){return $e(t.type,mO,e,t)}let yO="div";function wO(e,t){var n;let{__demoMode:r=!1,...o}=e,s=h.useRef(null),a=Ye(t,Id(D=>{s.current=D})),i=h.useRef([]),l=h.useReducer(bO,{__demoMode:r,popoverState:r?0:1,buttons:i,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,w=Es((n=s.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!f)return!1;for(let U of document.querySelectorAll("body > *"))if(Number(U==null?void 0:U.contains(d))^Number(U==null?void 0:U.contains(f)))return!0;let D=Rl(),W=D.indexOf(d),F=(W+D.length-1)%D.length,$=(W+1)%D.length,H=D[F],V=D[$];return!f.contains(H)&&!f.contains(V)},[d,f]),S=jt(p),C=jt(g),x=h.useMemo(()=>({buttonId:S,panelId:C,close:()=>b({type:1})}),[S,C,b]),E=lm(),T=E==null?void 0:E.registerPopover,_=oe(()=>{var D;return(D=E==null?void 0:E.isFocusWithinPopoverGroup())!=null?D:(w==null?void 0:w.activeElement)&&((d==null?void 0:d.contains(w.activeElement))||(f==null?void 0:f.contains(w.activeElement)))});h.useEffect(()=>T==null?void 0:T(x),[T,x]);let[O,P]=wP(),A=xP({mainTreeNodeRef:E==null?void 0:E.mainTreeNodeRef,portals:O,defaultContainers:[d,f]});dP(w==null?void 0:w.defaultView,"focus",D=>{var W,F,$,H;D.target!==window&&D.target instanceof HTMLElement&&u===0&&(_()||d&&f&&(A.contains(D.target)||(F=(W=m.current)==null?void 0:W.contains)!=null&&F.call(W,D.target)||(H=($=v.current)==null?void 0:$.contains)!=null&&H.call($,D.target)||b({type:1})))},!0),$d(A.resolveContainers,(D,W)=>{b({type:1}),kd(W,ec.Loose)||(D.preventDefault(),d==null||d.focus())},u===0);let M=oe(D=>{b({type:1});let W=D?D instanceof HTMLElement?D:"current"in D&&D.current instanceof HTMLElement?D.current:d:d;W==null||W.focus()}),k=h.useMemo(()=>({close:M,isPortalled:y}),[M,y]),j=h.useMemo(()=>({open:u===0,close:M}),[u,M]),L={ref:a};return h.createElement(ic.Provider,{value:null},h.createElement(Rd.Provider,{value:l},h.createElement(ep.Provider,{value:k},h.createElement(li,{value:$e(u,{0:pt.Open,1:pt.Closed})},h.createElement(P,null,Be({ourProps:L,theirProps:o,slot:j,defaultTag:yO,name:"Popover"}),h.createElement(A.MainTreeNode,null))))))}let SO="button";function CO(e,t){let n=Et(),{id:r=`headlessui-popover-button-${n}`,...o}=e,[s,a]=ac("Popover.Button"),{isPortalled:i}=tp("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${Et()}`,d=lm(),p=d==null?void 0:d.closeOthers,f=vO()!==null;h.useEffect(()=>{if(!f)return a({type:3,buttonId:r}),()=>{a({type:3,buttonId:null})}},[f,r,a]);let[g]=h.useState(()=>Symbol()),m=Ye(l,t,f?null:A=>{if(A)s.buttons.current.push(g);else{let M=s.buttons.current.indexOf(g);M!==-1&&s.buttons.current.splice(M,1)}s.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),A&&a({type:2,button:A})}),v=Ye(l,t),b=Es(l),w=oe(A=>{var M,k,j;if(f){if(s.popoverState===1)return;switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),(k=(M=A.target).click)==null||k.call(M),a({type:1}),(j=s.button)==null||j.focus();break}}else switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),A.stopPropagation(),s.popoverState===1&&(p==null||p(s.buttonId)),a({type:0});break;case ve.Escape:if(s.popoverState!==0)return p==null?void 0:p(s.buttonId);if(!l.current||b!=null&&b.activeElement&&!l.current.contains(b.activeElement))return;A.preventDefault(),A.stopPropagation(),a({type:1});break}}),y=oe(A=>{f||A.key===ve.Space&&A.preventDefault()}),S=oe(A=>{var M,k;$o(A.currentTarget)||e.disabled||(f?(a({type:1}),(M=s.button)==null||M.focus()):(A.preventDefault(),A.stopPropagation(),s.popoverState===1&&(p==null||p(s.buttonId)),a({type:0}),(k=s.button)==null||k.focus()))}),C=oe(A=>{A.preventDefault(),A.stopPropagation()}),x=s.popoverState===0,E=h.useMemo(()=>({open:x}),[x]),T=la(e,l),_=f?{ref:v,type:T,onKeyDown:w,onClick:S}:{ref:m,id:s.buttonId,type:T,"aria-expanded":s.popoverState===0,"aria-controls":s.panel?s.panelId:void 0,onKeyDown:w,onKeyUp:y,onClick:S,onMouseDown:C},O=R1(),P=oe(()=>{let A=s.panel;if(!A)return;function M(){$e(O.current,{[fo.Forwards]:()=>ln(A,_t.First),[fo.Backwards]:()=>ln(A,_t.Last)})===kr.Error&&ln(Rl().filter(k=>k.dataset.headlessuiFocusGuard!=="true"),$e(O.current,{[fo.Forwards]:_t.Next,[fo.Backwards]:_t.Previous}),{relativeTo:s.button})}M()});return h.createElement(h.Fragment,null,Be({ourProps:_,theirProps:o,slot:E,defaultTag:SO,name:"Popover.Button"}),x&&!f&&i&&h.createElement(br,{id:u,features:vr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let xO="div",EO=yn.RenderStrategy|yn.Static;function TO(e,t){let n=Et(),{id:r=`headlessui-popover-overlay-${n}`,...o}=e,[{popoverState:s},a]=ac("Popover.Overlay"),i=Ye(t),l=Ts(),u=l!==null?(l&pt.Open)===pt.Open:s===0,d=oe(f=>{if($o(f.currentTarget))return f.preventDefault();a({type:1})}),p=h.useMemo(()=>({open:s===0}),[s]);return Be({ourProps:{ref:i,id:r,"aria-hidden":!0,onClick:d},theirProps:o,slot:p,defaultTag:xO,features:EO,visible:u,name:"Popover.Overlay"})}let PO="div",OO=yn.RenderStrategy|yn.Static;function _O(e,t){let n=Et(),{id:r=`headlessui-popover-panel-${n}`,focus:o=!1,...s}=e,[a,i]=ac("Popover.Panel"),{close:l,isPortalled:u}=tp("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Et()}`,p=`headlessui-focus-sentinel-after-${Et()}`,f=h.useRef(null),g=Ye(f,t,_=>{i({type:4,panel:_})}),m=Es(f),v=Vd();Ze(()=>(i({type:5,panelId:r}),()=>{i({type:5,panelId:null})}),[r,i]);let b=Ts(),w=b!==null?(b&pt.Open)===pt.Open:a.popoverState===0,y=oe(_=>{var O;switch(_.key){case ve.Escape:if(a.popoverState!==0||!f.current||m!=null&&m.activeElement&&!f.current.contains(m.activeElement))return;_.preventDefault(),_.stopPropagation(),i({type:1}),(O=a.button)==null||O.focus();break}});h.useEffect(()=>{var _;e.static||a.popoverState===1&&((_=e.unmount)==null||_)&&i({type:4,panel:null})},[a.popoverState,e.unmount,e.static,i]),h.useEffect(()=>{if(a.__demoMode||!o||a.popoverState!==0||!f.current)return;let _=m==null?void 0:m.activeElement;f.current.contains(_)||ln(f.current,_t.First)},[a.__demoMode,o,f,a.popoverState]);let S=h.useMemo(()=>({open:a.popoverState===0,close:l}),[a,l]),C={ref:g,id:r,onKeyDown:y,onBlur:o&&a.popoverState===0?_=>{var O,P,A,M,k;let j=_.relatedTarget;j&&f.current&&((O=f.current)!=null&&O.contains(j)||(i({type:1}),((A=(P=a.beforePanelSentinel.current)==null?void 0:P.contains)!=null&&A.call(P,j)||(k=(M=a.afterPanelSentinel.current)==null?void 0:M.contains)!=null&&k.call(M,j))&&j.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=R1(),E=oe(()=>{let _=f.current;if(!_)return;function O(){$e(x.current,{[fo.Forwards]:()=>{var P;ln(_,_t.First)===kr.Error&&((P=a.afterPanelSentinel.current)==null||P.focus())},[fo.Backwards]:()=>{var P;(P=a.button)==null||P.focus({preventScroll:!0})}})}O()}),T=oe(()=>{let _=f.current;if(!_)return;function O(){$e(x.current,{[fo.Forwards]:()=>{var P;if(!a.button)return;let A=Rl(),M=A.indexOf(a.button),k=A.slice(0,M+1),j=[...A.slice(M+1),...k];for(let L of j.slice())if(L.dataset.headlessuiFocusGuard==="true"||(P=a.panel)!=null&&P.contains(L)){let D=j.indexOf(L);D!==-1&&j.splice(D,1)}ln(j,_t.First,{sorted:!1})},[fo.Backwards]:()=>{var P;ln(_,_t.Previous)===kr.Error&&((P=a.button)==null||P.focus())}})}O()});return h.createElement(ic.Provider,{value:r},w&&u&&h.createElement(br,{id:d,ref:a.beforePanelSentinel,features:vr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),Be({mergeRefs:v,ourProps:C,theirProps:s,slot:S,defaultTag:PO,features:OO,visible:w,name:"Popover.Panel"}),w&&u&&h.createElement(br,{id:p,ref:a.afterPanelSentinel,features:vr.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let AO="div";function LO(e,t){let n=h.useRef(null),r=Ye(n,t),[o,s]=h.useState([]),a=EP(),i=oe(v=>{s(b=>{let w=b.indexOf(v);if(w!==-1){let y=b.slice();return y.splice(w,1),y}return b})}),l=oe(v=>(s(b=>[...b,v]),()=>i(v))),u=oe(()=>{var v;let b=No(n);if(!b)return!1;let w=b.activeElement;return(v=n.current)!=null&&v.contains(w)?!0:o.some(y=>{var S,C;return((S=b.getElementById(y.buttonId.current))==null?void 0:S.contains(w))||((C=b.getElementById(y.panelId.current))==null?void 0:C.contains(w))})}),d=oe(v=>{for(let b of o)b.buttonId.current!==v&&b.close()}),p=h.useMemo(()=>({registerPopover:l,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:a.mainTreeNodeRef}),[l,i,u,d,a.mainTreeNodeRef]),f=h.useMemo(()=>({}),[]),g=e,m={ref:r};return h.createElement(np.Provider,{value:p},Be({ourProps:m,theirProps:g,slot:f,defaultTag:AO,name:"Popover.Group"}),h.createElement(a.MainTreeNode,null))}let MO=ze(wO),NO=ze(CO),kO=ze(TO),$O=ze(_O),IO=ze(LO),rp=Object.assign(MO,{Button:NO,Overlay:kO,Panel:$O,Group:IO}),cm=h.createContext(null);function um(){let e=h.useContext(cm);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,um),t}return e}function op(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let r=oe(s=>(t(a=>[...a,s]),()=>t(a=>{let i=a.slice(),l=i.indexOf(s);return l!==-1&&i.splice(l,1),i}))),o=h.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return h.createElement(cm.Provider,{value:o},n.children)},[t])]}let VO="label";function HO(e,t){let n=Et(),{id:r=`headlessui-label-${n}`,passive:o=!1,...s}=e,a=um(),i=Ye(t);Ze(()=>a.register(r),[r,a.register]);let l={ref:i,...a.props,id:r};return o&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in s&&delete s.onClick),Be({ourProps:l,theirProps:s,slot:a.slot||{},defaultTag:VO,name:a.name||"Label"})}let jO=ze(HO),dm=Object.assign(jO,{});function pm(e=0){let[t,n]=h.useState(e),r=sc(),o=h.useCallback(l=>{r.current&&n(u=>u|l)},[t,r]),s=h.useCallback(l=>!!(t&l),[t]),a=h.useCallback(l=>{r.current&&n(u=>u&~l)},[n,r]),i=h.useCallback(l=>{r.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:o,hasFlag:s,removeFlag:a,toggleFlag:i}}var DO=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(DO||{});let FO={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:po(n,r=>r.element.current)}},1(e,t){let n=e.options.slice(),r=e.options.findIndex(o=>o.id===t.id);return r===-1?e:(n.splice(r,1),{...e,options:n})}},sp=h.createContext(null);sp.displayName="RadioGroupDataContext";function fm(e){let t=h.useContext(sp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fm),n}return t}let ap=h.createContext(null);ap.displayName="RadioGroupActionsContext";function hm(e){let t=h.useContext(ap);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,hm),n}return t}function BO(e,t){return $e(t.type,FO,e,t)}let zO="div";function UO(e,t){let n=Et(),{id:r=`headlessui-radiogroup-${n}`,value:o,defaultValue:s,form:a,name:i,onChange:l,by:u=($,H)=>$===H,disabled:d=!1,...p}=e,f=oe(typeof u=="string"?($,H)=>{let V=u;return($==null?void 0:$[V])===(H==null?void 0:H[V])}:u),[g,m]=h.useReducer(BO,{options:[]}),v=g.options,[b,w]=op(),[y,S]=Wd(),C=h.useRef(null),x=Ye(C,t),[E,T]=Jl(o,l,s),_=h.useMemo(()=>v.find($=>!$.propsRef.current.disabled),[v]),O=h.useMemo(()=>v.some($=>f($.propsRef.current.value,E)),[v,E]),P=oe($=>{var H;if(d||f($,E))return!1;let V=(H=v.find(U=>f(U.propsRef.current.value,$)))==null?void 0:H.propsRef.current;return V!=null&&V.disabled?!1:(T==null||T($),!0)});q1({container:C.current,accept($){return $.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:$.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk($){$.setAttribute("role","none")}});let A=oe($=>{let H=C.current;if(!H)return;let V=No(H),U=v.filter(J=>J.propsRef.current.disabled===!1).map(J=>J.element.current);switch($.key){case ve.Enter:J1($.currentTarget);break;case ve.ArrowLeft:case ve.ArrowUp:if($.preventDefault(),$.stopPropagation(),ln(U,_t.Previous|_t.WrapAround)===kr.Success){let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break;case ve.ArrowRight:case ve.ArrowDown:if($.preventDefault(),$.stopPropagation(),ln(U,_t.Next|_t.WrapAround)===kr.Success){let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break;case ve.Space:{$.preventDefault(),$.stopPropagation();let J=v.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));J&&P(J.propsRef.current.value)}break}}),M=oe($=>(m({type:0,...$}),()=>m({type:1,id:$.id}))),k=h.useMemo(()=>({value:E,firstOption:_,containsCheckedOption:O,disabled:d,compare:f,...g}),[E,_,O,d,f,g]),j=h.useMemo(()=>({registerOption:M,change:P}),[M,P]),L={ref:x,id:r,role:"radiogroup","aria-labelledby":b,"aria-describedby":y,onKeyDown:A},D=h.useMemo(()=>({value:E}),[E]),W=h.useRef(null),F=mr();return h.useEffect(()=>{W.current&&s!==void 0&&F.addEventListener(W.current,"reset",()=>{P(s)})},[W,P]),h.createElement(S,{name:"RadioGroup.Description"},h.createElement(w,{name:"RadioGroup.Label"},h.createElement(ap.Provider,{value:j},h.createElement(sp.Provider,{value:k},i!=null&&E!=null&&oc({[i]:E}).map(([$,H],V)=>h.createElement(br,{features:vr.Hidden,ref:V===0?U=>{var J;W.current=(J=U==null?void 0:U.closest("form"))!=null?J:null}:void 0,...ca({key:$,as:"input",type:"radio",checked:H!=null,hidden:!0,readOnly:!0,form:a,disabled:d,name:$,value:H})})),Be({ourProps:L,theirProps:p,slot:D,defaultTag:zO,name:"RadioGroup"})))))}var WO=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(WO||{});let GO="div";function qO(e,t){var n;let r=Et(),{id:o=`headlessui-radiogroup-option-${r}`,value:s,disabled:a=!1,...i}=e,l=h.useRef(null),u=Ye(l,t),[d,p]=op(),[f,g]=Wd(),{addFlag:m,removeFlag:v,hasFlag:b}=pm(1),w=jt({value:s,disabled:a}),y=fm("RadioGroup.Option"),S=hm("RadioGroup.Option");Ze(()=>S.registerOption({id:o,element:l,propsRef:w}),[o,S,l,w]);let C=oe(M=>{var k;if($o(M.currentTarget))return M.preventDefault();S.change(s)&&(m(2),(k=l.current)==null||k.focus())}),x=oe(M=>{if($o(M.currentTarget))return M.preventDefault();m(2)}),E=oe(()=>v(2)),T=((n=y.firstOption)==null?void 0:n.id)===o,_=y.disabled||a,O=y.compare(y.value,s),P={ref:u,id:o,role:"radio","aria-checked":O?"true":"false","aria-labelledby":d,"aria-describedby":f,"aria-disabled":_?!0:void 0,tabIndex:_?-1:O||!y.containsCheckedOption&&T?0:-1,onClick:_?void 0:C,onFocus:_?void 0:x,onBlur:_?void 0:E},A=h.useMemo(()=>({checked:O,disabled:_,active:b(2)}),[O,_,b]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(p,{name:"RadioGroup.Label"},Be({ourProps:P,theirProps:i,slot:A,defaultTag:GO,name:"RadioGroup.Option"})))}let KO=ze(UO),ZO=ze(qO),gm=Object.assign(KO,{Option:ZO,Label:dm,Description:rm}),ip=h.createContext(null);ip.displayName="GroupContext";let YO=h.Fragment;function XO(e){var t;let[n,r]=h.useState(null),[o,s]=op(),[a,i]=Wd(),l=h.useMemo(()=>({switch:n,setSwitch:r,labelledby:o,describedby:a}),[n,r,o,a]),u={},d=e;return h.createElement(i,{name:"Switch.Description"},h.createElement(s,{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(ip.Provider,{value:l},Be({ourProps:u,theirProps:d,defaultTag:YO,name:"Switch.Group"}))))}let JO="button";function QO(e,t){var n;let r=Et(),{id:o=`headlessui-switch-${r}`,checked:s,defaultChecked:a=!1,onChange:i,disabled:l=!1,name:u,value:d,form:p,...f}=e,g=h.useContext(ip),m=h.useRef(null),v=Ye(m,t,g===null?null:g.setSwitch),[b,w]=Jl(s,i,a),y=oe(()=>w==null?void 0:w(!b)),S=oe(O=>{if($o(O.currentTarget))return O.preventDefault();O.preventDefault(),y()}),C=oe(O=>{O.key===ve.Space?(O.preventDefault(),y()):O.key===ve.Enter&&J1(O.currentTarget)}),x=oe(O=>O.preventDefault()),E=h.useMemo(()=>({checked:b}),[b]),T={id:o,ref:v,role:"switch",type:la(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:S,onKeyUp:C,onKeyPress:x},_=mr();return h.useEffect(()=>{var O;let P=(O=m.current)==null?void 0:O.closest("form");P&&a!==void 0&&_.addEventListener(P,"reset",()=>{w(a)})},[m,w]),h.createElement(h.Fragment,null,u!=null&&b&&h.createElement(br,{features:vr.Hidden,...ca({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:p,checked:b,name:u,value:d})}),Be({ourProps:T,theirProps:f,slot:E,defaultTag:JO,name:"Switch"}))}let RO=ze(QO),e_=XO,lp=Object.assign(RO,{Group:e_,Label:dm,Description:rm});function t_({onFocus:e}){let[t,n]=h.useState(!0),r=sc();return t?h.createElement(br,{as:"button",type:"button",features:vr.Focusable,onFocus:o=>{o.preventDefault();let s,a=50;function i(){if(a--<=0){s&&cancelAnimationFrame(s);return}if(e()){if(cancelAnimationFrame(s),!r.current)return;n(!1);return}s=requestAnimationFrame(i)}s=requestAnimationFrame(i)}}):null}const mm=nt.createContext(null);function n_(){return{groups:new Map,get(e,t){var n;let r=this.groups.get(e);r||(r=new Map,this.groups.set(e,r));let o=(n=r.get(t))!=null?n:0;r.set(t,o+1);let s=Array.from(r.keys()).indexOf(t);function a(){let i=r.get(t);i>1?r.set(t,i-1):r.delete(t)}return[s,a]}}}function r_({children:e}){let t=nt.useRef(n_());return nt.createElement(mm.Provider,{value:t},e)}function vm(e){let t=nt.useContext(mm);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=o_(),[r,o]=t.current.get(e,n);return nt.useEffect(()=>o,[]),r}function o_(){var e,t,n;let r=(n=(t=(e=nt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!r)return Symbol();let o=[],s=r;for(;s;)o.push(s.index),s=s.return;return"$."+o.join(".")}var s_=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(s_||{}),a_=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(a_||{}),i_=(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))(i_||{});let l_={0(e,t){var n;let r=po(e.tabs,d=>d.current),o=po(e.panels,d=>d.current),s=r.filter(d=>{var p;return!((p=d.current)!=null&&p.hasAttribute("disabled"))}),a={...e,tabs:r,panels:o};if(t.index<0||t.index>r.length-1){let d=$e(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>$e(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(s.length===0)return a;let p=$e(d,{0:()=>r.indexOf(s[0]),1:()=>r.indexOf(s[s.length-1])});return{...a,selectedIndex:p===-1?e.selectedIndex:p}}let i=r.slice(0,t.index),l=[...r.slice(t.index),...i].find(d=>s.includes(d));if(!l)return a;let u=(n=r.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...a,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],r=po([...e.tabs,t.tab],s=>s.current),o=e.selectedIndex;return e.info.current.isControlled||(o=r.indexOf(n),o===-1&&(o=e.selectedIndex)),{...e,tabs:r,selectedIndex:o}},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:po([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},cp=h.createContext(null);cp.displayName="TabsDataContext";function da(e){let t=h.useContext(cp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,da),n}return t}let up=h.createContext(null);up.displayName="TabsActionsContext";function dp(e){let t=h.useContext(up);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,dp),n}return t}function c_(e,t){return $e(t.type,l_,e,t)}let u_=h.Fragment;function d_(e,t){let{defaultIndex:n=0,vertical:r=!1,manual:o=!1,onChange:s,selectedIndex:a=null,...i}=e;const l=r?"vertical":"horizontal",u=o?"manual":"auto";let d=a!==null,p=jt({isControlled:d}),f=Ye(t),[g,m]=h.useReducer(c_,{info:p,selectedIndex:a??n,tabs:[],panels:[]}),v=h.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),b=jt(s||(()=>{})),w=jt(g.tabs),y=h.useMemo(()=>({orientation:l,activation:u,...g}),[l,u,g]),S=oe(O=>(m({type:1,tab:O}),()=>m({type:2,tab:O}))),C=oe(O=>(m({type:3,panel:O}),()=>m({type:4,panel:O}))),x=oe(O=>{E.current!==O&&b.current(O),d||m({type:0,index:O})}),E=jt(d?e.selectedIndex:g.selectedIndex),T=h.useMemo(()=>({registerTab:S,registerPanel:C,change:x}),[]);Ze(()=>{m({type:0,index:a??n})},[a]),Ze(()=>{if(E.current===void 0||g.tabs.length<=0)return;let O=po(g.tabs,P=>P.current);O.some((P,A)=>g.tabs[A]!==P)&&x(O.indexOf(g.tabs[E.current]))});let _={ref:f};return h.createElement(r_,null,h.createElement(up.Provider,{value:T},h.createElement(cp.Provider,{value:y},y.tabs.length<=0&&h.createElement(t_,{onFocus:()=>{var O,P;for(let A of w.current)if(((O=A.current)==null?void 0:O.tabIndex)===0)return(P=A.current)==null||P.focus(),!0;return!1}}),Be({ourProps:_,theirProps:i,slot:v,defaultTag:u_,name:"Tabs"}))))}let p_="div";function f_(e,t){let{orientation:n,selectedIndex:r}=da("Tab.List"),o=Ye(t);return Be({ourProps:{ref:o,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:r},defaultTag:p_,name:"Tabs.List"})}let h_="button";function g_(e,t){var n,r;let o=Et(),{id:s=`headlessui-tabs-tab-${o}`,...a}=e,{orientation:i,activation:l,selectedIndex:u,tabs:d,panels:p}=da("Tab"),f=dp("Tab"),g=da("Tab"),m=h.useRef(null),v=Ye(m,t);Ze(()=>f.registerTab(m),[f,m]);let b=vm("tabs"),w=d.indexOf(m);w===-1&&(w=b);let y=w===u,S=oe(P=>{var A;let M=P();if(M===kr.Success&&l==="auto"){let k=(A=No(m))==null?void 0:A.activeElement,j=g.tabs.findIndex(L=>L.current===k);j!==-1&&f.change(j)}return M}),C=oe(P=>{let A=d.map(M=>M.current).filter(Boolean);if(P.key===ve.Space||P.key===ve.Enter){P.preventDefault(),P.stopPropagation(),f.change(w);return}switch(P.key){case ve.Home:case ve.PageUp:return P.preventDefault(),P.stopPropagation(),S(()=>ln(A,_t.First));case ve.End:case ve.PageDown:return P.preventDefault(),P.stopPropagation(),S(()=>ln(A,_t.Last))}if(S(()=>$e(i,{vertical(){return P.key===ve.ArrowUp?ln(A,_t.Previous|_t.WrapAround):P.key===ve.ArrowDown?ln(A,_t.Next|_t.WrapAround):kr.Error},horizontal(){return P.key===ve.ArrowLeft?ln(A,_t.Previous|_t.WrapAround):P.key===ve.ArrowRight?ln(A,_t.Next|_t.WrapAround):kr.Error}}))===kr.Success)return P.preventDefault()}),x=h.useRef(!1),E=oe(()=>{var P;x.current||(x.current=!0,(P=m.current)==null||P.focus({preventScroll:!0}),f.change(w),Md(()=>{x.current=!1}))}),T=oe(P=>{P.preventDefault()}),_=h.useMemo(()=>{var P;return{selected:y,disabled:(P=e.disabled)!=null?P:!1}},[y,e.disabled]),O={ref:v,onKeyDown:C,onMouseDown:T,onClick:E,id:s,role:"tab",type:la(e,m),"aria-controls":(r=(n=p[w])==null?void 0:n.current)==null?void 0:r.id,"aria-selected":y,tabIndex:y?0:-1};return Be({ourProps:O,theirProps:a,slot:_,defaultTag:h_,name:"Tabs.Tab"})}let m_="div";function v_(e,t){let{selectedIndex:n}=da("Tab.Panels"),r=Ye(t),o=h.useMemo(()=>({selectedIndex:n}),[n]);return Be({ourProps:{ref:r},theirProps:e,slot:o,defaultTag:m_,name:"Tabs.Panels"})}let b_="div",y_=yn.RenderStrategy|yn.Static;function w_(e,t){var n,r,o,s;let a=Et(),{id:i=`headlessui-tabs-panel-${a}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:p,panels:f}=da("Tab.Panel"),g=dp("Tab.Panel"),m=h.useRef(null),v=Ye(m,t);Ze(()=>g.registerPanel(m),[g,m,i]);let b=vm("panels"),w=f.indexOf(m);w===-1&&(w=b);let y=w===d,S=h.useMemo(()=>({selected:y}),[y]),C={ref:v,id:i,role:"tabpanel","aria-labelledby":(r=(n=p[w])==null?void 0:n.current)==null?void 0:r.id,tabIndex:y?l:-1};return!y&&((o=u.unmount)==null||o)&&!((s=u.static)!=null&&s)?h.createElement(br,{as:"span","aria-hidden":"true",...C}):Be({ourProps:C,theirProps:u,slot:S,defaultTag:b_,features:y_,visible:y,name:"Tabs.Panel"})}let S_=ze(g_),C_=ze(d_),x_=ze(f_),E_=ze(v_),T_=ze(w_),fi=Object.assign(S_,{Group:C_,List:x_,Panels:E_,Panel:T_});function P_(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function pp(e,...t){e&&t.length>0&&e.classList.add(...t)}function fp(e,...t){e&&t.length>0&&e.classList.remove(...t)}function O_(e,t){let n=Nr();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:o}=getComputedStyle(e),[s,a]=[r,o].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}),i=s+a;if(i!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},i),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 __(e,t,n,r){let o=n?"enter":"leave",s=Nr(),a=r!==void 0?P_(r):()=>{};o==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let i=$e(o,{enter:()=>t.enter,leave:()=>t.leave}),l=$e(o,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=$e(o,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return fp(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),pp(e,...t.base,...i,...u),s.nextFrame(()=>{fp(e,...t.base,...i,...u),pp(e,...t.base,...i,...l),O_(e,()=>(fp(e,...t.base,...i),pp(e,...t.base,...t.entered),a()))}),s.dispose}function A_({immediate:e,container:t,direction:n,classes:r,onStart:o,onStop:s}){let a=sc(),i=mr(),l=jt(n);Ze(()=>{e&&(l.current="enter")},[e]),Ze(()=>{let u=Nr();i.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&a.current)return u.dispose(),o.current(l.current),u.add(__(d,r.current,l.current==="enter",()=>{u.dispose(),s.current(l.current)})),u.dispose},[n])}function Io(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let lc=h.createContext(null);lc.displayName="TransitionContext";var L_=(e=>(e.Visible="visible",e.Hidden="hidden",e))(L_||{});function M_(){let e=h.useContext(lc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function N_(){let e=h.useContext(cc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let cc=h.createContext(null);cc.displayName="NestingContext";function uc(e){return"children"in e?uc(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function bm(e,t){let n=jt(e),r=h.useRef([]),o=sc(),s=mr(),a=oe((g,m=ko.Hidden)=>{let v=r.current.findIndex(({el:b})=>b===g);v!==-1&&($e(m,{[ko.Unmount](){r.current.splice(v,1)},[ko.Hidden](){r.current[v].state="hidden"}}),s.microTask(()=>{var b;!uc(r)&&o.current&&((b=n.current)==null||b.call(n))}))}),i=oe(g=>{let m=r.current.find(({el:v})=>v===g);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:g,state:"visible"}),()=>a(g,ko.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),p=oe((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(([w,y])=>y)).then(()=>b())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(m)):v(m)}),f=oe((g,m,v)=>{Promise.all(d.current[m].splice(0).map(([b,w])=>w)).then(()=>{var b;(b=l.current.shift())==null||b()}).then(()=>v(m))});return h.useMemo(()=>({children:r,register:i,unregister:a,onStart:p,onStop:f,wait:u,chains:d}),[i,a,r,p,f,d,u])}function k_(){}let $_=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function ym(e){var t;let n={};for(let r of $_)n[r]=(t=e[r])!=null?t:k_;return n}function I_(e){let t=h.useRef(ym(e));return h.useEffect(()=>{t.current=ym(e)},[e]),t}let V_="div",wm=yn.RenderStrategy;function H_(e,t){var n,r;let{beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i,enter:l,enterFrom:u,enterTo:d,entered:p,leave:f,leaveFrom:g,leaveTo:m,...v}=e,b=h.useRef(null),w=Ye(b,t),y=(n=v.unmount)==null||n?ko.Unmount:ko.Hidden,{show:S,appear:C,initial:x}=M_(),[E,T]=h.useState(S?"visible":"hidden"),_=N_(),{register:O,unregister:P}=_;h.useEffect(()=>O(b),[O,b]),h.useEffect(()=>{if(y===ko.Hidden&&b.current){if(S&&E!=="visible"){T("visible");return}return $e(E,{hidden:()=>P(b),visible:()=>O(b)})}},[E,b,O,P,S,y]);let A=jt({base:Io(v.className),enter:Io(l),enterFrom:Io(u),enterTo:Io(d),entered:Io(p),leave:Io(f),leaveFrom:Io(g),leaveTo:Io(m)}),M=I_({beforeEnter:o,afterEnter:s,beforeLeave:a,afterLeave:i}),k=Ql();h.useEffect(()=>{if(k&&E==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,E,k]);let j=x&&!C,L=C&&S&&x,D=!k||j?"idle":S?"enter":"leave",W=pm(0),F=oe(Y=>$e(Y,{enter:()=>{W.addFlag(pt.Opening),M.current.beforeEnter()},leave:()=>{W.addFlag(pt.Closing),M.current.beforeLeave()},idle:()=>{}})),$=oe(Y=>$e(Y,{enter:()=>{W.removeFlag(pt.Opening),M.current.afterEnter()},leave:()=>{W.removeFlag(pt.Closing),M.current.afterLeave()},idle:()=>{}})),H=bm(()=>{T("hidden"),P(b)},_),V=h.useRef(!1);A_({immediate:L,container:b,classes:A,direction:D,onStart:jt(Y=>{V.current=!0,H.onStart(b,Y,F)}),onStop:jt(Y=>{V.current=!1,H.onStop(b,Y,$),Y==="leave"&&!uc(H)&&(T("hidden"),P(b))})});let U=v,J={ref:w};return L?U={...U,className:nc(v.className,...A.current.enter,...A.current.enterFrom)}:V.current&&(U.className=nc(v.className,(r=b.current)==null?void 0:r.className),U.className===""&&delete U.className),h.createElement(cc.Provider,{value:H},h.createElement(li,{value:$e(E,{visible:pt.Open,hidden:pt.Closed})|W.flags},Be({ourProps:J,theirProps:U,defaultTag:V_,features:wm,visible:E==="visible",name:"Transition.Child"})))}function j_(e,t){let{show:n,appear:r=!1,unmount:o=!0,...s}=e,a=h.useRef(null),i=Ye(a,t);Ql();let l=Ts();if(n===void 0&&l!==null&&(n=(l&pt.Open)===pt.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=bm(()=>{d("hidden")}),[f,g]=h.useState(!0),m=h.useRef([n]);Ze(()=>{f!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),g(!1))},[m,n]);let v=h.useMemo(()=>({show:n,appear:r,initial:f}),[n,r,f]);h.useEffect(()=>{if(n)d("visible");else if(!uc(p))d("hidden");else{let S=a.current;if(!S)return;let C=S.getBoundingClientRect();C.x===0&&C.y===0&&C.width===0&&C.height===0&&d("hidden")}},[n,p]);let b={unmount:o},w=oe(()=>{var S;f&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),y=oe(()=>{var S;f&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return h.createElement(cc.Provider,{value:p},h.createElement(lc.Provider,{value:v},Be({ourProps:{...b,as:h.Fragment,children:h.createElement(Sm,{ref:i,...b,...s,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:wm,visible:u==="visible",name:"Transition"})))}function D_(e,t){let n=h.useContext(lc)!==null,r=Ts()!==null;return h.createElement(h.Fragment,null,!n&&r?h.createElement(hp,{ref:t,...e}):h.createElement(Sm,{ref:t,...e}))}let hp=ze(j_),Sm=ze(H_),F_=ze(D_),gp=Object.assign(hp,{Child:F_,Root:hp});var Cm=function(t){return t.reduce(function(n,r){var o=r[0],s=r[1];return n[o]=s,n},{})},xm=typeof window<"u"&&window.document&&window.document.createElement?nt.useLayoutEffect:nt.useEffect,wn="top",Zn="bottom",Yn="right",Sn="left",mp="auto",hi=[wn,Zn,Yn,Sn],pa="start",gi="end",B_="clippingParents",Em="viewport",mi="popper",z_="reference",Tm=hi.reduce(function(e,t){return e.concat([t+"-"+pa,t+"-"+gi])},[]),Pm=[].concat(hi,[mp]).reduce(function(e,t){return e.concat([t,t+"-"+pa,t+"-"+gi])},[]),U_="beforeRead",W_="read",G_="afterRead",q_="beforeMain",K_="main",Z_="afterMain",Y_="beforeWrite",X_="write",J_="afterWrite",Q_=[U_,W_,G_,q_,K_,Z_,Y_,X_,J_];function $r(e){return e?(e.nodeName||"").toLowerCase():null}function Mn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function _s(e){var t=Mn(e).Element;return e instanceof t||e instanceof Element}function Xn(e){var t=Mn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function vp(e){if(typeof ShadowRoot>"u")return!1;var t=Mn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function R_(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},o=t.attributes[n]||{},s=t.elements[n];!Xn(s)||!$r(s)||(Object.assign(s.style,r),Object.keys(o).forEach(function(a){var i=o[a];i===!1?s.removeAttribute(a):s.setAttribute(a,i===!0?"":i)}))})}function eA(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(r){var o=t.elements[r],s=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),i=a.reduce(function(l,u){return l[u]="",l},{});!Xn(o)||!$r(o)||(Object.assign(o.style,i),Object.keys(s).forEach(function(l){o.removeAttribute(l)}))})}}const tA={name:"applyStyles",enabled:!0,phase:"write",fn:R_,effect:eA,requires:["computeStyles"]};function Ir(e){return e.split("-")[0]}var As=Math.max,dc=Math.min,fa=Math.round;function bp(){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 Om(){return!/^((?!chrome|android).)*safari/i.test(bp())}function ha(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),o=1,s=1;t&&Xn(e)&&(o=e.offsetWidth>0&&fa(r.width)/e.offsetWidth||1,s=e.offsetHeight>0&&fa(r.height)/e.offsetHeight||1);var a=_s(e)?Mn(e):window,i=a.visualViewport,l=!Om()&&n,u=(r.left+(l&&i?i.offsetLeft:0))/o,d=(r.top+(l&&i?i.offsetTop:0))/s,p=r.width/o,f=r.height/s;return{width:p,height:f,top:d,right:u+p,bottom:d+f,left:u,x:u,y:d}}function yp(e){var t=ha(e),n=e.offsetWidth,r=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-r)<=1&&(r=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:r}}function _m(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&vp(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function ho(e){return Mn(e).getComputedStyle(e)}function nA(e){return["table","td","th"].indexOf($r(e))>=0}function Vo(e){return((_s(e)?e.ownerDocument:e.document)||window.document).documentElement}function pc(e){return $r(e)==="html"?e:e.assignedSlot||e.parentNode||(vp(e)?e.host:null)||Vo(e)}function Am(e){return!Xn(e)||ho(e).position==="fixed"?null:e.offsetParent}function rA(e){var t=/firefox/i.test(bp()),n=/Trident/i.test(bp());if(n&&Xn(e)){var r=ho(e);if(r.position==="fixed")return null}var o=pc(e);for(vp(o)&&(o=o.host);Xn(o)&&["html","body"].indexOf($r(o))<0;){var s=ho(o);if(s.transform!=="none"||s.perspective!=="none"||s.contain==="paint"||["transform","perspective"].indexOf(s.willChange)!==-1||t&&s.willChange==="filter"||t&&s.filter&&s.filter!=="none")return o;o=o.parentNode}return null}function vi(e){for(var t=Mn(e),n=Am(e);n&&nA(n)&&ho(n).position==="static";)n=Am(n);return n&&($r(n)==="html"||$r(n)==="body"&&ho(n).position==="static")?t:n||rA(e)||t}function wp(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function bi(e,t,n){return As(e,dc(t,n))}function oA(e,t,n){var r=bi(e,t,n);return r>n?n:r}function Lm(){return{top:0,right:0,bottom:0,left:0}}function Mm(e){return Object.assign({},Lm(),e)}function Nm(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var sA=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Mm(typeof t!="number"?t:Nm(t,hi))};function aA(e){var t,n=e.state,r=e.name,o=e.options,s=n.elements.arrow,a=n.modifiersData.popperOffsets,i=Ir(n.placement),l=wp(i),u=[Sn,Yn].indexOf(i)>=0,d=u?"height":"width";if(!(!s||!a)){var p=sA(o.padding,n),f=yp(s),g=l==="y"?wn:Sn,m=l==="y"?Zn:Yn,v=n.rects.reference[d]+n.rects.reference[l]-a[l]-n.rects.popper[d],b=a[l]-n.rects.reference[l],w=vi(s),y=w?l==="y"?w.clientHeight||0:w.clientWidth||0:0,S=v/2-b/2,C=p[g],x=y-f[d]-p[m],E=y/2-f[d]/2+S,T=bi(C,E,x),_=l;n.modifiersData[r]=(t={},t[_]=T,t.centerOffset=T-E,t)}}function iA(e){var t=e.state,n=e.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=t.elements.popper.querySelector(o),!o)||_m(t.elements.popper,o)&&(t.elements.arrow=o))}const lA={name:"arrow",enabled:!0,phase:"main",fn:aA,effect:iA,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function ga(e){return e.split("-")[1]}var cA={top:"auto",right:"auto",bottom:"auto",left:"auto"};function uA(e,t){var n=e.x,r=e.y,o=t.devicePixelRatio||1;return{x:fa(n*o)/o||0,y:fa(r*o)/o||0}}function km(e){var t,n=e.popper,r=e.popperRect,o=e.placement,s=e.variation,a=e.offsets,i=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,f=a.x,g=f===void 0?0:f,m=a.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 w=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),S=Sn,C=wn,x=window;if(u){var E=vi(n),T="clientHeight",_="clientWidth";if(E===Mn(n)&&(E=Vo(n),ho(E).position!=="static"&&i==="absolute"&&(T="scrollHeight",_="scrollWidth")),E=E,o===wn||(o===Sn||o===Yn)&&s===gi){C=Zn;var O=p&&E===x&&x.visualViewport?x.visualViewport.height:E[T];v-=O-r.height,v*=l?1:-1}if(o===Sn||(o===wn||o===Zn)&&s===gi){S=Yn;var P=p&&E===x&&x.visualViewport?x.visualViewport.width:E[_];g-=P-r.width,g*=l?1:-1}}var A=Object.assign({position:i},u&&cA),M=d===!0?uA({x:g,y:v},Mn(n)):{x:g,y:v};if(g=M.x,v=M.y,l){var k;return Object.assign({},A,(k={},k[C]=y?"0":"",k[S]=w?"0":"",k.transform=(x.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",k))}return Object.assign({},A,(t={},t[C]=y?v+"px":"",t[S]=w?g+"px":"",t.transform="",t))}function dA(e){var t=e.state,n=e.options,r=n.gpuAcceleration,o=r===void 0?!0:r,s=n.adaptive,a=s===void 0?!0:s,i=n.roundOffsets,l=i===void 0?!0:i,u={placement:Ir(t.placement),variation:ga(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:o,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,km(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,km(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 pA={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:dA,data:{}};var fc={passive:!0};function fA(e){var t=e.state,n=e.instance,r=e.options,o=r.scroll,s=o===void 0?!0:o,a=r.resize,i=a===void 0?!0:a,l=Mn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return s&&u.forEach(function(d){d.addEventListener("scroll",n.update,fc)}),i&&l.addEventListener("resize",n.update,fc),function(){s&&u.forEach(function(d){d.removeEventListener("scroll",n.update,fc)}),i&&l.removeEventListener("resize",n.update,fc)}}const hA={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:fA,data:{}};var gA={left:"right",right:"left",bottom:"top",top:"bottom"};function hc(e){return e.replace(/left|right|bottom|top/g,function(t){return gA[t]})}var mA={start:"end",end:"start"};function $m(e){return e.replace(/start|end/g,function(t){return mA[t]})}function Sp(e){var t=Mn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Cp(e){return ha(Vo(e)).left+Sp(e).scrollLeft}function vA(e,t){var n=Mn(e),r=Vo(e),o=n.visualViewport,s=r.clientWidth,a=r.clientHeight,i=0,l=0;if(o){s=o.width,a=o.height;var u=Om();(u||!u&&t==="fixed")&&(i=o.offsetLeft,l=o.offsetTop)}return{width:s,height:a,x:i+Cp(e),y:l}}function bA(e){var t,n=Vo(e),r=Sp(e),o=(t=e.ownerDocument)==null?void 0:t.body,s=As(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),a=As(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),i=-r.scrollLeft+Cp(e),l=-r.scrollTop;return ho(o||n).direction==="rtl"&&(i+=As(n.clientWidth,o?o.clientWidth:0)-s),{width:s,height:a,x:i,y:l}}function xp(e){var t=ho(e),n=t.overflow,r=t.overflowX,o=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function Im(e){return["html","body","#document"].indexOf($r(e))>=0?e.ownerDocument.body:Xn(e)&&xp(e)?e:Im(pc(e))}function yi(e,t){var n;t===void 0&&(t=[]);var r=Im(e),o=r===((n=e.ownerDocument)==null?void 0:n.body),s=Mn(r),a=o?[s].concat(s.visualViewport||[],xp(r)?r:[]):r,i=t.concat(a);return o?i:i.concat(yi(pc(a)))}function Ep(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function yA(e,t){var n=ha(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 Vm(e,t,n){return t===Em?Ep(vA(e,n)):_s(t)?yA(t,n):Ep(bA(Vo(e)))}function wA(e){var t=yi(pc(e)),n=["absolute","fixed"].indexOf(ho(e).position)>=0,r=n&&Xn(e)?vi(e):e;return _s(r)?t.filter(function(o){return _s(o)&&_m(o,r)&&$r(o)!=="body"}):[]}function SA(e,t,n,r){var o=t==="clippingParents"?wA(e):[].concat(t),s=[].concat(o,[n]),a=s[0],i=s.reduce(function(l,u){var d=Vm(e,u,r);return l.top=As(d.top,l.top),l.right=dc(d.right,l.right),l.bottom=dc(d.bottom,l.bottom),l.left=As(d.left,l.left),l},Vm(e,a,r));return i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}function Hm(e){var t=e.reference,n=e.element,r=e.placement,o=r?Ir(r):null,s=r?ga(r):null,a=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2,l;switch(o){case wn:l={x:a,y:t.y-n.height};break;case Zn:l={x:a,y:t.y+t.height};break;case Yn:l={x:t.x+t.width,y:i};break;case Sn:l={x:t.x-n.width,y:i};break;default:l={x:t.x,y:t.y}}var u=o?wp(o):null;if(u!=null){var d=u==="y"?"height":"width";switch(s){case pa:l[u]=l[u]-(t[d]/2-n[d]/2);break;case gi:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function wi(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=r===void 0?e.placement:r,s=n.strategy,a=s===void 0?e.strategy:s,i=n.boundary,l=i===void 0?B_:i,u=n.rootBoundary,d=u===void 0?Em:u,p=n.elementContext,f=p===void 0?mi:p,g=n.altBoundary,m=g===void 0?!1:g,v=n.padding,b=v===void 0?0:v,w=Mm(typeof b!="number"?b:Nm(b,hi)),y=f===mi?z_:mi,S=e.rects.popper,C=e.elements[m?y:f],x=SA(_s(C)?C:C.contextElement||Vo(e.elements.popper),l,d,a),E=ha(e.elements.reference),T=Hm({reference:E,element:S,strategy:"absolute",placement:o}),_=Ep(Object.assign({},S,T)),O=f===mi?_:E,P={top:x.top-O.top+w.top,bottom:O.bottom-x.bottom+w.bottom,left:x.left-O.left+w.left,right:O.right-x.right+w.right},A=e.modifiersData.offset;if(f===mi&&A){var M=A[o];Object.keys(P).forEach(function(k){var j=[Yn,Zn].indexOf(k)>=0?1:-1,L=[wn,Zn].indexOf(k)>=0?"y":"x";P[k]+=M[L]*j})}return P}function CA(e,t){t===void 0&&(t={});var n=t,r=n.placement,o=n.boundary,s=n.rootBoundary,a=n.padding,i=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?Pm:l,d=ga(r),p=d?i?Tm:Tm.filter(function(m){return ga(m)===d}):hi,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]=wi(e,{placement:v,boundary:o,rootBoundary:s,padding:a})[Ir(v)],m},{});return Object.keys(g).sort(function(m,v){return g[m]-g[v]})}function xA(e){if(Ir(e)===mp)return[];var t=hc(e);return[$m(e),t,$m(t)]}function EA(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!0:a,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,w=Ir(b),y=w===b,S=l||(y||!m?[hc(b)]:xA(b)),C=[b].concat(S).reduce(function(Y,X){return Y.concat(Ir(X)===mp?CA(t,{placement:X,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:v}):X)},[]),x=t.rects.reference,E=t.rects.popper,T=new Map,_=!0,O=C[0],P=0;P<C.length;P++){var A=C[P],M=Ir(A),k=ga(A)===pa,j=[wn,Zn].indexOf(M)>=0,L=j?"width":"height",D=wi(t,{placement:A,boundary:d,rootBoundary:p,altBoundary:f,padding:u}),W=j?k?Yn:Sn:k?Zn:wn;x[L]>E[L]&&(W=hc(W));var F=hc(W),$=[];if(s&&$.push(D[M]<=0),i&&$.push(D[W]<=0,D[F]<=0),$.every(function(Y){return Y})){O=A,_=!1;break}T.set(A,$)}if(_)for(var H=m?3:1,V=function(X){var Q=C.find(function(ee){var G=T.get(ee);if(G)return G.slice(0,X).every(function(R){return R})});if(Q)return O=Q,"break"},U=H;U>0;U--){var J=V(U);if(J==="break")break}t.placement!==O&&(t.modifiersData[r]._skip=!0,t.placement=O,t.reset=!0)}}const TA={name:"flip",enabled:!0,phase:"main",fn:EA,requiresIfExists:["offset"],data:{_skip:!1}};function jm(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 Dm(e){return[wn,Yn,Zn,Sn].some(function(t){return e[t]>=0})}function PA(e){var t=e.state,n=e.name,r=t.rects.reference,o=t.rects.popper,s=t.modifiersData.preventOverflow,a=wi(t,{elementContext:"reference"}),i=wi(t,{altBoundary:!0}),l=jm(a,r),u=jm(i,o,s),d=Dm(l),p=Dm(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 OA={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:PA};function _A(e,t,n){var r=Ir(e),o=[Sn,wn].indexOf(r)>=0?-1:1,s=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=s[0],i=s[1];return a=a||0,i=(i||0)*o,[Sn,Yn].indexOf(r)>=0?{x:i,y:a}:{x:a,y:i}}function AA(e){var t=e.state,n=e.options,r=e.name,o=n.offset,s=o===void 0?[0,0]:o,a=Pm.reduce(function(d,p){return d[p]=_A(p,t.rects,s),d},{}),i=a[t.placement],l=i.x,u=i.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}const LA={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:AA};function MA(e){var t=e.state,n=e.name;t.modifiersData[n]=Hm({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const NA={name:"popperOffsets",enabled:!0,phase:"read",fn:MA,data:{}};function kA(e){return e==="x"?"y":"x"}function $A(e){var t=e.state,n=e.options,r=e.name,o=n.mainAxis,s=o===void 0?!0:o,a=n.altAxis,i=a===void 0?!1:a,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=wi(t,{boundary:l,rootBoundary:u,padding:p,altBoundary:d}),w=Ir(t.placement),y=ga(t.placement),S=!y,C=wp(w),x=kA(C),E=t.modifiersData.popperOffsets,T=t.rects.reference,_=t.rects.popper,O=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,P=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(E){if(s){var k,j=C==="y"?wn:Sn,L=C==="y"?Zn:Yn,D=C==="y"?"height":"width",W=E[C],F=W+b[j],$=W-b[L],H=g?-_[D]/2:0,V=y===pa?T[D]:_[D],U=y===pa?-_[D]:-T[D],J=t.elements.arrow,Y=g&&J?yp(J):{width:0,height:0},X=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Lm(),Q=X[j],ee=X[L],G=bi(0,T[D],Y[D]),R=S?T[D]/2-H-G-Q-P.mainAxis:V-G-Q-P.mainAxis,le=S?-T[D]/2+H+G+ee+P.mainAxis:U+G+ee+P.mainAxis,ge=t.elements.arrow&&vi(t.elements.arrow),Te=ge?C==="y"?ge.clientTop||0:ge.clientLeft||0:0,Ce=(k=A==null?void 0:A[C])!=null?k:0,tt=W+R-Ce-Te,Qe=W+le-Ce,Ot=bi(g?dc(F,tt):F,W,g?As($,Qe):$);E[C]=Ot,M[C]=Ot-W}if(i){var ut,Se=C==="x"?wn:Sn,ot=C==="x"?Zn:Yn,st=E[x],wt=x==="y"?"height":"width",Ne=st+b[Se],mt=st-b[ot],dt=[wn,Sn].indexOf(w)!==-1,Ue=(ut=A==null?void 0:A[x])!=null?ut:0,tn=dt?Ne:st-T[wt]-_[wt]-Ue+P.altAxis,he=dt?st+T[wt]+_[wt]-Ue-P.altAxis:mt,De=g&&dt?oA(tn,st,he):bi(g?tn:Ne,st,g?he:mt);E[x]=De,M[x]=De-st}t.modifiersData[r]=M}}const IA={name:"preventOverflow",enabled:!0,phase:"main",fn:$A,requiresIfExists:["offset"]};function VA(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function HA(e){return e===Mn(e)||!Xn(e)?Sp(e):VA(e)}function jA(e){var t=e.getBoundingClientRect(),n=fa(t.width)/e.offsetWidth||1,r=fa(t.height)/e.offsetHeight||1;return n!==1||r!==1}function DA(e,t,n){n===void 0&&(n=!1);var r=Xn(t),o=Xn(t)&&jA(t),s=Vo(t),a=ha(e,o,n),i={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&(($r(t)!=="body"||xp(s))&&(i=HA(t)),Xn(t)?(l=ha(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):s&&(l.x=Cp(s))),{x:a.left+i.scrollLeft-l.x,y:a.top+i.scrollTop-l.y,width:a.width,height:a.height}}function FA(e){var t=new Map,n=new Set,r=[];e.forEach(function(s){t.set(s.name,s)});function o(s){n.add(s.name);var a=[].concat(s.requires||[],s.requiresIfExists||[]);a.forEach(function(i){if(!n.has(i)){var l=t.get(i);l&&o(l)}}),r.push(s)}return e.forEach(function(s){n.has(s.name)||o(s)}),r}function BA(e){var t=FA(e);return Q_.reduce(function(n,r){return n.concat(t.filter(function(o){return o.phase===r}))},[])}function zA(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function UA(e){var t=e.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Fm={placement:"bottom",modifiers:[],strategy:"absolute"};function Bm(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function WA(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,o=t.defaultOptions,s=o===void 0?Fm:o;return function(i,l,u){u===void 0&&(u=s);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Fm,s),modifiersData:{},elements:{reference:i,popper:l},attributes:{},styles:{}},p=[],f=!1,g={state:d,setOptions:function(w){var y=typeof w=="function"?w(d.options):w;v(),d.options=Object.assign({},s,d.options,y),d.scrollParents={reference:_s(i)?yi(i):i.contextElement?yi(i.contextElement):[],popper:yi(l)};var S=BA(UA([].concat(r,d.options.modifiers)));return d.orderedModifiers=S.filter(function(C){return C.enabled}),m(),g.update()},forceUpdate:function(){if(!f){var w=d.elements,y=w.reference,S=w.popper;if(Bm(y,S)){d.rects={reference:DA(y,vi(S),d.options.strategy==="fixed"),popper:yp(S)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(P){return d.modifiersData[P.name]=Object.assign({},P.data)});for(var C=0;C<d.orderedModifiers.length;C++){if(d.reset===!0){d.reset=!1,C=-1;continue}var x=d.orderedModifiers[C],E=x.fn,T=x.options,_=T===void 0?{}:T,O=x.name;typeof E=="function"&&(d=E({state:d,options:_,name:O,instance:g})||d)}}}},update:zA(function(){return new Promise(function(b){g.forceUpdate(),b(d)})}),destroy:function(){v(),f=!0}};if(!Bm(i,l))return g;g.setOptions(u).then(function(b){!f&&u.onFirstUpdate&&u.onFirstUpdate(b)});function m(){d.orderedModifiers.forEach(function(b){var w=b.name,y=b.options,S=y===void 0?{}:y,C=b.effect;if(typeof C=="function"){var x=C({state:d,name:w,instance:g,options:S}),E=function(){};p.push(x||E)}})}function v(){p.forEach(function(b){return b()}),p=[]}return g}}var GA=[hA,NA,pA,tA,LA,TA,IA,lA,OA],qA=WA({defaultModifiers:GA}),KA=typeof Element<"u",ZA=typeof Map=="function",YA=typeof Set=="function",XA=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function gc(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,r,o;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!gc(e[r],t[r]))return!1;return!0}var s;if(ZA&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;for(s=e.entries();!(r=s.next()).done;)if(!gc(r.value[1],t.get(r.value[0])))return!1;return!0}if(YA&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(s=e.entries();!(r=s.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(XA&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(e[r]!==t[r])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(o=Object.keys(e),n=o.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,o[r]))return!1;if(KA&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((o[r]==="_owner"||o[r]==="__v"||o[r]==="__o")&&e.$$typeof)&&!gc(e[o[r]],t[o[r]]))return!1;return!0}return e!==e&&t!==t}var JA=function(t,n){try{return gc(t,n)}catch(r){if((r.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw r}};const QA=Wu(JA);var RA=[],Si=function(t,n,r){r===void 0&&(r={});var o=nt.useRef(null),s={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||RA},a=nt.useState({styles:{popper:{position:s.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),i=a[0],l=a[1],u=nt.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,v=Object.keys(m.elements);kS.flushSync(function(){l({styles:Cm(v.map(function(b){return[b,m.styles[b]||{}]})),attributes:Cm(v.map(function(b){return[b,m.attributes[b]]}))})})},requires:["computeStyles"]}},[]),d=nt.useMemo(function(){var f={onFirstUpdate:s.onFirstUpdate,placement:s.placement,strategy:s.strategy,modifiers:[].concat(s.modifiers,[u,{name:"applyStyles",enabled:!1}])};return QA(o.current,f)?o.current||f:(o.current=f,f)},[s.onFirstUpdate,s.placement,s.strategy,s.modifiers,u]),p=nt.useRef();return xm(function(){p.current&&p.current.setOptions(d)},[d]),xm(function(){if(!(t==null||n==null)){var f=r.createPopper||qA,g=f(t,n,d);return p.current=g,function(){g.destroy(),p.current=null}}},[t,n,r.createPopper]),{state:p.current?p.current.state:null,styles:i.styles,attributes:i.attributes,update:p.current?p.current.update:null,forceUpdate:p.current?p.current.forceUpdate:null}};const Jn=qt(function({children:t,title:n,onClose:r,icon:o,skipOverflow:s,shadow:a=!0,padding:i=!0,border:l=!0,round:u=!0,className:d,classNameBody:p,size:f="m",titleClass:g=Z("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:v,...b},w){const y=to(o)?o:{};return c.jsxs("div",{...b,ref:w,style:m,className:Z(["gs-utl-card",d,v||Ed.bg,te.b,u&&te.rnd,l?z.br:te.bT,!s&&"gs-utl-overflow-auto",a&&"gs-utl-shadow-md",i&&f==="l"&&"gs-utl-p-5",i&&f==="m"&&"gs-utl-px-4 gs-utl-py-2",i&&f==="s"&&"gs-utl-px-2 gs-utl-py-1",i&&f==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",i&&f==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&c.jsxs(I,{className:Z("gs-utl-card-title",g),items:"center",children:[c.jsx(B,{className:Z("truncate"),grow:!0,children:n}),(r||o)&&c.jsx(B,{onClick:r,className:Z("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(re,{icon:(ct(o)?o:"")||q.close,size:"18px",...y})})]}),c.jsx("div",{className:Z("gs-utl-card-body",p),children:t})]})});var mc,e3=new Uint8Array(16);function t3(){if(!mc&&(mc=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!mc))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return mc(e3)}const n3=/^(?:[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 r3(e){return typeof e=="string"&&n3.test(e)}for(var Zt=[],Tp=0;Tp<256;++Tp)Zt.push((Tp+256).toString(16).substr(1));function o3(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Zt[e[t+0]]+Zt[e[t+1]]+Zt[e[t+2]]+Zt[e[t+3]]+"-"+Zt[e[t+4]]+Zt[e[t+5]]+"-"+Zt[e[t+6]]+Zt[e[t+7]]+"-"+Zt[e[t+8]]+Zt[e[t+9]]+"-"+Zt[e[t+10]]+Zt[e[t+11]]+Zt[e[t+12]]+Zt[e[t+13]]+Zt[e[t+14]]+Zt[e[t+15]]).toLowerCase();if(!r3(n))throw TypeError("Stringified UUID is invalid");return n}function zm(e,t,n){e=e||{};var r=e.random||(e.rng||t3)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,o3(r)}class s3 extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Ci=async(e,{onError:t,onLoading:n,onResult:r,params:o,rawText:s,...a})=>{try{n==null||n(!0);const i=o?new URLSearchParams(o).toString():"",l=i?`?${i}`:"",u=await fetch(`${e}${l}`,a);if(!u.ok){const p=await u.json();throw new s3(p.error||"Request failed!",p.errorData)}let d;if(s)d=await u.text();else try{d=await u.json()}catch{d=void 0}return r==null||r(d),d}catch(i){const l=i instanceof Error?i:new Error(i);if(t==null||t(l),a.throwError)throw l;return l}finally{n==null||n(!1)}};class Vr{static async get(t,n){return Ci(t,{...n,method:"GET"})}static async post(t,n){return Ci(t,{...n,method:"POST"})}static async put(t,n){return Ci(t,{...n,method:"PUT"})}static async patch(t,n){return Ci(t,{...n,method:"PATCH"})}static async delete(t,n){return Ci(t,{...n,method:"DELETE"})}}var vc=(e=>(e.Projects="projects",e.Settings="settings",e))(vc||{}),Um=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(Um||{});const Wm={},a3=1,i3=(e={})=>new Promise((t,n)=>{const r=(e==null?void 0:e.db)||"gjs",o=r==="gjs-studio"?a3:1,s=Wm[r];if(s)t(s);else{if(!Or())return n(new Error("window context not found"));const a=window.indexedDB.open(r,o);a.onerror=n,a.onsuccess=()=>{const i=a.result;i.onerror=n,Wm[r]=i,t(i)},a.onupgradeneeded=()=>{const i=a.result;i.objectStoreNames.contains("projects")||i.createObjectStore("projects"),i.objectStoreNames.contains("settings")||i.createObjectStore("settings")}}}),Pp=async(e,t)=>(await i3(t)).transaction([e],"readwrite").objectStore(e),l3=async(e,t)=>{const n=await Pp(e,t);return new Promise((r,o)=>{const s=[],a=n.openCursor();a.onerror=o,a.onsuccess=function(i){const u=i.target.result;if(u){const d=u.primaryKey,p=u.value;s.push({key:d,data:p}),u.continue()}else r(s)}})},c3=async(e,t,n)=>{const r=await Pp(e,n);return new Promise((o,s)=>{const a=r.get(t);a.onerror=s,a.onsuccess=()=>o(a.result)})},u3=async(e,t,n)=>{const r=await Pp(e,n);return new Promise((o,s)=>{const a=r.delete(t);a.onerror=s,a.onsuccess=()=>o()})};var xi=(e=>(e.Existing="existing",e.Templates="templates",e))(xi||{});const d3=e=>{const t=J3();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},p3=(e,t)=>Vr.get(d3(e),{...t}),f3=async e=>{try{const t=await p3(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},Gm=async(e=xt.web)=>typeof window>"u"?[]:(await l3(vc.Projects)).map(({key:r,data:o})=>{var s;return{id:`${r}`,name:`${((s=o.custom)==null?void 0:s.projectName)||r}`,data:o}}).filter(r=>{var o;return((o=r.data.custom)==null?void 0:o.projectType)===e}),qm=new Set,Nn=new WeakMap,ma=new WeakMap,Ls=new WeakMap,Op=new WeakMap,h3=new WeakMap,va=new WeakMap,bc=new WeakMap;let Ho;const Ms="__aa_tgt",_p="__aa_del",g3=e=>{const t=w3(e);t&&t.forEach(n=>S3(n))},m3=e=>{e.forEach(t=>{t.target===Ho&&b3(),Nn.has(t.target)&&Ns(t.target)})};function v3(e){const t=Op.get(e);t==null||t.disconnect();let n=Nn.get(e),r=0;const o=5;n||(n=ya(e),Nn.set(e,n));const{offsetWidth:s,offsetHeight:a}=Ho,l=[n.top-o,s-(n.left+o+n.width),a-(n.top+o+n.height),n.left-o].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++r>1&&Ns(e)},{root:Ho,threshold:1,rootMargin:l});u.observe(e),Op.set(e,u)}function Ns(e){clearTimeout(bc.get(e));const t=yc(e),n=typeof t=="function"?500:t.duration;bc.set(e,setTimeout(()=>{const r=Ls.get(e);(!r||r.finished)&&(Nn.set(e,ya(e)),v3(e))},n))}function b3(){clearTimeout(bc.get(Ho)),bc.set(Ho,setTimeout(()=>{qm.forEach(e=>Ym(e,t=>Km(()=>Ns(t))))},100))}function y3(e){setTimeout(()=>{h3.set(e,setInterval(()=>Km(Ns.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function Km(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Ap,ba;typeof window<"u"&&(Ho=document.documentElement,Ap=new MutationObserver(g3),ba=new ResizeObserver(m3),ba.observe(Ho));function w3(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Lp(n.target),!t.has(n.target)){t.add(n.target);for(let r=0;r<n.target.children.length;r++){const o=n.target.children.item(r);if(o){if(_p in o)return!1;Lp(n.target,o),t.add(o)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const o=n.removedNodes[r];if(_p in o)return!1;o instanceof Element&&(t.add(o),Lp(n.target,o),ma.set(o,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Lp(e,t){!t&&!(Ms in e)?Object.defineProperty(e,Ms,{value:e}):t&&!(Ms in t)&&Object.defineProperty(t,Ms,{value:e})}function S3(e){var t;const n=Ho.contains(e),r=Nn.has(e);n&&ma.has(e)&&ma.delete(e),Ls.has(e)&&((t=Ls.get(e))===null||t===void 0||t.cancel()),r&&n?C3(e):r&&!n?E3(e):x3(e)}function Hr(e){return Number(e.replace(/[^0-9.\-]/g,""))}function ya(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function Zm(e,t,n){let r=t.width,o=t.height,s=n.width,a=n.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const u=Hr(i.paddingTop)+Hr(i.paddingBottom)+Hr(i.borderTopWidth)+Hr(i.borderBottomWidth),d=Hr(i.paddingLeft)+Hr(i.paddingRight)+Hr(i.borderRightWidth)+Hr(i.borderLeftWidth);r-=d,s-=d,o-=u,a-=u}return[r,s,o,a].map(Math.round)}function yc(e){return Ms in e&&va.has(e[Ms])?va.get(e[Ms]):{duration:250,easing:"ease-in-out"}}function Ym(e,...t){t.forEach(n=>n(e,va.has(e)));for(let n=0;n<e.children.length;n++){const r=e.children.item(n);r&&t.forEach(o=>o(r,va.has(r)))}}function C3(e){const t=Nn.get(e),n=ya(e);let r;if(!t)return;const o=yc(e);if(typeof o!="function"){const s=t.left-n.left,a=t.top-n.top,[i,l,u,d]=Zm(e,t,n),p={transform:`translate(${s}px, ${a}px)`},f={transform:"translate(0, 0)"};i!==l&&(p.width=`${i}px`,f.width=`${l}px`),u!==d&&(p.height=`${u}px`,f.height=`${d}px`),r=e.animate([p,f],o)}else r=new Animation(o(e,"remain",t,n)),r.play();Ls.set(e,r),Nn.set(e,n),r.addEventListener("finish",Ns.bind(null,e))}function x3(e){const t=ya(e);Nn.set(e,t);const n=yc(e);let r;typeof n!="function"?r=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"}):(r=new Animation(n(e,"add",t)),r.play()),Ls.set(e,r),r.addEventListener("finish",Ns.bind(null,e))}function E3(e){if(!ma.has(e)||!Nn.has(e))return;const[t,n]=ma.get(e);Object.defineProperty(e,_p,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[r,o,s,a]=T3(e),i=yc(e),l=Nn.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${r}px`,left:`${o}px`,width:`${s}px`,height:`${a}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof i!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:i.duration,easing:"ease-out"}):(u=new Animation(i(e,"remove",l)),u.play()),Ls.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),Nn.delete(e),ma.delete(e),Ls.delete(e),(d=Op.get(e))===null||d===void 0||d.disconnect()})}function T3(e){const t=Nn.get(e),[n,,r]=Zm(e,t,ya(e));let o=e.parentElement;for(;o&&(getComputedStyle(o).position==="static"||o instanceof HTMLBodyElement);)o=o.parentElement;o||(o=document.body);const s=getComputedStyle(o),a=Nn.get(o)||ya(o),i=Math.round(t.top-a.top)-Hr(s.borderTopWidth),l=Math.round(t.left-a.left)-Hr(s.borderLeftWidth);return[i,l,n,r]}function P3(e,t={}){Ap&&ba&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),Ym(e,Ns,y3,n=>ba==null?void 0:ba.observe(n)),typeof t=="function"?va.set(e,t):va.set(e,{duration:250,easing:"ease-in-out",...t}),Ap.observe(e,{childList:!0}),qm.add(e))}function O3(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&P3(t.current,e)},[t]),t}const _3={[sn.Info]:z.bgA,[sn.Error]:"bg-red-500",[sn.Success]:"bg-green-500",[sn.Warning]:"bg-orange-400"},A3=qt(function(t,n){const r={[sn.Info]:q.informationVariant,[sn.Error]:q.fire,[sn.Success]:q.checkBold,[sn.Warning]:q.alertRhombus},{children:o,className:s,content:a,id:i,buttons:l=[],variant:u=sn.Info,autoHideTimeout:d=3e3}=t,p=h.useRef(null),f=h.useRef(),g=r[u],m=_3[u];h.useImperativeHandle(n,()=>p.current,[]);const v=()=>{var S;return(S=t.onDismiss)==null?void 0:S.call(t,i)},b=()=>{d&&(f.current=setTimeout(v,d))},w=()=>f.current&&clearTimeout(f.current);h.useEffect(()=>(b(),w),[]);const y=a||o;return c.jsx(Jn,{className:ae(s,"overflow-hidden relative"),ref:p,onPointerEnter:w,onPointerLeave:b,children:c.jsxs(I,{space:"m",items:"center",className:ae(Pe.y),children:[c.jsx(B,{className:ae(m,te.pill,"text-white gjs-p-1"),children:c.jsx(re,{icon:g,size:se.s})}),c.jsx(B,{grow:!0,className:ae("gjs-pr-3"),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(B,{className:ae("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(B,{className:ae(z.txtLowEmphasis),children:y}),!!l.length&&c.jsx(I,{space:"m",justify:"end",children:l.map(({id:S,...C})=>c.jsx(Ke,{...C},S))})]})}),c.jsx(B,{className:ae("absolute top-1 right-1"),children:c.jsx(Ct,{onClick:v,border:!1,children:c.jsx(re,{icon:q.close,size:se.s})})})]})})});ce(qt(function({className:t,toasts:n,onDismiss:r,...o},s){const a=O3({});return c.jsx("div",{className:ae(t,"w-80 gs-utl-z-30"),...o,ref:a,children:n.map(i=>c.jsx(A3,{...i,className:ae("gjs-mb-2"),onDismiss:r},i.uuid||i.id))})}));var Mp=(e=>(e.self="self",e.cloud="cloud",e))(Mp||{}),ks=(e=>(e.image="image",e.video="video",e))(ks||{}),yr=(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))(yr||{}),Np=(e=>(e.canvas="canvas",e.layers="layers",e))(Np||{}),jo=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(jo||{}),Ft=(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))(Ft||{}),kp=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(kp||{});const Ei=e=>e.replaceAll('"',"").replaceAll("'",""),$s=e=>e.includes(",")?e:/\s/.test(e)?`'${Ei(e)}'`:Ei(e),Xm=(e,t,n)=>({family:e,variant:t,...n}),Ti=(e,t)=>{e=$s(e);const{menuVariant:n,variants:r}=t;return{family:e,familyLabel:Ei(e),menuVariant:n&&Xm($s(`menuFont-${Ei(e)}`),"regular",n),variants:Object.assign({},...Object.entries(r).map(([o,s])=>({[o]:Xm(e,o,s)})))}},$p=(e,t)=>{var i;const n=Ti(e.family,e),r=n.menuVariant??((i=Object.values(n.variants))==null?void 0:i[0]);if(!r)return"Arial, Helvetica, sans-serif";const{source:o,descriptors:s}=r,a=Ei(r.family);if(!t){const l=new FontFace(a,`url("${o}")`,s),u=Array.from(document.fonts.values()).filter(d=>d.family===a);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return $s(a)},jr=", sans-serif",Jm=["Arial, Helvetica"+jr,"Arial Black, Gadget"+jr,"Brush Script MT"+jr,"Comic Sans MS, cursive"+jr,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+jr,"Impact, Charcoal"+jr,"Lucida Sans Unicode, Lucida Grande"+jr,"Tahoma, Geneva"+jr,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+jr,"Verdana, Geneva"+jr].map(e=>({id:e,label:e.split(",")[0]})),L3=String.raw,go=(e,t)=>{if(!t)return"";const n=e[0],r=e[1];return`${n}${t}${r}`},M3=({family:e,source:t,descriptors:n})=>{const{display:r,ascentOverride:o,descentOverride:s,featureSettings:a,lineGapOverride:i,stretch:l,style:u,unicodeRange:d,weight:p}=n??{},f=[go`font-ascent-override: ${o};`,go`font-display: ${r};`,go`font-descent-override: ${s};`,go`font-feature-settings: ${a};`,go`font-line-gap-override: ${i};`,go`font-stretch: ${l};`,go`font-style: ${u};`,go`font-unicode-range: ${d};`,go`font-weight: ${p};`].filter(Boolean);return L3`
25
25
  @font-face {
26
26
  font-family: ${e};
27
27
  src: url('${t}');
28
- ${p.join(`
28
+ ${f.join(`
29
29
  `)}
30
30
  }
31
- `},Qm=(e={})=>{const t=Object.entries(e).map(([r,o])=>Ei(r,o));let n="";for(const r of t)for(const o of Object.values(r.variants))n+=O3(o)+`
32
- `;return n.trim()},Rm="data-project-fonts",ev="true",_3=`${Rm}="${ev}"`,tv=(e={})=>{const t=Qm(e);return t?`<style ${_3}>
31
+ `},Qm=(e={})=>{const t=Object.entries(e).map(([r,o])=>Ti(r,o));let n="";for(const r of t)for(const o of Object.values(r.variants))n+=M3(o)+`
32
+ `;return n.trim()},Rm="data-project-fonts",ev="true",N3=`${Rm}="${ev}"`,tv=(e={})=>{const t=Qm(e);return t?`<style ${N3}>
33
33
  ${t}
34
- </style>`:""},A3=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),L3=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),nv=e=>!!e.id,ya=e=>t=>(t.tagName||"").toLowerCase()===e,Hr=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),M3=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},wa=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},jo=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},Ti=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},Pi=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},N3=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),If=(e,t,n="html")=>{const{Pages:r}=e,o=ln({page:t,key:"slug"})??"";return`${r.getMain()===t?"index":Sl(o||t.getName())}.${n}`},$3=(e,t)=>{const{toolbar:n}=e;n.some(o=>o.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},yc="custom-html-body",wc="data-custom-html-body",rv="data-global-custom-html-head",ov="data-global-custom-html-body",sv="global",k3=function(e,t){const n=o=>{if(!o)return e.em.logError("loadGlobalHead: document not found");const s=Hf(t.appStore);let a=o.querySelector(`[${rv}]`);a||(a=o.createElement("div"),a.setAttribute(rv,"true"),o.head.insertBefore(a,o.head.firstChild));const i=tv(s.fonts),l=s.customCodeHead,u=[i,l].filter(d=>!!d).join(`
35
- `);a.innerHTML=u,Qh(a)},r=o=>{if(!o)return e.em.logError("loadGlobalBody: document not found");const s=Hf(t.appStore);let a=o.querySelector(`[${ov}]`);if(!a){a=o.createElement("div"),a.setAttribute(ov,"true");const i=o.querySelector('[data-gjs-type="wrapper"]');i==null||i.appendChild(a)}a.innerHTML=s.customCodeBody||"",Qh(a)};e.on(e.Canvas.events.frameLoad,o=>{var s;return n((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(e.Canvas.events.frameLoadBody,o=>{var s;return r((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(Pn.pageSettingsUpdate,o=>{var a,i;if(o.page)return;const s=(i=(a=e.Canvas.getFrames()[0])==null?void 0:a.view)==null?void 0:i.getDoc();n(s),r(s)}),e.Components.addType(yc,{isComponent:o=>Ti(o,wc),model:{defaults:{attributes:{[wc]:!0},locked:!0,layerable:!1},toHTML:()=>""}}),e.on(e.events.projectLoad,()=>{const{appStore:o}=t,{globalPageSettings:s}=o.projectDataCustom;let a=(s==null?void 0:s.customCodeHead)||"",i=(s==null?void 0:s.customCodeBody)||"";e.Pages.getAll().forEach(l=>{const u=l.getMainComponent(),d=u.head.components(),f=[];d.forEach(m=>{m.has(sv)&&f.push(m)}),f.forEach(m=>{const v=m.toHTML();a.includes(v)||(a+=v),m.remove()});const p=[];u.findType(yc).forEach(m=>{m.has(sv)&&p.push(m)}),p.forEach(m=>{const v=m.getInnerHTML();i.includes(v)||(i+=v),m.remove()})}),(a||i)&&o.setProjectDataCustom({globalPageSettings:{...s,customCodeHead:a,customCodeBody:i}})})},Oi="page://",Sc="href-params__",I3=`data-gjs-${Sc}`,Cc=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},xc=e=>!!Cc(e),av=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},V3=e=>!!(e!=null&&e.Components.getType("mjml")),iv=e=>xc(e)?q.database:Vf(e)?q.home:"",lv=e=>!!e.getSymbolOverride()?c.jsx(ne,{icon:q.rhombusOutline,size:se.s3x}):c.jsx(y1,{className:N("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),cv=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},Vf=e=>{var t;return e&&e===((t=e.em.Pages)==null?void 0:t.getMain())},pt={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"}},uv=e=>{for(const t in pt){const n=t;if(pt[n]({cmp:e}))return n}},dv=(e,t,n)=>{const r=[];let o=n;return e.getMainComponent().findType(yc).forEach(s=>{r.push(s),o=(o||"")+s.getInnerHTML()}),{components:r,html:o,changed:o!==t}},H3=(e,t)=>{const n={...t},r=e.getMainComponent(),{head:o}=r;if(o){const a=[],i=o.components();i.forEach(u=>{pt.title({cmp:u})?(u.components(t.title),delete n.title):pt.favicon({cmp:u})?(u.addAttributes({href:t.favicon}),delete n.favicon):pt.description({cmp:u})?(u.addAttributes({content:t.description}),delete n.description):pt.keywords({cmp:u})?(u.addAttributes({content:t.keywords}),delete n.keywords):pt.socialTitle({cmp:u})?(u.addAttributes({content:t.socialTitle}),delete n.socialTitle):pt.socialDescription({cmp:u})?(u.addAttributes({content:t.socialDescription}),delete n.socialDescription):pt.socialImage({cmp:u})?(u.addAttributes({content:t.socialImage}),delete n.socialImage):uv(u)||a.push(u)});const l=e.em.Parser.parseHtml(`<!DOCTYPE html><html><head>${t.customCodeHead}</head></html>`);l.head&&(i.remove(a),l.head.components&&i.add(l.head.components),delete n.customCodeHead)}const s=dv(e,n.customCodeBody);if(s.changed){const[a,...i]=s.components;(a||r.append({type:yc})[0]).components(n.customCodeBody),i.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},j3=(e,t={})=>{var s;const n={...e.get("settings")??{}},r=e.getMainComponent(),{head:o}=r;if(o){const a=[];o.components().forEach(i=>{const{content:l,href:u}=i.getAttributes({noClass:!0,noStyle:!0});pt.title({cmp:i})?n.title=i.getInnerHTML():pt.favicon({cmp:i})?n.favicon=u:pt.description({cmp:i})?n.description=l:pt.keywords({cmp:i})?n.keywords=l:pt.socialTitle({cmp:i})?n.socialTitle=l:pt.socialDescription({cmp:i})?n.socialDescription=l:pt.socialImage({cmp:i})?n.socialImage=l:uv(i)||a.push(i.toHTML())}),a.length&&(n.customCodeHead=a.join(`
36
- `))}if(n.customCodeBody=dv(e,n.customCodeBody).html,t.replaceDataSources&&Cc(e)){const{currentItem:a}=((s=r.getCollectionsState)==null?void 0:s.call(r))||{};a&&Object.keys(n).forEach(i=>{const l=i,u=n[l];ct(u)&&(n[l]=fv(u,a))})}return n},fv=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,r)=>{const o=t[r.trim()];return o!==void 0?String(o):""}),pv=(e,t={})=>{const{currentItem:n}=t,r=t.ext??"html",o=ln({page:e,key:"slug"})??"",s=n?fv(o,n):o,a=s.lastIndexOf("/"),i=a>=0,l=i?s.substring(a+1):s,u=i?s.substring(0,a):void 0,d=`${Sl(l)}${r?`.${r}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},D3=(e,t)=>e.get(`${Sc}${t}`)||"",F3=(e,t,n)=>{e.set({[`${Sc}${t}`]:n})},B3=(e,t)=>{Object.entries(t).forEach(([n,r])=>{e[`${I3}${n}`]=r})},z3=(e,t)=>{e.getModel().set("customData",{...Sa(e),...t})},Sa=e=>e.getModel().get("customData")??{},Hf=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},ln=e=>{const{page:t,key:n,appEditorStore:r,def:o,defPage:s,opts:a}=e;return t?j3(t,a)[n]??s:Hf(r)[n]??o},Do=(e,t,n)=>{const r=e.em.getEditor(),s=Sa(r).globalPageSettings||{};return ln({page:e,key:t,opts:n})||s[t]},hv=(e,t)=>{const n=(e==null?void 0:e.getName())??"",r={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:ln({...r,key:"slug",defPage:Sl(n)}),title:ln({...r,key:"title",defPage:n}),description:ln({...r,key:"description"}),favicon:ln({...r,key:"favicon"}),keywords:ln({...r,key:"keywords"}),socialTitle:ln({...r,key:"socialTitle",defPage:n}),socialImage:ln({...r,key:"socialImage"}),socialDescription:ln({...r,key:"socialDescription"}),customCodeHead:ln({...r,key:"customCodeHead"}),customCodeBody:ln({...r,key:"customCodeBody"})}},Ec=({icon:e,layout:t,tooltip:n,className:r,forceRemove:o,removeLayouts:s})=>({type:"button",icon:e,tooltip:n,className:r,size:"s",editorEvents:{[`${Pn.layoutToggleId}${t.id}`]:({fromEvent:a,setState:i})=>{i({active:a.isOpen})}},onClick:({editor:a})=>{s==null||s.forEach(i=>a.runCommand(re.layoutRemove,{id:i,force:o})),a.runCommand(re.layoutToggle,{...t})}}),gv={type:"static",layoutId:"leftPanelsContainer"},mv={width:240,overflow:"hidden"};Ec({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:mv,placer:gv}}),Ec({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:mv,placer:gv}}),Ec({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Ec({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 U3={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var W3={NODE_ENV:"production"};class G3{constructor(t,n){var s,a;this.projectType=xt.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=W3.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(i=>{const l=i,u=n[l];u!==void 0&&(this[l]=u)});const r=Tr()?window.location.search:"";this.queryParams=XS(r),sn(this,{sdkProps:!1},{autoBind:!0});const o=(a=(s=this.sdkProps.options)==null?void 0:s.customTheme)==null?void 0:a.icons;o&&fT(o)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return Bu({isDev:t,isStage:n})}get projectId(){var r,o;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((o=(r=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:r.custom)==null?void 0:o.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:r}=this,{customConfig:o}=r.layoutStore,s=(o==null?void 0:o.responsive)||(t==null?void 0:t.responsive);let a=(o==null?void 0:o.default)||(t==null?void 0:t.default)||U3;if(n&&s){const l=Object.keys(s).map(Number).sort((u,d)=>u-d).find(u=>n<=u);a=l?s[l]:a}return a}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===xt.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,r=this.sdkIdentityId;if(!n||!r)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)===$f.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===$f.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 f,p;const{store:t,sdkOptions:n}=this,{lastProjectId:r,lastProjectType:o}=t.localSettingsStore,s=(f=n.project)==null?void 0:f.default,{project:a}=n.storage||{};let i,l;o&&(this.store.templatesStore._projectTypeFilter=o),r&&(i=(p=(yield Gm(o)).find(m=>m.id===r))==null?void 0:p.data),i?l=i:a?l=a:s&&(l=s);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:r,data:o,isTemplate:s}=t,a=n.Storage.getConfig().options.local,i=s?`${r}__${JS()}`:r;this._projectId=i,a.key=i,YS(o)||this.loadProjectData({...o,custom:{...o.custom,id:i,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||xt.web,this.editor&&z3(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(q3(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const r=this.editor;r.loadProjectData(t),r.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:r,studioSdkVersion:o}=this;t==null||t.trigger(Jh,{baseApiUrl:r});const s=yield kr.post(`${r}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:o}});if(s instanceof Error)throw s;const a=s.result||{},{license:i,error:l,plan:u}=a;l?this.sdkLicenseError=l:(this.sdkLicense=i,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Fu,a)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Fu,{}))}}*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 q3=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||xt.web},we=()=>En().appEditorStore,vv=()=>Dh().appEditorStore,K3=()=>{try{return Dh().appEditorStore}catch{}},jf=()=>{const[e,t]=h.useState(0),n=En().appEditorStore,{transitionTime:r}=n;return h.useEffect(()=>{setTimeout(()=>t(o=>++o),r)},[r]),[e]},Df=()=>{const{baseApiUrl:e}=vv();return`${e}/assets/sdk`},Z3=e=>`${Df()}/${e}`,Y3=async(e,t,n)=>{const r=await kr.get(Df(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((r==null?void 0:r.result)??[]).map(({asset:o,cdnUrl:s})=>({...o,size:parseInt(o.size),src:s}))},X3=async(e,t,n,r)=>{const o=await kr.post(Df(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},J3=async(e,t)=>await kr.put(t,{body:e,rawText:!0}),Q3=async(e,t,n,r)=>Promise.all(e.map(o=>X3({name:o.name,size:o.size,type:o.type},t,n,r).then(async s=>{if(!s)throw new Error("No asset");const{asset:a,cdnUrl:i,uploadUrl:l}=s,u=await J3(o,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...a,size:parseInt(a.size),src:i,type:Ns.image}}))),R3=async(e,t,n,r)=>{const o=await kr.delete(Z3(e),{body:JSON.stringify({projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},bv=async(e,t,n,r)=>Promise.all(e.map(o=>R3(o.id||o.src,t,n,r)));function Fo(e,t,n){let r,o,s,a,i;const l=t===void 0?100:t;function u(){const f=Date.now()-a;f<l&&f>=0?r=setTimeout(u,l-f):(r=null,i=e.apply(s,o),s=o=null)}const d=function(){return s=this,o=arguments,a=Date.now(),r||(r=setTimeout(u,l)),i};return d.clear=function(){r&&(clearTimeout(r),r=null)},d.flush=function(){r&&(i=e.apply(s,o),s=o=null,clearTimeout(r),r=null)},d}class yv{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,sn(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Fo(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(r=>r.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(Ns.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 i,l,u,d;const{assetsStore:n}=this,{editor:r}=n;if(!r||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const o=((i=this.customPages)==null?void 0:i.length)??0,s=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,a=await this.provider.onLoad({editor:r,assetTypeFilter:this.typeFilter,pageIndex:o,searchValue:this.searchValue,pageCustomData:s})??[];if(Array.isArray(a)){const f=a.map(n.toAssetProps);this.setCustomAssetProps(f)}else{const f={...a,items:a.items.map(n.toAssetProps)};this.setCustomPages([...this.customPages??[],f])}this.setItemLayout((d=this.provider)==null?void 0:d.itemLayout)}async loadAssets(t=!0){const{assetsStore:n}=this,{toastStore:r}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(o){console.error(o),r.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:r}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&r&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:r}=this,{appEditorStore:o}=n.store,{editor:s}=o;if(!(!s||!r))try{n.setIsLoadingAssets(!0),await r({assets:[n.toAsset(t)],assetProps:[t],editor:s,loadAssets:a=>this.reloadAssets(a)})}catch(a){console.error(a),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:a==null?void 0:a.message})}finally{n.setIsLoadingAssets(!1)}}}const wv=e=>En().assetsStore.assetPanelStores[e];class e4{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${zm()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new yv(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),sn(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Mf.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Mf.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,o=n.options.licenseKey,s=t.sdkProjectId,a=t.sdkIdentityId,i=({files:l})=>Q3(l,o,s,a);return this.isUsingAssetCloud?i:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:r}=this;return n?t?async o=>{await t(o),this.deleteFromProjectAssets(o)}:void 0:r?async o=>{var l,u;const{sdkOptions:s}=this.store.appEditorStore,a=(l=s.project)==null?void 0:l.id,i=(u=s.identity)==null?void 0:u.id;await bv(o.assetProps,s.licenseKey,a,i),this.deleteFromProjectAssets(o)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var i,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,r=(i=n.project)==null?void 0:i.id,o=(l=n.identity)==null?void 0:l.id,s=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:Ns.image,onLoad:()=>Y3(s,r,o),onDelete:async u=>{const{assetProps:d,loadAssets:f}=u;await bv(d,s,r,o),this.deleteFromProjectAssets(u),await f({clearExisting:!1})}}}onEditor(){const t=Fo(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const r=n.Assets.events.all;n.on(r,t),this.loadProjectAssets()}addSdkProviders(){var r;const t=((r=this.sdkAssetConfig)==null?void 0:r.providers)??[],n=et(t)?t({providers:To(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const r=[...this.allProviders];let o=this.allProviders.findIndex(a=>a.id===t.id);const s=o!==-1;r.splice(n,0,t),s&&(o>=n&&(o+=1),r.splice(o,1)),this.setAllProviders(r)}hasType(t){return!!this.allProviders.find(n=>ct(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new yv(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:r,customOnLoad:o}=this,{toastStore:s}=this.store;let a;if(t){try{if(this.setIsLoadingAssets(!0),n&&o)if(r)a=r;else{const i=await o({editor:t});this.cachedOnLoadAssetProps=i.map(this.toAssetProps),a=this.cachedOnLoadAssetProps}else a=t.Assets.getAll().map(this.toAssetProps)}catch(i){console.error(i),s.addError("assets-error-load",{header:this.t("errorLoad"),content:i==null?void 0:i.message})}finally{this.setIsLoadingAssets(!1)}a&&this.setProjectAssetProps(a)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:r}){const{cachedOnLoadAssetProps:o,customOnLoad:s}=this;if(s){if(o){const a=r.map(i=>i.id);this.cachedOnLoadAssetProps=o.filter(({id:i})=>!a.includes(i)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(a=>n.Assets.remove(a)),av(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:r,customOnLoad:o}=this;o?r&&(this.cachedOnLoadAssetProps=[...t,...r],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),av(n))}async handleUpload(t){var s,a;const{editor:n,onCloudOrCustomUpload:r}=this,{toastStore:o}=this.store;if(!(!n||!r))try{this.setIsLoadingAssets(!0);const i=((s=t.dataTransfer)==null?void 0:s.files)||((a=t.target)==null?void 0:a.files)||[],l=Array.from(i),u=await r({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(i){console.error(i),o.addError("assets-error-upload",{header:this.t("errorUpload"),content:i==null?void 0:i.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 r=t;return{...r.attributes,id:r.attributes.id||r.getSrc(),src:r.getSrc(),name:r.attributes.name??r.getFilename(),type:r.attributes.type??r.getType()??Ns.image,asset:r}}return{...t,type:t.type||Ns.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 _i=()=>En().assetsStore;class t4{constructor(t){var r;this.store=t,this.fonts={},sn(this,{},{autoBind:!0});const n=(r=this.sdkFontOptions)==null?void 0:r.default;this.sdkDefaultFonts=et(n)?n({baseDefault:Jm}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>ct(t)?{id:t,label:t}:nv(t)?t:null).filter(t=>!!t):Jm}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!ct(n)&&!nv(n)).map(n=>Ei(n.family,n)):[]}get sortedFonts(){return A3(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return L3([...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 Ht(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Ht(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=Sa(t)??{},{fonts:r}=n??{};if(r)for(const[o,s]of Object.entries(r)){const a=Ei(o,s);this.addFont(a,{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=$s(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:r=!0}={}){const o=Ei(t.family,t),{editor:s}=this.store.appEditorStore;if(!s)return;const{family:a}=o;!r&&this.fonts[a]||(this.fonts[a]=o,n||this.updateProjectFonts(s))}removeFont(t){t=$s(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const r={...Sa(t).globalPageSettings,fonts:To(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:r}),cv(t),t.trigger(Pn.pageSettingsUpdate,{data:r})}}const Ai=()=>En().fontsStore;class n4{constructor(t){this.store=t,sn(this,{},{autoBind:!0})}t(t,n={}){var o;const{editor:r}=this.store.appEditorStore;return((o=r==null?void 0:r.I18n)==null?void 0:o.t(t,n))||""}tScoped(t){return(n,r)=>this.t(`${t}.${n}`,r)}}const Ie=()=>En().i18nStore,Xn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),Sv="gs-custom-layout",r4=h.forwardRef(function({className:t,component:n,noWrapper:r,id:o,render:s,componentProps:a,...i},l){const{editor:u}=we(),d=h.useRef(null),f=n,p=f&&u?c.jsx(f,{...a,editor:u}):null,g=N(Sv,o&&`${Sv}__${o}`,t),m=r&&!s;return h.useImperativeHandle(l,()=>d.current,[]),h.useEffect(()=>{const v=d.current;if(!s||!v)return;const b=S=>v.appendChild(S),w=S=>v.removeChild(S),y=s({editor:u,addEl:b,removeEl:w});if(ct(y))v.innerHTML=y;else{if(y instanceof HTMLElement)return b(y),()=>{w(y)};if(et(y))return()=>{y()}}},[s,u,d.current]),m?p:c.jsx("div",{className:g,ref:d,...i,children:p})}),Ff=ce(r4);class o4{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,sn(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}add(t,n){var r;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(r=this.editor)==null||r.trigger(`${Pn.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var o;const r=n==null?void 0:n.layout;r&&this.layouts.forEach(s=>{s.id===t&&Object.assign(s,r)}),this.layouts=n!=null&&n.force?this.layouts.filter(s=>s.id!==t):this.layouts.map(s=>s.id===t?{...s,toRemove:!0}:s),(o=this.editor)==null||o.trigger(`${Pn.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 r;const{children:t}=this.store.appEditorStore.sdkProps,n=((r=Xn(t,Ff))==null?void 0:r.filter(Boolean))||[];return new Map(n.map(({props:o})=>[o.id,o]))}}const Cv=()=>En().layoutStore,s4=()=>Dh().layoutStore;class a4{constructor(t){this.isActive=!1,this.content="",this.store=t,sn(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class i4{constructor(t){this.store=t,this._projectSourceFilter=Ci.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,sn(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===Ci.Existing?this.projects:this.templates}async loadProjects(){const t=await Gm(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var o;const t=(o=this.store.appEditorStore.sdkOptions.templates)==null?void 0:o.onLoad,n=async()=>await c3(this.projectTypeFilter);let r;if(t){const s=this.store.appEditorStore.editor;r=await t({editor:s,fetchCommunityTemplates:n})}else r=await n();this.setTemplates(r)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){a3(mc.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 xv=()=>En().templatesStore;class l4{constructor(t){this.toasts=[],this.store=t,sn(this,{},{autoBind:!0})}add(t,n){this.toasts.find(r=>r.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:on.Error})}addWarning(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:on.Warning})}addSuccess(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:on.Success})}addInfo(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:on.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class c4{constructor(t){this.isOpen=!1,this.store=t,sn(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(Pn.toggleBlocksPanel,{isOpen:this.isOpen})}}const u4=()=>En().blockManagerStore,Ev=":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",d4=Ev+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",f4="["+Ev+"]["+d4+"]*",p4=new RegExp("^"+f4+"$");function Tv(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const s=r.length;for(let a=0;a<s;a++)o.push(r[a]);n.push(o),r=t.exec(e)}return n}const Tc=function(e){const t=p4.exec(e);return!(t===null||typeof t>"u")};function h4(e){return typeof e<"u"}const g4={allowBooleanAttributes:!1,unpairedTags:[]};function m4(e,t){t=Object.assign({},g4,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let s=0;s<e.length;s++)if(e[s]==="<"&&e[s+1]==="?"){if(s+=2,s=Ov(e,s),s.err)return s}else if(e[s]==="<"){let a=s;if(s++,e[s]==="!"){s=_v(e,s);continue}else{let i=!1;e[s]==="/"&&(i=!0,s++);let l="";for(;s<e.length&&e[s]!==">"&&e[s]!==" "&&e[s]!==" "&&e[s]!==`
37
- `&&e[s]!=="\r";s++)l+=e[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!E4(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",Nt("InvalidTag",f,cn(e,s))}const u=y4(e,s);if(u===!1)return Nt("InvalidAttr","Attributes for '"+l+"' have open quote.",cn(e,s));let d=u.value;if(s=u.index,d[d.length-1]==="/"){const f=s-d.length;d=d.substring(0,d.length-1);const p=Av(d,t);if(p===!0)r=!0;else return Nt(p.err.code,p.err.msg,cn(e,f+p.err.line))}else if(i)if(u.tagClosed){if(d.trim().length>0)return Nt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",cn(e,a));if(n.length===0)return Nt("InvalidTag","Closing tag '"+l+"' has not been opened.",cn(e,a));{const f=n.pop();if(l!==f.tagName){let p=cn(e,f.tagStartPos);return Nt("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+l+"'.",cn(e,a))}n.length==0&&(o=!0)}}else return Nt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",cn(e,s));else{const f=Av(d,t);if(f!==!0)return Nt(f.err.code,f.err.msg,cn(e,s-d.length+f.err.line));if(o===!0)return Nt("InvalidXml","Multiple possible root nodes found.",cn(e,s));t.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:a}),r=!0}for(s++;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="!"){s++,s=_v(e,s);continue}else if(e[s+1]==="?"){if(s=Ov(e,++s),s.err)return s}else break;else if(e[s]==="&"){const f=C4(e,s);if(f==-1)return Nt("InvalidChar","char '&' is not expected.",cn(e,s));s=f}else if(o===!0&&!Pv(e[s]))return Nt("InvalidXml","Extra text at the end",cn(e,s));e[s]==="<"&&s--}}else{if(Pv(e[s]))continue;return Nt("InvalidChar","char '"+e[s]+"' is not expected.",cn(e,s))}if(r){if(n.length==1)return Nt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",cn(e,n[0].tagStartPos));if(n.length>0)return Nt("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Nt("InvalidXml","Start tag expected.",1);return!0}function Pv(e){return e===" "||e===" "||e===`
38
- `||e==="\r"}function Ov(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return Nt("InvalidXml","XML declaration allowed only at the start of the document.",cn(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function _v(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 v4='"',b4="'";function y4(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===v4||e[t]===b4)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const w4=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Av(e,t){const n=Tv(e,w4),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Nt("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",Li(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Nt("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",Li(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Nt("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",Li(n[o]));const s=n[o][2];if(!x4(s))return Nt("InvalidAttr","Attribute '"+s+"' is an invalid name.",Li(n[o]));if(!r.hasOwnProperty(s))r[s]=1;else return Nt("InvalidAttr","Attribute '"+s+"' is repeated.",Li(n[o]))}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 C4(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 x4(e){return Tc(e)}function E4(e){return Tc(e)}function cn(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Li(e){return e.startIndex+e[1].length}const T4={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},P4=function(e){return Object.assign({},T4,e)};let Pc;typeof Symbol!="function"?Pc="@@xmlMetadata":Pc=Symbol("XML Node Metadata");class ks{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][Pc]={startIndex:n})}static getMetaDataSymbol(){return Pc}}class O4{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const r={};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 o=1,s=!1,a=!1,i="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(s&&Is(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(r[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(s&&Is(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(s&&Is(t,"!ATTLIST",n))n+=8;else if(s&&Is(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(Is(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");o++,i=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,o--):o--,o===0)break}else t[n]==="["?s=!0:i+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(Mi(r),n=Sn(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 o="";return[n,o]=this.readIdentifierVal(t,n,"entity"),n--,[r,o,n]}readNotationExp(t,n){n=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&Mi(r),n=Sn(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=Sn(t,n);let s=null,a=null;if(o==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=Sn(t,n),(t[n]==='"'||t[n]==="'")&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:a,index:--n}}readIdentifierVal(t,n,r){let o="";const s=t[n];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(n++;n<t.length&&t[n]!==s;)o+=t[n],n++;if(t[n]!==s)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Tc(r))throw new Error(`Invalid element name: "${r}"`);n=Sn(t,n);let o="";if(t[n]==="E"&&Is(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Is(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=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:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=Sn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;Mi(r),n=Sn(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!Mi(o))throw new Error(`Invalid attribute name: "${o}"`);n=Sn(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=Sn(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let i=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!Mi(l))throw new Error(`Invalid notation name: "${l}"`);i.push(l),t[n]==="|"&&(n++,n=Sn(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+i.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=Sn(t,n);let a="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:s,defaultValue:a,index:n}}}const Sn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Is(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Mi(e){if(Tc(e))return e;throw new Error(`Invalid entity name ${e}`)}const _4=/^[-+]?0x[a-fA-F0-9]+$/,A4=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,L4={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function M4(e,t={}){if(t=Object.assign({},L4,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&&_4.test(n))return I4(n,16);if(n.search(/.+[eE].+/)!==-1)return $4(e,n,t);{const r=A4.exec(n);if(r){const o=r[1]||"",s=r[2];let a=k4(r[3]);const i=o?e[s.length+1]===".":e[s.length]===".";if(!t.leadingZeros&&(s.length>1||s.length===1&&!i))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===a||u===`${o}${a}`?l:e;let d=s?a:n;return s?d===u||o+d===u?l:e:d===u||d===o+u?l:e}}else return e}}const N4=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function $4(e,t,n){if(!n.eNotation)return e;const r=t.match(N4);if(r){let o=r[1]||"";const s=r[3].indexOf("e")===-1?"E":"e",a=r[2],i=o?e[a.length+1]===s:e[a.length]===s;return a.length>1&&i?e:a.length===1&&(r[3].startsWith(`.${s}`)||r[3][0]===s)?Number(t):n.leadingZeros&&!i?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function k4(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 I4(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 Lv(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 V4{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,r)=>String.fromCodePoint(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,16))}},this.addExternalEntities=H4,this.parseXml=z4,this.parseTextData=j4,this.resolveNameSpace=D4,this.buildAttributesMap=B4,this.isItStopNode=q4,this.replaceEntitiesValue=W4,this.readStopNodeData=Z4,this.saveTextToParentTag=G4,this.addChild=U4,this.ignoreAttributesFn=Lv(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 r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function H4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function j4(e,t,n,r,o,s,a){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return i==null?e:typeof i!=typeof e||i!==e?i:this.options.trimValues?zf(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?zf(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function D4(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 F4=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function B4(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Tv(e,F4),o=r.length,s={};for(let a=0;a<o;a++){const i=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(i,t))continue;let l=r[a][4],u=this.options.attributeNamePrefix+i;if(i.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(i,l,t);d==null?s[u]=l:typeof d!=typeof l||d!==l?s[u]=d:s[u]=zf(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const z4=function(e){e=e.replace(/\r\n?/g,`
39
- `);const t=new ks("!xml");let n=t,r="",o="";const s=new O4(this.options.processEntities);for(let a=0;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const l=Vs(e,">",a,"Closing Tag is not closed.");let u=e.substring(a+2,l).trim();if(this.options.removeNSPrefix){const p=u.indexOf(":");p!==-1&&(u=u.substr(p+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&(r=this.saveTextToParentTag(r,n,o));const d=o.substring(o.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let f=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(f=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=o.lastIndexOf("."),o=o.substring(0,f),n=this.tagsNodeStack.pop(),r="",a=l}else if(e[a+1]==="?"){let l=Bf(e,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new ks(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,o,l.tagName)),this.addChild(n,u,o,a)}a=l.closeIndex+1}else if(e.substr(a+1,3)==="!--"){const l=Vs(e,"-->",a+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(a+4,l-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}a=l}else if(e.substr(a+1,2)==="!D"){const l=s.readDocType(e,a);this.docTypeEntities=l.entities,a=l.i}else if(e.substr(a+1,2)==="!["){const l=Vs(e,"]]>",a,"CDATA is not closed.")-2,u=e.substring(a+9,l);r=this.saveTextToParentTag(r,n,o);let d=this.parseTextData(u,n.tagname,o,!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),a=l+2}else{let l=Bf(e,a,this.options.removeNSPrefix),u=l.tagName;const d=l.rawTagName;let f=l.tagExp,p=l.attrExpPresent,g=l.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),n&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==t.tagname&&(o+=o?"."+u:u);const v=a;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,u)){let b="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),f=u):f=f.substr(0,f.length-1),a=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)a=l.closeIndex;else{const y=this.readStopNodeData(e,d,g+1);if(!y)throw new Error(`Unexpected end of ${d}`);a=y.i,b=y.tagContent}const w=new ks(u);u!==f&&p&&(w[":@"]=this.buildAttributesMap(f,o,u)),b&&(b=this.parseTextData(b,u,o,!0,p,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),w.add(this.options.textNodeName,b),this.addChild(n,w,o,v)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),f=u):f=f.substr(0,f.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const b=new ks(u);u!==f&&p&&(b[":@"]=this.buildAttributesMap(f,o,u)),this.addChild(n,b,o,v),o=o.substr(0,o.lastIndexOf("."))}else{const b=new ks(u);this.tagsNodeStack.push(n),u!==f&&p&&(b[":@"]=this.buildAttributesMap(f,o,u)),this.addChild(n,b,o,v),n=b}r="",a=g}}else r+=e[a];return t.child};function U4(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const W4=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 G4(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function q4(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function K4(e,t,n=">"){let r,o="";for(let s=t;s<e.length;s++){let a=e[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(e[s+1]===n[1])return{data:o,index:s}}else return{data:o,index:s};else a===" "&&(a=" ");o+=a}}function Vs(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Bf(e,t,n,r=">"){const o=K4(e,t+1,r);if(!o)return;let s=o.data;const a=o.index,i=s.search(/\s/);let l=s,u=!0;i!==-1&&(l=s.substring(0,i),s=s.substring(i+1).trimStart());const d=l;if(n){const f=l.indexOf(":");f!==-1&&(l=l.substr(f+1),u=l!==o.data.substr(f+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:d}}function Z4(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const s=Vs(e,">",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i:s};n=s}else if(e[n+1]==="?")n=Vs(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Vs(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Vs(e,"]]>",n,"StopNode is not closed.")-2;else{const s=Bf(e,n,">");s&&((s&&s.tagName)===t&&s.tagExp[s.tagExp.length-1]!=="/"&&o++,n=s.closeIndex)}}function zf(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:M4(e,n)}else return h4(e)?e:""}const Uf=ks.getMetaDataSymbol();function Y4(e,t){return Mv(e,t)}function Mv(e,t,n){let r;const o={};for(let s=0;s<e.length;s++){const a=e[s],i=X4(a);let l="";if(n===void 0?l=i:l=n+"."+i,i===t.textNodeName)r===void 0?r=a[i]:r+=""+a[i];else{if(i===void 0)continue;if(a[i]){let u=Mv(a[i],t,l);const d=Q4(u,t);a[Uf]!==void 0&&(u[Uf]=a[Uf]),a[":@"]?J4(u,a[":@"],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=""),o[i]!==void 0&&o.hasOwnProperty(i)?(Array.isArray(o[i])||(o[i]=[o[i]]),o[i].push(u)):t.isArray(i,l,d)?o[i]=[u]:o[i]=u}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function X4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function J4(e,t,n,r){if(t){const o=Object.keys(t),s=o.length;for(let a=0;a<s;a++){const i=o[a];r.isArray(i,n+"."+i,!0,!0)?e[i]=[t[i]]:e[i]=t[i]}}}function Q4(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class R4{constructor(t){this.externalEntities={},this.options=P4(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 s=m4(t,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new V4(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:Y4(o,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 ks.getMetaDataSymbol()}}const eL=`
40
- `;function tL(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=eL),Nv(e,t,"",n)}function Nv(e,t,n,r){let o="",s=!1;for(let a=0;a<e.length;a++){const i=e[a],l=nL(i);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=i[l];rL(u,t)||(m=t.tagValueProcessor(l,m),m=kv(m,t)),s&&(o+=r),o+=m,s=!1;continue}else if(l===t.cdataPropName){s&&(o+=r),o+=`<![CDATA[${i[l][0][t.textNodeName]}]]>`,s=!1;continue}else if(l===t.commentPropName){o+=r+`<!--${i[l][0][t.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const m=$v(i[":@"],t),v=l==="?xml"?"":r;let b=i[l][0][t.textNodeName];b=b.length!==0?" "+b:"",o+=v+`<${l}${b}${m}?>`,s=!0;continue}let d=r;d!==""&&(d+=t.indentBy);const f=$v(i[":@"],t),p=r+`<${l}${f}`,g=Nv(i[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?o+=p+">":o+=p+"/>":(!g||g.length===0)&&t.suppressEmptyNode?o+=p+"/>":g&&g.endsWith(">")?o+=p+`>${g}${r}</${l}>`:(o+=p+">",g&&r!==""&&(g.includes("/>")||g.includes("</"))?o+=r+t.indentBy+g+r:o+=g,o+=`</${l}>`),s=!0}return o}function nL(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function $v(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=kv(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function rL(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function kv(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const oL={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 Bo(e){this.options=Object.assign({},oL,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Lv(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=iL),this.processTextOrObjNode=sL,this.options.format?(this.indentate=aL,this.tagEndChar=`>
34
+ </style>`:""},k3=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),$3=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),nv=e=>!!e.id,wa=e=>t=>(t.tagName||"").toLowerCase()===e,Dr=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),I3=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},Sa=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},Do=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},Pi=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},Oi=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},V3=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),Ip=(e,t,n="html")=>{const{Pages:r}=e,o=cn({page:t,key:"slug"})??"";return`${r.getMain()===t?"index":Cl(o||t.getName())}.${n}`},H3=(e,t)=>{const{toolbar:n}=e;n.some(o=>o.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},wc="custom-html-body",Sc="data-custom-html-body",rv="data-global-custom-html-head",ov="data-global-custom-html-body",sv="global",j3=function(e,t){const n=o=>{if(!o)return e.em.logError("loadGlobalHead: document not found");const s=Hp(t.appStore);let a=o.querySelector(`[${rv}]`);a||(a=o.createElement("div"),a.setAttribute(rv,"true"),o.head.insertBefore(a,o.head.firstChild));const i=tv(s.fonts),l=s.customCodeHead,u=[i,l].filter(d=>!!d).join(`
35
+ `);a.innerHTML=u,Qh(a)},r=o=>{if(!o)return e.em.logError("loadGlobalBody: document not found");const s=Hp(t.appStore);let a=o.querySelector(`[${ov}]`);if(!a){a=o.createElement("div"),a.setAttribute(ov,"true");const i=o.querySelector('[data-gjs-type="wrapper"]');i==null||i.appendChild(a)}a.innerHTML=s.customCodeBody||"",Qh(a)};e.on(e.Canvas.events.frameLoad,o=>{var s;return n((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(e.Canvas.events.frameLoadBody,o=>{var s;return r((s=o.el.contentWindow)==null?void 0:s.document)}),e.on(On.pageSettingsUpdate,o=>{var a,i;if(o.page)return;const s=(i=(a=e.Canvas.getFrames()[0])==null?void 0:a.view)==null?void 0:i.getDoc();n(s),r(s)}),e.Components.addType(wc,{isComponent:o=>Pi(o,Sc),model:{defaults:{attributes:{[Sc]:!0},locked:!0,layerable:!1},toHTML:()=>""}}),e.on(e.events.projectLoad,()=>{const{appStore:o}=t,{globalPageSettings:s}=o.projectDataCustom;let a=(s==null?void 0:s.customCodeHead)||"",i=(s==null?void 0:s.customCodeBody)||"";e.Pages.getAll().forEach(l=>{const u=l.getMainComponent(),d=u.head.components(),p=[];d.forEach(m=>{m.has(sv)&&p.push(m)}),p.forEach(m=>{const v=m.toHTML();a.includes(v)||(a+=v),m.remove()});const f=[];u.findType(wc).forEach(m=>{m.has(sv)&&f.push(m)}),f.forEach(m=>{const v=m.getInnerHTML();i.includes(v)||(i+=v),m.remove()})}),(a||i)&&o.setProjectDataCustom({globalPageSettings:{...s,customCodeHead:a,customCodeBody:i}})})},_i="page://",Cc="href-params__",D3=`data-gjs-${Cc}`,xc=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},Ec=e=>!!xc(e),av=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},F3=e=>!!(e!=null&&e.Components.getType("mjml")),iv=e=>Ec(e)?q.database:Vp(e)?q.home:"",lv=e=>!!e.getSymbolOverride()?c.jsx(re,{icon:q.rhombusOutline,size:se.s3x}):c.jsx(y1,{className:N("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),cv=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},Vp=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"}},uv=e=>{for(const t in ft){const n=t;if(ft[n]({cmp:e}))return n}},dv=(e,t,n)=>{const r=[];let o=n;return e.getMainComponent().findType(wc).forEach(s=>{r.push(s),o=(o||"")+s.getInnerHTML()}),{components:r,html:o,changed:o!==t}},B3=(e,t)=>{const n={...t},r=e.getMainComponent(),{head:o}=r;if(o){const a=[],i=o.components();i.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):uv(u)||a.push(u)});const l=e.em.Parser.parseHtml(`<!DOCTYPE html><html><head>${t.customCodeHead}</head></html>`);l.head&&(i.remove(a),l.head.components&&i.add(l.head.components),delete n.customCodeHead)}const s=dv(e,n.customCodeBody);if(s.changed){const[a,...i]=s.components;(a||r.append({type:wc})[0]).components(n.customCodeBody),i.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},z3=(e,t={})=>{var s;const n={...e.get("settings")??{}},r=e.getMainComponent(),{head:o}=r;if(o){const a=[];o.components().forEach(i=>{const{content:l,href:u}=i.getAttributes({noClass:!0,noStyle:!0});ft.title({cmp:i})?n.title=i.getInnerHTML():ft.favicon({cmp:i})?n.favicon=u:ft.description({cmp:i})?n.description=l:ft.keywords({cmp:i})?n.keywords=l:ft.socialTitle({cmp:i})?n.socialTitle=l:ft.socialDescription({cmp:i})?n.socialDescription=l:ft.socialImage({cmp:i})?n.socialImage=l:uv(i)||a.push(i.toHTML())}),a.length&&(n.customCodeHead=a.join(`
36
+ `))}if(n.customCodeBody=dv(e,n.customCodeBody).html,t.replaceDataSources&&xc(e)){const{currentItem:a}=((s=r.getCollectionsState)==null?void 0:s.call(r))||{};a&&Object.keys(n).forEach(i=>{const l=i,u=n[l];ct(u)&&(n[l]=pv(u,a))})}return n},pv=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,r)=>{const o=t[r.trim()];return o!==void 0?String(o):""}),fv=(e,t={})=>{const{currentItem:n}=t,r=t.ext??"html",o=cn({page:e,key:"slug"})??"",s=n?pv(o,n):o,a=s.lastIndexOf("/"),i=a>=0,l=i?s.substring(a+1):s,u=i?s.substring(0,a):void 0,d=`${Cl(l)}${r?`.${r}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},U3=(e,t)=>e.get(`${Cc}${t}`)||"",W3=(e,t,n)=>{e.set({[`${Cc}${t}`]:n})},G3=(e,t)=>{Object.entries(t).forEach(([n,r])=>{e[`${D3}${n}`]=r})},q3=(e,t)=>{e.getModel().set("customData",{...Ca(e),...t})},Ca=e=>e.getModel().get("customData")??{},Hp=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},cn=e=>{const{page:t,key:n,appEditorStore:r,def:o,defPage:s,opts:a}=e;return t?z3(t,a)[n]??s:Hp(r)[n]??o},Fo=(e,t,n)=>{const r=e.em.getEditor(),s=Ca(r).globalPageSettings||{};return cn({page:e,key:t,opts:n})||s[t]},hv=(e,t)=>{const n=(e==null?void 0:e.getName())??"",r={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:cn({...r,key:"slug",defPage:Cl(n)}),title:cn({...r,key:"title",defPage:n}),description:cn({...r,key:"description"}),favicon:cn({...r,key:"favicon"}),keywords:cn({...r,key:"keywords"}),socialTitle:cn({...r,key:"socialTitle",defPage:n}),socialImage:cn({...r,key:"socialImage"}),socialDescription:cn({...r,key:"socialDescription"}),customCodeHead:cn({...r,key:"customCodeHead"}),customCodeBody:cn({...r,key:"customCodeBody"})}},Tc=({icon:e,layout:t,tooltip:n,className:r,forceRemove:o,removeLayouts:s})=>({type:"button",icon:e,tooltip:n,className:r,size:"s",editorEvents:{[`${On.layoutToggleId}${t.id}`]:({fromEvent:a,setState:i})=>{i({active:a.isOpen})}},onClick:({editor:a})=>{s==null||s.forEach(i=>a.runCommand(ne.layoutRemove,{id:i,force:o})),a.runCommand(ne.layoutToggle,{...t})}}),gv={type:"static",layoutId:"leftPanelsContainer"},mv={width:240,overflow:"hidden"};Tc({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:mv,placer:gv}}),Tc({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:mv,placer:gv}}),Tc({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Tc({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 K3={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var Z3={NODE_ENV:"production"};class Y3{constructor(t,n){var s,a;this.projectType=xt.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=Z3.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(i=>{const l=i,u=n[l];u!==void 0&&(this[l]=u)});const r=Or()?window.location.search:"";this.queryParams=QS(r),an(this,{sdkProps:!1},{autoBind:!0});const o=(a=(s=this.sdkProps.options)==null?void 0:s.customTheme)==null?void 0:a.icons;o&&mT(o)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return zu({isDev:t,isStage:n})}get projectId(){var r,o;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((o=(r=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:r.custom)==null?void 0:o.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:r}=this,{customConfig:o}=r.layoutStore,s=(o==null?void 0:o.responsive)||(t==null?void 0:t.responsive);let a=(o==null?void 0:o.default)||(t==null?void 0:t.default)||K3;if(n&&s){const l=Object.keys(s).map(Number).sort((u,d)=>u-d).find(u=>n<=u);a=l?s[l]:a}return a}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===xt.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,r=this.sdkIdentityId;if(!n||!r)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:r,lastProjectType:o}=t.localSettingsStore,s=(p=n.project)==null?void 0:p.default,{project:a}=n.storage||{};let i,l;o&&(this.store.templatesStore._projectTypeFilter=o),r&&(i=(f=(yield Gm(o)).find(m=>m.id===r))==null?void 0:f.data),i?l=i:a?l=a:s&&(l=s);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:r,data:o,isTemplate:s}=t,a=n.Storage.getConfig().options.local,i=s?`${r}__${RS()}`:r;this._projectId=i,a.key=i,JS(o)||this.loadProjectData({...o,custom:{...o.custom,id:i,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||xt.web,this.editor&&q3(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(X3(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const r=this.editor;r.loadProjectData(t),r.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:r,studioSdkVersion:o}=this;t==null||t.trigger($S,{baseApiUrl:r});const s=yield Vr.post(`${r}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:o}});if(s instanceof Error)throw s;const a=s.result||{},{license:i,error:l,plan:u,info:d}=a;this.licensePlan=u,this.loadsInfo=d,l?this.sdkLicenseError=l:(this.sdkLicense=i,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Bu,a)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Bu,{}))}}*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 X3=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||xt.web},we=()=>Tn().appEditorStore,vv=()=>Fh().appEditorStore,J3=()=>{try{return Fh().appEditorStore}catch{}},jp=()=>{const[e,t]=h.useState(0),n=Tn().appEditorStore,{transitionTime:r}=n;return h.useEffect(()=>{setTimeout(()=>t(o=>++o),r)},[r]),[e]},Dp=()=>{const{baseApiUrl:e}=vv();return`${e}/assets/sdk`},Q3=e=>`${Dp()}/${e}`,R3=async(e,t,n)=>{const r=await Vr.get(Dp(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((r==null?void 0:r.result)??[]).map(({asset:o,cdnUrl:s})=>({...o,size:parseInt(o.size),src:s}))},e4=async(e,t,n,r)=>{const o=await Vr.post(Dp(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},t4=async(e,t)=>await Vr.put(t,{body:e,rawText:!0}),n4=async(e,t,n,r)=>Promise.all(e.map(o=>e4({name:o.name,size:o.size,type:o.type},t,n,r).then(async s=>{if(!s)throw new Error("No asset");const{asset:a,cdnUrl:i,uploadUrl:l}=s,u=await t4(o,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...a,size:parseInt(a.size),src:i,type:ks.image}}))),r4=async(e,t,n,r)=>{const o=await Vr.delete(Q3(e),{body:JSON.stringify({projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return o==null?void 0:o.result},bv=async(e,t,n,r)=>Promise.all(e.map(o=>r4(o.id||o.src,t,n,r)));function Bo(e,t,n){let r,o,s,a,i;const l=t===void 0?100:t;function u(){const p=Date.now()-a;p<l&&p>=0?r=setTimeout(u,l-p):(r=null,i=e.apply(s,o),s=o=null)}const d=function(){return s=this,o=arguments,a=Date.now(),r||(r=setTimeout(u,l)),i};return d.clear=function(){r&&(clearTimeout(r),r=null)},d.flush=function(){r&&(i=e.apply(s,o),s=o=null,clearTimeout(r),r=null)},d}class yv{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,an(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Bo(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(r=>r.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(ks.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 i,l,u,d;const{assetsStore:n}=this,{editor:r}=n;if(!r||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const o=((i=this.customPages)==null?void 0:i.length)??0,s=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,a=await this.provider.onLoad({editor:r,assetTypeFilter:this.typeFilter,pageIndex:o,searchValue:this.searchValue,pageCustomData:s})??[];if(Array.isArray(a)){const p=a.map(n.toAssetProps);this.setCustomAssetProps(p)}else{const p={...a,items:a.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:r}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(o){console.error(o),r.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:r}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&r&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:r}=this,{appEditorStore:o}=n.store,{editor:s}=o;if(!(!s||!r))try{n.setIsLoadingAssets(!0),await r({assets:[n.toAsset(t)],assetProps:[t],editor:s,loadAssets:a=>this.reloadAssets(a)})}catch(a){console.error(a),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:a==null?void 0:a.message})}finally{n.setIsLoadingAssets(!1)}}}const wv=e=>Tn().assetsStore.assetPanelStores[e];class o4{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${zm()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new yv(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),an(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Mp.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Mp.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,o=n.options.licenseKey,s=t.sdkProjectId,a=t.sdkIdentityId,i=({files:l})=>n4(l,o,s,a);return this.isUsingAssetCloud?i:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:r}=this;return n?t?async o=>{await t(o),this.deleteFromProjectAssets(o)}:void 0:r?async o=>{var l,u;const{sdkOptions:s}=this.store.appEditorStore,a=(l=s.project)==null?void 0:l.id,i=(u=s.identity)==null?void 0:u.id;await bv(o.assetProps,s.licenseKey,a,i),this.deleteFromProjectAssets(o)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var i,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,r=(i=n.project)==null?void 0:i.id,o=(l=n.identity)==null?void 0:l.id,s=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:ks.image,onLoad:()=>R3(s,r,o),onDelete:async u=>{const{assetProps:d,loadAssets:p}=u;await bv(d,s,r,o),this.deleteFromProjectAssets(u),await p({clearExisting:!1})}}}onEditor(){const t=Bo(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const r=n.Assets.events.all;n.on(r,t),this.loadProjectAssets()}addSdkProviders(){var r;const t=((r=this.sdkAssetConfig)==null?void 0:r.providers)??[],n=et(t)?t({providers:ur(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const r=[...this.allProviders];let o=this.allProviders.findIndex(a=>a.id===t.id);const s=o!==-1;r.splice(n,0,t),s&&(o>=n&&(o+=1),r.splice(o,1)),this.setAllProviders(r)}hasType(t){return!!this.allProviders.find(n=>ct(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new yv(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:r,customOnLoad:o}=this,{toastStore:s}=this.store;let a;if(t){try{if(this.setIsLoadingAssets(!0),n&&o)if(r)a=r;else{const i=await o({editor:t});this.cachedOnLoadAssetProps=i.map(this.toAssetProps),a=this.cachedOnLoadAssetProps}else a=t.Assets.getAll().map(this.toAssetProps)}catch(i){console.error(i),s.addError("assets-error-load",{header:this.t("errorLoad"),content:i==null?void 0:i.message})}finally{this.setIsLoadingAssets(!1)}a&&this.setProjectAssetProps(a)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:r}){const{cachedOnLoadAssetProps:o,customOnLoad:s}=this;if(s){if(o){const a=r.map(i=>i.id);this.cachedOnLoadAssetProps=o.filter(({id:i})=>!a.includes(i)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(a=>n.Assets.remove(a)),av(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:r,customOnLoad:o}=this;o?r&&(this.cachedOnLoadAssetProps=[...t,...r],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),av(n))}async handleUpload(t){var s,a;const{editor:n,onCloudOrCustomUpload:r}=this,{toastStore:o}=this.store;if(!(!n||!r))try{this.setIsLoadingAssets(!0);const i=((s=t.dataTransfer)==null?void 0:s.files)||((a=t.target)==null?void 0:a.files)||[],l=Array.from(i),u=await r({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(i){console.error(i),o.addError("assets-error-upload",{header:this.t("errorUpload"),content:i==null?void 0:i.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 r=t;return{...r.attributes,id:r.attributes.id||r.getSrc(),src:r.getSrc(),name:r.attributes.name??r.getFilename(),type:r.attributes.type??r.getType()??ks.image,asset:r}}return{...t,type:t.type||ks.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 Ai=()=>Tn().assetsStore;class s4{constructor(t){var r;this.store=t,this.fonts={},an(this,{},{autoBind:!0});const n=(r=this.sdkFontOptions)==null?void 0:r.default;this.sdkDefaultFonts=et(n)?n({baseDefault:Jm}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>ct(t)?{id:t,label:t}:nv(t)?t:null).filter(t=>!!t):Jm}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!ct(n)&&!nv(n)).map(n=>Ti(n.family,n)):[]}get sortedFonts(){return k3(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return $3([...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 Vt(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Vt(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=Ca(t)??{},{fonts:r}=n??{};if(r)for(const[o,s]of Object.entries(r)){const a=Ti(o,s);this.addFont(a,{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=$s(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:r=!0}={}){const o=Ti(t.family,t),{editor:s}=this.store.appEditorStore;if(!s)return;const{family:a}=o;!r&&this.fonts[a]||(this.fonts[a]=o,n||this.updateProjectFonts(s))}removeFont(t){t=$s(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const r={...Ca(t).globalPageSettings,fonts:ur(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:r}),cv(t),t.trigger(On.pageSettingsUpdate,{data:r})}}const Li=()=>Tn().fontsStore;class a4{constructor(t){this.store=t,an(this,{},{autoBind:!0})}t(t,n={}){var o;const{editor:r}=this.store.appEditorStore;return((o=r==null?void 0:r.I18n)==null?void 0:o.t(t,n))||""}tScoped(t){return(n,r)=>this.t(`${t}.${n}`,r)}}const Ie=()=>Tn().i18nStore,Qn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),Sv="gs-custom-layout",i4=qt(function({className:t,component:n,noWrapper:r,id:o,render:s,componentProps:a,...i},l){const{editor:u}=we(),d=h.useRef(null),p=n,f=p&&u?c.jsx(p,{...a,editor:u}):null,g=N(Sv,o&&`${Sv}__${o}`,t),m=r&&!s;return h.useImperativeHandle(l,()=>d.current,[]),h.useEffect(()=>{const v=d.current;if(!s||!v)return;const b=S=>v.appendChild(S),w=S=>v.removeChild(S),y=s({editor:u,addEl:b,removeEl:w});if(ct(y))v.innerHTML=y;else{if(y instanceof HTMLElement)return b(y),()=>{w(y)};if(et(y))return()=>{y()}}},[s,u,d.current]),m?f:c.jsx("div",{className:g,ref:d,...i,children:f})}),Fp=ce(i4);class l4{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,an(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}add(t,n){var r;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(r=this.editor)==null||r.trigger(`${On.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var o;const r=n==null?void 0:n.layout;r&&this.layouts.forEach(s=>{s.id===t&&Object.assign(s,r)}),this.layouts=n!=null&&n.force?this.layouts.filter(s=>s.id!==t):this.layouts.map(s=>s.id===t?{...s,toRemove:!0}:s),(o=this.editor)==null||o.trigger(`${On.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 r;const{children:t}=this.store.appEditorStore.sdkProps,n=((r=Qn(t,Fp))==null?void 0:r.filter(Boolean))||[];return new Map(n.map(({props:o})=>[o.id,o]))}}const Cv=()=>Tn().layoutStore,c4=()=>Fh().layoutStore;class u4{constructor(t){this.isActive=!1,this.content="",this.store=t,an(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class d4{constructor(t){this.store=t,this._projectSourceFilter=xi.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,an(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===xi.Existing?this.projects:this.templates}async loadProjects(){const t=await Gm(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var o;const t=(o=this.store.appEditorStore.sdkOptions.templates)==null?void 0:o.onLoad,n=async()=>await f3(this.projectTypeFilter);let r;if(t){const s=this.store.appEditorStore.editor;r=await t({editor:s,fetchCommunityTemplates:n})}else r=await n();this.setTemplates(r)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){u3(vc.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 xv=()=>Tn().templatesStore;class p4{constructor(t){this.toasts=[],this.store=t,an(this,{},{autoBind:!0})}add(t,n){this.toasts.find(r=>r.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Error})}addWarning(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Warning})}addSuccess(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Success})}addInfo(t,n){this.add(t,{...ct(n)?{header:n}:n,variant:sn.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class f4{constructor(t){this.isOpen=!1,this.store=t,an(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(On.toggleBlocksPanel,{isOpen:this.isOpen})}}const h4=()=>Tn().blockManagerStore,Ev=":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",g4=Ev+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",m4="["+Ev+"]["+g4+"]*",v4=new RegExp("^"+m4+"$");function Tv(e,t){const n=[];let r=t.exec(e);for(;r;){const o=[];o.startIndex=t.lastIndex-r[0].length;const s=r.length;for(let a=0;a<s;a++)o.push(r[a]);n.push(o),r=t.exec(e)}return n}const Pc=function(e){const t=v4.exec(e);return!(t===null||typeof t>"u")};function b4(e){return typeof e<"u"}const y4={allowBooleanAttributes:!1,unpairedTags:[]};function w4(e,t){t=Object.assign({},y4,t);const n=[];let r=!1,o=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let s=0;s<e.length;s++)if(e[s]==="<"&&e[s+1]==="?"){if(s+=2,s=Ov(e,s),s.err)return s}else if(e[s]==="<"){let a=s;if(s++,e[s]==="!"){s=_v(e,s);continue}else{let i=!1;e[s]==="/"&&(i=!0,s++);let l="";for(;s<e.length&&e[s]!==">"&&e[s]!==" "&&e[s]!==" "&&e[s]!==`
37
+ `&&e[s]!=="\r";s++)l+=e[s];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),s--),!_4(l)){let p;return l.trim().length===0?p="Invalid space after '<'.":p="Tag '"+l+"' is an invalid name.",Nt("InvalidTag",p,un(e,s))}const u=x4(e,s);if(u===!1)return Nt("InvalidAttr","Attributes for '"+l+"' have open quote.",un(e,s));let d=u.value;if(s=u.index,d[d.length-1]==="/"){const p=s-d.length;d=d.substring(0,d.length-1);const f=Av(d,t);if(f===!0)r=!0;else return Nt(f.err.code,f.err.msg,un(e,p+f.err.line))}else if(i)if(u.tagClosed){if(d.trim().length>0)return Nt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",un(e,a));if(n.length===0)return Nt("InvalidTag","Closing tag '"+l+"' has not been opened.",un(e,a));{const p=n.pop();if(l!==p.tagName){let f=un(e,p.tagStartPos);return Nt("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+f.line+", col "+f.col+") instead of closing tag '"+l+"'.",un(e,a))}n.length==0&&(o=!0)}}else return Nt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",un(e,s));else{const p=Av(d,t);if(p!==!0)return Nt(p.err.code,p.err.msg,un(e,s-d.length+p.err.line));if(o===!0)return Nt("InvalidXml","Multiple possible root nodes found.",un(e,s));t.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:a}),r=!0}for(s++;s<e.length;s++)if(e[s]==="<")if(e[s+1]==="!"){s++,s=_v(e,s);continue}else if(e[s+1]==="?"){if(s=Ov(e,++s),s.err)return s}else break;else if(e[s]==="&"){const p=P4(e,s);if(p==-1)return Nt("InvalidChar","char '&' is not expected.",un(e,s));s=p}else if(o===!0&&!Pv(e[s]))return Nt("InvalidXml","Extra text at the end",un(e,s));e[s]==="<"&&s--}}else{if(Pv(e[s]))continue;return Nt("InvalidChar","char '"+e[s]+"' is not expected.",un(e,s))}if(r){if(n.length==1)return Nt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",un(e,n[0].tagStartPos));if(n.length>0)return Nt("InvalidXml","Invalid '"+JSON.stringify(n.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Nt("InvalidXml","Start tag expected.",1);return!0}function Pv(e){return e===" "||e===" "||e===`
38
+ `||e==="\r"}function Ov(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const r=e.substr(n,t-n);if(t>5&&r==="xml")return Nt("InvalidXml","XML declaration allowed only at the start of the document.",un(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function _v(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 S4='"',C4="'";function x4(e,t){let n="",r="",o=!1;for(;t<e.length;t++){if(e[t]===S4||e[t]===C4)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){o=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:o}}const E4=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Av(e,t){const n=Tv(e,E4),r={};for(let o=0;o<n.length;o++){if(n[o][1].length===0)return Nt("InvalidAttr","Attribute '"+n[o][2]+"' has no space in starting.",Mi(n[o]));if(n[o][3]!==void 0&&n[o][4]===void 0)return Nt("InvalidAttr","Attribute '"+n[o][2]+"' is without value.",Mi(n[o]));if(n[o][3]===void 0&&!t.allowBooleanAttributes)return Nt("InvalidAttr","boolean attribute '"+n[o][2]+"' is not allowed.",Mi(n[o]));const s=n[o][2];if(!O4(s))return Nt("InvalidAttr","Attribute '"+s+"' is an invalid name.",Mi(n[o]));if(!r.hasOwnProperty(s))r[s]=1;else return Nt("InvalidAttr","Attribute '"+s+"' is repeated.",Mi(n[o]))}return!0}function T4(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 P4(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,T4(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 Pc(e)}function _4(e){return Pc(e)}function un(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Mi(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 Oc;typeof Symbol!="function"?Oc="@@xmlMetadata":Oc=Symbol("XML Node Metadata");class Is{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][Oc]={startIndex:n})}static getMetaDataSymbol(){return Oc}}class M4{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const r={};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 o=1,s=!1,a=!1,i="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(s&&Vs(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(r[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(s&&Vs(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(s&&Vs(t,"!ATTLIST",n))n+=8;else if(s&&Vs(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(Vs(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");o++,i=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,o--):o--,o===0)break}else t[n]==="["?s=!0:i+=t[n];if(o!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(Ni(r),n=Cn(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 o="";return[n,o]=this.readIdentifierVal(t,n,"entity"),n--,[r,o,n]}readNotationExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&Ni(r),n=Cn(t,n);const o=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&o!=="SYSTEM"&&o!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${o}"`);n+=o.length,n=Cn(t,n);let s=null,a=null;if(o==="PUBLIC")[n,s]=this.readIdentifierVal(t,n,"publicIdentifier"),n=Cn(t,n),(t[n]==='"'||t[n]==="'")&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(o==="SYSTEM"&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!a))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:r,publicIdentifier:s,systemIdentifier:a,index:--n}}readIdentifierVal(t,n,r){let o="";const s=t[n];if(s!=='"'&&s!=="'")throw new Error(`Expected quoted string, found "${s}"`);for(n++;n<t.length&&t[n]!==s;)o+=t[n],n++;if(t[n]!==s)throw new Error(`Unterminated ${r} value`);return n++,[n,o]}readElementExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Pc(r))throw new Error(`Invalid element name: "${r}"`);n=Cn(t,n);let o="";if(t[n]==="E"&&Vs(t,"MPTY",n))n+=4;else if(t[n]==="A"&&Vs(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)o+=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:r,contentModel:o.trim(),index:n}}readAttlistExp(t,n){n=Cn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;Ni(r),n=Cn(t,n);let o="";for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;if(!Ni(o))throw new Error(`Invalid attribute name: "${o}"`);n=Cn(t,n);let s="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(s="NOTATION",n+=8,n=Cn(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let i=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!Ni(l))throw new Error(`Invalid notation name: "${l}"`);i.push(l),t[n]==="|"&&(n++,n=Cn(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,s+=" ("+i.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(s.toUpperCase()))throw new Error(`Invalid attribute type: "${s}"`)}n=Cn(t,n);let a="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(a="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(a="#IMPLIED",n+=7):[n,a]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:r,attributeName:o,attributeType:s,defaultValue:a,index:n}}}const Cn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function Vs(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function Ni(e){if(Pc(e))return e;throw new Error(`Invalid entity name ${e}`)}const N4=/^[-+]?0x[a-fA-F0-9]+$/,k4=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,$4={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function I4(e,t={}){if(t=Object.assign({},$4,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&&N4.test(n))return D4(n,16);if(n.search(/.+[eE].+/)!==-1)return H4(e,n,t);{const r=k4.exec(n);if(r){const o=r[1]||"",s=r[2];let a=j4(r[3]);const i=o?e[s.length+1]===".":e[s.length]===".";if(!t.leadingZeros&&(s.length>1||s.length===1&&!i))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===a||u===`${o}${a}`?l:e;let d=s?a:n;return s?d===u||o+d===u?l:e:d===u||d===o+u?l:e}}else return e}}const V4=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function H4(e,t,n){if(!n.eNotation)return e;const r=t.match(V4);if(r){let o=r[1]||"";const s=r[3].indexOf("e")===-1?"E":"e",a=r[2],i=o?e[a.length+1]===s:e[a.length]===s;return a.length>1&&i?e:a.length===1&&(r[3].startsWith(`.${s}`)||r[3][0]===s)?Number(t):n.leadingZeros&&!i?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function j4(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 D4(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 Lv(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 F4{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,r)=>String.fromCodePoint(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,r)=>String.fromCodePoint(Number.parseInt(r,16))}},this.addExternalEntities=B4,this.parseXml=q4,this.parseTextData=z4,this.resolveNameSpace=U4,this.buildAttributesMap=G4,this.isItStopNode=X4,this.replaceEntitiesValue=Z4,this.readStopNodeData=Q4,this.saveTextToParentTag=Y4,this.addChild=K4,this.ignoreAttributesFn=Lv(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 r=this.options.stopNodes[n];typeof r=="string"&&(r.startsWith("*.")?this.stopNodesWildcard.add(r.substring(2)):this.stopNodesExact.add(r))}}}}function B4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];this.lastEntities[r]={regex:new RegExp("&"+r+";","g"),val:e[r]}}}function z4(e,t,n,r,o,s,a){if(e!==void 0&&(this.options.trimValues&&!r&&(e=e.trim()),e.length>0)){a||(e=this.replaceEntitiesValue(e));const i=this.options.tagValueProcessor(t,e,n,o,s);return i==null?e:typeof i!=typeof e||i!==e?i:this.options.trimValues?zp(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?zp(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function U4(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 W4=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function G4(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=Tv(e,W4),o=r.length,s={};for(let a=0;a<o;a++){const i=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(i,t))continue;let l=r[a][4],u=this.options.attributeNamePrefix+i;if(i.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(i,l,t);d==null?s[u]=l:typeof d!=typeof l||d!==l?s[u]=d:s[u]=zp(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(s[u]=!0)}if(!Object.keys(s).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=s,a}return s}}const q4=function(e){e=e.replace(/\r\n?/g,`
39
+ `);const t=new Is("!xml");let n=t,r="",o="";const s=new M4(this.options.processEntities);for(let a=0;a<e.length;a++)if(e[a]==="<")if(e[a+1]==="/"){const l=Hs(e,">",a,"Closing Tag is not closed.");let u=e.substring(a+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&&(r=this.saveTextToParentTag(r,n,o));const d=o.substring(o.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=o.lastIndexOf(".",o.lastIndexOf(".")-1),this.tagsNodeStack.pop()):p=o.lastIndexOf("."),o=o.substring(0,p),n=this.tagsNodeStack.pop(),r="",a=l}else if(e[a+1]==="?"){let l=Bp(e,a,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,n,o),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new Is(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,o,l.tagName)),this.addChild(n,u,o,a)}a=l.closeIndex+1}else if(e.substr(a+1,3)==="!--"){const l=Hs(e,"-->",a+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(a+4,l-2);r=this.saveTextToParentTag(r,n,o),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}a=l}else if(e.substr(a+1,2)==="!D"){const l=s.readDocType(e,a);this.docTypeEntities=l.entities,a=l.i}else if(e.substr(a+1,2)==="!["){const l=Hs(e,"]]>",a,"CDATA is not closed.")-2,u=e.substring(a+9,l);r=this.saveTextToParentTag(r,n,o);let d=this.parseTextData(u,n.tagname,o,!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),a=l+2}else{let l=Bp(e,a,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&&r&&n.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,n,o,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),o=o.substring(0,o.lastIndexOf("."))),u!==t.tagname&&(o+=o?"."+u:u);const v=a;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,o,u)){let b="";if(p.length>0&&p.lastIndexOf("/")===p.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),a=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)a=l.closeIndex;else{const y=this.readStopNodeData(e,d,g+1);if(!y)throw new Error(`Unexpected end of ${d}`);a=y.i,b=y.tagContent}const w=new Is(u);u!==p&&f&&(w[":@"]=this.buildAttributesMap(p,o,u)),b&&(b=this.parseTextData(b,u,o,!0,f,!0,!0)),o=o.substr(0,o.lastIndexOf(".")),w.add(this.options.textNodeName,b),this.addChild(n,w,o,v)}else{if(p.length>0&&p.lastIndexOf("/")===p.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),o=o.substr(0,o.length-1),p=u):p=p.substr(0,p.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const b=new Is(u);u!==p&&f&&(b[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,b,o,v),o=o.substr(0,o.lastIndexOf("."))}else{const b=new Is(u);this.tagsNodeStack.push(n),u!==p&&f&&(b[":@"]=this.buildAttributesMap(p,o,u)),this.addChild(n,b,o,v),n=b}r="",a=g}}else r+=e[a];return t.child};function K4(e,t,n,r){this.options.captureMetaData||(r=void 0);const o=this.options.updateTag(t.tagname,n,t[":@"]);o===!1||(typeof o=="string"&&(t.tagname=o),e.addChild(t,r))}const Z4=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 Y4(e,t,n,r){return e&&(r===void 0&&(r=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,r),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function X4(e,t,n,r){return!!(t&&t.has(r)||e&&e.has(n))}function J4(e,t,n=">"){let r,o="";for(let s=t;s<e.length;s++){let a=e[s];if(r)a===r&&(r="");else if(a==='"'||a==="'")r=a;else if(a===n[0])if(n[1]){if(e[s+1]===n[1])return{data:o,index:s}}else return{data:o,index:s};else a===" "&&(a=" ");o+=a}}function Hs(e,t,n,r){const o=e.indexOf(t,n);if(o===-1)throw new Error(r);return o+t.length-1}function Bp(e,t,n,r=">"){const o=J4(e,t+1,r);if(!o)return;let s=o.data;const a=o.index,i=s.search(/\s/);let l=s,u=!0;i!==-1&&(l=s.substring(0,i),s=s.substring(i+1).trimStart());const d=l;if(n){const p=l.indexOf(":");p!==-1&&(l=l.substr(p+1),u=l!==o.data.substr(p+1))}return{tagName:l,tagExp:s,closeIndex:a,attrExpPresent:u,rawTagName:d}}function Q4(e,t,n){const r=n;let o=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const s=Hs(e,">",n,`${t} is not closed`);if(e.substring(n+2,s).trim()===t&&(o--,o===0))return{tagContent:e.substring(r,n),i:s};n=s}else if(e[n+1]==="?")n=Hs(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=Hs(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=Hs(e,"]]>",n,"StopNode is not closed.")-2;else{const s=Bp(e,n,">");s&&((s&&s.tagName)===t&&s.tagExp[s.tagExp.length-1]!=="/"&&o++,n=s.closeIndex)}}function zp(e,t,n){if(t&&typeof e=="string"){const r=e.trim();return r==="true"?!0:r==="false"?!1:I4(e,n)}else return b4(e)?e:""}const Up=Is.getMetaDataSymbol();function R4(e,t){return Mv(e,t)}function Mv(e,t,n){let r;const o={};for(let s=0;s<e.length;s++){const a=e[s],i=eL(a);let l="";if(n===void 0?l=i:l=n+"."+i,i===t.textNodeName)r===void 0?r=a[i]:r+=""+a[i];else{if(i===void 0)continue;if(a[i]){let u=Mv(a[i],t,l);const d=nL(u,t);a[Up]!==void 0&&(u[Up]=a[Up]),a[":@"]?tL(u,a[":@"],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=""),o[i]!==void 0&&o.hasOwnProperty(i)?(Array.isArray(o[i])||(o[i]=[o[i]]),o[i].push(u)):t.isArray(i,l,d)?o[i]=[u]:o[i]=u}}}return typeof r=="string"?r.length>0&&(o[t.textNodeName]=r):r!==void 0&&(o[t.textNodeName]=r),o}function eL(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(r!==":@")return r}}function tL(e,t,n,r){if(t){const o=Object.keys(t),s=o.length;for(let a=0;a<s;a++){const i=o[a];r.isArray(i,n+"."+i,!0,!0)?e[i]=[t[i]]:e[i]=t[i]}}}function nL(e,t){const{textNodeName:n}=t,r=Object.keys(e).length;return!!(r===0||r===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class rL{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 s=w4(t,n);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}const r=new F4(this.options);r.addExternalEntities(this.externalEntities);const o=r.parseXml(t);return this.options.preserveOrder||o===void 0?o:R4(o,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 Is.getMetaDataSymbol()}}const oL=`
40
+ `;function sL(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=oL),Nv(e,t,"",n)}function Nv(e,t,n,r){let o="",s=!1;for(let a=0;a<e.length;a++){const i=e[a],l=aL(i);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=i[l];iL(u,t)||(m=t.tagValueProcessor(l,m),m=$v(m,t)),s&&(o+=r),o+=m,s=!1;continue}else if(l===t.cdataPropName){s&&(o+=r),o+=`<![CDATA[${i[l][0][t.textNodeName]}]]>`,s=!1;continue}else if(l===t.commentPropName){o+=r+`<!--${i[l][0][t.textNodeName]}-->`,s=!0;continue}else if(l[0]==="?"){const m=kv(i[":@"],t),v=l==="?xml"?"":r;let b=i[l][0][t.textNodeName];b=b.length!==0?" "+b:"",o+=v+`<${l}${b}${m}?>`,s=!0;continue}let d=r;d!==""&&(d+=t.indentBy);const p=kv(i[":@"],t),f=r+`<${l}${p}`,g=Nv(i[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?o+=f+">":o+=f+"/>":(!g||g.length===0)&&t.suppressEmptyNode?o+=f+"/>":g&&g.endsWith(">")?o+=f+`>${g}${r}</${l}>`:(o+=f+">",g&&r!==""&&(g.includes("/>")||g.includes("</"))?o+=r+t.indentBy+g+r:o+=g,o+=`</${l}>`),s=!0}return o}function aL(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const r=t[n];if(e.hasOwnProperty(r)&&r!==":@")return r}}function kv(e,t){let n="";if(e&&!t.ignoreAttributes)for(let r in e){if(!e.hasOwnProperty(r))continue;let o=t.attributeValueProcessor(r,e[r]);o=$v(o,t),o===!0&&t.suppressBooleanAttributes?n+=` ${r.substr(t.attributeNamePrefix.length)}`:n+=` ${r.substr(t.attributeNamePrefix.length)}="${o}"`}return n}function iL(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let r in t.stopNodes)if(t.stopNodes[r]===e||t.stopNodes[r]==="*."+n)return!0;return!1}function $v(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const r=t.entities[n];e=e.replace(r.regex,r.val)}return e}const lL={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 zo(e){this.options=Object.assign({},lL,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=Lv(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=dL),this.processTextOrObjNode=cL,this.options.format?(this.indentate=uL,this.tagEndChar=`>
41
41
  `,this.newLine=`
42
- `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Bo.prototype.build=function(e){return this.options.preserveOrder?tL(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},Bo.prototype.j2x=function(e,t,n){let r="",o="";const s=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(o+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t);else if(typeof e[a]!="object"){const i=this.isAttribute(a);if(i&&!this.ignoreAttributesFn(i,s))r+=this.buildAttrPairStr(i,""+e[a]);else if(!i)if(a===this.options.textNodeName){let l=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(l)}else o+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let l="",u="";for(let d=0;d<i;d++){const f=e[a][d];if(!(typeof f>"u"))if(f===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const p=this.j2x(f,t+1,n.concat(a));l+=p.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else l+=this.processTextOrObjNode(f,a,t,n);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(a,f);p=this.replaceEntitiesValue(p),l+=p}else l+=this.buildTextValNode(f,a,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,a,u,t)),o+=l}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const i=Object.keys(e[a]),l=i.length;for(let u=0;u<l;u++)r+=this.buildAttrPairStr(i[u],""+e[a][i[u]])}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:o}},Bo.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 sL(e,t,n,r){const o=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}Bo.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,s="";return t[0]==="?"&&(s="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+s+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+s+this.tagEndChar+e+this.indentate(r)+o}},Bo.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},Bo.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}},Bo.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 aL(e){return this.options.indentBy.repeat(e)}function iL(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const Oc="mjml-code-to-html";function Iv(e,t){const n=t==null?void 0:t.sanitizer;if(et(n))return n(e);if(n==="xml-sanitizer"){const f=e.replace(/(<[a-zA-Z!/])|</g,(E,T)=>T??"&lt;").replace(/&(?!#?\w+;)/g,"&amp;"),p=["br","hr"],g=new Set(p),m=E=>{const T=[];for(const _ of E){const O=Object.keys(_).find(P=>P!==":@");if(O&&g.has(O)){const P=_[O];Array.isArray(P)&&P.length>0?(T.push({..._,[O]:[]}),T.push(...m(P))):T.push(_)}else O&&Array.isArray(_[O])?T.push({..._,[O]:m(_[O])}):T.push(_)}return T},v={commentPropName:"#comment",unpairedTags:p,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},b=new R4({...v,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),w=new Bo({...v}),S=b.parse(`<root>${f}</root>`)[0].root,C=m(S);return w.build(C)}function r(f){const p=document.createElement("textarea");return p.innerHTML=f,p.value}const o=r(e||""),s=["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"],a={crossorigin:"anonymous","full-width":"true"},i=new RegExp(`\\s+(${s.join("|")})(?=\\s|\\/?>)`,"gi");return o.replace(/<[^>]+>/g,f=>f.replace(i,(p,g)=>{const m=a[g]??g;return` ${g}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(f,p,g)=>{const m=g.slice(1,-1).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");return`${p}"${m}"`}).replace(/&(?!#?\w+;)/g,(f,p,g)=>p>0&&g[p-1]==="&"?f:"&amp;").replace(/(<[a-zA-Z!/])|</g,(f,p)=>p??"&lt;")}var Ni=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(Ni||{}),Wf=(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))(Wf||{}),zo=(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))(zo||{}),Hs=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(Hs||{});function lL(e){const t=new Map,n={items:[]};return e.forEach(o=>{const{category:s,item:a}=o;if(s){const i=t.get(s.id);i?(i.items.push(a),i.category={...i.category,...s}):t.set(s.id,{category:s,items:[a]})}else n.items.push(a)}),[...Array.from(t).map(([,o])=>o),n].filter(o=>o.items.length)}const Vv=e=>(e==null?void 0:e.get("groups"))||[],Hv=(e,t)=>Vv(e).includes(t),cL=(e,t)=>{Hv(e,t)||e.set("groups",[...Vv(e),t])};class uL{constructor(t){this.dataSourceKeyid=Hs.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,sn(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,r=[],o=t.reduce((s,a)=>(s.set(a.get("id"),a),s),new Map);return n.forEach(({id:s})=>{const a=o.get(s);a&&(r.push(a),o.delete(s))}),Array.from(o).map(([,s])=>{s.get("_internal")||r.push(s)}),lL(r.map(s=>({category:s.get("category"),item:s})))}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(r=>Hv(r,t))}addStyleRule(t,n={}){var f,p;const{editor:r}=this,o=t.get("id"),s=t.get("selector")||"",a=t.get("property"),i=t.getPath("value"),l=`${this.dataSourceKeyid}:${o}`,u={[a]:{type:"data-variable",path:i,defaultValue:t.get("defaultValue")}};if(r&&QS(r)&&s.startsWith("mj-")){const g=r.Components.getWrapper(),{head:m}=Ni,{attributes:v}=Wf,b=g.findFirstType(Ni.root);if(!b)return;const w=b.findFirstType(m)||b.append({type:m},{at:0})[0],y=w.findFirstType(v)||w.append({type:v})[0],S=y.findType(s).pop()||y.append({type:s})[0],C=(S.get("attributes")||{})[a];Ht(C)&&C!==""&&t.set("value",C),S.addAttributes(u,{silent:!0});return}let d=((p=(f=n.selectorToRuleMap)==null?void 0:f.get(s))==null?void 0:p.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=r==null?void 0:r.CssComposer.addCollection([{selectors:[],selectorsAdd:s,style:u}],{extend:!0,at:t.index})[0],d&&cL(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var s,a;const{sdkOptionStyles:t}=this,n=new Map,r=(s=this.editor)==null?void 0:s.Css;if(!t.length){this.records=[];return}const o=this.getDataSource()||this.createDataSource();t.forEach(i=>{const{id:l,selector:u,label:d,field:f,property:p,category:g}=i,m=o.getRecord(l);if(m){const v={label:d,field:f,category:g};m.set({...v,_undo:!0})}else{const v=n.get(u),b=(v==null?void 0:v.rule)||(r==null?void 0:r.getRule(u)),w=(v==null?void 0:v.styles)||(b==null?void 0:b.getStyle())||{},y=w[p]||i.defaultValue;n.set(u,{rule:b,styles:w}),o.addRecord({value:void 0,...i,defaultValue:y,_internal:!0,_undo:!0})}}),o.getRecords().forEach(i=>{this.addStyleRule(i,{selectorToRuleMap:n})}),o.listenTo(o.records,"add",i=>{this.addStyleRule(i)}),(a=this.editor)==null||a.UndoManager.add(o.records),this.records=o.getRecords()}}const dL=()=>En().globalStylesStore,fL=(e,t)=>{let n;try{const r=Tr()&&e&&localStorage.getItem(e);r&&(n=JSON.parse(r))}catch(r){console.error(r)}return{lastProjectId:"",...t,...n}},jv=(e,t)=>{const r={...fL(e),...t};try{Tr()&&e&&localStorage.setItem(e,JSON.stringify(r))}catch(o){console.error(o)}return r},Dv="gs-utl-dark",pL=()=>Tr()&&window.matchMedia("(prefers-color-scheme: dark)").matches,Fv=e=>e==="dark"||e==="auto"&&pL(),Bv=(e,t)=>{if(e&&Tr()&&t.rootEl){const{classList:n}=t.rootEl;let r=!1;if(Fv(e)?(n.add(Dv),r=!0):n.remove(Dv),t.updateAppShell){const o=document.head.querySelector('meta[name="theme-color"]');o&&(o.content=r?"#18181b":"#ffffff")}t.resolvedTheme=r?So.dark:So.light}};class hL{constructor(t){this.key="",this.theme=So.auto,this.resolvedTheme=So.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),this.resolvedTheme=this.theme,sn(this,{},{autoBind:!0}),this.init()}init(){Bv(this.theme,this)}changeTheme(t){Bv(t,this),jv(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),jv(this.key,t)}get isDarkTheme(){return Fv(this.theme)}}const jr=()=>En().localSettingsStore;class gL{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,sn(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:r,confirmButton:o,...s}){this.isOpen=!0,this.content=t;const a=()=>{r==null||r(),this.close()};this.setModalProps({...s,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:a,size:"m2",variant:"pr",...o}]})}}const Ca=()=>En().modalStore,zv="column1",Uv="column2",Wv="column3",Gf="column3-7",mL=function(e,t={}){const{Components:n,Blocks:r}=e,o="gridRow",s="gridColumn",a="gjs-grid-row",i="gjs-grid-column",l={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,f=1,p=1;n.addType(o,{isComponent:b=>jo(b,a),model:{defaults:{emptyState:!0,droppable:Hr(s),highlightable:!1,attributes:{class:a},resizable:{...l,keyHeight:"min-height"},icon:`
42
+ `):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}zo.prototype.build=function(e){return this.options.preserveOrder?sL(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},zo.prototype.j2x=function(e,t,n){let r="",o="";const s=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(o+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?o+="":a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)o+=this.buildTextValNode(e[a],a,"",t);else if(typeof e[a]!="object"){const i=this.isAttribute(a);if(i&&!this.ignoreAttributesFn(i,s))r+=this.buildAttrPairStr(i,""+e[a]);else if(!i)if(a===this.options.textNodeName){let l=this.options.tagValueProcessor(a,""+e[a]);o+=this.replaceEntitiesValue(l)}else o+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let l="",u="";for(let d=0;d<i;d++){const p=e[a][d];if(!(typeof p>"u"))if(p===null)a[0]==="?"?o+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:o+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const f=this.j2x(p,t+1,n.concat(a));l+=f.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(u+=f.attrStr)}else l+=this.processTextOrObjNode(p,a,t,n);else if(this.options.oneListGroup){let f=this.options.tagValueProcessor(a,p);f=this.replaceEntitiesValue(f),l+=f}else l+=this.buildTextValNode(p,a,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,a,u,t)),o+=l}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const i=Object.keys(e[a]),l=i.length;for(let u=0;u<l;u++)r+=this.buildAttrPairStr(i[u],""+e[a][i[u]])}else o+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:o}},zo.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 cL(e,t,n,r){const o=this.j2x(e,n+1,r.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,o.attrStr,n):this.buildObjectNode(o.val,t,o.attrStr,n)}zo.prototype.buildObjectNode=function(e,t,n,r){if(e==="")return t[0]==="?"?this.indentate(r)+"<"+t+n+"?"+this.tagEndChar:this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let o="</"+t+this.tagEndChar,s="";return t[0]==="?"&&(s="?",o=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+s+">"+e+o:this.options.commentPropName!==!1&&t===this.options.commentPropName&&s.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+s+this.tagEndChar+e+this.indentate(r)+o}},zo.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},zo.prototype.buildTextValNode=function(e,t,n,r){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(r)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(r)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(r)+"<"+t+n+"?"+this.tagEndChar;{let o=this.options.tagValueProcessor(t,e);return o=this.replaceEntitiesValue(o),o===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+o+"</"+t+this.tagEndChar}},zo.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 uL(e){return this.options.indentBy.repeat(e)}function dL(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const _c="mjml-code-to-html";function Iv(e,t){const n=t==null?void 0:t.sanitizer;if(et(n))return n(e);if(n==="xml-sanitizer"){const p=e.replace(/(<[a-zA-Z!/])|</g,(E,T)=>T??"&lt;").replace(/&(?!#?\w+;)/g,"&amp;"),f=["br","hr"],g=new Set(f),m=E=>{const T=[];for(const _ of E){const O=Object.keys(_).find(P=>P!==":@");if(O&&g.has(O)){const P=_[O];Array.isArray(P)&&P.length>0?(T.push({..._,[O]:[]}),T.push(...m(P))):T.push(_)}else O&&Array.isArray(_[O])?T.push({..._,[O]:m(_[O])}):T.push(_)}return T},v={commentPropName:"#comment",unpairedTags:f,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},b=new rL({...v,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),w=new zo({...v}),S=b.parse(`<root>${p}</root>`)[0].root,C=m(S);return w.build(C)}function r(p){const f=document.createElement("textarea");return f.innerHTML=p,f.value}const o=r(e||""),s=["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"],a={crossorigin:"anonymous","full-width":"true"},i=new RegExp(`\\s+(${s.join("|")})(?=\\s|\\/?>)`,"gi");return o.replace(/<[^>]+>/g,p=>p.replace(i,(f,g)=>{const m=a[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 ki=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(ki||{}),Wp=(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))(Wp||{}),Uo=(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))(Uo||{}),js=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(js||{});function pL(e){const t=new Map,n={items:[]};return e.forEach(o=>{const{category:s,item:a}=o;if(s){const i=t.get(s.id);i?(i.items.push(a),i.category={...i.category,...s}):t.set(s.id,{category:s,items:[a]})}else n.items.push(a)}),[...Array.from(t).map(([,o])=>o),n].filter(o=>o.items.length)}const Vv=e=>(e==null?void 0:e.get("groups"))||[],Hv=(e,t)=>Vv(e).includes(t),fL=(e,t)=>{Hv(e,t)||e.set("groups",[...Vv(e),t])};class hL{constructor(t){this.dataSourceKeyid=js.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,an(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,r=[],o=t.reduce((s,a)=>(s.set(a.get("id"),a),s),new Map);return n.forEach(({id:s})=>{const a=o.get(s);a&&(r.push(a),o.delete(s))}),Array.from(o).map(([,s])=>{s.get("_internal")||r.push(s)}),pL(r.map(s=>({category:s.get("category"),item:s})))}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(r=>Hv(r,t))}addStyleRule(t,n={}){var p,f;const{editor:r}=this,o=t.get("id"),s=t.get("selector")||"",a=t.get("property"),i=t.getPath("value"),l=`${this.dataSourceKeyid}:${o}`,u={[a]:{type:"data-variable",path:i,defaultValue:t.get("defaultValue")}};if(r&&eC(r)&&s.startsWith("mj-")){const g=r.Components.getWrapper(),{head:m}=ki,{attributes:v}=Wp,b=g.findFirstType(ki.root);if(!b)return;const w=b.findFirstType(m)||b.append({type:m},{at:0})[0],y=w.findFirstType(v)||w.append({type:v})[0],S=y.findType(s).pop()||y.append({type:s})[0],C=(S.get("attributes")||{})[a];Vt(C)&&C!==""&&t.set("value",C),S.addAttributes(u,{silent:!0});return}let d=((f=(p=n.selectorToRuleMap)==null?void 0:p.get(s))==null?void 0:f.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=r==null?void 0:r.CssComposer.addCollection([{selectors:[],selectorsAdd:s,style:u}],{extend:!0,at:t.index})[0],d&&fL(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var s,a;const{sdkOptionStyles:t}=this,n=new Map,r=(s=this.editor)==null?void 0:s.Css;if(!t.length){this.records=[];return}const o=this.getDataSource()||this.createDataSource();t.forEach(i=>{const{id:l,selector:u,label:d,field:p,property:f,category:g}=i,m=o.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)||(r==null?void 0:r.getRule(u)),w=(v==null?void 0:v.styles)||(b==null?void 0:b.getStyle())||{},y=w[f]||i.defaultValue;n.set(u,{rule:b,styles:w}),o.addRecord({value:void 0,...i,defaultValue:y,_internal:!0,_undo:!0})}}),o.getRecords().forEach(i=>{this.addStyleRule(i,{selectorToRuleMap:n})}),o.listenTo(o.records,"add",i=>{this.addStyleRule(i)}),(a=this.editor)==null||a.UndoManager.add(o.records),this.records=o.getRecords()}}const gL=()=>Tn().globalStylesStore,mL=(e,t)=>{let n;try{const r=Or()&&e&&localStorage.getItem(e);r&&(n=JSON.parse(r))}catch(r){console.error(r)}return{lastProjectId:"",...t,...n}},jv=(e,t)=>{const r={...mL(e),...t};try{Or()&&e&&localStorage.setItem(e,JSON.stringify(r))}catch(o){console.error(o)}return r},Dv="gs-utl-dark",vL=()=>Or()&&window.matchMedia("(prefers-color-scheme: dark)").matches,Fv=e=>e==="dark"||e==="auto"&&vL(),Bv=(e,t)=>{if(e&&Or()&&t.rootEl){const{classList:n}=t.rootEl;let r=!1;if(Fv(e)?(n.add(Dv),r=!0):n.remove(Dv),t.updateAppShell){const o=document.head.querySelector('meta[name="theme-color"]');o&&(o.content=r?"#18181b":"#ffffff")}t.resolvedTheme=r?xo.dark:xo.light}};class bL{constructor(t){this.key="",this.theme=xo.auto,this.resolvedTheme=xo.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),this.resolvedTheme=this.theme,an(this,{},{autoBind:!0}),this.init()}init(){Bv(this.theme,this)}changeTheme(t){Bv(t,this),jv(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const r=n,o=t[r];o!==void 0&&(this[r]=o)}),jv(this.key,t)}get isDarkTheme(){return Fv(this.theme)}}const Fr=()=>Tn().localSettingsStore;class yL{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,an(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:r,confirmButton:o,...s}){this.isOpen=!0,this.content=t;const a=()=>{r==null||r(),this.close()};this.setModalProps({...s,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:a,size:"m2",variant:"pr",...o}]})}}const xa=()=>Tn().modalStore,zv="column1",Uv="column2",Wv="column3",Gp="column3-7",wL=function(e,t={}){const{Components:n,Blocks:r}=e,o="gridRow",s="gridColumn",a="gjs-grid-row",i="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(o,{isComponent:b=>Do(b,a),model:{defaults:{emptyState:!0,droppable:Dr(s),highlightable:!1,attributes:{class:a},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>
@@ -57,7 +57,7 @@ ${t}
57
57
  flex-direction: column;
58
58
  }
59
59
  }
60
- `}}}),n.addType(s,{isComponent:b=>jo(b,i),model:{defaults:{emptyState:!0,attributes:{class:i},draggable:Hr(o),resizable:{...l,bc:0,keyWidth:u,currentUnit:p,minDim:d,step:f},icon:`
60
+ `}}}),n.addType(s,{isComponent:b=>Do(b,i),model:{defaults:{emptyState:!0,attributes:{class:i},draggable:Dr(o),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:o,content:{type:o,components:[{type:s},{type:s},{type:s}]},...t.block},m={merge:!0},v=b=>{var w;return((w=r.get(b))==null?void 0:w.category)||g.category};r.add(zv,{...g,category:v(zv),content:{type:o,components:[{type:s}]}},m),r.add(Uv,{...g,category:v(Uv),content:{type:o,components:[{type:s},{type:s}]}},m),r.add(Wv,{...g,category:v(Wv),content:{type:o,components:[{type:s},{type:s},{type:s}]}},m),r.add(Gf,{...g,category:v(Gf),content:{type:o,components:[{type:s,style:{"flex-basis":"30%","flex-grow":0}},{type:s}]}},m)},$i="section",qf="container",Kf="gjs-section",Zf="gjs-container",vL=function(e,t={}){const{Components:n,Blocks:r}=e;r.add($i,{label:$i,media:`
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:o,content:{type:o,components:[{type:s},{type:s},{type:s}]},...t.block},m={merge:!0},v=b=>{var w;return((w=r.get(b))==null?void 0:w.category)||g.category};r.add(zv,{...g,category:v(zv),content:{type:o,components:[{type:s}]}},m),r.add(Uv,{...g,category:v(Uv),content:{type:o,components:[{type:s},{type:s}]}},m),r.add(Wv,{...g,category:v(Wv),content:{type:o,components:[{type:s},{type:s},{type:s}]}},m),r.add(Gp,{...g,category:v(Gp),content:{type:o,components:[{type:s,style:{"flex-basis":"30%","flex-grow":0}},{type:s}]}},m)},$i="section",qp="container",Kp="gjs-section",Zp="gjs-container",SL=function(e,t={}){const{Components:n,Blocks:r}=e;r.add($i,{label:$i,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:$i},...t.block},{at:Pi(e,Gf)+1}),n.addType($i,{isComponent:o=>jo(o,Kf),model:{defaults:{tagName:"section",emptyState:!0,draggable:Hr("wrapper"),droppable:Hr(qf),attributes:{class:Kf},components:{type:qf},styles:`
74
- .${Kf} {
73
+ `,content:{type:$i},...t.block},{at:Oi(e,Gp)+1}),n.addType($i,{isComponent:o=>Do(o,Kp),model:{defaults:{tagName:"section",emptyState:!0,draggable:Dr("wrapper"),droppable:Dr(qp),attributes:{class:Kp},components:{type:qp},styles:`
74
+ .${Kp} {
75
75
  display: flex;
76
76
  padding: 50px 0;
77
77
  }
78
- `}}}),n.addType(qf,{isComponent:o=>jo(o,Zf),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:Zf},styles:`
79
- .${Zf} {
78
+ `}}}),n.addType(qp,{isComponent:o=>Do(o,Zp),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:Zp},styles:`
79
+ .${Zp} {
80
80
  width: 90%;
81
81
  margin: 0 auto;
82
82
  max-width: 1200px;
83
83
  }
84
- `}}})},bL=function(e,t={}){const{Components:n,Blocks:r}=e,o="divider",s="gjs-divider";r.add(o,{label:o,media:`
84
+ `}}})},CL=function(e,t={}){const{Components:n,Blocks:r}=e,o="divider",s="gjs-divider";r.add(o,{label:o,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:o},...t.block},{at:Pi(e,$i)+1}),n.addType(o,{isComponent:a=>jo(a,s),model:{defaults:{droppable:!1,highlightable:!1,attributes:{class:s},stylable:["height","width","background-color","margin","margin-top","margin-right","margin-bottom","margin-left"],styles:`
88
+ `,content:{type:o},...t.block},{at:Oi(e,$i)+1}),n.addType(o,{isComponent:a=>Do(a,s),model:{defaults:{droppable:!1,highlightable:!1,attributes:{class:s},stylable:["height","width","background-color","margin","margin-top","margin-right","margin-bottom","margin-left"],styles:`
89
89
  .${s} {
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
- `}}})},yL=function(e){const{Components:t,Blocks:n}=e,o=t.getType("wrapper").model.getDefaults(),s=t.getType("head").model;t.addType("wrapper",{model:{defaults:{emptyState:{styleIn:"height: 100vh",styleOut:"padding: 0;"},stylable:[...o.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 s.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 i=t.getType("link").model;i.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=i.prototype.getAttrToHTML.apply(this),{href:d}=u;if(d&&d.startsWith(Oi)){const f=d.replace(Oi,""),p=e.Pages.get(f);if(u.href=p?`./${If(e,p)}`:"##",p&&xc(p)){const g={id:D3(this,"id")},m=pv(p,{currentItem:g});u.href=m.fullPath,B3(u,{...g,page:f})}}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:f})=>{u.components(d.map(p=>({type:"option",content:p.label,attributes:{value:p.id}}))),f()},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)}}})},wL=function(e,t={}){const{Components:n,Blocks:r}=e,o="heading";r.add(o,{label:o,media:`
95
+ `}}})},xL=function(e){const{Components:t,Blocks:n}=e,o=t.getType("wrapper").model.getDefaults(),s=t.getType("head").model;t.addType("wrapper",{model:{defaults:{emptyState:{styleIn:"height: 100vh",styleOut:"padding: 0;"},stylable:[...o.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 s.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 i=t.getType("link").model;i.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=i.prototype.getAttrToHTML.apply(this),{href:d}=u;if(d&&d.startsWith(_i)){const p=d.replace(_i,""),f=e.Pages.get(p);if(u.href=f?`./${Ip(e,f)}`:"##",f&&Ec(f)){const g={id:U3(this,"id")},m=fv(f,{currentItem:g});u.href=m.fullPath,G3(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)}}})},EL=function(e,t={}){const{Components:n,Blocks:r}=e,o="heading";r.add(o,{label:o,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:o,components:"Insert your text here"},...t.block},{at:Pi(e,"text")}),n.addType(o,{extend:"text",isComponent:s=>M3(s,"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:r}=e,o=e.Components.getType("default").model,s="imageBox",a="gjs-image-box";r.add(s,{label:s,media:`
99
+ `,content:{type:o,components:"Insert your text here"},...t.block},{at:Oi(e,"text")}),n.addType(o,{extend:"text",isComponent:s=>I3(s,"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}]}}})},TL=function(e,t={}){const{Components:n,Blocks:r}=e,o=e.Components.getType("default").model,s="imageBox",a="gjs-image-box";r.add(s,{label:s,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:s},...t.block},{at:Pi(e,"image")+1}),n.addType(s,{extend:"image",isComponent:i=>jo(i,a),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:a},styles:`
103
+ `,content:{type:s},...t.block},{at:Oi(e,"image")+1}),n.addType(s,{extend:"image",isComponent:i=>Do(i,a),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:a},styles:`
104
104
  .${a} {
105
105
  height: 200px;
106
106
  width: 100%;
107
107
  }
108
- `},getAttrToHTML(...i){return o.prototype.getAttrToHTML.apply(this,i)}},view:{tagName:"div",updateSrc(){const{model:i,em:l}=this,u=i.getSrcResult(),d=i.isDefaultSrc(),f=i.getStyle(),p=`url('${u}')`;u&&i.addStyle({"background-image":d&&f["background-image"]||p,"background-size":f["background-size"]||"contain","background-position":f["background-position"]||"center center","background-attachment":f["background-attachment"]||"scroll","background-repeat":f["background-repeat"]||"no-repeat"}),u&&l.trigger("component:toggled"),this.$el[u?"removeClass":"addClass"](this.classEmpty)},onRender(){this.renderChildren(),this.updateSrc()}}})},CL=function(e,t={}){const{Components:n,Blocks:r}=e,o="linkBox",s="gjs-link-box";r.add(o,{label:o,media:`
108
+ `},getAttrToHTML(...i){return o.prototype.getAttrToHTML.apply(this,i)}},view:{tagName:"div",updateSrc(){const{model:i,em:l}=this,u=i.getSrcResult(),d=i.isDefaultSrc(),p=i.getStyle(),f=`url('${u}')`;u&&i.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()}}})},PL=function(e,t={}){const{Components:n,Blocks:r}=e,o="linkBox",s="gjs-link-box";r.add(o,{label:o,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:o},...t.block},{at:Pi(e,"link")+1}),n.addType(o,{isComponent:a=>jo(a,s),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:s},styles:`
112
+ `,content:{type:o},...t.block},{at:Oi(e,"link")+1}),n.addType(o,{isComponent:a=>Do(a,s),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:s},styles:`
113
113
  .${s} {
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 xL(e){const t={};if(e.padding){const n=e.padding.split(" ");let r=n[0],o=n[0],s=n[0],a=n[0];n.length===4?(r=n[0],o=n[1],s=n[2],a=n[3]):n.length===3?(r=n[0],o=n[1],a=n[1],s=n[2]):n.length===2&&(r=n[0],o=n[1],a=n[1],s=n[0]),t["padding-top"]=e["padding-top"]||r,t["padding-right"]=e["padding-right"]||o,t["padding-bottom"]=e["padding-bottom"]||s,t["padding-left"]=e["padding-left"]||a,delete e.padding}return{...e,...t}}const EL={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},Gv=`<svg viewBox="0 0 24 24">
121
+ `}}})};function OL(e){const t={};if(e.padding){const n=e.padding.split(" ");let r=n[0],o=n[0],s=n[0],a=n[0];n.length===4?(r=n[0],o=n[1],s=n[2],a=n[3]):n.length===3?(r=n[0],o=n[1],a=n[1],s=n[2]):n.length===2&&(r=n[0],o=n[1],a=n[1],s=n[0]),t["padding-top"]=e["padding-top"]||r,t["padding-right"]=e["padding-right"]||o,t["padding-bottom"]=e["padding-bottom"]||s,t["padding-left"]=e["padding-left"]||a,delete e.padding}return{...e,...t}}const _L={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},Gv=`<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>`,TL=function(e,t={}){const{Components:n,Blocks:r}=e,o="icon",s="gjs-icon",a="data-type-icon";r.add(o,{label:"Icon",media:Gv,content:{type:o},...t.block}),n.addType(o,{isComponent:i=>jo(i,s)||Ti(i,a),model:{defaults:{droppable:!1,attributes:{class:s,[a]:!0},resizable:EL,components:Gv,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:i}){return i.getInnerHTML()},setValue:Fo(({editor:i,component:l,value:u})=>{const d=i.Parser.parseHtml(u).html,f=Array.isArray(d)?d[0]:d;f&&f.tagName==="svg"&&l.components(f)},500)}],styles:`
123
+ </svg>`,AL=function(e,t={}){const{Components:n,Blocks:r}=e,o="icon",s="gjs-icon",a="data-type-icon";r.add(o,{label:"Icon",media:Gv,content:{type:o},...t.block}),n.addType(o,{isComponent:i=>Do(i,s)||Pi(i,a),model:{defaults:{droppable:!1,attributes:{class:s,[a]:!0},resizable:_L,components:Gv,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:i}){return i.getInnerHTML()},setValue:Bo(({editor:i,component:l,value:u})=>{const d=i.Parser.parseHtml(u).html,p=Array.isArray(d)?d[0]:d;p&&p.tagName==="svg"&&l.components(p)},500)}],styles:`
124
124
  .${s} {
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(i=>i.set("layerable",!1))}},view:{init(){const{model:i}=this;this.listenTo(i.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(i=>{var u;const l=(u=i.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},Yf="__nc",PL=e=>{const t=e.getAttributes({noClass:!0,noStyle:!0});return e.traits.forEach(n=>{const r=n.getName();n.get("changeProp")||delete t[r]}),delete t.id,delete t.__p,t};function OL(e){const{Components:t}=e,n=r=>{const{model:o,id:s}=r,a=o.getDefaults();t.addType(s,{model:{defaults:{traits:[...a.traits,{name:"customAttributes",type:"stack",getValue({component:i}){const l=PL(i);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:i,value:l,options:u,emitUpdate:d})=>{const f=u.removed,p=u.previous,g=u.item;if(f)i.removeAttributes(f.id);else{p&&g&&p.id!==g.id&&i.removeAttributes(p.id);const m=l.reduce((v,b)=>(v[b.id]=b.value||"",v),{});i.addAttributes(m)}d()},addItem:()=>({id:Yf,value:!1}),labelItem:i=>i.id===Yf||!i.id&&!i.value?"- Empty -":`${i.id||""}="${i.value||""}"`,properties:[{name:"id",label:"Name",getValue:i=>i===Yf?"":i,setValue:(i,l)=>i.trim().toLowerCase().replace(/^[^a-z]{1}/gi,"_").replace(/\s+/g,"-")||l},{name:"value",label:"Value",getValue:i=>typeof i=="boolean"?"":i}]}]}}})};t.getTypes().forEach(n)}const _L="Basic";function Xf(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=xL;const r=e.Parser.getConfig().optionsHtml;r.htmlType="text/html";const o=n.sdkOptions.pages||{};(Ht(o.allowDocuments)?o.allowDocuments:!0)&&(r.detectDocument=!0,r.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 a={category:_L,select:!0,activate:!0};k3(e,t),yL(e),mL(e,{block:a}),wL(e,{block:a}),vL(e,{block:a}),bL(e,{block:a}),SL(e,{block:a}),CL(e,{block:a}),TL(e,{block:a}),OL(e)}function qv(e){const{code:t,appStore:n,showToastError:r}=e,{appEditorStore:o,toastStore:s,i18nStore:a}=n.store,{isProjectTypeEmail:i,editor:l}=o,u=(t||"").trim(),d=new DOMParser,f={input:t,output:"",error:""};let p="";try{if(i){const g=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=g.codeSanitizer,v=Iv(u,{sanitizer:m});if(g.htmlType==="text/xml"){const w=d.parseFromString(`<div>${v}</div>`,"text/xml").querySelector("parsererror div");f.error=(w==null?void 0:w.textContent)||""}m&&(l==null||l.runCommand(Oc,{mjml:v})),p=v}else{const g=d.parseFromString(u,"text/html");Kv(g.documentElement);const m=g.querySelectorAll("style"),v=[];m.forEach(w=>v.push(w.innerHTML));const b=v.filter(Boolean).join(`
134
- `).trim();b&&(l==null||l.Parser.parserCss.parse(b,{throwOnError:!0}))}}catch(g){f.error=g.message}return f.error?r&&s.addError("error-parser",{header:a.t("actions.importCode.parseError"),content:f.error}):f.output=p||u,f}function Kv(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const t=Array.from(e.attributes),n=Array.from(e.children);for(const r of t)e.setAttribute(r.name,r.value);for(const r of n)Kv(r)}function AL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Yv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zv(Object(n),!0).forEach(function(r){AL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function LL(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function ML(e,t){if(e==null)return{};var n=LL(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function NL(e,t){return $L(e)||kL(e,t)||IL(e,t)||VL()}function $L(e){if(Array.isArray(e))return e}function kL(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,s=void 0;try{for(var a=e[Symbol.iterator](),i;!(r=(i=a.next()).done)&&(n.push(i.value),!(t&&n.length===t));r=!0);}catch(l){o=!0,s=l}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw s}}return n}}function IL(e,t){if(e){if(typeof e=="string")return Xv(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 Xv(e,t)}}function Xv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function VL(){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 HL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Qv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jv(Object(n),!0).forEach(function(r){HL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function jL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,s){return s(o)},r)}}function ki(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function _c(e){return{}.toString.call(e).includes("Object")}function DL(e){return!Object.keys(e).length}function Ii(e){return typeof e=="function"}function FL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function BL(e,t){return _c(t)||Uo("changeType"),Object.keys(t).some(function(n){return!FL(e,n)})&&Uo("changeField"),t}function zL(e){Ii(e)||Uo("selectorType")}function UL(e){Ii(e)||_c(e)||Uo("handlerType"),_c(e)&&Object.values(e).some(function(t){return!Ii(t)})&&Uo("handlersType")}function WL(e){e||Uo("initialIsRequired"),_c(e)||Uo("initialType"),DL(e)&&Uo("initialContent")}function GL(e,t){throw new Error(e[t]||e.default)}var qL={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"},Uo=ki(GL)(qL),Ac={changes:BL,selector:zL,handler:UL,initial:WL};function KL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ac.initial(e),Ac.handler(t);var n={current:e},r=ki(XL)(n,t),o=ki(YL)(n),s=ki(Ac.changes)(e),a=ki(ZL)(n);function i(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Ac.selector(u),u(n.current)}function l(u){jL(r,o,s,a)(u)}return[i,l]}function ZL(e,t){return Ii(t)?t(e.current):t}function YL(e,t){return e.current=Qv(Qv({},e.current),t),t}function XL(e,t,n){return Ii(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var JL={create:KL},QL={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function RL(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function eM(e){return{}.toString.call(e).includes("Object")}function tM(e){return e||eb("configIsRequired"),eM(e)||eb("configType"),e.urls?(nM(),{paths:{vs:e.urls.monacoBase}}):e}function nM(){console.warn(Rv.deprecation)}function rM(e,t){throw new Error(e[t]||e.default)}var Rv={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(i=>i.set("layerable",!1))}},view:{init(){const{model:i}=this;this.listenTo(i.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(i=>{var u;const l=(u=i.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},Yp="__nc",LL=e=>{const t=e.getAttributes({noClass:!0,noStyle:!0});return e.traits.forEach(n=>{const r=n.getName();n.get("changeProp")||delete t[r]}),delete t.id,delete t.__p,t};function ML(e){const{Components:t}=e,n=r=>{const{model:o,id:s}=r,a=o.getDefaults();t.addType(s,{model:{defaults:{traits:[...a.traits,{name:"customAttributes",type:"stack",getValue({component:i}){const l=LL(i);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:i,value:l,options:u,emitUpdate:d})=>{const p=u.removed,f=u.previous,g=u.item;if(p)i.removeAttributes(p.id);else{f&&g&&f.id!==g.id&&i.removeAttributes(f.id);const m=l.reduce((v,b)=>(v[b.id]=b.value||"",v),{});i.addAttributes(m)}d()},addItem:()=>({id:Yp,value:!1}),labelItem:i=>i.id===Yp||!i.id&&!i.value?"- Empty -":`${i.id||""}="${i.value||""}"`,properties:[{name:"id",label:"Name",getValue:i=>i===Yp?"":i,setValue:(i,l)=>i.trim().toLowerCase().replace(/^[^a-z]{1}/gi,"_").replace(/\s+/g,"-")||l},{name:"value",label:"Value",getValue:i=>typeof i=="boolean"?"":i}]}]}}})};t.getTypes().forEach(n)}const NL="Basic";function Xp(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=OL;const r=e.Parser.getConfig().optionsHtml;r.htmlType="text/html";const o=n.sdkOptions.pages||{};(Vt(o.allowDocuments)?o.allowDocuments:!0)&&(r.detectDocument=!0,r.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 a={category:NL,select:!0,activate:!0};j3(e,t),xL(e),wL(e,{block:a}),EL(e,{block:a}),SL(e,{block:a}),CL(e,{block:a}),TL(e,{block:a}),PL(e,{block:a}),AL(e,{block:a}),ML(e)}function qv(e){const{code:t,appStore:n,showToastError:r}=e,{appEditorStore:o,toastStore:s,i18nStore:a}=n.store,{isProjectTypeEmail:i,editor:l}=o,u=(t||"").trim(),d=new DOMParser,p={input:t,output:"",error:""};let f="";try{if(i){const g=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=g.codeSanitizer,v=Iv(u,{sanitizer:m});if(g.htmlType==="text/xml"){const w=d.parseFromString(`<div>${v}</div>`,"text/xml").querySelector("parsererror div");p.error=(w==null?void 0:w.textContent)||""}m&&(l==null||l.runCommand(_c,{mjml:v})),f=v}else{const g=d.parseFromString(u,"text/html");Kv(g.documentElement);const m=g.querySelectorAll("style"),v=[];m.forEach(w=>v.push(w.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?r&&s.addError("error-parser",{header:a.t("actions.importCode.parseError"),content:p.error}):p.output=f||u,p}function Kv(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const t=Array.from(e.attributes),n=Array.from(e.children);for(const r of t)e.setAttribute(r.name,r.value);for(const r of n)Kv(r)}function kL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Zv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Yv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Zv(Object(n),!0).forEach(function(r){kL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Zv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function $L(e,t){if(e==null)return{};var n={},r=Object.keys(e),o,s;for(s=0;s<r.length;s++)o=r[s],!(t.indexOf(o)>=0)&&(n[o]=e[o]);return n}function IL(e,t){if(e==null)return{};var n=$L(e,t),r,o;if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(e,r)&&(n[r]=e[r])}return n}function VL(e,t){return HL(e)||jL(e,t)||DL(e,t)||FL()}function HL(e){if(Array.isArray(e))return e}function jL(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],r=!0,o=!1,s=void 0;try{for(var a=e[Symbol.iterator](),i;!(r=(i=a.next()).done)&&(n.push(i.value),!(t&&n.length===t));r=!0);}catch(l){o=!0,s=l}finally{try{!r&&a.return!=null&&a.return()}finally{if(o)throw s}}return n}}function DL(e,t){if(e){if(typeof e=="string")return Xv(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 Xv(e,t)}}function Xv(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function FL(){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 BL(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function Jv(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter(function(o){return Object.getOwnPropertyDescriptor(e,o).enumerable})),n.push.apply(n,r)}return n}function Qv(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?Jv(Object(n),!0).forEach(function(r){BL(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):Jv(Object(n)).forEach(function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))})}return e}function zL(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(r){return t.reduceRight(function(o,s){return s(o)},r)}}function Ii(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function Ac(e){return{}.toString.call(e).includes("Object")}function UL(e){return!Object.keys(e).length}function Vi(e){return typeof e=="function"}function WL(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function GL(e,t){return Ac(t)||Wo("changeType"),Object.keys(t).some(function(n){return!WL(e,n)})&&Wo("changeField"),t}function qL(e){Vi(e)||Wo("selectorType")}function KL(e){Vi(e)||Ac(e)||Wo("handlerType"),Ac(e)&&Object.values(e).some(function(t){return!Vi(t)})&&Wo("handlersType")}function ZL(e){e||Wo("initialIsRequired"),Ac(e)||Wo("initialType"),UL(e)&&Wo("initialContent")}function YL(e,t){throw new Error(e[t]||e.default)}var XL={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"},Wo=Ii(YL)(XL),Lc={changes:GL,selector:qL,handler:KL,initial:ZL};function JL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Lc.initial(e),Lc.handler(t);var n={current:e},r=Ii(eM)(n,t),o=Ii(RL)(n),s=Ii(Lc.changes)(e),a=Ii(QL)(n);function i(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Lc.selector(u),u(n.current)}function l(u){zL(r,o,s,a)(u)}return[i,l]}function QL(e,t){return Vi(t)?t(e.current):t}function RL(e,t){return e.current=Qv(Qv({},e.current),t),t}function eM(e,t,n){return Vi(t)?t(e.current):Object.keys(n).forEach(function(r){var o;return(o=t[r])===null||o===void 0?void 0:o.call(t,e.current[r])}),n}var tM={create:JL},nM={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function rM(e){return function t(){for(var n=this,r=arguments.length,o=new Array(r),s=0;s<r;s++)o[s]=arguments[s];return o.length>=e.length?e.apply(this,o):function(){for(var a=arguments.length,i=new Array(a),l=0;l<a;l++)i[l]=arguments[l];return t.apply(n,[].concat(o,i))}}}function oM(e){return{}.toString.call(e).includes("Object")}function sM(e){return e||eb("configIsRequired"),oM(e)||eb("configType"),e.urls?(aM(),{paths:{vs:e.urls.monacoBase}}):e}function aM(){console.warn(Rv.deprecation)}function iM(e,t){throw new Error(e[t]||e.default)}var Rv={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
- `},eb=RL(rM)(Rv),oM={config:tM},sM=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(s,a){return a(s)},o)}};function tb(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],tb(e[n],t[n]))}),Yv(Yv({},e),t)}var aM={type:"cancelation",msg:"operation is manually canceled"};function Jf(e){var t=!1,n=new Promise(function(r,o){e.then(function(s){return t?o(aM):r(s)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var iM=JL.create({config:QL,isInitialized:!1,resolve:null,reject:null,monaco:null}),nb=NL(iM,2),Vi=nb[0],Lc=nb[1];function lM(e){var t=oM.config(e),n=t.monaco,r=ML(t,["monaco"]);Lc(function(o){return{config:tb(o.config,r),monaco:n}})}function cM(){var e=Vi(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(Lc({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Jf(Qf);if(window.monaco&&window.monaco.editor)return rb(window.monaco),e.resolve(window.monaco),Jf(Qf);sM(uM,fM)(pM)}return Jf(Qf)}function uM(e){return document.body.appendChild(e)}function dM(e){var t=document.createElement("script");return e&&(t.src=e),t}function fM(e){var t=Vi(function(r){var o=r.config,s=r.reject;return{config:o,reject:s}}),n=dM("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function pM(){var e=Vi(function(n){var r=n.config,o=n.resolve,s=n.reject;return{config:r,resolve:o,reject:s}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){rb(n),e.resolve(n)},function(n){e.reject(n)})}function rb(e){Vi().monaco||Lc({monaco:e})}function hM(){return Vi(function(e){var t=e.monaco;return t})}var Qf=new Promise(function(e,t){return Lc({resolve:e,reject:t})}),ob={config:lM,init:cM,__getMonacoInstance:hM},gM={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Rf=gM,mM={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},vM=mM;function bM({children:e}){return h.createElement("div",{style:vM.container},e)}var yM=bM,wM=yM;function SM({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:s,wrapperProps:a}){return h.createElement("section",{style:{...Rf.wrapper,width:e,height:t},...a},!n&&h.createElement(wM,null,r),h.createElement("div",{ref:o,style:{...Rf.fullWidth,...!n&&Rf.hide},className:s}))}var CM=SM,sb=h.memo(CM);function xM(e){h.useEffect(e,[])}var ab=xM;function EM(e,t,n=!0){let r=h.useRef(!0);h.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var Nn=EM;function Hi(){}function xa(e,t,n,r){return TM(e,r)||PM(e,t,n,r)}function TM(e,t){return e.editor.getModel(ib(e,t))}function PM(e,t,n,r){return e.editor.createModel(t,n,r?ib(e,r):void 0)}function ib(e,t){return e.Uri.parse(t)}function OM({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:s,modifiedModelPath:a,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:f={},height:p="100%",width:g="100%",className:m,wrapperProps:v={},beforeMount:b=Hi,onMount:w=Hi}){let[y,S]=h.useState(!1),[C,x]=h.useState(!0),E=h.useRef(null),T=h.useRef(null),_=h.useRef(null),O=h.useRef(w),P=h.useRef(b),A=h.useRef(!1);ab(()=>{let L=ob.init();return L.then(D=>(T.current=D)&&x(!1)).catch(D=>(D==null?void 0:D.type)!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>E.current?j():L.cancel()}),Nn(()=>{if(E.current&&T.current){let L=E.current.getOriginalEditor(),D=xa(T.current,e||"",r||n||"text",s||"");D!==L.getModel()&&L.setModel(D)}},[s],y),Nn(()=>{if(E.current&&T.current){let L=E.current.getModifiedEditor(),D=xa(T.current,t||"",o||n||"text",a||"");D!==L.getModel()&&L.setModel(D)}},[a],y),Nn(()=>{let L=E.current.getModifiedEditor();L.getOption(T.current.editor.EditorOption.readOnly)?L.setValue(t||""):t!==L.getValue()&&(L.executeEdits("",[{range:L.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),L.pushUndoStop())},[t],y),Nn(()=>{var L,D;(D=(L=E.current)==null?void 0:L.getModel())==null||D.original.setValue(e||"")},[e],y),Nn(()=>{let{original:L,modified:D}=E.current.getModel();T.current.editor.setModelLanguage(L,r||n||"text"),T.current.editor.setModelLanguage(D,o||n||"text")},[n,r,o],y),Nn(()=>{var L;(L=T.current)==null||L.editor.setTheme(u)},[u],y),Nn(()=>{var L;(L=E.current)==null||L.updateOptions(f)},[f],y);let M=h.useCallback(()=>{var W;if(!T.current)return;P.current(T.current);let L=xa(T.current,e||"",r||n||"text",s||""),D=xa(T.current,t||"",o||n||"text",a||"");(W=E.current)==null||W.setModel({original:L,modified:D})},[n,t,o,e,r,s,a]),$=h.useCallback(()=>{var L;!A.current&&_.current&&(E.current=T.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...f}),M(),(L=T.current)==null||L.editor.setTheme(u),S(!0),A.current=!0)},[f,u,M]);h.useEffect(()=>{y&&O.current(E.current,T.current)},[y]),h.useEffect(()=>{!C&&!y&&$()},[C,y,$]);function j(){var D,W,F,k;let L=(D=E.current)==null?void 0:D.getModel();i||((W=L==null?void 0:L.original)==null||W.dispose()),l||((F=L==null?void 0:L.modified)==null||F.dispose()),(k=E.current)==null||k.dispose()}return h.createElement(sb,{width:g,height:p,isEditorReady:y,loading:d,_ref:_,className:m,wrapperProps:v})}var _M=OM;h.memo(_M);function AM(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var LM=AM,Mc=new Map;function MM({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:s,theme:a="light",line:i,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:p=!1,width:g="100%",height:m="100%",className:v,wrapperProps:b={},beforeMount:w=Hi,onMount:y=Hi,onChange:S,onValidate:C=Hi}){let[x,E]=h.useState(!1),[T,_]=h.useState(!0),O=h.useRef(null),P=h.useRef(null),A=h.useRef(null),M=h.useRef(y),$=h.useRef(w),j=h.useRef(),L=h.useRef(r),D=LM(s),W=h.useRef(!1),F=h.useRef(!1);ab(()=>{let V=ob.init();return V.then(U=>(O.current=U)&&_(!1)).catch(U=>(U==null?void 0:U.type)!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>P.current?H():V.cancel()}),Nn(()=>{var U,J,Y,X;let V=xa(O.current,e||r||"",t||o||"",s||n||"");V!==((U=P.current)==null?void 0:U.getModel())&&(f&&Mc.set(D,(J=P.current)==null?void 0:J.saveViewState()),(Y=P.current)==null||Y.setModel(V),f&&((X=P.current)==null||X.restoreViewState(Mc.get(s))))},[s],x),Nn(()=>{var V;(V=P.current)==null||V.updateOptions(u)},[u],x),Nn(()=>{!P.current||r===void 0||(P.current.getOption(O.current.editor.EditorOption.readOnly)?P.current.setValue(r):r!==P.current.getValue()&&(F.current=!0,P.current.executeEdits("",[{range:P.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),P.current.pushUndoStop(),F.current=!1))},[r],x),Nn(()=>{var U,J;let V=(U=P.current)==null?void 0:U.getModel();V&&o&&((J=O.current)==null||J.editor.setModelLanguage(V,o))},[o],x),Nn(()=>{var V;i!==void 0&&((V=P.current)==null||V.revealLine(i))},[i],x),Nn(()=>{var V;(V=O.current)==null||V.editor.setTheme(a)},[a],x);let k=h.useCallback(()=>{var V;if(!(!A.current||!O.current)&&!W.current){$.current(O.current);let U=s||n,J=xa(O.current,r||e||"",t||o||"",U||"");P.current=(V=O.current)==null?void 0:V.editor.create(A.current,{model:J,automaticLayout:!0,...u},d),f&&P.current.restoreViewState(Mc.get(U)),O.current.editor.setTheme(a),i!==void 0&&P.current.revealLine(i),E(!0),W.current=!0}},[e,t,n,r,o,s,u,d,f,a,i]);h.useEffect(()=>{x&&M.current(P.current,O.current)},[x]),h.useEffect(()=>{!T&&!x&&k()},[T,x,k]),L.current=r,h.useEffect(()=>{var V,U;x&&S&&((V=j.current)==null||V.dispose(),j.current=(U=P.current)==null?void 0:U.onDidChangeModelContent(J=>{F.current||S(P.current.getValue(),J)}))},[x,S]),h.useEffect(()=>{if(x){let V=O.current.editor.onDidChangeMarkers(U=>{var Y;let J=(Y=P.current.getModel())==null?void 0:Y.uri;if(J&&U.find(X=>X.path===J.path)){let X=O.current.editor.getModelMarkers({resource:J});C==null||C(X)}});return()=>{V==null||V.dispose()}}return()=>{}},[x,C]);function H(){var V,U;(V=j.current)==null||V.dispose(),p?f&&Mc.set(s,P.current.saveViewState()):(U=P.current.getModel())==null||U.dispose(),P.current.dispose()}return h.createElement(sb,{width:g,height:m,isEditorReady:x,loading:l,_ref:A,className:v,wrapperProps:b})}var NM=MM,$M=h.memo(NM),kM=$M;function Wo({className:e,as:t="label",bold:n,m:r="gjs-mb-1",size:o="m",capitalize:s=!0,children:a,tip:i,onClear:l,...u}){const d=t,f=!!l;return c.jsxs(d,{className:N(e,r,f&&z.tAo,s&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",o==="s"&&"gs-utl-text-sm",i||f?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...f&&{htmlFor:""},...u,children:[!!i&&c.jsx(Wt,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:i,children:c.jsx(ne,{icon:q.information,size:se.s2x})}),a,f&&c.jsx(Ct,{title:"Clear value",onClick:l,icon:{icon:q.close,size:se.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var lb=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(lb||{}),cb=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(cb||{});const IM="gs-cmp-button",Nc=h.memo(ce(function({classNameBtn:t,className:n,children:r,tooltip:o,variant:s,onClick:a,editorEvents:i,label:l,size:u,icon:d,active:f,buttonType:p,disabled:g,...m}){const{editor:v}=we(),[b,w]=h.useState(()=>({disabled:g,variant:s,active:f,className:n,classNameBtn:t,tooltip:o,icon:d,size:u,label:l})),y=b.variant,S=y==="outline",C=y==="secondary",E=y==="primary"?"pr":y==="danger"?"danger":S||C?"out-clear":void 0,T=b.label,_=P=>{v&&(a==null||a({event:P,editor:v,state:b,setState:A=>w(M=>({...M,...A}))}))};h.useEffect(()=>{if(!i||!v)return;const P=Object.keys(i).reduce((M,$)=>(M[$]=(j={})=>{i[$]({fromEvent:j,editor:v,state:b,setState:L=>w(D=>({...D,...L}))})},M),{}),A=Object.keys(P);return A.forEach(M=>v.on(M,P[M])),()=>{A.forEach(M=>v.off(M,P[M]))}},[v,b]);const O=b.tooltip;return c.jsx(Ct,{className:N(IM,b.classNameBtn),classNameWrp:b.className,variant:E,icon:b.icon,active:b.active,size:b.size,disabled:b.disabled,onClick:_,border:S||C,type:p,withBg:C,block:!0,...ct(O)?{title:O}:{tooltipProps:O},...m,children:T?et(T)?T({editor:v}):T:r})}));var ep=(e=>(e.m="m",e.s="s",e))(ep||{});const ub="gs-input-field",$c=e=>Ht(e)?e:"",ji=(e={})=>N("gs-utl-w-full",z.bgTr,Ao.inputText,e.disabled&&z.txtLowEmphasis),tp=({size:e="m"}={})=>N("gs-input-container gs-utl-w-full",z.bg,te.b,te.rnd,z.br,e==="m"&&Te.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),Go=({className:e,style:t,row:n})=>({className:N(e,"gs-utl-w-full gs-utl-flex",n?`${ub}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),br=e=>{const{as:t,size:n="m",label:r,description:o,hasClear:s,onChange:a,tip:i,row:l,afterLabel:u,afterLabelButtons:d}=e,f=!!r,p=!!o,g=s!=null&&s(e)?()=>a==null?void 0:a(""):void 0;if(!f&&!(d!=null&&d.length)&&!p)return null;const m=c.jsx(c.Fragment,{children:f&&c.jsx(Wo,{as:t,className:"gs-utl-w-full",size:n,tip:p?void 0:i,onClear:g,m:"",children:r})}),v=u||d!=null&&d.length?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((b,w)=>c.jsx(Nc,{...b},b.id??w))]}):null;return c.jsxs(I,{className:N("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[v?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[m,v]}):m,p&&c.jsx(Wo,{size:n,tip:i,as:"span",className:N(z.txtLowEmphasis),capitalize:!1,children:o})]})},rt=h.forwardRef(function(t,n){const{className:r,value:o,type:s,placeholder:a,required:i,disabled:l,readOnly:u,name:d,autoFocus:f,onInput:p,onChange:g,onBlur:m,onKeyDown:v,labelAs:b}=t,[w,y]=h.useState($c(o)),S=ji(t),C=h.useRef(null);h.useImperativeHandle(n,()=>C.current,[]),h.useEffect(()=>{y($c(o))},[o]),h.useEffect(()=>{const P=C.current;if(P&&f){const A=P.querySelector("input"),M=setTimeout(()=>A==null?void 0:A.focus(),Cd);return()=>clearTimeout(M)}},[C.current,f]);const x=(P,A)=>{g==null||g(P,A)},E=P=>{const{key:A}=P;switch(v==null||v(P),A){case"Escape":return y(o);case"Enter":return x(w)}},T=()=>{x(w),m==null||m()},_=P=>{const A=P.target.value;y(A),p==null||p(A)},O=Go({...t,className:N(ub,r)});return c.jsxs("div",{...O,ref:C,children:[c.jsx(br,{...t,as:b}),c.jsxs(I,{className:tp(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(B,{grow:!0,children:c.jsx("input",{className:S,name:d,value:w,onChange:_,placeholder:a,required:i,onBlur:T,onKeyDown:E,readOnly:u,disabled:l,type:s,maxLength:t.maxLength})}),t.afterInput]})]})}),db=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},VM="gs-field-code",HM={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 ho(e){const{defaultValue:t,value:n,language:r,onChange:o,clean:s,padding:a,isDarkTheme:i,className:l,containerClassName:u,minHeight:d="170px",onMount:f,readOnly:p,name:g,required:m,disabled:v,formatOnMount:b=!0,monacoOptions:w,labelAs:y}=e,S=n!==void 0,C=r,x=S?n:t,E=typeof x=="string"?x:JSON.stringify(x??"",null,2),T=Go({...e,className:N(VM,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),_=N("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...T,children:[c.jsx(br,{...e,as:y}),c.jsxs("div",{className:_,style:{minHeight:d},children:[g&&c.jsx("input",{className:Pe.hiddenVisually,name:g,value:E,disabled:v,required:m,onChange:()=>{}}),c.jsx("div",{className:N("gs-utl-absolute gs-utl-inset-0",v&&Pe.disabled),children:c.jsx(kM,{...S?{language:C,value:E}:{defaultLanguage:C,defaultValue:E},theme:i?"vs-dark":"light",className:N(te.b,te.rnd,z.br,l),options:{...HM,readOnly:p,...s&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Ht(a)&&{lineDecorationsWidth:a*2,padding:{top:a,bottom:a}},...w},onChange:o,onMount:(O,P)=>{if(b){let A=!1;const M=()=>db(O);O.onDidChangeModelLanguageConfiguration(M),O.onDidScrollChange(()=>{A||(A=!0,M())}),setTimeout(M,10)}f==null||f(O,P)}})})]})]})}const fb=ce(function({buttonProps:t,content:n,code:r,onAction:o}){const s=Ca(),a=Ie(),i=we(),{isProjectTypeEmail:l}=i,u=i.editor,{isDarkTheme:d}=jr(),[f,p]=h.useState(),g=()=>{let v=(f||"").trim();const b=qv({code:v,appStore:i,showToastError:!0});if(!b.error)v=b.output;else return;o?o(v):l?u.loadProjectData({pages:[{component:v}]}):u.setComponents(v),s.close()};h.useEffect(()=>{r?p(r):(async()=>{var C,x;const b=await u.runCommand(re.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),w=(C=b.find(E=>E.mimeType==="text/html"))==null?void 0:C.content,y=(x=b.find(E=>E.mimeType==="text/mjml"))==null?void 0:x.content,S=l?y:w;S&&p(S)})()},[]);const m=(t==null?void 0:t.children)||a.t("actions.importCode.button");return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(B,{children:n??a.t("actions.importCode.content")}),c.jsx(B,{className:Z("h-96"),children:f!==void 0&&c.jsx(ho,{defaultValue:f,onChange:v=>p(v||""),isDarkTheme:d,language:"html"})}),c.jsx(I,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),np="data-type-empty",pb=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:r}=n,o=Array.from(r.getDoc().querySelectorAll(`style[${np}]`));for(const s of o)s.disabled=!t})},jM=(e,t,n="Empty",r={})=>{const o=`[${np}="${t}"]`;if(!e.frameView.getDoc())return;const s=e.frameView.getHead(),{midSelector:a="",styleOut:i="",styleIn:l=""}=r;if(!s.querySelector(`style${o}`)){const u=document.createElement("style");u.setAttribute(np,t),u.innerHTML=`
144
+ `},eb=rM(iM)(Rv),lM={config:sM},cM=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(o){return n.reduceRight(function(s,a){return a(s)},o)}};function tb(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],tb(e[n],t[n]))}),Yv(Yv({},e),t)}var uM={type:"cancelation",msg:"operation is manually canceled"};function Jp(e){var t=!1,n=new Promise(function(r,o){e.then(function(s){return t?o(uM):r(s)}),e.catch(o)});return n.cancel=function(){return t=!0},n}var dM=tM.create({config:nM,isInitialized:!1,resolve:null,reject:null,monaco:null}),nb=VL(dM,2),Hi=nb[0],Mc=nb[1];function pM(e){var t=lM.config(e),n=t.monaco,r=IL(t,["monaco"]);Mc(function(o){return{config:tb(o.config,r),monaco:n}})}function fM(){var e=Hi(function(t){var n=t.monaco,r=t.isInitialized,o=t.resolve;return{monaco:n,isInitialized:r,resolve:o}});if(!e.isInitialized){if(Mc({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),Jp(Qp);if(window.monaco&&window.monaco.editor)return rb(window.monaco),e.resolve(window.monaco),Jp(Qp);cM(hM,mM)(vM)}return Jp(Qp)}function hM(e){return document.body.appendChild(e)}function gM(e){var t=document.createElement("script");return e&&(t.src=e),t}function mM(e){var t=Hi(function(r){var o=r.config,s=r.reject;return{config:o,reject:s}}),n=gM("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function vM(){var e=Hi(function(n){var r=n.config,o=n.resolve,s=n.reject;return{config:r,resolve:o,reject:s}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){rb(n),e.resolve(n)},function(n){e.reject(n)})}function rb(e){Hi().monaco||Mc({monaco:e})}function bM(){return Hi(function(e){var t=e.monaco;return t})}var Qp=new Promise(function(e,t){return Mc({resolve:e,reject:t})}),ob={config:pM,init:fM,__getMonacoInstance:bM},yM={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Rp=yM,wM={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},SM=wM;function CM({children:e}){return h.createElement("div",{style:SM.container},e)}var xM=CM,EM=xM;function TM({width:e,height:t,isEditorReady:n,loading:r,_ref:o,className:s,wrapperProps:a}){return h.createElement("section",{style:{...Rp.wrapper,width:e,height:t},...a},!n&&h.createElement(EM,null,r),h.createElement("div",{ref:o,style:{...Rp.fullWidth,...!n&&Rp.hide},className:s}))}var PM=TM,sb=h.memo(PM);function OM(e){h.useEffect(e,[])}var ab=OM;function _M(e,t,n=!0){let r=h.useRef(!0);h.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var kn=_M;function ji(){}function Ea(e,t,n,r){return AM(e,r)||LM(e,t,n,r)}function AM(e,t){return e.editor.getModel(ib(e,t))}function LM(e,t,n,r){return e.editor.createModel(t,n,r?ib(e,r):void 0)}function ib(e,t){return e.Uri.parse(t)}function MM({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:o,originalModelPath:s,modifiedModelPath:a,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:p={},height:f="100%",width:g="100%",className:m,wrapperProps:v={},beforeMount:b=ji,onMount:w=ji}){let[y,S]=h.useState(!1),[C,x]=h.useState(!0),E=h.useRef(null),T=h.useRef(null),_=h.useRef(null),O=h.useRef(w),P=h.useRef(b),A=h.useRef(!1);ab(()=>{let L=ob.init();return L.then(D=>(T.current=D)&&x(!1)).catch(D=>(D==null?void 0:D.type)!=="cancelation"&&console.error("Monaco initialization: error:",D)),()=>E.current?j():L.cancel()}),kn(()=>{if(E.current&&T.current){let L=E.current.getOriginalEditor(),D=Ea(T.current,e||"",r||n||"text",s||"");D!==L.getModel()&&L.setModel(D)}},[s],y),kn(()=>{if(E.current&&T.current){let L=E.current.getModifiedEditor(),D=Ea(T.current,t||"",o||n||"text",a||"");D!==L.getModel()&&L.setModel(D)}},[a],y),kn(()=>{let L=E.current.getModifiedEditor();L.getOption(T.current.editor.EditorOption.readOnly)?L.setValue(t||""):t!==L.getValue()&&(L.executeEdits("",[{range:L.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),L.pushUndoStop())},[t],y),kn(()=>{var L,D;(D=(L=E.current)==null?void 0:L.getModel())==null||D.original.setValue(e||"")},[e],y),kn(()=>{let{original:L,modified:D}=E.current.getModel();T.current.editor.setModelLanguage(L,r||n||"text"),T.current.editor.setModelLanguage(D,o||n||"text")},[n,r,o],y),kn(()=>{var L;(L=T.current)==null||L.editor.setTheme(u)},[u],y),kn(()=>{var L;(L=E.current)==null||L.updateOptions(p)},[p],y);let M=h.useCallback(()=>{var W;if(!T.current)return;P.current(T.current);let L=Ea(T.current,e||"",r||n||"text",s||""),D=Ea(T.current,t||"",o||n||"text",a||"");(W=E.current)==null||W.setModel({original:L,modified:D})},[n,t,o,e,r,s,a]),k=h.useCallback(()=>{var L;!A.current&&_.current&&(E.current=T.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...p}),M(),(L=T.current)==null||L.editor.setTheme(u),S(!0),A.current=!0)},[p,u,M]);h.useEffect(()=>{y&&O.current(E.current,T.current)},[y]),h.useEffect(()=>{!C&&!y&&k()},[C,y,k]);function j(){var D,W,F,$;let L=(D=E.current)==null?void 0:D.getModel();i||((W=L==null?void 0:L.original)==null||W.dispose()),l||((F=L==null?void 0:L.modified)==null||F.dispose()),($=E.current)==null||$.dispose()}return h.createElement(sb,{width:g,height:f,isEditorReady:y,loading:d,_ref:_,className:m,wrapperProps:v})}var NM=MM;h.memo(NM);function kM(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var $M=kM,Nc=new Map;function IM({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:o,path:s,theme:a="light",line:i,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:p=!0,keepCurrentModel:f=!1,width:g="100%",height:m="100%",className:v,wrapperProps:b={},beforeMount:w=ji,onMount:y=ji,onChange:S,onValidate:C=ji}){let[x,E]=h.useState(!1),[T,_]=h.useState(!0),O=h.useRef(null),P=h.useRef(null),A=h.useRef(null),M=h.useRef(y),k=h.useRef(w),j=h.useRef(),L=h.useRef(r),D=$M(s),W=h.useRef(!1),F=h.useRef(!1);ab(()=>{let V=ob.init();return V.then(U=>(O.current=U)&&_(!1)).catch(U=>(U==null?void 0:U.type)!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>P.current?H():V.cancel()}),kn(()=>{var U,J,Y,X;let V=Ea(O.current,e||r||"",t||o||"",s||n||"");V!==((U=P.current)==null?void 0:U.getModel())&&(p&&Nc.set(D,(J=P.current)==null?void 0:J.saveViewState()),(Y=P.current)==null||Y.setModel(V),p&&((X=P.current)==null||X.restoreViewState(Nc.get(s))))},[s],x),kn(()=>{var V;(V=P.current)==null||V.updateOptions(u)},[u],x),kn(()=>{!P.current||r===void 0||(P.current.getOption(O.current.editor.EditorOption.readOnly)?P.current.setValue(r):r!==P.current.getValue()&&(F.current=!0,P.current.executeEdits("",[{range:P.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),P.current.pushUndoStop(),F.current=!1))},[r],x),kn(()=>{var U,J;let V=(U=P.current)==null?void 0:U.getModel();V&&o&&((J=O.current)==null||J.editor.setModelLanguage(V,o))},[o],x),kn(()=>{var V;i!==void 0&&((V=P.current)==null||V.revealLine(i))},[i],x),kn(()=>{var V;(V=O.current)==null||V.editor.setTheme(a)},[a],x);let $=h.useCallback(()=>{var V;if(!(!A.current||!O.current)&&!W.current){k.current(O.current);let U=s||n,J=Ea(O.current,r||e||"",t||o||"",U||"");P.current=(V=O.current)==null?void 0:V.editor.create(A.current,{model:J,automaticLayout:!0,...u},d),p&&P.current.restoreViewState(Nc.get(U)),O.current.editor.setTheme(a),i!==void 0&&P.current.revealLine(i),E(!0),W.current=!0}},[e,t,n,r,o,s,u,d,p,a,i]);h.useEffect(()=>{x&&M.current(P.current,O.current)},[x]),h.useEffect(()=>{!T&&!x&&$()},[T,x,$]),L.current=r,h.useEffect(()=>{var V,U;x&&S&&((V=j.current)==null||V.dispose(),j.current=(U=P.current)==null?void 0:U.onDidChangeModelContent(J=>{F.current||S(P.current.getValue(),J)}))},[x,S]),h.useEffect(()=>{if(x){let V=O.current.editor.onDidChangeMarkers(U=>{var Y;let J=(Y=P.current.getModel())==null?void 0:Y.uri;if(J&&U.find(X=>X.path===J.path)){let X=O.current.editor.getModelMarkers({resource:J});C==null||C(X)}});return()=>{V==null||V.dispose()}}return()=>{}},[x,C]);function H(){var V,U;(V=j.current)==null||V.dispose(),f?p&&Nc.set(s,P.current.saveViewState()):(U=P.current.getModel())==null||U.dispose(),P.current.dispose()}return h.createElement(sb,{width:g,height:m,isEditorReady:x,loading:l,_ref:A,className:v,wrapperProps:b})}var VM=IM,HM=h.memo(VM),jM=HM;function Go({className:e,as:t="label",bold:n,m:r="gjs-mb-1",size:o="m",capitalize:s=!0,children:a,tip:i,onClear:l,...u}){const d=t,p=!!l;return c.jsxs(d,{className:N(e,r,p&&z.tAo,s&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",o==="s"&&"gs-utl-text-sm",i||p?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...p&&{htmlFor:""},...u,children:[!!i&&c.jsx(Ut,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:i,children:c.jsx(re,{icon:q.information,size:se.s2x})}),a,p&&c.jsx(Ct,{title:"Clear value",onClick:l,icon:{icon:q.close,size:se.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var lb=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(lb||{}),cb=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(cb||{});const DM="gs-cmp-button",kc=h.memo(ce(function({classNameBtn:t,className:n,children:r,tooltip:o,variant:s,onClick:a,editorEvents:i,label:l,size:u,icon:d,active:p,buttonType:f,disabled:g,...m}){const{editor:v}=we(),[b,w]=h.useState(()=>({disabled:g,variant:s,active:p,className:n,classNameBtn:t,tooltip:o,icon:d,size:u,label:l})),y=b.variant,S=y==="outline",C=y==="secondary",E=y==="primary"?"pr":y==="danger"?"danger":S||C?"out-clear":void 0,T=b.label,_=P=>{v&&(a==null||a({event:P,editor:v,state:b,setState:A=>w(M=>({...M,...A}))}))};h.useEffect(()=>{if(!i||!v)return;const P=Object.keys(i).reduce((M,k)=>(M[k]=(j={})=>{i[k]({fromEvent:j,editor:v,state:b,setState:L=>w(D=>({...D,...L}))})},M),{}),A=Object.keys(P);return A.forEach(M=>v.on(M,P[M])),()=>{A.forEach(M=>v.off(M,P[M]))}},[v,b]);const O=b.tooltip;return c.jsx(Ct,{className:N(DM,b.classNameBtn),classNameWrp:b.className,variant:E,icon:b.icon,active:b.active,size:b.size,disabled:b.disabled,onClick:_,border:S||C,type:f,withBg:C,block:!0,...ct(O)?{title:O}:{tooltipProps:O},...m,children:T?et(T)?T({editor:v}):T:r})}));var ef=(e=>(e.m="m",e.s="s",e))(ef||{});const ub="gs-input-field",$c=e=>Vt(e)?e:"",Di=(e={})=>N("gs-utl-w-full",z.bgTr,Lo.inputText,e.disabled&&z.txtLowEmphasis),tf=({size:e="m"}={})=>N("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"),qo=({className:e,style:t,row:n})=>({className:N(e,"gs-utl-w-full gs-utl-flex",n?`${ub}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),wr=e=>{const{as:t,size:n="m",label:r,description:o,hasClear:s,onChange:a,tip:i,row:l,afterLabel:u,afterLabelButtons:d}=e,p=!!r,f=!!o,g=s!=null&&s(e)?()=>a==null?void 0:a(""):void 0;if(!p&&!(d!=null&&d.length)&&!f)return null;const m=c.jsx(c.Fragment,{children:p&&c.jsx(Go,{as:t,className:"gs-utl-w-full",size:n,tip:f?void 0:i,onClear:g,m:"",children:r})}),v=u||d!=null&&d.length?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((b,w)=>c.jsx(kc,{...b},b.id??w))]}):null;return c.jsxs(I,{className:N("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[v?c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[m,v]}):m,f&&c.jsx(Go,{size:n,tip:i,as:"span",className:N(z.txtLowEmphasis),capitalize:!1,children:o})]})},rt=qt(function(t,n){const{className:r,value:o,type:s,placeholder:a,required:i,disabled:l,readOnly:u,name:d,autoFocus:p,onInput:f,onChange:g,onBlur:m,onKeyDown:v,labelAs:b}=t,[w,y]=h.useState($c(o)),S=Di(t),C=h.useRef(null);h.useImperativeHandle(n,()=>C.current,[]),h.useEffect(()=>{y($c(o))},[o]),h.useEffect(()=>{const P=C.current;if(P&&p){const A=P.querySelector("input"),M=setTimeout(()=>A==null?void 0:A.focus(),xd);return()=>clearTimeout(M)}},[C.current,p]);const x=(P,A)=>{g==null||g(P,A)},E=P=>{const{key:A}=P;switch(v==null||v(P),A){case"Escape":return y(o);case"Enter":return x(w)}},T=()=>{x(w),m==null||m()},_=P=>{const A=P.target.value;y(A),f==null||f(A)},O=qo({...t,className:N(ub,r)});return c.jsxs("div",{...O,ref:C,children:[c.jsx(wr,{...t,as:b}),c.jsxs(I,{className:tf(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(B,{grow:!0,children:c.jsx("input",{className:S,name:d,value:w,onChange:_,placeholder:a,required:i,onBlur:T,onKeyDown:E,readOnly:u,disabled:l,type:s,maxLength:t.maxLength})}),t.afterInput]})]})}),db=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},FM="gs-field-code",BM={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 mo(e){const{defaultValue:t,value:n,language:r,onChange:o,clean:s,padding:a,isDarkTheme:i,className:l,containerClassName:u,minHeight:d="170px",onMount:p,readOnly:f,name:g,required:m,disabled:v,formatOnMount:b=!0,monacoOptions:w,labelAs:y}=e,S=n!==void 0,C=r,x=S?n:t,E=typeof x=="string"?x:JSON.stringify(x??"",null,2),T=qo({...e,className:N(FM,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),_=N("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...T,children:[c.jsx(wr,{...e,as:y}),c.jsxs("div",{className:_,style:{minHeight:d},children:[g&&c.jsx("input",{className:Oe.hiddenVisually,name:g,value:E,disabled:v,required:m,onChange:()=>{}}),c.jsx("div",{className:N("gs-utl-absolute gs-utl-inset-0",v&&Oe.disabled),children:c.jsx(jM,{...S?{language:C,value:E}:{defaultLanguage:C,defaultValue:E},theme:i?"vs-dark":"light",className:N(te.b,te.rnd,z.br,l),options:{...BM,readOnly:f,...s&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Vt(a)&&{lineDecorationsWidth:a*2,padding:{top:a,bottom:a}},...w},onChange:o,onMount:(O,P)=>{if(b){let A=!1;const M=()=>db(O);O.onDidChangeModelLanguageConfiguration(M),O.onDidScrollChange(()=>{A||(A=!0,M())}),setTimeout(M,10)}p==null||p(O,P)}})})]})]})}const pb=ce(function({buttonProps:t,content:n,code:r,onAction:o}){const s=xa(),a=Ie(),i=we(),{isProjectTypeEmail:l}=i,u=i.editor,{isDarkTheme:d}=Fr(),[p,f]=h.useState(),g=()=>{let v=(p||"").trim();const b=qv({code:v,appStore:i,showToastError:!0});if(!b.error)v=b.output;else return;o?o(v):l?u.loadProjectData({pages:[{component:v}]}):u.setComponents(v),s.close()};h.useEffect(()=>{r?f(r):(async()=>{var C,x;const b=await u.runCommand(ne.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),w=(C=b.find(E=>E.mimeType==="text/html"))==null?void 0:C.content,y=(x=b.find(E=>E.mimeType==="text/mjml"))==null?void 0:x.content,S=l?y:w;S&&f(S)})()},[]);const m=(t==null?void 0:t.children)||a.t("actions.importCode.button");return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(B,{children:n??a.t("actions.importCode.content")}),c.jsx(B,{className:Z("h-96"),children:p!==void 0&&c.jsx(mo,{defaultValue:p,onChange:v=>f(v||""),isDarkTheme:d,language:"html"})}),c.jsx(I,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),nf="data-type-empty",fb=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:r}=n,o=Array.from(r.getDoc().querySelectorAll(`style[${nf}]`));for(const s of o)s.disabled=!t})},zM=(e,t,n="Empty",r={})=>{const o=`[${nf}="${t}"]`;if(!e.frameView.getDoc())return;const s=e.frameView.getHead(),{midSelector:a="",styleOut:i="",styleIn:l=""}=r;if(!s.querySelector(`style${o}`)){const u=document.createElement("style");u.setAttribute(nf,t),u.innerHTML=`
145
145
  [data-gjs-type="${t}"]${a}: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
  ${r.limitH?"height: auto;":""}
170
170
  ${r.smallH?"min-height: 30px;":""}
171
171
  ${l}
172
- }`,s.appendChild(u)}},hb=(e,t)=>{const{model:n}=t,r=n.constructor.getDefaults(),o=r.emptyState,s=n.get("type");if(!o||r.void===!0||s!==e)return;const a=o===!0?{}:o;jM(t,s,n.getName({noCustom:!0}),a)},DM=function(t){const{Components:n}=t,r=o=>{const{id:s}=o;n.addType(s,{extendFnView:["onRender"],view:{onRender(){hb(s,this)}}})};n.getTypes().forEach(r),t.on("component:type:add",r)};function FM(e,t){const{Components:n}=e,r=n.events,{modalStore:o,i18nStore:s,fontsStore:a}=t.appStore.store,{root:i,head:l,body:u}=Ni,{attributes:d,class:f,font:p,all:g,preview:m,title:v,style:b,breakpoint:w}=Wf,{wrapper:y,section:S,column:C,text:x,button:E,image:T,divider:_,group:O,social:P,socialElement:A,spacer:M,navbar:$,navbarLink:j,table:L,raw:D}=zo,{model:W}=n.getType("default"),{model:F}=n.getType(i),{model:k}=n.getType(u),{model:H}=n.getType(p),{model:V,view:U}=n.getType(l),{model:J,view:Y}=n.getType($),{model:X,view:Q}=n.getType(j),{model:ee,view:G}=n.getType(y),{model:R,view:le}=n.getType(S),{model:ge,view:Ee}=n.getType(C),{model:Ce,view:tt}=n.getType(x),{model:Qe,view:Ot}=n.getType(E),{model:ut}=n.getType(T),{model:Se,view:ot}=n.getType(_),{model:st,view:wt}=n.getType(M),{view:Ne,model:mt}=n.getType(P),{view:dt,model:Ue}=n.getType(A),{view:en,model:he}=n.getType(O),De=Hs.globalStyles,Fe="css-class",He={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},Mt={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},Gt={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},wo={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},qs={label:"Content",getValue:({component:K})=>K.getInnerHTML(),setValue:({component:K,value:de})=>K.components(de)},Re=K=>{o.open({title:K.getName({noCustom:!0}),content:()=>c.jsx(fb,{content:"",code:K.getInnerHTML(),onAction:de=>K.components(de),buttonProps:{children:s.t("save")}})})},St=K=>{var ue;const de=K.getChildrenContainer();((ue=de==null?void 0:de.innerHTML)==null?void 0:ue.trim())===""&&(de.innerHTML="")},tn=K=>K.set({void:!1},{silent:!0});function jn(K={}){return W.prototype.toHTML.call(this,K)}function Zt(K){const de=K.closestType(i),ue=de==null?void 0:de.findType(l)[0];return(ue==null?void 0:ue.toHTML())||""}function Ks(K){const de=K.toHTML(),ue=e.runCommand(Oc,{mjml:de}),Vt=new DOMParser().parseFromString(ue.html,"text/html");return{mjml:de,mjmlToHtml:ue,document:Vt}}const Tn=function(K){const de=K.model,ue=Fo(()=>{var Ae;return(Ae=de.closestType(i))==null?void 0:Ae.trigger("rerender")});K.listenTo(de.components(),"add remove reset change",ue)},ls=(K,de)=>K.replace(`<${i}>`,`<${i}>${Zt(de)}`),cs=K=>`cls-${K.tagName}-${K.getId()}`,us=(K,de)=>{const ue={...K.get("attributes")||{}};return delete ue.style,{...ue,[Fe]:`${ue[Fe]||""} ${cs(K)}`.trim()}},ds=(K,de)=>{const ue=K.closestType(i),Ae=(ue==null?void 0:ue.findFirstType(l))||(ue==null?void 0:ue.append({type:l})[0]);Ae==null||Ae.trigger(de?"rerenderHeadImmediate":"rerenderHead")},fs=K=>function(){return us(this)},gn=(K,de)=>function(ue){const Ae=ue.querySelector(`.${cs(this.model)}`);return(de?Ae:Ae==null?void 0:Ae.outerHTML)||K.prototype.getTemplateFromEl.call(this,ue)},Er=K=>function(...de){const ue=K.prototype.toJSON.apply(this,de),Ae=ue.attributes||{};return delete ue.style,delete Ae.style,delete Ae.__p,ue},Du=K=>function(...de){const ue=K.prototype.getAttrToHTML.apply(this,de);delete ue.__p;for(const Ae in ue)ue[Ae]===""&&delete ue[Ae];return ue};function Fa(){return{start:`<mjml>${Zt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function Gh(){var ue;const K=(ue=this.model.parent())==null?void 0:ue.is(d),de=TS(this.model,{withSiblings:!K,withHead:!K,beforeRootEnd:K?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:de.start,end:de.end}}function qH(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const TS=(K,de={})=>{var or;const ue=K.parents().filter(Dn=>Dn.tagName.startsWith("mj-")),Ae=ue.map(Dn=>`<${Dn.tagName}>`).reverse().join(""),Vt=ue.map(Dn=>`</${Dn.tagName}>`).join(""),kt=de.withHead?Zt(K):"",rr=de.withSiblings?(or=K.parent())==null?void 0:or.components().filter(Dn=>Dn!==K).map(({tagName:Dn})=>`<${Dn}></${Dn}>`).join(""):"";return{start:`<${i}>${kt}${Ae}`,end:`${rr||""}${Vt}${de.beforeRootEnd||""}</${i}>`}},nn=({model:K,noVoid:de})=>({init(){const ue={...this.get("style-default"),...this.getStylesToAttributes(),...this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0})};this.set("attributes",ue),this.set("style",ue),this.listenTo(this,"change:style",this.handleStyleChange),this.listenTo(this,"change:attributes",this.handleAttributeChange),de&&tn(this)},handleStyleChange(ue,Ae,Vt){if(Vt.fromAttr||Vt.fromSync)return;const kt=this.getStylesToAttributes();this.set("attributes",kt,{...Vt,fromStyle:!0,fromSync:!0})},handleAttributeChange(ue,Ae,Vt){if(Vt.fromStyle||Vt.fromSync)return;const kt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(kt,{...Vt,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const ue=this.getStyle({skipResolve:!0})||{};return delete ue.__p,ue},toHTML:jn,getAttrToHTML:Du(K),getMjmlAttributes:fs(),toJSON:Er(K)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:K=>K.findType(i)[0]}},init(){this.on(`${r.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(i)&&e.Layers.setRoot(this)}}}),n.addType(i,{model:{...nn({model:F}),defaults:{tagName:i,name:"Root",toolbar:[]},toHTML:jn},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:Er(V)},view:{init(){this.renderHeadDebounced=Fo(this.renderHead,30);const{em:K,el:de,model:ue}=this,Ae=ue.components(),Vt="core:preview",kt=K.Commands.events;this.listenTo(K,`${kt.runCommand}${Vt}`,()=>{de.style.display="none"}),this.listenTo(K,`${kt.stopCommand}${Vt}`,()=>{de.style.display=""}),this.listenTo(Ae,"change",this.onComponentsChange),this.listenTo(Ae,"add remove reset",this.renderHead),this.listenTo(ue,"rerenderHead",this.renderHeadDebounced),this.listenTo(ue,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(K){const de=Object.keys(K.changedAttributes());de.length===1&&de[0]==="status"||this.renderHead()},renderHead(){var or;const{model:K,el:de}=this,ue=de.ownerDocument;if(!(ue&&ue!==document))return;const Vt=K.closestType(i),kt=Vt&&Ks(Vt),rr=(or=kt==null?void 0:kt.document)==null?void 0:or.head;if(rr){const Dn="mjml-head-result",qh=ue.querySelector(Dn)||ue.createElement(Dn);qh.innerHTML=rr.innerHTML,!ue.head.contains(qh)&&ue.head.prepend(qh)}},render(...K){const de=U.prototype.render.apply(this,K);return this.renderHeadDebounced(),de}}}),n.addType(d,{isComponent:ya(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:Hr(l),traits:[]},toJSON:Er(W)},view:{onRender(){this.el.style.display="none"},init(){Tn(this)}}}),n.addType(f,{isComponent:ya(f),model:{defaults:{tagName:f,name:"Class",stylable:!1,draggable:Hr(d),traits:[]},toJSON:Er(W)}}),n.addType(p,{model:{...nn({model:H}),defaults:{tagName:p,name:"Font",stylable:!1,draggable:Hr(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(w,{extend:i,isComponent:ya(w),model:{defaults:{tagName:w,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:Hr(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:ya(g),model:{defaults:{tagName:g,name:"All",stylable:!1,void:!0,draggable:Hr(d),traits:[]},toHTML(...K){return F.prototype.toHTML.apply(this,K)},toJSON:Er(W)}}),n.addType(m,{isComponent:ya(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:Hr(l),traits:[qs],icon:`<svg viewBox="0 0 24 24">
172
+ }`,s.appendChild(u)}},hb=(e,t)=>{const{model:n}=t,r=n.constructor.getDefaults(),o=r.emptyState,s=n.get("type");if(!o||r.void===!0||s!==e)return;const a=o===!0?{}:o;zM(t,s,n.getName({noCustom:!0}),a)},UM=function(t){const{Components:n}=t,r=o=>{const{id:s}=o;n.addType(s,{extendFnView:["onRender"],view:{onRender(){hb(s,this)}}})};n.getTypes().forEach(r),t.on("component:type:add",r)};function WM(e,t){const{Components:n}=e,r=n.events,{modalStore:o,i18nStore:s,fontsStore:a}=t.appStore.store,{root:i,head:l,body:u}=ki,{attributes:d,class:p,font:f,all:g,preview:m,title:v,style:b,breakpoint:w}=Wp,{wrapper:y,section:S,column:C,text:x,button:E,image:T,divider:_,group:O,social:P,socialElement:A,spacer:M,navbar:k,navbarLink:j,table:L,raw:D}=Uo,{model:W}=n.getType("default"),{model:F}=n.getType(i),{model:$}=n.getType(u),{model:H}=n.getType(f),{model:V,view:U}=n.getType(l),{model:J,view:Y}=n.getType(k),{model:X,view:Q}=n.getType(j),{model:ee,view:G}=n.getType(y),{model:R,view:le}=n.getType(S),{model:ge,view:Te}=n.getType(C),{model:Ce,view:tt}=n.getType(x),{model:Qe,view:Ot}=n.getType(E),{model:ut}=n.getType(T),{model:Se,view:ot}=n.getType(_),{model:st,view:wt}=n.getType(M),{view:Ne,model:mt}=n.getType(P),{view:dt,model:Ue}=n.getType(A),{view:tn,model:he}=n.getType(O),De=js.globalStyles,Fe="css-class",He={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},Mt={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},Wt={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},Co={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},Ks={label:"Content",getValue:({component:K})=>K.getInnerHTML(),setValue:({component:K,value:ue})=>K.components(ue)},Re=K=>{o.open({title:K.getName({noCustom:!0}),content:()=>c.jsx(pb,{content:"",code:K.getInnerHTML(),onAction:ue=>K.components(ue),buttonProps:{children:s.t("save")}})})},St=K=>{var de;const ue=K.getChildrenContainer();((de=ue==null?void 0:ue.innerHTML)==null?void 0:de.trim())===""&&(ue.innerHTML="")},nn=K=>K.set({void:!1},{silent:!0});function Dn(K={}){return W.prototype.toHTML.call(this,K)}function Yt(K){const ue=K.closestType(i),de=ue==null?void 0:ue.findType(l)[0];return(de==null?void 0:de.toHTML())||""}function Zs(K){const ue=K.toHTML(),de=e.runCommand(_c,{mjml:ue}),Gt=new DOMParser().parseFromString(de.html,"text/html");return{mjml:ue,mjmlToHtml:de,document:Gt}}const Pn=function(K){const ue=K.model,de=Bo(()=>{var xe;return(xe=ue.closestType(i))==null?void 0:xe.trigger("rerender")});K.listenTo(ue.components(),"add remove reset change",de)},cs=(K,ue)=>K.replace(`<${i}>`,`<${i}>${Yt(ue)}`),us=K=>`cls-${K.tagName}-${K.getId()}`,ds=(K,ue)=>{const de={...K.get("attributes")||{}};return delete de.style,{...de,[Fe]:`${de[Fe]||""} ${us(K)}`.trim()}},ps=(K,ue)=>{const de=K.closestType(i),xe=(de==null?void 0:de.findFirstType(l))||(de==null?void 0:de.append({type:l})[0]);xe==null||xe.trigger(ue?"rerenderHeadImmediate":"rerenderHead")},fs=K=>function(){return ds(this)},mn=(K,ue)=>function(de){const xe=de.querySelector(`.${us(this.model)}`);return(ue?xe:xe==null?void 0:xe.outerHTML)||K.prototype.getTemplateFromEl.call(this,de)},Pr=K=>function(...ue){const de=K.prototype.toJSON.apply(this,ue),xe=de.attributes||{};return delete de.style,delete xe.style,delete xe.__p,de},Fu=K=>function(...ue){const de=K.prototype.getAttrToHTML.apply(this,ue);delete de.__p;for(const xe in de)de[xe]===""&&delete de[xe];return de};function Ba(){return{start:`<mjml>${Yt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function qh(){var de;const K=(de=this.model.parent())==null?void 0:de.is(d),ue=TS(this.model,{withSiblings:!K,withHead:!K,beforeRootEnd:K?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:ue.start,end:ue.end}}function XH(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const TS=(K,ue={})=>{var sr;const de=K.parents().filter(Bn=>Bn.tagName.startsWith("mj-")),xe=de.map(Bn=>`<${Bn.tagName}>`).reverse().join(""),Gt=de.map(Bn=>`</${Bn.tagName}>`).join(""),It=ue.withHead?Yt(K):"",Fn=ue.withSiblings?(sr=K.parent())==null?void 0:sr.components().filter(Bn=>Bn!==K).map(({tagName:Bn})=>`<${Bn}></${Bn}>`).join(""):"";return{start:`<${i}>${It}${xe}`,end:`${Fn||""}${Gt}${ue.beforeRootEnd||""}</${i}>`}},rn=({model:K,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&&nn(this)},handleStyleChange(de,xe,Gt){if(Gt.fromAttr||Gt.fromSync)return;const It=this.getStylesToAttributes();this.set("attributes",It,{...Gt,fromStyle:!0,fromSync:!0})},handleAttributeChange(de,xe,Gt){if(Gt.fromStyle||Gt.fromSync)return;const It=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(It,{...Gt,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const de=this.getStyle({skipResolve:!0})||{};return delete de.__p,de},toHTML:Dn,getAttrToHTML:Fu(K),getMjmlAttributes:fs(),toJSON:Pr(K)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:K=>K.findType(i)[0]}},init(){this.on(`${r.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(i)&&e.Layers.setRoot(this)}}}),n.addType(i,{model:{...rn({model:F}),defaults:{tagName:i,name:"Root",toolbar:[]},toHTML:Dn},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:Pr(V)},view:{init(){this.renderHeadDebounced=Bo(this.renderHead,30);const{em:K,el:ue,model:de}=this,xe=de.components(),Gt="core:preview",It=K.Commands.events;this.listenTo(K,`${It.runCommand}${Gt}`,()=>{ue.style.display="none"}),this.listenTo(K,`${It.stopCommand}${Gt}`,()=>{ue.style.display=""}),this.listenTo(xe,"change",this.onComponentsChange),this.listenTo(xe,"add remove reset",this.renderHead),this.listenTo(de,"rerenderHead",this.renderHeadDebounced),this.listenTo(de,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(K){const ue=Object.keys(K.changedAttributes());ue.length===1&&ue[0]==="status"||this.renderHead()},renderHead(){var Bn;const{model:K,el:ue,em:de}=this,xe=ue.ownerDocument;if(!(xe&&xe!==document)||de.destroyed)return;const It=K.closestType(i),Fn=It&&Zs(It),sr=(Bn=Fn==null?void 0:Fn.document)==null?void 0:Bn.head;if(sr){const _S="mjml-head-result",Kh=xe.querySelector(_S)||xe.createElement(_S);Kh.innerHTML=sr.innerHTML,!xe.head.contains(Kh)&&xe.head.prepend(Kh)}},render(...K){const ue=U.prototype.render.apply(this,K);return this.renderHeadDebounced(),ue}}}),n.addType(d,{isComponent:wa(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:Dr(l),traits:[]},toJSON:Pr(W)},view:{onRender(){this.el.style.display="none"},init(){Pn(this)}}}),n.addType(p,{isComponent:wa(p),model:{defaults:{tagName:p,name:"Class",stylable:!1,draggable:Dr(d),traits:[]},toJSON:Pr(W)}}),n.addType(f,{model:{...rn({model:H}),defaults:{tagName:f,name:"Font",stylable:!1,draggable:Dr(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(w,{extend:i,isComponent:wa(w),model:{defaults:{tagName:w,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:Dr(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:wa(g),model:{defaults:{tagName:g,name:"All",stylable:!1,void:!0,draggable:Dr(d),traits:[]},toHTML(...K){return F.prototype.toHTML.apply(this,K)},toJSON:Pr(W)}}),n.addType(m,{isComponent:wa(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:Dr(l),traits:[Ks],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:Er(W)},view:{tagName:()=>"div",init(){const K=this.model.components();this.onRender=Fo(this.onRender,1),this.listenTo(K,"add remove reset change",this.onRender)},onRender(){const{model:K,el:de}=this,ue=K.getName({noCustom:!0}),Ae=K.getInnerHTML();de.innerHTML=`<b>${ue}</b>: ${Ae}`,de.style.padding="5px 10px",de.style.fontFamily="system-ui"}}}),n.addType(v,{isComponent:ya(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:Er(W)},view:{render(){return this}}}),n.addType(u,{model:{...nn({model:k,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:{...nn({model:ee,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"],traits:[Gt]}},view:{attributes:{},getMjmlTemplate:Gh,getTemplateFromEl:gn(G),init:qH}}),n.addType(S,{model:{...nn({model:R,noVoid:!0}),defaults:{tagName:S,"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:[wo,Gt],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:gn(le),getMjmlTemplate:Gh,getChildrenSelector(){return this.model.getAttributes()["full-width"]==="full-width"?"table > tbody > tr > td > div table > tbody > tr > td":"table > tbody > tr > td"},render(){return St(this),this},attributes:{}}}),n.addType(O,{model:{...nn({model:he,noVoid:!0}),defaults:{tagName:O,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[wo]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:gn(en,!0),getChildrenContainer(){return this.el},getMjmlTemplate:Gh,render(){const K=this.getTemplateFromMjml(),de=$S(K);return this.renderAttributes(),this.$el.attr(de),this.el.innerHTML=K.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const KH=[x,T,E,_,M,P,A,D,L,O,$,j,zo.carousel,zo.carouselImage,zo.accordion,zo.accordionElement,zo.accordionTitle,zo.accordionText];n.addType(C,{model:{...nn({model:ge,noVoid:!0}),defaults:{tagName:C,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:K=>KH.includes(K.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var ue;const K=(ue=this.model.parent())==null?void 0:ue.is(d),de=TS(this.model,{withSiblings:!K,withHead:!K,beforeRootEnd:K?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:de.start,end:de.end}},getTemplateFromEl:gn(Ee,!0),getChildrenContainer(){const{el:K}=this;return K.querySelector("td > table tbody")||K.querySelector("table tbody")||K},render(){this.renderAttributes();const K=this.getTemplateFromMjml();return this.el.innerHTML=K.content,this.$el.attr(K.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),ds(this.model,!0),this}}}),n.addType(x,{model:{...nn({model:Ce}),defaults:{tagName:x,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:Fa,getTemplateFromEl:gn(tt),attributes:{style:"display: table; width: 100%"}}}),n.addType(E,{model:{...nn({model:Qe,noVoid:!0}),defaults:{tagName:E,traits:[He],stylable:[...Qe.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(Ot)}}),n.addType(T,{model:{...nn({model:ut}),defaults:{tagName:T,"style-default":{align:"center"},traits:[Mt,{id:"altText",name:"alt",placeholder:"Image description"},"title",He,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const K=ut.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete K.src,K},getMjmlAttributes(){const K=us(this);return this.isDefaultSrc()&&delete K.src,K}},view:{updateSrc(){const{model:K}=this,de=K.get("src",{skipResolve:!0})||K.getSrcResult();K.addAttributes({src:de}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Zt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(K){var de,ue,Ae;return(Ae=(ue=(de=K.querySelector("img"))==null?void 0:de.closest("table"))==null?void 0:ue.closest("tr"))==null?void 0:Ae.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(_,{model:{...nn({model:Se}),defaults:{tagName:_,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(ne,{icon:q.alignHorizontalLeft,size:se.sx})},{id:"center",title:"Center",labelReact:c.jsx(ne,{icon:q.alignHorizontalCenter,size:se.sx})},{id:"right",title:"Right",labelReact:c.jsx(ne,{icon:q.alignHorizontalRight,size:se.sx})}]}]}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(ot)}}),n.addType(P,{model:{...nn({model:mt}),defaults:{tagName:P,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...mt.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(Ne)}}),n.addType(A,{model:{...nn({model:Ue,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"}]},Mt,He,qs]},getMjmlAttributes(){const K=us(this);return{...this.getDefaultIconProps()[K.name],...K}},getAttrToHTML(){const K=Ue.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[K.name],...K}},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:K,end:de}=dt.prototype.getMjmlTemplate.call(this);return{start:ls(K,this.model),end:de}},getInnerMjmlTemplate(){var Ae;const{start:K,end:de}=dt.prototype.getInnerMjmlTemplate.call(this),ue=((Ae=this.model.getInnerHTML())==null?void 0:Ae.trim())||"";return{start:`${K}${ue}`,end:de}},getChildrenContainer(){var Ae;const{el:K}=this,de=(Ae=K.querySelector("tbody > tr > td"))==null?void 0:Ae.nextElementSibling;return(de==null?void 0:de.firstElementChild)||K.querySelector("img")||K}}}),n.addType(M,{model:{...nn({model:st}),defaults:{tagName:M,traits:[]}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(wt)}}),n.addType($,{model:{...nn({model:J}),defaults:{tagName:$,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:Fa,getTemplateFromEl:gn(Y,!0),render(){this.renderAttributes();const K=this.getTemplateFromMjml();return this.el.innerHTML=K.content,this.$el.attr(K.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),ds(this.model),this}}}),n.addType(j,{model:{...nn({model:X}),defaults:{tagName:j,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:K,end:de}=Q.prototype.getMjmlTemplate.call(this);return{start:ls(K,this.model),end:de}},getTemplateFromEl(K){return K.querySelector(".mj-inline-links").innerHTML}}}),n.addType(D,{extendFn:["initToolbar"],model:{defaults:{tagName:D,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){$3(this,{id:"edit",command:()=>Re(this),label:`<svg viewBox="0 0 24 24">
174
+ </svg>`},toJSON:Pr(W)},view:{tagName:()=>"div",init(){const K=this.model.components();this.onRender=Bo(this.onRender,1),this.listenTo(K,"add remove reset change",this.onRender)},onRender(){const{model:K,el:ue}=this,de=K.getName({noCustom:!0}),xe=K.getInnerHTML();ue.innerHTML=`<b>${de}</b>: ${xe}`,ue.style.padding="5px 10px",ue.style.fontFamily="system-ui"}}}),n.addType(v,{isComponent:wa(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:Pr(W)},view:{render(){return this}}}),n.addType(u,{model:{...rn({model:$,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:{...rn({model:ee,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"],traits:[Wt]}},view:{attributes:{},getMjmlTemplate:qh,getTemplateFromEl:mn(G),init:XH}}),n.addType(S,{model:{...rn({model:R,noVoid:!0}),defaults:{tagName:S,"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:[Co,Wt],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:mn(le),getMjmlTemplate:qh,getChildrenSelector(){return this.model.getAttributes()["full-width"]==="full-width"?"table > tbody > tr > td > div table > tbody > tr > td":"table > tbody > tr > td"},render(){return St(this),this},attributes:{}}}),n.addType(O,{model:{...rn({model:he,noVoid:!0}),defaults:{tagName:O,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[Co]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:mn(tn,!0),getChildrenContainer(){return this.el},getMjmlTemplate:qh,render(){const K=this.getTemplateFromMjml(),ue=IS(K);return this.renderAttributes(),this.$el.attr(ue),this.el.innerHTML=K.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const JH=[x,T,E,_,M,P,A,D,L,O,k,j,Uo.carousel,Uo.carouselImage,Uo.accordion,Uo.accordionElement,Uo.accordionTitle,Uo.accordionText];n.addType(C,{model:{...rn({model:ge,noVoid:!0}),defaults:{tagName:C,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:K=>JH.includes(K.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var de;const K=(de=this.model.parent())==null?void 0:de.is(d),ue=TS(this.model,{withSiblings:!K,withHead:!K,beforeRootEnd:K?`<${u}><${S}><${C}/></${S}></${u}>`:""});return{start:ue.start,end:ue.end}},getTemplateFromEl:mn(Te,!0),getChildrenContainer(){const{el:K}=this;return K.querySelector("td > table tbody")||K.querySelector("table tbody")||K},render(){this.renderAttributes();const K=this.getTemplateFromMjml();return this.el.innerHTML=K.content,this.$el.attr(K.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),ps(this.model,!0),this}}}),n.addType(x,{model:{...rn({model:Ce}),defaults:{tagName:x,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:Ba,getTemplateFromEl:mn(tt),attributes:{style:"display: table; width: 100%"}}}),n.addType(E,{model:{...rn({model:Qe,noVoid:!0}),defaults:{tagName:E,traits:[He],stylable:[...Qe.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(Ot)}}),n.addType(T,{model:{...rn({model:ut}),defaults:{tagName:T,"style-default":{align:"center"},traits:[Mt,{id:"altText",name:"alt",placeholder:"Image description"},"title",He,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const K=ut.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete K.src,K},getMjmlAttributes(){const K=ds(this);return this.isDefaultSrc()&&delete K.src,K}},view:{updateSrc(){const{model:K}=this,ue=K.get("src",{skipResolve:!0})||K.getSrcResult();K.addAttributes({src:ue}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Yt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(K){var ue,de,xe;return(xe=(de=(ue=K.querySelector("img"))==null?void 0:ue.closest("table"))==null?void 0:de.closest("tr"))==null?void 0:xe.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(_,{model:{...rn({model:Se}),defaults:{tagName:_,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(re,{icon:q.alignHorizontalLeft,size:se.sx})},{id:"center",title:"Center",labelReact:c.jsx(re,{icon:q.alignHorizontalCenter,size:se.sx})},{id:"right",title:"Right",labelReact:c.jsx(re,{icon:q.alignHorizontalRight,size:se.sx})}]}]}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(ot)}}),n.addType(P,{model:{...rn({model:mt}),defaults:{tagName:P,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...mt.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(Ne)}}),n.addType(A,{model:{...rn({model:Ue,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"}]},Mt,He,Ks]},getMjmlAttributes(){const K=ds(this);return{...this.getDefaultIconProps()[K.name],...K}},getAttrToHTML(){const K=Ue.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[K.name],...K}},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:K,end:ue}=dt.prototype.getMjmlTemplate.call(this);return{start:cs(K,this.model),end:ue}},getInnerMjmlTemplate(){var xe;const{start:K,end:ue}=dt.prototype.getInnerMjmlTemplate.call(this),de=((xe=this.model.getInnerHTML())==null?void 0:xe.trim())||"";return{start:`${K}${de}`,end:ue}},getChildrenContainer(){var xe;const{el:K}=this,ue=(xe=K.querySelector("tbody > tr > td"))==null?void 0:xe.nextElementSibling;return(ue==null?void 0:ue.firstElementChild)||K.querySelector("img")||K}}}),n.addType(M,{model:{...rn({model:st}),defaults:{tagName:M,traits:[]}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(wt)}}),n.addType(k,{model:{...rn({model:J}),defaults:{tagName:k,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:Ba,getTemplateFromEl:mn(Y,!0),render(){this.renderAttributes();const K=this.getTemplateFromMjml();return this.el.innerHTML=K.content,this.$el.attr(K.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),ps(this.model),this}}}),n.addType(j,{model:{...rn({model:X}),defaults:{tagName:j,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:K,end:ue}=Q.prototype.getMjmlTemplate.call(this);return{start:cs(K,this.model),end:ue}},getTemplateFromEl(K){return K.querySelector(".mj-inline-links").innerHTML}}}),n.addType(D,{extendFn:["initToolbar"],model:{defaults:{tagName:D,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){H3(this,{id:"edit",command:()=>Re(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:Er(W)},view:{events:{dblclick:"onActive"},onActive(){Re(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:K=>{var de,ue;if(((de=K.tagName)==null?void 0:de.toLowerCase())===b&&((ue=K.getAttribute)==null?void 0:ue.call(K,"css-class"))===De)return{type:"textnode",components:[],content:""}}});const ZH=K=>{const{id:de,view:ue}=K,Ae=ue.prototype;n.addType(de,{view:{render(){return Ae.render.apply(this,arguments),hb(de,this),this}}})};[u,S,C,x,$,P,D].forEach(K=>ZH(n.getType(K))),n.getTypes().forEach(({id:K,view:de})=>{de.prototype.disableEditing&&n.addType(K,{view:{onDisable(ue={}){this.disableEditing({...ue,parserOptions:{htmlType:"text/html"}})}}})});const PS=()=>{const K="projectFonts",ue=e.Components.getWrapper().findFirstType(i);if(!ue)return;const Ae=ue.findFirstType(l)||ue.append({type:l})[0];Ae.findType(b).filter(or=>or.getAttributes()[Fe]===K||or.attributes[Rm]===ev).forEach(or=>or.remove());const kt=Qm(a.fonts);if(!kt)return;const rr=Ae.append({type:b,content:kt})[0];rr==null||rr.addAttributes({[Fe]:K})},OS=()=>{const K=e.Css.rules.filter(kt=>{const rr=kt.attributes.groups;return!!(rr!=null&&rr.some(or=>or.startsWith(`${De}:`)))}).map(kt=>kt.toCSS());if(!K.length)return;const ue=e.Components.getWrapper().findFirstType(Ni.root),Ae=ue.findFirstType(l)||ue.append({type:l})[0];(Ae.findType(b).find(kt=>kt.getAttributes()[Fe]===De)||Ae.append({type:b,attributes:{[Fe]:De}})[0]).set("content",K.join(`
177
- `))},YH=Fo(OS,100);e.on(Pn.pageSettingsUpdate,K=>{K.page||PS()}),e.on(e.events.projectLoad,({loaded:K})=>{K&&(OS(),PS())}),e.on(e.Parser.events.htmlBefore,K=>{var ue;const de=(ue=e.Parser.config.optionsHtml)==null?void 0:ue.codeSanitizer;K.input=Iv(K.input,{sanitizer:de})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${De}`,YH)})}function BM(e){const{Blocks:t}=e,n="Content",r="Layout",o={className:"h-7",full:!0,space:"s",nowrap:!0},s={category:r,full:!0},a="gjs-border-2 gjs-border-current gjs-rounded-sm",i=(l,u)=>{t.add(l,{select:!0,category:n,...u})};i("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
176
+ </svg>`})},toJSON:Pr(W)},view:{events:{dblclick:"onActive"},onActive(){Re(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:K=>{var ue,de;if(((ue=K.tagName)==null?void 0:ue.toLowerCase())===b&&((de=K.getAttribute)==null?void 0:de.call(K,"css-class"))===De)return{type:"textnode",components:[],content:""}}});const QH=K=>{const{id:ue,view:de}=K,xe=de.prototype;n.addType(ue,{view:{render(){return xe.render.apply(this,arguments),hb(ue,this),this}}})};[u,S,C,x,k,P,D].forEach(K=>QH(n.getType(K))),n.getTypes().forEach(({id:K,view:ue})=>{ue.prototype.disableEditing&&n.addType(K,{view:{onDisable(de={}){this.disableEditing({...de,parserOptions:{htmlType:"text/html"}})}}})});const PS=()=>{const K="projectFonts",de=e.Components.getWrapper().findFirstType(i);if(!de)return;const xe=de.findFirstType(l)||de.append({type:l})[0];xe.findType(b).filter(sr=>sr.getAttributes()[Fe]===K||sr.attributes[Rm]===ev).forEach(sr=>sr.remove());const It=Qm(a.fonts);if(!It)return;const Fn=xe.append({type:b,content:It})[0];Fn==null||Fn.addAttributes({[Fe]:K})},OS=()=>{const K=e.Css.rules.filter(It=>{const Fn=It.attributes.groups;return!!(Fn!=null&&Fn.some(sr=>sr.startsWith(`${De}:`)))}).map(It=>It.toCSS());if(!K.length)return;const de=e.Components.getWrapper().findFirstType(ki.root);if(!de)return;const xe=de.findFirstType(l)||de.append({type:l})[0];(xe.findType(b).find(It=>It.getAttributes()[Fe]===De)||xe.append({type:b,attributes:{[Fe]:De}})[0]).set("content",K.join(`
177
+ `))},RH=Bo(OS,100);e.on(On.pageSettingsUpdate,K=>{K.page||PS()}),e.on(e.events.projectLoad,({loaded:K})=>{K&&(OS(),PS())}),e.on(e.Parser.events.htmlBefore,K=>{var de;const ue=(de=e.Parser.config.optionsHtml)==null?void 0:de.codeSanitizer;K.input=Iv(K.input,{sanitizer:ue})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${De}`,RH)})}function GM(e){const{Blocks:t}=e,n="Content",r="Layout",o={className:"h-7",full:!0,space:"s",nowrap:!0},s={category:r,full:!0},a="gjs-border-2 gjs-border-current gjs-rounded-sm",i=(l,u)=>{t.add(l,{select:!0,category:n,...u})};i("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}),i("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>"}),i("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="${WS}"/>`,activate:!0}),i("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
183
+ </svg>`,content:`<mj-image src="${qS}"/>`,activate:!0}),i("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/>"}),i("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" />
@@ -253,11 +253,11 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
253
253
  <mj-column></mj-column>
254
254
  <mj-column></mj-column>
255
255
  <mj-column></mj-column>
256
- </mj-section>`})}const zM=(e,t)=>({[xt.web]:r=>Xf(r,t),[xt.document]:r=>Xf(r,t),[xt.react]:r=>Xf(r,t),[xt.email]:r=>FM(r,t)})[e],Ea="https://cdn.jsdelivr.net/npm/",rp={id:"gjs-blocks-basic",src:`${Ea}grapesjs-blocks-basic@1.0.1/dist/index.js`},UM={id:"grapesjs-plugin-forms",src:`${Ea}grapesjs-plugin-forms@2.0.5/dist/index.js`},op={id:"grapesjs-parser-postcss",src:`${Ea}grapesjs-parser-postcss@1.0.1/dist/index.js`},WM={id:"grapesjs-navbar",src:`${Ea}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},sp={id:"grapesjs-plugin-export",src:`${Ea}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)}}},GM={id:"grapesjs-mjml",src:`${Ea}grapesjs-mjml@1.0.7/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},qM={[xt.email]:[BM,GM],[xt.web]:[rp,UM,sp,op,WM],[xt.document]:[rp,sp,op],[xt.react]:[rp,sp,op]};function KM(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",r=>{const o=-r.canvasOffset.left;r.left<o&&(r.left=o)})}function gb({onCopy:e,getValue:t,value:n,title:r="Copy",...o}){const[s,a]=h.useState(!1),i=()=>{IS((t==null?void 0:t())??n),a(!0),e==null||e()};return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>a(!1),3e3);return()=>clearTimeout(l)},[s]),c.jsx(Ct,{onClick:i,title:r,type:"button",size:"lg",withBg:!0,...o,children:c.jsx(ne,{className:ae(s&&z.tA),icon:s?q.check:q.contentCopy,size:se.s})})}const ZM=(e,t)=>e.filter(n=>n.id===t)[0]||null,mb=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),YM=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,vb=Z("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),ap={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]};function bb(e){var s;const{option:t,active:n,selected:r}=e,o=((s=e.isSelected)==null?void 0:s.call(e))||!0;return c.jsxs(I,{items:"center",className:Z([Te.xy,n&&xd.bgH]),children:[c.jsx(B,{className:Z("truncate"),grow:!0,children:t.label}),c.jsx(B,{className:Z("gjs-pl-2"),children:mb(t,r)&&o&&c.jsx(ne,{className:Z(z.tA),icon:q.check,size:se.s})})]})}const XM="gs-select-field";function yb({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(ne,{...ct(e.icon)?{icon:e.icon,size:se.s2x}:e.icon}),c.jsx(B,{className:Z("truncate"),grow:!0,children:e.content||e.label})]})}function Le(e){const{value:t,onChange:n,onBlur:r,onFocus:o,handlerSelected:s,label:a,options:i,includeEmpty:l,className:u,search:d,open:f,caret:p=q.chevronDown,size:g="m",border:m,emptyState:v="- Select an option -",name:b,required:w,disabled:y,classNameContainer:S,autoFocus:C,labelAs:x,hideCaret:E}=e,[T,_]=h.useState(null),[O,P]=h.useState(null),[A,M]=h.useState(""),{styles:$,attributes:j}=wi(T,O,ap),L=typeof d=="object"?d.onChange:void 0,D=[...i].filter(ee=>d?L||YM(ee,A):ee),W=d&&(typeof d=="object"&&d.value||A),F=W&&D.length?D[0]:ZM(D,t),k=ee=>n(ee.id,ee),H={id:null,label:v},V=(F==null?void 0:F.content)||(F==null?void 0:F.label),U=F?s?s(F):F.icon?c.jsx(I,{items:"center",gap:"s",children:c.jsx(yb,{option:F})}):V:s?s(H):v;l&&D.unshift(H);const J=ee=>{const{value:G}=ee.target,R=G.trim();switch(ee.key){case"Escape":n(null);break;case"Enter":n((D.length?D[0].id:R)||null,D[0]);break;case" ":ps(ee);break}},Y=N("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",te.rnd,ni.focus),X=()=>{r==null||r()},Q=Go({...e,className:N(XM,S,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(di,{value:F,onChange:k,disabled:y,children:({open:ee})=>c.jsxs("div",{...Q,children:[a&&c.jsx(di.Label,{as:x,className:e.classNameLabel,children:c.jsx(br,{as:"span",...e})}),b&&c.jsx("input",{type:"input",name:b,value:(F==null?void 0:F.id)??"",onChange:()=>{},className:Z("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:w,disabled:y}),c.jsx(di.Button,{ref:_,className:Y,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:C,value:typeof d=="object"&&d.value||A,className:N([u,"gs-utl-w-full",te.rnd,ni.focus,Te.xyS]),onChange:G=>{M(G.target.value),L==null||L(G.target.value)},onKeyDown:J,onClick:ps,onBlur:X,onFocus:o}):c.jsx(Yn,{border:m,size:g,title:U,icon:E?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:p,shadow:!1,className:Z(u),titleClass:"",disabled:y})}),c.jsx(di.Options,{static:f,className:vb,ref:P,style:$.popper,...j.popper,children:c.jsxs(Yn,{padding:!1,className:Z("h-full"),style:{minWidth:`${T==null?void 0:T.offsetWidth}px`,maxHeight:200},children:[!D.length&&d&&d!==!0&&c.jsx("div",{className:Z(Te.xy),children:d.empty}),D.map((G,R)=>c.jsx(di.Option,{value:G,children:({active:le})=>c.jsxs(I,{items:"center",gap:"s",className:Z([G.className,Te.xy,le&&xd.bgH]),nowrap:!0,children:[c.jsx(yb,{option:G}),c.jsx(B,{className:Z("gjs-pl-2"),children:mb(G,F)&&!W&&c.jsx(ne,{className:Z(z.tA),icon:q.check,size:se.s})})]})},R))]})})]})})}const wb=h.createContext(null),JM=({children:e})=>{const[t,n]=h.useState({setEditor:r=>{n(o=>({...o,editor:r}))}});return c.jsx(wb.Provider,{value:t,children:e})},Jn=()=>{const e=h.useContext(wb);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},Di=()=>{const{editor:e}=Jn();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},QM=()=>Jn().editor,Sb=h.createContext(null),RM=({children:e})=>{const[t,n]=h.useState(()=>({setRefCanvas(r){n(o=>({...o,refCanvas:r}))},setCustomModal(r){n(o=>({...o,customModal:r}))},setCustomAssets(r){n(o=>({...o,customAssets:r}))},setCustomBlocks(r){n(o=>({...o,customBlocks:r}))},setCustomRte(r){n(o=>({...o,customRte:r}))},setCustomStyles(r){n(o=>({...o,customStyles:r}))},setCustomLayers(r){n(o=>({...o,customLayers:r}))},setCustomSelectors(r){n(o=>({...o,customSelectors:r}))},setCustomTraits(r){n(o=>({...o,customTraits:r}))},setReady(r){n(o=>({...o,ready:r}))}}));return c.jsx(Sb.Provider,{value:t,children:e})},Dr=()=>{const e=h.useContext(Sb);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function eN(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function qo(e){return typeof e=="function"}function yr(){}const Cb=e=>typeof e=="string",tN=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},xb=e=>{const t=Cb(e)?{id:e,src:e}:e;return new Promise((n,r)=>{const o=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);o.src=t.src,o.onload=()=>n(t.id),o.onerror=()=>r(t.id),document.head.appendChild(o)})},nN=e=>{const t=e.map(n=>xb(n));return Promise.allSettled(t)},Eb=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(Cb(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Tb=new WeakMap;function Ta(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Tb.get(e);if(t)return t;const n=function({children:r}){return Fn.createPortal(h.createElement("div",null,r),e)};return Tb.set(e,n),n}h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(!1),[s,a]=h.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return h.useEffect(()=>{if(!t)return;const i=t.Assets.events.custom,l=({open:u,assets:d,types:f,select:p,close:g,container:m})=>{u&&a({assets:d,types:f,select:p,close:g,Container:Ta(m)}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?qo(e)?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(()=>({blocks:[],dragStart:yr,dragStop:yr,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const s=t.Blocks.events.custom,a=({blocks:i,container:l,dragStart:u,dragStop:d})=>{const f=i.reduce((p,g)=>{const m=g.getCategoryLabel(),v=p.get(m);return v?v.push(g):p.set(m,[g]),p},new Map);o({blocks:i,dragStart:u,dragStop:d,mapCategoryBlocks:f,Container:Ta(l)})};return t.on(s,a),t.Blocks.__trgCustom(),()=>{t.off(s,a)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function rN({children:e,...t}){const n=Dr(),r=h.useRef(null);return h.useEffect(()=>{r.current&&n.setRefCanvas(r.current)},[r.current]),c.jsx("div",{...t,ref:r,children:e})}const oN=h.memo(function({children:e}){const{editor:t}=Jn(),[n,r]=h.useState(()=>({devices:[],selected:"",select:yr}));return h.useEffect(()=>{if(!t)return;const{Devices:o}=t,s=o.events.all,a=()=>{var i;r({devices:o.getDevices(),selected:(i=o.getSelected())==null?void 0:i.id,select:l=>o.select(l)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?qo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),sN=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function aN(e){const t=e.map(({id:s,src:a})=>({id:s,src:a})),n=e.reduce((s,a)=>(s[a.id]=a,s),{}),r=[],o=[];return(await nN(t)).forEach(s=>{s.status==="fulfilled"?r.push(n[s.value]):o.push(n[s.reason])}),{loaded:r,failed:o}}const iN=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{sN(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await aN(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},lN=h.memo(function({children:e,className:t,style:n,options:r={},plugins:o=[],grapesjs:s,grapesjsCss:a,onEditor:i=yr,onReady:l,onUpdate:u,waitReady:d,...f}){const{setEditor:p}=Jn(),g=Dr(),[m,v]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{if(!g.ready||!b.current)return;const T=b.current,_=g.refCanvas;let O,P={},A=[];const M=$=>{const j={height:"100%",...r,plugins:[...A,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...P},modal:{custom:!!g.customModal,...r.modal},assetManager:{custom:!!g.customAssets,...r.assetManager},styleManager:{custom:!!g.customStyles,...r.styleManager},blockManager:{custom:!!g.customBlocks,...r.blockManager},richTextEditor:{custom:!!g.customRte,...r.richTextEditor},layerManager:{custom:!!g.customLayers,...r.layerManager},traitManager:{custom:!!g.customTraits,...r.traitManager},selectorManager:{custom:!!g.customSelectors,...r.selectorManager},container:_||T,customUI:!!_,..._?{panels:{defaults:[]}}:{}};O=$.init(j),p(O),i(O),u&&O.on("update",()=>{u(O.getProjectData(),O)}),O.onReady(()=>{v(!0),l==null||l(O)})};return(async()=>{a&&await tN(a);const $=await iN(o);A=$.plugins,P=$.pluginOptions,typeof s=="string"?(await xb(s),M(window.grapesjs)):M(s)})(),()=>O==null?void 0:O.destroy()},[g.ready]);const w=r.height??"100%",y=r.width??"100%",S=eN("gjs-editor-wrapper",t),C=d&&!m,x=h.useMemo(()=>({...n,height:w,width:y}),[w,y,n]),E=h.useMemo(()=>({...x,...C?{opacity:0,width:0,height:0}:{}}),[x,C]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:S,style:x,children:d}):null,c.jsx("div",{...f,ref:b,className:S,style:E,children:e})]})}),cN=h.memo(function(){const e=Dr();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(JM,{children:c.jsx(RM,{children:c.jsxs(lN,{...t,children:[e,c.jsx(cN,{})]})})})});const Pb=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Layers:s}=t,a=s.events.custom,i=({container:l})=>{o({root:s.getRoot(),Container:Ta(l)})};return t.on(a,i),s.__trgCustom({}),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomLayers(!0),[]),t?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(!1),[s,a]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:yr});return h.useEffect(()=>{if(!t)return;const i="modal",l=({open:u,title:d,content:f,close:p,attributes:g})=>{u&&a({title:h.createElement(Eb(d)),content:h.createElement(Eb(f)),attributes:g,close:p}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const Ob=h.memo(function({children:e}){const{editor:t}=Jn(),[n,r]=h.useState(()=>({pages:[],selected:void 0,select:yr,add:yr,remove:yr}));return h.useEffect(()=>{if(!t)return;const{Pages:o}=t,s=o.events.all,a=()=>{r({pages:o.getAll(),selected:o.getSelected(),select:(...i)=>o.select(...i),add:(...i)=>o.add(...i),remove:(...i)=>o.remove(...i)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?qo(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),_b=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:yr,removeSelector:yr,setState:yr,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Selectors:s}=t,a=s.events.custom,i=({container:l})=>{o({selectors:s.getSelected(),states:s.getStates(),selectedState:s.getState(),targets:s.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>s.addSelected(...u),removeSelector:(...u)=>s.removeSelected(...u),setState:(...u)=>s.setState(...u),Container:Ta(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomSelectors(!0),[]),t?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Ab=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Styles:s}=t,a=s.events.custom,i=({container:l})=>{o({sectors:s.getSectors({visible:!0}),Container:Ta(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomStyles(!0),[]),t?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),ip=h.memo(function({children:e}){const{editor:t}=Jn(),n=Dr(),[r,o]=h.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Traits:s}=t,a=s.events.custom,i=({container:l})=>{o({traits:s.getCurrent(),Container:Ta(l)})};return t.on(a,i),s.__trgCustom(),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomTraits(!0),[]),t?qo(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Fi=({children:e})=>QM()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function lp(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 qM=(e,t)=>({[xt.web]:r=>Xp(r,t),[xt.document]:r=>Xp(r,t),[xt.react]:r=>Xp(r,t),[xt.email]:r=>WM(r,t)})[e],Ta="https://cdn.jsdelivr.net/npm/",rf={id:"gjs-blocks-basic",src:`${Ta}grapesjs-blocks-basic@1.0.1/dist/index.js`},KM={id:"grapesjs-plugin-forms",src:`${Ta}grapesjs-plugin-forms@2.0.5/dist/index.js`},of={id:"grapesjs-parser-postcss",src:`${Ta}grapesjs-parser-postcss@1.0.1/dist/index.js`},ZM={id:"grapesjs-navbar",src:`${Ta}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},sf={id:"grapesjs-plugin-export",src:`${Ta}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)}}},YM={id:"grapesjs-mjml",src:`${Ta}grapesjs-mjml@1.0.7/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},XM={[xt.email]:[GM,YM],[xt.web]:[rf,KM,sf,of,ZM],[xt.document]:[rf,sf,of],[xt.react]:[rf,sf,of]};function JM(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",r=>{const o=-r.canvasOffset.left;r.left<o&&(r.left=o)})}function gb({onCopy:e,getValue:t,value:n,title:r="Copy",...o}){const[s,a]=h.useState(!1),i=()=>{HS((t==null?void 0:t())??n),a(!0),e==null||e()};return h.useEffect(()=>{if(!s)return;const l=setTimeout(()=>a(!1),3e3);return()=>clearTimeout(l)},[s]),c.jsx(Ct,{onClick:i,title:r,type:"button",size:"lg",withBg:!0,...o,children:c.jsx(re,{className:ae(s&&z.tA),icon:s?q.check:q.contentCopy,size:se.s})})}const QM=(e,t)=>e.filter(n=>n.id===t)[0]||null,mb=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),RM=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,vb=Z("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),af={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]};function bb(e){var s;const{option:t,active:n,selected:r}=e,o=((s=e.isSelected)==null?void 0:s.call(e))||!0;return c.jsxs(I,{items:"center",className:Z([Pe.xy,n&&Ed.bgH]),children:[c.jsx(B,{className:Z("truncate"),grow:!0,children:t.label}),c.jsx(B,{className:Z("gjs-pl-2"),children:mb(t,r)&&o&&c.jsx(re,{className:Z(z.tA),icon:q.check,size:se.s})})]})}const eN="gs-select-field";function yb({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(re,{...ct(e.icon)?{icon:e.icon,size:se.s2x}:e.icon}),c.jsx(B,{className:Z("truncate"),grow:!0,children:e.content||e.label})]})}function Le(e){const{value:t,onChange:n,onBlur:r,onFocus:o,handlerSelected:s,label:a,options:i,includeEmpty:l,className:u,search:d,open:p,caret:f=q.chevronDown,size:g="m",border:m,emptyState:v="- Select an option -",name:b,required:w,disabled:y,classNameContainer:S,autoFocus:C,labelAs:x,hideCaret:E}=e,[T,_]=h.useState(null),[O,P]=h.useState(null),[A,M]=h.useState(""),{styles:k,attributes:j}=Si(T,O,af),L=typeof d=="object"?d.onChange:void 0,D=[...i].filter(ee=>d?L||RM(ee,A):ee),W=d&&(typeof d=="object"&&d.value||A),F=W&&D.length?D[0]:QM(D,t),$=ee=>n(ee.id,ee),H={id:null,label:v},V=(F==null?void 0:F.content)||(F==null?void 0:F.label),U=F?s?s(F):F.icon?c.jsx(I,{items:"center",gap:"s",children:c.jsx(yb,{option:F})}):V:s?s(H):v;l&&D.unshift(H);const J=ee=>{const{value:G}=ee.target,R=G.trim();switch(ee.key){case"Escape":n(null);break;case"Enter":n((D.length?D[0].id:R)||null,D[0]);break;case" ":hs(ee);break}},Y=N("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",te.rnd,ri.focus),X=()=>{r==null||r()},Q=qo({...e,className:N(eN,S,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(pi,{value:F,onChange:$,disabled:y,children:({open:ee})=>c.jsxs("div",{...Q,children:[a&&c.jsx(pi.Label,{as:x,className:e.classNameLabel,children:c.jsx(wr,{as:"span",...e})}),b&&c.jsx("input",{type:"input",name:b,value:(F==null?void 0:F.id)??"",onChange:()=>{},className:Z("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:w,disabled:y}),c.jsx(pi.Button,{ref:_,className:Y,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:C,value:typeof d=="object"&&d.value||A,className:N([u,"gs-utl-w-full",te.rnd,ri.focus,Pe.xyS]),onChange:G=>{M(G.target.value),L==null||L(G.target.value)},onKeyDown:J,onClick:hs,onBlur:X,onFocus:o}):c.jsx(Jn,{border:m,size:g,title:U,icon:E?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:f,shadow:!1,className:Z(u),titleClass:"",disabled:y})}),c.jsx(pi.Options,{static:p,className:vb,ref:P,style:k.popper,...j.popper,children:c.jsxs(Jn,{padding:!1,className:Z("h-full"),style:{minWidth:`${T==null?void 0:T.offsetWidth}px`,maxHeight:200},children:[!D.length&&d&&d!==!0&&c.jsx("div",{className:Z(Pe.xy),children:d.empty}),D.map((G,R)=>c.jsx(pi.Option,{value:G,children:({active:le})=>c.jsxs(I,{items:"center",gap:"s",className:Z([G.className,Pe.xy,le&&Ed.bgH]),nowrap:!0,children:[c.jsx(yb,{option:G}),c.jsx(B,{className:Z("gjs-pl-2"),children:mb(G,F)&&!W&&c.jsx(re,{className:Z(z.tA),icon:q.check,size:se.s})})]})},R))]})})]})})}const wb=h.createContext(null),tN=({children:e})=>{const[t,n]=h.useState({setEditor:r=>{n(o=>({...o,editor:r}))}});return c.jsx(wb.Provider,{value:t,children:e})},Rn=()=>{const e=h.useContext(wb);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},Fi=()=>{const{editor:e}=Rn();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},nN=()=>Rn().editor,Sb=h.createContext(null),rN=({children:e})=>{const[t,n]=h.useState(()=>({setRefCanvas(r){n(o=>({...o,refCanvas:r}))},setCustomModal(r){n(o=>({...o,customModal:r}))},setCustomAssets(r){n(o=>({...o,customAssets:r}))},setCustomBlocks(r){n(o=>({...o,customBlocks:r}))},setCustomRte(r){n(o=>({...o,customRte:r}))},setCustomStyles(r){n(o=>({...o,customStyles:r}))},setCustomLayers(r){n(o=>({...o,customLayers:r}))},setCustomSelectors(r){n(o=>({...o,customSelectors:r}))},setCustomTraits(r){n(o=>({...o,customTraits:r}))},setReady(r){n(o=>({...o,ready:r}))}}));return c.jsx(Sb.Provider,{value:t,children:e})},Br=()=>{const e=h.useContext(Sb);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function oN(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function Ko(e){return typeof e=="function"}function Sr(){}const Cb=e=>typeof e=="string",sN=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},xb=e=>{const t=Cb(e)?{id:e,src:e}:e;return new Promise((n,r)=>{const o=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);o.src=t.src,o.onload=()=>n(t.id),o.onerror=()=>r(t.id),document.head.appendChild(o)})},aN=e=>{const t=e.map(n=>xb(n));return Promise.allSettled(t)},Eb=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(Cb(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Tb=new WeakMap;function Pa(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Tb.get(e);if(t)return t;const n=function({children:r}){return zn.createPortal(h.createElement("div",null,r),e)};return Tb.set(e,n),n}h.memo(function({children:e}){const{editor:t}=Rn(),n=Br(),[r,o]=h.useState(!1),[s,a]=h.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return h.useEffect(()=>{if(!t)return;const i=t.Assets.events.custom,l=({open:u,assets:d,types:p,select:f,close:g,container:m})=>{u&&a({assets:d,types:p,select:f,close:g,Container:Pa(m)}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?Ko(e)?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),h.memo(function({children:e}){const{editor:t}=Rn(),n=Br(),[r,o]=h.useState(()=>({blocks:[],dragStart:Sr,dragStop:Sr,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const s=t.Blocks.events.custom,a=({blocks:i,container:l,dragStart:u,dragStop:d})=>{const p=i.reduce((f,g)=>{const m=g.getCategoryLabel(),v=f.get(m);return v?v.push(g):f.set(m,[g]),f},new Map);o({blocks:i,dragStart:u,dragStop:d,mapCategoryBlocks:p,Container:Pa(l)})};return t.on(s,a),t.Blocks.__trgCustom(),()=>{t.off(s,a)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?Ko(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function iN({children:e,...t}){const n=Br(),r=h.useRef(null);return h.useEffect(()=>{r.current&&n.setRefCanvas(r.current)},[r.current]),c.jsx("div",{...t,ref:r,children:e})}const lN=h.memo(function({children:e}){const{editor:t}=Rn(),[n,r]=h.useState(()=>({devices:[],selected:"",select:Sr}));return h.useEffect(()=>{if(!t)return;const{Devices:o}=t,s=o.events.all,a=()=>{var i;r({devices:o.getDevices(),selected:(i=o.getSelected())==null?void 0:i.id,select:l=>o.select(l)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?Ko(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),cN=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function uN(e){const t=e.map(({id:s,src:a})=>({id:s,src:a})),n=e.reduce((s,a)=>(s[a.id]=a,s),{}),r=[],o=[];return(await aN(t)).forEach(s=>{s.status==="fulfilled"?r.push(n[s.value]):o.push(n[s.reason])}),{loaded:r,failed:o}}const dN=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{cN(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await uN(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},pN=h.memo(function({children:e,className:t,style:n,options:r={},plugins:o=[],grapesjs:s,grapesjsCss:a,onEditor:i=Sr,onReady:l,onUpdate:u,waitReady:d,...p}){const{setEditor:f}=Rn(),g=Br(),[m,v]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{if(!g.ready||!b.current)return;const T=b.current,_=g.refCanvas;let O,P={},A=[];const M=k=>{const j={height:"100%",...r,plugins:[...A,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...P},modal:{custom:!!g.customModal,...r.modal},assetManager:{custom:!!g.customAssets,...r.assetManager},styleManager:{custom:!!g.customStyles,...r.styleManager},blockManager:{custom:!!g.customBlocks,...r.blockManager},richTextEditor:{custom:!!g.customRte,...r.richTextEditor},layerManager:{custom:!!g.customLayers,...r.layerManager},traitManager:{custom:!!g.customTraits,...r.traitManager},selectorManager:{custom:!!g.customSelectors,...r.selectorManager},container:_||T,customUI:!!_,..._?{panels:{defaults:[]}}:{}};O=k.init(j),f(O),i(O),u&&O.on("update",()=>{u(O.getProjectData(),O)}),O.onReady(()=>{v(!0),l==null||l(O)})};return(async()=>{a&&await sN(a);const k=await dN(o);A=k.plugins,P=k.pluginOptions,typeof s=="string"?(await xb(s),M(window.grapesjs)):M(s)})(),()=>O==null?void 0:O.destroy()},[g.ready]);const w=r.height??"100%",y=r.width??"100%",S=oN("gjs-editor-wrapper",t),C=d&&!m,x=h.useMemo(()=>({...n,height:w,width:y}),[w,y,n]),E=h.useMemo(()=>({...x,...C?{opacity:0,width:0,height:0}:{}}),[x,C]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:S,style:x,children:d}):null,c.jsx("div",{...p,ref:b,className:S,style:E,children:e})]})}),fN=h.memo(function(){const e=Br();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(tN,{children:c.jsx(rN,{children:c.jsxs(pN,{...t,children:[e,c.jsx(fN,{})]})})})});const Pb=h.memo(function({children:e}){const{editor:t}=Rn(),n=Br(),[r,o]=h.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Layers:s}=t,a=s.events.custom,i=({container:l})=>{o({root:s.getRoot(),Container:Pa(l)})};return t.on(a,i),s.__trgCustom({}),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomLayers(!0),[]),t?Ko(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=Rn(),n=Br(),[r,o]=h.useState(!1),[s,a]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:Sr});return h.useEffect(()=>{if(!t)return;const i="modal",l=({open:u,title:d,content:p,close:f,attributes:g})=>{u&&a({title:h.createElement(Eb(d)),content:h.createElement(Eb(p)),attributes:g,close:f}),o(u)};return t.on(i,l),()=>{t.off(i,l)}},[t]),h.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:r,...s}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const Ob=h.memo(function({children:e}){const{editor:t}=Rn(),[n,r]=h.useState(()=>({pages:[],selected:void 0,select:Sr,add:Sr,remove:Sr}));return h.useEffect(()=>{if(!t)return;const{Pages:o}=t,s=o.events.all,a=()=>{r({pages:o.getAll(),selected:o.getSelected(),select:(...i)=>o.select(...i),add:(...i)=>o.add(...i),remove:(...i)=>o.remove(...i)})};return t.on(s,a),a(),()=>{t.off(s,a)}},[t]),t?Ko(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),_b=h.memo(function({children:e}){const{editor:t}=Rn(),n=Br(),[r,o]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:Sr,removeSelector:Sr,setState:Sr,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Selectors:s}=t,a=s.events.custom,i=({container:l})=>{o({selectors:s.getSelected(),states:s.getStates(),selectedState:s.getState(),targets:s.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>s.addSelected(...u),removeSelector:(...u)=>s.removeSelected(...u),setState:(...u)=>s.setState(...u),Container:Pa(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomSelectors(!0),[]),t?Ko(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Ab=h.memo(function({children:e}){const{editor:t}=Rn(),n=Br(),[r,o]=h.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Styles:s}=t,a=s.events.custom,i=({container:l})=>{o({sectors:s.getSectors({visible:!0}),Container:Pa(l)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomStyles(!0),[]),t?Ko(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),lf=h.memo(function({children:e}){const{editor:t}=Rn(),n=Br(),[r,o]=h.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Traits:s}=t,a=s.events.custom,i=({container:l})=>{o({traits:s.getCurrent(),Container:Pa(l)})};return t.on(a,i),s.__trgCustom(),()=>{t.off(a,i)}},[t]),h.useEffect(()=>n.setCustomTraits(!0),[]),t?Ko(e)?e(r):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Bi=({children:e})=>nN()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function cf(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 Lb=ce(function(){const t=Di(),n=Ie(),{Styles:r}=t,{isDarkTheme:o}=jr(),s=r.getSelected(),[a,i]=h.useState(0),l=s?lp(s==null?void 0:s.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const p=()=>i(m=>++m),g=r.events.custom;return t.on(g,p),()=>{t.off(g,p)}},[r,t]);const f=()=>{if(u){const p=t.Parser.parseCss(u)[0];p&&(s==null||s.setStyle(p.style))}};return c.jsxs(I,{className:Z("relative"),col:!0,full:!0,children:[c.jsx(B,{grow:!0,children:s?c.jsx(ho,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:o,clean:!0},a):n.t("noCode")}),c.jsx(Ke,{className:Z("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:f,children:n.t("update")})]})}),Mb=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],uN=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(re.projectFiles),r={};for(const o in n){const s=n[o],{filename:a,content:i}=s;if(s.path){const l=s.path.split("/").filter(Boolean);let u=r;for(const d of l)u[d]=u[d]||{},u=u[d];u[a]=i}else r[a]=i}return r}})},dN=ce(function(t){const n=Ie(),r=we(),{isProjectTypeEmail:o}=r,s=r.editor,[a,i]=h.useState(Mb[0].id),[l,u]=h.useState(),{isDarkTheme:d}=jr(),[f]=h.useState(()=>lp(s.getCss())),[p,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),v={...t.options,...o?{export:!1}:{}},b=()=>uN(s);h.useEffect(()=>{(async()=>{var T,_;const S=await s.runCommand(re.projectFiles,{page:s.Pages.getSelected(),skipProject:!0,styles:"skip"}),C=((T=S.find(O=>O.mimeType==="text/html"))==null?void 0:T.content)??"",x=((_=S.find(O=>O.mimeType==="text/mjml"))==null?void 0:_.content)??"";u(a==="mjml"?x:C)})()},[a]),h.useEffect(()=>{var y;p&&((y=p.getModel())==null||y.setValue(l),db(p))},[p,l]);const w={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{className:Z("h-96"),space:"m",children:[c.jsxs(B,{className:Z("relative"),grow:!0,children:[o&&c.jsxs(I,{className:Z("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(Le,{value:a,onChange:i,options:Mb,className:Z("min-w-24")}),c.jsx(gb,{getValue:()=>p.getModel().getValue()})]}),l!==void 0&&c.jsx(ho,{defaultValue:l,language:"html",onMount:g,...w})]}),!o&&c.jsx(B,{grow:!0,children:c.jsx(ho,{defaultValue:f,language:"css",...w})})]}),v.export!==!1&&c.jsx(I,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:b,children:m("exportButton")})})]})});function fN(e,t){h.useEffect(()=>{const n="pointerdown",{current:r}=e;if(!r||!t.enabled)return;function o(s){const a=s.target;r&&a&&!r.contains(a)&&t.onTrigger(a)}return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}},[e.current,t.enabled])}const Nb=e=>{const{ref:t,show:n,node:r,styles:o,update:s,reload:a}=e,i={all:"initial",zIndex:"10",fontFamily:"inherit",...o};h.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const f=l.attachShadow({mode:"closed"});l.__sh=_S.createRoot(f)}l.__sh.render(r),Object.keys(i).forEach(f=>{l.style.setProperty(GS(f),i[f],"important")});const u=new MutationObserver(a);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(f=>{Array.from(f[0].removedNodes).includes(l)&&a()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,s])},pN="gs-cmp-popover";function wr({children:e,handler:t,title:n,size:r,padding:o=!0,border:s=!0,overlay:a,clickAway:i,topIcon:l,placement:u="auto",offset:d,open:f,onClose:p,buttonAs:g,className:m,classNameBody:v,buttonProps:b={},disabled:w,hideCloseButton:y}){const[S,C]=h.useState(!!f),[x,E]=h.useState(S),[T,_]=h.useState(null),[O,P]=h.useState(null),A=wi(T,O,{...Fh({offset:d}),placement:u}),M=()=>{E(!1),p==null||p()};fN({current:O},{onTrigger:M,enabled:i&&S}),h.useEffect(()=>{E(!!f)},[f]),h.useEffect(()=>{var L;S&&((L=A.update)==null||L.call(A))},[S,A.update]),h.useEffect(()=>{const L=setTimeout(()=>C(x),10);return()=>clearTimeout(L)},[x]);const $=Z("w-full transition-colors",w&&"pointer-events-none",...O1({border:!1,size:"",...b})),j=Z(["fixed z-20",l&&"gjs-mt-5",r==="s"&&"w-full max-w-64",r==="sm"&&"w-full max-w-sm",r==="md"&&"w-full max-w-md"]);return c.jsxs(nf,{className:Z(pN,"relative flex",m),children:[c.jsx(nf.Button,{ref:_,as:g,className:$,children:c.jsx("div",{onClick:L=>{ps(L),!(Ht(f)||w)&&E(!S)},children:t})}),S&&a&&c.jsx("div",{onClick:M,className:Z("z-10 fixed inset-0")}),x&&c.jsx(nf.Panel,{static:!0,className:j,ref:P,style:A.styles.popper,...A.attributes.popper,children:c.jsx(gf,{as:h.Fragment,show:S,unmount:!1,...S1,children:c.jsx(Yn,{classNameBody:v,title:n,onClose:y?void 0:M,padding:o,border:s,children:typeof e=="function"?e({close:M,open:S}):e})})})]})}function Pa(e){const{action:t,icon:n,label:r,className:o,items:s,onItemClick:a,selected:i,...l}=e,u=h.useRef(null),[d,f]=h.useState(),p=u.current,g=N([o,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",z.br,Te.xy,te.bb,l.disabled&&Pe.disabled,...t?[z.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=b=>{et(t)&&(t({event:b}),a==null||a({event:b,item:e}))};h.useEffect(()=>{if(!p)return;const b=setTimeout(()=>f(p.getBoundingClientRect()),l.active?0:Cd);return()=>clearTimeout(b)},[p,l.active]);const v=()=>{var b;return(b=l.onActive)==null?void 0:b.call(l)};return c.jsxs(I,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:v,children:[n&&c.jsx(B,{children:c.jsx(ne,{icon:n,size:se.sx})}),!!r&&c.jsx(B,{className:N(l.classNameLabel,Pe.txtEllips),grow:!0,children:r}),!!i&&c.jsx(B,{children:c.jsx(ne,{className:z.tA,icon:q.check,size:se.s})}),!!(s!=null&&s.length)&&c.jsxs(c.Fragment,{children:[c.jsx(B,{children:c.jsx(ne,{icon:q.chevronRight,size:se.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(vH,{items:s,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:a,open:!0})]})]})}const kc=({className:e,grow:t,alignItems:n,justifyContent:r})=>N(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",r==="start"&&"gs-utl-justify-start",r==="end"&&"gs-utl-justify-end",r==="center"&&"gs-utl-justify-center",r==="between"&&"gs-utl-justify-between",r==="around"&&"gs-utl-justify-around",r==="evenly"&&"gs-utl-justify-evenly"),Ic=({style:e,width:t,height:n,gap:r})=>({height:n,gap:r,width:t,...e}),Cn=h.memo(ce(function({id:t,children:n,className:r,style:o,width:s,gap:a,height:i,grow:l,alignItems:u,justifyContent:d,htmlAttrs:f,...p}){const{layoutsById:g}=Cv(),[m,v]=h.useState({}),{className:b,style:w,...y}=f||{},S=r??b,C=o??w,x=h.useMemo(()=>Ic({height:i,gap:a,width:s,style:C}),[C,s,i,a]),E=kc({className:S,grow:l,alignItems:u,justifyContent:d});h.useEffect(()=>{if(t)return g.set(t,{state:m,setState:v}),()=>{g.delete(t)}},[g,m]);const T=p.as??"div";return c.jsx(T,{style:x,className:E,...p,...y,children:m.children??n})})),Vc="gs-cmp-button-menu",hN=h.memo(ce(function({className:t,style:n,icon:r,label:o,size:s,tooltip:a,value:i,disabled:l,options:u,children:d,editorEvents:f,classNameBtn:p,iconMenu:g="chevronDown",onClick:m,onClickMenu:v,onOptionSelect:b}){const{editor:w}=we(),[y,S]=h.useState(!1),[C,x]=h.useState(()=>({isOpen:y,className:t,style:n,tooltip:a,label:o,icon:r,iconMenu:g,size:s,disabled:l,value:i,options:u})),T={editor:w,state:C,setState:F=>x(k=>({...k,...F}))};is({editor:w,editorEvents:f,localState:C,setLocalState:x});const _=F=>{m==null||m({...T,event:F})},O=F=>{b==null||b({...T,option:F}),S(!1)},P=C.tooltip,A=ct(P)?{title:P}:{tooltipProps:P},$=(()=>{var U,J;if(C.label)return et(C.label)?C.label(T):C.label;const F=(U=C.options)==null?void 0:U.find(Y=>Y.id===C.value),k=(J=C.options)==null?void 0:J[0],H=F||k,V=N((F==null?void 0:F.id)===C.value&&z.tA);if(H!=null&&H.icon)return{type:"icon",className:V,icon:H.icon,size:18};if(H!=null&&H.label)return{type:"text",className:V,content:H.label}})(),j=$t($),L=()=>{if(d){const F=et(d)?d(T):d;return $t(F)}return C.options&&C.options.length>0?c.jsx("div",{className:`${Vc}-options`,children:C.options.map(F=>c.jsx(Pa,{label:F.label,icon:F.icon,selected:F.id===C.value,action:()=>O(F)},F.id))}):null},D=F=>{F.stopPropagation(),v?v({...T,event:F}):S(!y)},W=c.jsx(I,{items:"center",onClick:D,className:N(`${Vc}__icon-menu`,z.hBgH2,z.txtHighEmphasisH),children:c.jsx(ne,{icon:C.iconMenu,size:"14px"})});return c.jsx(Cn,{className:N(Vc,"gs-utl-flex",C.className),style:C.style,children:c.jsx(wr,{handler:c.jsx(Ct,{className:N(`${Vc}__btn`,p),icon:C.icon,size:C.size,disabled:C.disabled,onClick:_,block:!0,...A,children:$?c.jsxs(I,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(I,{items:"center",children:j}),W]}):W}),buttonAs:"div",open:y,onClose:()=>S(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:L()})})}));function Qt(e){const{className:t,options:n,name:r,value:o,size:s="m",required:a,disabled:i,onChange:l,labelAs:u}=e,d=g=>{const m=n.filter(v=>v.id===g)[0];return n.indexOf(m)===n.length-1},f=(g,m)=>N("gs-utl-cursor-pointer",s==="m"&&Te.xy,s==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",s==="xs"&&"gs-utl-p-1 text-sm",z.br,g&&z.bgO,!d(m)&&te.br),p=Go({...e,className:"gs-field-buttons"});return c.jsxs(gm,{value:o,onChange:l,disabled:i,...p,children:[c.jsx(br,{...e,as:u}),r&&c.jsx("input",{type:"hidden",name:r,value:o,required:a}),c.jsx(I,{className:N(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(Wt,{title:v,className:N("gs-utl-w-full"),classNameWrp:N("gs-utl-flex-1"),children:c.jsx(gm.Option,{value:g,className:({checked:w})=>f(w,g),children:c.jsxs(I,{justify:"center",gap:"s",full:!0,children:[!!b&&c.jsx(ne,{...ct(b)?{icon:b,size:se.s}:b}),m&&c.jsx(B,{children:m})]})})},g))})]})}const gN="gs-cmp-button-group-field",mN=h.memo(ce(function({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l,onChange:u,editorEvents:d}){const{editor:f}=we(),[p,g]=h.useState(()=>({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l})),m=v=>{u({value:v,editor:f,state:p,setState:b=>g(w=>({...w,...b}))})};return is({editor:f,editorEvents:d,localState:p,setLocalState:g}),c.jsx(Qt,{className:N(gN,p.className),label:p.label,name:p.name,value:p.value,options:p.options??[],size:p.size,required:p.required,disabled:p.disabled,onChange:m})}));function Hc({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=h.memo(ce(function(){const{isStage:e,updateStudio:t}=we(),{isDarkTheme:n}=jr(),r=h.useRef(null),{bg:o,text:s}=T1(n);return Nb({ref:r,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 Lb=ce(function(){const t=Fi(),n=Ie(),{Styles:r}=t,{isDarkTheme:o}=Fr(),s=r.getSelected(),[a,i]=h.useState(0),l=s?cf(s==null?void 0:s.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const f=()=>i(m=>++m),g=r.events.custom;return t.on(g,f),()=>{t.off(g,f)}},[r,t]);const p=()=>{if(u){const f=t.Parser.parseCss(u)[0];f&&(s==null||s.setStyle(f.style))}};return c.jsxs(I,{className:Z("relative"),col:!0,full:!0,children:[c.jsx(B,{grow:!0,children:s?c.jsx(mo,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:o,clean:!0},a):n.t("noCode")}),c.jsx(Ke,{className:Z("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:p,children:n.t("update")})]})}),Mb=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],hN=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(ne.projectFiles),r={};for(const o in n){const s=n[o],{filename:a,content:i}=s;if(s.path){const l=s.path.split("/").filter(Boolean);let u=r;for(const d of l)u[d]=u[d]||{},u=u[d];u[a]=i}else r[a]=i}return r}})},gN=ce(function(t){const n=Ie(),r=we(),{isProjectTypeEmail:o}=r,s=r.editor,[a,i]=h.useState(Mb[0].id),[l,u]=h.useState(),{isDarkTheme:d}=Fr(),[p]=h.useState(()=>cf(s.getCss())),[f,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),v={...t.options,...o?{export:!1}:{}},b=()=>hN(s);h.useEffect(()=>{(async()=>{var T,_;const S=await s.runCommand(ne.projectFiles,{page:s.Pages.getSelected(),skipProject:!0,styles:"skip"}),C=((T=S.find(O=>O.mimeType==="text/html"))==null?void 0:T.content)??"",x=((_=S.find(O=>O.mimeType==="text/mjml"))==null?void 0:_.content)??"";u(a==="mjml"?x:C)})()},[a]),h.useEffect(()=>{var y;f&&((y=f.getModel())==null||y.setValue(l),db(f))},[f,l]);const w={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{className:Z("h-96"),space:"m",children:[c.jsxs(B,{className:Z("relative"),grow:!0,children:[o&&c.jsxs(I,{className:Z("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(Le,{value:a,onChange:i,options:Mb,className:Z("min-w-24")}),c.jsx(gb,{getValue:()=>f.getModel().getValue()})]}),l!==void 0&&c.jsx(mo,{defaultValue:l,language:"html",onMount:g,...w})]}),!o&&c.jsx(B,{grow:!0,children:c.jsx(mo,{defaultValue:p,language:"css",...w})})]}),v.export!==!1&&c.jsx(I,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:b,children:m("exportButton")})})]})});function mN(e,t){h.useEffect(()=>{const n="pointerdown",{current:r}=e;if(!r||!t.enabled)return;function o(s){const a=s.target;r&&a&&!r.contains(a)&&t.onTrigger(a)}return document.addEventListener(n,o),()=>{document.removeEventListener(n,o)}},[e.current,t.enabled])}const Nb=e=>{const{ref:t,show:n,node:r,styles:o,update:s,reload:a}=e,i={all:"initial",zIndex:"10",fontFamily:"inherit",...o};h.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const p=l.attachShadow({mode:"closed"});l.__sh=AS.createRoot(p)}l.__sh.render(r),Object.keys(i).forEach(p=>{l.style.setProperty(KS(p),i[p],"important")});const u=new MutationObserver(a);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(p=>{Array.from(p[0].removedNodes).includes(l)&&a()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,s])},vN="gs-cmp-popover";function Cr({children:e,handler:t,title:n,size:r,padding:o=!0,border:s=!0,overlay:a,clickAway:i,topIcon:l,placement:u="auto",offset:d,open:p,onClose:f,buttonAs:g,className:m,classNameBody:v,buttonProps:b={},disabled:w,hideCloseButton:y}){const[S,C]=h.useState(!!p),[x,E]=h.useState(S),[T,_]=h.useState(null),[O,P]=h.useState(null),A=Si(T,O,{...Bh({offset:d}),placement:u}),M=()=>{E(!1),f==null||f()};mN({current:O},{onTrigger:M,enabled:i&&S}),h.useEffect(()=>{E(!!p)},[p]),h.useEffect(()=>{var L;S&&((L=A.update)==null||L.call(A))},[S,A.update]),h.useEffect(()=>{const L=setTimeout(()=>C(x),10);return()=>clearTimeout(L)},[x]);const k=Z("w-full transition-colors",w&&"pointer-events-none",...O1({border:!1,size:"",...b})),j=Z(["fixed z-20",l&&"gjs-mt-5",r==="s"&&"w-full max-w-64",r==="sm"&&"w-full max-w-sm",r==="md"&&"w-full max-w-md"]);return c.jsxs(rp,{className:Z(vN,"relative flex",m),children:[c.jsx(rp.Button,{ref:_,as:g,className:k,children:c.jsx("div",{onClick:L=>{hs(L),!(Vt(p)||w)&&E(!S)},children:t})}),S&&a&&c.jsx("div",{onClick:M,className:Z("z-10 fixed inset-0")}),x&&c.jsx(rp.Panel,{static:!0,className:j,ref:P,style:A.styles.popper,...A.attributes.popper,children:c.jsx(gp,{as:h.Fragment,show:S,unmount:!1,...S1,children:c.jsx(Jn,{classNameBody:v,title:n,onClose:y?void 0:M,padding:o,border:s,children:typeof e=="function"?e({close:M,open:S}):e})})})]})}function Oa(e){const{action:t,icon:n,label:r,className:o,items:s,onItemClick:a,selected:i,...l}=e,u=h.useRef(null),[d,p]=h.useState(),f=u.current,g=N([o,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",z.br,Pe.xy,te.bb,l.disabled&&Oe.disabled,...t?[z.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=b=>{et(t)&&(t({event:b}),a==null||a({event:b,item:e}))};h.useEffect(()=>{if(!f)return;const b=setTimeout(()=>p(f.getBoundingClientRect()),l.active?0:xd);return()=>clearTimeout(b)},[f,l.active]);const v=()=>{var b;return(b=l.onActive)==null?void 0:b.call(l)};return c.jsxs(I,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:v,children:[n&&c.jsx(B,{children:c.jsx(re,{icon:n,size:se.sx})}),!!r&&c.jsx(B,{className:N(l.classNameLabel,Oe.txtEllips),grow:!0,children:r}),!!i&&c.jsx(B,{children:c.jsx(re,{className:z.tA,icon:q.check,size:se.s})}),!!(s!=null&&s.length)&&c.jsxs(c.Fragment,{children:[c.jsx(B,{children:c.jsx(re,{icon:q.chevronRight,size:se.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(SH,{items:s,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:a,open:!0})]})]})}const Ic=({className:e,grow:t,alignItems:n,justifyContent:r})=>N(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",r==="start"&&"gs-utl-justify-start",r==="end"&&"gs-utl-justify-end",r==="center"&&"gs-utl-justify-center",r==="between"&&"gs-utl-justify-between",r==="around"&&"gs-utl-justify-around",r==="evenly"&&"gs-utl-justify-evenly"),Vc=({style:e,width:t,height:n,gap:r})=>({height:n,gap:r,width:t,...e}),xn=h.memo(ce(function({id:t,children:n,className:r,style:o,width:s,gap:a,height:i,grow:l,alignItems:u,justifyContent:d,htmlAttrs:p,...f}){const{layoutsById:g}=Cv(),[m,v]=h.useState({}),{className:b,style:w,...y}=p||{},S=r??b,C=o??w,x=h.useMemo(()=>Vc({height:i,gap:a,width:s,style:C}),[C,s,i,a]),E=Ic({className:S,grow:l,alignItems:u,justifyContent:d});h.useEffect(()=>{if(t)return g.set(t,{state:m,setState:v}),()=>{g.delete(t)}},[g,m]);const T=f.as??"div";return c.jsx(T,{style:x,className:E,...f,...y,children:m.children??n})})),Hc="gs-cmp-button-menu",bN=h.memo(ce(function({className:t,style:n,icon:r,label:o,size:s,tooltip:a,value:i,disabled:l,options:u,children:d,editorEvents:p,classNameBtn:f,iconMenu:g="chevronDown",onClick:m,onClickMenu:v,onOptionSelect:b}){const{editor:w}=we(),[y,S]=h.useState(!1),[C,x]=h.useState(()=>({isOpen:y,className:t,style:n,tooltip:a,label:o,icon:r,iconMenu:g,size:s,disabled:l,value:i,options:u})),T={editor:w,state:C,setState:F=>x($=>({...$,...F}))};ls({editor:w,editorEvents:p,localState:C,setLocalState:x});const _=F=>{m==null||m({...T,event:F})},O=F=>{b==null||b({...T,option:F}),S(!1)},P=C.tooltip,A=ct(P)?{title:P}:{tooltipProps:P},k=(()=>{var U,J;if(C.label)return et(C.label)?C.label(T):C.label;const F=(U=C.options)==null?void 0:U.find(Y=>Y.id===C.value),$=(J=C.options)==null?void 0:J[0],H=F||$,V=N((F==null?void 0:F.id)===C.value&&z.tA);if(H!=null&&H.icon)return{type:"icon",className:V,icon:H.icon,size:18};if(H!=null&&H.label)return{type:"text",className:V,content:H.label}})(),j=kt(k),L=()=>{if(d){const F=et(d)?d(T):d;return kt(F)}return C.options&&C.options.length>0?c.jsx("div",{className:`${Hc}-options`,children:C.options.map(F=>c.jsx(Oa,{label:F.label,icon:F.icon,selected:F.id===C.value,action:()=>O(F)},F.id))}):null},D=F=>{F.stopPropagation(),v?v({...T,event:F}):S(!y)},W=c.jsx(I,{items:"center",onClick:D,className:N(`${Hc}__icon-menu`,z.hBgH2,z.txtHighEmphasisH),children:c.jsx(re,{icon:C.iconMenu,size:"14px"})});return c.jsx(xn,{className:N(Hc,"gs-utl-flex",C.className),style:C.style,children:c.jsx(Cr,{handler:c.jsx(Ct,{className:N(`${Hc}__btn`,f),icon:C.icon,size:C.size,disabled:C.disabled,onClick:_,block:!0,...A,children:k?c.jsxs(I,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(I,{items:"center",children:j}),W]}):W}),buttonAs:"div",open:y,onClose:()=>S(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:L()})})}));function Rt(e){const{className:t,options:n,name:r,value:o,size:s="m",required:a,disabled:i,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)=>N("gs-utl-cursor-pointer",s==="m"&&Pe.xy,s==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",s==="xs"&&"gs-utl-p-1 text-sm",z.br,g&&z.bgO,!d(m)&&te.br),f=qo({...e,className:"gs-field-buttons"});return c.jsxs(gm,{value:o,onChange:l,disabled:i,...f,children:[c.jsx(wr,{...e,as:u}),r&&c.jsx("input",{type:"hidden",name:r,value:o,required:a}),c.jsx(I,{className:N(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(Ut,{title:v,className:N("gs-utl-w-full"),classNameWrp:N("gs-utl-flex-1"),children:c.jsx(gm.Option,{value:g,className:({checked:w})=>p(w,g),children:c.jsxs(I,{justify:"center",gap:"s",full:!0,children:[!!b&&c.jsx(re,{...ct(b)?{icon:b,size:se.s}:b}),m&&c.jsx(B,{children:m})]})})},g))})]})}const yN="gs-cmp-button-group-field",wN=h.memo(ce(function({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l,onChange:u,editorEvents:d}){const{editor:p}=we(),[f,g]=h.useState(()=>({className:t,label:n,name:r,value:o,options:s,size:a,required:i,disabled:l})),m=v=>{u({value:v,editor:p,state:f,setState:b=>g(w=>({...w,...b}))})};return ls({editor:p,editorEvents:d,localState:f,setLocalState:g}),c.jsx(Rt,{className:N(yN,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 jc({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}=we(),{isDarkTheme:n}=Fr(),r=h.useRef(null),{bg:o,text:s}=T1(n);return Nb({ref:r,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(Yn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx(Hc,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:r})})),bN=()=>`https://grapesjs.com?ref=${window.location.host}`,yN=h.memo(ce(function(){const{updateStudio:e,showPoweredBy:t}=we(),{isDarkTheme:n}=jr(),r=h.useRef(null),{bg:o,text:s,link:a}=T1(n);return Nb({ref:r,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(Jn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx(jc,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:r})})),CN=()=>`https://grapesjs.com?ref=${window.location.host}`,xN=h.memo(ce(function(){const{updateStudio:e,showPoweredBy:t}=we(),{isDarkTheme:n}=Fr(),r=h.useRef(null),{bg:o,text:s,link:a}=T1(n);return Nb({ref:r,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(Yn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:bN(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(Hc,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:r})})),$b="gs-canvas-content",wN=h.memo(ce(function({children:t}){const{isReady:n}=we(),r=N(`${$b}__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:$b,children:[c.jsx("div",{className:r}),!n&&c.jsx(Lo,{className:N("gs-utl-z-10"),abs:!0,full:!0}),n&&$t(t)]}),c.jsx(vN,{}),c.jsx(yN,{})]})})),SN="gs-canvas",kb=h.memo(function({className:t,style:n,grow:r,children:o}){return c.jsx(rN,{style:n,className:N(SN,"gs-utl-relative",r&&"gs-utl-flex-grow",t),children:c.jsx(Fi,{children:c.jsx(wN,{children:o})})})}),cp=(()=>{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=cp?Promise.resolve().then(function(){return _N}):Promise.resolve().then(function(){return kN});async function xN(...e){return(await CN).default(...e)}cp?Promise.resolve().then(function(){return LN}):Promise.resolve().then(function(){return VN});const EN=cp?Promise.resolve().then(function(){return NN}):Promise.resolve().then(function(){return jN});async function TN(...e){return(await EN).default(...e)}const PN=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((o,s)=>{t[s]={description:o.description||"Files",accept:{}},o.mimeTypes?o.mimeTypes.map(a=>{t[s].accept[a]=o.extensions||[]}):t[s].accept["*/*"]=o.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}),r=await Promise.all(n.map(PN));return e[0].multiple?r:r[0]},_N={__proto__:null,default:ON};function jc(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(o){return{value:o,done:r}})}return jc=function(n){this.s=n,this.n=n.next},jc.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var r=this.s.return;return r===void 0?Promise.resolve({value:n,done:!0}):t(r.apply(this.s,arguments))},throw:function(n){var r=this.s.return;return r===void 0?Promise.reject(n):t(r.apply(this.s,arguments))}},new jc(e)}const Ib=async(e,t,n=e.name,r)=>{const o=[],s=[];var a,i=!1,l=!1;try{for(var u,d=function(f){var p,g,m,v=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,m=Symbol.iterator);v--;){if(g&&(p=f[g])!=null)return p.call(f);if(m&&(p=f[m])!=null)return new jc(p.call(f));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());i=!(u=await d.next()).done;i=!1){const f=u.value,p=`${n}/${f.name}`;f.kind==="file"?s.push(f.getFile().then(g=>(g.directoryHandle=e,g.handle=f,Object.defineProperty(g,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>p})))):f.kind!=="directory"||!t||r&&r(f)||o.push(Ib(f,t,p,r))}}catch(f){l=!0,a=f}finally{try{i&&d.return!=null&&await d.return()}finally{if(l)throw a}}return[...(await Promise.all(o)).flat(),...await Promise.all(s)]};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]:Ib(t,e.recursive,void 0,e.skipDirectory)},LN={__proto__:null,default:AN},MN=async(e,t=[{}],n=null,r=!1,o=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const s=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((u,d)=>{s[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&a&&u.mimeTypes.push(a),u.mimeTypes.map(f=>{s[d].accept[f]=u.extensions||[]})):a?s[d].accept[a]=u.extensions||[]:s[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,r)throw u}const i=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:s,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&o&&o(i);const l=await i.createWritable();return"stream"in e?(await e.stream().pipeTo(l),i):"body"in e?(await e.body.pipeTo(l),i):(await l.write(await e),await l.close(),i)},NN={__proto__:null,default:MN},$N=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const r=document.createElement("input");r.type="file";const o=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();r.multiple=e[0].multiple||!1,r.accept=o||"",r.style.display="none",document.body.append(r);const s=l=>{typeof a=="function"&&a(),t(l)},a=e[0].legacySetup&&e[0].legacySetup(s,()=>a(n),r),i=()=>{window.removeEventListener("focus",i),r.remove()};r.addEventListener("click",()=>{window.addEventListener("focus",i)}),r.addEventListener("change",()=>{window.removeEventListener("focus",i),r.remove(),s(r.multiple?Array.from(r.files):r.files[0])}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),kN={__proto__:null,default:$N},IN=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0;const o=a=>{typeof s=="function"&&s(),t(a)},s=e[0].legacySetup&&e[0].legacySetup(o,()=>s(n),r);r.addEventListener("change",()=>{let a=Array.from(r.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(a=a.filter(i=>i.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):a=a.filter(i=>i.webkitRelativePath.split("/").length===2),o(a)}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),VN={__proto__:null,default:IN},HN=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let r=e;"body"in e&&(r=await async function(a,i){const l=a.getReader(),u=new ReadableStream({start:p=>async function g(){return l.read().then(({done:m,value:v})=>{if(!m)return p.enqueue(v),g();p.close()})}()}),d=new Response(u),f=await d.blob();return l.releaseLock(),new Blob([f],{type:i})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await r);const o=()=>{typeof s=="function"&&s()},s=t.legacySetup&&t.legacySetup(o,()=>s(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),o()}),n.click(),null},jN={__proto__:null,default:HN};function Ko({children:e,label:t,s:n="m",pill:r,border:o,nopad:s,className:a,block:i,...l}){return c.jsx("div",{className:N(!i&&"gs-utl-inline-block",a,!s&&Te.xyS2,r?te.pill:te.rnd,o&&`${te.b} ${z.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Vb={NODE_ENV:"production"};const DN=Vb.REACT_APP_VERSION??Vb.NPM_PACKAGE_VERSION,FN=ce(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsxs(B,{className:ae("relative"),children:[c.jsx(Hc,{className:ae("w-24 opacity-50")}),t&&c.jsx(Ko,{className:ae(z.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(B,{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:ae(Ao.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:ae(Ao.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(B,{className:ae(z.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",DN]})]})}),BN=ce(function(){return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsx(B,{className:Z("relative"),children:c.jsx(Hc,{className:Z("w-24 opacity-50")})})}),c.jsx(B,{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:Z(Ao.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:Z(Ao.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:xt.web,label:Pr(xt.web),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:q.web,size:se.s}),c.jsx("span",{children:Pr(xt.web)})]})},{id:xt.email,label:Pr(xt.email),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:q.emailOutline,size:se.s}),c.jsx("span",{children:Pr(xt.email)})]})}],Dc="gs-cmp-tabs";function Zo({tabs:e,className:t,classNamePanel:n,classNameTab:r,variant:o,style:s,onChange:a=qS,value:i}){const l=o==="pills",u=l?N("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",z.bgH):"",d=v=>l?N("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",v?z.bg:""):N("gs-utl-border-b-2",Te.xy),f=v=>{v&&(v.tabIndex=-1)},p=v=>{const b=v.currentTarget;setTimeout(()=>b.blur(),10)},g=Ht(i)?e.findIndex(v=>v.id===i):void 0,m=!e.some(v=>!!v.content);return c.jsxs(fi.Group,{onChange:v=>a(e[v].id),defaultIndex:e.findIndex(v=>v.id===i),selectedIndex:g,children:[c.jsx(fi.List,{as:I,className:N(Dc,t,u),style:s,full:!0,nowrap:!0,children:e.map(v=>c.jsx(fi,{disabled:v.disabled,className:({selected:b})=>N(`${Dc}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",v.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",ni.focus,d(b),b?`${z.tAo} ${z.bA}`:z.br,r),children:v.label},v.id))}),c.jsx(fi.Panels,{className:N(`${Dc}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(v=>c.jsx(fi.Panel,{tabIndex:-1,className:N(`${Dc}__panel`,"gs-utl-h-full"),ref:f,onFocus:p,children:v.content},v.id))})]})}const Fc=0,Yo=1,Oa=2,Hb=4;function jb(e,t){return n=>e(t(n))}function UN(e,t){return t(e)}function Db(e,t){return n=>e(t,n)}function Fb(e,t){return()=>e(t)}function Bc(e,t){return t(e),e}function Tt(...e){return e}function WN(e){e()}function Bb(e){return()=>e}function GN(...e){return()=>{e.map(WN)}}function up(e){return e!==void 0}function _a(){}function at(e,t){return e(Yo,t)}function Ve(e,t){e(Fc,t)}function dp(e){e(Oa)}function Rt(e){return e(Hb)}function ye(e,t){return at(e,Db(t,Fc))}function Fr(e,t){const n=e(Yo,r=>{n(),t(r)});return n}function Ge(){const e=[];return(t,n)=>{switch(t){case Oa:e.splice(0,e.length);return;case Yo:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case Fc:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function pe(e){let t=e;const n=Ge();return(r,o)=>{switch(r){case Yo:o(t);break;case Fc:t=o;break;case Hb:return t}return n(r,o)}}function qN(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case Yo:return s?n===s?void 0:(r(),n=s,t=at(e,s),t):(r(),_a);case Oa:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function $n(e){return Bc(Ge(),t=>ye(e,t))}function un(e,t){return Bc(pe(t),n=>ye(e,n))}function KN(...e){return t=>e.reduceRight(UN,t)}function ie(e,...t){const n=KN(...t);return(r,o)=>{switch(r){case Yo:return at(e,n(o));case Oa:dp(e);return}}}function zb(e,t){return e===t}function Pt(e=zb){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function Oe(e){return t=>n=>{e(n)&&t(n)}}function me(e){return t=>jb(t,e)}function Br(e){return t=>()=>t(e)}function zr(e,t){return n=>r=>n(t=e(t,r))}function Aa(e){return t=>n=>{e>0?e--:t(n)}}function Xo(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ub(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function je(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);at(s,l=>{const u=n;n=n|i,t[a]=l,u!==o&&n===o&&r&&(r(),r=null)})}),s=>a=>{const i=()=>s([a].concat(t));n===o?i():r=i}}function Wb(...e){return function(t,n){switch(t){case Yo:return GN(...e.map(r=>at(r,n)));case Oa:return;default:throw new Error(`unrecognized action ${t}`)}}}function _e(e,t=zb){return ie(e,Pt(t))}function zt(...e){const t=Ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);at(s,l=>{n[a]=l,r=r|i,r===o&&Ve(t,n)})}),function(s,a){switch(s){case Yo:return r===o&&a(n),at(t,a);case Oa:return dp(t);default:throw new Error(`unrecognized action ${s}`)}}}function it(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:r,constructor:o,dependencies:s,singleton:a})=>{if(a&&t.has(r))return t.get(r);const i=o(s.map(l=>n(l)));return a&&t.set(r,i),i};return n(e)}function XN(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const a in t)r.hasOwnProperty(a)||(n[a]=t[a]);return n}const zc=typeof document<"u"?h.useLayoutEffect:h.useEffect;function Gb(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),a=Object.keys(t.events||{}),i=h.createContext({});function l(w,y){w.propsReady&&Ve(w.propsReady,!1);for(const S of r){const C=w[t.required[S]];Ve(C,y[S])}for(const S of o)if(S in y){const C=w[t.optional[S]];Ve(C,y[S])}w.propsReady&&Ve(w.propsReady,!0)}function u(w){return s.reduce((y,S)=>(y[S]=C=>{const x=w[t.methods[S]];Ve(x,C)},y),{})}function d(w){return a.reduce((y,S)=>(y[S]=qN(w[t.events[S]]),y),{})}const f=h.forwardRef((w,y)=>{const{children:S,...C}=w,[x]=h.useState(()=>Bc(YN(e),_=>l(_,C))),[E]=h.useState(Fb(d,x));zc(()=>{for(const _ of a)_ in C&&at(E[_],C[_]);return()=>{Object.values(E).map(dp)}},[C,E,x]),zc(()=>{l(x,C)}),h.useImperativeHandle(y,Bb(u(x)));const T=n;return c.jsx(i.Provider,{value:x,children:n?c.jsx(T,{...XN([...r,...o,...a],C),children:S}):S})}),p=w=>h.useCallback(Db(Ve,h.useContext(i)[w]),[w]),g=w=>{const S=h.useContext(i)[w],C=h.useCallback(x=>at(S,x),[S]);return h.useSyncExternalStore(C,()=>Rt(S),()=>Rt(S))},m=w=>{const S=h.useContext(i)[w],[C,x]=h.useState(Fb(Rt,S));return zc(()=>at(S,E=>{E!==C&&x(Bb(E))}),[S,C]),C},v=h.version.startsWith("18")?g:m;return{Component:f,usePublisher:p,useEmitterValue:v,useEmitter:(w,y)=>{const C=h.useContext(i)[w];zc(()=>at(C,y),[y,C])}}}const qb=typeof document<"u"?h.useLayoutEffect:h.useEffect;var kn=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(kn||{});const JN={0:"debug",1:"log",2:"warn",3:"error"},QN=()=>typeof globalThis>"u"?window:globalThis,Jo=it(()=>{const e=pe(3);return{log:pe((n,r,o=1)=>{var s;const a=(s=QN().VIRTUOSO_LOG_LEVEL)!=null?s:Rt(e);o>=a&&console[JN[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function fp(e,t,n){const r=h.useRef(null);let o=s=>{};if(typeof ResizeObserver<"u"){const s=h.useMemo(()=>new ResizeObserver(a=>{const i=()=>{const l=a[0].target;l.offsetParent!==null&&e(l)};n?i():requestAnimationFrame(i)}),[e]);o=a=>{a&&t?(s.observe(a),r.current=a):(r.current&&s.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function js(e,t,n){return fp(e,t,n).callbackRef}function RN(e,t,n,r,o,s,a,i,l){const u=h.useCallback(d=>{const f=e$(d.children,t,i?"offsetWidth":"offsetHeight",o);let p=d.parentElement;for(;!p.dataset.virtuosoScroller;)p=p.parentElement;const g=p.lastElementChild.dataset.viewportType==="window",m=a?i?a.scrollLeft:a.scrollTop:g?i?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:i?p.scrollLeft:p.scrollTop,v=a?i?a.scrollWidth:a.scrollHeight:g?i?document.documentElement.scrollWidth:document.documentElement.scrollHeight:i?p.scrollWidth:p.scrollHeight,b=a?i?a.offsetWidth:a.offsetHeight:g?i?window.innerWidth:window.innerHeight:i?p.offsetWidth:p.offsetHeight;r({scrollTop:Math.max(m,0),scrollHeight:v,viewportHeight:b}),s==null||s(i?Kb("column-gap",getComputedStyle(d).columnGap,o):Kb("row-gap",getComputedStyle(d).rowGap,o)),f!==null&&e(f)},[e,t,o,s,a,r]);return fp(u,n,l)}function e$(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let a=0;a<o;a++){const i=e.item(a);if(!i||i.dataset.index===void 0)continue;const l=parseInt(i.dataset.index),u=parseFloat(i.dataset.knownSize),d=t(i,n);if(d===0&&r("Zero-sized element, this should not happen",{child:i},kn.ERROR),d===u)continue;const f=s[s.length-1];s.length===0||f.size!==d||f.endIndex!==l-1?s.push({startIndex:l,endIndex:l,size:d}):s[s.length-1].endIndex++}return s}function Kb(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,kn.WARN),t==="normal"?0:parseInt(t??"0",10)}function Qo(e,t){return Math.round(e.getBoundingClientRect()[t])}function Zb(e,t){return Math.abs(e-t)<1.01}function Yb(e,t,n,r=_a,o,s){const a=h.useRef(null),i=h.useRef(null),l=h.useRef(null),u=h.useCallback(p=>{const g=p.target,m=g===window||g===document,v=s?m?window.pageXOffset||document.documentElement.scrollLeft:g.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=s?m?document.documentElement.scrollWidth:g.scrollWidth:m?document.documentElement.scrollHeight:g.scrollHeight,w=s?m?window.innerWidth:g.offsetWidth:m?window.innerHeight:g.offsetHeight,y=()=>{e({scrollTop:Math.max(v,0),scrollHeight:b,viewportHeight:w})};p.suppressFlushSync?y():Fn.flushSync(y),i.current!==null&&(v===i.current||v<=0||v===b-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);h.useEffect(()=>{const p=o||a.current;return r(o||a.current),u({target:p,suppressFlushSync:!0}),p.addEventListener("scroll",u,{passive:!0}),()=>{r(null),p.removeEventListener("scroll",u)}},[a,u,n,r,o]);function d(p){const g=a.current;if(!g||(s?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=p.behavior==="smooth";let v,b,w;g===window?(b=Math.max(Qo(document.documentElement,s?"width":"height"),s?document.documentElement.scrollWidth:document.documentElement.scrollHeight),v=s?window.innerWidth:window.innerHeight,w=s?document.documentElement.scrollLeft:document.documentElement.scrollTop):(b=g[s?"scrollWidth":"scrollHeight"],v=Qo(g,s?"width":"height"),w=g[s?"scrollLeft":"scrollTop"]);const y=b-v;if(p.top=Math.ceil(Math.max(Math.min(y,p.top),0)),Zb(v,b)||p.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:v}),m&&t(!0);return}m?(i.current=p.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(p={left:p.top,behavior:p.behavior}),g.scrollTo(p)}function f(p){s&&(p={left:p.top,behavior:p.behavior}),a.current.scrollBy(p)}return{scrollerRef:a,scrollByCallback:f,scrollToCallback:d}}const dn=it(()=>{const e=Ge(),t=Ge(),n=pe(0),r=Ge(),o=pe(0),s=Ge(),a=Ge(),i=pe(0),l=pe(0),u=pe(0),d=pe(0),f=Ge(),p=Ge(),g=pe(!1),m=pe(!1),v=pe(!1);return ye(ie(e,me(({scrollTop:b})=>b)),t),ye(ie(e,me(({scrollHeight:b})=>b)),a),ye(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:a,smoothScrollTargetReached:r,horizontalDirection:m,skipAnimationFrameInResizeObserver:v,scrollTo:f,scrollBy:p,statefulScrollTop:o,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),Bi={lvl:0};function Xb(e,t,n,r=Bi,o=Bi){return{k:e,v:t,lvl:n,l:r,r:o}}function ht(e){return e===Bi}function La(){return Bi}function pp(e,t){if(ht(e))return Bi;const{k:n,l:r,r:o}=e;if(t===n){if(ht(r))return o;if(ht(o))return r;{const[s,a]=Jb(r);return Uc(Ft(e,{k:s,v:a,l:Qb(r)}))}}else return t<n?Uc(Ft(e,{l:pp(r,t)})):Uc(Ft(e,{r:pp(o,t)}))}function zi(e,t){if(!ht(e))return t===e.k?e.v:t<e.k?zi(e.l,t):zi(e.r,t)}function Sr(e,t,n="k"){if(ht(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=Sr(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return Sr(e.l,t,n)}function In(e,t,n){return ht(e)?Xb(t,n,1):t===e.k?Ft(e,{k:t,v:n}):t<e.k?Rb(Ft(e,{l:In(e.l,t,n)})):Rb(Ft(e,{r:In(e.r,t,n)}))}function hp(e,t,n){if(ht(e))return[];const{k:r,v:o,l:s,r:a}=e;let i=[];return r>t&&(i=i.concat(hp(s,t,n))),r>=t&&r<=n&&i.push({k:r,v:o}),r<=n&&(i=i.concat(hp(a,t,n))),i}function Ds(e){return ht(e)?[]:[...Ds(e.l),{k:e.k,v:e.v},...Ds(e.r)]}function Jb(e){return ht(e.r)?[e.k,e.v]:Jb(e.r)}function Qb(e){return ht(e.r)?e.l:Uc(Ft(e,{r:Qb(e.r)}))}function Ft(e,t){return Xb(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 gp(e){return ht(e)||e.lvl>e.r.lvl}function Rb(e){return mp(t0(e))}function Uc(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(gp(t))return t0(Ft(e,{lvl:r-1}));if(!ht(t)&&!ht(t.r))return Ft(t.r,{l:Ft(t,{r:t.r.l}),r:Ft(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(gp(e))return mp(Ft(e,{lvl:r-1}));if(!ht(n)&&!ht(n.l)){const o=n.l,s=gp(o)?n.lvl-1:n.lvl;return Ft(o,{l:Ft(e,{r:o.l,lvl:r-1}),r:mp(Ft(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function Wc(e,t,n){if(ht(e))return[];const r=Sr(e,t)[0];return t$(hp(e,r,n))}function e0(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let a=1;a<n;a++){const{index:i,value:l}=t(e[a]);s.push({start:r,end:i-1,value:o}),r=i,o=l}return s.push({start:r,end:1/0,value:o}),s}function t$(e){return e0(e,({k:t,v:n})=>({index:t,value:n}))}function mp(e){const{r:t,lvl:n}=e;return!ht(t)&&!ht(t.r)&&t.lvl===n&&t.r.lvl===n?Ft(t,{l:Ft(e,{r:t.l}),lvl:n+1}):e}function t0(e){const{l:t}=e;return!ht(t)&&t.lvl===e.lvl?Ft(t,{r:Ft(e,{l:t.r})}):e}function Gc(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),a=e[s],i=n(a,t);if(i===0)return s;if(i===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function n0(e,t,n){return e[Gc(e,t,n)]}function n$(e,t,n,r){const o=Gc(e,t,r),s=Gc(e,n,r,o);return e.slice(o,s+1)}const vp=it(()=>({recalcInProgress:pe(!1)}),[],{singleton:!0});function r$(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function r0(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function o$(e,t){let n=ht(e)?0:1/0;for(const r of t){const{size:o,startIndex:s,endIndex:a}=r;if(n=Math.min(n,s),ht(e)){e=In(e,0,o);continue}const i=Wc(e,s-1,a+1);if(i.some(r$(r)))continue;let l=!1,u=!1;for(const{start:d,end:f,value:p}of i)l?(a>=d||o===p)&&(e=pp(e,d)):(u=p!==o,l=!0),f>a&&a>=d&&p!==o&&(e=In(e,a+1,p));u&&(e=In(e,s,o))}return[e,n]}function s$(){return{offsetTree:[],sizeTree:La(),groupOffsetTree:La(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function bp({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 i$(e){return{index:e.index,value:e}}function l$(e,t,n,r=0){return r>0&&(t=Math.max(t,n0(e,r,bp).offset)),e0(n$(e,t,n,a$),i$)}function yp(e,t,n,r){let o=e,s=0,a=0,i=0,l=0;if(t!==0){l=Gc(o,t-1,bp),i=o[l].offset;const d=Sr(n,t-1);s=d[0],a=d[1],o.length&&o[l].size===Sr(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:d}of Wc(n,t,1/0)){const f=u-s,p=f*a+i+f*r;o.push({offset:p,size:d,index:u}),s=u,i=p,a=d}return{offsetTree:o,lastIndex:s,lastOffset:i,lastSize:a}}function c$(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,kn.DEBUG);const s=e.sizeTree;let a=s,i=0;if(n.length>0&&ht(s)&&t.length===2){const p=t[0].size,g=t[1].size;a=n.reduce((m,v)=>In(In(m,v,p),v+1,g),a)}else[a,i]=o$(a,t);if(a===s)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:f}=yp(e.offsetTree,i,a,o);return{sizeTree:a,offsetTree:l,lastIndex:u,lastOffset:f,lastSize:d,groupOffsetTree:n.reduce((p,g)=>In(p,g,Ui(g,l,o)),La()),groupIndices:n}}function Ui(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=n0(t,e,bp),a=e-o,i=s*a+(a-1)*n+r;return i>0?i+n:i}function u$(e){return typeof e.groupIndex<"u"}function o0(e,t,n){if(u$(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=s0(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function s0(e,t){if(!qc(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function qc(e){return!ht(e.groupOffsetTree)}function d$(e){return Ds(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],a=s?s.k-1:1/0;return{startIndex:t,endIndex:a,size:n}})}const f$={offsetHeight:"height",offsetWidth:"width"},Ur=it(([{log:e},{recalcInProgress:t}])=>{const n=Ge(),r=Ge(),o=un(r,0),s=Ge(),a=Ge(),i=pe(0),l=pe([]),u=pe(void 0),d=pe(void 0),f=pe((x,E)=>Qo(x,f$[E])),p=pe(void 0),g=pe(0),m=s$(),v=un(ie(n,je(l,e,g),zr(c$,m),Pt()),m),b=un(ie(l,Pt(),zr((x,E)=>({prev:x.current,current:E}),{prev:[],current:[]}),me(({prev:x})=>x)),[]);ye(ie(l,Oe(x=>x.length>0),je(v,g),me(([x,E,T])=>{const _=x.reduce((O,P,A)=>In(O,P,Ui(P,E.offsetTree,T)||A),La());return{...E,groupIndices:x,groupOffsetTree:_}})),v),ye(ie(r,je(v),Oe(([x,{lastIndex:E}])=>x<E),me(([x,{lastIndex:E,lastSize:T}])=>[{startIndex:x,endIndex:E,size:T}])),n),ye(u,d);const w=un(ie(u,me(x=>x===void 0)),!0);ye(ie(d,Oe(x=>x!==void 0&&ht(Rt(v).sizeTree)),me(x=>[{startIndex:0,endIndex:0,size:x}])),n);const y=$n(ie(n,je(v),zr(({sizes:x},[E,T])=>({changed:T!==x,sizes:T}),{changed:!1,sizes:m}),me(x=>x.changed)));at(ie(i,zr((x,E)=>({diff:x.prev-E,prev:E}),{diff:0,prev:0}),me(x=>x.diff)),x=>{const{groupIndices:E}=Rt(v);if(x>0)Ve(t,!0),Ve(s,x+r0(x,E));else if(x<0){const T=Rt(b);T.length>0&&(x-=r0(-x,T)),Ve(a,x)}}),at(ie(i,je(e)),([x,E])=>{x<0&&E("`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:i},kn.ERROR)});const S=$n(s);ye(ie(s,je(v),me(([x,E])=>{const T=E.groupIndices.length>0,_=[],O=E.lastSize;if(T){const P=zi(E.sizeTree,0);let A=0,M=0;for(;A<x;){const L=E.groupIndices[M],D=E.groupIndices.length===M+1?1/0:E.groupIndices[M+1]-L-1;_.push({startIndex:L,endIndex:L,size:P}),_.push({startIndex:L+1,endIndex:L+1+D-1,size:O}),M++,A+=D+1}const $=Ds(E.sizeTree);return A!==x&&$.shift(),$.reduce((L,{k:D,v:W})=>{let F=L.ranges;return L.prevSize!==0&&(F=[...L.ranges,{startIndex:L.prevIndex,endIndex:D+x-1,size:L.prevSize}]),{ranges:F,prevIndex:D+x,prevSize:W}},{ranges:_,prevIndex:x,prevSize:0}).ranges}return Ds(E.sizeTree).reduce((P,{k:A,v:M})=>({ranges:[...P.ranges,{startIndex:P.prevIndex,endIndex:A+x-1,size:P.prevSize}],prevIndex:A+x,prevSize:M}),{ranges:[],prevIndex:0,prevSize:O}).ranges})),n);const C=$n(ie(a,je(v,g),me(([x,{offsetTree:E},T])=>{const _=-x;return Ui(_,E,T)})));return ye(ie(a,je(v,g),me(([x,E,T])=>{if(E.groupIndices.length>0){if(ht(E.sizeTree))return E;let O=La();const P=Rt(b);let A=0,M=0,$=0;for(;A<-x;){$=P[M];const L=P[M+1]-$-1;M++,A+=L+1}if(O=Ds(E.sizeTree).reduce((L,{k:D,v:W})=>In(L,Math.max(0,D+x),W),O),A!==-x){const L=zi(E.sizeTree,$);O=In(O,0,L);const D=Sr(E.sizeTree,-x+1)[1];O=In(O,1,D)}return{...E,sizeTree:O,...yp(E.offsetTree,0,O,T)}}else{const O=Ds(E.sizeTree).reduce((P,{k:A,v:M})=>In(P,Math.max(0,A+x),M),La());return{...E,sizeTree:O,...yp(E.offsetTree,0,O,T)}}})),v),{data:p,totalCount:r,sizeRanges:n,groupIndices:l,defaultItemSize:d,fixedItemSize:u,unshiftWith:s,shiftWith:a,shiftWithOffset:C,beforeUnshiftWith:S,firstItemIndex:i,gap:g,sizes:v,listRefresh:y,statefulTotalCount:o,trackItemSizes:w,itemSize:f}},Tt(Jo,vp),{singleton:!0}),p$=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function a0(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!p$)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Wi=it(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:a,smoothScrollTargetReached:i,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:f},{log:p}])=>{const g=Ge(),m=Ge(),v=pe(0);let b=null,w=null,y=null;function S(){b&&(b(),b=null),y&&(y(),y=null),w&&(clearTimeout(w),w=null),Ve(o,!1)}return ye(ie(g,je(e,s,t,v,l,u,p),je(r,d,f),me(([[C,x,E,T,_,O,P,A],M,$,j])=>{const L=a0(C),{align:D,behavior:W,offset:F}=L,k=T-1,H=o0(L,x,k);let V=Ui(H,x.offsetTree,M)+O;D==="end"?(V+=$+Sr(x.sizeTree,H)[1]-E+j,H===k&&(V+=P)):D==="center"?V+=($+Sr(x.sizeTree,H)[1]-E+j)/2:V-=_,F&&(V+=F);const U=J=>{S(),J?(A("retrying to scroll to",{location:C},kn.DEBUG),Ve(g,C)):(Ve(m,!0),A("list did not change, scroll successful",{},kn.DEBUG))};if(S(),W==="smooth"){let J=!1;y=at(n,Y=>{J=J||Y}),b=Fr(i,()=>{U(J)})}else b=Fr(ie(n,h$(150)),U);return w=setTimeout(()=>{S()},1200),Ve(o,!0),A("scrolling from index to",{index:H,top:V,behavior:W},kn.DEBUG),{top:V,behavior:W}})),a),{scrollToIndex:g,scrollTargetReached:m,topListHeight:v}},Tt(Ur,dn,Jo),{singleton:!0});function h$(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const Gi="up",qi="down",g$="none",m$={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},v$=0,Ki=it(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const a=pe(!1),i=pe(!0),l=Ge(),u=Ge(),d=pe(4),f=pe(v$),p=un(ie(Wb(ie(_e(t),Aa(1),Br(!0)),ie(_e(t),Aa(1),Br(!1),Ub(100))),Pt()),!1),g=un(ie(Wb(ie(s,Br(!0)),ie(s,Br(!1),Ub(200))),Pt()),!1);ye(ie(zt(_e(t),_e(f)),me(([y,S])=>y<=S),Pt()),i),ye(ie(i,Xo(50)),u);const m=$n(ie(zt(e,_e(n),_e(r),_e(o),_e(d)),zr((y,[{scrollTop:S,scrollHeight:C},x,E,T,_])=>{const O=S+x-C>-_,P={viewportHeight:x,scrollTop:S,scrollHeight:C};if(O){let M,$;return S>y.state.scrollTop?(M="SCROLLED_DOWN",$=y.state.scrollTop-S):(M="SIZE_DECREASED",$=y.state.scrollTop-S||y.scrollTopDelta),{atBottom:!0,state:P,atBottomBecause:M,scrollTopDelta:$}}let A;return P.scrollHeight>y.state.scrollHeight?A="SIZE_INCREASED":x<y.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":S<y.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:P}},m$),Pt((y,S)=>y&&y.atBottom===S.atBottom))),v=un(ie(e,zr((y,{scrollTop:S,scrollHeight:C,viewportHeight:x})=>{if(Zb(y.scrollHeight,C))return{scrollTop:S,scrollHeight:C,jump:0,changed:!1};{const E=C-(S+x)<1;return y.scrollTop!==S&&E?{scrollHeight:C,scrollTop:S,jump:y.scrollTop-S,changed:!0}:{scrollHeight:C,scrollTop:S,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Oe(y=>y.changed),me(y=>y.jump)),0);ye(ie(m,me(y=>y.atBottom)),a),ye(ie(a,Xo(50)),l);const b=pe(qi);ye(ie(e,me(({scrollTop:y})=>y),Pt(),zr((y,S)=>Rt(g)?{direction:y.direction,prevScrollTop:S}:{direction:S<y.prevScrollTop?Gi:qi,prevScrollTop:S},{direction:qi,prevScrollTop:0}),me(y=>y.direction)),b),ye(ie(e,Xo(50),Br(g$)),b);const w=pe(0);return ye(ie(p,Oe(y=>!y),Br(0)),w),ye(ie(t,Xo(100),je(p),Oe(([y,S])=>!!S),zr(([y,S],[C])=>[S,C],[0,0]),me(([y,S])=>S-y)),w),{isScrolling:p,isAtTop:i,isAtBottom:a,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:b,atBottomThreshold:d,atTopThreshold:f,scrollVelocity:w,lastJumpDueToItemResize:v}},Tt(dn)),Ro=it(([{log:e}])=>{const t=pe(!1),n=$n(ie(t,Oe(r=>r),Pt()));return at(t,r=>{r&&Rt(e)("props updated",{},kn.DEBUG)}),{propsReady:t,didMount:n}},Tt(Jo),{singleton:!0});function wp(e,t){e==0?t():requestAnimationFrame(()=>wp(e-1,t))}function Sp(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Zi=it(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o,scrollTargetReached:s},{didMount:a}])=>{const i=pe(!0),l=pe(0),u=pe(!0);return ye(ie(a,je(l),Oe(([d,f])=>!!f),Br(!1)),i),ye(ie(a,je(l),Oe(([d,f])=>!!f),Br(!1)),u),at(ie(zt(t,a),je(i,e,n,u),Oe(([[,d],f,{sizeTree:p},g,m])=>d&&(!ht(p)||up(g))&&!f&&!m),je(l)),([,d])=>{Fr(s,()=>{Ve(u,!0)}),wp(4,()=>{Fr(r,()=>{Ve(i,!0)}),Ve(o,d)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Tt(Ur,dn,Wi,Ro),{singleton:!0});function i0(e){return e?e==="smooth"?"smooth":"auto":!1}const b$=(e,t)=>typeof e=="function"?i0(e(t)):t&&i0(e),y$=it(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:a,didMount:i},{log:l},{scrollingInProgress:u}])=>{const d=pe(!1),f=Ge();let p=null;function g(v){Ve(o,{index:"LAST",align:"end",behavior:v})}at(ie(zt(ie(_e(e),Aa(1)),i),je(_e(d),n,s,u),me(([[v,b],w,y,S,C])=>{let x=b&&S,E="auto";return x&&(E=b$(w,y||C),x=x&&!!E),{totalCount:v,shouldFollow:x,followOutputBehavior:E}}),Oe(({shouldFollow:v})=>v)),({totalCount:v,followOutputBehavior:b})=>{p&&(p(),p=null),p=Fr(t,()=>{Rt(l)("following output to ",{totalCount:v},kn.DEBUG),g(b),p=null})});function m(v){const b=Fr(r,w=>{v&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(Rt(l)("scrolling to bottom due to increased size",{},kn.DEBUG),g("auto"))});setTimeout(b,100)}return at(ie(zt(_e(d),e,a),Oe(([v,,b])=>v&&b),zr(({value:v},[,b])=>({refreshed:v===b,value:b}),{refreshed:!1,value:0}),Oe(({refreshed:v})=>v),je(d,e)),([,v])=>{Rt(s)&&m(v!==!1)}),at(f,()=>{m(Rt(d)!==!1)}),at(zt(_e(d),r),([v,b])=>{v&&!b.atBottom&&b.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")}),{followOutput:d,autoscrollToBottom:f}},Tt(Ur,Ki,Wi,Zi,Ro,Jo,dn));function w$(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const l0=it(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Ge(),a=Ge(),i=$n(ie(s,me(w$)));return ye(ie(i,me(l=>l.totalCount)),e),ye(ie(i,me(l=>l.groupIndices)),t),ye(ie(zt(r,n,o),Oe(([l,u])=>qc(u)),me(([l,u,d])=>Sr(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Pt(),me(l=>[l])),a),{groupCounts:s,topItemsIndexes:a}},Tt(Ur,dn));function Yi(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function c0(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Kc="top",Zc="bottom",u0="none";function d0(e,t,n){return typeof e=="number"?n===Gi&&t===Kc||n===qi&&t===Zc?e:0:n===Gi?t===Kc?e.main:e.reverse:t===Zc?e.main:e.reverse}function f0(e,t){return typeof e=="number"?e:e[t]||0}const Cp=it(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Ge(),a=pe(0),i=pe(0),l=pe(0),u=un(ie(zt(_e(e),_e(t),_e(r),_e(s,Yi),_e(l),_e(a),_e(o),_e(n),_e(i)),me(([d,f,p,[g,m],v,b,w,y,S])=>{const C=d-y,x=b+w,E=Math.max(p-C,0);let T=u0;const _=f0(S,Kc),O=f0(S,Zc);return g-=y,g+=p+w,m+=p+w,m-=y,g>d+x-_&&(T=Gi),m<d-E+f+O&&(T=qi),T!==u0?[Math.max(C-p-d0(v,Kc,T)-_,0),C-E-w+f+d0(v,Zc,T)+O]:null}),Oe(d=>d!=null),Pt(Yi)),[0,0]);return{listBoundary:s,overscan:l,topListHeight:a,increaseViewportBy:i,visibleRange:u}},Tt(dn),{singleton:!0});function S$(e,t,n){if(qc(t)){const r=s0(e,t);return[{index:Sr(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const xp={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function p0(e,t,n){if(e.length===0)return[];if(!qc(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,s=[],a=Wc(t.groupOffsetTree,r,o);let i,l=0;for(const u of e){(!i||i.end<u.index)&&(i=a.shift(),l=t.groupIndices.indexOf(i.start));let d;u.index===i.start?d={type:"group",index:l}:d={index:u.index-(l+1)+n,groupIndex:l},s.push({...d,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return s}function Yc(e,t,n,r,o,s){const{lastSize:a,lastOffset:i,lastIndex:l}=o;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 f=n-l,p=i+f*a+(f-1)*r,g=u,m=p-d;return{items:p0(e,o,s),topItems:p0(t,o,s),topListHeight:t.reduce((v,b)=>b.size+v,0),offsetTop:u,offsetBottom:m,top:g,bottom:d,totalCount:n,firstItemIndex:s}}function h0(e,t,n,r,o,s){let a=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-a>=e)break;a++}const i=e+a,l=Sp(t,i),u=Array.from({length:i}).map((d,f)=>({index:f+l,size:0,offset:0,data:s[f+l]}));return Yc(u,[],i,o,n,r)}const Fs=it(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:a,listBoundary:i,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:f},p,{didMount:g},{recalcInProgress:m}])=>{const v=pe([]),b=pe(0),w=Ge();ye(s.topItemsIndexes,v);const y=un(ie(zt(g,m,_e(a,Yi),_e(t),_e(e),_e(d),u,_e(v),_e(r),_e(o),n),Oe(([E,T,,_,,,,,,,O])=>{const P=O&&O.length!==_;return E&&!T&&!P}),me(([,,[E,T],_,O,P,A,M,$,j,L])=>{const D=O,{sizeTree:W,offsetTree:F}=D,k=Rt(b);if(_===0)return{...xp,totalCount:_};if(E===0&&T===0)return k===0?{...xp,totalCount:_}:h0(k,P,O,$,j,L||[]);if(ht(W))return k>0?null:Yc(S$(Sp(P,_),D,L),[],_,j,D,$);const H=[];if(M.length>0){const X=M[0],Q=M[M.length-1];let ee=0;for(const G of Wc(W,X,Q)){const R=G.value,le=Math.max(G.start,X),ge=Math.min(G.end,Q);for(let Ee=le;Ee<=ge;Ee++)H.push({index:Ee,size:R,offset:ee,data:L&&L[Ee]}),ee+=R}}if(!A)return Yc([],H,_,j,D,$);const V=M.length>0?M[M.length-1]+1:0,U=l$(F,E,T,V);if(U.length===0)return null;const J=_-1,Y=Bc([],X=>{for(const Q of U){const ee=Q.value;let G=ee.offset,R=Q.start;const le=ee.size;if(ee.offset<E){R+=Math.floor((E-ee.offset+j)/(le+j));const Ee=R-Q.start;G+=Ee*le+Ee*j}R<V&&(G+=(V-R)*le,R=V);const ge=Math.min(Q.end,J);for(let Ee=R;Ee<=ge&&!(G>=T);Ee++)X.push({index:Ee,size:le,offset:G,data:L&&L[Ee]}),G+=le+j}});return Yc(Y,H,_,j,D,$)}),Oe(E=>E!==null),Pt()),xp);ye(ie(n,Oe(up),me(E=>E==null?void 0:E.length)),t),ye(ie(y,me(E=>E.topListHeight)),f),ye(f,l),ye(ie(y,me(E=>[E.top,E.bottom])),i),ye(ie(y,me(E=>E.items)),w);const S=$n(ie(y,Oe(({items:E})=>E.length>0),je(t,n),Oe(([{items:E},T])=>E[E.length-1].originalIndex===T-1),me(([,E,T])=>[E-1,T]),Pt(Yi),me(([E])=>E))),C=$n(ie(y,Xo(200),Oe(({items:E,topItems:T})=>E.length>0&&E[0].originalIndex===T.length),me(({items:E})=>E[0].index),Pt())),x=$n(ie(y,Oe(({items:E})=>E.length>0),me(({items:E})=>{let T=0,_=E.length-1;for(;E[T].type==="group"&&T<_;)T++;for(;E[_].type==="group"&&_>T;)_--;return{startIndex:E[T].index,endIndex:E[_].index}}),Pt(c0)));return{listState:y,topItemsIndexes:v,endReached:S,startReached:C,rangeChanged:x,itemsRendered:w,initialItemCount:b,...p}},Tt(Ur,l0,Cp,Zi,Wi,Ki,Ro,vp),{singleton:!0}),C$=it(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:a},{didMount:i}])=>(ye(ie(i,je(s),Oe(([,l])=>l!==0),je(o,e,t,r,n),me(([[,l],u,d,f,p,g=[]])=>h0(l,u,d,f,p,g))),a),{}),Tt(Ur,Zi,Fs,Ro),{singleton:!0}),g0=it(([{scrollVelocity:e}])=>{const t=pe(!1),n=Ge(),r=pe(!1);return ye(ie(e,je(r,t,n),Oe(([o,s])=>!!s),me(([o,s,a,i])=>{const{exit:l,enter:u}=s;if(a){if(l(o,i))return!1}else if(u(o,i))return!0;return a}),Pt()),t),at(ie(zt(t,e,n),je(r)),([[o,s,a],i])=>o&&i&&i.change&&i.change(s,a)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Tt(Ki),{singleton:!0}),x$=it(([{topItemsIndexes:e}])=>{const t=pe(0);return ye(ie(t,Oe(n=>n>0),me(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Tt(Fs)),m0=it(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Ge(),a=un(ie(zt(e,r,t,n,o),me(([i,l,u,d,f])=>i+l+u+d+f.offsetBottom+f.bottom)),0);return ye(_e(a),s),{totalListHeight:a,totalListHeightChanged:s}},Tt(dn,Fs),{singleton:!0});function v0(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const E$=v0(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),T$=it(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:a,lastJumpDueToItemResize:i},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:f,gap:p},{log:g},{recalcInProgress:m}])=>{const v=$n(ie(l,je(i),zr(([,w,y,S],[{items:C,totalCount:x,bottom:E,offsetBottom:T},_])=>{const O=E+T;let P=0;return y===x&&w.length>0&&C.length>0&&(C[0].originalIndex===0&&w[0].originalIndex===0||(P=O-S,P!==0&&(P+=_))),[P,C,x,O]},[0,[],0,0]),Oe(([w])=>w!==0),je(t,a,r,s,g,m),Oe(([,w,y,S,,,C])=>!C&&!S&&w!==0&&y===Gi),me(([[w],,,,,y])=>(y("Upward scrolling compensation",{amount:w},kn.DEBUG),w))));function b(w){w>0?(Ve(e,{top:-w,behavior:"auto"}),Ve(n,0)):(Ve(n,0),Ve(e,{top:-w,behavior:"auto"}))}return at(ie(v,je(n,o)),([w,y,S])=>{S&&E$()?Ve(n,y-w):b(-w)}),at(ie(zt(un(o,!1),n,m),Oe(([w,y,S])=>!w&&!S&&y!==0),me(([w,y])=>y),Xo(1)),b),ye(ie(d,me(w=>({top:-w}))),e),at(ie(u,je(f,p),me(([w,{lastSize:y,groupIndices:S,sizeTree:C},x])=>{function E(T){return T*(y+x)}if(S.length===0)return E(w);{let T=0;const _=zi(C,0);let O=0,P=0;for(;O<w;){O++,T+=_;let A=S.length===P+1?1/0:S[P+1]-S[P]-1;O+A>w&&(T-=_,A=w-O+1),O+=A,T+=E(A),P++}return T}})),w=>{Ve(n,w),requestAnimationFrame(()=>{Ve(e,{top:w}),requestAnimationFrame(()=>{Ve(n,0),Ve(m,!1)})})}),{deviation:n}},Tt(dn,Ki,Fs,Ur,Jo,vp)),P$=it(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=pe(0);return at(ie(e,je(r),Oe(([,o])=>o!==0),me(([,o])=>({top:o}))),o=>{Fr(ie(n,Aa(1),Oe(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(t,o)})})}),{initialScrollTop:r}},Tt(Ro,dn,Fs),{singleton:!0}),O$=it(([{viewportHeight:e},{totalListHeight:t}])=>{const n=pe(!1),r=un(ie(zt(n,e,t),Oe(([o])=>o),me(([,o,s])=>Math.max(0,o-s)),Xo(0),Pt()),0);return{alignToBottom:n,paddingTopAddition:r}},Tt(dn,m0),{singleton:!0}),Ep=it(([{scrollTo:e,scrollContainerState:t}])=>{const n=Ge(),r=Ge(),o=Ge(),s=pe(!1),a=pe(void 0);return ye(ie(zt(n,r),me(([{viewportHeight:i,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:i}))),t),ye(ie(e,je(r),me(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),o),{useWindowScroll:s,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Tt(dn)),_$=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...a}})=>e<n?{...a,behavior:o,align:s??"start"}:t>r?{...a,behavior:o,align:s??"end"}:null,A$=it(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:a,fixedFooterHeight:i,scrollingInProgress:l},{scrollToIndex:u}])=>{const d=Ge();return ye(ie(d,je(e,o,t,s,a,i,r),je(n),me(([[f,p,g,m,v,b,w,y],S])=>{const{done:C,behavior:x,align:E,calculateViewLocation:T=_$,..._}=f,O=o0(f,p,m-1),P=Ui(O,p.offsetTree,S)+v+b,A=P+Sr(p.sizeTree,O)[1],M=y+b,$=y+g-w,j=T({itemTop:P,itemBottom:A,viewportTop:M,viewportBottom:$,locationParams:{behavior:x,align:E,..._}});return j?C&&Fr(ie(l,Oe(L=>L===!1),Aa(Rt(l)?1:2)),C):C&&C(),j}),Oe(f=>f!==null)),u),{scrollIntoView:d}},Tt(Ur,dn,Wi,Fs,Jo),{singleton:!0}),L$=it(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:a,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Ge(),d=pe(void 0),f=pe(null),p=pe(null);return ye(i,f),ye(l,p),at(ie(u,je(e,n,a,f,p,r)),([g,m,v,b,w,y,S])=>{const C=d$(m.sizeTree);b&&w!==null&&y!==null&&(v=w.scrollTop-y.offsetTop),v-=S,g({ranges:C,scrollTop:v})}),ye(ie(d,Oe(up),me(M$)),o),ye(ie(s,je(d),Oe(([,g])=>g!==void 0),Pt(),me(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:d}},Tt(Ur,dn,Zi,Ro,Ep));function M$(e){return{offset:e.scrollTop,index:0,align:"start"}}const N$=it(([e,t,n,r,o,s,a,i,l,u])=>({...e,...t,...n,...r,...o,...s,...a,...i,...l,...u}),Tt(Cp,C$,Ro,g0,m0,P$,O$,Ep,A$,Jo)),$$=it(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:a,firstItemIndex:i,groupIndices:l,statefulTotalCount:u,gap:d,sizes:f},{initialTopMostItemIndex:p,scrolledToInitialItem:g,initialItemFinalLocationReached:m},v,b,w,{listState:y,topItemsIndexes:S,...C},{scrollToIndex:x},E,{topItemCount:T},{groupCounts:_},O])=>(ye(C.rangeChanged,O.scrollSeekRangeChanged),ye(ie(O.windowViewportRect,me(P=>P.visibleHeight)),v.viewportHeight),{totalCount:e,data:a,firstItemIndex:i,sizeRanges:t,initialTopMostItemIndex:p,scrolledToInitialItem:g,initialItemFinalLocationReached:m,topItemsIndexes:S,topItemCount:T,groupCounts:_,fixedItemHeight:n,defaultItemHeight:r,gap:d,...w,statefulTotalCount:u,listState:y,scrollToIndex:x,trackItemSizes:o,itemSize:s,groupIndices:l,...C,...O,...v,sizes:f,...b}),Tt(Ur,Zi,dn,L$,y$,Fs,Wi,T$,x$,l0,N$)),Tp="-webkit-sticky",b0="sticky",y0=v0(()=>{if(typeof document>"u")return b0;const e=document.createElement("div");return e.style.position=Tp,e.style.position===Tp?Tp:b0});function w0(e,t,n){const r=h.useRef(null),o=h.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),d=u.width;let f,p;if(t){const g=t.getBoundingClientRect(),m=u.top-g.top;f=g.height-Math.max(0,m),p=m+t.scrollTop}else f=window.innerHeight-Math.max(0,u.top),p=u.top+window.pageYOffset;r.current={offsetTop:p,visibleHeight:f,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:a}=fp(o,!0,n),i=h.useCallback(()=>{o(a.current)},[o,a]);return h.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),s}const S0=h.createContext(void 0),C0=h.createContext(void 0);function x0(e){return e}const k$=it(([e,t])=>({...e,...t}),Tt($$,it(()=>{const e=pe(l=>`Item ${l}`),t=pe(null),n=pe(l=>`Group ${l}`),r=pe({}),o=pe(x0),s=pe("div"),a=pe(_a),i=(l,u=null)=>un(ie(r,me(d=>d[l]),Pt()),u);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,HeaderFooterTag:s,scrollerRef:a,FooterComponent:i("Footer"),HeaderComponent:i("Header"),TopItemListComponent:i("TopItemList"),ListComponent:i("List","div"),ItemComponent:i("Item","div"),GroupComponent:i("Group","div"),ScrollerComponent:i("Scroller","div"),EmptyPlaceholder:i("EmptyPlaceholder"),ScrollSeekPlaceholder:i("ScrollSeekPlaceholder")}}))),I$=({height:e})=>c.jsx("div",{style:{height:e}}),V$={position:y0(),zIndex:1,overflowAnchor:"none"},E0={overflowAnchor:"none"},H$={...E0,display:"inline-block",height:"100%"},T0=h.memo(function({showTopList:t=!1}){const n=Me("listState"),r=Qn("sizeRanges"),o=Me("useWindowScroll"),s=Me("customScrollParent"),a=Qn("windowScrollContainerState"),i=Qn("scrollContainerState"),l=s||o?a:i,u=Me("itemContent"),d=Me("context"),f=Me("groupContent"),p=Me("trackItemSizes"),g=Me("itemSize"),m=Me("log"),v=Qn("gap"),b=Me("horizontalDirection"),{callbackRef:w}=RN(r,g,p,t?_a:l,m,v,s,b,Me("skipAnimationFrameInResizeObserver")),[y,S]=h.useState(0);Pp("deviation",L=>{y!==L&&S(L)});const C=Me("EmptyPlaceholder"),x=Me("ScrollSeekPlaceholder")||I$,E=Me("ListComponent"),T=Me("ItemComponent"),_=Me("GroupComponent"),O=Me("computeItemKey"),P=Me("isSeeking"),A=Me("groupIndices").length>0,M=Me("alignToBottom"),$=Me("initialItemFinalLocationReached"),j=t?{}:{boxSizing:"border-box",...b?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:M?"auto":0}:{marginTop:y!==0?y:M?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...$?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&C?c.jsx(C,{...fn(C,d)}):c.jsx(E,{...fn(E,d),ref:w,style:j,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(L=>{const D=L.originalIndex,W=O(D+n.firstItemIndex,L.data,d);return P?h.createElement(x,{...fn(x,d),key:W,index:L.index,height:L.size,type:L.type||"item",...L.type==="group"?{}:{groupIndex:L.groupIndex}}):L.type==="group"?h.createElement(_,{...fn(_,d),key:W,"data-index":D,"data-known-size":L.size,"data-item-index":L.index,style:V$},f(L.index,d)):h.createElement(T,{...fn(T,d),...B$(T,L.data),key:W,"data-index":D,"data-known-size":L.size,"data-item-index":L.index,"data-item-group-index":L.groupIndex,style:b?H$:E0},A?u(L.index,L.groupIndex,L.data,d):u(L.index,L.data,d))})})}),j$={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},D$={outline:"none",overflowX:"auto",position:"relative"},Xc=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),F$={width:"100%",position:y0(),top:0,zIndex:1};function fn(e,t){if(typeof e!="string")return{context:t}}function B$(e,t){return{item:typeof e=="string"?void 0:t}}const z$=h.memo(function(){const t=Me("HeaderComponent"),n=Qn("headerHeight"),r=Me("HeaderFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(a,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),s=Me("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),U$=h.memo(function(){const t=Me("FooterComponent"),n=Qn("footerHeight"),r=Me("HeaderFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(a,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),s=Me("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null});function P0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:s,children:a,...i}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=n("scrollerRef"),p=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:v,scrollToCallback:b}=Yb(l,d,u,f,void 0,g);t("scrollTo",b),t("scrollBy",v);const w=g?D$:j$;return c.jsx(u,{ref:m,style:{...w,...s},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...i,...fn(u,p),children:a})})}function O0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:s,children:a,...i}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=n("totalListHeight"),p=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:v,scrollByCallback:b,scrollToCallback:w}=Yb(l,d,u,_a,g);return qb(()=>(v.current=g||window,()=>{v.current=null}),[v,g]),t("windowScrollTo",w),t("scrollBy",b),c.jsx(u,{style:{position:"relative",...s,...f!==0?{height:f+p}:{}},"data-virtuoso-scroller":!0,...i,...fn(u,m),children:a})})}const W$=({children:e})=>{const t=h.useContext(S0),n=Qn("viewportHeight"),r=Qn("fixedItemHeight"),o=Me("alignToBottom"),s=Me("horizontalDirection"),a=h.useMemo(()=>jb(n,l=>Qo(l,s?"width":"height")),[n,s]),i=js(a,!0,Me("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),c.jsx("div",{style:Xc(o),ref:i,"data-viewport-type":"element",children:e})},G$=({children:e})=>{const t=h.useContext(S0),n=Qn("windowViewportRect"),r=Qn("fixedItemHeight"),o=Me("customScrollParent"),s=w0(n,o,Me("skipAnimationFrameInResizeObserver")),a=Me("alignToBottom");return h.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),c.jsx("div",{ref:s,style:Xc(a),"data-viewport-type":"window",children:e})},q$=({children:e})=>{const t=Me("TopItemListComponent")||"div",n=Me("headerHeight"),r={...F$,marginTop:`${n}px`},o=Me("context");return c.jsx(t,{style:r,...fn(t,o),children:e})},K$=h.memo(function(t){const n=Me("useWindowScroll"),r=Me("topItemsIndexes").length>0,o=Me("customScrollParent"),s=o||n?X$:Y$,a=o||n?G$:W$;return c.jsxs(s,{...t,children:[r&&c.jsx(q$,{children:c.jsx(T0,{showTopList:!0})}),c.jsxs(a,{children:[c.jsx(z$,{}),c.jsx(T0,{}),c.jsx(U$,{})]})]})}),{Component:Z$,usePublisher:Qn,useEmitterValue:Me,useEmitter:Pp}=Gb(k$,{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"}},K$),Y$=P0({usePublisher:Qn,useEmitterValue:Me,useEmitter:Pp}),X$=O0({usePublisher:Qn,useEmitterValue:Me,useEmitter:Pp}),J$=Z$,_0={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},Q$={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:A0,ceil:L0,floor:Jc,min:Op,max:Xi}=Math;function R$(e){return{...Q$,items:e}}function M0(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function ek(e,t){return e&&e.column===t.column&&e.row===t.row}function Qc(e,t){return e&&e.width===t.width&&e.height===t.height}const tk=it(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:r},{scrollTop:o,viewportHeight:s,scrollBy:a,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:f},p,g,{propsReady:m,didMount:v},{windowViewportRect:b,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,windowScrollTo:C},x])=>{const E=pe(0),T=pe(0),_=pe(_0),O=pe({height:0,width:0}),P=pe({height:0,width:0}),A=Ge(),M=Ge(),$=pe(0),j=pe(null),L=pe({row:0,column:0}),D=Ge(),W=Ge(),F=pe(!1),k=pe(0),H=pe(!0),V=pe(!1),U=pe(!1);at(ie(v,je(k),Oe(([G,R])=>!!R)),()=>{Ve(H,!1)}),at(ie(zt(v,H,P,O,k,V),Oe(([G,R,le,ge,,Ee])=>G&&!R&&le.height!==0&&ge.height!==0&&!Ee)),([,,,,G])=>{Ve(V,!0),wp(1,()=>{Ve(A,G)}),Fr(ie(o),()=>{Ve(n,[0,0]),Ve(H,!0)})}),ye(ie(W,Oe(G=>G!=null&&G.scrollTop>0),Br(0)),T),at(ie(v,je(W),Oe(([,G])=>G!=null)),([,G])=>{G&&(Ve(O,G.viewport),Ve(P,G==null?void 0:G.item),Ve(L,G.gap),G.scrollTop>0&&(Ve(F,!0),Fr(ie(o,Aa(1)),R=>{Ve(F,!1)}),Ve(i,{top:G.scrollTop})))}),ye(ie(O,me(({height:G})=>G)),s),ye(ie(zt(_e(O,Qc),_e(P,Qc),_e(L,(G,R)=>G&&G.column===R.column&&G.row===R.row),_e(o)),me(([G,R,le,ge])=>({viewport:G,item:R,gap:le,scrollTop:ge}))),D),ye(ie(zt(_e(E),t,_e(L,ek),_e(P,Qc),_e(O,Qc),_e(j),_e(T),_e(F),_e(H),_e(k)),Oe(([,,,,,,,G])=>!G),me(([G,[R,le],ge,Ee,Ce,tt,Qe,,Ot,ut])=>{const{row:Se,column:ot}=ge,{height:st,width:wt}=Ee,{width:Ne}=Ce;if(Qe===0&&(G===0||Ne===0))return _0;if(wt===0){const Gt=Sp(ut,G),wo=Math.max(Gt+Qe-1,0);return R$(M0(Gt,wo,tt))}const mt=$0(Ne,wt,ot);let dt,Ue;Ot?R===0&&le===0&&Qe>0?(dt=0,Ue=Qe-1):(dt=mt*Jc((R+Se)/(st+Se)),Ue=mt*L0((le+Se)/(st+Se))-1,Ue=Op(G-1,Xi(Ue,mt-1)),dt=Op(Ue,Xi(0,dt))):(dt=0,Ue=-1);const en=M0(dt,Ue,tt),{top:he,bottom:De}=N0(Ce,ge,Ee,en),Fe=L0(G/mt),Mt=Fe*st+(Fe-1)*Se-De;return{items:en,offsetTop:he,offsetBottom:Mt,top:he,bottom:De,itemHeight:st,itemWidth:wt}})),_),ye(ie(j,Oe(G=>G!==null),me(G=>G.length)),E),ye(ie(zt(O,P,_,L),Oe(([G,R,{items:le}])=>le.length>0&&R.height!==0&&G.height!==0),me(([G,R,{items:le},ge])=>{const{top:Ee,bottom:Ce}=N0(G,ge,R,le);return[Ee,Ce]}),Pt(Yi)),n);const J=pe(!1);ye(ie(o,je(J),me(([G,R])=>R||G!==0)),J);const Y=$n(ie(_e(_),Oe(({items:G})=>G.length>0),je(E,J),Oe(([{items:G},R,le])=>le&&G[G.length-1].index===R-1),me(([,G])=>G-1),Pt())),X=$n(ie(_e(_),Oe(({items:G})=>G.length>0&&G[0].index===0),Br(0),Pt())),Q=$n(ie(_e(_),je(F),Oe(([{items:G},R])=>G.length>0&&!R),me(([{items:G}])=>({startIndex:G[0].index,endIndex:G[G.length-1].index})),Pt(c0),Xo(0)));ye(Q,g.scrollSeekRangeChanged),ye(ie(A,je(O,P,E,L),me(([G,R,le,ge,Ee])=>{const Ce=a0(G),{align:tt,behavior:Qe,offset:Ot}=Ce;let ut=Ce.index;ut==="LAST"&&(ut=ge-1),ut=Xi(0,ut,Op(ge-1,ut));let Se=_p(R,Ee,le,ut);return tt==="end"?Se=A0(Se-R.height+le.height):tt==="center"&&(Se=A0(Se-R.height/2+le.height/2)),Ot&&(Se+=Ot),{top:Se,behavior:Qe}})),i);const ee=un(ie(_,me(G=>G.offsetBottom+G.bottom)),0);return ye(ie(b,me(G=>({width:G.visibleWidth,height:G.visibleHeight}))),O),{data:j,totalCount:E,viewportDimensions:O,itemDimensions:P,scrollTop:o,scrollHeight:M,overscan:e,increaseViewportBy:r,scrollBy:a,scrollTo:i,scrollToIndex:A,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:C,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,deviation:$,scrollContainerState:u,footerHeight:d,headerHeight:f,initialItemCount:T,gap:L,restoreStateFrom:W,...g,initialTopMostItemIndex:k,horizontalDirection:U,gridState:_,totalListHeight:ee,...p,startReached:X,endReached:Y,rangeChanged:Q,stateChanged:D,propsReady:m,stateRestoreInProgress:F,...x}},Tt(Cp,dn,Ki,g0,Ro,Ep,Jo));function N0(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=_p(e,t,n,r[0].index),a=_p(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:a}}function _p(e,t,n,r){const o=$0(e.width,n.width,t.column),s=Jc(r/o),a=s*n.height+Xi(0,s-1)*t.row;return a>0?a+t.row:a}function $0(e,t,n){return Xi(1,Jc((e+n)/(Jc(t)+n)))}const nk=it(([e,t])=>({...e,...t}),Tt(tk,it(()=>{const e=pe(f=>`Item ${f}`),t=pe({}),n=pe(null),r=pe("virtuoso-grid-item"),o=pe("virtuoso-grid-list"),s=pe(x0),a=pe("div"),i=pe(_a),l=(f,p=null)=>un(ie(t,me(g=>g[f]),Pt()),p),u=pe(!1),d=pe(!1);return ye(_e(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:a,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}))),rk=h.memo(function(){const t=At("gridState"),n=At("listClassName"),r=At("itemClassName"),o=At("itemContent"),s=At("computeItemKey"),a=At("isSeeking"),i=Rn("scrollHeight"),l=At("ItemComponent"),u=At("ListComponent"),d=At("ScrollSeekPlaceholder"),f=At("context"),p=Rn("itemDimensions"),g=Rn("gap"),m=At("log"),v=At("stateRestoreInProgress"),b=Rn("reportReadyState"),w=js(h.useMemo(()=>y=>{const S=y.parentElement.parentElement.scrollHeight;i(S);const C=y.firstChild;if(C){const{width:x,height:E}=C.getBoundingClientRect();p({width:x,height:E})}g({row:I0("row-gap",getComputedStyle(y).rowGap,m),column:I0("column-gap",getComputedStyle(y).columnGap,m)})},[i,p,g,m]),!0,!1);return qb(()=>{t.itemHeight>0&&t.itemWidth>0&&b(!0)},[t]),v?null:c.jsx(u,{ref:w,className:n,...fn(u,f),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const S=s(y.index,y.data,f);return a?c.jsx(d,{...fn(d,f),index:y.index,height:t.itemHeight,width:t.itemWidth},S):h.createElement(l,{...fn(l,f),className:r,"data-index":y.index,key:S},o(y.index,y.data,f))})})}),ok=h.memo(function(){const t=At("HeaderComponent"),n=Rn("headerHeight"),r=At("headerFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),sk=h.memo(function(){const t=At("FooterComponent"),n=Rn("footerHeight"),r=At("headerFooterTag"),o=js(h.useMemo(()=>a=>n(Qo(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),ak=({children:e})=>{const t=h.useContext(C0),n=Rn("itemDimensions"),r=Rn("viewportDimensions"),o=js(h.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return h.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),c.jsx("div",{style:Xc(!1),ref:o,children:e})},ik=({children:e})=>{const t=h.useContext(C0),n=Rn("windowViewportRect"),r=Rn("itemDimensions"),o=At("customScrollParent"),s=w0(n,o,!1);return h.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),c.jsx("div",{ref:s,style:Xc(!1),children:e})},lk=h.memo(function({...t}){const n=At("useWindowScroll"),r=At("customScrollParent"),o=r||n?dk:uk,s=r||n?ik:ak;return c.jsx(o,{...t,children:c.jsxs(s,{children:[c.jsx(ok,{}),c.jsx(rk,{}),c.jsx(sk,{})]})})}),{Component:ck,usePublisher:Rn,useEmitterValue:At,useEmitter:k0}=Gb(nk,{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"}},lk),uk=P0({usePublisher:Rn,useEmitterValue:At,useEmitter:k0}),dk=O0({usePublisher:Rn,useEmitterValue:At,useEmitter:k0});function I0(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,kn.WARN),t==="normal"?0:parseInt(t??"0",10)}const Rc=ck,Ap=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},fk=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function pk(e){const t=e.map(({id:a,src:i})=>({id:a,src:i})),n=e.reduce((a,i)=>(a[i.id]=i,a),{}),r=[],o=[];return(await jS(t)).forEach(a=>{a.status==="fulfilled"?r.push(n[a.value]):o.push(n[a.reason])}),{loaded:r,failed:o}}const hk=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{fk(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await pk(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},gk=(e,t,n,r={})=>{const{skipReplace:o}=r;e.loadData(t);const s=e.getCss()||"",a=o?s:s.replace(/:root\s*{/gi,"[data-body]{");let i=`${e.getHtml()}<style>${a}</style>`;if(n===xt.email)try{i=e.runCommand(Oc).html}catch(l){console.error(l)}return r.removeScripts&&(i=i.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),o?i:i.replace("<body","<div data-body").replace("</body>","</div>")},mk=async(e,t,n)=>{const r=hS(t,{appStore:n}),o=await hk(r);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...o.plugins,s=>{s.Storage.setCurrent("")}],pluginsOpts:o.pluginOptions,protectedCss:`
303
+ `}),c.jsx(Jn,{className:"gs-banner",children:c.jsxs(I,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:CN(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(jc,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:r})})),kb="gs-canvas-content",EN=h.memo(ce(function({children:t}){const{isReady:n}=we(),r=N(`${kb}__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:kb,children:[c.jsx("div",{className:r}),!n&&c.jsx(Mo,{className:N("gs-utl-z-10"),abs:!0,full:!0}),n&&kt(t)]}),c.jsx(SN,{}),c.jsx(xN,{})]})})),TN="gs-canvas",$b=h.memo(function({className:t,style:n,grow:r,children:o}){return c.jsx(iN,{style:n,className:N(TN,"gs-utl-relative",r&&"gs-utl-flex-grow",t),children:c.jsx(Bi,{children:c.jsx(EN,{children:o})})})}),uf=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),PN=uf?Promise.resolve().then(function(){return NN}):Promise.resolve().then(function(){return jN});async function ON(...e){return(await PN).default(...e)}uf?Promise.resolve().then(function(){return $N}):Promise.resolve().then(function(){return FN});const _N=uf?Promise.resolve().then(function(){return VN}):Promise.resolve().then(function(){return zN});async function AN(...e){return(await _N).default(...e)}const LN=async e=>{const t=await e.getFile();return t.handle=e,t};var MN=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((o,s)=>{t[s]={description:o.description||"Files",accept:{}},o.mimeTypes?o.mimeTypes.map(a=>{t[s].accept[a]=o.extensions||[]}):t[s].accept["*/*"]=o.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}),r=await Promise.all(n.map(LN));return e[0].multiple?r:r[0]},NN={__proto__:null,default:MN};function Dc(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(o){return{value:o,done:r}})}return Dc=function(n){this.s=n,this.n=n.next},Dc.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var r=this.s.return;return r===void 0?Promise.resolve({value:n,done:!0}):t(r.apply(this.s,arguments))},throw:function(n){var r=this.s.return;return r===void 0?Promise.reject(n):t(r.apply(this.s,arguments))}},new Dc(e)}const Ib=async(e,t,n=e.name,r)=>{const o=[],s=[];var a,i=!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 Dc(f.call(p));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());i=!(u=await d.next()).done;i=!1){const p=u.value,f=`${n}/${p.name}`;p.kind==="file"?s.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||r&&r(p)||o.push(Ib(p,t,f,r))}}catch(p){l=!0,a=p}finally{try{i&&d.return!=null&&await d.return()}finally{if(l)throw a}}return[...(await Promise.all(o)).flat(),...await Promise.all(s)]};var kN=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]:Ib(t,e.recursive,void 0,e.skipDirectory)},$N={__proto__:null,default:kN},IN=async(e,t=[{}],n=null,r=!1,o=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const s=[];let a=null;if(e instanceof Blob&&e.type?a=e.type:e.headers&&e.headers.get("content-type")&&(a=e.headers.get("content-type")),t.forEach((u,d)=>{s[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&a&&u.mimeTypes.push(a),u.mimeTypes.map(p=>{s[d].accept[p]=u.extensions||[]})):a?s[d].accept[a]=u.extensions||[]:s[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,r)throw u}const i=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:s,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&o&&o(i);const l=await i.createWritable();return"stream"in e?(await e.stream().pipeTo(l),i):"body"in e?(await e.body.pipeTo(l),i):(await l.write(await e),await l.close(),i)},VN={__proto__:null,default:IN},HN=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const r=document.createElement("input");r.type="file";const o=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();r.multiple=e[0].multiple||!1,r.accept=o||"",r.style.display="none",document.body.append(r);const s=l=>{typeof a=="function"&&a(),t(l)},a=e[0].legacySetup&&e[0].legacySetup(s,()=>a(n),r),i=()=>{window.removeEventListener("focus",i),r.remove()};r.addEventListener("click",()=>{window.addEventListener("focus",i)}),r.addEventListener("change",()=>{window.removeEventListener("focus",i),r.remove(),s(r.multiple?Array.from(r.files):r.files[0])}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),jN={__proto__:null,default:HN},DN=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const r=document.createElement("input");r.type="file",r.webkitdirectory=!0;const o=a=>{typeof s=="function"&&s(),t(a)},s=e[0].legacySetup&&e[0].legacySetup(o,()=>s(n),r);r.addEventListener("change",()=>{let a=Array.from(r.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(a=a.filter(i=>i.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):a=a.filter(i=>i.webkitRelativePath.split("/").length===2),o(a)}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),FN={__proto__:null,default:DN},BN=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let r=e;"body"in e&&(r=await async function(a,i){const l=a.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:i})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await r);const o=()=>{typeof s=="function"&&s()},s=t.legacySetup&&t.legacySetup(o,()=>s(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),o()}),n.click(),null},zN={__proto__:null,default:BN};function Zo({children:e,label:t,s:n="m",pill:r,border:o,nopad:s,className:a,block:i,...l}){return c.jsx("div",{className:N(!i&&"gs-utl-inline-block",a,!s&&Pe.xyS2,r?te.pill:te.rnd,o&&`${te.b} ${z.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Vb={NODE_ENV:"production"};const UN=Vb.REACT_APP_VERSION??Vb.NPM_PACKAGE_VERSION,WN=ce(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsxs(B,{className:ae("relative"),children:[c.jsx(jc,{className:ae("w-24 opacity-50")}),t&&c.jsx(Zo,{className:ae(z.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(B,{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:ae(Lo.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:ae(Lo.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(B,{className:ae(z.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",UN]})]})}),GN=ce(function(){return c.jsxs(I,{col:!0,space:"m",children:[c.jsx(I,{justify:"center",children:c.jsx(B,{className:Z("relative"),children:c.jsx(jc,{className:Z("w-24 opacity-50")})})}),c.jsx(B,{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:Z(Lo.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:Z(Lo.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),qN=()=>[{id:xt.web,label:_r(xt.web),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(re,{icon:q.web,size:se.s}),c.jsx("span",{children:_r(xt.web)})]})},{id:xt.email,label:_r(xt.email),content:c.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(re,{icon:q.emailOutline,size:se.s}),c.jsx("span",{children:_r(xt.email)})]})}],Fc="gs-cmp-tabs";function Yo({tabs:e,className:t,classNamePanel:n,classNameTab:r,variant:o,style:s,onChange:a=ZS,value:i}){const l=o==="pills",u=l?N("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",z.bgH):"",d=v=>l?N("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",v?z.bg:""):N("gs-utl-border-b-2",Pe.xy),p=v=>{v&&(v.tabIndex=-1)},f=v=>{const b=v.currentTarget;setTimeout(()=>b.blur(),10)},g=Vt(i)?e.findIndex(v=>v.id===i):void 0,m=!e.some(v=>!!v.content);return c.jsxs(fi.Group,{onChange:v=>a(e[v].id),defaultIndex:e.findIndex(v=>v.id===i),selectedIndex:g,children:[c.jsx(fi.List,{as:I,className:N(Fc,t,u),style:s,full:!0,nowrap:!0,children:e.map(v=>c.jsx(fi,{disabled:v.disabled,className:({selected:b})=>N(`${Fc}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",v.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",ri.focus,d(b),b?`${z.tAo} ${z.bA}`:z.br,r),children:v.label},v.id))}),c.jsx(fi.Panels,{className:N(`${Fc}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(v=>c.jsx(fi.Panel,{tabIndex:-1,className:N(`${Fc}__panel`,"gs-utl-h-full"),ref:p,onFocus:f,children:v.content},v.id))})]})}const Bc=0,Xo=1,_a=2,Hb=4;function jb(e,t){return n=>e(t(n))}function KN(e,t){return t(e)}function Db(e,t){return n=>e(t,n)}function Fb(e,t){return()=>e(t)}function zc(e,t){return t(e),e}function Tt(...e){return e}function ZN(e){e()}function Bb(e){return()=>e}function YN(...e){return()=>{e.map(ZN)}}function df(e){return e!==void 0}function Aa(){}function at(e,t){return e(Xo,t)}function Ve(e,t){e(Bc,t)}function pf(e){e(_a)}function en(e){return e(Hb)}function ye(e,t){return at(e,Db(t,Bc))}function zr(e,t){const n=e(Xo,r=>{n(),t(r)});return n}function Ge(){const e=[];return(t,n)=>{switch(t){case _a:e.splice(0,e.length);return;case Xo:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case Bc:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function fe(e){let t=e;const n=Ge();return(r,o)=>{switch(r){case Xo:o(t);break;case Bc:t=o;break;case Hb:return t}return n(r,o)}}function XN(e){let t,n;const r=()=>t&&t();return function(o,s){switch(o){case Xo:return s?n===s?void 0:(r(),n=s,t=at(e,s),t):(r(),Aa);case _a:r(),n=null;return;default:throw new Error(`unrecognized action ${o}`)}}}function $n(e){return zc(Ge(),t=>ye(e,t))}function dn(e,t){return zc(fe(t),n=>ye(e,n))}function JN(...e){return t=>e.reduceRight(KN,t)}function ie(e,...t){const n=JN(...t);return(r,o)=>{switch(r){case Xo:return at(e,n(o));case _a:pf(e);return}}}function zb(e,t){return e===t}function Pt(e=zb){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function _e(e){return t=>n=>{e(n)&&t(n)}}function me(e){return t=>jb(t,e)}function Ur(e){return t=>()=>t(e)}function Wr(e,t){return n=>r=>n(t=e(t,r))}function La(e){return t=>n=>{e>0?e--:t(n)}}function Jo(e){let t=null,n;return r=>o=>{t=o,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Ub(e){let t,n;return r=>o=>{t=o,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function je(...e){const t=new Array(e.length);let n=0,r=null;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);at(s,l=>{const u=n;n=n|i,t[a]=l,u!==o&&n===o&&r&&(r(),r=null)})}),s=>a=>{const i=()=>s([a].concat(t));n===o?i():r=i}}function Wb(...e){return function(t,n){switch(t){case Xo:return YN(...e.map(r=>at(r,n)));case _a:return;default:throw new Error(`unrecognized action ${t}`)}}}function Ae(e,t=zb){return ie(e,Pt(t))}function Bt(...e){const t=Ge(),n=new Array(e.length);let r=0;const o=Math.pow(2,e.length)-1;return e.forEach((s,a)=>{const i=Math.pow(2,a);at(s,l=>{n[a]=l,r=r|i,r===o&&Ve(t,n)})}),function(s,a){switch(s){case Xo:return r===o&&a(n),at(t,a);case _a:return pf(t);default:throw new Error(`unrecognized action ${s}`)}}}function it(e,t=[],{singleton:n}={singleton:!0}){return{id:QN(),constructor:e,dependencies:t,singleton:n}}const QN=()=>Symbol();function RN(e){const t=new Map,n=({id:r,constructor:o,dependencies:s,singleton:a})=>{if(a&&t.has(r))return t.get(r);const i=o(s.map(l=>n(l)));return a&&t.set(r,i),i};return n(e)}function ek(e,t){const n={},r={};let o=0;const s=e.length;for(;o<s;)r[e[o]]=1,o+=1;for(const a in t)r.hasOwnProperty(a)||(n[a]=t[a]);return n}const Uc=typeof document<"u"?h.useLayoutEffect:h.useEffect;function Gb(e,t,n){const r=Object.keys(t.required||{}),o=Object.keys(t.optional||{}),s=Object.keys(t.methods||{}),a=Object.keys(t.events||{}),i=h.createContext({});function l(w,y){w.propsReady&&Ve(w.propsReady,!1);for(const S of r){const C=w[t.required[S]];Ve(C,y[S])}for(const S of o)if(S in y){const C=w[t.optional[S]];Ve(C,y[S])}w.propsReady&&Ve(w.propsReady,!0)}function u(w){return s.reduce((y,S)=>(y[S]=C=>{const x=w[t.methods[S]];Ve(x,C)},y),{})}function d(w){return a.reduce((y,S)=>(y[S]=XN(w[t.events[S]]),y),{})}const p=h.forwardRef((w,y)=>{const{children:S,...C}=w,[x]=h.useState(()=>zc(RN(e),_=>l(_,C))),[E]=h.useState(Fb(d,x));Uc(()=>{for(const _ of a)_ in C&&at(E[_],C[_]);return()=>{Object.values(E).map(pf)}},[C,E,x]),Uc(()=>{l(x,C)}),h.useImperativeHandle(y,Bb(u(x)));const T=n;return c.jsx(i.Provider,{value:x,children:n?c.jsx(T,{...ek([...r,...o,...a],C),children:S}):S})}),f=w=>h.useCallback(Db(Ve,h.useContext(i)[w]),[w]),g=w=>{const S=h.useContext(i)[w],C=h.useCallback(x=>at(S,x),[S]);return h.useSyncExternalStore(C,()=>en(S),()=>en(S))},m=w=>{const S=h.useContext(i)[w],[C,x]=h.useState(Fb(en,S));return Uc(()=>at(S,E=>{E!==C&&x(Bb(E))}),[S,C]),C},v=h.version.startsWith("18")?g:m;return{Component:p,usePublisher:f,useEmitterValue:v,useEmitter:(w,y)=>{const C=h.useContext(i)[w];Uc(()=>at(C,y),[y,C])}}}const qb=typeof document<"u"?h.useLayoutEffect:h.useEffect;var In=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(In||{});const tk={0:"debug",1:"log",2:"warn",3:"error"},nk=()=>typeof globalThis>"u"?window:globalThis,Qo=it(()=>{const e=fe(3);return{log:fe((n,r,o=1)=>{var s;const a=(s=nk().VIRTUOSO_LOG_LEVEL)!=null?s:en(e);o>=a&&console[tk[o]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function ff(e,t,n){const r=h.useRef(null);let o=s=>{};if(typeof ResizeObserver<"u"){const s=h.useMemo(()=>new ResizeObserver(a=>{const i=()=>{const l=a[0].target;l.offsetParent!==null&&e(l)};n?i():requestAnimationFrame(i)}),[e]);o=a=>{a&&t?(s.observe(a),r.current=a):(r.current&&s.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:o}}function Ds(e,t,n){return ff(e,t,n).callbackRef}function rk(e,t,n,r,o,s,a,i,l){const u=h.useCallback(d=>{const p=ok(d.children,t,i?"offsetWidth":"offsetHeight",o);let f=d.parentElement;for(;!f.dataset.virtuosoScroller;)f=f.parentElement;const g=f.lastElementChild.dataset.viewportType==="window",m=a?i?a.scrollLeft:a.scrollTop:g?i?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:i?f.scrollLeft:f.scrollTop,v=a?i?a.scrollWidth:a.scrollHeight:g?i?document.documentElement.scrollWidth:document.documentElement.scrollHeight:i?f.scrollWidth:f.scrollHeight,b=a?i?a.offsetWidth:a.offsetHeight:g?i?window.innerWidth:window.innerHeight:i?f.offsetWidth:f.offsetHeight;r({scrollTop:Math.max(m,0),scrollHeight:v,viewportHeight:b}),s==null||s(i?Kb("column-gap",getComputedStyle(d).columnGap,o):Kb("row-gap",getComputedStyle(d).rowGap,o)),p!==null&&e(p)},[e,t,o,s,a,r]);return ff(u,n,l)}function ok(e,t,n,r){const o=e.length;if(o===0)return null;const s=[];for(let a=0;a<o;a++){const i=e.item(a);if(!i||i.dataset.index===void 0)continue;const l=parseInt(i.dataset.index),u=parseFloat(i.dataset.knownSize),d=t(i,n);if(d===0&&r("Zero-sized element, this should not happen",{child:i},In.ERROR),d===u)continue;const p=s[s.length-1];s.length===0||p.size!==d||p.endIndex!==l-1?s.push({startIndex:l,endIndex:l,size:d}):s[s.length-1].endIndex++}return s}function Kb(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,In.WARN),t==="normal"?0:parseInt(t??"0",10)}function Ro(e,t){return Math.round(e.getBoundingClientRect()[t])}function Zb(e,t){return Math.abs(e-t)<1.01}function Yb(e,t,n,r=Aa,o,s){const a=h.useRef(null),i=h.useRef(null),l=h.useRef(null),u=h.useCallback(f=>{const g=f.target,m=g===window||g===document,v=s?m?window.pageXOffset||document.documentElement.scrollLeft:g.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=s?m?document.documentElement.scrollWidth:g.scrollWidth:m?document.documentElement.scrollHeight:g.scrollHeight,w=s?m?window.innerWidth:g.offsetWidth:m?window.innerHeight:g.offsetHeight,y=()=>{e({scrollTop:Math.max(v,0),scrollHeight:b,viewportHeight:w})};f.suppressFlushSync?y():zn.flushSync(y),i.current!==null&&(v===i.current||v<=0||v===b-w)&&(i.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);h.useEffect(()=>{const f=o||a.current;return r(o||a.current),u({target:f,suppressFlushSync:!0}),f.addEventListener("scroll",u,{passive:!0}),()=>{r(null),f.removeEventListener("scroll",u)}},[a,u,n,r,o]);function d(f){const g=a.current;if(!g||(s?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=f.behavior==="smooth";let v,b,w;g===window?(b=Math.max(Ro(document.documentElement,s?"width":"height"),s?document.documentElement.scrollWidth:document.documentElement.scrollHeight),v=s?window.innerWidth:window.innerHeight,w=s?document.documentElement.scrollLeft:document.documentElement.scrollTop):(b=g[s?"scrollWidth":"scrollHeight"],v=Ro(g,s?"width":"height"),w=g[s?"scrollLeft":"scrollTop"]);const y=b-v;if(f.top=Math.ceil(Math.max(Math.min(y,f.top),0)),Zb(v,b)||f.top===w){e({scrollTop:w,scrollHeight:b,viewportHeight:v}),m&&t(!0);return}m?(i.current=f.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,i.current=null,t(!0)},1e3)):i.current=null,s&&(f={left:f.top,behavior:f.behavior}),g.scrollTo(f)}function p(f){s&&(f={left:f.top,behavior:f.behavior}),a.current.scrollBy(f)}return{scrollerRef:a,scrollByCallback:p,scrollToCallback:d}}const pn=it(()=>{const e=Ge(),t=Ge(),n=fe(0),r=Ge(),o=fe(0),s=Ge(),a=Ge(),i=fe(0),l=fe(0),u=fe(0),d=fe(0),p=Ge(),f=Ge(),g=fe(!1),m=fe(!1),v=fe(!1);return ye(ie(e,me(({scrollTop:b})=>b)),t),ye(ie(e,me(({scrollHeight:b})=>b)),a),ye(t,o),{scrollContainerState:e,scrollTop:t,viewportHeight:s,headerHeight:i,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:a,smoothScrollTargetReached:r,horizontalDirection:m,skipAnimationFrameInResizeObserver:v,scrollTo:p,scrollBy:f,statefulScrollTop:o,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),zi={lvl:0};function Xb(e,t,n,r=zi,o=zi){return{k:e,v:t,lvl:n,l:r,r:o}}function ht(e){return e===zi}function Ma(){return zi}function hf(e,t){if(ht(e))return zi;const{k:n,l:r,r:o}=e;if(t===n){if(ht(r))return o;if(ht(o))return r;{const[s,a]=Jb(r);return Wc(Dt(e,{k:s,v:a,l:Qb(r)}))}}else return t<n?Wc(Dt(e,{l:hf(r,t)})):Wc(Dt(e,{r:hf(o,t)}))}function Ui(e,t){if(!ht(e))return t===e.k?e.v:t<e.k?Ui(e.l,t):Ui(e.r,t)}function xr(e,t,n="k"){if(ht(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const r=xr(e.r,t,n);return r[0]===-1/0?[e.k,e.v]:r}return xr(e.l,t,n)}function Vn(e,t,n){return ht(e)?Xb(t,n,1):t===e.k?Dt(e,{k:t,v:n}):t<e.k?Rb(Dt(e,{l:Vn(e.l,t,n)})):Rb(Dt(e,{r:Vn(e.r,t,n)}))}function gf(e,t,n){if(ht(e))return[];const{k:r,v:o,l:s,r:a}=e;let i=[];return r>t&&(i=i.concat(gf(s,t,n))),r>=t&&r<=n&&i.push({k:r,v:o}),r<=n&&(i=i.concat(gf(a,t,n))),i}function Fs(e){return ht(e)?[]:[...Fs(e.l),{k:e.k,v:e.v},...Fs(e.r)]}function Jb(e){return ht(e.r)?[e.k,e.v]:Jb(e.r)}function Qb(e){return ht(e.r)?e.l:Wc(Dt(e,{r:Qb(e.r)}))}function Dt(e,t){return Xb(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 mf(e){return ht(e)||e.lvl>e.r.lvl}function Rb(e){return vf(t0(e))}function Wc(e){const{l:t,r:n,lvl:r}=e;if(n.lvl>=r-1&&t.lvl>=r-1)return e;if(r>n.lvl+1){if(mf(t))return t0(Dt(e,{lvl:r-1}));if(!ht(t)&&!ht(t.r))return Dt(t.r,{l:Dt(t,{r:t.r.l}),r:Dt(e,{l:t.r.r,lvl:r-1}),lvl:r});throw new Error("Unexpected empty nodes")}else{if(mf(e))return vf(Dt(e,{lvl:r-1}));if(!ht(n)&&!ht(n.l)){const o=n.l,s=mf(o)?n.lvl-1:n.lvl;return Dt(o,{l:Dt(e,{r:o.l,lvl:r-1}),r:vf(Dt(n,{l:o.r,lvl:s})),lvl:o.lvl+1})}else throw new Error("Unexpected empty nodes")}}function Gc(e,t,n){if(ht(e))return[];const r=xr(e,t)[0];return sk(gf(e,r,n))}function e0(e,t){const n=e.length;if(n===0)return[];let{index:r,value:o}=t(e[0]);const s=[];for(let a=1;a<n;a++){const{index:i,value:l}=t(e[a]);s.push({start:r,end:i-1,value:o}),r=i,o=l}return s.push({start:r,end:1/0,value:o}),s}function sk(e){return e0(e,({k:t,v:n})=>({index:t,value:n}))}function vf(e){const{r:t,lvl:n}=e;return!ht(t)&&!ht(t.r)&&t.lvl===n&&t.r.lvl===n?Dt(t,{l:Dt(e,{r:t.l}),lvl:n+1}):e}function t0(e){const{l:t}=e;return!ht(t)&&t.lvl===e.lvl?Dt(t,{r:Dt(e,{l:t.r})}):e}function qc(e,t,n,r=0){let o=e.length-1;for(;r<=o;){const s=Math.floor((r+o)/2),a=e[s],i=n(a,t);if(i===0)return s;if(i===-1){if(o-r<2)return s-1;o=s-1}else{if(o===r)return s;r=s+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function n0(e,t,n){return e[qc(e,t,n)]}function ak(e,t,n,r){const o=qc(e,t,r),s=qc(e,n,r,o);return e.slice(o,s+1)}const bf=it(()=>({recalcInProgress:fe(!1)}),[],{singleton:!0});function ik(e){const{size:t,startIndex:n,endIndex:r}=e;return o=>o.start===n&&(o.end===r||o.end===1/0)&&o.value===t}function r0(e,t){let n=0,r=0;for(;n<e;)n+=t[r+1]-t[r]-1,r++;return r-(n===e?0:1)}function lk(e,t){let n=ht(e)?0:1/0;for(const r of t){const{size:o,startIndex:s,endIndex:a}=r;if(n=Math.min(n,s),ht(e)){e=Vn(e,0,o);continue}const i=Gc(e,s-1,a+1);if(i.some(ik(r)))continue;let l=!1,u=!1;for(const{start:d,end:p,value:f}of i)l?(a>=d||o===f)&&(e=hf(e,d)):(u=f!==o,l=!0),p>a&&a>=d&&f!==o&&(e=Vn(e,a+1,f));u&&(e=Vn(e,s,o))}return[e,n]}function ck(){return{offsetTree:[],sizeTree:Ma(),groupOffsetTree:Ma(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function yf({index:e},t){return t===e?0:t<e?-1:1}function uk({offset:e},t){return t===e?0:t<e?-1:1}function dk(e){return{index:e.index,value:e}}function pk(e,t,n,r=0){return r>0&&(t=Math.max(t,n0(e,r,yf).offset)),e0(ak(e,t,n,uk),dk)}function wf(e,t,n,r){let o=e,s=0,a=0,i=0,l=0;if(t!==0){l=qc(o,t-1,yf),i=o[l].offset;const d=xr(n,t-1);s=d[0],a=d[1],o.length&&o[l].size===xr(n,t)[1]&&(l-=1),o=o.slice(0,l+1)}else o=[];for(const{start:u,value:d}of Gc(n,t,1/0)){const p=u-s,f=p*a+i+p*r;o.push({offset:f,size:d,index:u}),s=u,i=f,a=d}return{offsetTree:o,lastIndex:s,lastOffset:i,lastSize:a}}function fk(e,[t,n,r,o]){t.length>0&&r("received item sizes",t,In.DEBUG);const s=e.sizeTree;let a=s,i=0;if(n.length>0&&ht(s)&&t.length===2){const f=t[0].size,g=t[1].size;a=n.reduce((m,v)=>Vn(Vn(m,v,f),v+1,g),a)}else[a,i]=lk(a,t);if(a===s)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:p}=wf(e.offsetTree,i,a,o);return{sizeTree:a,offsetTree:l,lastIndex:u,lastOffset:p,lastSize:d,groupOffsetTree:n.reduce((f,g)=>Vn(f,g,Wi(g,l,o)),Ma()),groupIndices:n}}function Wi(e,t,n){if(t.length===0)return 0;const{offset:r,index:o,size:s}=n0(t,e,yf),a=e-o,i=s*a+(a-1)*n+r;return i>0?i+n:i}function hk(e){return typeof e.groupIndex<"u"}function o0(e,t,n){if(hk(e))return t.groupIndices[e.groupIndex]+1;{const r=e.index==="LAST"?n:e.index;let o=s0(r,t);return o=Math.max(0,o,Math.min(n,o)),o}}function s0(e,t){if(!Kc(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function Kc(e){return!ht(e.groupOffsetTree)}function gk(e){return Fs(e).map(({k:t,v:n},r,o)=>{const s=o[r+1],a=s?s.k-1:1/0;return{startIndex:t,endIndex:a,size:n}})}const mk={offsetHeight:"height",offsetWidth:"width"},Gr=it(([{log:e},{recalcInProgress:t}])=>{const n=Ge(),r=Ge(),o=dn(r,0),s=Ge(),a=Ge(),i=fe(0),l=fe([]),u=fe(void 0),d=fe(void 0),p=fe((x,E)=>Ro(x,mk[E])),f=fe(void 0),g=fe(0),m=ck(),v=dn(ie(n,je(l,e,g),Wr(fk,m),Pt()),m),b=dn(ie(l,Pt(),Wr((x,E)=>({prev:x.current,current:E}),{prev:[],current:[]}),me(({prev:x})=>x)),[]);ye(ie(l,_e(x=>x.length>0),je(v,g),me(([x,E,T])=>{const _=x.reduce((O,P,A)=>Vn(O,P,Wi(P,E.offsetTree,T)||A),Ma());return{...E,groupIndices:x,groupOffsetTree:_}})),v),ye(ie(r,je(v),_e(([x,{lastIndex:E}])=>x<E),me(([x,{lastIndex:E,lastSize:T}])=>[{startIndex:x,endIndex:E,size:T}])),n),ye(u,d);const w=dn(ie(u,me(x=>x===void 0)),!0);ye(ie(d,_e(x=>x!==void 0&&ht(en(v).sizeTree)),me(x=>[{startIndex:0,endIndex:0,size:x}])),n);const y=$n(ie(n,je(v),Wr(({sizes:x},[E,T])=>({changed:T!==x,sizes:T}),{changed:!1,sizes:m}),me(x=>x.changed)));at(ie(i,Wr((x,E)=>({diff:x.prev-E,prev:E}),{diff:0,prev:0}),me(x=>x.diff)),x=>{const{groupIndices:E}=en(v);if(x>0)Ve(t,!0),Ve(s,x+r0(x,E));else if(x<0){const T=en(b);T.length>0&&(x-=r0(-x,T)),Ve(a,x)}}),at(ie(i,je(e)),([x,E])=>{x<0&&E("`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:i},In.ERROR)});const S=$n(s);ye(ie(s,je(v),me(([x,E])=>{const T=E.groupIndices.length>0,_=[],O=E.lastSize;if(T){const P=Ui(E.sizeTree,0);let A=0,M=0;for(;A<x;){const L=E.groupIndices[M],D=E.groupIndices.length===M+1?1/0:E.groupIndices[M+1]-L-1;_.push({startIndex:L,endIndex:L,size:P}),_.push({startIndex:L+1,endIndex:L+1+D-1,size:O}),M++,A+=D+1}const k=Fs(E.sizeTree);return A!==x&&k.shift(),k.reduce((L,{k:D,v:W})=>{let F=L.ranges;return L.prevSize!==0&&(F=[...L.ranges,{startIndex:L.prevIndex,endIndex:D+x-1,size:L.prevSize}]),{ranges:F,prevIndex:D+x,prevSize:W}},{ranges:_,prevIndex:x,prevSize:0}).ranges}return Fs(E.sizeTree).reduce((P,{k:A,v:M})=>({ranges:[...P.ranges,{startIndex:P.prevIndex,endIndex:A+x-1,size:P.prevSize}],prevIndex:A+x,prevSize:M}),{ranges:[],prevIndex:0,prevSize:O}).ranges})),n);const C=$n(ie(a,je(v,g),me(([x,{offsetTree:E},T])=>{const _=-x;return Wi(_,E,T)})));return ye(ie(a,je(v,g),me(([x,E,T])=>{if(E.groupIndices.length>0){if(ht(E.sizeTree))return E;let O=Ma();const P=en(b);let A=0,M=0,k=0;for(;A<-x;){k=P[M];const L=P[M+1]-k-1;M++,A+=L+1}if(O=Fs(E.sizeTree).reduce((L,{k:D,v:W})=>Vn(L,Math.max(0,D+x),W),O),A!==-x){const L=Ui(E.sizeTree,k);O=Vn(O,0,L);const D=xr(E.sizeTree,-x+1)[1];O=Vn(O,1,D)}return{...E,sizeTree:O,...wf(E.offsetTree,0,O,T)}}else{const O=Fs(E.sizeTree).reduce((P,{k:A,v:M})=>Vn(P,Math.max(0,A+x),M),Ma());return{...E,sizeTree:O,...wf(E.offsetTree,0,O,T)}}})),v),{data:f,totalCount:r,sizeRanges:n,groupIndices:l,defaultItemSize:d,fixedItemSize:u,unshiftWith:s,shiftWith:a,shiftWithOffset:C,beforeUnshiftWith:S,firstItemIndex:i,gap:g,sizes:v,listRefresh:y,statefulTotalCount:o,trackItemSizes:w,itemSize:p}},Tt(Qo,bf),{singleton:!0}),vk=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function a0(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!vk)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const Gi=it(([{sizes:e,totalCount:t,listRefresh:n,gap:r},{scrollingInProgress:o,viewportHeight:s,scrollTo:a,smoothScrollTargetReached:i,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:p},{log:f}])=>{const g=Ge(),m=Ge(),v=fe(0);let b=null,w=null,y=null;function S(){b&&(b(),b=null),y&&(y(),y=null),w&&(clearTimeout(w),w=null),Ve(o,!1)}return ye(ie(g,je(e,s,t,v,l,u,f),je(r,d,p),me(([[C,x,E,T,_,O,P,A],M,k,j])=>{const L=a0(C),{align:D,behavior:W,offset:F}=L,$=T-1,H=o0(L,x,$);let V=Wi(H,x.offsetTree,M)+O;D==="end"?(V+=k+xr(x.sizeTree,H)[1]-E+j,H===$&&(V+=P)):D==="center"?V+=(k+xr(x.sizeTree,H)[1]-E+j)/2:V-=_,F&&(V+=F);const U=J=>{S(),J?(A("retrying to scroll to",{location:C},In.DEBUG),Ve(g,C)):(Ve(m,!0),A("list did not change, scroll successful",{},In.DEBUG))};if(S(),W==="smooth"){let J=!1;y=at(n,Y=>{J=J||Y}),b=zr(i,()=>{U(J)})}else b=zr(ie(n,bk(150)),U);return w=setTimeout(()=>{S()},1200),Ve(o,!0),A("scrolling from index to",{index:H,top:V,behavior:W},In.DEBUG),{top:V,behavior:W}})),a),{scrollToIndex:g,scrollTargetReached:m,topListHeight:v}},Tt(Gr,pn,Qo),{singleton:!0});function bk(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return r=>{r&&(t(!0),clearTimeout(n))}}}const qi="up",Ki="down",yk="none",wk={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},Sk=0,Zi=it(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:o,scrollBy:s}])=>{const a=fe(!1),i=fe(!0),l=Ge(),u=Ge(),d=fe(4),p=fe(Sk),f=dn(ie(Wb(ie(Ae(t),La(1),Ur(!0)),ie(Ae(t),La(1),Ur(!1),Ub(100))),Pt()),!1),g=dn(ie(Wb(ie(s,Ur(!0)),ie(s,Ur(!1),Ub(200))),Pt()),!1);ye(ie(Bt(Ae(t),Ae(p)),me(([y,S])=>y<=S),Pt()),i),ye(ie(i,Jo(50)),u);const m=$n(ie(Bt(e,Ae(n),Ae(r),Ae(o),Ae(d)),Wr((y,[{scrollTop:S,scrollHeight:C},x,E,T,_])=>{const O=S+x-C>-_,P={viewportHeight:x,scrollTop:S,scrollHeight:C};if(O){let M,k;return S>y.state.scrollTop?(M="SCROLLED_DOWN",k=y.state.scrollTop-S):(M="SIZE_DECREASED",k=y.state.scrollTop-S||y.scrollTopDelta),{atBottom:!0,state:P,atBottomBecause:M,scrollTopDelta:k}}let A;return P.scrollHeight>y.state.scrollHeight?A="SIZE_INCREASED":x<y.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":S<y.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:P}},wk),Pt((y,S)=>y&&y.atBottom===S.atBottom))),v=dn(ie(e,Wr((y,{scrollTop:S,scrollHeight:C,viewportHeight:x})=>{if(Zb(y.scrollHeight,C))return{scrollTop:S,scrollHeight:C,jump:0,changed:!1};{const E=C-(S+x)<1;return y.scrollTop!==S&&E?{scrollHeight:C,scrollTop:S,jump:y.scrollTop-S,changed:!0}:{scrollHeight:C,scrollTop:S,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),_e(y=>y.changed),me(y=>y.jump)),0);ye(ie(m,me(y=>y.atBottom)),a),ye(ie(a,Jo(50)),l);const b=fe(Ki);ye(ie(e,me(({scrollTop:y})=>y),Pt(),Wr((y,S)=>en(g)?{direction:y.direction,prevScrollTop:S}:{direction:S<y.prevScrollTop?qi:Ki,prevScrollTop:S},{direction:Ki,prevScrollTop:0}),me(y=>y.direction)),b),ye(ie(e,Jo(50),Ur(yk)),b);const w=fe(0);return ye(ie(f,_e(y=>!y),Ur(0)),w),ye(ie(t,Jo(100),je(f),_e(([y,S])=>!!S),Wr(([y,S],[C])=>[S,C],[0,0]),me(([y,S])=>S-y)),w),{isScrolling:f,isAtTop:i,isAtBottom:a,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:b,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:w,lastJumpDueToItemResize:v}},Tt(pn)),es=it(([{log:e}])=>{const t=fe(!1),n=$n(ie(t,_e(r=>r),Pt()));return at(t,r=>{r&&en(e)("props updated",{},In.DEBUG)}),{propsReady:t,didMount:n}},Tt(Qo),{singleton:!0});function Sf(e,t){e==0?t():requestAnimationFrame(()=>Sf(e-1,t))}function Cf(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const Yi=it(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:r},{scrollToIndex:o,scrollTargetReached:s},{didMount:a}])=>{const i=fe(!0),l=fe(0),u=fe(!0);return ye(ie(a,je(l),_e(([d,p])=>!!p),Ur(!1)),i),ye(ie(a,je(l),_e(([d,p])=>!!p),Ur(!1)),u),at(ie(Bt(t,a),je(i,e,n,u),_e(([[,d],p,{sizeTree:f},g,m])=>d&&(!ht(f)||df(g))&&!p&&!m),je(l)),([,d])=>{zr(s,()=>{Ve(u,!0)}),Sf(4,()=>{zr(r,()=>{Ve(i,!0)}),Ve(o,d)})}),{scrolledToInitialItem:i,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Tt(Gr,pn,Gi,es),{singleton:!0});function i0(e){return e?e==="smooth"?"smooth":"auto":!1}const Ck=(e,t)=>typeof e=="function"?i0(e(t)):t&&i0(e),xk=it(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:r},{scrollToIndex:o},{scrolledToInitialItem:s},{propsReady:a,didMount:i},{log:l},{scrollingInProgress:u}])=>{const d=fe(!1),p=Ge();let f=null;function g(v){Ve(o,{index:"LAST",align:"end",behavior:v})}at(ie(Bt(ie(Ae(e),La(1)),i),je(Ae(d),n,s,u),me(([[v,b],w,y,S,C])=>{let x=b&&S,E="auto";return x&&(E=Ck(w,y||C),x=x&&!!E),{totalCount:v,shouldFollow:x,followOutputBehavior:E}}),_e(({shouldFollow:v})=>v)),({totalCount:v,followOutputBehavior:b})=>{f&&(f(),f=null),f=zr(t,()=>{en(l)("following output to ",{totalCount:v},In.DEBUG),g(b),f=null})});function m(v){const b=zr(r,w=>{v&&!w.atBottom&&w.notAtBottomBecause==="SIZE_INCREASED"&&!f&&(en(l)("scrolling to bottom due to increased size",{},In.DEBUG),g("auto"))});setTimeout(b,100)}return at(ie(Bt(Ae(d),e,a),_e(([v,,b])=>v&&b),Wr(({value:v},[,b])=>({refreshed:v===b,value:b}),{refreshed:!1,value:0}),_e(({refreshed:v})=>v),je(d,e)),([,v])=>{en(s)&&m(v!==!1)}),at(p,()=>{m(en(d)!==!1)}),at(Bt(Ae(d),r),([v,b])=>{v&&!b.atBottom&&b.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")}),{followOutput:d,autoscrollToBottom:p}},Tt(Gr,Zi,Gi,Yi,es,Qo,pn));function Ek(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const l0=it(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:r,headerHeight:o}])=>{const s=Ge(),a=Ge(),i=$n(ie(s,me(Ek)));return ye(ie(i,me(l=>l.totalCount)),e),ye(ie(i,me(l=>l.groupIndices)),t),ye(ie(Bt(r,n,o),_e(([l,u])=>Kc(u)),me(([l,u,d])=>xr(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Pt(),me(l=>[l])),a),{groupCounts:s,topItemsIndexes:a}},Tt(Gr,pn));function Xi(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function c0(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Zc="top",Yc="bottom",u0="none";function d0(e,t,n){return typeof e=="number"?n===qi&&t===Zc||n===Ki&&t===Yc?e:0:n===qi?t===Zc?e.main:e.reverse:t===Yc?e.main:e.reverse}function p0(e,t){return typeof e=="number"?e:e[t]||0}const xf=it(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:o}])=>{const s=Ge(),a=fe(0),i=fe(0),l=fe(0),u=dn(ie(Bt(Ae(e),Ae(t),Ae(r),Ae(s,Xi),Ae(l),Ae(a),Ae(o),Ae(n),Ae(i)),me(([d,p,f,[g,m],v,b,w,y,S])=>{const C=d-y,x=b+w,E=Math.max(f-C,0);let T=u0;const _=p0(S,Zc),O=p0(S,Yc);return g-=y,g+=f+w,m+=f+w,m-=y,g>d+x-_&&(T=qi),m<d-E+p+O&&(T=Ki),T!==u0?[Math.max(C-f-d0(v,Zc,T)-_,0),C-E-w+p+d0(v,Yc,T)+O]:null}),_e(d=>d!=null),Pt(Xi)),[0,0]);return{listBoundary:s,overscan:l,topListHeight:a,increaseViewportBy:i,visibleRange:u}},Tt(pn),{singleton:!0});function Tk(e,t,n){if(Kc(t)){const r=s0(e,t);return[{index:xr(t.groupOffsetTree,r)[0],size:0,offset:0},{index:r,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const Ef={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function f0(e,t,n){if(e.length===0)return[];if(!Kc(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const r=e[0].index,o=e[e.length-1].index,s=[],a=Gc(t.groupOffsetTree,r,o);let i,l=0;for(const u of e){(!i||i.end<u.index)&&(i=a.shift(),l=t.groupIndices.indexOf(i.start));let d;u.index===i.start?d={type:"group",index:l}:d={index:u.index-(l+1)+n,groupIndex:l},s.push({...d,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return s}function Xc(e,t,n,r,o,s){const{lastSize:a,lastOffset:i,lastIndex:l}=o;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=i+p*a+(p-1)*r,g=u,m=f-d;return{items:f0(e,o,s),topItems:f0(t,o,s),topListHeight:t.reduce((v,b)=>b.size+v,0),offsetTop:u,offsetBottom:m,top:g,bottom:d,totalCount:n,firstItemIndex:s}}function h0(e,t,n,r,o,s){let a=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-a>=e)break;a++}const i=e+a,l=Cf(t,i),u=Array.from({length:i}).map((d,p)=>({index:p+l,size:0,offset:0,data:s[p+l]}));return Xc(u,[],i,o,n,r)}const Bs=it(([{sizes:e,totalCount:t,data:n,firstItemIndex:r,gap:o},s,{visibleRange:a,listBoundary:i,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:p},f,{didMount:g},{recalcInProgress:m}])=>{const v=fe([]),b=fe(0),w=Ge();ye(s.topItemsIndexes,v);const y=dn(ie(Bt(g,m,Ae(a,Xi),Ae(t),Ae(e),Ae(d),u,Ae(v),Ae(r),Ae(o),n),_e(([E,T,,_,,,,,,,O])=>{const P=O&&O.length!==_;return E&&!T&&!P}),me(([,,[E,T],_,O,P,A,M,k,j,L])=>{const D=O,{sizeTree:W,offsetTree:F}=D,$=en(b);if(_===0)return{...Ef,totalCount:_};if(E===0&&T===0)return $===0?{...Ef,totalCount:_}:h0($,P,O,k,j,L||[]);if(ht(W))return $>0?null:Xc(Tk(Cf(P,_),D,L),[],_,j,D,k);const H=[];if(M.length>0){const X=M[0],Q=M[M.length-1];let ee=0;for(const G of Gc(W,X,Q)){const R=G.value,le=Math.max(G.start,X),ge=Math.min(G.end,Q);for(let Te=le;Te<=ge;Te++)H.push({index:Te,size:R,offset:ee,data:L&&L[Te]}),ee+=R}}if(!A)return Xc([],H,_,j,D,k);const V=M.length>0?M[M.length-1]+1:0,U=pk(F,E,T,V);if(U.length===0)return null;const J=_-1,Y=zc([],X=>{for(const Q of U){const ee=Q.value;let G=ee.offset,R=Q.start;const le=ee.size;if(ee.offset<E){R+=Math.floor((E-ee.offset+j)/(le+j));const Te=R-Q.start;G+=Te*le+Te*j}R<V&&(G+=(V-R)*le,R=V);const ge=Math.min(Q.end,J);for(let Te=R;Te<=ge&&!(G>=T);Te++)X.push({index:Te,size:le,offset:G,data:L&&L[Te]}),G+=le+j}});return Xc(Y,H,_,j,D,k)}),_e(E=>E!==null),Pt()),Ef);ye(ie(n,_e(df),me(E=>E==null?void 0:E.length)),t),ye(ie(y,me(E=>E.topListHeight)),p),ye(p,l),ye(ie(y,me(E=>[E.top,E.bottom])),i),ye(ie(y,me(E=>E.items)),w);const S=$n(ie(y,_e(({items:E})=>E.length>0),je(t,n),_e(([{items:E},T])=>E[E.length-1].originalIndex===T-1),me(([,E,T])=>[E-1,T]),Pt(Xi),me(([E])=>E))),C=$n(ie(y,Jo(200),_e(({items:E,topItems:T})=>E.length>0&&E[0].originalIndex===T.length),me(({items:E})=>E[0].index),Pt())),x=$n(ie(y,_e(({items:E})=>E.length>0),me(({items:E})=>{let T=0,_=E.length-1;for(;E[T].type==="group"&&T<_;)T++;for(;E[_].type==="group"&&_>T;)_--;return{startIndex:E[T].index,endIndex:E[_].index}}),Pt(c0)));return{listState:y,topItemsIndexes:v,endReached:S,startReached:C,rangeChanged:x,itemsRendered:w,initialItemCount:b,...f}},Tt(Gr,l0,xf,Yi,Gi,Zi,es,bf),{singleton:!0}),Pk=it(([{sizes:e,firstItemIndex:t,data:n,gap:r},{initialTopMostItemIndex:o},{initialItemCount:s,listState:a},{didMount:i}])=>(ye(ie(i,je(s),_e(([,l])=>l!==0),je(o,e,t,r,n),me(([[,l],u,d,p,f,g=[]])=>h0(l,u,d,p,f,g))),a),{}),Tt(Gr,Yi,Bs,es),{singleton:!0}),g0=it(([{scrollVelocity:e}])=>{const t=fe(!1),n=Ge(),r=fe(!1);return ye(ie(e,je(r,t,n),_e(([o,s])=>!!s),me(([o,s,a,i])=>{const{exit:l,enter:u}=s;if(a){if(l(o,i))return!1}else if(u(o,i))return!0;return a}),Pt()),t),at(ie(Bt(t,e,n),je(r)),([[o,s,a],i])=>o&&i&&i.change&&i.change(s,a)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},Tt(Zi),{singleton:!0}),Ok=it(([{topItemsIndexes:e}])=>{const t=fe(0);return ye(ie(t,_e(n=>n>0),me(n=>Array.from({length:n}).map((r,o)=>o))),e),{topItemCount:t}},Tt(Bs)),m0=it(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:r},{listState:o}])=>{const s=Ge(),a=dn(ie(Bt(e,r,t,n,o),me(([i,l,u,d,p])=>i+l+u+d+p.offsetBottom+p.bottom)),0);return ye(Ae(a),s),{totalListHeight:a,totalListHeightChanged:s}},Tt(pn,Bs),{singleton:!0});function v0(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const _k=v0(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),Ak=it(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:r},{isScrolling:o,isAtBottom:s,scrollDirection:a,lastJumpDueToItemResize:i},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:p,gap:f},{log:g},{recalcInProgress:m}])=>{const v=$n(ie(l,je(i),Wr(([,w,y,S],[{items:C,totalCount:x,bottom:E,offsetBottom:T},_])=>{const O=E+T;let P=0;return y===x&&w.length>0&&C.length>0&&(C[0].originalIndex===0&&w[0].originalIndex===0||(P=O-S,P!==0&&(P+=_))),[P,C,x,O]},[0,[],0,0]),_e(([w])=>w!==0),je(t,a,r,s,g,m),_e(([,w,y,S,,,C])=>!C&&!S&&w!==0&&y===qi),me(([[w],,,,,y])=>(y("Upward scrolling compensation",{amount:w},In.DEBUG),w))));function b(w){w>0?(Ve(e,{top:-w,behavior:"auto"}),Ve(n,0)):(Ve(n,0),Ve(e,{top:-w,behavior:"auto"}))}return at(ie(v,je(n,o)),([w,y,S])=>{S&&_k()?Ve(n,y-w):b(-w)}),at(ie(Bt(dn(o,!1),n,m),_e(([w,y,S])=>!w&&!S&&y!==0),me(([w,y])=>y),Jo(1)),b),ye(ie(d,me(w=>({top:-w}))),e),at(ie(u,je(p,f),me(([w,{lastSize:y,groupIndices:S,sizeTree:C},x])=>{function E(T){return T*(y+x)}if(S.length===0)return E(w);{let T=0;const _=Ui(C,0);let O=0,P=0;for(;O<w;){O++,T+=_;let A=S.length===P+1?1/0:S[P+1]-S[P]-1;O+A>w&&(T-=_,A=w-O+1),O+=A,T+=E(A),P++}return T}})),w=>{Ve(n,w),requestAnimationFrame(()=>{Ve(e,{top:w}),requestAnimationFrame(()=>{Ve(n,0),Ve(m,!1)})})}),{deviation:n}},Tt(pn,Zi,Bs,Gr,Qo,bf)),Lk=it(([{didMount:e},{scrollTo:t},{listState:n}])=>{const r=fe(0);return at(ie(e,je(r),_e(([,o])=>o!==0),me(([,o])=>({top:o}))),o=>{zr(ie(n,La(1),_e(s=>s.items.length>1)),()=>{requestAnimationFrame(()=>{Ve(t,o)})})}),{initialScrollTop:r}},Tt(es,pn,Bs),{singleton:!0}),Mk=it(([{viewportHeight:e},{totalListHeight:t}])=>{const n=fe(!1),r=dn(ie(Bt(n,e,t),_e(([o])=>o),me(([,o,s])=>Math.max(0,o-s)),Jo(0),Pt()),0);return{alignToBottom:n,paddingTopAddition:r}},Tt(pn,m0),{singleton:!0}),Tf=it(([{scrollTo:e,scrollContainerState:t}])=>{const n=Ge(),r=Ge(),o=Ge(),s=fe(!1),a=fe(void 0);return ye(ie(Bt(n,r),me(([{viewportHeight:i,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:i}))),t),ye(ie(e,je(r),me(([i,{offsetTop:l}])=>({...i,top:i.top+l}))),o),{useWindowScroll:s,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:o}},Tt(pn)),Nk=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:r,locationParams:{behavior:o,align:s,...a}})=>e<n?{...a,behavior:o,align:s??"start"}:t>r?{...a,behavior:o,align:s??"end"}:null,kk=it(([{sizes:e,totalCount:t,gap:n},{scrollTop:r,viewportHeight:o,headerHeight:s,fixedHeaderHeight:a,fixedFooterHeight:i,scrollingInProgress:l},{scrollToIndex:u}])=>{const d=Ge();return ye(ie(d,je(e,o,t,s,a,i,r),je(n),me(([[p,f,g,m,v,b,w,y],S])=>{const{done:C,behavior:x,align:E,calculateViewLocation:T=Nk,..._}=p,O=o0(p,f,m-1),P=Wi(O,f.offsetTree,S)+v+b,A=P+xr(f.sizeTree,O)[1],M=y+b,k=y+g-w,j=T({itemTop:P,itemBottom:A,viewportTop:M,viewportBottom:k,locationParams:{behavior:x,align:E,..._}});return j?C&&zr(ie(l,_e(L=>L===!1),La(en(l)?1:2)),C):C&&C(),j}),_e(p=>p!==null)),u),{scrollIntoView:d}},Tt(Gr,pn,Gi,Bs,Qo),{singleton:!0}),$k=it(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:r},{initialTopMostItemIndex:o},{didMount:s},{useWindowScroll:a,windowScrollContainerState:i,windowViewportRect:l}])=>{const u=Ge(),d=fe(void 0),p=fe(null),f=fe(null);return ye(i,p),ye(l,f),at(ie(u,je(e,n,a,p,f,r)),([g,m,v,b,w,y,S])=>{const C=gk(m.sizeTree);b&&w!==null&&y!==null&&(v=w.scrollTop-y.offsetTop),v-=S,g({ranges:C,scrollTop:v})}),ye(ie(d,_e(df),me(Ik)),o),ye(ie(s,je(d),_e(([,g])=>g!==void 0),Pt(),me(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:d}},Tt(Gr,pn,Yi,es,Tf));function Ik(e){return{offset:e.scrollTop,index:0,align:"start"}}const Vk=it(([e,t,n,r,o,s,a,i,l,u])=>({...e,...t,...n,...r,...o,...s,...a,...i,...l,...u}),Tt(xf,Pk,es,g0,m0,Lk,Mk,Tf,kk,Qo)),Hk=it(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:r,trackItemSizes:o,itemSize:s,data:a,firstItemIndex:i,groupIndices:l,statefulTotalCount:u,gap:d,sizes:p},{initialTopMostItemIndex:f,scrolledToInitialItem:g,initialItemFinalLocationReached:m},v,b,w,{listState:y,topItemsIndexes:S,...C},{scrollToIndex:x},E,{topItemCount:T},{groupCounts:_},O])=>(ye(C.rangeChanged,O.scrollSeekRangeChanged),ye(ie(O.windowViewportRect,me(P=>P.visibleHeight)),v.viewportHeight),{totalCount:e,data:a,firstItemIndex:i,sizeRanges:t,initialTopMostItemIndex:f,scrolledToInitialItem:g,initialItemFinalLocationReached:m,topItemsIndexes:S,topItemCount:T,groupCounts:_,fixedItemHeight:n,defaultItemHeight:r,gap:d,...w,statefulTotalCount:u,listState:y,scrollToIndex:x,trackItemSizes:o,itemSize:s,groupIndices:l,...C,...O,...v,sizes:p,...b}),Tt(Gr,Yi,pn,$k,xk,Bs,Gi,Ak,Ok,l0,Vk)),Pf="-webkit-sticky",b0="sticky",y0=v0(()=>{if(typeof document>"u")return b0;const e=document.createElement("div");return e.style.position=Pf,e.style.position===Pf?Pf:b0});function w0(e,t,n){const r=h.useRef(null),o=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;r.current={offsetTop:f,visibleHeight:p,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:s,ref:a}=ff(o,!0,n),i=h.useCallback(()=>{o(a.current)},[o,a]);return h.useEffect(()=>{if(t){t.addEventListener("scroll",i);const l=new ResizeObserver(()=>{requestAnimationFrame(i)});return l.observe(t),()=>{t.removeEventListener("scroll",i),l.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),s}const S0=h.createContext(void 0),C0=h.createContext(void 0);function x0(e){return e}const jk=it(([e,t])=>({...e,...t}),Tt(Hk,it(()=>{const e=fe(l=>`Item ${l}`),t=fe(null),n=fe(l=>`Group ${l}`),r=fe({}),o=fe(x0),s=fe("div"),a=fe(Aa),i=(l,u=null)=>dn(ie(r,me(d=>d[l]),Pt()),u);return{context:t,itemContent:e,groupContent:n,components:r,computeItemKey:o,HeaderFooterTag:s,scrollerRef:a,FooterComponent:i("Footer"),HeaderComponent:i("Header"),TopItemListComponent:i("TopItemList"),ListComponent:i("List","div"),ItemComponent:i("Item","div"),GroupComponent:i("Group","div"),ScrollerComponent:i("Scroller","div"),EmptyPlaceholder:i("EmptyPlaceholder"),ScrollSeekPlaceholder:i("ScrollSeekPlaceholder")}}))),Dk=({height:e})=>c.jsx("div",{style:{height:e}}),Fk={position:y0(),zIndex:1,overflowAnchor:"none"},E0={overflowAnchor:"none"},Bk={...E0,display:"inline-block",height:"100%"},T0=h.memo(function({showTopList:t=!1}){const n=Me("listState"),r=er("sizeRanges"),o=Me("useWindowScroll"),s=Me("customScrollParent"),a=er("windowScrollContainerState"),i=er("scrollContainerState"),l=s||o?a:i,u=Me("itemContent"),d=Me("context"),p=Me("groupContent"),f=Me("trackItemSizes"),g=Me("itemSize"),m=Me("log"),v=er("gap"),b=Me("horizontalDirection"),{callbackRef:w}=rk(r,g,f,t?Aa:l,m,v,s,b,Me("skipAnimationFrameInResizeObserver")),[y,S]=h.useState(0);Of("deviation",L=>{y!==L&&S(L)});const C=Me("EmptyPlaceholder"),x=Me("ScrollSeekPlaceholder")||Dk,E=Me("ListComponent"),T=Me("ItemComponent"),_=Me("GroupComponent"),O=Me("computeItemKey"),P=Me("isSeeking"),A=Me("groupIndices").length>0,M=Me("alignToBottom"),k=Me("initialItemFinalLocationReached"),j=t?{}:{boxSizing:"border-box",...b?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:M?"auto":0}:{marginTop:y!==0?y:M?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...k?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&C?c.jsx(C,{...fn(C,d)}):c.jsx(E,{...fn(E,d),ref:w,style:j,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(L=>{const D=L.originalIndex,W=O(D+n.firstItemIndex,L.data,d);return P?h.createElement(x,{...fn(x,d),key:W,index:L.index,height:L.size,type:L.type||"item",...L.type==="group"?{}:{groupIndex:L.groupIndex}}):L.type==="group"?h.createElement(_,{...fn(_,d),key:W,"data-index":D,"data-known-size":L.size,"data-item-index":L.index,style:Fk},p(L.index,d)):h.createElement(T,{...fn(T,d),...Gk(T,L.data),key:W,"data-index":D,"data-known-size":L.size,"data-item-index":L.index,"data-item-group-index":L.groupIndex,style:b?Bk:E0},A?u(L.index,L.groupIndex,L.data,d):u(L.index,L.data,d))})})}),zk={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},Uk={outline:"none",overflowX:"auto",position:"relative"},Jc=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),Wk={width:"100%",position:y0(),top:0,zIndex:1};function fn(e,t){if(typeof e!="string")return{context:t}}function Gk(e,t){return{item:typeof e=="string"?void 0:t}}const qk=h.memo(function(){const t=Me("HeaderComponent"),n=er("headerHeight"),r=Me("HeaderFooterTag"),o=Ds(h.useMemo(()=>a=>n(Ro(a,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),s=Me("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),Kk=h.memo(function(){const t=Me("FooterComponent"),n=er("footerHeight"),r=Me("HeaderFooterTag"),o=Ds(h.useMemo(()=>a=>n(Ro(a,"height")),[n]),!0,Me("skipAnimationFrameInResizeObserver")),s=Me("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null});function P0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:s,children:a,...i}){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}=Yb(l,d,u,p,void 0,g);t("scrollTo",b),t("scrollBy",v);const w=g?Uk:zk;return c.jsx(u,{ref:m,style:{...w,...s},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...i,...fn(u,f),children:a})})}function O0({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:s,children:a,...i}){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:w}=Yb(l,d,u,Aa,g);return qb(()=>(v.current=g||window,()=>{v.current=null}),[v,g]),t("windowScrollTo",w),t("scrollBy",b),c.jsx(u,{style:{position:"relative",...s,...p!==0?{height:p+f}:{}},"data-virtuoso-scroller":!0,...i,...fn(u,m),children:a})})}const Zk=({children:e})=>{const t=h.useContext(S0),n=er("viewportHeight"),r=er("fixedItemHeight"),o=Me("alignToBottom"),s=Me("horizontalDirection"),a=h.useMemo(()=>jb(n,l=>Ro(l,s?"width":"height")),[n,s]),i=Ds(a,!0,Me("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),r(t.itemHeight))},[t,n,r]),c.jsx("div",{style:Jc(o),ref:i,"data-viewport-type":"element",children:e})},Yk=({children:e})=>{const t=h.useContext(S0),n=er("windowViewportRect"),r=er("fixedItemHeight"),o=Me("customScrollParent"),s=w0(n,o,Me("skipAnimationFrameInResizeObserver")),a=Me("alignToBottom");return h.useEffect(()=>{t&&(r(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,r]),c.jsx("div",{ref:s,style:Jc(a),"data-viewport-type":"window",children:e})},Xk=({children:e})=>{const t=Me("TopItemListComponent")||"div",n=Me("headerHeight"),r={...Wk,marginTop:`${n}px`},o=Me("context");return c.jsx(t,{style:r,...fn(t,o),children:e})},Jk=h.memo(function(t){const n=Me("useWindowScroll"),r=Me("topItemsIndexes").length>0,o=Me("customScrollParent"),s=o||n?e$:Rk,a=o||n?Yk:Zk;return c.jsxs(s,{...t,children:[r&&c.jsx(Xk,{children:c.jsx(T0,{showTopList:!0})}),c.jsxs(a,{children:[c.jsx(qk,{}),c.jsx(T0,{}),c.jsx(Kk,{})]})]})}),{Component:Qk,usePublisher:er,useEmitterValue:Me,useEmitter:Of}=Gb(jk,{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"}},Jk),Rk=P0({usePublisher:er,useEmitterValue:Me,useEmitter:Of}),e$=O0({usePublisher:er,useEmitterValue:Me,useEmitter:Of}),t$=Qk,_0={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},n$={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:A0,ceil:L0,floor:Qc,min:_f,max:Ji}=Math;function r$(e){return{...n$,items:e}}function M0(e,t,n){return Array.from({length:t-e+1}).map((r,o)=>{const s=n===null?null:n[o+e];return{index:o+e,data:s}})}function o$(e,t){return e&&e.column===t.column&&e.row===t.row}function Rc(e,t){return e&&e.width===t.width&&e.height===t.height}const s$=it(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:r},{scrollTop:o,viewportHeight:s,scrollBy:a,scrollTo:i,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:p},f,g,{propsReady:m,didMount:v},{windowViewportRect:b,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,windowScrollTo:C},x])=>{const E=fe(0),T=fe(0),_=fe(_0),O=fe({height:0,width:0}),P=fe({height:0,width:0}),A=Ge(),M=Ge(),k=fe(0),j=fe(null),L=fe({row:0,column:0}),D=Ge(),W=Ge(),F=fe(!1),$=fe(0),H=fe(!0),V=fe(!1),U=fe(!1);at(ie(v,je($),_e(([G,R])=>!!R)),()=>{Ve(H,!1)}),at(ie(Bt(v,H,P,O,$,V),_e(([G,R,le,ge,,Te])=>G&&!R&&le.height!==0&&ge.height!==0&&!Te)),([,,,,G])=>{Ve(V,!0),Sf(1,()=>{Ve(A,G)}),zr(ie(o),()=>{Ve(n,[0,0]),Ve(H,!0)})}),ye(ie(W,_e(G=>G!=null&&G.scrollTop>0),Ur(0)),T),at(ie(v,je(W),_e(([,G])=>G!=null)),([,G])=>{G&&(Ve(O,G.viewport),Ve(P,G==null?void 0:G.item),Ve(L,G.gap),G.scrollTop>0&&(Ve(F,!0),zr(ie(o,La(1)),R=>{Ve(F,!1)}),Ve(i,{top:G.scrollTop})))}),ye(ie(O,me(({height:G})=>G)),s),ye(ie(Bt(Ae(O,Rc),Ae(P,Rc),Ae(L,(G,R)=>G&&G.column===R.column&&G.row===R.row),Ae(o)),me(([G,R,le,ge])=>({viewport:G,item:R,gap:le,scrollTop:ge}))),D),ye(ie(Bt(Ae(E),t,Ae(L,o$),Ae(P,Rc),Ae(O,Rc),Ae(j),Ae(T),Ae(F),Ae(H),Ae($)),_e(([,,,,,,,G])=>!G),me(([G,[R,le],ge,Te,Ce,tt,Qe,,Ot,ut])=>{const{row:Se,column:ot}=ge,{height:st,width:wt}=Te,{width:Ne}=Ce;if(Qe===0&&(G===0||Ne===0))return _0;if(wt===0){const Wt=Cf(ut,G),Co=Math.max(Wt+Qe-1,0);return r$(M0(Wt,Co,tt))}const mt=k0(Ne,wt,ot);let dt,Ue;Ot?R===0&&le===0&&Qe>0?(dt=0,Ue=Qe-1):(dt=mt*Qc((R+Se)/(st+Se)),Ue=mt*L0((le+Se)/(st+Se))-1,Ue=_f(G-1,Ji(Ue,mt-1)),dt=_f(Ue,Ji(0,dt))):(dt=0,Ue=-1);const tn=M0(dt,Ue,tt),{top:he,bottom:De}=N0(Ce,ge,Te,tn),Fe=L0(G/mt),Mt=Fe*st+(Fe-1)*Se-De;return{items:tn,offsetTop:he,offsetBottom:Mt,top:he,bottom:De,itemHeight:st,itemWidth:wt}})),_),ye(ie(j,_e(G=>G!==null),me(G=>G.length)),E),ye(ie(Bt(O,P,_,L),_e(([G,R,{items:le}])=>le.length>0&&R.height!==0&&G.height!==0),me(([G,R,{items:le},ge])=>{const{top:Te,bottom:Ce}=N0(G,ge,R,le);return[Te,Ce]}),Pt(Xi)),n);const J=fe(!1);ye(ie(o,je(J),me(([G,R])=>R||G!==0)),J);const Y=$n(ie(Ae(_),_e(({items:G})=>G.length>0),je(E,J),_e(([{items:G},R,le])=>le&&G[G.length-1].index===R-1),me(([,G])=>G-1),Pt())),X=$n(ie(Ae(_),_e(({items:G})=>G.length>0&&G[0].index===0),Ur(0),Pt())),Q=$n(ie(Ae(_),je(F),_e(([{items:G},R])=>G.length>0&&!R),me(([{items:G}])=>({startIndex:G[0].index,endIndex:G[G.length-1].index})),Pt(c0),Jo(0)));ye(Q,g.scrollSeekRangeChanged),ye(ie(A,je(O,P,E,L),me(([G,R,le,ge,Te])=>{const Ce=a0(G),{align:tt,behavior:Qe,offset:Ot}=Ce;let ut=Ce.index;ut==="LAST"&&(ut=ge-1),ut=Ji(0,ut,_f(ge-1,ut));let Se=Af(R,Te,le,ut);return tt==="end"?Se=A0(Se-R.height+le.height):tt==="center"&&(Se=A0(Se-R.height/2+le.height/2)),Ot&&(Se+=Ot),{top:Se,behavior:Qe}})),i);const ee=dn(ie(_,me(G=>G.offsetBottom+G.bottom)),0);return ye(ie(b,me(G=>({width:G.visibleWidth,height:G.visibleHeight}))),O),{data:j,totalCount:E,viewportDimensions:O,itemDimensions:P,scrollTop:o,scrollHeight:M,overscan:e,increaseViewportBy:r,scrollBy:a,scrollTo:i,scrollToIndex:A,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:C,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,deviation:k,scrollContainerState:u,footerHeight:d,headerHeight:p,initialItemCount:T,gap:L,restoreStateFrom:W,...g,initialTopMostItemIndex:$,horizontalDirection:U,gridState:_,totalListHeight:ee,...f,startReached:X,endReached:Y,rangeChanged:Q,stateChanged:D,propsReady:m,stateRestoreInProgress:F,...x}},Tt(xf,pn,Zi,g0,es,Tf,Qo));function N0(e,t,n,r){const{height:o}=n;if(o===void 0||r.length===0)return{top:0,bottom:0};const s=Af(e,t,n,r[0].index),a=Af(e,t,n,r[r.length-1].index)+o;return{top:s,bottom:a}}function Af(e,t,n,r){const o=k0(e.width,n.width,t.column),s=Qc(r/o),a=s*n.height+Ji(0,s-1)*t.row;return a>0?a+t.row:a}function k0(e,t,n){return Ji(1,Qc((e+n)/(Qc(t)+n)))}const a$=it(([e,t])=>({...e,...t}),Tt(s$,it(()=>{const e=fe(p=>`Item ${p}`),t=fe({}),n=fe(null),r=fe("virtuoso-grid-item"),o=fe("virtuoso-grid-list"),s=fe(x0),a=fe("div"),i=fe(Aa),l=(p,f=null)=>dn(ie(t,me(g=>g[p]),Pt()),f),u=fe(!1),d=fe(!1);return ye(Ae(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:s,itemClassName:r,listClassName:o,headerFooterTag:a,scrollerRef:i,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}))),i$=h.memo(function(){const t=At("gridState"),n=At("listClassName"),r=At("itemClassName"),o=At("itemContent"),s=At("computeItemKey"),a=At("isSeeking"),i=tr("scrollHeight"),l=At("ItemComponent"),u=At("ListComponent"),d=At("ScrollSeekPlaceholder"),p=At("context"),f=tr("itemDimensions"),g=tr("gap"),m=At("log"),v=At("stateRestoreInProgress"),b=tr("reportReadyState"),w=Ds(h.useMemo(()=>y=>{const S=y.parentElement.parentElement.scrollHeight;i(S);const C=y.firstChild;if(C){const{width:x,height:E}=C.getBoundingClientRect();f({width:x,height:E})}g({row:I0("row-gap",getComputedStyle(y).rowGap,m),column:I0("column-gap",getComputedStyle(y).columnGap,m)})},[i,f,g,m]),!0,!1);return qb(()=>{t.itemHeight>0&&t.itemWidth>0&&b(!0)},[t]),v?null:c.jsx(u,{ref:w,className:n,...fn(u,p),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const S=s(y.index,y.data,p);return a?c.jsx(d,{...fn(d,p),index:y.index,height:t.itemHeight,width:t.itemWidth},S):h.createElement(l,{...fn(l,p),className:r,"data-index":y.index,key:S},o(y.index,y.data,p))})})}),l$=h.memo(function(){const t=At("HeaderComponent"),n=tr("headerHeight"),r=At("headerFooterTag"),o=Ds(h.useMemo(()=>a=>n(Ro(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),c$=h.memo(function(){const t=At("FooterComponent"),n=tr("footerHeight"),r=At("headerFooterTag"),o=Ds(h.useMemo(()=>a=>n(Ro(a,"height")),[n]),!0,!1),s=At("context");return t?c.jsx(r,{ref:o,children:c.jsx(t,{...fn(t,s)})}):null}),u$=({children:e})=>{const t=h.useContext(C0),n=tr("itemDimensions"),r=tr("viewportDimensions"),o=Ds(h.useMemo(()=>s=>{r(s.getBoundingClientRect())},[r]),!0,!1);return h.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),c.jsx("div",{style:Jc(!1),ref:o,children:e})},d$=({children:e})=>{const t=h.useContext(C0),n=tr("windowViewportRect"),r=tr("itemDimensions"),o=At("customScrollParent"),s=w0(n,o,!1);return h.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),c.jsx("div",{ref:s,style:Jc(!1),children:e})},p$=h.memo(function({...t}){const n=At("useWindowScroll"),r=At("customScrollParent"),o=r||n?g$:h$,s=r||n?d$:u$;return c.jsx(o,{...t,children:c.jsxs(s,{children:[c.jsx(l$,{}),c.jsx(i$,{}),c.jsx(c$,{})]})})}),{Component:f$,usePublisher:tr,useEmitterValue:At,useEmitter:$0}=Gb(a$,{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"}},p$),h$=P0({usePublisher:tr,useEmitterValue:At,useEmitter:$0}),g$=O0({usePublisher:tr,useEmitterValue:At,useEmitter:$0});function I0(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,In.WARN),t==="normal"?0:parseInt(t??"0",10)}const eu=f$,Lf=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},m$=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function v$(e){const t=e.map(({id:a,src:i})=>({id:a,src:i})),n=e.reduce((a,i)=>(a[i.id]=i,a),{}),r=[],o=[];return(await FS(t)).forEach(a=>{a.status==="fulfilled"?r.push(n[a.value]):o.push(n[a.reason])}),{loaded:r,failed:o}}const b$=async e=>{const t=[...e],n={};if(t.length){const r={},o=[];if(t.forEach((s,a)=>{m$(s)&&(r[s.id]={index:a},o.push(s))}),o.length){const{loaded:s}=await v$(o);s.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(s=>{const a=r[s];a.loaded?t[a.index]=s:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},y$=(e,t,n,r={})=>{const{skipReplace:o}=r;e.loadData(t);const s=e.getCss()||"",a=o?s:s.replace(/:root\s*{/gi,"[data-body]{");let i=`${e.getHtml()}<style>${a}</style>`;if(n===xt.email)try{i=e.runCommand(_c).html}catch(l){console.error(l)}return r.removeScripts&&(i=i.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),o?i:i.replace("<body","<div data-body").replace("</body>","</div>")},w$=async(e,t,n)=>{const r=hS(t,{appStore:n}),o=await b$(r);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...o.plugins,s=>{s.Storage.setCurrent("")}],pluginsOpts:o.pluginOptions,protectedCss:`
304
304
  * { box-sizing: border-box; }
305
305
  [data-body] {
306
306
  margin: 0;
@@ -318,20 +318,20 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
318
318
  height: 0px;
319
319
  overflow: hidden;
320
320
  }
321
- `})};function eu({children:e,text:t,onConfirm:n,onCancel:r,className:o="w-[200px]",confirmButtonProps:s={},...a}){const i=Ie();return c.jsx(wr,{...a,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(I,{className:Z(o),space:"m",col:!0,children:[c.jsx(B,{grow:!0,className:Z("text-center"),children:t||i.t("confirmAction")}),c.jsxs(I,{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()},...s,children:s.children||i.t("confirm")}),c.jsx(Ke,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),r==null||r()},children:i.t("cancel")})]})]})})}const V0=new Map,H0=new Map,vk=async({html:e="",el:t})=>{const n=e,r={};if(document.body.attachShadow){const o=t.shadowRoot||t.attachShadow({mode:"open"});o.innerHTML=n}return r},bk=ce(function({template:t,projectType:n,skipProjectNamePopover:r,className:o,onSelect:s,onRemove:a}){var T;const i=Ie(),l=we(),u=l.editor,[d,f]=h.useState(""),p=h.useRef(null),g=i.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((T=t.data.custom)==null?void 0:T.id),v=n===xt.web,b=!t.isTemplate||r,w=()=>{b&&(s==null||s({editor:u,template:t,loadTemplate:y}))},y=l.setProject,S=_=>{_.preventDefault(),s({editor:u,template:t,loadTemplate:y})};h.useEffect(()=>{const O=setTimeout(async()=>{if(!p.current||!u)return;const P=`${t.isTemplate?"t-":""}${t.id}`;let A=V0.get(P);if(!A){let $=H0.get(n);if(!$){const j=new pH({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});$=await mk(u.config.grapesjs,n,j.appEditorStore),H0.set(n,$)}A=$?gk($,t.data,n):"",V0.set(P,A)}const M=p.current;vk({el:M,html:A})});return()=>clearTimeout(O)},[p,u,n,t.data]);const{media:C,author:x}=t,E=c.jsx(Ke,{className:ae("text-sm"),size:"m2",variant:"pr",onClick:w,disabled:m,children:i.t("select")});return c.jsx(Yn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,children:[c.jsxs(B,{className:ae("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ae("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:C?c.jsx("img",{src:C,alt:t.name,className:ae("max-w-full")}):c.jsx("div",{className:ae("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:p})}),m&&c.jsx(Ko,{className:ae("absolute top-2 right-2",z.bgA2),label:i.t("current"),s:"s",pill:!0}),c.jsx(I,{justify:"center",items:"center",className:ae(Pe.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:b?E:c.jsx(wr,{overlay:!0,title:!1,buttonAs:"span",handler:E,children:()=>c.jsx("form",{onSubmit:S,children:c.jsxs(I,{space:"m",col:!0,children:[c.jsx(B,{children:c.jsx(rt,{size:"s",value:d,onChange:f,placeholder:g,required:!0})}),c.jsx(B,{children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:i.t("load")})})]})})})})]}),c.jsxs(I,{className:ae("gjs-p-2 max-w-full",te.bt,z.br),col:!0,space:"s",children:[c.jsxs(I,{className:ae("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(B,{className:ae(Pe.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!x&&c.jsxs(B,{children:["by"," ",c.jsx("a",{className:ae(Ao.link),href:x.link,rel:"noreferrer",target:"_blank",children:x.name})]})]}),c.jsxs(I,{items:"center",children:[v&&c.jsxs(B,{className:ae("gjs-mr-auto"),children:[i.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&a&&c.jsx(B,{className:ae("gjs-ml-auto"),children:c.jsx(eu,{onConfirm:()=>a(t),className:"",children:c.jsx(Ct,{title:i.t("delete"),children:c.jsx(ne,{icon:q.delete,size:se.sx})})})})]})]})]})})}),j0=ce(function({templates:e,projectType:t,content:n,skipProjectNamePopover:r,onSelect:o,onRemove:s}){const[a]=jf(),l=Ie().tScoped("templates"),d=we().editor,f=Ap(n==null?void 0:n.itemsPerRow),p=o??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(I,{justify:"center",children:l("notFound")}):c.jsx(Rc,{data:e,listClassName:ae("grid gap-2 gjs-pr-2",f),itemContent:(g,m)=>c.jsx(bk,{template:m,projectType:t,onSelect:p,onRemove:s,skipProjectNamePopover:r},m.id)},a):c.jsx(Lo,{})})}),yk=ce(function(){var v;const t=we(),n=xv(),{filteredTemplates:r,projectSourceFilter:o,projectTypeFilter:s}=n,a=Ie(),i=Ca(),{sdkOptions:l}=t,u=a.tScoped("projectManager"),d=async({loadTemplate:b,template:w})=>{b(w),i.close()},f=async b=>{n.setProjectTypeFilter(b),await n.loadAllTemplates()},p=b=>{n.removeProject(b.id),n.loadProjects()},g=h.useMemo(()=>[{id:Ci.Existing,label:u("existentProjects")},{id:Ci.Templates,label:u("templates")}],[a]),m=((v=l.project)==null?void 0:v.types)&&zu();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(I,{col:!0,full:!0,space:"m",children:[m&&c.jsx(I,{items:"center",space:"m",children:c.jsx(B,{className:ae("gjs-ml-auto"),children:c.jsx(Le,{value:s,onChange:f,options:zN(),handlerSelected:b=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",b.label]})})})}),c.jsx(B,{children:c.jsx(Zo,{tabs:g,value:o,onChange:n.setProjectSourceFilter})}),c.jsx(B,{grow:!0,children:c.jsx(j0,{templates:r,projectType:xt[s],onSelect:d,onRemove:p,content:{itemsPerRow:3}})})]})}),wk=({items:e,editor:t,customItems:n})=>n===!1?[]:et(n)?n({items:e,editor:t}):n||e,D0=e=>({icon:q.plus,size:se.s,className:Z("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),F0=e=>!e.type||e.type==="button",Sk="gs-cmp-topbar-left",Ck=ce(function({buttons:t,className:n,style:r}){const o=we(),s=Ie(),{isOpen:a,toggleOpen:i}=u4(),l=o.editor,d=s.tScoped("blockManager")("blocks"),f=wk({items:[{id:`blocks-${d}`,tooltip:d,size:cb.s,icon:D0(a),variant:lb.primary,editorEvents:{[Pn.toggleBlocksPanel]:({fromEvent:p,setState:g})=>{g({icon:D0(p.isOpen)})}},onClick:()=>i()}],customItems:t,editor:l});return c.jsx(I,{gap:"s",items:"center",justify:"start",className:Z(Sk,Te.xS,n),style:r,nowrap:!0,children:f.map(({id:p,...g})=>F0(g)?c.jsx(Nc,{...g},p):$t({id:p,...g}))})}),xk=[{id:So.auto,label:"Auto"},{id:So.dark,label:"Dark"},{id:So.light,label:"Light"}],Ek={size:"s"},Lp=".grapesjs",Tk=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},Pk=({actions:e,editor:t,buttons:n,sdkOptions:r})=>{const o=r.actions;return o===!1?[]:et(o)?o({actions:e,editor:t}):o||(n?et(n)?n({items:e,editor:t}):n:e)},Ok="gs-cmp-topbar-right",_k=ce(function({editor:t,className:n,buttons:r,...o}){const s=we(),{theme:a,setTheme:i}=jr(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:f,isBrowserMode:p,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:v}=s,b=Ca(),w=Ie(),y=M=>w.t(`actions.${M}`),S=t.Storage.events,C=l.events,x="change:changesCount",E=(M,$)=>()=>{et(M)?M({editor:t}):l.isActive(M)?l.stop(M):l.run(M,$)},T=M=>({[`${C.runCommand}${M}`]:({setState:$})=>$({active:!0}),[`${C.stopCommand}${M}`]:({setState:$})=>$({active:!1})}),_=[{id:vr.componentOutline,icon:q.borderRadius,tooltip:y("componentOutline.title"),onClick:E("core:component-outline"),editorEvents:T("core:component-outline")},{id:vr.preview,icon:q.eye,tooltip:y("preview.title"),onClick:E("core:preview"),editorEvents:T("core:preview")},{id:vr.fullscreen,icon:q.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:E("core:fullscreen",{target:"body"}),editorEvents:T("core:fullscreen")},{id:vr.showCode,icon:q.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(re.dialogExportCode)},{id:vr.showImportCode,icon:q.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(re.dialogImportCode)},{id:vr.clearCanvas,icon:q.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:vr.store,tooltip:y("store.title"),onClick:async()=>!s.isSaving&&t.store(),editorEvents:{"change:changesCount":({setState:M})=>M({}),[S.startStore]:({setState:M})=>M({disabled:!0}),[S.endStore]:({setState:M})=>M({disabled:!1})},label:()=>c.jsxs("div",{className:Z("relative"),children:[c.jsx(ne,{icon:q.floppy,size:se.s}),!!t.getDirtyCount()&&!s.isSaving&&c.jsx("div",{className:Z("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",z.bg),children:c.jsx("div",{className:Z(Pe.dot,z.bgW)})}),s.isSaving&&c.jsx("div",{className:Z("absolute right-0 bottom-0 gjs-rounded-full",z.bg),children:c.jsx(ne,{icon:q.refresh,size:"11px",className:Z(Pe.spin)})})]})},{id:vr.undo,icon:q.arrowULeftTop,disabled:!0,onClick:E("core:undo"),editorEvents:{[x]:({setState:M})=>M({disabled:!u.hasUndo()})}},{id:vr.redo,icon:q.arrowURightTop,disabled:!0,onClick:E("core:redo"),editorEvents:{[x]:({setState:M})=>M({disabled:!u.hasRedo()})}}],O=Pk({actions:_,sdkOptions:m,editor:t,buttons:r}),P=[{id:"about",label:y("about.title"),icon:q.helpCircle,action:()=>b.open({size:"m",title:y("about.title"),content:()=>c.jsx(FN,{})})},{id:"embed",label:y("embed.title"),icon:q.powerPlug,action:()=>b.open({size:"m",title:y("embed.title"),content:()=>c.jsx(BN,{})})},{id:"openProject",label:y("open.title"),icon:q.folder,action:async()=>{let M="";try{M=await(await xN({extensions:[Lp]})).text()}catch($){return console.error($)}s.loadProjectData(JSON.parse(M))}},{id:"saveProject",label:y("save.title"),icon:q.contentSave,action:async()=>{const M=t.getProjectData(),$=new Blob([JSON.stringify(M)]),j=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await TN($,{fileName:`${j}${Lp}`,extensions:[Lp]})}catch(L){return console.error(L)}}},{id:"loadProject",label:y("newProject.title"),icon:q.newspaperVariantOutline,action:()=>b.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(yk,{})})},{id:"installApp",label:y(f?"installApp.installed":"installApp.title"),icon:q.applicationBracketsOutline,action:async()=>{if(f)return;d==null||d.prompt();const M=await(d==null?void 0:d.userChoice);(M==null?void 0:M.outcome)==="accepted"&&g()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs(I,{items:"center",space:"m",children:[c.jsx(B,{children:"Theme"}),c.jsx(B,{children:c.jsx(Zo,{tabs:xk,onChange:M=>i(M),value:a,variant:"pills"})})]})}]].filter(({id:M})=>!((!p||!d)&&M==="installApp"||!Tk(m,M))),A=(M,$)=>j=>{et(M)&&(M(j),$())};return c.jsxs(I,{space:"s",items:"center",justify:"end",className:Z(Ok,Te.xS,n),nowrap:!0,...o,children:[O.map(({id:M,...$})=>F0($)?c.jsx(Nc,{size:"s",...$},M):$t({id:M,...$})),c.jsx(B,{children:m.settingsMenu!==!1&&P.length>0&&c.jsx(wr,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(ne,{icon:q.cog,size:se.s}),buttonProps:Ek,overlay:!0,children:({close:M})=>c.jsx(c.Fragment,{children:P.map($=>c.jsx(Pa,{action:A($.action,M),icon:$.icon,label:$.label},$.id))})})})]})});function Ak({devices:e,selected:t,className:n,style:r,select:o}){const s=e.map(a=>({id:a.id,label:a.getName(),icon:a.attributes.icon}));return s.length?c.jsx(Le,{size:"xs",className:n,style:r,value:t,options:s,onChange:o}):null}const Lk="gs-devices",B0=h.memo(function({className:t,style:n}){return c.jsx(oN,{children:r=>c.jsx(Ak,{className:N(Lk,t),style:n,...r})})}),Ji="gs-cmp-editor-topbar",Mk=ce(function({className:t,height:n,style:r,children:o,leftContainer:s,rightContainer:a,devices:i}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:f}=we(),p=n??l,g=h.useMemo(()=>({...r,minHeight:p,marginTop:u||!f?`-${p}px`:0}),[u,f,r]);return c.jsxs(c.Fragment,{children:[c.jsx(B,{className:N(Ji,"gs-utl-transition-spacing gs-utl-w-full",te.bb,z.br,t),style:g,children:o??c.jsxs(I,{className:N(`${Ji}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(B,{className:N(`${Ji}__wrp-left`),grow:!0,children:s!==!1&&c.jsx(Ck,{...s})}),c.jsx(B,{className:N(`${Ji}__wrp-center`),children:i!==!1&&c.jsx(B0,{...i})}),c.jsx(B,{className:N(`${Ji}__wrp-right`),grow:!0,children:a!==!1&&d&&c.jsx(_k,{editor:d,...a})})]})}),c.jsx(B,{className:N("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:N("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:q.eyeOff,size:se.s})})})]})}),Nk="gs-sidebar-top",z0=h.memo(ce(function({height:t,children:n,...r}){return c.jsx(Mk,{height:t,...r,style:Ic(r),className:N(Nk,"gs-utl-flex",kc(r)),children:n?$t(n):void 0})})),$k="gs-canvas-sidebar-top",kk=h.memo(ce(function({className:t,sidebarTop:n,...r}){return c.jsxs(Cn,{className:N($k,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...r,children:[c.jsx(z0,{...n}),c.jsx(kb,{grow:!0})]})})),Ik="gs-code-field",Vk=ce(function(e){const{editor:t}=we(),{isDarkTheme:n}=jr(),{editorEvents:r,onChange:o}=e,[s,a]=h.useState(()=>e),i=u=>({value:u,editor:t,state:s,setState:d=>a(f=>({...f,...d}))}),l=u=>o==null?void 0:o(i(u||""));return is({editor:t,editorEvents:r,localState:s,setLocalState:a}),c.jsx(ho,{className:N(Ik,s.className),language:s.language,style:s.style,label:s.label,name:s.name,defaultValue:s.value,size:s.size,required:s.required,disabled:s.disabled,readOnly:s.readOnly,minHeight:s.minHeight,row:s.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});var Hk={grad:.9,turn:360,rad:360/(2*Math.PI)},go=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Ut=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},er=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},U0=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},W0=function(e){return{r:er(e.r,0,255),g:er(e.g,0,255),b:er(e.b,0,255),a:er(e.a)}},Mp=function(e){return{r:Ut(e.r),g:Ut(e.g),b:Ut(e.b),a:Ut(e.a,3)}},jk=/^#([0-9a-f]{3,8})$/i,tu=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},G0=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:60*(i<0?i+6:i),s:s?a/s*100:0,v:s/255*100,a:o}},q0=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:255*[r,i,a,a,l,r][u],g:255*[l,r,r,i,a,a][u],b:255*[a,a,l,r,r,i][u],a:o}},K0=function(e){return{h:U0(e.h),s:er(e.s,0,100),l:er(e.l,0,100),a:er(e.a)}},Z0=function(e){return{h:Ut(e.h),s:Ut(e.s),l:Ut(e.l),a:Ut(e.a,3)}},Y0=function(e){return q0((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},Qi=function(e){return{h:(t=G0(e)).h,s:(o=(200-(n=t.s))*(r=t.v)/100)>0&&o<200?n*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,r,o},Dk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Fk=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Bk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zk=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Np={string:[[function(e){var t=jk.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?Ut(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?Ut(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=Bk.exec(e)||zk.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:W0({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=Dk.exec(e)||Fk.exec(e);if(!t)return null;var n,r,o=K0({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(Hk[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Y0(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=o===void 0?1:o;return go(t)&&go(n)&&go(r)?W0({r:Number(t),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,o=e.a,s=o===void 0?1:o;if(!go(t)||!go(n)||!go(r))return null;var a=K0({h:Number(t),s:Number(n),l:Number(r),a:Number(s)});return Y0(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,s=o===void 0?1:o;if(!go(t)||!go(n)||!go(r))return null;var a=function(i){return{h:U0(i.h),s:er(i.s,0,100),v:er(i.v,0,100),a:er(i.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)});return q0(a)},"hsv"]]},X0=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},Uk=function(e){return typeof e=="string"?X0(e.trim(),Np.string):typeof e=="object"&&e!==null?X0(e,Np.object):[null,void 0]},$p=function(e,t){var n=Qi(e);return{h:n.h,s:er(n.s+100*t,0,100),l:n.l,a:n.a}},kp=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},J0=function(e,t){var n=Qi(e);return{h:n.h,s:n.s,l:er(n.l+100*t,0,100),a:n.a}},Ip=function(){function e(t){this.parsed=Uk(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 Ut(kp(this.rgba),2)},e.prototype.isDark=function(){return kp(this.rgba)<.5},e.prototype.isLight=function(){return kp(this.rgba)>=.5},e.prototype.toHex=function(){return t=Mp(this.rgba),n=t.r,r=t.g,o=t.b,a=(s=t.a)<1?tu(Ut(255*s)):"","#"+tu(n)+tu(r)+tu(o)+a;var t,n,r,o,s,a},e.prototype.toRgb=function(){return Mp(this.rgba)},e.prototype.toRgbString=function(){return t=Mp(this.rgba),n=t.r,r=t.g,o=t.b,(s=t.a)<1?"rgba("+n+", "+r+", "+o+", "+s+")":"rgb("+n+", "+r+", "+o+")";var t,n,r,o,s},e.prototype.toHsl=function(){return Z0(Qi(this.rgba))},e.prototype.toHslString=function(){return t=Z0(Qi(this.rgba)),n=t.h,r=t.s,o=t.l,(s=t.a)<1?"hsla("+n+", "+r+"%, "+o+"%, "+s+")":"hsl("+n+", "+r+"%, "+o+"%)";var t,n,r,o,s},e.prototype.toHsv=function(){return t=G0(this.rgba),{h:Ut(t.h),s:Ut(t.s),v:Ut(t.v),a:Ut(t.a,3)};var t},e.prototype.invert=function(){return Wr({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),Wr($p(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),Wr($p(this.rgba,-t))},e.prototype.grayscale=function(){return Wr($p(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),Wr(J0(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),Wr(J0(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"?Wr({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):Ut(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=Qi(this.rgba);return typeof t=="number"?Wr({h:t,s:n.s,l:n.l,a:n.a}):Ut(n.h)},e.prototype.isEqual=function(t){return this.toHex()===Wr(t).toHex()},e}(),Wr=function(e){return e instanceof Ip?e:new Ip(e)},Q0=[],Wk=function(e){e.forEach(function(t){Q0.indexOf(t)<0&&(t(Ip,Np),Q0.push(t))})};function Gk(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"},r={};for(var o in n)r[n[o]]=o;var s={};e.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,l,u=r[this.toHex()];if(u)return u;if(a!=null&&a.closest){var d=this.toRgb(),f=1/0,p="black";if(!s.length)for(var g in n)s[g]=new e(n[g]).toRgb();for(var m in n){var v=(i=d,l=s[m],Math.pow(i.r-l.r,2)+Math.pow(i.g-l.g,2)+Math.pow(i.b-l.b,2));v<f&&(f=v,p=m)}return p}},t.string.push([function(a){var i=a.toLowerCase(),l=i==="transparent"?"#0000":n[i];return l?new e(l).toRgb():null},"name"])}function nu(){return(nu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function R0(e,t){if(e==null)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}function Vp(e){var t=h.useRef(e),n=h.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Ma=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},Ri=function(e){return"touches"in e},Hp=function(e){return e&&e.ownerDocument.defaultView||self},ey=function(e,t,n){var r=e.getBoundingClientRect(),o=Ri(t)?function(s,a){for(var i=0;i<s.length;i++)if(s[i].identifier===a)return s[i];return s[0]}(t.touches,n):t;return{left:Ma((o.pageX-(r.left+Hp(e).pageXOffset))/r.width),top:Ma((o.pageY-(r.top+Hp(e).pageYOffset))/r.height)}},ty=function(e){!Ri(e)&&e.preventDefault()},jp=h.memo(function(e){var t=e.onMove,n=e.onKey,r=R0(e,["onMove","onKey"]),o=h.useRef(null),s=Vp(t),a=Vp(n),i=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(b){ty(b),(Ri(b)?b.touches.length>0:b.buttons>0)&&o.current?s(ey(o.current,b,i.current)):v(!1)},m=function(){return v(!1)};function v(b){var w=l.current,y=Hp(o.current),S=b?y.addEventListener:y.removeEventListener;S(w?"touchmove":"mousemove",g),S(w?"touchend":"mouseup",m)}return[function(b){var w=b.nativeEvent,y=o.current;if(y&&(ty(w),!function(C,x){return x&&!Ri(C)}(w,l.current)&&y)){if(Ri(w)){l.current=!0;var S=w.changedTouches||[];S.length&&(i.current=S[0].identifier)}y.focus(),s(ey(y,w,i.current)),v(!0)}},function(b){var w=b.which||b.keyCode;w<37||w>40||(b.preventDefault(),a({left:w===39?.05:w===37?-.05:0,top:w===40?.05:w===38?-.05:0}))},v]},[a,s]),d=u[0],f=u[1],p=u[2];return h.useEffect(function(){return p},[p]),h.createElement("div",nu({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:f,tabIndex:0,role:"slider"}))}),ru=function(e){return e.filter(Boolean).join(" ")},Dp=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=ru(["react-colorful__pointer",e.className]);return h.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},h.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},pn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},ny=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:pn(e.h),s:pn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:pn(o/2),a:pn(r,2)}},Fp=function(e){var t=ny(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Bp=function(e){var t=ny(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},qk=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:pn(255*[r,i,a,a,l,r][u]),g:pn(255*[l,r,r,i,a,a][u]),b:pn(255*[a,a,l,r,r,i][u]),a:pn(o,2)}},Kk=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?Zk({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}},Zk=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:pn(60*(i<0?i+6:i)),s:pn(s?a/s*100:0),v:pn(s/255*100),a:o}},Yk=h.memo(function(e){var t=e.hue,n=e.onChange,r=ru(["react-colorful__hue",e.className]);return h.createElement("div",{className:r},h.createElement(jp,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Ma(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":pn(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(Dp,{className:"react-colorful__hue-pointer",left:t/360,color:Fp({h:t,s:100,v:100,a:1})})))}),Xk=h.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Fp({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:r},h.createElement(jp,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Ma(t.s+100*o.left,0,100),v:Ma(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+pn(t.s)+"%, Brightness "+pn(t.v)+"%"},h.createElement(Dp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Fp(t)})))}),Jk=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},Qk=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function Rk(e,t,n){var r=Vp(n),o=h.useState(function(){return e.toHsva(t)}),s=o[0],a=o[1],i=h.useRef({color:t,hsva:s});h.useEffect(function(){if(!e.equal(t,i.current.color)){var u=e.toHsva(t);i.current={hsva:u,color:t},a(u)}},[t,e]),h.useEffect(function(){var u;Jk(s,i.current.hsva)||e.equal(u=e.fromHsva(s),i.current.color)||(i.current={hsva:s,color:u},r(u))},[s,e,r]);var l=h.useCallback(function(u){a(function(d){return Object.assign({},d,u)})},[]);return[s,l]}var e6=typeof window<"u"?h.useLayoutEffect:h.useEffect,t6=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},ry=new Map,n6=function(e){e6(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!ry.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}`,ry.set(t,n);var r=t6();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},r6=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+Bp(Object.assign({},n,{a:0}))+", "+Bp(Object.assign({},n,{a:1}))+")"},s=ru(["react-colorful__alpha",t]),a=pn(100*n.a);return h.createElement("div",{className:s},h.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),h.createElement(jp,{onMove:function(i){r({a:i.left})},onKey:function(i){r({a:Ma(n.a+i.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(Dp,{className:"react-colorful__alpha-pointer",left:n.a,color:Bp(n)})))},o6=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,a=R0(e,["className","colorModel","color","onChange"]),i=h.useRef(null);n6(i);var l=Rk(n,o,s),u=l[0],d=l[1],f=ru(["react-colorful",t]);return h.createElement("div",nu({},a,{ref:i,className:f}),h.createElement(Xk,{hsva:u,onChange:d}),h.createElement(Yk,{hue:u.h,onChange:d}),h.createElement(r6,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},s6={defaultColor:"rgba(0, 0, 0, 1)",toHsva:Kk,fromHsva:function(e){var t=qk(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:Qk},a6=function(e){return h.createElement(o6,nu({},e,{colorModel:s6}))};Wk([Gk]);const i6=e=>e.startsWith("rgba")?e:Wr(e).toRgbString();function oy({value:e,onChange:t,disabled:n}){const r=i6(e||""),o=h.useRef(r),[s,a]=h.useState(!1),i=Tr()&&!!window.EyeDropper,l=g=>{o.current=g,t==null||t(g)},u=g=>{o.current=g,t==null||t(g,!0)},d=()=>{i&&new window.EyeDropper().open().then(m=>l(m.sRGBHex)).catch(console.warn)},f=()=>{a(!0)},p=()=>{t==null||t(o.current,!1),a(!1)};return c.jsxs(c.Fragment,{children:[s&&c.jsx("div",{onPointerUp:p,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx(a6,{className:"color-picker",color:r,onChange:u,onPointerDown:f,onPointerUp:p}),c.jsxs(I,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(B,{grow:!0,children:c.jsx(rt,{size:"s",value:r,onChange:l,disabled:n})}),i&&c.jsx(Ke,{type:"button",onClick:d,children:c.jsx(ne,{icon:q.eyedropperVariant,size:se.s})})]})]})}const l6="gs-cmp-studio-color-picker",c6=h.memo(ce(function({className:t,style:n,value:r="",disabled:o,onChange:s,editorEvents:a}){const{editor:i}=we(),[l,u]=h.useState(()=>({className:t,style:n,value:r,disabled:o})),d=(f,p)=>{const g=f||"";s==null||s({value:g,partial:p,editor:i,state:l,setState:m=>u(v=>({...v,...m}))})};return is({editor:i,editorEvents:a,localState:l,setLocalState:u}),c.jsx("div",{className:N(l6,l.className,Te.m),style:l.style,children:c.jsx(oy,{value:l.value||"",onChange:d,disabled:l.disabled})})})),u6="gs-cmp-column",d6=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(Cn,{className:N(u6,z.bg,"gs-utl-flex gs-utl-flex-col",r&&"gs-utl-h-full",t),...o,children:$t(n)})}),zp=`<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>`,Bs="--before-content",Up={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},sy={stylable:!1,traits:[]};function f6(e){return typeof e=="object"&&e.type===Bt.variable}function ay(e){if(f6(e)){const{path:t}=e;return iy(t||"")}return e}function iy(e){return`{{ ${e} }}`}function p6(e){const t={};return e.DataSources.getAll().forEach(n=>{const r=n.get("id");if(!r)return;const o=n.getRecords();if(!o){t[r]={};return}t[r]=o.reduce((s,a)=>{if(!a)return s;let i={...a.attributes};return delete i.__p,delete i.id,r===Hs.globalStyles&&(i={value:i.value}),{...s,[a.id]:i}},{})}),t}function ly(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const Wp=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags)??t?{...sy}:{}},Gp=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e,r=(a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags;return t||r===!0?{...sy}:{}},h6=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,g6=e=>Array.isArray(e)?"array":e===null?"default":typeof e,m6=ce(({name:e,value:t,isActive:n,isCollection:r,onClick:o,className:s})=>{const a=Ie().tScoped("dataSources"),i=typeof t=="object"&&t!==null,l={array:q.codeBrackets,object:q.codeBraces,string:q.codeString,number:q.number,boolean:q.toggleSwitchOffOutline,default:q.null},u=g6(t),d=N(s,"gs-utl-text-left",z.hBgH,te.b,te.rnd,Te.xy,n?[te.bA,z.tA]:[z.br,z.txtHighEmphasisH]),f=p=>typeof p=="object"?Array.isArray(p)?a("items",{params:{length:p.length}}):p?a("properties",{params:{length:Object.keys(p).length}}):"null":String(p);return c.jsx(Ke,{onClick:o,border:!1,className:d,full:!0,children:c.jsxs(I,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs(I,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs(I,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(ne,{icon:l[u],size:se.s}),c.jsx(B,{className:N(Pe.txtEllips,r&&"gs-utl-font-bold"),children:e})]}),c.jsx(B,{className:N("gs-utl-w-full",Pe.txtEllips,Pe.disabled),children:f(t)})]}),i&&c.jsx(B,{children:c.jsx(ne,{size:se.sx,icon:q.arrowRight,className:N(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),v6="gs-cmp-data-path-explorer",cy=ce(function({additionalSources:t,onChange:n,path:r=""}){const{editor:o}=we(),s=h.useRef({}),[a,i]=h.useState(()=>r.split(".")),[l,u]=h.useState([]),d=h.useMemo(()=>({...o?p6(o):{},...t}),[o,t]),f=(v,b)=>{let w=s.current;for(let y=0;y<b&&y<v.length;y++){const S=v[y];if(w&&typeof w=="object"&&S in w)w=w[S];else{w=void 0;break}}return!w||typeof w!="object"?[]:Object.entries(w).map(([y,S])=>{const C=v.slice(0,b).concat(y),x=a[b]===y,E=b===0&&Rr(S)&&S.collectionId===y,T=()=>{const _=x?C.slice(0,-1):C;n==null||n(_.join("."),{paths:_}),i(_)};return c.jsx(m6,{className:N(E&&"-gs-utl-order-1"),isCollection:E,name:y,value:S,isActive:x,onClick:T},y)})};h.useEffect(()=>{s.current=d;const v=[];for(let b=0;b<=a.length;b++){const w=f(a,b);w.length>0&&v.push(w)}u(v)},[d,a]);const p=N(v6,z.bg,z.br,te.b,te.rnd,Pe.scrollX,"gs-utl-h-full"),g=N("gs-utl-min-w-[220px]",z.br),m=N("gs-utl-h-full gs-utl-max-h-[60vh]",Pe.scrollY,Te.xyS);return c.jsx(I,{className:p,full:!0,nowrap:!0,children:l.map((v,b)=>c.jsx(B,{className:N(g,b!==l.length-1&&te.br),children:c.jsx(I,{col:!0,nowrap:!0,gap:"m",className:m,children:v})},b))})});function uy(e){const{collectionId:t,variableType:n,path:r=""}=e;return t?[t,n,r].filter(Boolean).join("."):r}function qp(e,t){const[n="",r="",...o]=e.split(".");return n&&t[n]?{collectionId:n,variableType:r,path:o.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const b6=e=>{const{path:t,collectionId:n,variableType:r}=e.dataResolver||{};return n?[n,r,t].filter(Boolean).join("."):e.value||t||""},y6=e=>{const{dataResolver:t,editor:n,value:r,defaultValue:o,additionalSources:s}=e,{path:a="",collectionId:i,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(i){const d=s==null?void 0:s[i],f=l&&d?d[l]:d;return(u==null?void 0:u.getValue(a,o,{context:f}))||""}else return(u==null?void 0:u.getValue(r,o))||""},w6="gs-cmp-data-path-field",el=ce(e=>{const{size:t="m",value:n="",label:r,open:o,defaultValue:s,additionalSources:a,dataResolver:i,readOnly:l,disabled:u,pickerInPopover:d,onChange:f,onPickerToggle:p}=e,{editor:g}=we(),m=Ie().tScoped("dataSources"),[v,b]=h.useState(!!o),[w,y]=h.useState(!1),S=!!l||v||w,C=()=>y(!w),x=F=>{const k=F??!v;b(k),p==null||p(k)},E=()=>x(!1),T=(...F)=>{f==null||f(...F)},_=F=>{S||f==null||f(F,{paths:F.split(".")})},O=b6({dataResolver:i,value:n}),P=w&&g?`"${y6({editor:g,dataResolver:i,additionalSources:a,value:n,defaultValue:s})}"`:O,A=t==="m",M=A?"lg":t,$=A?se.l:se.s,j=m(v?"closePathExplorer":"openPathExplorer"),L={icon:v?q.close:q.databaseOutline,size:se.l},D={icon:w?q.eyeOff:q.eye,size:A?se.m:$},W=c.jsx(Ct,{block:!0,variant:"pr",size:M,title:j,onClick:()=>x(),icon:L});return c.jsxs(I,{className:w6,gap:t,col:!0,children:[c.jsxs(I,{gap:t,items:"end",nowrap:!0,children:[c.jsx(rt,{readOnly:S,label:r,value:w?P:O,size:t,disabled:u,onChange:_,placeholder:m("selectVariablePath"),className:N("gs-utl-flex-grow",z.txt,Pe.txtEllips),afterInput:!!n&&c.jsx(Ct,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:C,className:Pe.hover,icon:D})}),d?c.jsx(wr,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:W,onClose:E,overlay:!0,children:c.jsx(cy,{path:O,onChange:T,additionalSources:a})}):W]}),!!v&&!d&&c.jsx(cy,{path:O,onChange:T,additionalSources:a})]})}),S6=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},dy=({value:e,step:t})=>{const n=parseFloat(`${e}`);let r=0;if(Math.floor(n)!==n&&t){const o=`${t}`.split(".")[1];r=(o==null?void 0:o.length)||0}return r?parseFloat(n.toFixed(r)):n},C6=({value:e,key:t,shiftKey:n,min:r,max:o,step:s=1})=>{const a=t==="ArrowUp",i=t==="ArrowDown";let l=null;if(a||i){l=Number(e);const u=parseFloat(`${s}`);a&&(l+=(n?10:1)*u),i&&(l-=(n?10:1)*u),l=`${ou({min:r,max:o,value:l})}`,l=dy({value:l,step:s})}return l},ou=({min:e,max:t,value:n})=>{const r=parseFloat(`${n}`);let o=r||0;return Ht(e)&&(o=Math.max(o,parseFloat(`${e}`)||0)),Ht(t)&&(o=Math.min(o,parseFloat(`${t}`)||0)),`${`${r}`!=`${n}`?n:o}`},x6=(e,t,n,r={})=>{const o=parseInt(`${e}`,10)||0,{min:s,max:a,step:i=1}=r;let l=o;const u=f=>{const p=f.clientY-t,g=o-p*parseFloat(`${i}`);l=dy({value:ou({min:s,max:a,value:g}),step:i}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},E6=(e,t,n={})=>{const{partial:r}=n,o=(s,a)=>s===a||r&&s.startsWith(a);return t.some(s=>o(typeof s=="string"?s:s.id,e))},fy=e=>Ht(e)?e:"",T6="gs-cmp-number-field";function $e(e){const{className:t,value:n,units:r,valueUnit:o,size:s="m",pan:a=!0,min:i,max:l,step:u,placeholder:d,disabled:f,onChange:p,onChangeUnit:g}=e,[m,v]=h.useState(fy(n)),[b,w]=h.useState(!1),y=(r==null?void 0:r.map(O=>({id:O,label:O})))||[],S={min:i,max:l,step:u};h.useEffect(()=>{v(fy(n))},[n,o]);const C=(O,P)=>{p==null||p(ou({min:i,max:l,value:O}),P)},x=O=>{if(f)return;w(!0);const P=(A,M)=>{C(A,!!M),!M&&w(!1)};x6(m,O.clientY,P,S)},E=O=>{const{key:P,shiftKey:A}=O;switch(P){case"Escape":return v(n);case"Enter":return C(m)}const M=C6({step:u,value:n,key:P,shiftKey:A});M!==null&&(O.preventDefault(),C(M))},T=()=>{C(m)},_=Go({...e,className:N(T6,t)});return c.jsxs("div",{..._,children:[b&&c.jsx("div",{className:N("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(br,{as:e.labelAs,...e}),c.jsxs(I,{className:tp(e),items:"center",space:"x2s",children:[!!a&&c.jsx(B,{onMouseDown:x,className:N("gs-utl-opacity-50 gs-utl-cursor-ns",s==="m"&&"-gs-utl-ml-3",s==="s"&&"-gs-utl-ml-2",a!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:a===!0?c.jsx(ne,{icon:q.panVertical,size:se.s2x}):a}),c.jsx(B,{grow:!0,children:c.jsx("input",{className:ji(e),value:m,disabled:f,onChange:O=>v(O.target.value),placeholder:d,onBlur:T,onKeyDown:E})}),!!y.length&&c.jsx(B,{className:N(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(Le,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:o,disabled:f,onChange:O=>g==null?void 0:g(O),options:y})})]})]})}const P6="gs-cmp-switch-field";function tl(e){const{className:t,value:n,label:r,labelAs:o,border:s,disabled:a,onChange:i}=e,l=!!n,u=N("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,ni.focus,s&&`${z.br} ${te.b}`);return c.jsx(lf.Group,{children:c.jsxs(I,{items:"center",className:N(P6,t),full:!0,children:[!!r&&c.jsx(lf.Label,{as:o,className:N("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(br,{...e,as:"span"})}),c.jsx(lf,{checked:l,onChange:i,className:u,disabled:a,children:c.jsx("span",{className:N(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 Kp(e){var a;const[t,n]=h.useState(((a=e.getDataResolver)==null?void 0:a.call(e))??{}),r=h.useRef(t),o=i=>{const l={...r.current,...i};r.current=l,n(l)},s=()=>{e.setDataResolver(r.current)};return h.useEffect(()=>{const i="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(i,l),()=>{e.off(i,l)}},[e]),{localData:t,updateLocalData:o,syncToComponent:s}}const O6="gs-cmp-data-collection-picker",_6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Kp(e),{collectionId:s="",dataSource:a={},startIndex:i=0,endIndex:l=10}=n,u=uy(a),d=l===Number.MAX_VALUE,f=Ie().tScoped("dataSources"),p=d?"":l,g=()=>{o(),t==null||t({value:n})},m=y=>r({dataSource:{...a,path:y}}),v=y=>r({startIndex:y}),b=y=>r({endIndex:y}),w=y=>r({endIndex:y?Number.MAX_VALUE:4});return c.jsxs(I,{className:O6,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(rt,{className:"gs-utl-flex-grow",size:"s",label:f("collectionId"),value:s,readOnly:!0,disabled:!0}),c.jsx(gb,{size:"s",value:s,block:!0})]}),c.jsx(el,{label:f("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx($e,{size:"s",className:"gs-utl-flex-grow",label:f("collectionStartIndex"),value:i==null?void 0:i.toString(),onChange:v}),c.jsx($e,{size:"s",label:f("collectionEndIndex"),placeholder:d?"-":"",value:p==null?void 0:p.toString(),onChange:b,className:N("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(B,{children:c.jsx(tl,{label:f("collectionUpToEndIndex"),value:d,onChange:w})})]}),c.jsx(I,{full:!0,justify:"end",children:c.jsx(Ke,{onClick:g,variant:"pr",size:"m",children:f("confirm")})})]})}),A6="gs-data-collection-picker",L6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(Cn,{className:N(A6,t),...o,children:c.jsx(_6,{component:n,onConfirm:r})})});var Vn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Vn||{}),Hn=(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))(Hn||{}),Zp=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(Zp||{}),Yp=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(Yp||{});const M6=[...Object.values(Yp),...Object.values(Zp),...Object.values(Hn)],Xp={string:Object.values(Yp),number:Object.values(Zp),dataSource:M6},N6=h.memo(function(t){const{additionalSources:n,side:r,type:o,value:s,onChange:a}=t;switch(o){case Vn.DATA_SOURCE:return c.jsx(el,{size:"s",pickerInPopover:!0,value:uy(s),onChange:i=>a(r,i,o),additionalSources:n});case Vn.NUMBER:return c.jsx($e,{size:"s",value:s,onChange:i=>a(r,i,o)});default:return c.jsx(rt,{size:"s",value:s,onChange:i=>a(r,i,o)})}}),$6="gs-cmp-statement-side",py=h.memo(function({side:t,type:n,value:r,label:o,onChange:s,onTypeChange:a,additionalSources:i,typeOptions:l}){return c.jsxs(I,{className:N($6,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Wo,{size:"s",children:o}),c.jsxs(I,{items:"center",gap:"xs",children:[c.jsx(B,{children:c.jsx(Le,{size:"s",value:n,options:l,onChange:u=>a(t,u)})}),c.jsx(B,{grow:!0,children:c.jsx(N6,{additionalSources:i,side:t,type:n,value:r,onChange:s})})]})]})}),su=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Vn.DATA_SOURCE:typeof e=="string"?Vn.STRING:typeof e=="number"?Vn.NUMBER:Vn.STRING,k6=(e,t,n)=>{switch(t){case Vn.STRING:return e||"";case Vn.NUMBER:return e?Number(e):0;case Vn.DATA_SOURCE:{const r=n||{};return{type:"data-variable",...(ct(e)?qp(e,r):e)??{path:"",defaultValue:""}}}default:return e}},I6=e=>Xp[e][0],V6=e=>![Hn.isTruthy,Hn.isFalsy,Hn.isDefined,Hn.isNull,Hn.isUndefined,Hn.isArray,Hn.isObject,Hn.isString,Hn.isNumber,Hn.isBoolean,Hn.isDefaultValue].includes(e),H6="gs-cmp-statement",j6=ce(e=>{const{statement:t,onChange:n,className:r,additionalSources:o}=e,s=Ie().tScoped("dataSources"),[a,i]=h.useState(()=>su(t.left)),[l,u]=h.useState(()=>su(t.right)),d=Xp[a]||Xp[Vn.STRING],f=h.useMemo(()=>Object.values(Vn).map(C=>({id:C,label:Pr(C)})),[]),p=h.useMemo(()=>d.map(C=>({id:C,label:s(`operators.${C}`)})),[d,s]);h.useEffect(()=>{i(su(t.left)),u(su(t.right))},[t.left,t.right]);const g=C=>{n({...t,...C})},m=(C,x,E)=>{const T=k6(x,E,o),_=C==="left",O=_&&E!==Vn.DATA_SOURCE;_?i(E):u(E),g({[C]:T,...O&&{operator:I6(E)}})},v=(C,x)=>m(C,null,x),b=C=>g({operator:C}),w=N(H6,r,z.br,te.b,te.rnd,Te.xy),y=V6(t.operator),S={additionalSources:o,onChange:m,onTypeChange:v,typeOptions:f};return c.jsx(I,{className:N(w,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs(I,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(py,{side:"left",type:a,value:t.left,label:s("leftValue"),...S}),c.jsx(B,{children:c.jsx(Le,{size:"s",label:s("operator"),value:t.operator,options:p,onChange:b})}),y&&c.jsx(py,{side:"right",type:l,value:t.right,label:s("rightValue"),...S})]})})}),Jp="gs-cmp-statements-group",D6=e=>e==="and"||e==="or",au=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),hy=ce(e=>{const{className:t,condition:n,onUpdate:r,additionalSources:o,skipAddCondition:s}=e,a=Ie().tScoped("dataSources"),i=n.statements??[],l=n.logicalOperator||"and",u=m=>{D6(m)&&r({...n,logicalOperator:m})},d=()=>{au(n),r(au(n))},f=m=>{const v=i.filter((b,w)=>w!==m);r({...n,statements:v})},p=(m,v)=>{if(m>=0&&m<i.length){const b=[...i];b[m]=v,r({...n,statements:b})}},g=[{id:"and",label:a("conditionAnd")},{id:"or",label:a("conditionOr")}];return c.jsxs(I,{className:N(Jp,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[i.length>1&&c.jsx(Zo,{value:l,onChange:u,tabs:g}),c.jsx(I,{className:`${Jp}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:i.map((m,v)=>c.jsxs(I,{className:N(`${Jp}__item`),gap:"s",col:!0,children:[c.jsx(j6,{additionalSources:o,statement:m,onChange:b=>p(v,b)}),v<i.length-1&&c.jsxs(I,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:N(z.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(Ct,{block:!0,variant:"out-clear",title:a("deleteCondition"),onClick:()=>f(v+1),icon:{icon:q.delete,size:se.s}})]})]},`stmt-${v}`))}),!s&&c.jsx(I,{justify:"end",children:c.jsx(Ke,{variant:"pr",onClick:d,icon:{icon:q.plus,size:se.s},children:a("addCondition")})})]})}),F6="gs-cmp-data-condition-picker",B6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Kp(e),s=Ie().tScoped("dataSources"),a=n.condition,i=d=>r({condition:d}),l=()=>{o(),t==null||t({value:n})},u=()=>{r({condition:au(a)})};return c.jsxs(I,{className:F6,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(hy,{additionalSources:e.collectionsStateMap??{},condition:a,onUpdate:i,skipAddCondition:!0}),c.jsxs(I,{gap:"m",justify:"end",full:!0,children:[c.jsx(Ke,{variant:"out",onClick:u,icon:{icon:q.plus,size:se.s},children:s("addCondition")}),c.jsx(Ke,{onClick:l,variant:"pr",size:"m",children:s("confirm")})]})]})}),z6="gs-data-condition-picker",U6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(Cn,{className:N(z6,t),...o,children:c.jsx(B6,{component:n,onConfirm:r})})}),W6="gs-data-path-field",G6=ce(({className:e,value:t="",onChange:n,...r})=>c.jsx(Cn,{className:N(W6,e),...r,children:c.jsx(el,{onChange:o=>n({value:o}),value:t})})),iu={type:"data-variable",path:"",defaultValue:""},gy={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function es(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const my="gs-cmp-dynamic-value-picker",q6=ce(({value:e,onChange:t,onConfirm:n,additionalSources:r})=>{const[o,s]=h.useState(()=>es(e)?e:iu),[a,i]=h.useState(o.type),l=Ie().tScoped("dataSources");h.useEffect(()=>{const S=es(e)?e:iu;(S.type!==o.type||JSON.stringify(S)!==JSON.stringify(o))&&(s(S),i(S.type))},[e]);const u=S=>{s(S),t==null||t({value:S})},d=S=>{const C=S;i(C);const x=o.type===C?o:C==="data-variable"?iu:gy;u(x)},f=S=>{u({type:"data-variable",defaultValue:o.defaultValue,...qp(S,r)})},p=S=>{s(C=>{const x={...C,defaultValue:S};return t==null||t({value:x}),x})},g=S=>{u({...o,condition:S})},m=(S,C)=>{u({...o,[S]:C})},v=()=>{const S=o.condition;g(au(S))},b=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],w=(o==null?void 0:o.type)==="data-variable"?o:iu,y=(o==null?void 0:o.type)==="data-condition"?o:gy;return c.jsxs(I,{className:my,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{className:my,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(Zo,{value:a,onChange:d,tabs:b}),c.jsx(B,{grow:!0,className:Te.y,style:{overflowY:"auto",overflowX:"hidden"},children:a==="data-variable"?c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(el,{value:w.path,label:l("variablePath"),additionalSources:r,defaultValue:w.defaultValue,onChange:f}),c.jsx(rt,{label:l("defaultValue"),value:w.defaultValue||"",onChange:p})]}):c.jsxs(I,{gap:"m",col:!0,children:[c.jsx(hy,{additionalSources:r,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(rt,{label:l("ifTrue"),value:y.ifTrue,onChange:S=>m("ifTrue",S)}),c.jsx(rt,{label:l("ifFalse"),value:y.ifFalse,onChange:S=>m("ifFalse",S)})]})]})}),a==="data-condition"&&c.jsx(I,{full:!0,justify:"end",className:Te.x,children:c.jsx(Ke,{variant:"out",onClick:v,icon:{icon:q.plus,size:se.s},children:l("addCondition")})})]}),c.jsx(I,{full:!0,justify:"end",className:Te.y,children:c.jsx(Ke,{onClick:()=>{n==null||n({value:o})},variant:"pr",size:"m",children:l("confirm")})})]})}),K6="gs-data-value-picker",Z6=ce(({className:e,value:t={},onChange:n,onConfirm:r,additionalSources:o={},...s})=>c.jsx(Cn,{className:N(K6,e),...s,children:c.jsx(q6,{value:t,onConfirm:a=>r==null?void 0:r(a),onChange:a=>n==null?void 0:n(a),additionalSources:o})})),Y6="gs-cmp-data-variable-picker",X6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Kp(e),s=Ie().tScoped("dataSources"),{path:a="",defaultValue:i=""}=n,l=e.collectionsStateMap,u=p=>{r(qp(p,l))},d=()=>{o(),t==null||t({value:n})},f=p=>r({defaultValue:p});return c.jsxs(I,{className:Y6,gap:"s",col:!0,nowrap:!0,children:[c.jsx(el,{value:a,label:s("variablePath"),dataResolver:n,additionalSources:l,defaultValue:i,onChange:u}),c.jsx(rt,{label:s("defaultValue"),value:i,onChange:f}),c.jsx(I,{full:!0,justify:"end",className:Te.y,children:c.jsx(Ke,{onClick:d,variant:"pr",size:"m",children:s("confirm")})})]})}),J6="gs-data-variable-picker",Q6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(Cn,{className:N(J6,t),...o,children:c.jsx(X6,{component:n,onConfirm:r})})}),R6="gs-cmp-input-field",e8=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,disabled:i,inputType:l,readOnly:u,required:d,placeholder:f,onChange:p,onInput:g,editorEvents:m}){const{editor:v}=we(),[b,w]=h.useState(()=>({className:t,style:n,label:r,name:o,value:s,size:a,readOnly:u,disabled:i,required:d,placeholder:f})),y=x=>({value:x,editor:v,state:b,setState:E=>w(T=>({...T,...E}))}),S=x=>p==null?void 0:p(y(x)),C=x=>g==null?void 0:g(y(x));return is({editor:v,editorEvents:m,localState:b,setLocalState:w}),c.jsx(rt,{type:l,className:N(R6,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:S,onInput:C})})),t8="gs-menu-list",n8=ce(function({className:e,items:t,onItemClick:n,...r}){const{editor:o}=we(),[s,a]=h.useState(),i=u=>{const{onClick:d}=u;if(d&&o)return f=>d({item:u,editor:o,...f})},l=()=>{if(n&&o)return u=>n({...u,editor:o})};return c.jsx(Cn,{className:N(t8,z.bg,"gs-utl-flex gs-utl-flex-col",e),...r,children:(t||[]).map((u,d)=>h.createElement(Pa,{...u,label:u.layout?$t(u.layout):u.label,key:u.id??d,className:u.className,action:i(u),onActive:()=>a(u),onItemClick:l(),active:s===u,items:u.items}))})});function r8({children:e,accept:t,onChange:n,multiple:r=!0,...o}){const s=Ie(),a=h.useRef(null),i=()=>{const{current:l}=a;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:Z("hidden"),ref:a,type:"file",multiple:r,accept:t,onChange:n}),c.jsx(Ke,{variant:"pr",size:"m2",...o,onClick:i,children:e||s.t("upload")})]})}const o8=ce(r8),s8=ce(function({editor:t,assetProps:n,itemLayout:r,onSelect:o,onRemove:s}){const a=_i();return $t(r({asset:To(a.toAsset(n)),assetProps:To(n),onSelect:i=>o(a.toAssetProps(i)),onDelete:s&&(i=>s(a.toAssetProps(i))),editor:t}))}),a8="gs-cmp-asset-card",i8=ce(function(t){var f;const{assetProps:n,onSelect:r,onRemove:o,className:s,itemLayout:a}=t,i=Ie(),{editor:l}=we();if(a)return l?c.jsx(s8,{...t,editor:l,itemLayout:a}):null;const{src:u}=n,d=n.name||((f=u.split("/").pop())==null?void 0:f.split("?").shift());return c.jsx(Yn,{padding:!1,className:ae(a8,"overflow-hidden max-w-full group",s),children:c.jsxs(I,{col:!0,children:[c.jsxs(B,{className:ae("relative group h-24 cursor-pointer bg-checker"),onClick:()=>r(n),children:[c.jsx("div",{className:ae("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(I,{justify:"center",items:"center",className:ae(Pe.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Ke,{className:ae("text-sm"),size:"m2",variant:"pr",children:i.t("select")})})]}),c.jsxs(I,{className:ae("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(B,{className:ae(Pe.txtEllips,"text-sm gjs-mr-auto"),children:d}),o&&c.jsx(eu,{onConfirm:()=>o==null?void 0:o(n),text:c.jsxs(I,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ae("text-center",z.txtHighEmphasis),children:i.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ae("text-center"),children:i.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(Ct,{title:i.t("delete"),children:c.jsx(ne,{icon:q.delete,size:se.sx})})})]})]})})}),Gr="gs-asset-manager",l8={search:!0,addUrl:!0,upload:!0},c8=ce(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:r,typeFilter:o,providerFilter:s,searchValue:a,isLoading:i,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:f,content:p,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:v,onChangeSearchValue:b,onChangeUpload:w,onAddUrl:y,onRemove:S,onEndReached:C,layoutAfterHeader:x}){const E=we(),{editor:T}=E,_=Ie(),[O]=jf(),P=Ap(p==null?void 0:p.itemsPerRow),[A,M]=h.useState(""),$=(p==null?void 0:p.header)===!1?!1:{...l8,...Rr(p==null?void 0:p.header)?p.header:{}};if(!T)return;const j=d?t.filter(L=>!(a&&!Zs(L.src,a)&&!Zs(L.name??"",a))):t;return c.jsxs(I,{className:Z(Gr,"relative gs-utl-h-full",i&&Pe.disabled),nowrap:!0,col:!0,space:"m",children:[$!==!1&&c.jsxs(I,{className:`${Gr}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(I,{className:`${Gr}__header-filters`,items:"center",gap:"m",children:[$.search&&c.jsx(B,{children:c.jsx(rt,{className:`${Gr}__search-filter`,size:"m",type:"search",value:a,onInput:b,placeholder:`${_.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(B,{children:c.jsx(Le,{className:Z(`${Gr}__type-filter`,"items-center"),size:"m",options:n,value:o,onChange:m,emptyState:_.t("assetManager.assetTypes.all"),includeEmpty:l})}),r.length>(u?0:1)&&c.jsx(B,{children:c.jsx(Le,{classNameContainer:Z(`${Gr}__provider-filter`,"items-center"),size:"m",options:r.map(L=>({...L,label:et(L.label)?L.label({editor:T}):L.label,icon:L.icon})),value:s,onChange:v,emptyState:_.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(I,{className:`${Gr}__header-buttons`,items:"center",gap:"m",children:[$.upload&&c.jsx(B,{children:c.jsx(o8,{className:`${Gr}__upload-field`,onChange:w})}),$.addUrl&&!!y&&c.jsx(B,{children:c.jsx(wr,{className:`${Gr}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(Ke,{variant:"pr",size:"m2",children:_.t("assetManager.addUrl")}),children:({close:L})=>c.jsxs(I,{gap:"m",children:[c.jsx(B,{children:c.jsx(rt,{type:"url",size:"s",value:A,onChange:M,placeholder:_.t("assetManager.inputPlh")})}),c.jsx(B,{children:c.jsx(Ke,{variant:"pr",size:"m2",onClick:()=>{y(A),L()},children:_.t("add")})})]})})})]}),x&&c.jsx(c.Fragment,{children:$t(x({editor:T}))})]}),c.jsx(I,{className:Z(`${Gr}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!i&&!j.length?c.jsx(I,{justify:"center",children:_.t("noItems")}):!!O&&c.jsx(Rc,{data:j,listClassName:Z("gs-utl-grid gs-utl-gap-2",P),endReached:C,itemContent:(L,D)=>c.jsx(i8,{assetProps:D,onSelect:g,onRemove:S,itemLayout:f},D.id),components:{Footer:C?u8:void 0}})}),i&&c.jsx(Lo,{abs:!0})]})}),u8=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),d8=ce(function({panelId:t,content:n,assets:r,types:o,providers:s,typeId:a,providerId:i,optionalType:l,optionalProvider:u,onSelect:d,close:f,layoutAfterHeader:p}){const{appEditorStore:g,i18nStore:m}=En(),{editor:v}=g,b=_i(),{customOnLoad:w}=b,y=wv(t);h.useEffect(()=>{const T=O=>ct(O)?{id:O,label:m.t(`assetManager.assetTypes.${O}`)||O}:O;y.setCustomTypes(o==null?void 0:o.map(T)),y.setCustomProviders(ct(s)?[s]:s),a?y.setTypeFilter(a):y.initTypeFilter(),i?y.setProviderFilter(i):y.initProviderFilter(),Ht(l)?y.setOptionalType(l):y.initOptionalType(),Ht(u)?y.setOptionalProvider(u):y.initOptionalProvider();const _=setTimeout(()=>y.loadAssets());return()=>clearTimeout(_)},[o,s,a,i,l,u]);const S=T=>{b.addToProjectAssets([{id:T,src:T,type:y.typeFilter??Ns.image}])},C=T=>{v&&(d==null||d({asset:b.toAsset(T),assetProps:T,editor:v}),f==null||f())},x=r==null?void 0:r.map(b.toAssetProps),E=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(c8,{assetProps:x??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:T=>{y.setTypeFilter(T),y.loadAssets()},onChangeProviderFilter:T=>{y.setProviderFilter(T),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:C,onAddUrl:w?void 0:S,onChangeUpload:T=>b.uploadFile(T.nativeEvent),onRemove:x?void 0:y.handleDelete,onEndReached:E,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:p})});var f8=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),It=function(){return It=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},It.apply(this,arguments)},vy={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},by={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},lu={width:"20px",height:"20px",position:"absolute"},p8={top:It(It({},vy),{top:"-5px"}),right:It(It({},by),{left:void 0,right:"-5px"}),bottom:It(It({},vy),{top:void 0,bottom:"-5px"}),left:It(It({},by),{left:"-5px"}),topRight:It(It({},lu),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:It(It({},lu),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:It(It({},lu),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:It(It({},lu),{left:"-10px",top:"-10px",cursor:"nw-resize"})},h8=function(e){f8(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(r){n.props.onResizeStart(r,n.props.direction)},n.onTouchStart=function(r){n.props.onResizeStart(r,n.props.direction)},n}return t.prototype.render=function(){return nt.createElement("div",{className:this.props.className||"",style:It(It({position:"absolute",userSelect:"none"},p8[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(nt.PureComponent),g8=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),qr=function(){return qr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},qr.apply(this,arguments)},m8={width:"auto",height:"auto"},cu=function(e,t,n){return Math.max(Math.min(e,n),t)},yy=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},Na=function(e,t){return new RegExp(e,"i").test(t)},uu=function(e){return!!(e.touches&&e.touches.length)},v8=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},wy=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(s,a,i){return Math.abs(a-e)<Math.abs(t[s]-e)?i:s},0),o=Math.abs(t[r]-e);return n===0||o<n?t[r]:e},Qp=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"},du=function(e,t,n,r){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var o=Number(e.replace("%",""))/100;return t*o}if(e.endsWith("vw")){var o=Number(e.replace("vw",""))/100;return n*o}if(e.endsWith("vh")){var o=Number(e.replace("vh",""))/100;return r*o}}return e},b8=function(e,t,n,r,o,s,a){return r=du(r,e.width,t,n),o=du(o,e.height,t,n),s=du(s,e.width,t,n),a=du(a,e.height,t,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof a>"u"?void 0:Number(a)}},y8=function(e){return Array.isArray(e)?e:[e,e]},w8=["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"],Sy="__resizable_base__",S8=function(e){g8(t,e);function t(n){var r,o,s,a,i=e.call(this,n)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var l=i.parentNode;if(!l)return null;var u=i.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(Sy):u.className+=Sy,l.appendChild(u),u},i.removeBase=function(l){var u=i.parentNode;u&&u.removeChild(l)},i.state={isResizing:!1,width:(o=(r=i.propsSize)===null||r===void 0?void 0:r.width)!==null&&o!==void 0?o:"auto",height:(a=(s=i.propsSize)===null||s===void 0?void 0:s.height)!==null&&a!==void 0?a:"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},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}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||m8},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=a}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(i){var l;if(typeof n.state[i]>"u"||n.state[i]==="auto")return"auto";if(n.propsSize&&n.propsSize[i]&&(!((l=n.propsSize[i])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[i].toString().endsWith("%"))return n.state[i].toString();var u=n.getParentSize(),d=Number(n.state[i].toString().replace("px","")),f=d/u[i]*100;return f+"%"}return Qp(n.state[i])},s=r&&typeof r.width<"u"&&!this.state.isResizing?Qp(r.width):o("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?Qp(r.height):o("height");return{width:s,height:a}},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 r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},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,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,a=o&&Na("left",s),i=o&&Na("top",s),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=a?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=i?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=i?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=i?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)&&(r=r&&r<u?r:u),{maxWidth:n,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(n,r){var o=this.props.scale||1,s=y8(this.props.resizeRatio||1),a=s[0],i=s[1],l=this.state,u=l.direction,d=l.original,f=this.props,p=f.lockAspectRatio,g=f.lockAspectRatioExtraHeight,m=f.lockAspectRatioExtraWidth,v=d.width,b=d.height,w=g||0,y=m||0;return Na("right",u)&&(v=d.width+(n-d.x)*a/o,p&&(b=(v-y)/this.ratio+w)),Na("left",u)&&(v=d.width-(n-d.x)*a/o,p&&(b=(v-y)/this.ratio+w)),Na("bottom",u)&&(b=d.height+(r-d.y)*i/o,p&&(v=(b-w)*this.ratio+y)),Na("top",u)&&(b=d.height-(r-d.y)*i/o,p&&(v=(b-w)*this.ratio+y)),{newWidth:v,newHeight:b}},t.prototype.calculateNewSizeFromAspectRatio=function(n,r,o,s){var a=this.props,i=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,u=a.lockAspectRatioExtraWidth,d=typeof s.width>"u"?10:s.width,f=typeof o.width>"u"||o.width<0?n:o.width,p=typeof s.height>"u"?10:s.height,g=typeof o.height>"u"||o.height<0?r:o.height,m=l||0,v=u||0;if(i){var b=(p-m)*this.ratio+v,w=(g-m)*this.ratio+v,y=(d-v)/this.ratio+m,S=(f-v)/this.ratio+m,C=Math.max(d,b),x=Math.min(f,w),E=Math.max(p,y),T=Math.min(g,S);n=cu(n,C,x),r=cu(r,E,T)}else n=cu(n,d,f),r=cu(r,p,g);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var o=r.getBoundingClientRect();this.parentLeft=o.left*n,this.parentTop=o.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*n,this.targetTop=s.top*n}if(this.resizable){var a=this.resizable.getBoundingClientRect(),i=a.left,l=a.top,u=a.right,d=a.bottom;this.resizableLeft=i*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&v8(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&uu(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var a=this.props.onResizeStart(n,r,this.resizable);if(a===!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 i,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",i=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var f={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:qr(qr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:i};this.setState(f)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&uu(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,a=o.maxHeight,i=o.minWidth,l=o.minHeight,u=uu(n)?n.touches[0].clientX:n.clientX,d=uu(n)?n.touches[0].clientY:n.clientY,f=this.state,p=f.direction,g=f.original,m=f.width,v=f.height,b=this.getParentSize(),w=b8(b,this.window.innerWidth,this.window.innerHeight,s,a,i,l);s=w.maxWidth,a=w.maxHeight,i=w.minWidth,l=w.minHeight;var y=this.calculateNewSizeFromDirection(u,d),S=y.newHeight,C=y.newWidth,x=this.calculateNewMaxFromBoundary(s,a);this.props.snap&&this.props.snap.x&&(C=wy(C,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(S=wy(S,this.props.snap.y,this.props.snapGap));var E=this.calculateNewSizeFromAspectRatio(C,S,{width:x.maxWidth,height:x.maxHeight},{width:i,height:l});if(C=E.newWidth,S=E.newHeight,this.props.grid){var T=yy(C,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),_=yy(S,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),O=this.props.snapGap||0,P=O===0||Math.abs(T-C)<=O?T:C,A=O===0||Math.abs(_-S)<=O?_:S;C=P,S=A}var M={width:C-g.width,height:S-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var $=C/b.width*100;C=$+"%"}else if(m.endsWith("vw")){var j=C/this.window.innerWidth*100;C=j+"vw"}else if(m.endsWith("vh")){var L=C/this.window.innerHeight*100;C=L+"vh"}}if(v&&typeof v=="string"){if(v.endsWith("%")){var $=S/b.height*100;S=$+"%"}else if(v.endsWith("vw")){var j=S/this.window.innerWidth*100;S=j+"vw"}else if(v.endsWith("vh")){var L=S/this.window.innerHeight*100;S=L+"vh"}}var D={width:this.createSizeForCssProperty(C,"width"),height:this.createSizeForCssProperty(S,"height")};this.flexDir==="row"?D.flexBasis=D.width:this.flexDir==="column"&&(D.flexBasis=D.height);var W=this.state.width!==D.width,F=this.state.height!==D.height,k=this.state.flexBasis!==D.flexBasis,H=W||F||k;H&&Fn.flushSync(function(){r.setState(D)}),this.props.onResize&&H&&this.props.onResize(n,p,this.resizable,M)}},t.prototype.onMouseUp=function(n){var r,o,s=this.state,a=s.isResizing,i=s.direction,l=s.original;if(!(!a||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,i,this.resizable,u),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(o=this.props.size.height)!==null&&o!==void 0?o:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:qr(qr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var r,o;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(o=n.height)!==null&&o!==void 0?o:"auto"})},t.prototype.renderResizer=function(n){var r=this,o=this.props,s=o.enable,a=o.handleStyles,i=o.handleClasses,l=o.handleWrapperStyle,u=o.handleWrapperClass,d=o.handleComponent;if(!s)return null;var f=n.filter(function(p){return s[p]!==!1}).map(function(p){return s[p]!==!1?nt.createElement(h8,{key:p,direction:p,onResizeStart:r.onResizeStart,replaceStyles:a&&a[p],className:i&&i[p]},d&&d[p]?d[p]:null):null});return nt.createElement("div",{className:u,style:l},f)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,i){return w8.indexOf(i)!==-1||(a[i]=n.props[i]),a},{}),o=qr(qr(qr({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&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return nt.createElement(s,qr({style:o,className:this.props.className},r,{ref:function(a){a&&(n.resizable=a)}}),this.state.isResizing&&nt.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}(nt.PureComponent);function fu({className:e,children:t,top:n,bottom:r,right:o,left:s,width:a,height:i,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,onResize:g,onResizeStop:m,...v}){const b={top:n||!1,right:o||!1,bottom:r||!1,left:s||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},w={width:a||"auto",height:i||"auto"},y=N("gs-utl-z-10",z.hBgAct),S={top:y,bottom:y,right:y,left:y},C={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(S8,{className:e,enable:v.enable??b,defaultSize:w,handleStyles:C,handleClasses:S,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,children:t})}const Rp="gs-cmp-accordion",eh=`${Rp}-handler`,pu=`${eh}__content`,C8=`${Rp}-content`;function mo({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:r,style:o,handler:s,handlerIcon:a,children:i,inverted:l,disabled:u,sticky:d,onChange:f,open:p}){return c.jsx(Zd,{as:"div",defaultOpen:p,className:Z(Rp,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(Zd.Button,{as:u?"div":"button",disabled:u,style:o,onClick:m=>f==null?void 0:f({event:m,open:!g}),className:({open:m})=>N(eh,et(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(I,{items:"center",className:Z("gap-2"),full:!0,children:[c.jsx(B,{className:Z(pu,r,"text-left"),grow:!0,children:et(s)?s(m):c.jsxs(I,{items:"center",className:Z(`${pu}-wrp`,"gap-3"),nowrap:!0,children:[!!a&&c.jsx(ne,{className:Z(`${pu}-icon`),icon:a,size:se.s2x}),c.jsx(B,{className:Z(`${pu}-label gs-utl-w-full`),children:s})]})}),c.jsx(B,{className:Z(`${eh}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(ne,{icon:q.chevronDown,className:Z("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(Zd.Panel,{className:Z(C8,n),children:i})]})})}const nl="gs-studio-panel",Cy=(e,t={})=>({...t,...e===!0?{}:e||void 0}),Cr=h.memo(function({children:t,header:n,resizable:r,className:o,classNameAccordion:s,classNameAccordionContent:a,...i}){const l=c.jsx(Cn,{className:N(nl,o),...i,children:t}),u=r?r===!0?{top:!0,right:!0,bottom:!0,left:!0}:r:void 0,d=u?c.jsx(fu,{className:N([`${nl}__resizer`]),...u,children:l}):l,f=n===!0?{collapsible:!0}:n||void 0;return f?c.jsx(mo,{classNameWrap:N(`${nl}__accordion`,s),className:N(`${nl}__accordion-header`,Te.xy,f.className),classNameContent:N(`${nl}__accordion-content`,a),disabled:f.collapsible===!1,style:f.style,handler:c.jsxs(I,{space:"s",items:"center",children:[!!f.icon&&c.jsx(ne,{icon:f.icon,size:se.s}),c.jsx(B,{grow:!0,children:f.label})]}),open:n?f.collapsed!==!0:!0,children:d}):d}),x8="gs-panel-assets",E8=h.memo(ce(function({className:t,onSelect:n,content:r,assets:o,types:s,providers:a,typeId:i,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:f,layoutAfterHeader:p,...g}){var x;const m=we(),v=_i(),b=m.editor,w=(x=m.sdkOptions.assets)==null?void 0:x.layoutAfterHeader,y=p||w,[S]=h.useState(()=>g.id||zm());return h.useEffect(()=>(v.createAssetManager(S),()=>{v.removeAssetManager(S)}),[S]),wv(S)?c.jsx(Cr,{className:N(x8,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...g,children:b&&c.jsx(d8,{panelId:S,assets:o,types:s,providers:a,onSelect:n,typeId:i,providerId:l,content:r,optionalType:u,optionalProvider:f??d,layoutAfterHeader:y})}):null}));var rl=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(rl||{}),Kr=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Kr||{});const xy="gs-block-item",Ey=ce(e=>{const{block:t,className:n,itemLayout:r,onClick:o,variant:s}=e,{editor:a}=we(),i=Ie(),[,l]=h.useState(0),u=i.tScoped("blockManager.labels"),d=t.getId(),f=!!t.get("full"),p=o||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),v=t.getMedia(),b=t.get("attributes")||{},w=u(d)||t.getLabel(),y=s==="compact",S=N(xy,`${xy}--${d}`,n,"gs-utl-px-2 gs-utl-transition-colors",te.b,te.rnd,z.br,f&&"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?Pe.disabledM:N("gs-utl-cursor-pointer",z.hTAo,z.hBgH)),C=Ht(b.class)&&!y?b.class:N("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"),x=N("gs-utl-text-center",Pe.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!a)return;const{Blocks:A}=a,M=A.events.update,$=j=>j===t&&l(L=>++L);return a.on(M,$),()=>{a.off(M,$)}},[t,a]),!a)return null;const{Blocks:E}=a,O={className:S,...!g&&{onDragStart:()=>E.startDrag(t),onDragEnd:()=>E.endDrag(!1),draggable:!o},...!!p&&{onClick:()=>p(t,a)}},P=r==null?void 0:r({editor:a,block:t,attributes:O});return P&&$t(P)||c.jsxs(I,{items:"center",...O,children:[m||c.jsx("div",{className:C,dangerouslySetInnerHTML:{__html:v}}),c.jsx("div",{className:x,title:w,children:w})]})});function th({className:e,value:t,onChange:n}){const[r,o]=h.useState(t),s=h.useRef(null),a=u=>{const{value:d}=u.target;o(d)},i=()=>{n(r||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(r||t);break}};return h.useEffect(()=>{s.current&&s.current.select()},[]),c.jsx("input",{autoFocus:!0,className:Z([e,"w-full",z.bgTr]),value:r,onChange:a,onBlur:i,onKeyDown:l,onPointerDown:ps,ref:s})}function Ty({className:e,value:t,active:n,unstyled:r,activable:o,onChange:s,onActive:a,...i}){const[l,u]=h.useState(n);h.useEffect(()=>{u(n)},[n]);const d=p=>{a==null||a(p),u(p)},f=p=>{s(p),d(!1)};return c.jsx("div",{className:Z("truncate",e),...i,onDoubleClick:()=>o&&d(!0),children:l?c.jsx(th,{className:Z(r&&Pe.noFocusOut),value:t,onChange:f}):c.jsx(c.Fragment,{children:t})})}const Py=ae("text-sm w-full",Pe.txtEllips),T8=ce(({symbol:e,className:t})=>{const n=Di(),{Components:r}=n,o=Ie(),s=Ca(),a=o.tScoped("blockManager.symbols"),i=()=>{const{draggable:w,droppable:y,attributes:S,type:C,tagName:x}=e.attributes;n.Canvas.startDrag({content:()=>r.addSymbol(e),model:e,dragDef:{type:C,tagName:x,draggable:w,droppable:y,attributes:S}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),f=r.getSymbolInfo(e).instances.length,p=ae("h-10 w-10 block-media",z.grouphTAo),g=ae("gjs-pt-1 gjs-mt-2",te.bt,z.br),m=ae("cursor-pointer gjs-p-2 transition-colors group",te.b,te.rnd,z.br,z.hBgH,t),v=()=>{s.confirm({title:a("delete"),content:a("deleteConfirm"),onConfirm:()=>e.remove()})},b=w=>{e.set("custom-name",w)};return c.jsxs(I,{className:m,onDragStart:i,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:p,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(I,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(B,{children:c.jsx(I,{className:ae(Py,"gjs-mr-auto"),children:c.jsx(Wt,{title:`${f} ${a("instancesProject")}`,children:c.jsx(Ko,{label:`${f}`,className:ae(z.bgH75)})})})}),c.jsx(B,{className:ae("truncate"),grow:!0,title:d,children:c.jsx(Ty,{activable:!0,value:d,className:Py,onChange:b})}),c.jsx(B,{className:ae(Pe.hoverGroup),children:c.jsx(I,{justify:"end",full:!0,children:c.jsx(Ct,{onClick:v,title:a("delete"),border:!1,size:"",block:!0,children:c.jsx(ne,{icon:q.delete,size:se.s})})})})]})]})}),ts="gs-block-manager",Oy={id:Kr.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>'},P8={id:Kr.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>'},O8={id:Kr.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>'},_y={id:Kr.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>'},Ay=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},Ly=e=>{const t=e.getContent();return et(t)?e.getDragDef():t},_8=e=>{const t=Ly(e);return Array.isArray(t)?t[0]:t},A8=ce(function({isOpen:t,className:n,hideCategories:r,target:o,variant:s,itemLayout:a,...i}){var Ue,en;const{editor:l}=we(),u=Ie(),[d,f]=h.useState(0),[p,g]=h.useState(rl.REGULAR),[m,v]=h.useState(""),[b,w]=h.useState(""),y=h.useRef(new Set),[S,C]=h.useState((o==null?void 0:o.position)||Kr.after),[x,E]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),T=p===rl.SYMBOLS,_=h.useRef(null),O=u.tScoped("blockManager"),P=o==null?void 0:o.component;if(h.useEffect(()=>{if(!l)return;const{Blocks:he,Components:De}=l,Fe=he.events.custom,He=De.events.symbol,Mt=()=>{E(De.getSymbols()),f(Gt=>++Gt)};return l.on(He,Mt),l.on(Fe,Mt),()=>{l.off(He,Mt),l.off(Fe,Mt)}},[l]),h.useEffect(()=>{if(_.current&&t){const he=_.current.querySelector("input");setTimeout(()=>he==null?void 0:he.focus(),Cd)}},[_.current,t]),!l)return null;const{Blocks:A,Components:M}=l,$=he=>O(`labels.${he.getId()}`)||he.getLabel(),j=x.filter(he=>Zs(he.getName(),m)),L=A.getAll().map(he=>he),D=((Ue=i.blocks)==null?void 0:Ue.call(i,{blocks:L}))||L,W=S===Kr.before,F=S===Kr.beforeInside,k=S===Kr.afterInside,H=S===Kr.after,V=!!(P!=null&&P.attributes.droppable),U=D.filter(he=>{const De=Ay(l,he.category);if(m&&!Zs(De,m)&&!Zs($(he),m))return!1;if(P){const Fe=_8(he);if(V&&(F||k)){const He=F?0:void 0;return M.canMove(P,Fe,He).result}else if(W||H){const He=P.index(),Mt=P.parent(),Gt=W?He:He+1;return Mt&&M.canMove(Mt,Fe,Gt).result}}return!0}),J=A.getBlocksByCategory(U),Y=r?U:(en=J.find(he=>!he.category))==null?void 0:en.items,X=r?[]:J.filter(he=>he.category),Q=i.symbols!==!1,ee=i.search!==!1,G=!Q&&!ee,R=s==="compact",le=O("search")||u.t("search"),ge=N(ts,n,"gap-2"),Ee=N(`${ts}__header`,"gs-utl-pt-2",Te.xS,G&&"gs-utl-hidden"),Ce=N(`${ts}__content`,Pe.scrollY,z.br,te.bt),tt=N(`${ts}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Qe=N(`${ts}__not-found`,"gs-utl-text-center gs-utl-p-4"),Ot=N(`${ts}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",R?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),ut=N(`${ts}__no-category`,Ot,z.br,X.length&&te.bb),Se=N(z.tAo,z.bgH75,te.bA),ot=`${ts}__category`,st=[{id:rl.REGULAR,label:O("types.regular")},{id:rl.SYMBOLS,label:O("types.symbols")}],wt=V?[Oy,P8,O8,_y]:[Oy,_y],Ne=P?he=>{const De=Ly(he);if(!De)return;let Fe;if(F||k){const He=F?0:void 0;Fe=P.append(De,{at:He})[0]}else if(W||H){const He=P.index(),Mt=P.parent(),Gt=W?He:He+1;Fe=Mt==null?void 0:Mt.append(De,{at:Gt})[0]}if(Fe){const{activate:He,select:Mt}=he.attributes;Mt||He&&Mt!==!1?l.em.setSelected(Fe,{activate:He}):He&&Fe.trigger("active")}}:void 0,mt=he=>{if(!P)return;const De=Array.from(y.current);if(he.key==="ArrowDown")he.preventDefault(),w(Fe=>{const He=De.indexOf(Fe);return De.at(Math.min(He+1,De.length-1))||""});else if(he.key==="ArrowUp")he.preventDefault(),w(Fe=>{const He=De.indexOf(Fe);return De.at(Math.max(He-1,0))||""});else if(he.key==="Enter"&&b){const Fe=A.get(b);Fe&&(Ne==null||Ne(Fe))}},dt=he=>{y.current.clear(),v(he)};return c.jsxs(I,{className:ge,col:!0,full:!0,children:[c.jsxs(I,{className:Ee,gap:"s",col:!0,children:[Q&&c.jsx(Zo,{tabs:st,onChange:g,value:p,variant:"pills"}),P&&c.jsx(Qt,{size:"s",options:wt,value:S,onChange:he=>C(he)}),ee&&c.jsx(rt,{ref:_,size:"s",value:m,onInput:dt,onKeyDown:mt,placeholder:le,type:"search"})]}),c.jsxs(B,{className:Ce,grow:!0,children:[T&&(j.length?c.jsx(I,{className:tt,children:j.map(he=>c.jsx(T8,{symbol:he},`${d}_${he.getId()}`))}):c.jsx(I,{className:Qe,justify:"center",children:O("symbols.notFound")})),!T&&(U.length?c.jsxs(c.Fragment,{children:[!!(Y!=null&&Y.length)&&c.jsx(I,{className:ut,children:Y==null?void 0:Y.map(he=>(y.current.add(`${he.id}`),c.jsx(Ey,{block:he,itemLayout:a,onClick:Ne,variant:s,className:N(b===he.id&&Se)},he.id)))}),X.map(({category:he,items:De},Fe)=>c.jsx(mo,{sticky:!0,className:He=>Ed.itemList({index:Fe,open:He,length:X.length}),open:!!(he!=null&&he.get("open")),onChange:({open:He})=>he==null?void 0:he.set({open:He}),handler:Ay(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:N(ot,`${ot}--${he==null?void 0:he.id}`),children:c.jsx(I,{className:Ot,children:De.map(He=>(y.current.add(`${He.id}`),c.jsx(Ey,{block:He,itemLayout:a,onClick:Ne,variant:s,className:N(b===He.id&&Se)},He.id)))})},he==null?void 0:he.id))]}):c.jsx(I,{className:Qe,justify:"center",children:O("notFound")}))]})]})}),L8=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-after"),n),ref:o,...r,children:t})}),M8=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-before"),n),ref:o,...r,children:t})}),N8="gs-panel-blocks",$8=h.memo(ce(function({className:t,symbols:n,search:r,hideCategories:o,target:s,variant:a,blocks:i,itemLayout:l,...u}){const d=we().sdkProps.children,f={search:r,symbols:n,hideCategories:o,isOpen:!0,target:s,variant:a,blocks:i,itemLayout:l};return c.jsx(Cr,{className:N(N8,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(Fi,{children:[Xn(d,M8),c.jsx(A8,{className:N("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...f}),Xn(d,L8)]})})})),k8="gs-cmp-color-picker",I8={backgroundSize:"10px"},V8=[0,15];function My({className:e,value:t,onChange:n,disabled:r}){const[o,s]=h.useState(!1),a=N(`${k8}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,te.b,te.rnd,z.br),i=()=>{s(!1)},l=c.jsxs("div",{style:I8,className:a,children:[o&&c.jsx("div",{onPointerUp:i,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(wr,{handler:l,title:"Color",size:"s",placement:"left-end",offset:V8,clickAway:!0,disabled:r,children:c.jsx(oy,{value:t,onChange:n,disabled:r})})}const H8="gs-cmp-color-field";function vo(e){const{className:t,value:n,placeholder:r,preventSubmitOnEnter:o=!1,onChange:s,labelAs:a,disabled:i}=e,[l,u]=h.useState($c(n)),d=ji(e);h.useEffect(()=>{u($c(n))},[n]);const f=(v,b)=>{s==null||s(v,b)},p=v=>{switch(v.key){case"Escape":return u(n);case"Enter":f(l),o&&(v.preventDefault(),v.stopPropagation())}},g=()=>{f(l)},m=Go({...e,className:N(H8,t)});return c.jsxs("div",{...m,children:[c.jsx(br,{...e,as:a}),c.jsxs(I,{className:tp(e),items:"center",space:"s",children:[c.jsx(B,{children:c.jsx(My,{value:n,onChange:s,disabled:i})}),c.jsx(B,{grow:!0,children:c.jsx("input",{className:N(d,i&&"gs-utl-pointer-events-none"),value:l,onChange:v=>u(v.target.value),placeholder:r,onBlur:g,onKeyDown:p,disabled:i})})]})]})}const j8=(e,t)=>{t.runCommand(re.fontAdd,{font:e})},nh=(e,{onSelect:t,...n}={})=>{const r="font",a=e.runCommand(re.assetProviderGet).filter(i=>ct(i.types)?i.types===r:i.types.includes(r))[0];if(!a){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:r,providerId:a.id,onSelect:i=>{const l=i.assetProps;j8(l.customData.font,e),t==null||t(i)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},hu=ce(e=>{const{buttonClassName:t,value:n,...r}=e,{editor:o}=we(),s=Ie(),a=_i(),i=Ai(),l=[...r.options||[],...i.fontFamilyOptions].map(u=>{const d=i.getFont(u.id),f=d?kf(d):u.id;return{...u,content:c.jsx(I,{col:!0,children:c.jsx(B,{style:{fontFamily:f},children:u.label})})}});return c.jsx(Le,{...r,value:$s(n),options:l,afterLabel:i.sdkAddFonts&&a.hasType("font")&&c.jsx(Ct,{className:t,title:s.t("fontManager.addFontToProject"),icon:q.plus,size:"xs",border:!1,block:!0,onClick:()=>o&&nh(o,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;r.onChange($s(d.family))}})})})}),D8=(e,{t,id:n})=>t(`fields.${n}.label`)||Pr(`${e}`.replace(/-/g," ")),Ny=(e,{t,id:n})=>{const r=ct(e)?{id:e,label:e}:e;return{...r,label:t(`fields.${n}.options.${r.id}`)||r.label}},$y=e=>e.get("defaultValue")||"",ol=e=>e.get("field"),ky=e=>{const t=ol(e);return ct(t)?{type:t}:t},Iy=e=>`${e.get("value")||$y(e)||ky(e).defaultValue||""}`,F8=(e,t)=>e||$y(t)||"",sl=({record:e,value:t,partial:n})=>{e.set({value:F8(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},al=(e,t)=>{const{className:n,defaultValue:r,size:o,...s}=ky(e),a=r??e.get("defaultValue");return{...s,hasClear:()=>{const i=e.get("value");return!!i&&Ht(a)&&i!==a},className:N(n,"gs-utl-w-full"),size:o||"s",value:Iy(e),label:D8(e.get("label")||e.id||"",t),onChange:(i,l)=>sl({record:e,value:i,partial:l})}},B8=(e,t)=>{const n=ol(e),r=Rr(n)?n:void 0,o=(r==null?void 0:r.units)||[],s=S6(Iy(e)),a=s.number,i=s.unit||o[0]||"";return{...al(e,t),value:a,valueUnit:i,min:r==null?void 0:r.min,max:r==null?void 0:r.max,step:r==null?void 0:r.step,units:r==null?void 0:r.units,onChange:(l,u)=>{sl({value:l?`${l}${i}`:"",record:e,partial:u})},onChangeUnit:l=>{sl({value:a?`${a}${l}`:"",record:e})}}},Vy=(e,t)=>{var s;const n=ol(e),r=Rr(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Ny(a,t)))||[];return{...al(e,t),options:o,onChange:a=>sl({value:a,record:e})}},z8=(e,t)=>({...al(e,t),onChange:n=>sl({value:n,record:e})}),U8=(e,t)=>{var s;const n=ol(e),r=Rr(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Ny(a,t)))||[];return{...Vy(e,t),size:"s",options:o}};function W8(e,t){const n=ol(e);switch(ct(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(Qt,{...U8(e,t)});case"select":return c.jsx(Le,{...Vy(e,t)});case"selectFont":{const o=z8(e,t);return c.jsx(hu,{...o,labelAs:"div"})}case"number":return c.jsx($e,{...B8(e,t)});case"color":return c.jsx(vo,{...al(e,t)});default:return c.jsx(rt,{...al(e,t)})}}const Hy="gs-cmp-global-style-field",G8=ce(function({record:t}){const n=we(),o=Ie().tScoped("globalStyleManager"),[,s]=h.useState(0),a=n.editor,i=t.id,l={t:o,id:i};return h.useEffect(()=>{if(!a)return;const u=`data:path:${t.getPath("value")}`,d=()=>s(f=>++f);return a.on(u,d),()=>{a.off(u,d)}},[a]),c.jsx(I,{className:N(Hy,`${Hy}__${i}`),children:W8(t,l)})}),il="gs-cmp-global-style-manager",jy=({items:e,category:t,className:n})=>{const r=N(t?`${il}__cat-fields--${t.id}`:`${il}__uncat-fields`,"gs-utl-gap-2",Te.xy,n);return c.jsx(I,{className:r,nowrap:!0,col:!0,children:e.map(o=>c.jsx(G8,{record:o},o.id))})},q8=ce(function(){const t=dL(),{recordsByCategory:n,openCategories:r}=t,s=Ie().tScoped("globalStyleManager");return c.jsx(I,{col:!0,full:!0,nowrap:!0,className:N(il,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(I,{col:!0,nowrap:!0,className:N(`${il}__fields`,Pe.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:a,items:i},l)=>a?c.jsx(mo,{sticky:!0,open:r.get(a.id)??a.open,handler:s(`categories.${a.id}.label`)||a.label||a.id,onChange:({open:u})=>t.setCategoryOpen(a.id,u),className:u=>N(`${il}__cat-fields`,Ed.itemList({index:l,open:u,length:n.length}),l===0&&te.bt),children:c.jsx(jy,{category:a,items:i})},a.id):c.jsx(jy,{items:i,className:N(n.length!==1&&[te.bt,z.br])},l)):c.jsx(I,{className:N("gs-utl-text-center"),justify:"center",children:s("notFound")})})})}),K8="gs-panel-global-styles",Z8=h.memo(ce(function({className:t,...n}){return c.jsx(Cr,{className:N(K8,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Fi,{children:c.jsx(q8,{})})})})),Y8={maxWidth:`${KS}px`},X8="gs-cmp-layer-item";function Dy({component:e,draggingCmp:t,dragParent:n,...r}){const o=Di(),{Layers:s}=o,a=h.useRef(null),[i,l]=h.useState(!1),[u,d]=h.useState(s.getLayerData(e)),{open:f,selected:p,hovered:g,components:m,visible:v,locked:b,name:w}=u,y=m.map(F=>F.cid),S=t===e,C=y.join("-"),x=r.level+1,E=g||n===e;h.useEffect(()=>{x===0&&d(s.getLayerData(e)),a.current&&(a.current.__cmp=e)},[e]),h.useEffect(()=>{const F=a.current;if(!F)return;const{select:k}=o.Components.events,H=V=>V===e&&F.scrollIntoView({block:"nearest"});return o.on(k,H),()=>{o.off(k,H)}},[e,a.current]),h.useEffect(()=>{const F=H=>{H===e&&d(s.getLayerData(H))},k=s.events.component;return o.on(k,F),()=>{o.off(k,F)}},[o,s,e]);const T=h.useMemo(()=>m.map(F=>c.jsx(Dy,{component:F,level:x,draggingCmp:t,dragParent:n},F.cid)),[C,t,n]),_=F=>{s.setLayerData(e,{name:F}),l(!1)},O=F=>{F.stopPropagation(),s.setLayerData(e,{open:!f})},P=F=>{F.stopPropagation(),s.setLayerData(e,{visible:!v})},A=F=>{F.stopPropagation(),s.setLayerData(e,{locked:!b})},M=F=>{F.stopPropagation(),s.setLayerData(e,{selected:!0},{event:F})},$=F=>{F.preventDefault(),o.runCommand(re.contextMenuComponent,{source:Nf.layers,component:e,event:F.nativeEvent,x:F.clientX,y:F.clientY})},j=F=>{(!F||!t)&&s.setLayerData(e,{hovered:F})},L=P1(e),D=Z("layer-item",(p||L.isSymbol)&&L.bgSoftX,(!v||S)&&"opacity-50"),W=Z(Te.xyS,te.b,E?L.border:te.bT,p&&L.bgSoft);return c.jsx("div",{className:X8,children:c.jsxs(I,{col:!0,className:D,children:[c.jsx(B,{onClick:M,onContextMenu:$,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),className:Z("group max-w-full"),"data-layer-item":!0,ref:a,children:c.jsxs(I,{items:"center",space:"xs",className:W,children:[c.jsx(B,{style:{marginLeft:`${x*10}px`},className:Z("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:O,children:c.jsx(ne,{icon:q.menuDown,size:se.sx,rotate:f?0:-90})}),c.jsx(B,{children:lv(e)}),c.jsx(B,{className:Z("truncate"),onDoubleClick:()=>l(!0),style:Y8,grow:!0,children:i?c.jsx(th,{value:w,onChange:_}):c.jsx(c.Fragment,{children:w})}),!i&&c.jsxs(c.Fragment,{children:[c.jsx(B,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-100":"opacity-0"),onClick:A,children:c.jsx(ne,{icon:b?q.lock:q.lockOpenVariant,size:se.s3x})}),c.jsx(B,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-0":"opacity-100"),onClick:P,children:c.jsx(ne,{icon:v?q.eyeOutline:q.eyeOffOutline,size:se.sx})})]})]})}),!!(f&&m.length)&&c.jsx(B,{className:Z("max-w-full",!f&&"hidden"),children:T})]})})}const J8={touchAction:"none"},Fy=5,Q8=e=>{var s,a;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),r=n==null?void 0:n.__cmp,o=((a=(s=r==null?void 0:r.delegate)==null?void 0:s.move)==null?void 0:a.call(s,r))||r;return{el:n,cmp:o}},By=ce(function({root:t,header:n}){const{editor:r}=we(),[o,s]=h.useState(!1),[a,i]=h.useState({}),[l,u]=h.useState(),[d,f]=h.useState(),[p,g]=h.useState(),[m,v]=h.useState(),b=h.useRef(null);if(h.useEffect(()=>{const O=window.document,P=A=>{A.key==="Escape"&&(i({...a,result:!1}),C())};return O.addEventListener("keydown",P),()=>{O.removeEventListener("keydown",P)}},[]),!r)return null;const{Components:w}=r,y=O=>{O.button===0&&s(!0)},S=O=>{if(!o)return;const{cmp:P,el:A}=Q8(O);if(!A||!P)return;const M=A.getBoundingClientRect(),$=A.offsetHeight,j=A.offsetTop,L=O.clientY,D=L<M.y+$/2,W=d||P,F=P.parent(),k=P.index()+(D?0:1);!d&&f(P),u(P);const H=w.canMove(F,W,k),V=w.canMove(P,W),U={...H,canMoveInside:V,index:k};let J=!1;V.result&&L>M.y+Fy&&L<M.y+$-Fy&&(J=!0,U.target=P,delete U.index),g(J?P:void 0),i(U),v({pointerInside:J,y:j+(D?0:$),h:$})},C=()=>{var O;a!=null&&a.result&&((O=a.source)==null||O.move(a.target,{at:a.index})),i({}),s(!1),f(void 0),u(void 0),g(void 0),v(void 0)},x=(l?l.parents():[]).length,E=!!(d&&m&&(a!=null&&a.result)&&!m.pointerInside),T=E?{top:m.y,left:0,marginLeft:x*10+20}:{},_=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(I,{col:!0,full:!0,nowrap:!0,className:Z("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(B,{children:c.jsxs(I,{space:"s",items:"center",className:Z([Te.xy,te.bb,z.br]),children:[c.jsx(B,{children:c.jsx(ne,{icon:q.layers,size:se.s})}),c.jsx(B,{grow:!0,children:_})]})}),c.jsxs(B,{className:Z("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:J8,onPointerDown:y,onPointerMove:S,onPointerUp:C,grow:!0,children:[!!t&&c.jsx(Dy,{component:t,level:-1,draggingCmp:d,dragParent:p}),E&&c.jsx("div",{ref:b,className:Z("absolute w-full gs-utl-h-0.5",z.cmp),style:T})]})]})}),zy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-after"),n),ref:o,...r,children:t})}),Uy=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-before"),n),ref:o,...r,children:t})}),R8="gs-panel-layers",Wy=h.memo(ce(function({className:t,...n}){const r=we().sdkProps.children;return c.jsx(Cr,{className:N(R8,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Pb,{children:o=>c.jsxs(c.Fragment,{children:[Xn(r,Uy),c.jsx(By,{...o,header:!1}),Xn(r,zy)]})})})})),zs="gs-cmp-file-field";function ll(e){var x;const{className:t,value:n,btnLabel:r,nameLabel:o,size:s,isContain:a,clear:i,inputField:l,placeholder:u,preview:d=50,disabled:f,hideButton:p,labelAs:g,onChange:m,onOpen:v}=e,b=(n||"").replace(/^"|"$/gi,""),w=((x=b.split("/").pop())==null?void 0:x.split("?")[0])||"",y={minWidth:d,minHeight:d},S=b?{...y,backgroundImage:`url("${b}")`}:y,C=N(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",a?"gs-utl-bg-contain":"gs-utl-bg-cover",te.b,te.rnd,z.br);return c.jsxs(I,{className:N(zs,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(br,{...e,as:g}),c.jsxs(I,{className:N(`${zs}-content gs-utl-gap-1`,z.bg),items:"center",nowrap:!0,children:[c.jsx(B,{className:N(`${zs}-preview`),children:c.jsx("div",{className:C,style:S})}),c.jsxs(B,{className:N(`${zs}-fields gs-utl-overflow-hidden`),grow:!0,children:[w&&o!==!1&&c.jsx(Wo,{className:N(`${zs}-name`,"gs-utl-mb-2",Pe.txtEllips),as:"div",size:s,capitalize:!1,children:w}),c.jsxs(I,{className:N(`${zs}-buttons`),space:"s",nowrap:!0,children:[!p&&c.jsx(Ke,{onClick:()=>v==null?void 0:v(n),size:s,type:"button",block:!0,full:!0,disabled:f,children:r||"Select image"}),!!n&&i&&c.jsx(Ct,{onClick:()=>m==null?void 0:m(""),title:i.tooltip,size:s,icon:{icon:q.close,size:se.s},type:"button",block:!0})]})]})]}),l&&c.jsx(rt,{className:N(`${zs}-input`),value:b,onChange:m,size:s,placeholder:u})]})}function eI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const gu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $a(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function rh(e){return"nodeType"in e}function ns(e){var t,n;return e?$a(e)?e:rh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function oh(e){const{Document:t}=ns(e);return e instanceof t}function ka(e){return $a(e)?!1:e instanceof ns(e).HTMLElement}function Gy(e){return e instanceof ns(e).SVGElement}function Ia(e){return e?$a(e)?e.document:rh(e)?oh(e)?e:ka(e)||Gy(e)?e.ownerDocument:document:document:document}const Us=gu?h.useLayoutEffect:h.useEffect;function tI(e){const t=h.useRef(e);return Us(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function nI(){const e=h.useRef(null),t=h.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function cl(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function sh(e){const t=tI(e),n=h.useRef(null),r=h.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}let ah={};function ul(e,t){return h.useMemo(()=>{if(t)return t;const n=ah[e]==null?0:ah[e]+1;return ah[e]=n,e+"-"+n},[e,t])}function qy(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const i=Object.entries(a);for(const[l,u]of i){const d=s[l];d!=null&&(s[l]=d+e*u)}return s},{...t})}}const dl=qy(1),Ky=qy(-1);function rI(e){return"clientX"in e&&"clientY"in e}function oI(e){if(!e)return!1;const{KeyboardEvent:t}=ns(e.target);return t&&e instanceof t}function sI(e){if(!e)return!1;const{TouchEvent:t}=ns(e.target);return t&&e instanceof t}function ih(e){if(sI(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 rI(e)?{x:e.clientX,y:e.clientY}:null}const fl=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[fl.Translate.toString(e),fl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),aI={display:"none"};function iI(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:aI},n)}function lI(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={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:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function cI(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const uI={draggable:`
321
+ `})};function tu({children:e,text:t,onConfirm:n,onCancel:r,className:o="w-[200px]",confirmButtonProps:s={},...a}){const i=Ie();return c.jsx(Cr,{...a,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(I,{className:Z(o),space:"m",col:!0,children:[c.jsx(B,{grow:!0,className:Z("text-center"),children:t||i.t("confirmAction")}),c.jsxs(I,{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()},...s,children:s.children||i.t("confirm")}),c.jsx(Ke,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),r==null||r()},children:i.t("cancel")})]})]})})}const V0=new Map,H0=new Map,S$=async({html:e="",el:t})=>{const n=e,r={};if(document.body.attachShadow){const o=t.shadowRoot||t.attachShadow({mode:"open"});o.innerHTML=n}return r},C$=ce(function({template:t,projectType:n,skipProjectNamePopover:r,className:o,onSelect:s,onRemove:a}){var T;const i=Ie(),l=we(),u=l.editor,[d,p]=h.useState(""),f=h.useRef(null),g=i.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((T=t.data.custom)==null?void 0:T.id),v=n===xt.web,b=!t.isTemplate||r,w=()=>{b&&(s==null||s({editor:u,template:t,loadTemplate:y}))},y=l.setProject,S=_=>{_.preventDefault(),s({editor:u,template:t,loadTemplate:y})};h.useEffect(()=>{const O=setTimeout(async()=>{if(!f.current||!u)return;const P=`${t.isTemplate?"t-":""}${t.id}`;let A=V0.get(P);if(!A){let k=H0.get(n);if(!k){const j=new vH({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});k=await w$(u.config.grapesjs,n,j.appEditorStore),H0.set(n,k)}A=k?y$(k,t.data,n):"",V0.set(P,A)}const M=f.current;S$({el:M,html:A})});return()=>clearTimeout(O)},[f,u,n,t.data]);const{media:C,author:x}=t,E=c.jsx(Ke,{className:ae("text-sm"),size:"m2",variant:"pr",onClick:w,disabled:m,children:i.t("select")});return c.jsx(Jn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,children:[c.jsxs(B,{className:ae("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ae("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:C?c.jsx("img",{src:C,alt:t.name,className:ae("max-w-full")}):c.jsx("div",{className:ae("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(Zo,{className:ae("absolute top-2 right-2",z.bgA2),label:i.t("current"),s:"s",pill:!0}),c.jsx(I,{justify:"center",items:"center",className:ae(Oe.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:b?E:c.jsx(Cr,{overlay:!0,title:!1,buttonAs:"span",handler:E,children:()=>c.jsx("form",{onSubmit:S,children:c.jsxs(I,{space:"m",col:!0,children:[c.jsx(B,{children:c.jsx(rt,{size:"s",value:d,onChange:p,placeholder:g,required:!0})}),c.jsx(B,{children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:i.t("load")})})]})})})})]}),c.jsxs(I,{className:ae("gjs-p-2 max-w-full",te.bt,z.br),col:!0,space:"s",children:[c.jsxs(I,{className:ae("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(B,{className:ae(Oe.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!x&&c.jsxs(B,{children:["by"," ",c.jsx("a",{className:ae(Lo.link),href:x.link,rel:"noreferrer",target:"_blank",children:x.name})]})]}),c.jsxs(I,{items:"center",children:[v&&c.jsxs(B,{className:ae("gjs-mr-auto"),children:[i.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&a&&c.jsx(B,{className:ae("gjs-ml-auto"),children:c.jsx(tu,{onConfirm:()=>a(t),className:"",children:c.jsx(Ct,{title:i.t("delete"),children:c.jsx(re,{icon:q.delete,size:se.sx})})})})]})]})]})})}),j0=ce(function({templates:e,projectType:t,content:n,skipProjectNamePopover:r,onSelect:o,onRemove:s}){const[a]=jp(),l=Ie().tScoped("templates"),d=we().editor,p=Lf(n==null?void 0:n.itemsPerRow),f=o??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(I,{justify:"center",children:l("notFound")}):c.jsx(eu,{data:e,listClassName:ae("grid gap-2 gjs-pr-2",p),itemContent:(g,m)=>c.jsx(C$,{template:m,projectType:t,onSelect:f,onRemove:s,skipProjectNamePopover:r},m.id)},a):c.jsx(Mo,{})})}),x$=ce(function(){var v;const t=we(),n=xv(),{filteredTemplates:r,projectSourceFilter:o,projectTypeFilter:s}=n,a=Ie(),i=xa(),{sdkOptions:l}=t,u=a.tScoped("projectManager"),d=async({loadTemplate:b,template:w})=>{b(w),i.close()},p=async b=>{n.setProjectTypeFilter(b),await n.loadAllTemplates()},f=b=>{n.removeProject(b.id),n.loadProjects()},g=h.useMemo(()=>[{id:xi.Existing,label:u("existentProjects")},{id:xi.Templates,label:u("templates")}],[a]),m=((v=l.project)==null?void 0:v.types)&&Uu();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(I,{col:!0,full:!0,space:"m",children:[m&&c.jsx(I,{items:"center",space:"m",children:c.jsx(B,{className:ae("gjs-ml-auto"),children:c.jsx(Le,{value:s,onChange:p,options:qN(),handlerSelected:b=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",b.label]})})})}),c.jsx(B,{children:c.jsx(Yo,{tabs:g,value:o,onChange:n.setProjectSourceFilter})}),c.jsx(B,{grow:!0,children:c.jsx(j0,{templates:r,projectType:xt[s],onSelect:d,onRemove:f,content:{itemsPerRow:3}})})]})}),E$=({items:e,editor:t,customItems:n})=>n===!1?[]:et(n)?n({items:e,editor:t}):n||e,D0=e=>({icon:q.plus,size:se.s,className:Z("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),F0=e=>!e.type||e.type==="button",T$="gs-cmp-topbar-left",P$=ce(function({buttons:t,className:n,style:r}){const o=we(),s=Ie(),{isOpen:a,toggleOpen:i}=h4(),l=o.editor,d=s.tScoped("blockManager")("blocks"),p=E$({items:[{id:`blocks-${d}`,tooltip:d,size:cb.s,icon:D0(a),variant:lb.primary,editorEvents:{[On.toggleBlocksPanel]:({fromEvent:f,setState:g})=>{g({icon:D0(f.isOpen)})}},onClick:()=>i()}],customItems:t,editor:l});return c.jsx(I,{gap:"s",items:"center",justify:"start",className:Z(T$,Pe.xS,n),style:r,nowrap:!0,children:p.map(({id:f,...g})=>F0(g)?c.jsx(kc,{...g},f):kt({id:f,...g}))})}),O$=[{id:xo.auto,label:"Auto"},{id:xo.dark,label:"Dark"},{id:xo.light,label:"Light"}],_$={size:"s"},Mf=".grapesjs",A$=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},L$=({actions:e,editor:t,buttons:n,sdkOptions:r})=>{const o=r.actions;return o===!1?[]:et(o)?o({actions:e,editor:t}):o||(n?et(n)?n({items:e,editor:t}):n:e)},M$="gs-cmp-topbar-right",N$=ce(function({editor:t,className:n,buttons:r,...o}){const s=we(),{theme:a,setTheme:i}=Fr(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:p,isBrowserMode:f,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:v}=s,b=xa(),w=Ie(),y=M=>w.t(`actions.${M}`),S=t.Storage.events,C=l.events,x="change:changesCount",E=(M,k)=>()=>{et(M)?M({editor:t}):l.isActive(M)?l.stop(M):l.run(M,k)},T=M=>({[`${C.runCommand}${M}`]:({setState:k})=>k({active:!0}),[`${C.stopCommand}${M}`]:({setState:k})=>k({active:!1})}),_=[{id:yr.componentOutline,icon:q.borderRadius,tooltip:y("componentOutline.title"),onClick:E("core:component-outline"),editorEvents:T("core:component-outline")},{id:yr.preview,icon:q.eye,tooltip:y("preview.title"),onClick:E("core:preview"),editorEvents:T("core:preview")},{id:yr.fullscreen,icon:q.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:E("core:fullscreen",{target:"body"}),editorEvents:T("core:fullscreen")},{id:yr.showCode,icon:q.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(ne.dialogExportCode)},{id:yr.showImportCode,icon:q.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(ne.dialogImportCode)},{id:yr.clearCanvas,icon:q.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:yr.store,tooltip:y("store.title"),onClick:async()=>!s.isSaving&&t.store(),editorEvents:{"change:changesCount":({setState:M})=>M({}),[S.startStore]:({setState:M})=>M({disabled:!0}),[S.endStore]:({setState:M})=>M({disabled:!1})},label:()=>c.jsxs("div",{className:Z("relative"),children:[c.jsx(re,{icon:q.floppy,size:se.s}),!!t.getDirtyCount()&&!s.isSaving&&c.jsx("div",{className:Z("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",z.bg),children:c.jsx("div",{className:Z(Oe.dot,z.bgW)})}),s.isSaving&&c.jsx("div",{className:Z("absolute right-0 bottom-0 gjs-rounded-full",z.bg),children:c.jsx(re,{icon:q.refresh,size:"11px",className:Z(Oe.spin)})})]})},{id:yr.undo,icon:q.arrowULeftTop,disabled:!0,onClick:E("core:undo"),editorEvents:{[x]:({setState:M})=>M({disabled:!u.hasUndo()})}},{id:yr.redo,icon:q.arrowURightTop,disabled:!0,onClick:E("core:redo"),editorEvents:{[x]:({setState:M})=>M({disabled:!u.hasRedo()})}}],O=L$({actions:_,sdkOptions:m,editor:t,buttons:r}),P=[{id:"about",label:y("about.title"),icon:q.helpCircle,action:()=>b.open({size:"m",title:y("about.title"),content:()=>c.jsx(WN,{})})},{id:"embed",label:y("embed.title"),icon:q.powerPlug,action:()=>b.open({size:"m",title:y("embed.title"),content:()=>c.jsx(GN,{})})},{id:"openProject",label:y("open.title"),icon:q.folder,action:async()=>{let M="";try{M=await(await ON({extensions:[Mf]})).text()}catch(k){return console.error(k)}s.loadProjectData(JSON.parse(M))}},{id:"saveProject",label:y("save.title"),icon:q.contentSave,action:async()=>{const M=t.getProjectData(),k=new Blob([JSON.stringify(M)]),j=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await AN(k,{fileName:`${j}${Mf}`,extensions:[Mf]})}catch(L){return console.error(L)}}},{id:"loadProject",label:y("newProject.title"),icon:q.newspaperVariantOutline,action:()=>b.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(x$,{})})},{id:"installApp",label:y(p?"installApp.installed":"installApp.title"),icon:q.applicationBracketsOutline,action:async()=>{if(p)return;d==null||d.prompt();const M=await(d==null?void 0:d.userChoice);(M==null?void 0:M.outcome)==="accepted"&&g()}},...m.customTheme?[]:[{id:"theme",label:c.jsxs(I,{items:"center",space:"m",children:[c.jsx(B,{children:"Theme"}),c.jsx(B,{children:c.jsx(Yo,{tabs:O$,onChange:M=>i(M),value:a,variant:"pills"})})]})}]].filter(({id:M})=>!((!f||!d)&&M==="installApp"||!A$(m,M))),A=(M,k)=>j=>{et(M)&&(M(j),k())};return c.jsxs(I,{space:"s",items:"center",justify:"end",className:Z(M$,Pe.xS,n),nowrap:!0,...o,children:[O.map(({id:M,...k})=>F0(k)?c.jsx(kc,{size:"s",...k},M):kt({id:M,...k})),c.jsx(B,{children:m.settingsMenu!==!1&&P.length>0&&c.jsx(Cr,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(re,{icon:q.cog,size:se.s}),buttonProps:_$,overlay:!0,children:({close:M})=>c.jsx(c.Fragment,{children:P.map(k=>c.jsx(Oa,{action:A(k.action,M),icon:k.icon,label:k.label},k.id))})})})]})});function k$({devices:e,selected:t,className:n,style:r,select:o}){const s=e.map(a=>({id:a.id,label:a.getName(),icon:a.attributes.icon}));return s.length?c.jsx(Le,{size:"xs",className:n,style:r,value:t,options:s,onChange:o}):null}const $$="gs-devices",B0=h.memo(function({className:t,style:n}){return c.jsx(lN,{children:r=>c.jsx(k$,{className:N($$,t),style:n,...r})})}),Qi="gs-cmp-editor-topbar",I$=ce(function({className:t,height:n,style:r,children:o,leftContainer:s,rightContainer:a,devices:i}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:p}=we(),f=n??l,g=h.useMemo(()=>({...r,minHeight:f,marginTop:u||!p?`-${f}px`:0}),[u,p,r]);return c.jsxs(c.Fragment,{children:[c.jsx(B,{className:N(Qi,"gs-utl-transition-spacing gs-utl-w-full",te.bb,z.br,t),style:g,children:o??c.jsxs(I,{className:N(`${Qi}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(B,{className:N(`${Qi}__wrp-left`),grow:!0,children:s!==!1&&c.jsx(P$,{...s})}),c.jsx(B,{className:N(`${Qi}__wrp-center`),children:i!==!1&&c.jsx(B0,{...i})}),c.jsx(B,{className:N(`${Qi}__wrp-right`),grow:!0,children:a!==!1&&d&&c.jsx(N$,{editor:d,...a})})]})}),c.jsx(B,{className:N("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:N("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(re,{icon:q.eyeOff,size:se.s})})})]})}),V$="gs-sidebar-top",z0=h.memo(ce(function({height:t,children:n,...r}){return c.jsx(I$,{height:t,...r,style:Vc(r),className:N(V$,"gs-utl-flex",Ic(r)),children:n?kt(n):void 0})})),H$="gs-canvas-sidebar-top",j$=h.memo(ce(function({className:t,sidebarTop:n,...r}){return c.jsxs(xn,{className:N(H$,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...r,children:[c.jsx(z0,{...n}),c.jsx($b,{grow:!0})]})})),D$="gs-code-field",F$=ce(function(e){const{editor:t}=we(),{isDarkTheme:n}=Fr(),{editorEvents:r,onChange:o}=e,[s,a]=h.useState(()=>e),i=u=>({value:u,editor:t,state:s,setState:d=>a(p=>({...p,...d}))}),l=u=>o==null?void 0:o(i(u||""));return ls({editor:t,editorEvents:r,localState:s,setLocalState:a}),c.jsx(mo,{className:N(D$,s.className),language:s.language,style:s.style,label:s.label,name:s.name,defaultValue:s.value,size:s.size,required:s.required,disabled:s.disabled,readOnly:s.readOnly,minHeight:s.minHeight,row:s.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});var B$={grad:.9,turn:360,rad:360/(2*Math.PI)},vo=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},nr=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},U0=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},W0=function(e){return{r:nr(e.r,0,255),g:nr(e.g,0,255),b:nr(e.b,0,255),a:nr(e.a)}},Nf=function(e){return{r:zt(e.r),g:zt(e.g),b:zt(e.b),a:zt(e.a,3)}},z$=/^#([0-9a-f]{3,8})$/i,nu=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},G0=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:60*(i<0?i+6:i),s:s?a/s*100:0,v:s/255*100,a:o}},q0=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:255*[r,i,a,a,l,r][u],g:255*[l,r,r,i,a,a][u],b:255*[a,a,l,r,r,i][u],a:o}},K0=function(e){return{h:U0(e.h),s:nr(e.s,0,100),l:nr(e.l,0,100),a:nr(e.a)}},Z0=function(e){return{h:zt(e.h),s:zt(e.s),l:zt(e.l),a:zt(e.a,3)}},Y0=function(e){return q0((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},Ri=function(e){return{h:(t=G0(e)).h,s:(o=(200-(n=t.s))*(r=t.v)/100)>0&&o<200?n*r/100/(o<=100?o:200-o)*100:0,l:o/2,a:t.a};var t,n,r,o},U$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,W$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,G$=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,q$=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,kf={string:[[function(e){var t=z$.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=G$.exec(e)||q$.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:W0({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=U$.exec(e)||W$.exec(e);if(!t)return null;var n,r,o=K0({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(B$[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Y0(o)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=o===void 0?1:o;return vo(t)&&vo(n)&&vo(r)?W0({r:Number(t),g:Number(n),b:Number(r),a:Number(s)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,o=e.a,s=o===void 0?1:o;if(!vo(t)||!vo(n)||!vo(r))return null;var a=K0({h:Number(t),s:Number(n),l:Number(r),a:Number(s)});return Y0(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,o=e.a,s=o===void 0?1:o;if(!vo(t)||!vo(n)||!vo(r))return null;var a=function(i){return{h:U0(i.h),s:nr(i.s,0,100),v:nr(i.v,0,100),a:nr(i.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(s)});return q0(a)},"hsv"]]},X0=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},K$=function(e){return typeof e=="string"?X0(e.trim(),kf.string):typeof e=="object"&&e!==null?X0(e,kf.object):[null,void 0]},$f=function(e,t){var n=Ri(e);return{h:n.h,s:nr(n.s+100*t,0,100),l:n.l,a:n.a}},If=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},J0=function(e,t){var n=Ri(e);return{h:n.h,s:n.s,l:nr(n.l+100*t,0,100),a:n.a}},Vf=function(){function e(t){this.parsed=K$(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(If(this.rgba),2)},e.prototype.isDark=function(){return If(this.rgba)<.5},e.prototype.isLight=function(){return If(this.rgba)>=.5},e.prototype.toHex=function(){return t=Nf(this.rgba),n=t.r,r=t.g,o=t.b,a=(s=t.a)<1?nu(zt(255*s)):"","#"+nu(n)+nu(r)+nu(o)+a;var t,n,r,o,s,a},e.prototype.toRgb=function(){return Nf(this.rgba)},e.prototype.toRgbString=function(){return t=Nf(this.rgba),n=t.r,r=t.g,o=t.b,(s=t.a)<1?"rgba("+n+", "+r+", "+o+", "+s+")":"rgb("+n+", "+r+", "+o+")";var t,n,r,o,s},e.prototype.toHsl=function(){return Z0(Ri(this.rgba))},e.prototype.toHslString=function(){return t=Z0(Ri(this.rgba)),n=t.h,r=t.s,o=t.l,(s=t.a)<1?"hsla("+n+", "+r+"%, "+o+"%, "+s+")":"hsl("+n+", "+r+"%, "+o+"%)";var t,n,r,o,s},e.prototype.toHsv=function(){return t=G0(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 qr({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),qr($f(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),qr($f(this.rgba,-t))},e.prototype.grayscale=function(){return qr($f(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),qr(J0(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),qr(J0(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"?qr({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=Ri(this.rgba);return typeof t=="number"?qr({h:t,s:n.s,l:n.l,a:n.a}):zt(n.h)},e.prototype.isEqual=function(t){return this.toHex()===qr(t).toHex()},e}(),qr=function(e){return e instanceof Vf?e:new Vf(e)},Q0=[],Z$=function(e){e.forEach(function(t){Q0.indexOf(t)<0&&(t(Vf,kf),Q0.push(t))})};function Y$(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"},r={};for(var o in n)r[n[o]]=o;var s={};e.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,l,u=r[this.toHex()];if(u)return u;if(a!=null&&a.closest){var d=this.toRgb(),p=1/0,f="black";if(!s.length)for(var g in n)s[g]=new e(n[g]).toRgb();for(var m in n){var v=(i=d,l=s[m],Math.pow(i.r-l.r,2)+Math.pow(i.g-l.g,2)+Math.pow(i.b-l.b,2));v<p&&(p=v,f=m)}return f}},t.string.push([function(a){var i=a.toLowerCase(),l=i==="transparent"?"#0000":n[i];return l?new e(l).toRgb():null},"name"])}function ru(){return(ru=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e}).apply(this,arguments)}function R0(e,t){if(e==null)return{};var n,r,o={},s=Object.keys(e);for(r=0;r<s.length;r++)t.indexOf(n=s[r])>=0||(o[n]=e[n]);return o}function Hf(e){var t=h.useRef(e),n=h.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var Na=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},el=function(e){return"touches"in e},jf=function(e){return e&&e.ownerDocument.defaultView||self},ey=function(e,t,n){var r=e.getBoundingClientRect(),o=el(t)?function(s,a){for(var i=0;i<s.length;i++)if(s[i].identifier===a)return s[i];return s[0]}(t.touches,n):t;return{left:Na((o.pageX-(r.left+jf(e).pageXOffset))/r.width),top:Na((o.pageY-(r.top+jf(e).pageYOffset))/r.height)}},ty=function(e){!el(e)&&e.preventDefault()},Df=h.memo(function(e){var t=e.onMove,n=e.onKey,r=R0(e,["onMove","onKey"]),o=h.useRef(null),s=Hf(t),a=Hf(n),i=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(b){ty(b),(el(b)?b.touches.length>0:b.buttons>0)&&o.current?s(ey(o.current,b,i.current)):v(!1)},m=function(){return v(!1)};function v(b){var w=l.current,y=jf(o.current),S=b?y.addEventListener:y.removeEventListener;S(w?"touchmove":"mousemove",g),S(w?"touchend":"mouseup",m)}return[function(b){var w=b.nativeEvent,y=o.current;if(y&&(ty(w),!function(C,x){return x&&!el(C)}(w,l.current)&&y)){if(el(w)){l.current=!0;var S=w.changedTouches||[];S.length&&(i.current=S[0].identifier)}y.focus(),s(ey(y,w,i.current)),v(!0)}},function(b){var w=b.which||b.keyCode;w<37||w>40||(b.preventDefault(),a({left:w===39?.05:w===37?-.05:0,top:w===40?.05:w===38?-.05:0}))},v]},[a,s]),d=u[0],p=u[1],f=u[2];return h.useEffect(function(){return f},[f]),h.createElement("div",ru({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:o,onKeyDown:p,tabIndex:0,role:"slider"}))}),ou=function(e){return e.filter(Boolean).join(" ")},Ff=function(e){var t=e.color,n=e.left,r=e.top,o=r===void 0?.5:r,s=ou(["react-colorful__pointer",e.className]);return h.createElement("div",{className:s,style:{top:100*o+"%",left:100*n+"%"}},h.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},hn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},ny=function(e){var t=e.s,n=e.v,r=e.a,o=(200-t)*n/100;return{h:hn(e.h),s:hn(o>0&&o<200?t*n/100/(o<=100?o:200-o)*100:0),l:hn(o/2),a:hn(r,2)}},Bf=function(e){var t=ny(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},zf=function(e){var t=ny(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},X$=function(e){var t=e.h,n=e.s,r=e.v,o=e.a;t=t/360*6,n/=100,r/=100;var s=Math.floor(t),a=r*(1-n),i=r*(1-(t-s)*n),l=r*(1-(1-t+s)*n),u=s%6;return{r:hn(255*[r,i,a,a,l,r][u]),g:hn(255*[l,r,r,i,a,a][u]),b:hn(255*[a,a,l,r,r,i][u]),a:hn(o,2)}},J$=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?Q$({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}},Q$=function(e){var t=e.r,n=e.g,r=e.b,o=e.a,s=Math.max(t,n,r),a=s-Math.min(t,n,r),i=a?s===t?(n-r)/a:s===n?2+(r-t)/a:4+(t-n)/a:0;return{h:hn(60*(i<0?i+6:i)),s:hn(s?a/s*100:0),v:hn(s/255*100),a:o}},R$=h.memo(function(e){var t=e.hue,n=e.onChange,r=ou(["react-colorful__hue",e.className]);return h.createElement("div",{className:r},h.createElement(Df,{onMove:function(o){n({h:360*o.left})},onKey:function(o){n({h:Na(t+360*o.left,0,360)})},"aria-label":"Hue","aria-valuenow":hn(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(Ff,{className:"react-colorful__hue-pointer",left:t/360,color:Bf({h:t,s:100,v:100,a:1})})))}),e6=h.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Bf({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:r},h.createElement(Df,{onMove:function(o){n({s:100*o.left,v:100-100*o.top})},onKey:function(o){n({s:Na(t.s+100*o.left,0,100),v:Na(t.v-100*o.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+hn(t.s)+"%, Brightness "+hn(t.v)+"%"},h.createElement(Ff,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Bf(t)})))}),t6=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},n6=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function r6(e,t,n){var r=Hf(n),o=h.useState(function(){return e.toHsva(t)}),s=o[0],a=o[1],i=h.useRef({color:t,hsva:s});h.useEffect(function(){if(!e.equal(t,i.current.color)){var u=e.toHsva(t);i.current={hsva:u,color:t},a(u)}},[t,e]),h.useEffect(function(){var u;t6(s,i.current.hsva)||e.equal(u=e.fromHsva(s),i.current.color)||(i.current={hsva:s,color:u},r(u))},[s,e,r]);var l=h.useCallback(function(u){a(function(d){return Object.assign({},d,u)})},[]);return[s,l]}var o6=typeof window<"u"?h.useLayoutEffect:h.useEffect,s6=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},ry=new Map,a6=function(e){o6(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!ry.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}`,ry.set(t,n);var r=s6();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},i6=function(e){var t=e.className,n=e.hsva,r=e.onChange,o={backgroundImage:"linear-gradient(90deg, "+zf(Object.assign({},n,{a:0}))+", "+zf(Object.assign({},n,{a:1}))+")"},s=ou(["react-colorful__alpha",t]),a=hn(100*n.a);return h.createElement("div",{className:s},h.createElement("div",{className:"react-colorful__alpha-gradient",style:o}),h.createElement(Df,{onMove:function(i){r({a:i.left})},onKey:function(i){r({a:Na(n.a+i.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(Ff,{className:"react-colorful__alpha-pointer",left:n.a,color:zf(n)})))},l6=function(e){var t=e.className,n=e.colorModel,r=e.color,o=r===void 0?n.defaultColor:r,s=e.onChange,a=R0(e,["className","colorModel","color","onChange"]),i=h.useRef(null);a6(i);var l=r6(n,o,s),u=l[0],d=l[1],p=ou(["react-colorful",t]);return h.createElement("div",ru({},a,{ref:i,className:p}),h.createElement(e6,{hsva:u,onChange:d}),h.createElement(R$,{hue:u.h,onChange:d}),h.createElement(i6,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},c6={defaultColor:"rgba(0, 0, 0, 1)",toHsva:J$,fromHsva:function(e){var t=X$(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:n6},u6=function(e){return h.createElement(l6,ru({},e,{colorModel:c6}))};Z$([Y$]);const d6=e=>e.startsWith("rgba")?e:qr(e).toRgbString();function oy({value:e,onChange:t,disabled:n}){const r=d6(e||""),o=h.useRef(r),[s,a]=h.useState(!1),i=Or()&&!!window.EyeDropper,l=g=>{o.current=g,t==null||t(g)},u=g=>{o.current=g,t==null||t(g,!0)},d=()=>{i&&new window.EyeDropper().open().then(m=>l(m.sRGBHex)).catch(console.warn)},p=()=>{a(!0)},f=()=>{t==null||t(o.current,!1),a(!1)};return c.jsxs(c.Fragment,{children:[s&&c.jsx("div",{onPointerUp:f,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx(u6,{className:"color-picker",color:r,onChange:u,onPointerDown:p,onPointerUp:f}),c.jsxs(I,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(B,{grow:!0,children:c.jsx(rt,{size:"s",value:r,onChange:l,disabled:n})}),i&&c.jsx(Ke,{type:"button",onClick:d,children:c.jsx(re,{icon:q.eyedropperVariant,size:se.s})})]})]})}const p6="gs-cmp-studio-color-picker",f6=h.memo(ce(function({className:t,style:n,value:r="",disabled:o,onChange:s,editorEvents:a}){const{editor:i}=we(),[l,u]=h.useState(()=>({className:t,style:n,value:r,disabled:o})),d=(p,f)=>{const g=p||"";s==null||s({value:g,partial:f,editor:i,state:l,setState:m=>u(v=>({...v,...m}))})};return ls({editor:i,editorEvents:a,localState:l,setLocalState:u}),c.jsx("div",{className:N(p6,l.className,Pe.m),style:l.style,children:c.jsx(oy,{value:l.value||"",onChange:d,disabled:l.disabled})})})),h6="gs-cmp-column",g6=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(xn,{className:N(h6,z.bg,"gs-utl-flex gs-utl-flex-col",r&&"gs-utl-h-full",t),...o,children:kt(n)})}),Uf=`<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>`,zs="--before-content",Wf={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},sy={stylable:!1,traits:[]};function m6(e){return typeof e=="object"&&e.type===Ft.variable}function ay(e){if(m6(e)){const{path:t}=e;return iy(t||"")}return e}function iy(e){return`{{ ${e} }}`}function v6(e){const t={};return e.DataSources.getAll().forEach(n=>{const r=n.get("id");if(!r)return;const o=n.getRecords();if(!o){t[r]={};return}t[r]=o.reduce((s,a)=>{if(!a)return s;let i={...a.attributes};return delete i.__p,delete i.id,r===js.globalStyles&&(i={value:i.value}),{...s,[a.id]:i}},{})}),t}function ly(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const Gf=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags)??t?{...sy}:{}},qf=e=>{var s,a;const{isProjectTypeEmail:t,sdkOptions:n}=e,r=(a=(s=n.dataSources)==null?void 0:s.exportConfig)==null?void 0:a.skipTags;return t||r===!0?{...sy}:{}},b6=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,y6=e=>Array.isArray(e)?"array":e===null?"default":typeof e,w6=ce(({name:e,value:t,isActive:n,isCollection:r,onClick:o,className:s})=>{const a=Ie().tScoped("dataSources"),i=typeof t=="object"&&t!==null,l={array:q.codeBrackets,object:q.codeBraces,string:q.codeString,number:q.number,boolean:q.toggleSwitchOffOutline,default:q.null},u=y6(t),d=N(s,"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)?a("items",{params:{length:f.length}}):f?a("properties",{params:{length:Object.keys(f).length}}):"null":String(f);return c.jsx(Ke,{onClick:o,border:!1,className:d,full:!0,children:c.jsxs(I,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs(I,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs(I,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(re,{icon:l[u],size:se.s}),c.jsx(B,{className:N(Oe.txtEllips,r&&"gs-utl-font-bold"),children:e})]}),c.jsx(B,{className:N("gs-utl-w-full",Oe.txtEllips,Oe.disabled),children:p(t)})]}),i&&c.jsx(B,{children:c.jsx(re,{size:se.sx,icon:q.arrowRight,className:N(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),S6="gs-cmp-data-path-explorer",cy=ce(function({additionalSources:t,onChange:n,path:r=""}){const{editor:o}=we(),s=h.useRef({}),[a,i]=h.useState(()=>r.split(".")),[l,u]=h.useState([]),d=h.useMemo(()=>({...o?v6(o):{},...t}),[o,t]),p=(v,b)=>{let w=s.current;for(let y=0;y<b&&y<v.length;y++){const S=v[y];if(w&&typeof w=="object"&&S in w)w=w[S];else{w=void 0;break}}return!w||typeof w!="object"?[]:Object.entries(w).map(([y,S])=>{const C=v.slice(0,b).concat(y),x=a[b]===y,E=b===0&&to(S)&&S.collectionId===y,T=()=>{const _=x?C.slice(0,-1):C;n==null||n(_.join("."),{paths:_}),i(_)};return c.jsx(w6,{className:N(E&&"-gs-utl-order-1"),isCollection:E,name:y,value:S,isActive:x,onClick:T},y)})};h.useEffect(()=>{s.current=d;const v=[];for(let b=0;b<=a.length;b++){const w=p(a,b);w.length>0&&v.push(w)}u(v)},[d,a]);const f=N(S6,z.bg,z.br,te.b,te.rnd,Oe.scrollX,"gs-utl-h-full"),g=N("gs-utl-min-w-[220px]",z.br),m=N("gs-utl-h-full gs-utl-max-h-[60vh]",Oe.scrollY,Pe.xyS);return c.jsx(I,{className:f,full:!0,nowrap:!0,children:l.map((v,b)=>c.jsx(B,{className:N(g,b!==l.length-1&&te.br),children:c.jsx(I,{col:!0,nowrap:!0,gap:"m",className:m,children:v})},b))})});function uy(e){const{collectionId:t,variableType:n,path:r=""}=e;return t?[t,n,r].filter(Boolean).join("."):r}function Kf(e,t){const[n="",r="",...o]=e.split(".");return n&&t[n]?{collectionId:n,variableType:r,path:o.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const C6=e=>{const{path:t,collectionId:n,variableType:r}=e.dataResolver||{};return n?[n,r,t].filter(Boolean).join("."):e.value||t||""},x6=e=>{const{dataResolver:t,editor:n,value:r,defaultValue:o,additionalSources:s}=e,{path:a="",collectionId:i,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(i){const d=s==null?void 0:s[i],p=l&&d?d[l]:d;return(u==null?void 0:u.getValue(a,o,{context:p}))||""}else return(u==null?void 0:u.getValue(r,o))||""},E6="gs-cmp-data-path-field",tl=ce(e=>{const{size:t="m",value:n="",label:r,open:o,defaultValue:s,additionalSources:a,dataResolver:i,readOnly:l,disabled:u,pickerInPopover:d,onChange:p,onPickerToggle:f}=e,{editor:g}=we(),m=Ie().tScoped("dataSources"),[v,b]=h.useState(!!o),[w,y]=h.useState(!1),S=!!l||v||w,C=()=>y(!w),x=F=>{const $=F??!v;b($),f==null||f($)},E=()=>x(!1),T=(...F)=>{p==null||p(...F)},_=F=>{S||p==null||p(F,{paths:F.split(".")})},O=C6({dataResolver:i,value:n}),P=w&&g?`"${x6({editor:g,dataResolver:i,additionalSources:a,value:n,defaultValue:s})}"`:O,A=t==="m",M=A?"lg":t,k=A?se.l:se.s,j=m(v?"closePathExplorer":"openPathExplorer"),L={icon:v?q.close:q.databaseOutline,size:se.l},D={icon:w?q.eyeOff:q.eye,size:A?se.m:k},W=c.jsx(Ct,{block:!0,variant:"pr",size:M,title:j,onClick:()=>x(),icon:L});return c.jsxs(I,{className:E6,gap:t,col:!0,children:[c.jsxs(I,{gap:t,items:"end",nowrap:!0,children:[c.jsx(rt,{readOnly:S,label:r,value:w?P:O,size:t,disabled:u,onChange:_,placeholder:m("selectVariablePath"),className:N("gs-utl-flex-grow",z.txt,Oe.txtEllips),afterInput:!!n&&c.jsx(Ct,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:C,className:Oe.hover,icon:D})}),d?c.jsx(Cr,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:W,onClose:E,overlay:!0,children:c.jsx(cy,{path:O,onChange:T,additionalSources:a})}):W]}),!!v&&!d&&c.jsx(cy,{path:O,onChange:T,additionalSources:a})]})}),T6=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},dy=({value:e,step:t})=>{const n=parseFloat(`${e}`);let r=0;if(Math.floor(n)!==n&&t){const o=`${t}`.split(".")[1];r=(o==null?void 0:o.length)||0}return r?parseFloat(n.toFixed(r)):n},P6=({value:e,key:t,shiftKey:n,min:r,max:o,step:s=1})=>{const a=t==="ArrowUp",i=t==="ArrowDown";let l=null;if(a||i){l=Number(e);const u=parseFloat(`${s}`);a&&(l+=(n?10:1)*u),i&&(l-=(n?10:1)*u),l=`${su({min:r,max:o,value:l})}`,l=dy({value:l,step:s})}return l},su=({min:e,max:t,value:n})=>{const r=parseFloat(`${n}`);let o=r||0;return Vt(e)&&(o=Math.max(o,parseFloat(`${e}`)||0)),Vt(t)&&(o=Math.min(o,parseFloat(`${t}`)||0)),`${`${r}`!=`${n}`?n:o}`},O6=(e,t,n,r={})=>{const o=parseInt(`${e}`,10)||0,{min:s,max:a,step:i=1}=r;let l=o;const u=p=>{const f=p.clientY-t,g=o-f*parseFloat(`${i}`);l=dy({value:su({min:s,max:a,value:g}),step:i}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},_6=(e,t,n={})=>{const{partial:r}=n,o=(s,a)=>s===a||r&&s.startsWith(a);return t.some(s=>o(typeof s=="string"?s:s.id,e))},py=e=>Vt(e)?e:"",A6="gs-cmp-number-field";function ke(e){const{className:t,value:n,units:r,valueUnit:o,size:s="m",pan:a=!0,min:i,max:l,step:u,placeholder:d,disabled:p,onChange:f,onChangeUnit:g}=e,[m,v]=h.useState(py(n)),[b,w]=h.useState(!1),y=(r==null?void 0:r.map(O=>({id:O,label:O})))||[],S={min:i,max:l,step:u};h.useEffect(()=>{v(py(n))},[n,o]);const C=(O,P)=>{f==null||f(su({min:i,max:l,value:O}),P)},x=O=>{if(p)return;w(!0);const P=(A,M)=>{C(A,!!M),!M&&w(!1)};O6(m,O.clientY,P,S)},E=O=>{const{key:P,shiftKey:A}=O;switch(P){case"Escape":return v(n);case"Enter":return C(m)}const M=P6({step:u,value:n,key:P,shiftKey:A});M!==null&&(O.preventDefault(),C(M))},T=()=>{C(m)},_=qo({...e,className:N(A6,t)});return c.jsxs("div",{..._,children:[b&&c.jsx("div",{className:N("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(wr,{as:e.labelAs,...e}),c.jsxs(I,{className:tf(e),items:"center",space:"x2s",children:[!!a&&c.jsx(B,{onMouseDown:x,className:N("gs-utl-opacity-50 gs-utl-cursor-ns",s==="m"&&"-gs-utl-ml-3",s==="s"&&"-gs-utl-ml-2",a!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:a===!0?c.jsx(re,{icon:q.panVertical,size:se.s2x}):a}),c.jsx(B,{grow:!0,children:c.jsx("input",{className:Di(e),value:m,disabled:p,onChange:O=>v(O.target.value),placeholder:d,onBlur:T,onKeyDown:E})}),!!y.length&&c.jsx(B,{className:N(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(Le,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:o,disabled:p,onChange:O=>g==null?void 0:g(O),options:y})})]})]})}const L6="gs-cmp-switch-field";function nl(e){const{className:t,value:n,label:r,labelAs:o,border:s,disabled:a,onChange:i}=e,l=!!n,u=N("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,ri.focus,s&&`${z.br} ${te.b}`);return c.jsx(lp.Group,{children:c.jsxs(I,{items:"center",className:N(L6,t),full:!0,children:[!!r&&c.jsx(lp.Label,{as:o,className:N("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(wr,{...e,as:"span"})}),c.jsx(lp,{checked:l,onChange:i,className:u,disabled:a,children:c.jsx("span",{className:N(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 Zf(e){var a;const[t,n]=h.useState(((a=e.getDataResolver)==null?void 0:a.call(e))??{}),r=h.useRef(t),o=i=>{const l={...r.current,...i};r.current=l,n(l)},s=()=>{e.setDataResolver(r.current)};return h.useEffect(()=>{const i="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(i,l),()=>{e.off(i,l)}},[e]),{localData:t,updateLocalData:o,syncToComponent:s}}const M6="gs-cmp-data-collection-picker",N6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Zf(e),{collectionId:s="",dataSource:a={},startIndex:i=0,endIndex:l=10}=n,u=uy(a),d=l===Number.MAX_VALUE,p=Ie().tScoped("dataSources"),f=d?"":l,g=()=>{o(),t==null||t({value:n})},m=y=>r({dataSource:{...a,path:y}}),v=y=>r({startIndex:y}),b=y=>r({endIndex:y}),w=y=>r({endIndex:y?Number.MAX_VALUE:4});return c.jsxs(I,{className:M6,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(rt,{className:"gs-utl-flex-grow",size:"s",label:p("collectionId"),value:s,readOnly:!0,disabled:!0}),c.jsx(gb,{size:"s",value:s,block:!0})]}),c.jsx(tl,{label:p("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(ke,{size:"s",className:"gs-utl-flex-grow",label:p("collectionStartIndex"),value:i==null?void 0:i.toString(),onChange:v}),c.jsx(ke,{size:"s",label:p("collectionEndIndex"),placeholder:d?"-":"",value:f==null?void 0:f.toString(),onChange:b,className:N("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(B,{children:c.jsx(nl,{label:p("collectionUpToEndIndex"),value:d,onChange:w})})]}),c.jsx(I,{full:!0,justify:"end",children:c.jsx(Ke,{onClick:g,variant:"pr",size:"m",children:p("confirm")})})]})}),k6="gs-data-collection-picker",$6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(k6,t),...o,children:c.jsx(N6,{component:n,onConfirm:r})})});var Hn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Hn||{}),jn=(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))(jn||{}),Yf=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(Yf||{}),Xf=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(Xf||{});const I6=[...Object.values(Xf),...Object.values(Yf),...Object.values(jn)],Jf={string:Object.values(Xf),number:Object.values(Yf),dataSource:I6},V6=h.memo(function(t){const{additionalSources:n,side:r,type:o,value:s,onChange:a}=t;switch(o){case Hn.DATA_SOURCE:return c.jsx(tl,{size:"s",pickerInPopover:!0,value:uy(s),onChange:i=>a(r,i,o),additionalSources:n});case Hn.NUMBER:return c.jsx(ke,{size:"s",value:s,onChange:i=>a(r,i,o)});default:return c.jsx(rt,{size:"s",value:s,onChange:i=>a(r,i,o)})}}),H6="gs-cmp-statement-side",fy=h.memo(function({side:t,type:n,value:r,label:o,onChange:s,onTypeChange:a,additionalSources:i,typeOptions:l}){return c.jsxs(I,{className:N(H6,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Go,{size:"s",children:o}),c.jsxs(I,{items:"center",gap:"xs",children:[c.jsx(B,{children:c.jsx(Le,{size:"s",value:n,options:l,onChange:u=>a(t,u)})}),c.jsx(B,{grow:!0,children:c.jsx(V6,{additionalSources:i,side:t,type:n,value:r,onChange:s})})]})]})}),au=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Hn.DATA_SOURCE:typeof e=="string"?Hn.STRING:typeof e=="number"?Hn.NUMBER:Hn.STRING,j6=(e,t,n)=>{switch(t){case Hn.STRING:return e||"";case Hn.NUMBER:return e?Number(e):0;case Hn.DATA_SOURCE:{const r=n||{};return{type:"data-variable",...(ct(e)?Kf(e,r):e)??{path:"",defaultValue:""}}}default:return e}},D6=e=>Jf[e][0],F6=e=>![jn.isTruthy,jn.isFalsy,jn.isDefined,jn.isNull,jn.isUndefined,jn.isArray,jn.isObject,jn.isString,jn.isNumber,jn.isBoolean,jn.isDefaultValue].includes(e),B6="gs-cmp-statement",z6=ce(e=>{const{statement:t,onChange:n,className:r,additionalSources:o}=e,s=Ie().tScoped("dataSources"),[a,i]=h.useState(()=>au(t.left)),[l,u]=h.useState(()=>au(t.right)),d=Jf[a]||Jf[Hn.STRING],p=h.useMemo(()=>Object.values(Hn).map(C=>({id:C,label:_r(C)})),[]),f=h.useMemo(()=>d.map(C=>({id:C,label:s(`operators.${C}`)})),[d,s]);h.useEffect(()=>{i(au(t.left)),u(au(t.right))},[t.left,t.right]);const g=C=>{n({...t,...C})},m=(C,x,E)=>{const T=j6(x,E,o),_=C==="left",O=_&&E!==Hn.DATA_SOURCE;_?i(E):u(E),g({[C]:T,...O&&{operator:D6(E)}})},v=(C,x)=>m(C,null,x),b=C=>g({operator:C}),w=N(B6,r,z.br,te.b,te.rnd,Pe.xy),y=F6(t.operator),S={additionalSources:o,onChange:m,onTypeChange:v,typeOptions:p};return c.jsx(I,{className:N(w,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs(I,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(fy,{side:"left",type:a,value:t.left,label:s("leftValue"),...S}),c.jsx(B,{children:c.jsx(Le,{size:"s",label:s("operator"),value:t.operator,options:f,onChange:b})}),y&&c.jsx(fy,{side:"right",type:l,value:t.right,label:s("rightValue"),...S})]})})}),Qf="gs-cmp-statements-group",U6=e=>e==="and"||e==="or",iu=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),hy=ce(e=>{const{className:t,condition:n,onUpdate:r,additionalSources:o,skipAddCondition:s}=e,a=Ie().tScoped("dataSources"),i=n.statements??[],l=n.logicalOperator||"and",u=m=>{U6(m)&&r({...n,logicalOperator:m})},d=()=>{iu(n),r(iu(n))},p=m=>{const v=i.filter((b,w)=>w!==m);r({...n,statements:v})},f=(m,v)=>{if(m>=0&&m<i.length){const b=[...i];b[m]=v,r({...n,statements:b})}},g=[{id:"and",label:a("conditionAnd")},{id:"or",label:a("conditionOr")}];return c.jsxs(I,{className:N(Qf,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[i.length>1&&c.jsx(Yo,{value:l,onChange:u,tabs:g}),c.jsx(I,{className:`${Qf}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:i.map((m,v)=>c.jsxs(I,{className:N(`${Qf}__item`),gap:"s",col:!0,children:[c.jsx(z6,{additionalSources:o,statement:m,onChange:b=>f(v,b)}),v<i.length-1&&c.jsxs(I,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:N(z.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(Ct,{block:!0,variant:"out-clear",title:a("deleteCondition"),onClick:()=>p(v+1),icon:{icon:q.delete,size:se.s}})]})]},`stmt-${v}`))}),!s&&c.jsx(I,{justify:"end",children:c.jsx(Ke,{variant:"pr",onClick:d,icon:{icon:q.plus,size:se.s},children:a("addCondition")})})]})}),W6="gs-cmp-data-condition-picker",G6=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Zf(e),s=Ie().tScoped("dataSources"),a=n.condition,i=d=>r({condition:d}),l=()=>{o(),t==null||t({value:n})},u=()=>{r({condition:iu(a)})};return c.jsxs(I,{className:W6,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(hy,{additionalSources:e.collectionsStateMap??{},condition:a,onUpdate:i,skipAddCondition:!0}),c.jsxs(I,{gap:"m",justify:"end",full:!0,children:[c.jsx(Ke,{variant:"out",onClick:u,icon:{icon:q.plus,size:se.s},children:s("addCondition")}),c.jsx(Ke,{onClick:l,variant:"pr",size:"m",children:s("confirm")})]})]})}),q6="gs-data-condition-picker",K6=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(q6,t),...o,children:c.jsx(G6,{component:n,onConfirm:r})})}),Z6="gs-data-path-field",Y6=ce(({className:e,value:t="",onChange:n,...r})=>c.jsx(xn,{className:N(Z6,e),...r,children:c.jsx(tl,{onChange:o=>n({value:o}),value:t})})),lu={type:"data-variable",path:"",defaultValue:""},gy={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function ts(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const my="gs-cmp-dynamic-value-picker",X6=ce(({value:e,onChange:t,onConfirm:n,additionalSources:r})=>{const[o,s]=h.useState(()=>ts(e)?e:lu),[a,i]=h.useState(o.type),l=Ie().tScoped("dataSources");h.useEffect(()=>{const S=ts(e)?e:lu;(S.type!==o.type||JSON.stringify(S)!==JSON.stringify(o))&&(s(S),i(S.type))},[e]);const u=S=>{s(S),t==null||t({value:S})},d=S=>{const C=S;i(C);const x=o.type===C?o:C==="data-variable"?lu:gy;u(x)},p=S=>{u({type:"data-variable",defaultValue:o.defaultValue,...Kf(S,r)})},f=S=>{s(C=>{const x={...C,defaultValue:S};return t==null||t({value:x}),x})},g=S=>{u({...o,condition:S})},m=(S,C)=>{u({...o,[S]:C})},v=()=>{const S=o.condition;g(iu(S))},b=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],w=(o==null?void 0:o.type)==="data-variable"?o:lu,y=(o==null?void 0:o.type)==="data-condition"?o:gy;return c.jsxs(I,{className:my,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(I,{className:my,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(Yo,{value:a,onChange:d,tabs:b}),c.jsx(B,{grow:!0,className:Pe.y,style:{overflowY:"auto",overflowX:"hidden"},children:a==="data-variable"?c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(tl,{value:w.path,label:l("variablePath"),additionalSources:r,defaultValue:w.defaultValue,onChange:p}),c.jsx(rt,{label:l("defaultValue"),value:w.defaultValue||"",onChange:f})]}):c.jsxs(I,{gap:"m",col:!0,children:[c.jsx(hy,{additionalSources:r,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(rt,{label:l("ifTrue"),value:y.ifTrue,onChange:S=>m("ifTrue",S)}),c.jsx(rt,{label:l("ifFalse"),value:y.ifFalse,onChange:S=>m("ifFalse",S)})]})]})}),a==="data-condition"&&c.jsx(I,{full:!0,justify:"end",className:Pe.x,children:c.jsx(Ke,{variant:"out",onClick:v,icon:{icon:q.plus,size:se.s},children:l("addCondition")})})]}),c.jsx(I,{full:!0,justify:"end",className:Pe.y,children:c.jsx(Ke,{onClick:()=>{n==null||n({value:o})},variant:"pr",size:"m",children:l("confirm")})})]})}),J6="gs-data-value-picker",Q6=ce(({className:e,value:t={},onChange:n,onConfirm:r,additionalSources:o={},...s})=>c.jsx(xn,{className:N(J6,e),...s,children:c.jsx(X6,{value:t,onConfirm:a=>r==null?void 0:r(a),onChange:a=>n==null?void 0:n(a),additionalSources:o})})),R6="gs-cmp-data-variable-picker",e8=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:o}=Zf(e),s=Ie().tScoped("dataSources"),{path:a="",defaultValue:i=""}=n,l=e.collectionsStateMap,u=f=>{r(Kf(f,l))},d=()=>{o(),t==null||t({value:n})},p=f=>r({defaultValue:f});return c.jsxs(I,{className:R6,gap:"s",col:!0,nowrap:!0,children:[c.jsx(tl,{value:a,label:s("variablePath"),dataResolver:n,additionalSources:l,defaultValue:i,onChange:u}),c.jsx(rt,{label:s("defaultValue"),value:i,onChange:p}),c.jsx(I,{full:!0,justify:"end",className:Pe.y,children:c.jsx(Ke,{onClick:d,variant:"pr",size:"m",children:s("confirm")})})]})}),t8="gs-data-variable-picker",n8=ce(function({className:t,component:n,onConfirm:r,...o}){return c.jsx(xn,{className:N(t8,t),...o,children:c.jsx(e8,{component:n,onConfirm:r})})}),r8="gs-cmp-input-field",o8=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,disabled:i,inputType:l,readOnly:u,required:d,placeholder:p,onChange:f,onInput:g,editorEvents:m}){const{editor:v}=we(),[b,w]=h.useState(()=>({className:t,style:n,label:r,name:o,value:s,size:a,readOnly:u,disabled:i,required:d,placeholder:p})),y=x=>({value:x,editor:v,state:b,setState:E=>w(T=>({...T,...E}))}),S=x=>f==null?void 0:f(y(x)),C=x=>g==null?void 0:g(y(x));return ls({editor:v,editorEvents:m,localState:b,setLocalState:w}),c.jsx(rt,{type:l,className:N(r8,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:S,onInput:C})})),s8="gs-menu-list",a8=ce(function({className:e,items:t,onItemClick:n,...r}){const{editor:o}=we(),[s,a]=h.useState(),i=u=>{const{onClick:d}=u;if(d&&o)return p=>d({item:u,editor:o,...p})},l=()=>{if(n&&o)return u=>n({...u,editor:o})};return c.jsx(xn,{className:N(s8,z.bg,"gs-utl-flex gs-utl-flex-col",e),...r,children:(t||[]).map((u,d)=>h.createElement(Oa,{...u,label:u.layout?kt(u.layout):u.label,key:u.id??d,className:u.className,action:i(u),onActive:()=>a(u),onItemClick:l(),active:s===u,items:u.items}))})});function i8({children:e,accept:t,onChange:n,multiple:r=!0,...o}){const s=Ie(),a=h.useRef(null),i=()=>{const{current:l}=a;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:Z("hidden"),ref:a,type:"file",multiple:r,accept:t,onChange:n}),c.jsx(Ke,{variant:"pr",size:"m2",...o,onClick:i,children:e||s.t("upload")})]})}const l8=ce(i8),c8=ce(function({editor:t,assetProps:n,itemLayout:r,onSelect:o,onRemove:s}){const a=Ai();return kt(r({asset:ur(a.toAsset(n)),assetProps:ur(n),onSelect:i=>o(a.toAssetProps(i)),onDelete:s&&(i=>s(a.toAssetProps(i))),editor:t}))}),u8="gs-cmp-asset-card",d8=ce(function(t){var p;const{assetProps:n,onSelect:r,onRemove:o,className:s,itemLayout:a}=t,i=Ie(),{editor:l}=we();if(a)return l?c.jsx(c8,{...t,editor:l,itemLayout:a}):null;const{src:u}=n,d=n.name||((p=u.split("/").pop())==null?void 0:p.split("?").shift());return c.jsx(Jn,{padding:!1,className:ae(u8,"overflow-hidden max-w-full group",s),children:c.jsxs(I,{col:!0,children:[c.jsxs(B,{className:ae("relative group h-24 cursor-pointer bg-checker"),onClick:()=>r(n),children:[c.jsx("div",{className:ae("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(I,{justify:"center",items:"center",className:ae(Oe.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Ke,{className:ae("text-sm"),size:"m2",variant:"pr",children:i.t("select")})})]}),c.jsxs(I,{className:ae("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(B,{className:ae(Oe.txtEllips,"text-sm gjs-mr-auto"),children:d}),o&&c.jsx(tu,{onConfirm:()=>o==null?void 0:o(n),text:c.jsxs(I,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ae("text-center",z.txtHighEmphasis),children:i.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ae("text-center"),children:i.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(Ct,{title:i.t("delete"),children:c.jsx(re,{icon:q.delete,size:se.sx})})})]})]})})}),Kr="gs-asset-manager",p8={search:!0,addUrl:!0,upload:!0},f8=ce(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:r,typeFilter:o,providerFilter:s,searchValue:a,isLoading:i,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:p,content:f,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:v,onChangeSearchValue:b,onChangeUpload:w,onAddUrl:y,onRemove:S,onEndReached:C,layoutAfterHeader:x}){const E=we(),{editor:T}=E,_=Ie(),[O]=jp(),P=Lf(f==null?void 0:f.itemsPerRow),[A,M]=h.useState(""),k=(f==null?void 0:f.header)===!1?!1:{...p8,...to(f==null?void 0:f.header)?f.header:{}};if(!T)return;const j=d?t.filter(L=>!(a&&!Ys(L.src,a)&&!Ys(L.name??"",a))):t;return c.jsxs(I,{className:Z(Kr,"relative gs-utl-h-full",i&&Oe.disabled),nowrap:!0,col:!0,space:"m",children:[k!==!1&&c.jsxs(I,{className:`${Kr}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(I,{className:`${Kr}__header-filters`,items:"center",gap:"m",children:[k.search&&c.jsx(B,{children:c.jsx(rt,{className:`${Kr}__search-filter`,size:"m",type:"search",value:a,onInput:b,placeholder:`${_.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(B,{children:c.jsx(Le,{className:Z(`${Kr}__type-filter`,"items-center"),size:"m",options:n,value:o,onChange:m,emptyState:_.t("assetManager.assetTypes.all"),includeEmpty:l})}),r.length>(u?0:1)&&c.jsx(B,{children:c.jsx(Le,{classNameContainer:Z(`${Kr}__provider-filter`,"items-center"),size:"m",options:r.map(L=>({...L,label:et(L.label)?L.label({editor:T}):L.label,icon:L.icon})),value:s,onChange:v,emptyState:_.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(I,{className:`${Kr}__header-buttons`,items:"center",gap:"m",children:[k.upload&&c.jsx(B,{children:c.jsx(l8,{className:`${Kr}__upload-field`,onChange:w})}),k.addUrl&&!!y&&c.jsx(B,{children:c.jsx(Cr,{className:`${Kr}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(Ke,{variant:"pr",size:"m2",children:_.t("assetManager.addUrl")}),children:({close:L})=>c.jsxs(I,{gap:"m",children:[c.jsx(B,{children:c.jsx(rt,{type:"url",size:"s",value:A,onChange:M,placeholder:_.t("assetManager.inputPlh")})}),c.jsx(B,{children:c.jsx(Ke,{variant:"pr",size:"m2",onClick:()=>{y(A),L()},children:_.t("add")})})]})})})]}),x&&c.jsx(c.Fragment,{children:kt(x({editor:T}))})]}),c.jsx(I,{className:Z(`${Kr}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!i&&!j.length?c.jsx(I,{justify:"center",children:_.t("noItems")}):!!O&&c.jsx(eu,{data:j,listClassName:Z("gs-utl-grid gs-utl-gap-2",P),endReached:C,itemContent:(L,D)=>c.jsx(d8,{assetProps:D,onSelect:g,onRemove:S,itemLayout:p},D.id),components:{Footer:C?h8:void 0}})}),i&&c.jsx(Mo,{abs:!0})]})}),h8=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),g8=ce(function({panelId:t,content:n,assets:r,types:o,providers:s,typeId:a,providerId:i,optionalType:l,optionalProvider:u,onSelect:d,close:p,layoutAfterHeader:f}){const{appEditorStore:g,i18nStore:m}=Tn(),{editor:v}=g,b=Ai(),{customOnLoad:w}=b,y=wv(t);h.useEffect(()=>{const T=O=>ct(O)?{id:O,label:m.t(`assetManager.assetTypes.${O}`)||O}:O;y.setCustomTypes(o==null?void 0:o.map(T)),y.setCustomProviders(ct(s)?[s]:s),a?y.setTypeFilter(a):y.initTypeFilter(),i?y.setProviderFilter(i):y.initProviderFilter(),Vt(l)?y.setOptionalType(l):y.initOptionalType(),Vt(u)?y.setOptionalProvider(u):y.initOptionalProvider();const _=setTimeout(()=>y.loadAssets());return()=>clearTimeout(_)},[o,s,a,i,l,u]);const S=T=>{b.addToProjectAssets([{id:T,src:T,type:y.typeFilter??ks.image}])},C=T=>{v&&(d==null||d({asset:b.toAsset(T),assetProps:T,editor:v}),p==null||p())},x=r==null?void 0:r.map(b.toAssetProps),E=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(f8,{assetProps:x??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:T=>{y.setTypeFilter(T),y.loadAssets()},onChangeProviderFilter:T=>{y.setProviderFilter(T),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:C,onAddUrl:w?void 0:S,onChangeUpload:T=>b.uploadFile(T.nativeEvent),onRemove:x?void 0:y.handleDelete,onEndReached:E,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:f})});var m8=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),$t=function(){return $t=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},$t.apply(this,arguments)},vy={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},by={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},cu={width:"20px",height:"20px",position:"absolute"},v8={top:$t($t({},vy),{top:"-5px"}),right:$t($t({},by),{left:void 0,right:"-5px"}),bottom:$t($t({},vy),{top:void 0,bottom:"-5px"}),left:$t($t({},by),{left:"-5px"}),topRight:$t($t({},cu),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:$t($t({},cu),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:$t($t({},cu),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:$t($t({},cu),{left:"-10px",top:"-10px",cursor:"nw-resize"})},b8=function(e){m8(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(r){n.props.onResizeStart(r,n.props.direction)},n.onTouchStart=function(r){n.props.onResizeStart(r,n.props.direction)},n}return t.prototype.render=function(){return nt.createElement("div",{className:this.props.className||"",style:$t($t({position:"absolute",userSelect:"none"},v8[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(nt.PureComponent),y8=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,o){r.__proto__=o}||function(r,o){for(var s in o)Object.prototype.hasOwnProperty.call(o,s)&&(r[s]=o[s])},e(t,n)};return function(t,n){e(t,n);function r(){this.constructor=t}t.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}}(),Zr=function(){return Zr=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var o in t)Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o])}return e},Zr.apply(this,arguments)},w8={width:"auto",height:"auto"},uu=function(e,t,n){return Math.max(Math.min(e,n),t)},yy=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},ka=function(e,t){return new RegExp(e,"i").test(t)},du=function(e){return!!(e.touches&&e.touches.length)},S8=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},wy=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(s,a,i){return Math.abs(a-e)<Math.abs(t[s]-e)?i:s},0),o=Math.abs(t[r]-e);return n===0||o<n?t[r]:e},Rf=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"},pu=function(e,t,n,r){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var o=Number(e.replace("%",""))/100;return t*o}if(e.endsWith("vw")){var o=Number(e.replace("vw",""))/100;return n*o}if(e.endsWith("vh")){var o=Number(e.replace("vh",""))/100;return r*o}}return e},C8=function(e,t,n,r,o,s,a){return r=pu(r,e.width,t,n),o=pu(o,e.height,t,n),s=pu(s,e.width,t,n),a=pu(a,e.height,t,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof o>"u"?void 0:Number(o),minWidth:typeof s>"u"?void 0:Number(s),minHeight:typeof a>"u"?void 0:Number(a)}},x8=function(e){return Array.isArray(e)?e:[e,e]},E8=["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"],Sy="__resizable_base__",T8=function(e){y8(t,e);function t(n){var r,o,s,a,i=e.call(this,n)||this;return i.ratio=1,i.resizable=null,i.parentLeft=0,i.parentTop=0,i.resizableLeft=0,i.resizableRight=0,i.resizableTop=0,i.resizableBottom=0,i.targetLeft=0,i.targetTop=0,i.appendBase=function(){if(!i.resizable||!i.window)return null;var l=i.parentNode;if(!l)return null;var u=i.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(Sy):u.className+=Sy,l.appendChild(u),u},i.removeBase=function(l){var u=i.parentNode;u&&u.removeChild(l)},i.state={isResizing:!1,width:(o=(r=i.propsSize)===null||r===void 0?void 0:r.width)!==null&&o!==void 0?o:"auto",height:(a=(s=i.propsSize)===null||s===void 0?void 0:s.height)!==null&&a!==void 0?a:"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},i.onResizeStart=i.onResizeStart.bind(i),i.onMouseMove=i.onMouseMove.bind(i),i.onMouseUp=i.onMouseUp.bind(i),i}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||w8},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var o=this.resizable.offsetWidth,s=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:o,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:s,this.resizable.style.position=a}return{width:n,height:r}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,r=this.props.size,o=function(i){var l;if(typeof n.state[i]>"u"||n.state[i]==="auto")return"auto";if(n.propsSize&&n.propsSize[i]&&(!((l=n.propsSize[i])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[i].toString().endsWith("%"))return n.state[i].toString();var u=n.getParentSize(),d=Number(n.state[i].toString().replace("px","")),p=d/u[i]*100;return p+"%"}return Rf(n.state[i])},s=r&&typeof r.width<"u"&&!this.state.isResizing?Rf(r.width):o("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?Rf(r.height):o("height");return{width:s,height:a}},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 r=!1,o=this.parentNode.style.flexWrap;o!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var s={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=o),this.removeBase(n),s},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,r){var o=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof o>"u"||o==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var o=this.props.boundsByDirection,s=this.state.direction,a=o&&ka("left",s),i=o&&ka("top",s),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=a?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=i?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=i?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=a?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=i?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)&&(r=r&&r<u?r:u),{maxWidth:n,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(n,r){var o=this.props.scale||1,s=x8(this.props.resizeRatio||1),a=s[0],i=s[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,w=g||0,y=m||0;return ka("right",u)&&(v=d.width+(n-d.x)*a/o,f&&(b=(v-y)/this.ratio+w)),ka("left",u)&&(v=d.width-(n-d.x)*a/o,f&&(b=(v-y)/this.ratio+w)),ka("bottom",u)&&(b=d.height+(r-d.y)*i/o,f&&(v=(b-w)*this.ratio+y)),ka("top",u)&&(b=d.height-(r-d.y)*i/o,f&&(v=(b-w)*this.ratio+y)),{newWidth:v,newHeight:b}},t.prototype.calculateNewSizeFromAspectRatio=function(n,r,o,s){var a=this.props,i=a.lockAspectRatio,l=a.lockAspectRatioExtraHeight,u=a.lockAspectRatioExtraWidth,d=typeof s.width>"u"?10:s.width,p=typeof o.width>"u"||o.width<0?n:o.width,f=typeof s.height>"u"?10:s.height,g=typeof o.height>"u"||o.height<0?r:o.height,m=l||0,v=u||0;if(i){var b=(f-m)*this.ratio+v,w=(g-m)*this.ratio+v,y=(d-v)/this.ratio+m,S=(p-v)/this.ratio+m,C=Math.max(d,b),x=Math.min(p,w),E=Math.max(f,y),T=Math.min(g,S);n=uu(n,C,x),r=uu(r,E,T)}else n=uu(n,d,p),r=uu(r,f,g);return{newWidth:n,newHeight:r}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var r=this.parentNode;if(r){var o=r.getBoundingClientRect();this.parentLeft=o.left*n,this.parentTop=o.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var s=this.props.bounds.getBoundingClientRect();this.targetLeft=s.left*n,this.targetTop=s.top*n}if(this.resizable){var a=this.resizable.getBoundingClientRect(),i=a.left,l=a.top,u=a.right,d=a.bottom;this.resizableLeft=i*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var o=0,s=0;if(n.nativeEvent&&S8(n.nativeEvent)?(o=n.nativeEvent.clientX,s=n.nativeEvent.clientY):n.nativeEvent&&du(n.nativeEvent)&&(o=n.nativeEvent.touches[0].clientX,s=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var a=this.props.onResizeStart(n,r,this.resizable);if(a===!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 i,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",i=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var p={original:{x:o,y:s,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Zr(Zr({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:r,flexBasis:i};this.setState(p)}},t.prototype.onMouseMove=function(n){var r=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&du(n))try{n.preventDefault(),n.stopPropagation()}catch{}var o=this.props,s=o.maxWidth,a=o.maxHeight,i=o.minWidth,l=o.minHeight,u=du(n)?n.touches[0].clientX:n.clientX,d=du(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(),w=C8(b,this.window.innerWidth,this.window.innerHeight,s,a,i,l);s=w.maxWidth,a=w.maxHeight,i=w.minWidth,l=w.minHeight;var y=this.calculateNewSizeFromDirection(u,d),S=y.newHeight,C=y.newWidth,x=this.calculateNewMaxFromBoundary(s,a);this.props.snap&&this.props.snap.x&&(C=wy(C,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(S=wy(S,this.props.snap.y,this.props.snapGap));var E=this.calculateNewSizeFromAspectRatio(C,S,{width:x.maxWidth,height:x.maxHeight},{width:i,height:l});if(C=E.newWidth,S=E.newHeight,this.props.grid){var T=yy(C,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),_=yy(S,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),O=this.props.snapGap||0,P=O===0||Math.abs(T-C)<=O?T:C,A=O===0||Math.abs(_-S)<=O?_:S;C=P,S=A}var M={width:C-g.width,height:S-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var k=C/b.width*100;C=k+"%"}else if(m.endsWith("vw")){var j=C/this.window.innerWidth*100;C=j+"vw"}else if(m.endsWith("vh")){var L=C/this.window.innerHeight*100;C=L+"vh"}}if(v&&typeof v=="string"){if(v.endsWith("%")){var k=S/b.height*100;S=k+"%"}else if(v.endsWith("vw")){var j=S/this.window.innerWidth*100;S=j+"vw"}else if(v.endsWith("vh")){var L=S/this.window.innerHeight*100;S=L+"vh"}}var D={width:this.createSizeForCssProperty(C,"width"),height:this.createSizeForCssProperty(S,"height")};this.flexDir==="row"?D.flexBasis=D.width:this.flexDir==="column"&&(D.flexBasis=D.height);var W=this.state.width!==D.width,F=this.state.height!==D.height,$=this.state.flexBasis!==D.flexBasis,H=W||F||$;H&&zn.flushSync(function(){r.setState(D)}),this.props.onResize&&H&&this.props.onResize(n,f,this.resizable,M)}},t.prototype.onMouseUp=function(n){var r,o,s=this.state,a=s.isResizing,i=s.direction,l=s.original;if(!(!a||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,i,this.resizable,u),this.props.size&&this.setState({width:(r=this.props.size.width)!==null&&r!==void 0?r:"auto",height:(o=this.props.size.height)!==null&&o!==void 0?o:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Zr(Zr({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var r,o;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(o=n.height)!==null&&o!==void 0?o:"auto"})},t.prototype.renderResizer=function(n){var r=this,o=this.props,s=o.enable,a=o.handleStyles,i=o.handleClasses,l=o.handleWrapperStyle,u=o.handleWrapperClass,d=o.handleComponent;if(!s)return null;var p=n.filter(function(f){return s[f]!==!1}).map(function(f){return s[f]!==!1?nt.createElement(b8,{key:f,direction:f,onResizeStart:r.onResizeStart,replaceStyles:a&&a[f],className:i&&i[f]},d&&d[f]?d[f]:null):null});return nt.createElement("div",{className:u,style:l},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,i){return E8.indexOf(i)!==-1||(a[i]=n.props[i]),a},{}),o=Zr(Zr(Zr({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&&(o.flexBasis=this.state.flexBasis);var s=this.props.as||"div";return nt.createElement(s,Zr({style:o,className:this.props.className},r,{ref:function(a){a&&(n.resizable=a)}}),this.state.isResizing&&nt.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}(nt.PureComponent);function fu({className:e,children:t,top:n,bottom:r,right:o,left:s,width:a,height:i,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,onResize:g,onResizeStop:m,...v}){const b={top:n||!1,right:o||!1,bottom:r||!1,left:s||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},w={width:a||"auto",height:i||"auto"},y=N("gs-utl-z-10",z.hBgAct),S={top:y,bottom:y,right:y,left:y},C={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(T8,{className:e,enable:v.enable??b,defaultSize:w,handleStyles:C,handleClasses:S,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:p,style:f,children:t})}const eh="gs-cmp-accordion",th=`${eh}-handler`,hu=`${th}__content`,P8=`${eh}-content`;function bo({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:r,style:o,handler:s,handlerIcon:a,children:i,inverted:l,disabled:u,sticky:d,onChange:p,open:f}){return c.jsx(Yd,{as:"div",defaultOpen:f,className:Z(eh,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(Yd.Button,{as:u?"div":"button",disabled:u,style:o,onClick:m=>p==null?void 0:p({event:m,open:!g}),className:({open:m})=>N(th,et(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(I,{items:"center",className:Z("gap-2"),full:!0,children:[c.jsx(B,{className:Z(hu,r,"text-left"),grow:!0,children:et(s)?s(m):c.jsxs(I,{items:"center",className:Z(`${hu}-wrp`,"gap-3"),nowrap:!0,children:[!!a&&c.jsx(re,{className:Z(`${hu}-icon`),icon:a,size:se.s2x}),c.jsx(B,{className:Z(`${hu}-label gs-utl-w-full`),children:s})]})}),c.jsx(B,{className:Z(`${th}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(re,{icon:q.chevronDown,className:Z("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(Yd.Panel,{className:Z(P8,n),children:i})]})})}const rl="gs-studio-panel",Cy=(e,t={})=>({...t,...e===!0?{}:e||void 0}),Er=h.memo(function({children:t,header:n,resizable:r,className:o,classNameAccordion:s,classNameAccordionContent:a,...i}){const l=c.jsx(xn,{className:N(rl,o),...i,children:t}),u=r?r===!0?{top:!0,right:!0,bottom:!0,left:!0}:r:void 0,d=u?c.jsx(fu,{className:N([`${rl}__resizer`]),...u,children:l}):l,p=n===!0?{collapsible:!0}:n||void 0;return p?c.jsx(bo,{classNameWrap:N(`${rl}__accordion`,s),className:N(`${rl}__accordion-header`,Pe.xy,p.className),classNameContent:N(`${rl}__accordion-content`,a),disabled:p.collapsible===!1,style:p.style,handler:c.jsxs(I,{space:"s",items:"center",children:[!!p.icon&&c.jsx(re,{icon:p.icon,size:se.s}),c.jsx(B,{grow:!0,children:p.label})]}),open:n?p.collapsed!==!0:!0,children:d}):d}),O8="gs-panel-assets",_8=h.memo(ce(function({className:t,onSelect:n,content:r,assets:o,types:s,providers:a,typeId:i,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:p,layoutAfterHeader:f,...g}){var x;const m=we(),v=Ai(),b=m.editor,w=(x=m.sdkOptions.assets)==null?void 0:x.layoutAfterHeader,y=f||w,[S]=h.useState(()=>g.id||zm());return h.useEffect(()=>(v.createAssetManager(S),()=>{v.removeAssetManager(S)}),[S]),wv(S)?c.jsx(Er,{className:N(O8,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...g,children:b&&c.jsx(g8,{panelId:S,assets:o,types:s,providers:a,onSelect:n,typeId:i,providerId:l,content:r,optionalType:u,optionalProvider:p??d,layoutAfterHeader:y})}):null}));var ol=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(ol||{}),Yr=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Yr||{});const xy="gs-block-item",Ey=ce(e=>{const{block:t,className:n,itemLayout:r,onClick:o,variant:s}=e,{editor:a}=we(),i=Ie(),[,l]=h.useState(0),u=i.tScoped("blockManager.labels"),d=t.getId(),p=!!t.get("full"),f=o||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),v=t.getMedia(),b=t.get("attributes")||{},w=u(d)||t.getLabel(),y=s==="compact",S=N(xy,`${xy}--${d}`,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?Oe.disabledM:N("gs-utl-cursor-pointer",z.hTAo,z.hBgH)),C=Vt(b.class)&&!y?b.class:N("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"),x=N("gs-utl-text-center",Oe.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!a)return;const{Blocks:A}=a,M=A.events.update,k=j=>j===t&&l(L=>++L);return a.on(M,k),()=>{a.off(M,k)}},[t,a]),!a)return null;const{Blocks:E}=a,O={className:S,...!g&&{onDragStart:()=>E.startDrag(t),onDragEnd:()=>E.endDrag(!1),draggable:!o},...!!f&&{onClick:()=>f(t,a)}},P=r==null?void 0:r({editor:a,block:t,attributes:O});return P&&kt(P)||c.jsxs(I,{items:"center",...O,children:[m||c.jsx("div",{className:C,dangerouslySetInnerHTML:{__html:v}}),c.jsx("div",{className:x,title:w,children:w})]})});function nh({className:e,value:t,onChange:n}){const[r,o]=h.useState(t),s=h.useRef(null),a=u=>{const{value:d}=u.target;o(d)},i=()=>{n(r||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(r||t);break}};return h.useEffect(()=>{s.current&&s.current.select()},[]),c.jsx("input",{autoFocus:!0,className:Z([e,"w-full",z.bgTr]),value:r,onChange:a,onBlur:i,onKeyDown:l,onPointerDown:hs,ref:s})}function Ty({className:e,value:t,active:n,unstyled:r,activable:o,onChange:s,onActive:a,...i}){const[l,u]=h.useState(n);h.useEffect(()=>{u(n)},[n]);const d=f=>{a==null||a(f),u(f)},p=f=>{s(f),d(!1)};return c.jsx("div",{className:Z("truncate",e),...i,onDoubleClick:()=>o&&d(!0),children:l?c.jsx(nh,{className:Z(r&&Oe.noFocusOut),value:t,onChange:p}):c.jsx(c.Fragment,{children:t})})}const Py=ae("text-sm w-full",Oe.txtEllips),A8=ce(({symbol:e,className:t})=>{const n=Fi(),{Components:r}=n,o=Ie(),s=xa(),a=o.tScoped("blockManager.symbols"),i=()=>{const{draggable:w,droppable:y,attributes:S,type:C,tagName:x}=e.attributes;n.Canvas.startDrag({content:()=>r.addSymbol(e),model:e,dragDef:{type:C,tagName:x,draggable:w,droppable:y,attributes:S}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),p=r.getSymbolInfo(e).instances.length,f=ae("h-10 w-10 block-media",z.grouphTAo),g=ae("gjs-pt-1 gjs-mt-2",te.bt,z.br),m=ae("cursor-pointer gjs-p-2 transition-colors group",te.b,te.rnd,z.br,z.hBgH,t),v=()=>{s.confirm({title:a("delete"),content:a("deleteConfirm"),onConfirm:()=>e.remove()})},b=w=>{e.set("custom-name",w)};return c.jsxs(I,{className:m,onDragStart:i,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:f,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(I,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(B,{children:c.jsx(I,{className:ae(Py,"gjs-mr-auto"),children:c.jsx(Ut,{title:`${p} ${a("instancesProject")}`,children:c.jsx(Zo,{label:`${p}`,className:ae(z.bgH75)})})})}),c.jsx(B,{className:ae("truncate"),grow:!0,title:d,children:c.jsx(Ty,{activable:!0,value:d,className:Py,onChange:b})}),c.jsx(B,{className:ae(Oe.hoverGroup),children:c.jsx(I,{justify:"end",full:!0,children:c.jsx(Ct,{onClick:v,title:a("delete"),border:!1,size:"",block:!0,children:c.jsx(re,{icon:q.delete,size:se.s})})})})]})]})}),ns="gs-block-manager",Oy={id:Yr.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>'},L8={id:Yr.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>'},M8={id:Yr.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>'},_y={id:Yr.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>'},Ay=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},Ly=e=>{const t=e.getContent();return et(t)?e.getDragDef():t},N8=e=>{const t=Ly(e);return Array.isArray(t)?t[0]:t},k8=ce(function({isOpen:t,className:n,hideCategories:r,target:o,variant:s,itemLayout:a,...i}){var Ue,tn;const{editor:l}=we(),u=Ie(),[d,p]=h.useState(0),[f,g]=h.useState(ol.REGULAR),[m,v]=h.useState(""),[b,w]=h.useState(""),y=h.useRef(new Set),[S,C]=h.useState((o==null?void 0:o.position)||Yr.after),[x,E]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),T=f===ol.SYMBOLS,_=h.useRef(null),O=u.tScoped("blockManager"),P=o==null?void 0:o.component;if(h.useEffect(()=>{if(!l)return;const{Blocks:he,Components:De}=l,Fe=he.events.custom,He=De.events.symbol,Mt=()=>{E(De.getSymbols()),p(Wt=>++Wt)};return l.on(He,Mt),l.on(Fe,Mt),()=>{l.off(He,Mt),l.off(Fe,Mt)}},[l]),h.useEffect(()=>{if(_.current&&t){const he=_.current.querySelector("input");setTimeout(()=>he==null?void 0:he.focus(),xd)}},[_.current,t]),!l)return null;const{Blocks:A,Components:M}=l,k=he=>O(`labels.${he.getId()}`)||he.getLabel(),j=x.filter(he=>Ys(he.getName(),m)),L=A.getAll().map(he=>he),D=((Ue=i.blocks)==null?void 0:Ue.call(i,{blocks:L}))||L,W=S===Yr.before,F=S===Yr.beforeInside,$=S===Yr.afterInside,H=S===Yr.after,V=!!(P!=null&&P.attributes.droppable),U=D.filter(he=>{const De=Ay(l,he.category);if(m&&!Ys(De,m)&&!Ys(k(he),m))return!1;if(P){const Fe=N8(he);if(V&&(F||$)){const He=F?0:void 0;return M.canMove(P,Fe,He).result}else if(W||H){const He=P.index(),Mt=P.parent(),Wt=W?He:He+1;return Mt&&M.canMove(Mt,Fe,Wt).result}}return!0}),J=A.getBlocksByCategory(U),Y=r?U:(tn=J.find(he=>!he.category))==null?void 0:tn.items,X=r?[]:J.filter(he=>he.category),Q=i.symbols!==!1,ee=i.search!==!1,G=!Q&&!ee,R=s==="compact",le=O("search")||u.t("search"),ge=N(ns,n,"gap-2"),Te=N(`${ns}__header`,"gs-utl-pt-2",Pe.xS,G&&"gs-utl-hidden"),Ce=N(`${ns}__content`,Oe.scrollY,z.br,te.bt),tt=N(`${ns}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Qe=N(`${ns}__not-found`,"gs-utl-text-center gs-utl-p-4"),Ot=N(`${ns}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",R?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),ut=N(`${ns}__no-category`,Ot,z.br,X.length&&te.bb),Se=N(z.tAo,z.bgH75,te.bA),ot=`${ns}__category`,st=[{id:ol.REGULAR,label:O("types.regular")},{id:ol.SYMBOLS,label:O("types.symbols")}],wt=V?[Oy,L8,M8,_y]:[Oy,_y],Ne=P?he=>{const De=Ly(he);if(!De)return;let Fe;if(F||$){const He=F?0:void 0;Fe=P.append(De,{at:He})[0]}else if(W||H){const He=P.index(),Mt=P.parent(),Wt=W?He:He+1;Fe=Mt==null?void 0:Mt.append(De,{at:Wt})[0]}if(Fe){const{activate:He,select:Mt}=he.attributes;Mt||He&&Mt!==!1?l.em.setSelected(Fe,{activate:He}):He&&Fe.trigger("active")}}:void 0,mt=he=>{if(!P)return;const De=Array.from(y.current);if(he.key==="ArrowDown")he.preventDefault(),w(Fe=>{const He=De.indexOf(Fe);return De.at(Math.min(He+1,De.length-1))||""});else if(he.key==="ArrowUp")he.preventDefault(),w(Fe=>{const He=De.indexOf(Fe);return De.at(Math.max(He-1,0))||""});else if(he.key==="Enter"&&b){const Fe=A.get(b);Fe&&(Ne==null||Ne(Fe))}},dt=he=>{y.current.clear(),v(he)};return c.jsxs(I,{className:ge,col:!0,full:!0,children:[c.jsxs(I,{className:Te,gap:"s",col:!0,children:[Q&&c.jsx(Yo,{tabs:st,onChange:g,value:f,variant:"pills"}),P&&c.jsx(Rt,{size:"s",options:wt,value:S,onChange:he=>C(he)}),ee&&c.jsx(rt,{ref:_,size:"s",value:m,onInput:dt,onKeyDown:mt,placeholder:le,type:"search"})]}),c.jsxs(B,{className:Ce,grow:!0,children:[T&&(j.length?c.jsx(I,{className:tt,children:j.map(he=>c.jsx(A8,{symbol:he},`${d}_${he.getId()}`))}):c.jsx(I,{className:Qe,justify:"center",children:O("symbols.notFound")})),!T&&(U.length?c.jsxs(c.Fragment,{children:[!!(Y!=null&&Y.length)&&c.jsx(I,{className:ut,children:Y==null?void 0:Y.map(he=>(y.current.add(`${he.id}`),c.jsx(Ey,{block:he,itemLayout:a,onClick:Ne,variant:s,className:N(b===he.id&&Se)},he.id)))}),X.map(({category:he,items:De},Fe)=>c.jsx(bo,{sticky:!0,className:He=>Td.itemList({index:Fe,open:He,length:X.length}),open:!!(he!=null&&he.get("open")),onChange:({open:He})=>he==null?void 0:he.set({open:He}),handler:Ay(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:N(ot,`${ot}--${he==null?void 0:he.id}`),children:c.jsx(I,{className:Ot,children:De.map(He=>(y.current.add(`${He.id}`),c.jsx(Ey,{block:He,itemLayout:a,onClick:Ne,variant:s,className:N(b===He.id&&Se)},He.id)))})},he==null?void 0:he.id))]}):c.jsx(I,{className:Qe,justify:"center",children:O("notFound")}))]})]})}),$8=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-after"),n),ref:o,...r,children:t})}),I8=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-block-manager-before"),n),ref:o,...r,children:t})}),V8="gs-panel-blocks",H8=h.memo(ce(function({className:t,symbols:n,search:r,hideCategories:o,target:s,variant:a,blocks:i,itemLayout:l,...u}){const d=we().sdkProps.children,p={search:r,symbols:n,hideCategories:o,isOpen:!0,target:s,variant:a,blocks:i,itemLayout:l};return c.jsx(Er,{className:N(V8,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(Bi,{children:[Qn(d,I8),c.jsx(k8,{className:N("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...p}),Qn(d,$8)]})})})),j8="gs-cmp-color-picker",D8={backgroundSize:"10px"},F8=[0,15];function My({className:e,value:t,onChange:n,disabled:r}){const[o,s]=h.useState(!1),a=N(`${j8}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,te.b,te.rnd,z.br),i=()=>{s(!1)},l=c.jsxs("div",{style:D8,className:a,children:[o&&c.jsx("div",{onPointerUp:i,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(Cr,{handler:l,title:"Color",size:"s",placement:"left-end",offset:F8,clickAway:!0,disabled:r,children:c.jsx(oy,{value:t,onChange:n,disabled:r})})}const B8="gs-cmp-color-field";function yo(e){const{className:t,value:n,placeholder:r,preventSubmitOnEnter:o=!1,onChange:s,labelAs:a,disabled:i}=e,[l,u]=h.useState($c(n)),d=Di(e);h.useEffect(()=>{u($c(n))},[n]);const p=(v,b)=>{s==null||s(v,b)},f=v=>{switch(v.key){case"Escape":return u(n);case"Enter":p(l),o&&(v.preventDefault(),v.stopPropagation())}},g=()=>{p(l)},m=qo({...e,className:N(B8,t)});return c.jsxs("div",{...m,children:[c.jsx(wr,{...e,as:a}),c.jsxs(I,{className:tf(e),items:"center",space:"s",children:[c.jsx(B,{children:c.jsx(My,{value:n,onChange:s,disabled:i})}),c.jsx(B,{grow:!0,children:c.jsx("input",{className:N(d,i&&"gs-utl-pointer-events-none"),value:l,onChange:v=>u(v.target.value),placeholder:r,onBlur:g,onKeyDown:f,disabled:i})})]})]})}const z8=(e,t)=>{t.runCommand(ne.fontAdd,{font:e})},rh=(e,{onSelect:t,...n}={})=>{const r="font",a=e.runCommand(ne.assetProviderGet).filter(i=>ct(i.types)?i.types===r:i.types.includes(r))[0];if(!a){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:r,providerId:a.id,onSelect:i=>{const l=i.assetProps;z8(l.customData.font,e),t==null||t(i)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},gu=ce(e=>{const{buttonClassName:t,value:n,...r}=e,{editor:o}=we(),s=Ie(),a=Ai(),i=Li(),l=[...r.options||[],...i.fontFamilyOptions].map(u=>{const d=i.getFont(u.id),p=d?$p(d):u.id;return{...u,content:c.jsx(I,{col:!0,children:c.jsx(B,{style:{fontFamily:p},children:u.label})})}});return c.jsx(Le,{...r,value:$s(n),options:l,afterLabel:i.sdkAddFonts&&a.hasType("font")&&c.jsx(Ct,{className:t,title:s.t("fontManager.addFontToProject"),icon:q.plus,size:"xs",border:!1,block:!0,onClick:()=>o&&rh(o,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;r.onChange($s(d.family))}})})})}),U8=(e,{t,id:n})=>t(`fields.${n}.label`)||_r(`${e}`.replace(/-/g," ")),Ny=(e,{t,id:n})=>{const r=ct(e)?{id:e,label:e}:e;return{...r,label:t(`fields.${n}.options.${r.id}`)||r.label}},ky=e=>e.get("defaultValue")||"",sl=e=>e.get("field"),$y=e=>{const t=sl(e);return ct(t)?{type:t}:t},Iy=e=>`${e.get("value")||ky(e)||$y(e).defaultValue||""}`,W8=(e,t)=>e||ky(t)||"",al=({record:e,value:t,partial:n})=>{e.set({value:W8(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},il=(e,t)=>{const{className:n,defaultValue:r,size:o,...s}=$y(e),a=r??e.get("defaultValue");return{...s,hasClear:()=>{const i=e.get("value");return!!i&&Vt(a)&&i!==a},className:N(n,"gs-utl-w-full"),size:o||"s",value:Iy(e),label:U8(e.get("label")||e.id||"",t),onChange:(i,l)=>al({record:e,value:i,partial:l})}},G8=(e,t)=>{const n=sl(e),r=to(n)?n:void 0,o=(r==null?void 0:r.units)||[],s=T6(Iy(e)),a=s.number,i=s.unit||o[0]||"";return{...il(e,t),value:a,valueUnit:i,min:r==null?void 0:r.min,max:r==null?void 0:r.max,step:r==null?void 0:r.step,units:r==null?void 0:r.units,onChange:(l,u)=>{al({value:l?`${l}${i}`:"",record:e,partial:u})},onChangeUnit:l=>{al({value:a?`${a}${l}`:"",record:e})}}},Vy=(e,t)=>{var s;const n=sl(e),r=to(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Ny(a,t)))||[];return{...il(e,t),options:o,onChange:a=>al({value:a,record:e})}},q8=(e,t)=>({...il(e,t),onChange:n=>al({value:n,record:e})}),K8=(e,t)=>{var s;const n=sl(e),r=to(n)?n:void 0,o=((s=r==null?void 0:r.options)==null?void 0:s.map(a=>Ny(a,t)))||[];return{...Vy(e,t),size:"s",options:o}};function Z8(e,t){const n=sl(e);switch(ct(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(Rt,{...K8(e,t)});case"select":return c.jsx(Le,{...Vy(e,t)});case"selectFont":{const o=q8(e,t);return c.jsx(gu,{...o,labelAs:"div"})}case"number":return c.jsx(ke,{...G8(e,t)});case"color":return c.jsx(yo,{...il(e,t)});default:return c.jsx(rt,{...il(e,t)})}}const Hy="gs-cmp-global-style-field",Y8=ce(function({record:t}){const n=we(),o=Ie().tScoped("globalStyleManager"),[,s]=h.useState(0),a=n.editor,i=t.id,l={t:o,id:i};return h.useEffect(()=>{if(!a)return;const u=`data:path:${t.getPath("value")}`,d=()=>s(p=>++p);return a.on(u,d),()=>{a.off(u,d)}},[a]),c.jsx(I,{className:N(Hy,`${Hy}__${i}`),children:Z8(t,l)})}),ll="gs-cmp-global-style-manager",jy=({items:e,category:t,className:n})=>{const r=N(t?`${ll}__cat-fields--${t.id}`:`${ll}__uncat-fields`,"gs-utl-gap-2",Pe.xy,n);return c.jsx(I,{className:r,nowrap:!0,col:!0,children:e.map(o=>c.jsx(Y8,{record:o},o.id))})},X8=ce(function(){const t=gL(),{recordsByCategory:n,openCategories:r}=t,s=Ie().tScoped("globalStyleManager");return c.jsx(I,{col:!0,full:!0,nowrap:!0,className:N(ll,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(I,{col:!0,nowrap:!0,className:N(`${ll}__fields`,Oe.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:a,items:i},l)=>a?c.jsx(bo,{sticky:!0,open:r.get(a.id)??a.open,handler:s(`categories.${a.id}.label`)||a.label||a.id,onChange:({open:u})=>t.setCategoryOpen(a.id,u),className:u=>N(`${ll}__cat-fields`,Td.itemList({index:l,open:u,length:n.length}),l===0&&te.bt),children:c.jsx(jy,{category:a,items:i})},a.id):c.jsx(jy,{items:i,className:N(n.length!==1&&[te.bt,z.br])},l)):c.jsx(I,{className:N("gs-utl-text-center"),justify:"center",children:s("notFound")})})})}),J8="gs-panel-global-styles",Q8=h.memo(ce(function({className:t,...n}){return c.jsx(Er,{className:N(J8,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Bi,{children:c.jsx(X8,{})})})})),R8={maxWidth:`${YS}px`},eI="gs-cmp-layer-item";function Dy({component:e,draggingCmp:t,dragParent:n,...r}){const o=Fi(),{Layers:s}=o,a=h.useRef(null),[i,l]=h.useState(!1),[u,d]=h.useState(s.getLayerData(e)),{open:p,selected:f,hovered:g,components:m,visible:v,locked:b,name:w}=u,y=m.map(F=>F.cid),S=t===e,C=y.join("-"),x=r.level+1,E=g||n===e;h.useEffect(()=>{x===0&&d(s.getLayerData(e)),a.current&&(a.current.__cmp=e)},[e]),h.useEffect(()=>{const F=a.current;if(!F)return;const{select:$}=o.Components.events,H=V=>V===e&&F.scrollIntoView({block:"nearest"});return o.on($,H),()=>{o.off($,H)}},[e,a.current]),h.useEffect(()=>{const F=H=>{H===e&&d(s.getLayerData(H))},$=s.events.component;return o.on($,F),()=>{o.off($,F)}},[o,s,e]);const T=h.useMemo(()=>m.map(F=>c.jsx(Dy,{component:F,level:x,draggingCmp:t,dragParent:n},F.cid)),[C,t,n]),_=F=>{s.setLayerData(e,{name:F}),l(!1)},O=F=>{F.stopPropagation(),s.setLayerData(e,{open:!p})},P=F=>{F.stopPropagation(),s.setLayerData(e,{visible:!v})},A=F=>{F.stopPropagation(),s.setLayerData(e,{locked:!b})},M=F=>{F.stopPropagation(),s.setLayerData(e,{selected:!0},{event:F})},k=F=>{F.preventDefault(),o.runCommand(ne.contextMenuComponent,{source:Np.layers,component:e,event:F.nativeEvent,x:F.clientX,y:F.clientY})},j=F=>{(!F||!t)&&s.setLayerData(e,{hovered:F})},L=P1(e),D=Z("layer-item",(f||L.isSymbol)&&L.bgSoftX,(!v||S)&&"opacity-50"),W=Z(Pe.xyS,te.b,E?L.border:te.bT,f&&L.bgSoft);return c.jsx("div",{className:eI,children:c.jsxs(I,{col:!0,className:D,children:[c.jsx(B,{onClick:M,onContextMenu:k,onMouseEnter:()=>j(!0),onMouseLeave:()=>j(!1),className:Z("group max-w-full"),"data-layer-item":!0,ref:a,children:c.jsxs(I,{items:"center",space:"xs",className:W,children:[c.jsx(B,{style:{marginLeft:`${x*10}px`},className:Z("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:O,children:c.jsx(re,{icon:q.menuDown,size:se.sx,rotate:p?0:-90})}),c.jsx(B,{children:lv(e)}),c.jsx(B,{className:Z("truncate"),onDoubleClick:()=>l(!0),style:R8,grow:!0,children:i?c.jsx(nh,{value:w,onChange:_}):c.jsx(c.Fragment,{children:w})}),!i&&c.jsxs(c.Fragment,{children:[c.jsx(B,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-100":"opacity-0"),onClick:A,children:c.jsx(re,{icon:b?q.lock:q.lockOpenVariant,size:se.s3x})}),c.jsx(B,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-0":"opacity-100"),onClick:P,children:c.jsx(re,{icon:v?q.eyeOutline:q.eyeOffOutline,size:se.sx})})]})]})}),!!(p&&m.length)&&c.jsx(B,{className:Z("max-w-full",!p&&"hidden"),children:T})]})})}const tI={touchAction:"none"},Fy=5,nI=e=>{var s,a;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),r=n==null?void 0:n.__cmp,o=((a=(s=r==null?void 0:r.delegate)==null?void 0:s.move)==null?void 0:a.call(s,r))||r;return{el:n,cmp:o}},By=ce(function({root:t,header:n}){const{editor:r}=we(),[o,s]=h.useState(!1),[a,i]=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 O=window.document,P=A=>{A.key==="Escape"&&(i({...a,result:!1}),C())};return O.addEventListener("keydown",P),()=>{O.removeEventListener("keydown",P)}},[]),!r)return null;const{Components:w}=r,y=O=>{O.button===0&&s(!0)},S=O=>{if(!o)return;const{cmp:P,el:A}=nI(O);if(!A||!P)return;const M=A.getBoundingClientRect(),k=A.offsetHeight,j=A.offsetTop,L=O.clientY,D=L<M.y+k/2,W=d||P,F=P.parent(),$=P.index()+(D?0:1);!d&&p(P),u(P);const H=w.canMove(F,W,$),V=w.canMove(P,W),U={...H,canMoveInside:V,index:$};let J=!1;V.result&&L>M.y+Fy&&L<M.y+k-Fy&&(J=!0,U.target=P,delete U.index),g(J?P:void 0),i(U),v({pointerInside:J,y:j+(D?0:k),h:k})},C=()=>{var O;a!=null&&a.result&&((O=a.source)==null||O.move(a.target,{at:a.index})),i({}),s(!1),p(void 0),u(void 0),g(void 0),v(void 0)},x=(l?l.parents():[]).length,E=!!(d&&m&&(a!=null&&a.result)&&!m.pointerInside),T=E?{top:m.y,left:0,marginLeft:x*10+20}:{},_=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(I,{col:!0,full:!0,nowrap:!0,className:Z("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(B,{children:c.jsxs(I,{space:"s",items:"center",className:Z([Pe.xy,te.bb,z.br]),children:[c.jsx(B,{children:c.jsx(re,{icon:q.layers,size:se.s})}),c.jsx(B,{grow:!0,children:_})]})}),c.jsxs(B,{className:Z("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:tI,onPointerDown:y,onPointerMove:S,onPointerUp:C,grow:!0,children:[!!t&&c.jsx(Dy,{component:t,level:-1,draggingCmp:d,dragParent:f}),E&&c.jsx("div",{ref:b,className:Z("absolute w-full gs-utl-h-0.5",z.cmp),style:T})]})]})}),zy=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-after"),n),ref:o,...r,children:t})}),Uy=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-layer-manager-before"),n),ref:o,...r,children:t})}),rI="gs-panel-layers",Wy=h.memo(ce(function({className:t,...n}){const r=we().sdkProps.children;return c.jsx(Er,{className:N(rI,"gs-utl-overflow-auto",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Pb,{children:o=>c.jsxs(c.Fragment,{children:[Qn(r,Uy),c.jsx(By,{...o,header:!1}),Qn(r,zy)]})})})})),Us="gs-cmp-file-field";function cl(e){var x;const{className:t,value:n,btnLabel:r,nameLabel:o,size:s,isContain:a,clear:i,inputField:l,placeholder:u,preview:d=50,disabled:p,hideButton:f,labelAs:g,onChange:m,onOpen:v}=e,b=(n||"").replace(/^"|"$/gi,""),w=((x=b.split("/").pop())==null?void 0:x.split("?")[0])||"",y={minWidth:d,minHeight:d},S=b?{...y,backgroundImage:`url("${b}")`}:y,C=N(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",a?"gs-utl-bg-contain":"gs-utl-bg-cover",te.b,te.rnd,z.br);return c.jsxs(I,{className:N(Us,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(wr,{...e,as:g}),c.jsxs(I,{className:N(`${Us}-content gs-utl-gap-1`,z.bg),items:"center",nowrap:!0,children:[c.jsx(B,{className:N(`${Us}-preview`),children:c.jsx("div",{className:C,style:S})}),c.jsxs(B,{className:N(`${Us}-fields gs-utl-overflow-hidden`),grow:!0,children:[w&&o!==!1&&c.jsx(Go,{className:N(`${Us}-name`,"gs-utl-mb-2",Oe.txtEllips),as:"div",size:s,capitalize:!1,children:w}),c.jsxs(I,{className:N(`${Us}-buttons`),space:"s",nowrap:!0,children:[!f&&c.jsx(Ke,{onClick:()=>v==null?void 0:v(n),size:s,type:"button",block:!0,full:!0,disabled:p,children:r||"Select image"}),!!n&&i&&c.jsx(Ct,{onClick:()=>m==null?void 0:m(""),title:i.tooltip,size:s,icon:{icon:q.close,size:se.s},type:"button",block:!0})]})]})]}),l&&c.jsx(rt,{className:N(`${Us}-input`),value:b,onChange:m,size:s,placeholder:u})]})}function oI(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const mu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function $a(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function oh(e){return"nodeType"in e}function rs(e){var t,n;return e?$a(e)?e:oh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function sh(e){const{Document:t}=rs(e);return e instanceof t}function Ia(e){return $a(e)?!1:e instanceof rs(e).HTMLElement}function Gy(e){return e instanceof rs(e).SVGElement}function Va(e){return e?$a(e)?e.document:oh(e)?sh(e)?e:Ia(e)||Gy(e)?e.ownerDocument:document:document:document}const Ws=mu?h.useLayoutEffect:h.useEffect;function sI(e){const t=h.useRef(e);return Ws(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function aI(){const e=h.useRef(null),t=h.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ul(e,t){const n=h.useRef();return h.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function ah(e){const t=sI(e),n=h.useRef(null),r=h.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}let ih={};function dl(e,t){return h.useMemo(()=>{if(t)return t;const n=ih[e]==null?0:ih[e]+1;return ih[e]=n,e+"-"+n},[e,t])}function qy(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((s,a)=>{const i=Object.entries(a);for(const[l,u]of i){const d=s[l];d!=null&&(s[l]=d+e*u)}return s},{...t})}}const pl=qy(1),Ky=qy(-1);function iI(e){return"clientX"in e&&"clientY"in e}function lI(e){if(!e)return!1;const{KeyboardEvent:t}=rs(e.target);return t&&e instanceof t}function cI(e){if(!e)return!1;const{TouchEvent:t}=rs(e.target);return t&&e instanceof t}function lh(e){if(cI(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 iI(e)?{x:e.clientX,y:e.clientY}:null}const fl=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[fl.Translate.toString(e),fl.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),uI={display:"none"};function dI(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:uI},n)}function pI(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={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:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function fI(){const[e,t]=h.useState("");return{announce:h.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const hI={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
- `},dI={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 gt;(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"})(gt||(gt={}));function lh(...e){}class pl 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,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const mu=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:lh,draggableNodes:{},droppableRects:new Map,droppableContainers:new pl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:lh},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:lh,windowRect:null,willRecomputeLayouts:!1});function fI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new pl}}}function pI(e,t){switch(t.type){case gt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case gt.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 gt.DragEnd:case gt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case gt.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new pl(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case gt.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new pl(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case gt.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new pl(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}const Zy=h.createContext({type:null,event:null});function hI({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:o}){const s=h.useContext(Zy),a=h.useRef(s);h.useEffect(()=>{if(s!==a.current){const{type:i,event:l}=s;switch(i){case gt.DragStart:e==null||e(l);break;case gt.DragMove:t==null||t(l);break;case gt.DragOver:n==null||n(l);break;case gt.DragCancel:o==null||o(l);break;case gt.DragEnd:r==null||r(l);break}a.current=s}},[s,e,t,n,r,o])}function gI({announcements:e=dI,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:r,announcement:o}=cI(),s=ul("DndLiveRegion"),[a,i]=h.useState(!1);return h.useEffect(()=>{i(!0)},[]),hI(h.useMemo(()=>({onDragStart({active:l}){r(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&r(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){r(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){r(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){r(e.onDragCancel(l.id))}}),[r,e])),a?Fn.createPortal(h.createElement(h.Fragment,null,h.createElement(iI,{id:t,value:n.draggable}),h.createElement(lI,{id:s,announcement:o})),document.body):null}const bo=Object.freeze({x:0,y:0});function Yy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xy(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const mI=({collisionRect:e,droppableContainers:t})=>{const n=Xy(e,e.left,e.top);let r=1/0,o=null;for(const s of t){const{rect:{current:a}}=s;if(a){const i=Yy(Xy(a),n);i<r&&(r=i,o=s.id)}}return o};function vI(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function bI(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:bo}function yI(e){return function(n,...r){return r.reduce((o,s)=>({...o,top:o.top+e*s.y,bottom:o.bottom+e*s.y,left:o.left+e*s.x,right:o.right+e*s.x,offsetLeft:o.offsetLeft+e*s.x,offsetTop:o.offsetTop+e*s.y}),{...n})}}const Jy=yI(1);function wI(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function SI(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})!=null}function ch(e){const t=[];function n(r){if(!r)return t;if(oh(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!ka(r)||Gy(r)||t.includes(r))return t;const o=window.getComputedStyle(r);return SI(r,o)&&t.push(r),wI(r,o)?t:n(r.parentNode)}return e?n(e.parentNode):t}function uh(e){return!gu||!e?null:$a(e)?e:rh(e)?oh(e)||e===Ia(e).scrollingElement?window:ka(e)?e:null:null}function dh(e){return $a(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var Va;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Va||(Va={}));function Qy(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},r=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:r,isLeft:o,isBottom:s,isRight:a,maxScroll:n,minScroll:t}}function CI(e){return!gu||!e?!1:e===document.scrollingElement}const xI={x:.2,y:.2};function EI(e,t,{top:n,left:r,right:o,bottom:s},a=10,i=xI){const{clientHeight:l,clientWidth:u}=e,d=CI(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:f,isBottom:p,isLeft:g,isRight:m}=Qy(e),v={x:0,y:0},b={x:0,y:0},w={height:d.height*i.y,width:d.width*i.x};return!f&&n<=d.top+w.height?(v.y=Va.Backward,b.y=a*Math.abs((d.top+w.height-n)/w.height)):!p&&s>=d.bottom-w.height&&(v.y=Va.Forward,b.y=a*Math.abs((d.bottom-w.height-s)/w.height)),!m&&o>=d.right-w.width?(v.x=Va.Forward,b.x=a*Math.abs((d.right-w.width-o)/w.width)):!g&&r<=d.left+w.width&&(v.x=Va.Backward,b.x=a*Math.abs((d.left+w.width-r)/w.width)),{direction:v,speed:b}}function TI(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Ry(e){return e.reduce((t,n)=>dl(t,dh(n)),bo)}function ew(e,t,n=bo){if(!e||!ka(e))return n;const r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:ew(e.offsetParent,t,r)}function vu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=ew(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function bu(e){if($a(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}=vu(e),{width:r,height:o,top:s,bottom:a,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:s,bottom:a,right:l,left:i,offsetTop:t,offsetLeft:n}}function fh(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=vu(e),s=ch(e),a=Ry(s),i=r-a.y,l=o-a.x;return{width:t,height:n,top:i,bottom:i+n,right:l+t,left:l,offsetTop:r,offsetLeft:o}}function tw(e){return"top"in e}function nw(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 PI=({collisionRect:e,droppableContainers:t})=>{let n=1/0,r=null;const o=nw(e,e.left,e.top);for(const s of t){const{rect:{current:a}}=s;if(a){const i=nw(a,tw(a)?a.left:void 0,tw(a)?a.top:void 0),l=o.reduce((d,f,p)=>d+Yy(i[p],f),0),u=Number((l/4).toFixed(4));u<n&&(n=u,r=s.id)}}return r};function OI(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),s=Math.min(t.top+t.height,e.offsetTop+e.height),a=o-r,i=s-n;if(r<o&&n<s){const l=t.width*t.height,u=e.width*e.height,d=a*i,f=d/(l+u-d);return Number(f.toFixed(4))}return 0}const _I=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const o of t){const{rect:{current:s}}=o;if(s){const a=OI(s,e);a>n&&(n=a,r=o.id)}}return r};var hl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(hl||(hl={}));var yu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(yu||(yu={}));function AI({acceleration:e,activator:t=hl.Pointer,canScroll:n,draggingRect:r,enabled:o,interval:s=5,order:a=yu.TreeOrder,pointerCoordinates:i,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[f,p]=nI(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case hl.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case hl.DraggableRect:return r}return null},[t,r,i]),v=h.useRef(bo),b=h.useRef(null),w=h.useCallback(()=>{const S=b.current;if(!S)return;const C=g.current.x*v.current.x,x=g.current.y*v.current.y;S.scrollBy(C,x)},[]),y=h.useMemo(()=>a===yu.TreeOrder?[...l].reverse():l,[a,l]);h.useEffect(()=>{if(!o||!l.length||!m){p();return}for(const S of y){if((n==null?void 0:n(S))===!1)continue;const C=l.indexOf(S),x=u[C];if(!x)continue;const{direction:E,speed:T}=EI(S,x,m,e,d);if(T.x>0||T.y>0){p(),b.current=S,f(w,s),g.current=T,v.current=E;return}}g.current={x:0,y:0},v.current={x:0,y:0},p()},[e,w,n,p,o,s,JSON.stringify(m),f,l,y,u,JSON.stringify(d)])}function LI(e,t){const n=t!==null?e[t]:void 0,r=n?n.node.current:null;return cl(o=>{var s;return t===null?null:(s=r??o)!=null?s:null},[r,t])}function MI(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}function rw(e){const t=h.useRef(e);return Us(()=>{t.current!==e&&(t.current=e)},[e]),t}var gl;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(gl||(gl={}));var ph;(function(e){e.Optimized="optimized"})(ph||(ph={}));const ow=new Map,NI={measure:vu,strategy:gl.WhileDragging,frequency:ph.Optimized};function $I(e,{dragging:t,dependencies:n,config:r}){const[o,s]=h.useState(!1),{frequency:a,measure:i,strategy:l}={...NI,...r},u=h.useRef(e),d=h.useCallback(()=>s(!0),[]),f=h.useRef(null),p=m(),g=cl(v=>{if(p&&!t)return ow;if(!v||v===ow||u.current!==e||o){for(let b of e)b&&(b.rect.current=b.node.current?i(b.node.current):null);return kI(e)}return v},[e,t,p,i,o]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{o&&s(!1)},[o]),h.useEffect(function(){p||requestAnimationFrame(d)},[t,p]),h.useEffect(function(){p||typeof a!="number"||f.current!==null||(f.current=setTimeout(()=>{d(),f.current=null},a))},[a,p,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:o};function m(){switch(l){case gl.Always:return!1;case gl.BeforeDragging:return t;default:return!t}}}function kI(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:r,rect:o}=n;o.current!=null&&t.set(r,o.current)}return t}function II(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(s=>{const a=uh(s.target);a&&n(i=>i?(i.set(a,dh(a)),new Map(i)):null)},[]);return h.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=uh(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,dh(u)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(s)};function a(i){i.forEach(l=>{const u=uh(l);u==null||u.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>dl(s,a),bo):Ry(e):bo,[e,t])}const VI=[];function HI(e){const t=h.useRef(e),n=cl(r=>e?r&&e&&t.current&&e.parentNode===t.current.parentNode?r:ch(e):VI,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function jI(e){h.useEffect(()=>{if(!gu)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 DI(e,t){return h.useMemo(()=>e.reduce((n,{eventName:r,handler:o})=>(n[r]=s=>{o(s,t)},n),{}),[e,t])}const hh=aw(bu),FI=BI(bu);function sw(e,t,n){const r=h.useRef(e);return cl(o=>e?n||!o&&e||e!==r.current?ka(e)&&e.parentNode==null?null:t(e):o??null:null,[e,n,t])}function aw(e){return(t,n)=>sw(t,e,n)}function BI(e){const t=[];return function(r,o){const s=h.useRef(r);return cl(a=>r.length?o||!a&&r.length||r!==s.current?r.map(i=>e(i)):a??t:t,[r,o])}}function zI(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ka(t)?t:e}function UI(e){const{width:t,height:n,offsetLeft:r,offsetTop:o}=vu(e);return{top:o,bottom:o+n,left:r,right:r+t,width:t,height:n,offsetTop:o,offsetLeft:r}}const WI=aw(UI);function GI({disabled:e,forceRecompute:t}){const[n,r]=sh(),o=WI(e?null:zI(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:o,setRef:r}),[o,n,r])}function iw(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function qI(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class ml{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})}}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function KI(e){const{EventTarget:t}=ns(e);return e instanceof t?e:Ia(e)}function gh(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var tr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(tr||(tr={}));function lw(e){e.preventDefault()}function ZI(e){e.stopPropagation()}var qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(qe||(qe={}));const cw={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter]},YI=(e,{currentCoordinates:t})=>{switch(e.code){case qe.Right:return{...t,x:t.x+25};case qe.Left:return{...t,x:t.x-25};case qe.Down:return{...t,y:t.y+25};case qe.Up:return{...t,y:t.y-25}}};class mh{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=bo;const{event:{target:n}}=t;this.props=t,this.listeners=new ml(Ia(n)),this.windowListeners=new ml(ns(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(tr.Resize,this.handleCancel),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(tr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const r=bu(t.node.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)}handleKeyDown(t){if(oI(t)){const{coordinates:n}=this,{active:r,context:o,options:s}=this.props,{keyboardCodes:a=cw,coordinateGetter:i=YI,scrollBehavior:l="smooth"}=s,{code:u}=t;if(a.end.includes(u)){this.handleEnd(t);return}if(a.cancel.includes(u)){this.handleCancel(t);return}const d=i(t,{active:r,context:o.current,currentCoordinates:n});if(d){const f={x:0,y:0},{scrollableAncestors:p}=o.current;for(const g of p){const m=t.code,v=Ky(d,n),{isTop:b,isRight:w,isLeft:y,isBottom:S,maxScroll:C,minScroll:x}=Qy(g),E=TI(g),T={x:Math.min(m===qe.Right?E.right-E.width/2:E.right,Math.max(m===qe.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(m===qe.Down?E.bottom-E.height/2:E.bottom,Math.max(m===qe.Down?E.top:E.top+E.height/2,d.y))},_=m===qe.Right&&!w||m===qe.Left&&!y,O=m===qe.Down&&!S||m===qe.Up&&!b;if(_&&T.x!==d.x){if(m===qe.Right&&g.scrollLeft+v.x<=C.x||m===qe.Left&&g.scrollLeft+v.x>=x.x){g.scrollBy({left:v.x,behavior:l});return}f.x=m===qe.Right?g.scrollLeft-C.x:g.scrollLeft-x.x,g.scrollBy({left:-f.x,behavior:l});break}else if(O&&T.y!==d.y){if(m===qe.Down&&g.scrollTop+v.y<=C.y||m===qe.Up&&g.scrollTop+v.y>=x.y){g.scrollBy({top:v.y,behavior:l});return}f.y=m===qe.Down?g.scrollTop-C.y:g.scrollTop-x.y,g.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,dl(d,f))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(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()}}mh.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=cw,onActivation:n})=>{const{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function uw(e){return!!(e&&"distance"in e)}function dw(e){return!!(e&&"delay"in e)}class vh{constructor(t,n,r=KI(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=Ia(s),this.documentListeners=new ml(this.document),this.listeners=new ml(r),this.windowListeners=new ml(ns(s)),this.initialCoordinates=ih(o),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(tr.Resize,this.handleCancel),this.windowListeners.add(tr.DragStart,lw),this.windowListeners.add(tr.VisibilityChange,this.handleCancel),this.windowListeners.add(tr.ContextMenu,lw),this.documentListeners.add(tr.Keydown,this.handleKeydown),n){if(uw(n))return;if(dw(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(tr.Click,ZI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(tr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:r,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!r)return;const i=ih(t),l=Ky(r,i);if(!n&&a){if(dw(a))return gh(l,a.tolerance)?this.handleCancel():void 0;if(uw(a))return a.tolerance!=null&&gh(l,a.tolerance)?this.handleCancel():gh(l,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(i)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const XI={move:{name:"pointermove"},end:{name:"pointerup"}};class bh extends vh{constructor(t){const{event:n}=t,r=Ia(n.target);super(t,XI,r)}}bh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const JI={move:{name:"mousemove"},end:{name:"mouseup"}};var yh;(function(e){e[e.RightClick=2]="RightClick"})(yh||(yh={}));class QI extends vh{constructor(t){super(t,JI,Ia(t.event.target))}}QI.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===yh.RightClick?!1:(t==null||t({event:e}),!0)}];const wh={move:{name:"touchmove"},end:{name:"touchend"}};class RI extends vh{constructor(t){super(t,wh)}static setup(){return window.addEventListener(wh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(wh.move.name,t)};function t(){}}}RI.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function e9(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((r,o)=>o({transform:r,...n}),t):t}const t9=[{sensor:bh,options:{}},{sensor:mh,options:{}}],n9={current:{}},fw=h.createContext({...bo,scaleX:1,scaleY:1}),r9=h.memo(function({id:t,autoScroll:n=!0,announcements:r,children:o,sensors:s=t9,collisionDetection:a=_I,measuring:i,modifiers:l,screenReaderInstructions:u=uI,...d}){var f,p,g,m,v;const b=h.useReducer(pI,void 0,fI),[w,y]=b,[S,C]=h.useState(()=>({type:null,event:null})),[x,E]=h.useState(!1),{draggable:{active:T,nodes:_,translate:O},droppable:{containers:P}}=w,A=T?_[T]:null,M=h.useRef({initial:null,translated:null}),$=h.useMemo(()=>{var Re;return T!=null?{id:T,data:(Re=A==null?void 0:A.data)!=null?Re:n9,rect:M}:null},[T,A]),j=h.useRef(null),[L,D]=h.useState(null),[W,F]=h.useState(null),k=h.useRef(d),H=ul("DndDescribedBy",t),V=h.useMemo(()=>P.getEnabled(),[P]),{layoutRectMap:U,recomputeLayouts:J,willRecomputeLayouts:Y}=$I(V,{dragging:x,dependencies:[O.x,O.y],config:i==null?void 0:i.droppable}),X=LI(_,T),Q=W?ih(W):null,ee=sw(X,(f=i==null||(p=i.draggable)==null?void 0:p.measure)!=null?f:fh),G=hh(X),R=h.useRef(null),le=R.current,ge=h.useRef({active:null,activeNode:X,collisionRect:null,droppableRects:U,draggableNodes:_,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Ee=P.getNodeFor((g=ge.current.over)==null?void 0:g.id),Ce=hh(X?X.ownerDocument.defaultView:null),tt=hh(X?X.parentElement:null),Qe=HI(T?Ee??X:null),Ot=FI(Qe),ut=GI({disabled:T==null,forceRecompute:Y}),Se=(m=ut.rect)!=null?m:ee,ot=Se===ee?bI(ee,le):bo,st=e9(l,{transform:{x:O.x-ot.x,y:O.y-ot.y,scaleX:1,scaleY:1},activatorEvent:W,active:$,activeNodeRect:G,containerNodeRect:tt,draggingNodeRect:Se,over:ge.current.over,overlayNodeRect:ut.rect,scrollableAncestors:Qe,scrollableAncestorRects:Ot,windowRect:Ce}),wt=Q?dl(Q,O):null,Ne=II(Qe),mt=dl(st,Ne),dt=Se?Jy(Se,st):null,Ue=dt?Jy(dt,Ne):null,en=$&&Ue?a({active:$,collisionRect:Ue,droppableContainers:V}):null,[he,De]=h.useState(null),Fe=vI(st,(v=he==null?void 0:he.rect)!=null?v:null,ee),He=h.useCallback((Re,{sensor:St,options:tn})=>{if(!j.current)return;const jn=_[j.current];if(!jn)return;const Zt=new St({active:j.current,activeNode:jn,event:Re.nativeEvent,options:tn,context:ge,onStart(Tn){const ls=j.current;if(!ls)return;const cs=_[ls];if(!cs)return;const{onDragStart:us}=k.current,ds={active:{id:ls,data:cs.data,rect:M}};Fn.unstable_batchedUpdates(()=>{y({type:gt.DragStart,initialCoordinates:Tn,active:ls}),C({type:gt.DragStart,event:ds})}),us==null||us(ds)},onMove(Tn){y({type:gt.DragMove,coordinates:Tn})},onEnd:Ks(gt.DragEnd),onCancel:Ks(gt.DragCancel)});Fn.unstable_batchedUpdates(()=>{D(Zt),F(Re.nativeEvent)});function Ks(Tn){return async function(){const{active:cs,over:us,scrollAdjustedTranslate:ds}=ge.current;let fs=null;if(cs&&ds){const{cancelDrop:gn}=k.current;fs={active:cs,delta:ds,over:us},Tn===gt.DragEnd&&typeof gn=="function"&&await Promise.resolve(gn(fs))&&(Tn=gt.DragCancel)}if(j.current=null,Fn.unstable_batchedUpdates(()=>{y({type:Tn}),De(null),E(!1),D(null),F(null),fs&&C({type:Tn,event:fs})}),fs){const{onDragCancel:gn,onDragEnd:Er}=k.current,Du=Tn===gt.DragEnd?Er:gn;Du==null||Du(fs)}}}},[y,_]),Mt=h.useCallback((Re,St)=>(tn,jn)=>{const Zt=tn.nativeEvent;j.current!==null||Zt.dndKit||Zt.defaultPrevented||Re(tn,St.options)===!0&&(Zt.dndKit={capturedBy:St.sensor},j.current=jn,He(tn,St))},[He]),Gt=MI(s,Mt);jI(s),Us(()=>{k.current=d},Object.values(d)),h.useEffect(()=>{T!=null&&E(!0)},[T]),h.useEffect(()=>{$||(R.current=null),$&&ee&&!R.current&&(R.current=ee)},[ee,$]),h.useEffect(()=>{const{onDragMove:Re}=k.current,{active:St,over:tn}=ge.current;if(!St)return;const jn={active:St,delta:{x:mt.x,y:mt.y},over:tn};C({type:gt.DragMove,event:jn}),Re==null||Re(jn)},[mt.x,mt.y]),h.useEffect(()=>{const{active:Re,droppableContainers:St,scrollAdjustedTranslate:tn}=ge.current;if(!Re||!j.current||!tn)return;const{onDragOver:jn}=k.current,Zt=St.get(en),Ks=Zt&&Zt.rect.current?{id:Zt.id,rect:Zt.rect.current,data:Zt.data,disabled:Zt.disabled}:null,Tn={active:Re,delta:{x:tn.x,y:tn.y},over:Ks};Fn.unstable_batchedUpdates(()=>{De(Ks),C({type:gt.DragOver,event:Tn}),jn==null||jn(Tn)})},[en]),Us(()=>{ge.current={active:$,activeNode:X,collisionRect:Ue,droppableRects:U,draggableNodes:_,draggingNodeRect:Se,droppableContainers:P,over:he,scrollableAncestors:Qe,scrollAdjustedTranslate:mt,translatedRect:dt},M.current={initial:Se,translated:dt}},[$,X,Ue,_,Se,U,P,he,Qe,mt,dt]),AI({...qs(),draggingRect:dt,pointerCoordinates:wt,scrollableAncestors:Qe,scrollableAncestorRects:Ot});const wo=h.useMemo(()=>({active:$,activeNode:X,activeNodeRect:ee,activeNodeClientRect:G,activatorEvent:W,activators:Gt,ariaDescribedById:{draggable:H},containerNodeRect:tt,dispatch:y,dragOverlay:ut,draggableNodes:_,droppableContainers:P,droppableRects:U,over:he,recomputeLayouts:J,scrollableAncestors:Qe,scrollableAncestorRects:Ot,willRecomputeLayouts:Y,windowRect:Ce}),[$,X,G,ee,W,Gt,tt,ut,y,_,H,P,U,he,J,Qe,Ot,Y,Ce]);return h.createElement(Zy.Provider,{value:S},h.createElement(mu.Provider,{value:wo},h.createElement(fw.Provider,{value:Fe},o)),h.createElement(gI,{announcements:r,hiddenTextDescribedById:H,screenReaderInstructions:u}));function qs(){const Re=(L==null?void 0:L.autoScrollEnabled)===!1,St=typeof n=="object"?n.enabled===!1:n===!1,tn=!Re&&!St;return typeof n=="object"?{...n,enabled:tn}:{enabled:tn}}}),o9=h.createContext(null),pw="button",s9="Droppable";function a9({id:e,data:t,disabled:n=!1,attributes:r}){const o=ul(s9),{active:s,activeNodeRect:a,activatorEvent:i,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:f,over:p}=h.useContext(mu),{role:g=pw,roleDescription:m="draggable",tabIndex:v=0}=r??{},b=(s==null?void 0:s.id)===e,w=h.useContext(b?fw:o9),[y,S]=sh(),C=DI(f,e),x=rw(t);h.useEffect(()=>(u[e]={id:e,key:o,node:y,data:x},()=>{const T=u[e];T&&T.key===o&&delete u[e]}),[u,e]);const E=h.useMemo(()=>({role:g,tabIndex:v,"aria-pressed":b&&g===pw?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[g,v,b,m,l.draggable]);return{active:s,activeNodeRect:a,activatorEvent:i,attributes:E,droppableRects:d,isDragging:b,listeners:n?void 0:C,node:y,over:p,setNodeRef:S,transform:w}}function i9(){return h.useContext(mu)}const l9="Droppable";function c9({data:e,disabled:t=!1,id:n}){const r=ul(l9),{active:o,dispatch:s,over:a}=h.useContext(mu),i=h.useRef(null),[l,u]=sh(),d=rw(e);return Us(()=>(s({type:gt.RegisterDroppable,element:{id:n,key:r,disabled:t,node:l,rect:i,data:d}}),()=>s({type:gt.UnregisterDroppable,key:r,id:n})),[n]),h.useEffect(()=>{s({type:gt.SetDroppableDisabled,id:n,key:r,disabled:t})},[t]),{active:o,rect:i,isOver:(a==null?void 0:a.id)===n,node:l,over:a,setNodeRef:u}}function u9(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const d9=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const r=n[0];return!e||!r?t:u9(t,e,r)},f9=({transform:e})=>({...e,x:0});function hw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function p9(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function wu(e){return e!==null&&e>=0}const gw=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{const o=hw(e,n,t),s=e[r],a=o[r];return!a||!s?null:{x:a.offsetLeft-s.offsetLeft,y:a.offsetTop-s.offsetTop,scaleX:a.width/s.width,scaleY:a.height/s.height}},Su={scaleX:1,scaleY:1},h9=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:r,overIndex:o})=>{var s;const a=(s=r[e])!=null?s:t;if(!a)return null;if(n===e){const l=r[o];return l?{x:0,y:e<o?l.offsetTop+l.height-(a.offsetTop+a.height):l.offsetTop-a.offsetTop,...Su}:null}const i=g9(r,n,e);return n>e&&n<=o?{x:0,y:-a.height-i,...Su}:n<e&&n>=o?{x:0,y:a.height+i,...Su}:{x:0,y:0,...Su}};function g9(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.offsetTop-(o.offsetTop+o.height):s?s.offsetTop-(r.offsetTop+r.height):0:s?s.offsetTop-(r.offsetTop+r.height):o?r.offsetTop-(o.offsetTop+o.height):0:0}const mw="Sortable",vw=h.createContext({activeIndex:-1,containerId:mw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gw,wasDragging:{current:!1}});function m9({children:e,id:t,items:n,strategy:r=gw}){const{active:o,dragOverlay:s,droppableRects:a,over:i,recomputeLayouts:l,willRecomputeLayouts:u}=i9(),d=ul(mw,t),f=s.rect!==null,p=h.useMemo(()=>n.map(T=>typeof T=="string"?T:T.id),[n]),g=o!=null,m=h.useRef(!1),v=o?p.indexOf(o.id):-1,b=v!==-1,w=i?p.indexOf(i.id):-1,y=h.useRef(p),S=p9(p,a),C=!v9(p,y.current),x=w!==-1&&v===-1||C;Us(()=>{C&&b&&!u&&l()},[C,b,l,u]),h.useEffect(()=>{y.current=p},[p]),h.useEffect(()=>{const T=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(T)},[g]);const E=h.useMemo(()=>({activeIndex:v,containerId:d,disableTransforms:x,items:p,overIndex:w,useDragOverlay:f,sortedRects:S,strategy:r,wasDragging:m}),[v,d,x,p,w,S,f,r,m]);return h.createElement(vw.Provider,{value:E},e)}function v9(e,t){return e.join()===t.join()}const b9=({id:e,items:t,activeIndex:n,overIndex:r})=>hw(t,n,r).indexOf(e),y9=({containerId:e,isSorting:t,wasDragging:n,index:r,items:o,newIndex:s,previousItems:a,previousContainerId:i,transition:l})=>!l||!n||a!==o&&r===s?!1:t?!0:s!==r&&e===i,w9={duration:200,easing:"ease"},bw="transform",S9=fl.Transition.toString({property:bw,duration:0,easing:"linear"}),C9={roleDescription:"sortable"};function x9({disabled:e,index:t,node:n,rect:r}){const[o,s]=h.useState(null),a=h.useRef(t);return Us(()=>{if(!e&&t!==a.current&&n.current){const i=r.current;if(i){const l=bu(n.current),u={x:i.offsetLeft-l.offsetLeft,y:i.offsetTop-l.offsetTop,scaleX:i.width/l.width,scaleY:i.height/l.height};(u.x||u.y)&&s(u)}}t!==a.current&&(a.current=t)},[e,t,n,r]),h.useEffect(()=>{o&&requestAnimationFrame(()=>{s(null)})},[o]),o}function E9({animateLayoutChanges:e=y9,attributes:t,disabled:n,data:r,getNewIndex:o=b9,id:s,strategy:a,transition:i=w9}){const{items:l,containerId:u,activeIndex:d,disableTransforms:f,sortedRects:p,overIndex:g,useDragOverlay:m,strategy:v,wasDragging:b}=h.useContext(vw),w=l.indexOf(s),y=h.useMemo(()=>({sortable:{containerId:u,index:w,items:l},...r}),[u,r,w,l]),{rect:S,node:C,setNodeRef:x}=c9({id:s,data:y}),{active:E,activeNodeRect:T,activatorEvent:_,attributes:O,setNodeRef:P,listeners:A,isDragging:M,over:$,transform:j}=a9({id:s,data:y,attributes:{...C9,...t},disabled:n}),L=eI(x,P),D=!!E,W=D&&b.current&&!f&&wu(d)&&wu(g),F=!m&&M,k=F&&W?j:null,V=W?k??(a??v)({layoutRects:p,activeNodeRect:T,activeIndex:d,overIndex:g,index:w}):null,U=wu(d)&&wu(g)?o({id:s,items:l,activeIndex:d,overIndex:g}):w,J=h.useRef(l),Y=l!==J.current,X=h.useRef(U),Q=h.useRef(u),ee=e({active:E,containerId:u,isDragging:M,isSorting:D,id:s,index:w,items:l,newIndex:X.current,previousItems:J.current,previousContainerId:Q.current,transition:i,wasDragging:b.current}),G=x9({disabled:!ee,index:w,node:C,rect:S});return h.useEffect(()=>{D&&X.current!==U&&(X.current=U),u!==Q.current&&(Q.current=u),l!==J.current&&(J.current=l)},[D,U,u,l]),{active:E,attributes:O,activatorEvent:_,rect:S,index:w,isSorting:D,isDragging:M,listeners:A,node:C,overIndex:g,over:$,setNodeRef:L,setDroppableNodeRef:x,setDraggableNodeRef:P,transform:G??V,transition:R()};function R(){if(G||Y&&X.current===w)return S9;if(!(F||!i)&&(D||ee))return fl.Transition.toString({...i,property:bw})}}const T9=[qe.Down,qe.Right,qe.Up,qe.Left],P9=(e,{context:{active:t,droppableContainers:n,translatedRect:r,scrollableAncestors:o}})=>{if(T9.includes(e.code)){if(e.preventDefault(),!t||!r)return;const a=[];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=fh(u),f={...l,rect:{current:d}};switch(e.code){case qe.Down:r.top+r.height<=d.top&&a.push(f);break;case qe.Up:r.top>=d.top+d.height&&a.push(f);break;case qe.Left:r.left>=d.left+d.width&&a.push(f);break;case qe.Right:r.left+r.width<=d.left&&a.push(f);break}});const i=PI({active:t,collisionRect:r,droppableContainers:a});if(i){var s;const l=(s=n.get(i))==null?void 0:s.node.current;if(l){const d=ch(l).some((m,v)=>o[v]!==m),f=fh(l),p=d?{x:0,y:0}:{x:r.width-f.width,y:r.height-f.height};return{x:f.left-p.x,y:f.top-p.y}}}}};function O9(e){const{id:t,item:n,className:r,select:o,remove:s,renderItem:a,previewStyle:i,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:f,listeners:p,setNodeRef:g,transform:m,transition:v}=E9({id:t,disabled:u}),b={transform:fl.Transform.toString(m),transition:v},w=()=>!u&&(o==null?void 0:o(n));return c.jsx("div",{...l?{ref:g,style:b,...f}:{},children:c.jsxs(I,{space:"s",onClick:w,className:r,items:"center",nowrap:!0,children:[l&&c.jsx(B,{className:Z(!u&&Pe.hover,!u&&"cursor-grab"),...p,children:c.jsx(ne,{icon:q.dotsVertical,size:se.sx})}),c.jsx(B,{grow:!0,className:Z("overflow-hidden"),children:c.jsxs(I,{children:[c.jsx(B,{grow:!0,className:Z("overflow-ellipsis overflow-hidden"),children:a(n)}),!!i&&c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:i(n)})})]})}),s&&d?c.jsx(eu,{disabled:u,onConfirm:()=>{s==null||s(n)},children:c.jsx(B,{className:Z(!u&&Pe.click),children:c.jsx(ne,{icon:q.close,size:se.sx})})}):c.jsx(B,{className:Z(!u&&Pe.click),onClick:y=>{ps(y),!u&&(s==null||s(n))},children:c.jsx(ne,{icon:q.close,size:se.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Zr(e){const{className:t,items:n,selected:r,renderItem:o,select:s,add:a,remove:i,move:l,previewStyle:u,getItemId:d=P=>P.id||P.name||P.title||P.label||"",label:f,labelAs:p,children:g,title:m="Select",titleAdd:v="Add",emptyState:b,disabled:w=!1,hidePopover:y,popoverPlacement:S="left",confirmRemove:C}=e,x=qI(iw(bh),iw(mh,{coordinateGetter:P9}));function E(P){const{active:A,over:M}=P;if(A.id!==(M==null?void 0:M.id)){const $=n.find(L=>d(L)===A.id),j=n.findIndex(L=>d(L)===(M==null?void 0:M.id));$&&(l==null||l($,j))}}const T=Z(te.rnd,z.br,n.length&&te.b,n.length&&"gjs-mt-1");let _=c.jsxs("div",{className:T,children:[n.length===0&&b&&c.jsx(I,{className:N("gs-utl-p-2 gs-utl-text-center",z.txtLowEmphasis),items:"center",justify:"center",children:b}),n.map((P,A)=>{const M=d(P),$=P===r,j=Z("gjs-px-2 gjs-py-2 text-xs",z.br,A&&te.bt,!!s&&!$&&!w&&z.hBgH2,$&&z.bgH,w&&"opacity-75");return c.jsx(O9,{id:M,item:P,className:j,select:s,remove:i,renderItem:o,previewStyle:u,sortable:!!l,disabled:w,confirmRemove:C},M||A)})]});l&&(_=c.jsx(r9,{sensors:x,collisionDetection:mI,onDragEnd:E,modifiers:[f9,d9],children:c.jsx(m9,{items:n.map(d),strategy:h9,children:_})})),s&&!y&&(_=c.jsx(wr,{placement:S,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!r&&!w,onClose:()=>s==null?void 0:s(null),handler:_,children:g}));const O=a?[{type:"button",icon:q.plus,tooltip:v,variant:"outline",size:"xs",disabled:w,onClick:a}]:[];return c.jsxs("div",{className:Z(t,"w-full"),children:[!!(f||a)&&c.jsx(br,{...e,as:p,afterLabelButtons:O}),_]})}const _9=ce(function(){const t=Ie(),{editor:n}=we(),r=_i(),o=Ai(),s=o.sortedFonts;return n?c.jsx(Zr,{items:s,selected:null,renderItem:a=>{const i=kf(a);return c.jsxs(I,{col:!0,children:[c.jsx(B,{className:"gs-utl-text-lg",style:{fontFamily:i},children:a.familyLabel}),c.jsx(B,{children:a.familyLabel})]})},remove:a=>o.removeFont(a.family),add:o.sdkAddFonts&&r.hasType("font")?()=>nh(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:a=>a.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),yw=h.forwardRef(function({size:t="m",className:n,classNameContent:r,border:o=!0,children:s,...a},i){const l=ae(z.bg,z.br,o&&`${te.b} ${te.rnd}`,t==="m"&&Te.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx(I,{className:l,items:"center",space:"x2s",...a,ref:i,children:c.jsx(B,{grow:!0,className:r,children:s})})}),ww=h.forwardRef(({autoResize:e,style:t={},...n},r)=>{const o=h.useRef(null),s=r||o;return h.useEffect(()=>{!s.current||!e||(s.current.style.height="auto",s.current.style.height=s.current.scrollHeight+"px")},[n.value,e,s]),c.jsx("textarea",{ref:s,style:{...t,...e?{resize:"none"}:{}},...n})});ww.displayName="TextAreaWithAutoResize";const A9="gs-field-textarea";function Sw(e){const{className:t,value:n,label:r,size:o,description:s,placeholder:a,readOnly:i,disabled:l,required:u,onChange:d,onKeyDown:f,afterInput:p,minHeight:g,maxHeight:m,autoResize:v,classNameField:b,classNameFieldContent:w,classNameInput:y}=e,S=ji(e);return c.jsxs("div",{className:Z(A9,t),children:[!!r&&c.jsx(Wo,{size:o,children:r}),!!s&&c.jsx(Wo,{size:o,as:"span",className:Z(z.txtLowEmphasis),capitalize:!1,children:s}),c.jsxs(yw,{size:o,className:b,classNameContent:w,children:[c.jsx(ww,{className:Z(S,y),autoResize:v,value:n,placeholder:a,readOnly:i,disabled:l,required:u,onChange:C=>d==null?void 0:d(C.target.value),onKeyDown:f,style:{minHeight:g,maxHeight:m}}),p]})]})}const Cu="gs-page-settings",L9=`${Cu}-header`,M9=`${Cu}-content`,N9=`${Cu}-footer`,Cw="",$9=ce(function({className:t,classNameHeader:n,classNameContent:r,classNameFooter:o,page:s,size:a=ep.m}){const i=we(),{isDarkTheme:l}=jr(),u=Ai(),d=Ie(),[f,p]=h.useState(s),[g,m]=h.useState(()=>hv(f,i)),[v,b]=h.useState(()=>d.t("update")),w=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:S}=i,C={containerClassName:"gs-utl-min-h-80",size:a,padding:5,isDarkTheme:l,clean:!0};if(!S)return null;const x=$=>m(j=>({...j,...$})),E=$=>{$.preventDefault();const{name:j,...L}=g;L.customCodeHead=BS(L.customCodeHead),L.customCodeBody=FS(L.customCodeBody),f?(H3(f,L),f.setName(j)):i.setProjectDataCustom({globalPageSettings:L}),b(d.t("updated")),setTimeout(()=>b(d.t("update")),2e3),cv(S),S.trigger(Pn.pageSettingsUpdate,{page:f,data:{name:j,...L}})},T={tooltip:d.t("clear")},_=(f==null?void 0:f.getId())??Cw,O=$=>{const j=S.Pages.get($);p(j),m(hv(j,i))},P=Vf(f),A=!!f&&xc(f),M=[{id:Cw,label:w("global")},...S.Pages.getAll().map($=>({icon:iv($),id:$.getId(),label:$.getName()}))];return c.jsx("form",{onSubmit:E,className:N(Cu,"gs-utl-h-full",t),children:c.jsxs(I,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(B,{className:N(L9,n,z.br,te.bb),children:c.jsx(Le,{value:_,onChange:O,options:M,handlerSelected:$=>c.jsxs(I,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),$.icon&&ct($.icon)&&c.jsx(ne,{icon:$.icon,size:se.s2x}),c.jsx("span",{children:$.label})]})})}),c.jsxs(I,{col:!0,className:N(M9,"gs-utl-gap-5 gs-utl-overflow-y-auto",r),nowrap:!0,children:[!!_&&c.jsxs(c.Fragment,{children:[c.jsx(rt,{size:a,value:g.name,onChange:$=>x({name:$}),label:y("name.label"),description:y("name.description"),required:!0}),!P&&c.jsx(rt,{size:a,value:g.slug,onChange:$=>x({slug:A?RS($,["id"]):Sl($)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(rt,{size:a,value:g.title,onChange:$=>x({title:$}),label:y("title.label"),description:y("title.description")}),c.jsx(Sw,{size:a,value:g.description,onChange:$=>x({description:$}),label:y("description.label"),description:y("description.description")}),c.jsx(ll,{size:a,clear:T,value:g.favicon,onChange:$=>x({favicon:$}),onOpen:()=>{S.Assets.open({select($){x({favicon:$.getSrc()}),S.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(rt,{size:a,value:g.keywords,onChange:$=>x({keywords:$}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(rt,{size:a,value:g.socialTitle,onChange:$=>x({socialTitle:$}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(ll,{size:a,clear:T,value:g.socialImage,onChange:$=>x({socialImage:$}),onOpen:()=>{S.Assets.open({select($){x({socialImage:$.getSrc()}),S.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(Sw,{size:a,value:g.socialDescription,onChange:$=>x({socialDescription:$}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(ho,{language:"html",defaultValue:g.customCodeHead,onChange:$=>x({customCodeHead:$}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...C},`head-${_}`),c.jsx(ho,{language:"html",defaultValue:g.customCodeBody,onChange:$=>x({customCodeBody:$}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...C},`body-${_}`),u.sdkShowProjectFonts&&!_&&c.jsx(_9,{})]}),c.jsx(I,{className:N(N9,"gs-utl-mt-auto",o,z.br,te.bt),children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:v})})]})})}),k9="gs-panel-page-settings",I9=h.memo(ce(function({className:t,page:n,...r}){return c.jsx(Cr,{className:N(k9,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...r,children:c.jsx(Fi,{children:c.jsx($9,{className:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:ep.s,classNameHeader:Te.s,classNameContent:Te.s,classNameFooter:Te.s})})})})),xu="gs-page-item",xw=ce(function({page:t,rename:n,setRename:r,commandItems:o}){const s=we(),a=Ie(),i=s.editor,{Pages:l}=i,u=s.sdkPagesConfig,d=u==null?void 0:u.settings,f=u==null?void 0:u.showHomeIcon,p=u==null?void 0:u.layoutBefore,g=E=>a.t(`pageManager.${E}`),m=E=>l.select(E),v=E=>l.getSelected()===E,b=E=>E===n,w=v(t),y=E=>E.getName()||E.getId(),S=E=>{n==null||n.set({name:E}),r(void 0)},C=ae("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),x=()=>i.runCommand(re.setPageSettings,{page:t,isOpen:!0});return c.jsxs(I,{gap:"s",items:"center",onClick:()=>m(t),className:ae([xu,"group cursor-default",Te.xy,w?z.bgH:z.hBgH2]),children:[f&&Vf(t)&&c.jsx(B,{className:`${xu}__icon-home`,title:g("homePage"),children:c.jsx(ne,{icon:q.home,size:se.s3x})}),p&&$t(p({page:t,editor:i,isSelected:w})),c.jsx(B,{className:ae(`${xu}__name truncate`),grow:!0,children:b(t)?c.jsx(th,{value:y(t),onChange:S}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(I,{className:`${xu}__actions`,gap:"xs",onClick:ps,items:"center",children:[!n&&d!==!1&&c.jsx(Ct,{className:C,size:"xs",border:!1,title:g("settings.label"),onClick:x,block:!0,children:c.jsx(ne,{icon:q.cog,size:se.s3x})}),w&&!!o.length&&c.jsx(wr,{placement:"right-start",handler:c.jsx(ne,{icon:q.dotsVertical,size:se.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>o.map(T=>c.jsx(Pa,{icon:T.icon,label:et(T.label)?T.label({editor:i}):T.label,action:()=>{var _;E(),(_=T.cmd)==null||_.call(T,{page:t,editor:i})}},T.id))})]})]},t.getId())});function V9({dragging:e,dragRect:t}){const n=!!(e&&t),r=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:r}}var Ew=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Ew||{});const Sh="gs-cmp-sortable",Tw=3;function H9({items:e,direction:t,onDrop:n,renderItem:r}){const[o,s]=h.useState(null),[a,i]=h.useState(-1),[l,u]=h.useState(),[d,f]=h.useState(!1),p=h.useRef(null),{showIndicator:g,indicatorStyle:m}=V9({dragging:!!o&&d,dragRect:l}),v=h.useMemo(()=>[],[e]);h.useEffect(()=>{const T=window.document,_=O=>O.key==="Escape"&&y(O);return T.addEventListener("keydown",_),()=>T.removeEventListener("keydown",_)},[]);const b=T=>_=>{_.button===0&&(p.current={x:_.clientX,y:_.clientY},s(T),f(!1),_.target.setPointerCapture(_.pointerId))},w=T=>{const _=p.current;if(!o||!_)return;if(!d){const $=Math.abs(T.clientX-_.x),j=Math.abs(T.clientY-_.y);(t==="vertical"?j>Tw:$>Tw)&&f(!0);return}const O=T.clientY;let P=-1;v.forEach(($,j)=>{const L=$.getBoundingClientRect();O>L.top+L.height/2&&(P=j)});const A=e.findIndex($=>$.id===o.id);P<A&&(P+=1),P=Math.min(P,e.length-1),i(P);const M=v[P];if(M){const{height:$,top:j}=M.getBoundingClientRect(),L=O<j+$/2;u({y:M.offsetTop+(L?0:$),h:$})}},y=T=>{s(null),f(!1),p.current=null,u(void 0);const _=T.target,{pointerId:O}=T;O&&(_==null||_.releasePointerCapture(O))},S=T=>{!o||!p.current||(l&&a!==-1&&(n==null||n(o,a)),y(T))},C=N(Sh,"gs-utl-relative"),x=N(`${Sh}__indicator`,z.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),E=T=>N(`${Sh}__item`,g&&(o==null?void 0:o.id)===T.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx(I,{col:t==="vertical",className:C,children:e.map((T,_)=>c.jsx(B,{ref:O=>{O&&(v[_]=O)},className:E(T),onPointerDown:b(T),onPointerMove:w,onPointerUp:S,children:r(T)},T.id))}),g&&c.jsx("div",{className:x,style:m})]})}const j9=({pages:e,commandItems:t,rename:n,setRename:r,editor:o})=>{if(!o.Pages.move)return e.map(l=>c.jsx(xw,{page:l,commandItems:t,rename:n,setRename:r},l.getId()));const s=(l,u)=>{o.Pages.move(l.entity,{at:u})},a=l=>c.jsx(xw,{page:l.entity,commandItems:t,rename:n,setRename:r},l.id),i=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(H9,{items:i,direction:Ew.vertical,onDrop:s,renderItem:a})},D9=({items:e,editor:t,sdkPageConfig:n})=>{const r=n==null?void 0:n.commandItems;return r===!1?[]:et(r)?r({items:e,editor:t}):r||e},Ch="gs-panel-page-manager",Pw=ce(function({pages:t,select:n,add:r,remove:o,header:s,resizable:a={bottom:!0},height:i=200}){const l=we(),u=Ca(),d=Ie(),{sdkPagesConfig:f}=l,p=l.editor,[g,m]=h.useState(),v=M=>d.t(`pageManager.${M}`),b=f==null?void 0:f.add,w=f==null?void 0:f.duplicate,y=f==null?void 0:f.remove,S=M=>{ps(M);const $=L=>{const D=t.length+1;return r({name:`${v("page")} ${D}`,component:`<div>${v("newPage")} ${D}</div>`,...L},{select:!0})};if(b)return b({event:M,editor:p,rename:m,addPage:$});const j=$();j&&m(j)},C=({page:M})=>{if(y)return y({editor:p,page:M});u.confirm({title:v("deletePage"),content:v("confirmDelete"),confirmButton:{variant:"danger",children:v("deletePage")},onConfirm:()=>{const $=t.indexOf(M),j=t[$+1]||t[0];n(j),o(M)}})},x=({page:M})=>{if(w)return w({editor:p,page:M,rename:m});const $=M.getMainComponent(),j=r({name:`${M.getName()} (${v("copy")})`,component:$.clone()},{select:!0});j&&m(j)},E=[{id:"rename",label:v("rename"),icon:q.pencil,cmd:({page:M})=>m(M)},w!==!1&&{id:"duplicate",label:v("duplicate"),icon:q.contentCopy,cmd:x},t.length>1&&y!==!1&&{id:"remove",label:v("delete"),icon:q.delete,cmd:C}].filter(Boolean),T=D9({items:E,editor:p,sdkPageConfig:f}),_=Cy(s,{collapsible:!0,label:v("pages"),icon:q.textBoxMultiple}),O=a?a===!0?{top:!0,right:!0,bottom:!0,left:!0}:a:void 0,P=c.jsx(j9,{pages:t,commandItems:T,rename:g,setRename:m,editor:p}),A=O?c.jsx(fu,{className:Z([`${Ch}__content`,"text-sm overflow-auto",te.bt,z.br]),height:i,...O,children:P}):P;return c.jsx(mo,{classNameWrap:Ch,className:Z(`${Ch}__header`,Te.xy,s===!1&&"gs-utl-hidden"),disabled:_&&_.collapsible===!1,handler:c.jsxs(I,{space:"s",items:"center",children:[!!_.icon&&c.jsx(B,{children:c.jsx(ne,{icon:_.icon,size:se.s})}),c.jsx(B,{grow:!0,children:_.label}),b!==!1&&c.jsx(Wt,{title:v("add"),children:c.jsx(I,{onClick:S,className:Z("cursor-pointer"),children:c.jsx(ne,{icon:q.plus,size:se.s})})})]}),open:_?_.collapsed!==!0:!0,children:A})}),Ow=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-after"),n),ref:o,...r,children:t})}),_w=h.forwardRef(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-before"),n),ref:o,...r,children:t})}),F9="gs-panel-pages",Aw=h.memo(ce(function({className:t,header:n,height:r,resizable:o,...s}){const a=we().sdkProps.children;return c.jsx(Cn,{className:N(F9,t),...s,children:c.jsx(Ob,{children:i=>c.jsxs(c.Fragment,{children:[Xn(a,_w),c.jsx(Pw,{header:n,height:r,resizable:o,...i}),Xn(a,Ow)]})})})})),B9="gs-panel-pages-layers",z9=h.memo(ce(function({className:t,panelPagesProps:n,panelLayersProps:r,...o}){const{showPages:s}=we(),a=Ie(),{className:i,...l}=n||{},u=Cy(r==null?void 0:r.header,{icon:q.layers,collapsible:!1,label:a.t("layerManager.layers"),className:N(te.bb,z.br)});return c.jsxs(Cr,{className:N(B9,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...o,children:[s&&c.jsx(Aw,{className:N(i,te.bb,z.br),...l}),c.jsx(Wy,{...r,header:u})]})})),U9="gs-trait-custom",W9=ce(function(t){const{trait:n,editor:r,value:o,disabled:s,labelAs:a,className:i}=t,[,l]=h.useState(0),u=h.useRef(null),d=n.get("component"),f=n.get("render"),p=n.target,g=u.current;if(h.useEffect(()=>{if(p){let b=()=>{},w=()=>{};const y=()=>{w(),l(S=>++S)};if(p.on("change",y),!d&&f&&g){const S=E=>g.appendChild(E),C=E=>g.removeChild(E),x=f({editor:r,component:p,trait:n,addEl:S,removeEl:C,onUpdate:E=>{w=E}});x instanceof HTMLElement?(S(x),b=()=>C(x)):et(x)&&(b=()=>x())}return()=>{p.off("change",y),b()}}},[p,g,o]),!p)return null;const m=Go({...t,className:N(U9,i)}),v={trait:n,component:p,editor:r,value:o,disabled:s};return c.jsxs("div",{...m,children:[c.jsx(br,{...t,as:a}),c.jsx("div",{className:N(s&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...v}):f?c.jsx("div",{ref:u}):null})]})});function Lw({className:e,options:t,value:n,name:r,label:o,border:s,hideCaret:a,size:i="s",autoFocus:l,open:u,allowNew:d,onChange:f,onBlur:p,placeholder:g}){const[m,v]=h.useState(null),[b,w]=h.useState(null),{styles:y,attributes:S}=wi(m,b,ap),[C,x]=h.useState(""),E=ji(),T=C===""?t:t.filter(j=>j.label.toLowerCase().includes(C.toLowerCase())),_=j=>x(j.target.value),O=j=>j==null?void 0:j.label,P=d&&C.length>0&&!T.some(j=>j.label===C),A=et(d)?d(C):d,M={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},$=()=>p==null?void 0:p();return c.jsxs("div",{className:Z("w-full",e),children:[!!o&&c.jsx(Wo,{size:i,children:o}),c.jsxs(ca,{value:n,onChange:f,name:r,nullable:!0,children:[c.jsx(yw,{size:i,ref:v,border:s,children:c.jsxs(I,{nowrap:!0,children:[c.jsx(ca.Input,{autoFocus:l,className:E,displayValue:O,onChange:_,onBlur:$,placeholder:g}),!a&&c.jsx(ca.Button,{children:c.jsx(ne,{icon:q.chevronDown,size:se.sx})})]})}),c.jsx(ca.Options,{static:u,className:vb,ref:w,style:y.popper,...S.popper,children:c.jsxs(Yn,{className:Z("h-full"),padding:!1,style:M,children:[P&&c.jsx(ca.Option,{value:{id:null,label:C},children:({active:j})=>c.jsx(bb,{option:{id:null,label:A},active:j,selected:n})}),!P&&T.length===0&&c.jsx("div",{className:Z(Te.xy),children:"No items found"}),T.map(j=>c.jsx(ca.Option,{value:j,children:({active:L})=>c.jsx(bb,{option:j,active:L,selected:n})},j.id))]})})]})]})}const G9=(e,t)=>{const n=`${Sc}${t}`,r=e.get(n,{skipResolve:!0});return r?Mw(r):e.get(n)||""};function Mw(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const q9=({page:e,component:t})=>{const{DataSources:n,I18n:r}=e.em,o=["prevItem","currentItem","nextItem"],s=Cc(e)||"",a=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return o.map(f=>{if(d!=null&&d[f]){const{collectionId:p}=d,g=r.t(`dataSources.collections.${p}`)||p,m=r.t(`dataSources.variableTypes.${f}`)||f,v={collectionId:p,path:"id",type:n.dataComponentTypes.variable,variableType:f};return{id:Mw(v),label:`${g} > ${m}`,dataVariable:v}}}).filter(Boolean)}).flat().filter(Boolean),i=n.get(s),l=i==null?void 0:i.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...a,...l]},Nw="#",Eu="mailto:",xh="subject=",Eh="tel:",$w="hrefType",kw="showIdList",Iw=(e,t)=>{const n=t==null?void 0:t.get($w);return n||(e.startsWith(Eh)?"phone":e.startsWith(Eu)?"email":e.startsWith(Oi)?"pages":e.startsWith(Nw)?"elements":"url")},Vw=e=>`${e.getName()} - #${e.getId()}`,K9="gs-trait-href",Z9=ce(function(t){const{trait:n,value:r,disabled:o,labelAs:s,className:a}=t,i=n.component,l=we(),{isSelectingTarget:u,editor:d}=l,[,f]=h.useState(0),[p,g]=h.useState(""),[m,v]=h.useState(""),[b,w]=h.useState(""),[y,S]=h.useState([]),C=Ie(),x=d==null?void 0:d.Pages.getAll(),E=C.tScoped("traitManager.traits.labels"),T=()=>f(Q=>++Q),_=i.get(kw)??!1,O=Iw(r,i),P=O==="pages"?r==null?void 0:r.replace(Oi,""):"",A=!!P&&(d==null?void 0:d.Pages.get(P)),M=A?xc(A):!1,$=h.useMemo(()=>!M||!A||!d?[]:q9({page:A,component:i}),[d,A,M,i]),j=Q=>{n.setValue(Q)},L=Q=>{i.set({[kw]:Q}),T()},D=Q=>{g(""),v(""),w(""),j(""),i.set({[$w]:Q}),T()},W=Q=>{j(Q),T()},F=(Q,ee)=>{F3(i,"id",(ee==null?void 0:ee.dataVariable)||Q),T()},k=Q=>{Q&&(j(Q.id),T())},H=Q=>{j(`${Eh}${Q}`),w(Q)},V=Q=>{j(`${Eu}${Q}${m?`?${xh}${m}`:""}`),g(Q)},U=Q=>{j(`${Eu}${p}${Q?`?${xh}${Q}`:""}`),v(Q)},J=()=>{l.setSelectingTarget(!u)},Y=Q=>{const ee=Q.replace(Nw,""),G=d==null?void 0:d.Components.componentsById[ee];return{id:Q,label:G?Vw(G):Q}};h.useEffect(()=>{var ee;const Q=[];if(_){const G=["path","br","b","u","i","strike"],R=(ee=d==null?void 0:d.Pages.getSelected())==null?void 0:ee.getMainComponent();R==null||R.forEachChild(le=>{!le.is("comment")&&!le.is("textnode")&&!G.includes(le.get("tagName"))&&Q.push({id:`#${le.getId()}`,label:Vw(le)})})}S(Q)},[d,_]),h.useEffect(()=>{let Q=()=>{};const ee=()=>{Q(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand($u))};return u&&(Q=VS(ee),d==null||d.runCommand($u,{onSelect:G=>j(`#${G.getId()}`)})),ee},[d,u]),h.useEffect(()=>{if(!r)return;switch(Iw(r,i)){case"phone":w(r.replace(Eh,""));break;case"email":{const[ee,G=""]=r.replace(Eu,"").split("?");g(ee),v(G.replace(xh,""));break}}},[r]);const X=Go({className:N(K9,a)});return c.jsxs("div",{...X,children:[c.jsx(br,{...t,as:s}),c.jsx("div",{className:N(o&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(Zo,{onChange:D,classNamePanel:"gs-utl-p-1",value:O,tabs:[{id:"url",label:c.jsx(ne,{icon:q.link,size:se.s}),content:c.jsx(rt,{placeholder:"eg. https://google.com",value:r,label:"URL",onChange:j,size:"s",type:"url"})},{id:"pages",label:c.jsx(ne,{icon:q.textBoxMultiple,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Le,{size:"s",options:(x||[]).map(Q=>({id:`${Oi}${Q.getId()}`,icon:iv(Q),label:Q.getName()})),value:r,onChange:W,label:"Page"}),M&&c.jsx(Le,{size:"s",options:$,value:G9(i,"id"),onChange:F,label:C.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(ne,{icon:q.viewDayOutline,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Wo,{size:"s",children:"Element ID"}),c.jsxs(I,{gap:"xs",nowrap:!0,children:[_?c.jsx(Lw,{options:y,onChange:k,value:Y(r),placeholder:C.t("selectList")}):c.jsx(rt,{size:"s",placeholder:"eg. #my-element-in-page",value:r,onChange:j,className:"gs-utl-flex-1"}),c.jsx(Ct,{title:C.t("selectTarget"),size:"m2",active:u,onClick:J,className:"gs-utl-h-[30px]",children:c.jsx(ne,{icon:q.target,size:se.sx})})]}),c.jsx(tl,{value:_,onChange:L,label:E("showList")})]})},{id:"email",label:c.jsx(ne,{icon:q.email,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(rt,{placeholder:"eg. mail@gmail.com",value:p,onChange:V,size:"s",label:"Email",type:"email"}),c.jsx(rt,{placeholder:"eg. My subject",value:m,onChange:U,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(ne,{icon:q.phone,size:se.s}),content:c.jsx(rt,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:b,onChange:H})}]})})]})});function Y9({trait:e,value:t,disabled:n,label:r,labelAs:o}){const[s,a]=h.useState(),i=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],f=d.findIndex(p=>p.id===(s==null?void 0:s.id));return c.jsx(Zr,{items:d,selected:f>-1?s:null,select:a,disabled:n,label:r,labelAs:o,add:()=>{const p=d.length+1,g=l?l(p):{id:`opt${p}`,label:`New option ${p}`};e.setValue([...d,g])},move:(p,g)=>{const m=e.getValue().filter(v=>v.id!==p.id);m.splice(g,0,p),e.setValue(m)},remove:p=>{const g=e.getValue().filter(m=>m.id!==p.id);e.setValue(g,{removed:p})},renderItem:p=>u?u(p):p.label,children:c.jsx(I,{space:"m",col:!0,children:!!s&&i.map(p=>{const{name:g,getValue:m}=p,v=p.setValue,b=p.label||g,w=d[f];if(!w)return null;const y=w[g],S=m?m(y):y,C=E=>{const T={...w};w[g]=v?v(E,S):E,e.setValue([...d],{item:w,previous:T}),g==="id"&&a(w)};let x=c.jsx(rt,{label:b,value:S,onChange:C});switch(p.type){case"select":x=c.jsx(Le,{label:b,options:p.options,value:S,onChange:C})}return c.jsx(h.Fragment,{children:x},g)})})})}const X9="gs-trait-custom-type",J9=ce(function({trait:t,editor:n}){const r=h.useRef(null),o=t.getType(),s=t.target,{Traits:a}=n,i=a.getType(o),l=!!(s&&i);return h.useEffect(()=>{const u=r.current;if(i&&u&&s){const d=new i({model:t,config:a.getConfig(),attributes:t.get("attributes")}),f=d.render().el;return u.appendChild(f),d.listenTo(s,"change",()=>d.postUpdate()),()=>{u.removeChild(f),d.removeView()}}},[s,i,t]),l&&c.jsx("div",{className:X9,ref:r})}),Q9=e=>{const{value:t={},onConfirm:n,additionalSources:r,editor:o}=e;if(!o)return;const s="DataValuePicker",a={id:s,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:i})=>{n==null||n(i),o.runCommand(re.layoutRemove,{id:s})},additionalSources:r},placer:{type:"dialog",size:"l"}};o.runCommand(re.layoutToggle,{...a})};function Hw(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:r,editor:o,additionalSources:s,enableDataValue:a,hasDataResolverValue:i}=e;if(!o||!a)return[];const l={type:"button",className:i?z.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:o.I18n.t("dataSources.connectDataValue"),icon:{icon:q.databaseOutline,size:se.s2x},onClick:()=>Q9({value:t,onConfirm:n,additionalSources:s,editor:o})}];return i&&u.push({...l,title:o.I18n.t("dataSources.clearDataValue"),icon:{icon:q.close,size:se.s2x},onClick:r}),u}function R9(e,t){const n=e.em.getEditor(),r=e.target;let o=!1;t===!0?o=!0:Rr(t)&&et(t.enable)&&(o=t.enable({trait:e,component:r,editor:n}));const s=e.getValue({skipResolve:!0}),a=r.collectionsStateMap,i=es(s);return{hasDataResolverValue:i,dataResolverValue:i?e.getValue():void 0,enableDataValue:o,initialDataValue:s,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:a}}const e7=({label:e,buttons:t})=>c.jsxs(I,{items:"center",nowrap:!0,full:!0,children:[c.jsx(B,{grow:!0,children:e}),c.jsx(I,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,r)=>c.jsx(Ct,{...n},r))})]}),jw=e=>Pr((e||"").replace(/-/g," ")),t7=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&jw(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,r)=>e.setValue(n,{partial:r})}),xr=(e,t,n)=>{const r=R9(e,n.traitManagerDataConfig),o=Hw(r),{hasDataResolverValue:s,dataResolverValue:a}=r,i=t7(e,t);return{...i,value:a??i.value,disabled:s,labelAs:o.length?"span":void 0,label:c.jsx(e7,{label:i.label,buttons:o})}},Dw=(e,t,n)=>xr(e,t,n),n7=(e,t,n)=>xr(e,t,n),r7=(e,t,n)=>{const r=es(e.getValue({skipResolve:!0})),o=xr(e,t,n),s={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!r,units:r?[]:e.get("units"),onChange:(a,i)=>{const l=i||isNaN(parseFloat(a))?a:parseFloat(a);e.setValue(l,{partial:i})}};return{...o,...s}},Fw=(e,t,n)=>{const r=e.get("labelToTitle"),o=es(e.getValue({skipResolve:!0})),s=xr(e,t,n),a={options:e.getOptions().map(i=>{const l=i.labelReact||i.name||i.label||i.value;return ct(i)?{id:i,label:i}:{id:i.id||i.value,title:r?l:i.title,icon:i.icon,label:r?"":l}}),onChange:i=>e.setValue(i),emptyState:o&&e.getValue()||void 0,hideCaret:o};return{...s,...a}},o7=(e,t,n)=>{const{options:r,onChange:o}=Fw(e,t,n),s={options:r,onChange:o};return{...xr(e,t,n),...s}},s7=(e,t,n)=>{const r=e.get("typeProps")||{},o=es(e.getValue({skipResolve:!0}));return{...xr(e,t,n),isContain:!0,hideButton:o,btnLabel:e.get("text"),onOpen(){if(o)return;const a=t==null?void 0:t.Assets;a==null||a.open({select(i){e.setValue(i.getSrc()),a.close()}})},...r}},a7=e=>({children:jw(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");ct(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),i7=(e,t,n)=>{const r=xr(e,t,n),s={value:!!(r.disabled?r.value:e.getValue({useType:!0})),onChange:a=>e.setValue(a)};return{...r,...s}},l7=(e,t,n)=>{const r=xr(e,t,n),o=e.get("typeProps")||{},s=es(e.getValue({skipResolve:!0}));return{language:"css",...o,...r,formatOnMount:!s,onChange:a=>e.setValue(a)}},c7=(e,t,n)=>({...xr(e,t,n),trait:e}),u7=(e,t,n)=>({...xr(e,t,n),trait:e}),d7=(e,t,n)=>({...xr(e,t,n),trait:e,editor:t});function f7(e,t,n={}){var a;const r=e.get("visible"),o=e.getType(),s={traitManagerDataConfig:n.traitManagerDataConfig};if(et(r)&&r({component:e.target,trait:e})===!1)return null;switch(o){case"text":return c.jsx(rt,{...Dw(e,t,s)});case"select":return c.jsx(Le,{...Fw(e,t,s)});case"number":return c.jsx($e,{...r7(e,t,s)});case"color":return c.jsx(vo,{...n7(e,t,s)});case"checkbox":return c.jsx(tl,{...i7(e,t,s)});case"button":return c.jsx(Ke,{...a7(e)});case"radio":return c.jsx(Qt,{...o7(e,t,s)});case"code":return c.jsx(ho,{...l7(e,t,s),...n},((a=t==null?void 0:t.getSelected())==null?void 0:a.getId())||"");case"image":case"file":return c.jsx(ll,{...s7(e,t,s)});case"stack":return c.jsx(Y9,{...c7(e,t,s)});case"href":return c.jsx(Z9,{...u7(e,t,s)});case"custom":return c.jsx(W9,{...d7(e,t,s)});default:return!!t.Traits.getType(o)?c.jsx(J9,{editor:t,trait:e}):c.jsx(rt,{...Dw(e,t,s)})}}const Th="gs-trait-manager",Bw=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(B,{className:Z(`${Th}-field gs-utl-mb-2 gs-utl-w-full`),children:f7(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function p7({traits:e,className:t}){var d,f;const n=Di(),{isDarkTheme:r}=jr(),s=(d=we().sdkOptions.dataSources)==null?void 0:d.traitManager,a=n.Traits.getTraitsByCategory(e),i=(f=a.find(p=>!p.category))==null?void 0:f.items,l=a.filter(p=>p.category),u=Z("gs-utl-text-center");return c.jsx(I,{className:Z(Th,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[i==null?void 0:i.map(p=>c.jsx(Bw,{trait:p,isDarkTheme:r,traitManagerDataConfig:s},p.id)),l.map(({category:p,items:g},m)=>c.jsx(mo,{open:!!(p!=null&&p.get("open")),onChange:({open:v})=>p==null?void 0:p.set({open:v}),handler:p==null?void 0:p.getLabel(),handlerIcon:p==null?void 0:p.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${Th}-category -gs-utl-mx-2`,className:v=>Z(Ed.itemList({index:m+(i?1:0),open:v,length:l.length})),children:g.map(v=>c.jsx(Bw,{trait:v,isDarkTheme:r,traitManagerDataConfig:s},v.id))},p==null?void 0:p.id))]}):c.jsx(B,{className:u,children:"No properties available"}):c.jsx(B,{className:u,children:n.t("traitManager.empty")})})}const Ph=ce(p7),h7="gs-panel-properties",g7=h.memo(ce(function({className:t,...n}){return c.jsx(Cr,{className:N(h7,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(ip,{children:r=>c.jsx(Ph,{...r})})})})),m7=async({html:e="",css:t="",el:n})=>{const r=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,o={};if(document.body.attachShadow){const s=n.shadowRoot||n.attachShadow({mode:"open"});s.innerHTML=r}return o},v7=ce(function({rule:t,onSelect:n,onRemove:r,className:o}){const s=h.useRef(null),i=we().editor,l=Ie(),u=t.getDevice(),d=t.getState(),{isDarkTheme:f}=jr(),[p,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,v]=h.useState(p),b=t.selectorsToString(),w=()=>{i.select(),setTimeout(()=>i.Selectors.select(t)),n==null||n()},y=()=>{i.Css.remove(t),r==null||r()},S=()=>{if(m){const C=i.Parser.parseCss(m)[0];C&&(t.setStyle(C.style),g(m))}};return h.useEffect(()=>{if(s.current){const C=s.current;m7({el:C,html:'<div class="prv-rule">Preview</div>',css:`
326
+ `},gI={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 gt;(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"})(gt||(gt={}));function ch(...e){}class hl 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,r;return(n=(r=this.get(t))==null?void 0:r.node.current)!=null?n:void 0}}const vu=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:ch,draggableNodes:{},droppableRects:new Map,droppableContainers:new hl,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:ch},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:ch,windowRect:null,willRecomputeLayouts:!1});function mI(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new hl}}}function vI(e,t){switch(t.type){case gt.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case gt.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 gt.DragEnd:case gt.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case gt.RegisterDroppable:{const{element:n}=t,{id:r}=n,o=new hl(e.droppable.containers);return o.set(r,n),{...e,droppable:{...e.droppable,containers:o}}}case gt.SetDroppableDisabled:{const{id:n,key:r,disabled:o}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const a=new hl(e.droppable.containers);return a.set(n,{...s,disabled:o}),{...e,droppable:{...e.droppable,containers:a}}}case gt.UnregisterDroppable:{const{id:n,key:r}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const s=new hl(e.droppable.containers);return s.delete(n),{...e,droppable:{...e.droppable,containers:s}}}default:return e}}const Zy=h.createContext({type:null,event:null});function bI({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:o}){const s=h.useContext(Zy),a=h.useRef(s);h.useEffect(()=>{if(s!==a.current){const{type:i,event:l}=s;switch(i){case gt.DragStart:e==null||e(l);break;case gt.DragMove:t==null||t(l);break;case gt.DragOver:n==null||n(l);break;case gt.DragCancel:o==null||o(l);break;case gt.DragEnd:r==null||r(l);break}a.current=s}},[s,e,t,n,r,o])}function yI({announcements:e=gI,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:r,announcement:o}=fI(),s=dl("DndLiveRegion"),[a,i]=h.useState(!1);return h.useEffect(()=>{i(!0)},[]),bI(h.useMemo(()=>({onDragStart({active:l}){r(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&r(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){r(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){r(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){r(e.onDragCancel(l.id))}}),[r,e])),a?zn.createPortal(h.createElement(h.Fragment,null,h.createElement(dI,{id:t,value:n.draggable}),h.createElement(pI,{id:s,announcement:o})),document.body):null}const wo=Object.freeze({x:0,y:0});function Yy(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function Xy(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const wI=({collisionRect:e,droppableContainers:t})=>{const n=Xy(e,e.left,e.top);let r=1/0,o=null;for(const s of t){const{rect:{current:a}}=s;if(a){const i=Yy(Xy(a),n);i<r&&(r=i,o=s.id)}}return o};function SI(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function CI(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:wo}function xI(e){return function(n,...r){return r.reduce((o,s)=>({...o,top:o.top+e*s.y,bottom:o.bottom+e*s.y,left:o.left+e*s.x,right:o.right+e*s.x,offsetLeft:o.offsetLeft+e*s.x,offsetTop:o.offsetTop+e*s.y}),{...n})}}const Jy=xI(1);function EI(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function TI(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(o=>{const s=t[o];return typeof s=="string"?n.test(s):!1})!=null}function uh(e){const t=[];function n(r){if(!r)return t;if(sh(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!Ia(r)||Gy(r)||t.includes(r))return t;const o=window.getComputedStyle(r);return TI(r,o)&&t.push(r),EI(r,o)?t:n(r.parentNode)}return e?n(e.parentNode):t}function dh(e){return!mu||!e?null:$a(e)?e:oh(e)?sh(e)||e===Va(e).scrollingElement?window:Ia(e)?e:null:null}function ph(e){return $a(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var Ha;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(Ha||(Ha={}));function Qy(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},r=e.scrollTop<=t.y,o=e.scrollLeft<=t.x,s=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:r,isLeft:o,isBottom:s,isRight:a,maxScroll:n,minScroll:t}}function PI(e){return!mu||!e?!1:e===document.scrollingElement}const OI={x:.2,y:.2};function _I(e,t,{top:n,left:r,right:o,bottom:s},a=10,i=OI){const{clientHeight:l,clientWidth:u}=e,d=PI(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:p,isBottom:f,isLeft:g,isRight:m}=Qy(e),v={x:0,y:0},b={x:0,y:0},w={height:d.height*i.y,width:d.width*i.x};return!p&&n<=d.top+w.height?(v.y=Ha.Backward,b.y=a*Math.abs((d.top+w.height-n)/w.height)):!f&&s>=d.bottom-w.height&&(v.y=Ha.Forward,b.y=a*Math.abs((d.bottom-w.height-s)/w.height)),!m&&o>=d.right-w.width?(v.x=Ha.Forward,b.x=a*Math.abs((d.right-w.width-o)/w.width)):!g&&r<=d.left+w.width&&(v.x=Ha.Backward,b.x=a*Math.abs((d.left+w.width-r)/w.width)),{direction:v,speed:b}}function AI(e){if(e===document.scrollingElement){const{innerWidth:s,innerHeight:a}=window;return{top:0,left:0,right:s,bottom:a,width:s,height:a}}const{top:t,left:n,right:r,bottom:o}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:o,width:e.clientWidth,height:e.clientHeight}}function Ry(e){return e.reduce((t,n)=>pl(t,ph(n)),wo)}function ew(e,t,n=wo){if(!e||!Ia(e))return n;const r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:ew(e.offsetParent,t,r)}function bu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:o}=ew(e,null);return{width:t,height:n,offsetTop:o,offsetLeft:r}}function yu(e){if($a(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}=bu(e),{width:r,height:o,top:s,bottom:a,left:i,right:l}=e.getBoundingClientRect();return{width:r,height:o,top:s,bottom:a,right:l,left:i,offsetTop:t,offsetLeft:n}}function fh(e){const{width:t,height:n,offsetTop:r,offsetLeft:o}=bu(e),s=uh(e),a=Ry(s),i=r-a.y,l=o-a.x;return{width:t,height:n,top:i,bottom:i+n,right:l+t,left:l,offsetTop:r,offsetLeft:o}}function tw(e){return"top"in e}function nw(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 LI=({collisionRect:e,droppableContainers:t})=>{let n=1/0,r=null;const o=nw(e,e.left,e.top);for(const s of t){const{rect:{current:a}}=s;if(a){const i=nw(a,tw(a)?a.left:void 0,tw(a)?a.top:void 0),l=o.reduce((d,p,f)=>d+Yy(i[f],p),0),u=Number((l/4).toFixed(4));u<n&&(n=u,r=s.id)}}return r};function MI(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),o=Math.min(t.left+t.width,e.offsetLeft+e.width),s=Math.min(t.top+t.height,e.offsetTop+e.height),a=o-r,i=s-n;if(r<o&&n<s){const l=t.width*t.height,u=e.width*e.height,d=a*i,p=d/(l+u-d);return Number(p.toFixed(4))}return 0}const NI=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const o of t){const{rect:{current:s}}=o;if(s){const a=MI(s,e);a>n&&(n=a,r=o.id)}}return r};var gl;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(gl||(gl={}));var wu;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(wu||(wu={}));function kI({acceleration:e,activator:t=gl.Pointer,canScroll:n,draggingRect:r,enabled:o,interval:s=5,order:a=wu.TreeOrder,pointerCoordinates:i,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[p,f]=aI(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case gl.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case gl.DraggableRect:return r}return null},[t,r,i]),v=h.useRef(wo),b=h.useRef(null),w=h.useCallback(()=>{const S=b.current;if(!S)return;const C=g.current.x*v.current.x,x=g.current.y*v.current.y;S.scrollBy(C,x)},[]),y=h.useMemo(()=>a===wu.TreeOrder?[...l].reverse():l,[a,l]);h.useEffect(()=>{if(!o||!l.length||!m){f();return}for(const S of y){if((n==null?void 0:n(S))===!1)continue;const C=l.indexOf(S),x=u[C];if(!x)continue;const{direction:E,speed:T}=_I(S,x,m,e,d);if(T.x>0||T.y>0){f(),b.current=S,p(w,s),g.current=T,v.current=E;return}}g.current={x:0,y:0},v.current={x:0,y:0},f()},[e,w,n,f,o,s,JSON.stringify(m),p,l,y,u,JSON.stringify(d)])}function $I(e,t){const n=t!==null?e[t]:void 0,r=n?n.node.current:null;return ul(o=>{var s;return t===null?null:(s=r??o)!=null?s:null},[r,t])}function II(e,t){return h.useMemo(()=>e.reduce((n,r)=>{const{sensor:o}=r,s=o.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...s]},[]),[e,t])}function rw(e){const t=h.useRef(e);return Ws(()=>{t.current!==e&&(t.current=e)},[e]),t}var ml;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(ml||(ml={}));var hh;(function(e){e.Optimized="optimized"})(hh||(hh={}));const ow=new Map,VI={measure:bu,strategy:ml.WhileDragging,frequency:hh.Optimized};function HI(e,{dragging:t,dependencies:n,config:r}){const[o,s]=h.useState(!1),{frequency:a,measure:i,strategy:l}={...VI,...r},u=h.useRef(e),d=h.useCallback(()=>s(!0),[]),p=h.useRef(null),f=m(),g=ul(v=>{if(f&&!t)return ow;if(!v||v===ow||u.current!==e||o){for(let b of e)b&&(b.rect.current=b.node.current?i(b.node.current):null);return jI(e)}return v},[e,t,f,i,o]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{o&&s(!1)},[o]),h.useEffect(function(){f||requestAnimationFrame(d)},[t,f]),h.useEffect(function(){f||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{d(),p.current=null},a))},[a,f,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:o};function m(){switch(l){case ml.Always:return!1;case ml.BeforeDragging:return t;default:return!t}}}function jI(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:r,rect:o}=n;o.current!=null&&t.set(r,o.current)}return t}function DI(e){const[t,n]=h.useState(null),r=h.useRef(e),o=h.useCallback(s=>{const a=dh(s.target);a&&n(i=>i?(i.set(a,ph(a)),new Map(i)):null)},[]);return h.useEffect(()=>{const s=r.current;if(e!==s){a(s);const i=e.map(l=>{const u=dh(l);return u?(u.addEventListener("scroll",o,{passive:!0}),[u,ph(u)]):null}).filter(l=>l!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(s)};function a(i){i.forEach(l=>{const u=dh(l);u==null||u.removeEventListener("scroll",o)})}},[o,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((s,a)=>pl(s,a),wo):Ry(e):wo,[e,t])}const FI=[];function BI(e){const t=h.useRef(e),n=ul(r=>e?r&&e&&t.current&&e.parentNode===t.current.parentNode?r:uh(e):FI,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function zI(e){h.useEffect(()=>{if(!mu)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 UI(e,t){return h.useMemo(()=>e.reduce((n,{eventName:r,handler:o})=>(n[r]=s=>{o(s,t)},n),{}),[e,t])}const gh=aw(yu),WI=GI(yu);function sw(e,t,n){const r=h.useRef(e);return ul(o=>e?n||!o&&e||e!==r.current?Ia(e)&&e.parentNode==null?null:t(e):o??null:null,[e,n,t])}function aw(e){return(t,n)=>sw(t,e,n)}function GI(e){const t=[];return function(r,o){const s=h.useRef(r);return ul(a=>r.length?o||!a&&r.length||r!==s.current?r.map(i=>e(i)):a??t:t,[r,o])}}function qI(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ia(t)?t:e}function KI(e){const{width:t,height:n,offsetLeft:r,offsetTop:o}=bu(e);return{top:o,bottom:o+n,left:r,right:r+t,width:t,height:n,offsetTop:o,offsetLeft:r}}const ZI=aw(KI);function YI({disabled:e,forceRecompute:t}){const[n,r]=ah(),o=ZI(e?null:qI(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:o,setRef:r}),[o,n,r])}function iw(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function XI(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class vl{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var r;return(r=this.target)==null?void 0:r.removeEventListener(...n)})}}add(t,n,r){var o;(o=this.target)==null||o.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function JI(e){const{EventTarget:t}=rs(e);return e instanceof t?e:Va(e)}function mh(e,t){const n=Math.abs(e.x),r=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+r**2)>t:"x"in t&&"y"in t?n>t.x&&r>t.y:"x"in t?n>t.x:"y"in t?r>t.y:!1}var rr;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(rr||(rr={}));function lw(e){e.preventDefault()}function QI(e){e.stopPropagation()}var qe;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(qe||(qe={}));const cw={start:[qe.Space,qe.Enter],cancel:[qe.Esc],end:[qe.Space,qe.Enter]},RI=(e,{currentCoordinates:t})=>{switch(e.code){case qe.Right:return{...t,x:t.x+25};case qe.Left:return{...t,x:t.x-25};case qe.Down:return{...t,y:t.y+25};case qe.Up:return{...t,y:t.y-25}}};class vh{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=wo;const{event:{target:n}}=t;this.props=t,this.listeners=new vl(Va(n)),this.windowListeners=new vl(rs(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(rr.Resize,this.handleCancel),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(rr.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const r=yu(t.node.current),o={x:r.left,y:r.top};this.coordinates=o,n(o)}handleKeyDown(t){if(lI(t)){const{coordinates:n}=this,{active:r,context:o,options:s}=this.props,{keyboardCodes:a=cw,coordinateGetter:i=RI,scrollBehavior:l="smooth"}=s,{code:u}=t;if(a.end.includes(u)){this.handleEnd(t);return}if(a.cancel.includes(u)){this.handleCancel(t);return}const d=i(t,{active:r,context:o.current,currentCoordinates:n});if(d){const p={x:0,y:0},{scrollableAncestors:f}=o.current;for(const g of f){const m=t.code,v=Ky(d,n),{isTop:b,isRight:w,isLeft:y,isBottom:S,maxScroll:C,minScroll:x}=Qy(g),E=AI(g),T={x:Math.min(m===qe.Right?E.right-E.width/2:E.right,Math.max(m===qe.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(m===qe.Down?E.bottom-E.height/2:E.bottom,Math.max(m===qe.Down?E.top:E.top+E.height/2,d.y))},_=m===qe.Right&&!w||m===qe.Left&&!y,O=m===qe.Down&&!S||m===qe.Up&&!b;if(_&&T.x!==d.x){if(m===qe.Right&&g.scrollLeft+v.x<=C.x||m===qe.Left&&g.scrollLeft+v.x>=x.x){g.scrollBy({left:v.x,behavior:l});return}p.x=m===qe.Right?g.scrollLeft-C.x:g.scrollLeft-x.x,g.scrollBy({left:-p.x,behavior:l});break}else if(O&&T.y!==d.y){if(m===qe.Down&&g.scrollTop+v.y<=C.y||m===qe.Up&&g.scrollTop+v.y>=x.y){g.scrollBy({top:v.y,behavior:l});return}p.y=m===qe.Down?g.scrollTop-C.y:g.scrollTop-x.y,g.scrollBy({top:-p.y,behavior:l});break}}this.handleMove(t,pl(d,p))}}}handleMove(t,n){const{onMove:r}=this.props;t.preventDefault(),r(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()}}vh.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=cw,onActivation:n})=>{const{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function uw(e){return!!(e&&"distance"in e)}function dw(e){return!!(e&&"delay"in e)}class bh{constructor(t,n,r=JI(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:o}=t,{target:s}=o;this.props=t,this.events=n,this.document=Va(s),this.documentListeners=new vl(this.document),this.listeners=new vl(r),this.windowListeners=new vl(rs(s)),this.initialCoordinates=lh(o),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(rr.Resize,this.handleCancel),this.windowListeners.add(rr.DragStart,lw),this.windowListeners.add(rr.VisibilityChange,this.handleCancel),this.windowListeners.add(rr.ContextMenu,lw),this.documentListeners.add(rr.Keydown,this.handleKeydown),n){if(uw(n))return;if(dw(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(rr.Click,QI,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(rr.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:r,props:o}=this,{onMove:s,options:{activationConstraint:a}}=o;if(!r)return;const i=lh(t),l=Ky(r,i);if(!n&&a){if(dw(a))return mh(l,a.tolerance)?this.handleCancel():void 0;if(uw(a))return a.tolerance!=null&&mh(l,a.tolerance)?this.handleCancel():mh(l,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),s(i)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===qe.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const e9={move:{name:"pointermove"},end:{name:"pointerup"}};class yh extends bh{constructor(t){const{event:n}=t,r=Va(n.target);super(t,e9,r)}}yh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const t9={move:{name:"mousemove"},end:{name:"mouseup"}};var wh;(function(e){e[e.RightClick=2]="RightClick"})(wh||(wh={}));class n9 extends bh{constructor(t){super(t,t9,Va(t.event.target))}}n9.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===wh.RightClick?!1:(t==null||t({event:e}),!0)}];const Sh={move:{name:"touchmove"},end:{name:"touchend"}};class r9 extends bh{constructor(t){super(t,Sh)}static setup(){return window.addEventListener(Sh.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Sh.move.name,t)};function t(){}}}r9.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function o9(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((r,o)=>o({transform:r,...n}),t):t}const s9=[{sensor:yh,options:{}},{sensor:vh,options:{}}],a9={current:{}},pw=h.createContext({...wo,scaleX:1,scaleY:1}),i9=h.memo(function({id:t,autoScroll:n=!0,announcements:r,children:o,sensors:s=s9,collisionDetection:a=NI,measuring:i,modifiers:l,screenReaderInstructions:u=hI,...d}){var p,f,g,m,v;const b=h.useReducer(vI,void 0,mI),[w,y]=b,[S,C]=h.useState(()=>({type:null,event:null})),[x,E]=h.useState(!1),{draggable:{active:T,nodes:_,translate:O},droppable:{containers:P}}=w,A=T?_[T]:null,M=h.useRef({initial:null,translated:null}),k=h.useMemo(()=>{var Re;return T!=null?{id:T,data:(Re=A==null?void 0:A.data)!=null?Re:a9,rect:M}:null},[T,A]),j=h.useRef(null),[L,D]=h.useState(null),[W,F]=h.useState(null),$=h.useRef(d),H=dl("DndDescribedBy",t),V=h.useMemo(()=>P.getEnabled(),[P]),{layoutRectMap:U,recomputeLayouts:J,willRecomputeLayouts:Y}=HI(V,{dragging:x,dependencies:[O.x,O.y],config:i==null?void 0:i.droppable}),X=$I(_,T),Q=W?lh(W):null,ee=sw(X,(p=i==null||(f=i.draggable)==null?void 0:f.measure)!=null?p:fh),G=gh(X),R=h.useRef(null),le=R.current,ge=h.useRef({active:null,activeNode:X,collisionRect:null,droppableRects:U,draggableNodes:_,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Te=P.getNodeFor((g=ge.current.over)==null?void 0:g.id),Ce=gh(X?X.ownerDocument.defaultView:null),tt=gh(X?X.parentElement:null),Qe=BI(T?Te??X:null),Ot=WI(Qe),ut=YI({disabled:T==null,forceRecompute:Y}),Se=(m=ut.rect)!=null?m:ee,ot=Se===ee?CI(ee,le):wo,st=o9(l,{transform:{x:O.x-ot.x,y:O.y-ot.y,scaleX:1,scaleY:1},activatorEvent:W,active:k,activeNodeRect:G,containerNodeRect:tt,draggingNodeRect:Se,over:ge.current.over,overlayNodeRect:ut.rect,scrollableAncestors:Qe,scrollableAncestorRects:Ot,windowRect:Ce}),wt=Q?pl(Q,O):null,Ne=DI(Qe),mt=pl(st,Ne),dt=Se?Jy(Se,st):null,Ue=dt?Jy(dt,Ne):null,tn=k&&Ue?a({active:k,collisionRect:Ue,droppableContainers:V}):null,[he,De]=h.useState(null),Fe=SI(st,(v=he==null?void 0:he.rect)!=null?v:null,ee),He=h.useCallback((Re,{sensor:St,options:nn})=>{if(!j.current)return;const Dn=_[j.current];if(!Dn)return;const Yt=new St({active:j.current,activeNode:Dn,event:Re.nativeEvent,options:nn,context:ge,onStart(Pn){const cs=j.current;if(!cs)return;const us=_[cs];if(!us)return;const{onDragStart:ds}=$.current,ps={active:{id:cs,data:us.data,rect:M}};zn.unstable_batchedUpdates(()=>{y({type:gt.DragStart,initialCoordinates:Pn,active:cs}),C({type:gt.DragStart,event:ps})}),ds==null||ds(ps)},onMove(Pn){y({type:gt.DragMove,coordinates:Pn})},onEnd:Zs(gt.DragEnd),onCancel:Zs(gt.DragCancel)});zn.unstable_batchedUpdates(()=>{D(Yt),F(Re.nativeEvent)});function Zs(Pn){return async function(){const{active:us,over:ds,scrollAdjustedTranslate:ps}=ge.current;let fs=null;if(us&&ps){const{cancelDrop:mn}=$.current;fs={active:us,delta:ps,over:ds},Pn===gt.DragEnd&&typeof mn=="function"&&await Promise.resolve(mn(fs))&&(Pn=gt.DragCancel)}if(j.current=null,zn.unstable_batchedUpdates(()=>{y({type:Pn}),De(null),E(!1),D(null),F(null),fs&&C({type:Pn,event:fs})}),fs){const{onDragCancel:mn,onDragEnd:Pr}=$.current,Fu=Pn===gt.DragEnd?Pr:mn;Fu==null||Fu(fs)}}}},[y,_]),Mt=h.useCallback((Re,St)=>(nn,Dn)=>{const Yt=nn.nativeEvent;j.current!==null||Yt.dndKit||Yt.defaultPrevented||Re(nn,St.options)===!0&&(Yt.dndKit={capturedBy:St.sensor},j.current=Dn,He(nn,St))},[He]),Wt=II(s,Mt);zI(s),Ws(()=>{$.current=d},Object.values(d)),h.useEffect(()=>{T!=null&&E(!0)},[T]),h.useEffect(()=>{k||(R.current=null),k&&ee&&!R.current&&(R.current=ee)},[ee,k]),h.useEffect(()=>{const{onDragMove:Re}=$.current,{active:St,over:nn}=ge.current;if(!St)return;const Dn={active:St,delta:{x:mt.x,y:mt.y},over:nn};C({type:gt.DragMove,event:Dn}),Re==null||Re(Dn)},[mt.x,mt.y]),h.useEffect(()=>{const{active:Re,droppableContainers:St,scrollAdjustedTranslate:nn}=ge.current;if(!Re||!j.current||!nn)return;const{onDragOver:Dn}=$.current,Yt=St.get(tn),Zs=Yt&&Yt.rect.current?{id:Yt.id,rect:Yt.rect.current,data:Yt.data,disabled:Yt.disabled}:null,Pn={active:Re,delta:{x:nn.x,y:nn.y},over:Zs};zn.unstable_batchedUpdates(()=>{De(Zs),C({type:gt.DragOver,event:Pn}),Dn==null||Dn(Pn)})},[tn]),Ws(()=>{ge.current={active:k,activeNode:X,collisionRect:Ue,droppableRects:U,draggableNodes:_,draggingNodeRect:Se,droppableContainers:P,over:he,scrollableAncestors:Qe,scrollAdjustedTranslate:mt,translatedRect:dt},M.current={initial:Se,translated:dt}},[k,X,Ue,_,Se,U,P,he,Qe,mt,dt]),kI({...Ks(),draggingRect:dt,pointerCoordinates:wt,scrollableAncestors:Qe,scrollableAncestorRects:Ot});const Co=h.useMemo(()=>({active:k,activeNode:X,activeNodeRect:ee,activeNodeClientRect:G,activatorEvent:W,activators:Wt,ariaDescribedById:{draggable:H},containerNodeRect:tt,dispatch:y,dragOverlay:ut,draggableNodes:_,droppableContainers:P,droppableRects:U,over:he,recomputeLayouts:J,scrollableAncestors:Qe,scrollableAncestorRects:Ot,willRecomputeLayouts:Y,windowRect:Ce}),[k,X,G,ee,W,Wt,tt,ut,y,_,H,P,U,he,J,Qe,Ot,Y,Ce]);return h.createElement(Zy.Provider,{value:S},h.createElement(vu.Provider,{value:Co},h.createElement(pw.Provider,{value:Fe},o)),h.createElement(yI,{announcements:r,hiddenTextDescribedById:H,screenReaderInstructions:u}));function Ks(){const Re=(L==null?void 0:L.autoScrollEnabled)===!1,St=typeof n=="object"?n.enabled===!1:n===!1,nn=!Re&&!St;return typeof n=="object"?{...n,enabled:nn}:{enabled:nn}}}),l9=h.createContext(null),fw="button",c9="Droppable";function u9({id:e,data:t,disabled:n=!1,attributes:r}){const o=dl(c9),{active:s,activeNodeRect:a,activatorEvent:i,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:p,over:f}=h.useContext(vu),{role:g=fw,roleDescription:m="draggable",tabIndex:v=0}=r??{},b=(s==null?void 0:s.id)===e,w=h.useContext(b?pw:l9),[y,S]=ah(),C=UI(p,e),x=rw(t);h.useEffect(()=>(u[e]={id:e,key:o,node:y,data:x},()=>{const T=u[e];T&&T.key===o&&delete u[e]}),[u,e]);const E=h.useMemo(()=>({role:g,tabIndex:v,"aria-pressed":b&&g===fw?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[g,v,b,m,l.draggable]);return{active:s,activeNodeRect:a,activatorEvent:i,attributes:E,droppableRects:d,isDragging:b,listeners:n?void 0:C,node:y,over:f,setNodeRef:S,transform:w}}function d9(){return h.useContext(vu)}const p9="Droppable";function f9({data:e,disabled:t=!1,id:n}){const r=dl(p9),{active:o,dispatch:s,over:a}=h.useContext(vu),i=h.useRef(null),[l,u]=ah(),d=rw(e);return Ws(()=>(s({type:gt.RegisterDroppable,element:{id:n,key:r,disabled:t,node:l,rect:i,data:d}}),()=>s({type:gt.UnregisterDroppable,key:r,id:n})),[n]),h.useEffect(()=>{s({type:gt.SetDroppableDisabled,id:n,key:r,disabled:t})},[t]),{active:o,rect:i,isOver:(a==null?void 0:a.id)===n,node:l,over:a,setNodeRef:u}}function h9(e,t,n){const r={...e};return t.top+e.y<=n.top?r.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(r.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?r.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(r.x=n.left+n.width-t.right),r}const g9=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const r=n[0];return!e||!r?t:h9(t,e,r)},m9=({transform:e})=>({...e,x:0});function hw(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function v9(e,t){return e.reduce((n,r,o)=>{const s=t.get(r);return s&&(n[o]=s),n},Array(e.length))}function Su(e){return e!==null&&e>=0}const gw=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{const o=hw(e,n,t),s=e[r],a=o[r];return!a||!s?null:{x:a.offsetLeft-s.offsetLeft,y:a.offsetTop-s.offsetTop,scaleX:a.width/s.width,scaleY:a.height/s.height}},Cu={scaleX:1,scaleY:1},b9=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:r,overIndex:o})=>{var s;const a=(s=r[e])!=null?s:t;if(!a)return null;if(n===e){const l=r[o];return l?{x:0,y:e<o?l.offsetTop+l.height-(a.offsetTop+a.height):l.offsetTop-a.offsetTop,...Cu}:null}const i=y9(r,n,e);return n>e&&n<=o?{x:0,y:-a.height-i,...Cu}:n<e&&n>=o?{x:0,y:a.height+i,...Cu}:{x:0,y:0,...Cu}};function y9(e,t,n){const r=e[t],o=e[t-1],s=e[t+1];return r?n<t?o?r.offsetTop-(o.offsetTop+o.height):s?s.offsetTop-(r.offsetTop+r.height):0:s?s.offsetTop-(r.offsetTop+r.height):o?r.offsetTop-(o.offsetTop+o.height):0:0}const mw="Sortable",vw=h.createContext({activeIndex:-1,containerId:mw,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:gw,wasDragging:{current:!1}});function w9({children:e,id:t,items:n,strategy:r=gw}){const{active:o,dragOverlay:s,droppableRects:a,over:i,recomputeLayouts:l,willRecomputeLayouts:u}=d9(),d=dl(mw,t),p=s.rect!==null,f=h.useMemo(()=>n.map(T=>typeof T=="string"?T:T.id),[n]),g=o!=null,m=h.useRef(!1),v=o?f.indexOf(o.id):-1,b=v!==-1,w=i?f.indexOf(i.id):-1,y=h.useRef(f),S=v9(f,a),C=!S9(f,y.current),x=w!==-1&&v===-1||C;Ws(()=>{C&&b&&!u&&l()},[C,b,l,u]),h.useEffect(()=>{y.current=f},[f]),h.useEffect(()=>{const T=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(T)},[g]);const E=h.useMemo(()=>({activeIndex:v,containerId:d,disableTransforms:x,items:f,overIndex:w,useDragOverlay:p,sortedRects:S,strategy:r,wasDragging:m}),[v,d,x,f,w,S,p,r,m]);return h.createElement(vw.Provider,{value:E},e)}function S9(e,t){return e.join()===t.join()}const C9=({id:e,items:t,activeIndex:n,overIndex:r})=>hw(t,n,r).indexOf(e),x9=({containerId:e,isSorting:t,wasDragging:n,index:r,items:o,newIndex:s,previousItems:a,previousContainerId:i,transition:l})=>!l||!n||a!==o&&r===s?!1:t?!0:s!==r&&e===i,E9={duration:200,easing:"ease"},bw="transform",T9=fl.Transition.toString({property:bw,duration:0,easing:"linear"}),P9={roleDescription:"sortable"};function O9({disabled:e,index:t,node:n,rect:r}){const[o,s]=h.useState(null),a=h.useRef(t);return Ws(()=>{if(!e&&t!==a.current&&n.current){const i=r.current;if(i){const l=yu(n.current),u={x:i.offsetLeft-l.offsetLeft,y:i.offsetTop-l.offsetTop,scaleX:i.width/l.width,scaleY:i.height/l.height};(u.x||u.y)&&s(u)}}t!==a.current&&(a.current=t)},[e,t,n,r]),h.useEffect(()=>{o&&requestAnimationFrame(()=>{s(null)})},[o]),o}function _9({animateLayoutChanges:e=x9,attributes:t,disabled:n,data:r,getNewIndex:o=C9,id:s,strategy:a,transition:i=E9}){const{items:l,containerId:u,activeIndex:d,disableTransforms:p,sortedRects:f,overIndex:g,useDragOverlay:m,strategy:v,wasDragging:b}=h.useContext(vw),w=l.indexOf(s),y=h.useMemo(()=>({sortable:{containerId:u,index:w,items:l},...r}),[u,r,w,l]),{rect:S,node:C,setNodeRef:x}=f9({id:s,data:y}),{active:E,activeNodeRect:T,activatorEvent:_,attributes:O,setNodeRef:P,listeners:A,isDragging:M,over:k,transform:j}=u9({id:s,data:y,attributes:{...P9,...t},disabled:n}),L=oI(x,P),D=!!E,W=D&&b.current&&!p&&Su(d)&&Su(g),F=!m&&M,$=F&&W?j:null,V=W?$??(a??v)({layoutRects:f,activeNodeRect:T,activeIndex:d,overIndex:g,index:w}):null,U=Su(d)&&Su(g)?o({id:s,items:l,activeIndex:d,overIndex:g}):w,J=h.useRef(l),Y=l!==J.current,X=h.useRef(U),Q=h.useRef(u),ee=e({active:E,containerId:u,isDragging:M,isSorting:D,id:s,index:w,items:l,newIndex:X.current,previousItems:J.current,previousContainerId:Q.current,transition:i,wasDragging:b.current}),G=O9({disabled:!ee,index:w,node:C,rect:S});return h.useEffect(()=>{D&&X.current!==U&&(X.current=U),u!==Q.current&&(Q.current=u),l!==J.current&&(J.current=l)},[D,U,u,l]),{active:E,attributes:O,activatorEvent:_,rect:S,index:w,isSorting:D,isDragging:M,listeners:A,node:C,overIndex:g,over:k,setNodeRef:L,setDroppableNodeRef:x,setDraggableNodeRef:P,transform:G??V,transition:R()};function R(){if(G||Y&&X.current===w)return T9;if(!(F||!i)&&(D||ee))return fl.Transition.toString({...i,property:bw})}}const A9=[qe.Down,qe.Right,qe.Up,qe.Left],L9=(e,{context:{active:t,droppableContainers:n,translatedRect:r,scrollableAncestors:o}})=>{if(A9.includes(e.code)){if(e.preventDefault(),!t||!r)return;const a=[];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=fh(u),p={...l,rect:{current:d}};switch(e.code){case qe.Down:r.top+r.height<=d.top&&a.push(p);break;case qe.Up:r.top>=d.top+d.height&&a.push(p);break;case qe.Left:r.left>=d.left+d.width&&a.push(p);break;case qe.Right:r.left+r.width<=d.left&&a.push(p);break}});const i=LI({active:t,collisionRect:r,droppableContainers:a});if(i){var s;const l=(s=n.get(i))==null?void 0:s.node.current;if(l){const d=uh(l).some((m,v)=>o[v]!==m),p=fh(l),f=d?{x:0,y:0}:{x:r.width-p.width,y:r.height-p.height};return{x:p.left-f.x,y:p.top-f.y}}}}};function M9(e){const{id:t,item:n,className:r,select:o,remove:s,renderItem:a,previewStyle:i,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:p,listeners:f,setNodeRef:g,transform:m,transition:v}=_9({id:t,disabled:u}),b={transform:fl.Transform.toString(m),transition:v},w=()=>!u&&(o==null?void 0:o(n));return c.jsx("div",{...l?{ref:g,style:b,...p}:{},children:c.jsxs(I,{space:"s",onClick:w,className:r,items:"center",nowrap:!0,children:[l&&c.jsx(B,{className:Z(!u&&Oe.hover,!u&&"cursor-grab"),...f,children:c.jsx(re,{icon:q.dotsVertical,size:se.sx})}),c.jsx(B,{grow:!0,className:Z("overflow-hidden"),children:c.jsxs(I,{children:[c.jsx(B,{grow:!0,className:Z("overflow-ellipsis overflow-hidden"),children:a(n)}),!!i&&c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:i(n)})})]})}),s&&d?c.jsx(tu,{disabled:u,onConfirm:()=>{s==null||s(n)},children:c.jsx(B,{className:Z(!u&&Oe.click),children:c.jsx(re,{icon:q.close,size:se.sx})})}):c.jsx(B,{className:Z(!u&&Oe.click),onClick:y=>{hs(y),!u&&(s==null||s(n))},children:c.jsx(re,{icon:q.close,size:se.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Xr(e){const{className:t,items:n,selected:r,renderItem:o,select:s,add:a,remove:i,move:l,previewStyle:u,getItemId:d=P=>P.id||P.name||P.title||P.label||"",label:p,labelAs:f,children:g,title:m="Select",titleAdd:v="Add",emptyState:b,disabled:w=!1,hidePopover:y,popoverPlacement:S="left",confirmRemove:C}=e,x=XI(iw(yh),iw(vh,{coordinateGetter:L9}));function E(P){const{active:A,over:M}=P;if(A.id!==(M==null?void 0:M.id)){const k=n.find(L=>d(L)===A.id),j=n.findIndex(L=>d(L)===(M==null?void 0:M.id));k&&(l==null||l(k,j))}}const T=Z(te.rnd,z.br,n.length&&te.b,n.length&&"gjs-mt-1");let _=c.jsxs("div",{className:T,children:[n.length===0&&b&&c.jsx(I,{className:N("gs-utl-p-2 gs-utl-text-center",z.txtLowEmphasis),items:"center",justify:"center",children:b}),n.map((P,A)=>{const M=d(P),k=P===r,j=Z("gjs-px-2 gjs-py-2 text-xs",z.br,A&&te.bt,!!s&&!k&&!w&&z.hBgH2,k&&z.bgH,w&&"opacity-75");return c.jsx(M9,{id:M,item:P,className:j,select:s,remove:i,renderItem:o,previewStyle:u,sortable:!!l,disabled:w,confirmRemove:C},M||A)})]});l&&(_=c.jsx(i9,{sensors:x,collisionDetection:wI,onDragEnd:E,modifiers:[m9,g9],children:c.jsx(w9,{items:n.map(d),strategy:b9,children:_})})),s&&!y&&(_=c.jsx(Cr,{placement:S,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!r&&!w,onClose:()=>s==null?void 0:s(null),handler:_,children:g}));const O=a?[{type:"button",icon:q.plus,tooltip:v,variant:"outline",size:"xs",disabled:w,onClick:a}]:[];return c.jsxs("div",{className:Z(t,"w-full"),children:[!!(p||a)&&c.jsx(wr,{...e,as:f,afterLabelButtons:O}),_]})}const N9=ce(function(){const t=Ie(),{editor:n}=we(),r=Ai(),o=Li(),s=o.sortedFonts;return n?c.jsx(Xr,{items:s,selected:null,renderItem:a=>{const i=$p(a);return c.jsxs(I,{col:!0,children:[c.jsx(B,{className:"gs-utl-text-lg",style:{fontFamily:i},children:a.familyLabel}),c.jsx(B,{children:a.familyLabel})]})},remove:a=>o.removeFont(a.family),add:o.sdkAddFonts&&r.hasType("font")?()=>rh(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:a=>a.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),yw=qt(function({size:t="m",className:n,classNameContent:r,border:o=!0,children:s,...a},i){const l=ae(z.bg,z.br,o&&`${te.b} ${te.rnd}`,t==="m"&&Pe.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx(I,{className:l,items:"center",space:"x2s",...a,ref:i,children:c.jsx(B,{grow:!0,className:r,children:s})})}),ww=qt(({autoResize:e,style:t={},...n},r)=>{const o=h.useRef(null),s=r||o;return h.useEffect(()=>{!s.current||!e||(s.current.style.height="auto",s.current.style.height=s.current.scrollHeight+"px")},[n.value,e,s]),c.jsx("textarea",{ref:s,style:{...t,...e?{resize:"none"}:{}},...n})});ww.displayName="TextAreaWithAutoResize";const k9="gs-field-textarea";function Sw(e){const{className:t,value:n,label:r,size:o,description:s,placeholder:a,readOnly:i,disabled:l,required:u,onChange:d,onKeyDown:p,afterInput:f,minHeight:g,maxHeight:m,autoResize:v,classNameField:b,classNameFieldContent:w,classNameInput:y}=e,S=Di(e);return c.jsxs("div",{className:Z(k9,t),children:[!!r&&c.jsx(Go,{size:o,children:r}),!!s&&c.jsx(Go,{size:o,as:"span",className:Z(z.txtLowEmphasis),capitalize:!1,children:s}),c.jsxs(yw,{size:o,className:b,classNameContent:w,children:[c.jsx(ww,{className:Z(S,y),autoResize:v,value:n,placeholder:a,readOnly:i,disabled:l,required:u,onChange:C=>d==null?void 0:d(C.target.value),onKeyDown:p,style:{minHeight:g,maxHeight:m}}),f]})]})}const xu="gs-page-settings",$9=`${xu}-header`,I9=`${xu}-content`,V9=`${xu}-footer`,Cw="",H9=ce(function({className:t,classNameHeader:n,classNameContent:r,classNameFooter:o,page:s,size:a=ef.m}){const i=we(),{isDarkTheme:l}=Fr(),u=Li(),d=Ie(),[p,f]=h.useState(s),[g,m]=h.useState(()=>hv(p,i)),[v,b]=h.useState(()=>d.t("update")),w=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:S}=i,C={containerClassName:"gs-utl-min-h-80",size:a,padding:5,isDarkTheme:l,clean:!0};if(!S)return null;const x=k=>m(j=>({...j,...k})),E=k=>{k.preventDefault();const{name:j,...L}=g;L.customCodeHead=US(L.customCodeHead),L.customCodeBody=zS(L.customCodeBody),p?(B3(p,L),p.setName(j)):i.setProjectDataCustom({globalPageSettings:L}),b(d.t("updated")),setTimeout(()=>b(d.t("update")),2e3),cv(S),S.trigger(On.pageSettingsUpdate,{page:p,data:{name:j,...L}})},T={tooltip:d.t("clear")},_=(p==null?void 0:p.getId())??Cw,O=k=>{const j=S.Pages.get(k);f(j),m(hv(j,i))},P=Vp(p),A=!!p&&Ec(p),M=[{id:Cw,label:w("global")},...S.Pages.getAll().map(k=>({icon:iv(k),id:k.getId(),label:k.getName()}))];return c.jsx("form",{onSubmit:E,className:N(xu,"gs-utl-h-full",t),children:c.jsxs(I,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(B,{className:N($9,n,z.br,te.bb),children:c.jsx(Le,{value:_,onChange:O,options:M,handlerSelected:k=>c.jsxs(I,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),k.icon&&ct(k.icon)&&c.jsx(re,{icon:k.icon,size:se.s2x}),c.jsx("span",{children:k.label})]})})}),c.jsxs(I,{col:!0,className:N(I9,"gs-utl-gap-5 gs-utl-overflow-y-auto",r),nowrap:!0,children:[!!_&&c.jsxs(c.Fragment,{children:[c.jsx(rt,{size:a,value:g.name,onChange:k=>x({name:k}),label:y("name.label"),description:y("name.description"),required:!0}),!P&&c.jsx(rt,{size:a,value:g.slug,onChange:k=>x({slug:A?tC(k,["id"]):Cl(k)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(rt,{size:a,value:g.title,onChange:k=>x({title:k}),label:y("title.label"),description:y("title.description")}),c.jsx(Sw,{size:a,value:g.description,onChange:k=>x({description:k}),label:y("description.label"),description:y("description.description")}),c.jsx(cl,{size:a,clear:T,value:g.favicon,onChange:k=>x({favicon:k}),onOpen:()=>{S.Assets.open({select(k){x({favicon:k.getSrc()}),S.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(rt,{size:a,value:g.keywords,onChange:k=>x({keywords:k}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(rt,{size:a,value:g.socialTitle,onChange:k=>x({socialTitle:k}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(cl,{size:a,clear:T,value:g.socialImage,onChange:k=>x({socialImage:k}),onOpen:()=>{S.Assets.open({select(k){x({socialImage:k.getSrc()}),S.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(Sw,{size:a,value:g.socialDescription,onChange:k=>x({socialDescription:k}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(mo,{language:"html",defaultValue:g.customCodeHead,onChange:k=>x({customCodeHead:k}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...C},`head-${_}`),c.jsx(mo,{language:"html",defaultValue:g.customCodeBody,onChange:k=>x({customCodeBody:k}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...C},`body-${_}`),u.sdkShowProjectFonts&&!_&&c.jsx(N9,{})]}),c.jsx(I,{className:N(V9,"gs-utl-mt-auto",o,z.br,te.bt),children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:v})})]})})}),j9="gs-panel-page-settings",D9=h.memo(ce(function({className:t,page:n,...r}){return c.jsx(Er,{className:N(j9,"gs-utl-overflow-hidden",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...r,children:c.jsx(Bi,{children:c.jsx(H9,{className:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:ef.s,classNameHeader:Pe.s,classNameContent:Pe.s,classNameFooter:Pe.s})})})})),Eu="gs-page-item",xw=ce(function({page:t,rename:n,setRename:r,commandItems:o}){const s=we(),a=Ie(),i=s.editor,{Pages:l}=i,u=s.sdkPagesConfig,d=u==null?void 0:u.settings,p=u==null?void 0:u.showHomeIcon,f=u==null?void 0:u.layoutBefore,g=E=>a.t(`pageManager.${E}`),m=E=>l.select(E),v=E=>l.getSelected()===E,b=E=>E===n,w=v(t),y=E=>E.getName()||E.getId(),S=E=>{n==null||n.set({name:E}),r(void 0)},C=ae("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),x=()=>i.runCommand(ne.setPageSettings,{page:t,isOpen:!0});return c.jsxs(I,{gap:"s",items:"center",onClick:()=>m(t),className:ae([Eu,"group cursor-default",Pe.xy,w?z.bgH:z.hBgH2]),children:[p&&Vp(t)&&c.jsx(B,{className:`${Eu}__icon-home`,title:g("homePage"),children:c.jsx(re,{icon:q.home,size:se.s3x})}),f&&kt(f({page:t,editor:i,isSelected:w})),c.jsx(B,{className:ae(`${Eu}__name truncate`),grow:!0,children:b(t)?c.jsx(nh,{value:y(t),onChange:S}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(I,{className:`${Eu}__actions`,gap:"xs",onClick:hs,items:"center",children:[!n&&d!==!1&&c.jsx(Ct,{className:C,size:"xs",border:!1,title:g("settings.label"),onClick:x,block:!0,children:c.jsx(re,{icon:q.cog,size:se.s3x})}),w&&!!o.length&&c.jsx(Cr,{placement:"right-start",handler:c.jsx(re,{icon:q.dotsVertical,size:se.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>o.map(T=>c.jsx(Oa,{icon:T.icon,label:et(T.label)?T.label({editor:i}):T.label,action:()=>{var _;E(),(_=T.cmd)==null||_.call(T,{page:t,editor:i})}},T.id))})]})]},t.getId())});function F9({dragging:e,dragRect:t}){const n=!!(e&&t),r=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:r}}var Ew=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Ew||{});const Ch="gs-cmp-sortable",Tw=3;function B9({items:e,direction:t,onDrop:n,renderItem:r}){const[o,s]=h.useState(null),[a,i]=h.useState(-1),[l,u]=h.useState(),[d,p]=h.useState(!1),f=h.useRef(null),{showIndicator:g,indicatorStyle:m}=F9({dragging:!!o&&d,dragRect:l}),v=h.useMemo(()=>[],[e]);h.useEffect(()=>{const T=window.document,_=O=>O.key==="Escape"&&y(O);return T.addEventListener("keydown",_),()=>T.removeEventListener("keydown",_)},[]);const b=T=>_=>{_.button===0&&(f.current={x:_.clientX,y:_.clientY},s(T),p(!1),_.target.setPointerCapture(_.pointerId))},w=T=>{const _=f.current;if(!o||!_)return;if(!d){const k=Math.abs(T.clientX-_.x),j=Math.abs(T.clientY-_.y);(t==="vertical"?j>Tw:k>Tw)&&p(!0);return}const O=T.clientY;let P=-1;v.forEach((k,j)=>{const L=k.getBoundingClientRect();O>L.top+L.height/2&&(P=j)});const A=e.findIndex(k=>k.id===o.id);P<A&&(P+=1),P=Math.min(P,e.length-1),i(P);const M=v[P];if(M){const{height:k,top:j}=M.getBoundingClientRect(),L=O<j+k/2;u({y:M.offsetTop+(L?0:k),h:k})}},y=T=>{s(null),p(!1),f.current=null,u(void 0);const _=T.target,{pointerId:O}=T;O&&(_==null||_.releasePointerCapture(O))},S=T=>{!o||!f.current||(l&&a!==-1&&(n==null||n(o,a)),y(T))},C=N(Ch,"gs-utl-relative"),x=N(`${Ch}__indicator`,z.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),E=T=>N(`${Ch}__item`,g&&(o==null?void 0:o.id)===T.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx(I,{col:t==="vertical",className:C,children:e.map((T,_)=>c.jsx(B,{ref:O=>{O&&(v[_]=O)},className:E(T),onPointerDown:b(T),onPointerMove:w,onPointerUp:S,children:r(T)},T.id))}),g&&c.jsx("div",{className:x,style:m})]})}const z9=({pages:e,commandItems:t,rename:n,setRename:r,editor:o})=>{if(!o.Pages.move)return e.map(l=>c.jsx(xw,{page:l,commandItems:t,rename:n,setRename:r},l.getId()));const s=(l,u)=>{o.Pages.move(l.entity,{at:u})},a=l=>c.jsx(xw,{page:l.entity,commandItems:t,rename:n,setRename:r},l.id),i=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(B9,{items:i,direction:Ew.vertical,onDrop:s,renderItem:a})},U9=({items:e,editor:t,sdkPageConfig:n})=>{const r=n==null?void 0:n.commandItems;return r===!1?[]:et(r)?r({items:e,editor:t}):r||e},xh="gs-panel-page-manager",Pw=ce(function({pages:t,select:n,add:r,remove:o,header:s,resizable:a={bottom:!0},height:i=200}){const l=we(),u=xa(),d=Ie(),{sdkPagesConfig:p}=l,f=l.editor,[g,m]=h.useState(),v=M=>d.t(`pageManager.${M}`),b=p==null?void 0:p.add,w=p==null?void 0:p.duplicate,y=p==null?void 0:p.remove,S=M=>{hs(M);const k=L=>{const D=t.length+1;return r({name:`${v("page")} ${D}`,component:`<div>${v("newPage")} ${D}</div>`,...L},{select:!0})};if(b)return b({event:M,editor:f,rename:m,addPage:k});const j=k();j&&m(j)},C=({page:M})=>{if(y)return y({editor:f,page:M});u.confirm({title:v("deletePage"),content:v("confirmDelete"),confirmButton:{variant:"danger",children:v("deletePage")},onConfirm:()=>{const k=t.indexOf(M),j=t[k+1]||t[0];n(j),o(M)}})},x=({page:M})=>{if(w)return w({editor:f,page:M,rename:m});const k=M.getMainComponent(),j=r({name:`${M.getName()} (${v("copy")})`,component:k.clone()},{select:!0});j&&m(j)},E=[{id:"rename",label:v("rename"),icon:q.pencil,cmd:({page:M})=>m(M)},w!==!1&&{id:"duplicate",label:v("duplicate"),icon:q.contentCopy,cmd:x},t.length>1&&y!==!1&&{id:"remove",label:v("delete"),icon:q.delete,cmd:C}].filter(Boolean),T=U9({items:E,editor:f,sdkPageConfig:p}),_=Cy(s,{collapsible:!0,label:v("pages"),icon:q.textBoxMultiple}),O=a?a===!0?{top:!0,right:!0,bottom:!0,left:!0}:a:void 0,P=c.jsx(z9,{pages:t,commandItems:T,rename:g,setRename:m,editor:f}),A=O?c.jsx(fu,{className:Z([`${xh}__content`,"text-sm overflow-auto",te.bt,z.br]),height:i,...O,children:P}):P;return c.jsx(bo,{classNameWrap:xh,className:Z(`${xh}__header`,Pe.xy,s===!1&&"gs-utl-hidden"),disabled:_&&_.collapsible===!1,handler:c.jsxs(I,{space:"s",items:"center",children:[!!_.icon&&c.jsx(B,{children:c.jsx(re,{icon:_.icon,size:se.s})}),c.jsx(B,{grow:!0,children:_.label}),b!==!1&&c.jsx(Ut,{title:v("add"),children:c.jsx(I,{onClick:S,className:Z("cursor-pointer"),children:c.jsx(re,{icon:q.plus,size:se.s})})})]}),open:_?_.collapsed!==!0:!0,children:A})}),Ow=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-after"),n),ref:o,...r,children:t})}),_w=qt(function({children:t,className:n,...r},o){return c.jsx("div",{className:N(ae("gs-page-manager-before"),n),ref:o,...r,children:t})}),W9="gs-panel-pages",Aw=h.memo(ce(function({className:t,header:n,height:r,resizable:o,...s}){const a=we().sdkProps.children;return c.jsx(xn,{className:N(W9,t),...s,children:c.jsx(Ob,{children:i=>c.jsxs(c.Fragment,{children:[Qn(a,_w),c.jsx(Pw,{header:n,height:r,resizable:o,...i}),Qn(a,Ow)]})})})})),G9="gs-panel-pages-layers",q9=h.memo(ce(function({className:t,panelPagesProps:n,panelLayersProps:r,...o}){const{showPages:s}=we(),a=Ie(),{className:i,...l}=n||{},u=Cy(r==null?void 0:r.header,{icon:q.layers,collapsible:!1,label:a.t("layerManager.layers"),className:N(te.bb,z.br)});return c.jsxs(Er,{className:N(G9,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...o,children:[s&&c.jsx(Aw,{className:N(i,te.bb,z.br),...l}),c.jsx(Wy,{...r,header:u})]})})),K9="gs-trait-custom",Z9=ce(function(t){const{trait:n,editor:r,value:o,disabled:s,labelAs:a,className:i}=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=()=>{},w=()=>{};const y=()=>{w(),l(S=>++S)};if(f.on("change",y),!d&&p&&g){const S=E=>g.appendChild(E),C=E=>g.removeChild(E),x=p({editor:r,component:f,trait:n,addEl:S,removeEl:C,onUpdate:E=>{w=E}});x instanceof HTMLElement?(S(x),b=()=>C(x)):et(x)&&(b=()=>x())}return()=>{f.off("change",y),b()}}},[f,g,o]),!f)return null;const m=qo({...t,className:N(K9,i)}),v={trait:n,component:f,editor:r,value:o,disabled:s};return c.jsxs("div",{...m,children:[c.jsx(wr,{...t,as:a}),c.jsx("div",{className:N(s&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...v}):p?c.jsx("div",{ref:u}):null})]})});function Lw({className:e,options:t,value:n,name:r,label:o,border:s,hideCaret:a,size:i="s",autoFocus:l,open:u,allowNew:d,onChange:p,onBlur:f,placeholder:g}){const[m,v]=h.useState(null),[b,w]=h.useState(null),{styles:y,attributes:S}=Si(m,b,af),[C,x]=h.useState(""),E=Di(),T=C===""?t:t.filter(j=>j.label.toLowerCase().includes(C.toLowerCase())),_=j=>x(j.target.value),O=j=>j==null?void 0:j.label,P=d&&C.length>0&&!T.some(j=>j.label===C),A=et(d)?d(C):d,M={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},k=()=>f==null?void 0:f();return c.jsxs("div",{className:Z("w-full",e),children:[!!o&&c.jsx(Go,{size:i,children:o}),c.jsxs(ua,{value:n,onChange:p,name:r,nullable:!0,children:[c.jsx(yw,{size:i,ref:v,border:s,children:c.jsxs(I,{nowrap:!0,children:[c.jsx(ua.Input,{autoFocus:l,className:E,displayValue:O,onChange:_,onBlur:k,placeholder:g}),!a&&c.jsx(ua.Button,{children:c.jsx(re,{icon:q.chevronDown,size:se.sx})})]})}),c.jsx(ua.Options,{static:u,className:vb,ref:w,style:y.popper,...S.popper,children:c.jsxs(Jn,{className:Z("h-full"),padding:!1,style:M,children:[P&&c.jsx(ua.Option,{value:{id:null,label:C},children:({active:j})=>c.jsx(bb,{option:{id:null,label:A},active:j,selected:n})}),!P&&T.length===0&&c.jsx("div",{className:Z(Pe.xy),children:"No items found"}),T.map(j=>c.jsx(ua.Option,{value:j,children:({active:L})=>c.jsx(bb,{option:j,active:L,selected:n})},j.id))]})})]})]})}const Y9=(e,t)=>{const n=`${Cc}${t}`,r=e.get(n,{skipResolve:!0});return r?Mw(r):e.get(n)||""};function Mw(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const X9=({page:e,component:t})=>{const{DataSources:n,I18n:r}=e.em,o=["prevItem","currentItem","nextItem"],s=xc(e)||"",a=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return o.map(p=>{if(d!=null&&d[p]){const{collectionId:f}=d,g=r.t(`dataSources.collections.${f}`)||f,m=r.t(`dataSources.variableTypes.${p}`)||p,v={collectionId:f,path:"id",type:n.dataComponentTypes.variable,variableType:p};return{id:Mw(v),label:`${g} > ${m}`,dataVariable:v}}}).filter(Boolean)}).flat().filter(Boolean),i=n.get(s),l=i==null?void 0:i.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...a,...l]},Nw="#",Tu="mailto:",Eh="subject=",Th="tel:",kw="hrefType",$w="showIdList",Iw=(e,t)=>{const n=t==null?void 0:t.get(kw);return n||(e.startsWith(Th)?"phone":e.startsWith(Tu)?"email":e.startsWith(_i)?"pages":e.startsWith(Nw)?"elements":"url")},Vw=e=>`${e.getName()} - #${e.getId()}`,J9="gs-trait-href",Q9=ce(function(t){const{trait:n,value:r,disabled:o,labelAs:s,className:a}=t,i=n.component,l=we(),{isSelectingTarget:u,editor:d}=l,[,p]=h.useState(0),[f,g]=h.useState(""),[m,v]=h.useState(""),[b,w]=h.useState(""),[y,S]=h.useState([]),C=Ie(),x=d==null?void 0:d.Pages.getAll(),E=C.tScoped("traitManager.traits.labels"),T=()=>p(Q=>++Q),_=i.get($w)??!1,O=Iw(r,i),P=O==="pages"?r==null?void 0:r.replace(_i,""):"",A=!!P&&(d==null?void 0:d.Pages.get(P)),M=A?Ec(A):!1,k=h.useMemo(()=>!M||!A||!d?[]:X9({page:A,component:i}),[d,A,M,i]),j=Q=>{n.setValue(Q)},L=Q=>{i.set({[$w]:Q}),T()},D=Q=>{g(""),v(""),w(""),j(""),i.set({[kw]:Q}),T()},W=Q=>{j(Q),T()},F=(Q,ee)=>{W3(i,"id",(ee==null?void 0:ee.dataVariable)||Q),T()},$=Q=>{Q&&(j(Q.id),T())},H=Q=>{j(`${Th}${Q}`),w(Q)},V=Q=>{j(`${Tu}${Q}${m?`?${Eh}${m}`:""}`),g(Q)},U=Q=>{j(`${Tu}${f}${Q?`?${Eh}${Q}`:""}`),v(Q)},J=()=>{l.setSelectingTarget(!u)},Y=Q=>{const ee=Q.replace(Nw,""),G=d==null?void 0:d.Components.componentsById[ee];return{id:Q,label:G?Vw(G):Q}};h.useEffect(()=>{var ee;const Q=[];if(_){const G=["path","br","b","u","i","strike"],R=(ee=d==null?void 0:d.Pages.getSelected())==null?void 0:ee.getMainComponent();R==null||R.forEachChild(le=>{!le.is("comment")&&!le.is("textnode")&&!G.includes(le.get("tagName"))&&Q.push({id:`#${le.getId()}`,label:Vw(le)})})}S(Q)},[d,_]),h.useEffect(()=>{let Q=()=>{};const ee=()=>{Q(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand($u))};return u&&(Q=jS(ee),d==null||d.runCommand($u,{onSelect:G=>j(`#${G.getId()}`)})),ee},[d,u]),h.useEffect(()=>{if(!r)return;switch(Iw(r,i)){case"phone":w(r.replace(Th,""));break;case"email":{const[ee,G=""]=r.replace(Tu,"").split("?");g(ee),v(G.replace(Eh,""));break}}},[r]);const X=qo({className:N(J9,a)});return c.jsxs("div",{...X,children:[c.jsx(wr,{...t,as:s}),c.jsx("div",{className:N(o&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(Yo,{onChange:D,classNamePanel:"gs-utl-p-1",value:O,tabs:[{id:"url",label:c.jsx(re,{icon:q.link,size:se.s}),content:c.jsx(rt,{placeholder:"eg. https://google.com",value:r,label:"URL",onChange:j,size:"s",type:"url"})},{id:"pages",label:c.jsx(re,{icon:q.textBoxMultiple,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Le,{size:"s",options:(x||[]).map(Q=>({id:`${_i}${Q.getId()}`,icon:iv(Q),label:Q.getName()})),value:r,onChange:W,label:"Page"}),M&&c.jsx(Le,{size:"s",options:k,value:Y9(i,"id"),onChange:F,label:C.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(re,{icon:q.viewDayOutline,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(Go,{size:"s",children:"Element ID"}),c.jsxs(I,{gap:"xs",nowrap:!0,children:[_?c.jsx(Lw,{options:y,onChange:$,value:Y(r),placeholder:C.t("selectList")}):c.jsx(rt,{size:"s",placeholder:"eg. #my-element-in-page",value:r,onChange:j,className:"gs-utl-flex-1"}),c.jsx(Ct,{title:C.t("selectTarget"),size:"m2",active:u,onClick:J,className:"gs-utl-h-[30px]",children:c.jsx(re,{icon:q.target,size:se.sx})})]}),c.jsx(nl,{value:_,onChange:L,label:E("showList")})]})},{id:"email",label:c.jsx(re,{icon:q.email,size:se.s}),content:c.jsxs(I,{gap:"s",col:!0,children:[c.jsx(rt,{placeholder:"eg. mail@gmail.com",value:f,onChange:V,size:"s",label:"Email",type:"email"}),c.jsx(rt,{placeholder:"eg. My subject",value:m,onChange:U,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(re,{icon:q.phone,size:se.s}),content:c.jsx(rt,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:b,onChange:H})}]})})]})});function R9({trait:e,value:t,disabled:n,label:r,labelAs:o}){const[s,a]=h.useState(),i=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],p=d.findIndex(f=>f.id===(s==null?void 0:s.id));return c.jsx(Xr,{items:d,selected:p>-1?s:null,select:a,disabled:n,label:r,labelAs:o,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(I,{space:"m",col:!0,children:!!s&&i.map(f=>{const{name:g,getValue:m}=f,v=f.setValue,b=f.label||g,w=d[p];if(!w)return null;const y=w[g],S=m?m(y):y,C=E=>{const T={...w};w[g]=v?v(E,S):E,e.setValue([...d],{item:w,previous:T}),g==="id"&&a(w)};let x=c.jsx(rt,{label:b,value:S,onChange:C});switch(f.type){case"select":x=c.jsx(Le,{label:b,options:f.options,value:S,onChange:C})}return c.jsx(h.Fragment,{children:x},g)})})})}const e7="gs-trait-custom-type",t7=ce(function({trait:t,editor:n}){const r=h.useRef(null),o=t.getType(),s=t.target,{Traits:a}=n,i=a.getType(o),l=!!(s&&i);return h.useEffect(()=>{const u=r.current;if(i&&u&&s){const d=new i({model:t,config:a.getConfig(),attributes:t.get("attributes")}),p=d.render().el;return u.appendChild(p),d.listenTo(s,"change",()=>d.postUpdate()),()=>{u.removeChild(p),d.removeView()}}},[s,i,t]),l&&c.jsx("div",{className:e7,ref:r})}),n7=e=>{const{value:t={},onConfirm:n,additionalSources:r,editor:o}=e;if(!o)return;const s="DataValuePicker",a={id:s,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:i})=>{n==null||n(i),o.runCommand(ne.layoutRemove,{id:s})},additionalSources:r},placer:{type:"dialog",size:"l"}};o.runCommand(ne.layoutToggle,{...a})};function Hw(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:r,editor:o,additionalSources:s,enableDataValue:a,hasDataResolverValue:i}=e;if(!o||!a)return[];const l={type:"button",className:i?z.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:o.I18n.t("dataSources.connectDataValue"),icon:{icon:q.databaseOutline,size:se.s2x},onClick:()=>n7({value:t,onConfirm:n,additionalSources:s,editor:o})}];return i&&u.push({...l,title:o.I18n.t("dataSources.clearDataValue"),icon:{icon:q.close,size:se.s2x},onClick:r}),u}function r7(e,t){const n=e.em.getEditor(),r=e.target;let o=!1;t===!0?o=!0:to(t)&&et(t.enable)&&(o=t.enable({trait:e,component:r,editor:n}));const s=e.getValue({skipResolve:!0}),a=r.collectionsStateMap,i=ts(s);return{hasDataResolverValue:i,dataResolverValue:i?e.getValue():void 0,enableDataValue:o,initialDataValue:s,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:a}}const o7=({label:e,buttons:t})=>c.jsxs(I,{items:"center",nowrap:!0,full:!0,children:[c.jsx(B,{grow:!0,children:e}),c.jsx(I,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,r)=>c.jsx(Ct,{...n},r))})]}),jw=e=>_r((e||"").replace(/-/g," ")),s7=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&jw(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,r)=>e.setValue(n,{partial:r})}),Tr=(e,t,n)=>{const r=r7(e,n.traitManagerDataConfig),o=Hw(r),{hasDataResolverValue:s,dataResolverValue:a}=r,i=s7(e,t);return{...i,value:a??i.value,disabled:s,labelAs:o.length?"span":void 0,label:c.jsx(o7,{label:i.label,buttons:o})}},Dw=(e,t,n)=>Tr(e,t,n),a7=(e,t,n)=>Tr(e,t,n),i7=(e,t,n)=>{const r=ts(e.getValue({skipResolve:!0})),o=Tr(e,t,n),s={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!r,units:r?[]:e.get("units"),onChange:(a,i)=>{const l=i||isNaN(parseFloat(a))?a:parseFloat(a);e.setValue(l,{partial:i})}};return{...o,...s}},Fw=(e,t,n)=>{const r=e.get("labelToTitle"),o=ts(e.getValue({skipResolve:!0})),s=Tr(e,t,n),a={options:e.getOptions().map(i=>{const l=i.labelReact||i.name||i.label||i.value;return ct(i)?{id:i,label:i}:{id:i.id||i.value,title:r?l:i.title,icon:i.icon,label:r?"":l}}),onChange:i=>e.setValue(i),emptyState:o&&e.getValue()||void 0,hideCaret:o};return{...s,...a}},l7=(e,t,n)=>{const{options:r,onChange:o}=Fw(e,t,n),s={options:r,onChange:o};return{...Tr(e,t,n),...s}},c7=(e,t,n)=>{const r=e.get("typeProps")||{},o=ts(e.getValue({skipResolve:!0}));return{...Tr(e,t,n),isContain:!0,hideButton:o,btnLabel:e.get("text"),onOpen(){if(o)return;const a=t==null?void 0:t.Assets;a==null||a.open({select(i){e.setValue(i.getSrc()),a.close()}})},...r}},u7=e=>({children:jw(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");ct(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),d7=(e,t,n)=>{const r=Tr(e,t,n),s={value:!!(r.disabled?r.value:e.getValue({useType:!0})),onChange:a=>e.setValue(a)};return{...r,...s}},p7=(e,t,n)=>{const r=Tr(e,t,n),o=e.get("typeProps")||{},s=ts(e.getValue({skipResolve:!0}));return{language:"css",...o,...r,formatOnMount:!s,onChange:a=>e.setValue(a)}},f7=(e,t,n)=>({...Tr(e,t,n),trait:e}),h7=(e,t,n)=>({...Tr(e,t,n),trait:e}),g7=(e,t,n)=>({...Tr(e,t,n),trait:e,editor:t});function m7(e,t,n={}){var a;const r=e.get("visible"),o=e.getType(),s={traitManagerDataConfig:n.traitManagerDataConfig};if(et(r)&&r({component:e.target,trait:e})===!1)return null;switch(o){case"text":return c.jsx(rt,{...Dw(e,t,s)});case"select":return c.jsx(Le,{...Fw(e,t,s)});case"number":return c.jsx(ke,{...i7(e,t,s)});case"color":return c.jsx(yo,{...a7(e,t,s)});case"checkbox":return c.jsx(nl,{...d7(e,t,s)});case"button":return c.jsx(Ke,{...u7(e)});case"radio":return c.jsx(Rt,{...l7(e,t,s)});case"code":return c.jsx(mo,{...p7(e,t,s),...n},((a=t==null?void 0:t.getSelected())==null?void 0:a.getId())||"");case"image":case"file":return c.jsx(cl,{...c7(e,t,s)});case"stack":return c.jsx(R9,{...f7(e,t,s)});case"href":return c.jsx(Q9,{...h7(e,t,s)});case"custom":return c.jsx(Z9,{...g7(e,t,s)});default:return!!t.Traits.getType(o)?c.jsx(t7,{editor:t,trait:e}):c.jsx(rt,{...Dw(e,t,s)})}}const Ph="gs-trait-manager",Bw=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(B,{className:Z(`${Ph}-field gs-utl-mb-2 gs-utl-w-full`),children:m7(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function v7({traits:e,className:t}){var d,p;const n=Fi(),{isDarkTheme:r}=Fr(),s=(d=we().sdkOptions.dataSources)==null?void 0:d.traitManager,a=n.Traits.getTraitsByCategory(e),i=(p=a.find(f=>!f.category))==null?void 0:p.items,l=a.filter(f=>f.category),u=Z("gs-utl-text-center");return c.jsx(I,{className:Z(Ph,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[i==null?void 0:i.map(f=>c.jsx(Bw,{trait:f,isDarkTheme:r,traitManagerDataConfig:s},f.id)),l.map(({category:f,items:g},m)=>c.jsx(bo,{open:!!(f!=null&&f.get("open")),onChange:({open:v})=>f==null?void 0:f.set({open:v}),handler:f==null?void 0:f.getLabel(),handlerIcon:f==null?void 0:f.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${Ph}-category -gs-utl-mx-2`,className:v=>Z(Td.itemList({index:m+(i?1:0),open:v,length:l.length})),children:g.map(v=>c.jsx(Bw,{trait:v,isDarkTheme:r,traitManagerDataConfig:s},v.id))},f==null?void 0:f.id))]}):c.jsx(B,{className:u,children:"No properties available"}):c.jsx(B,{className:u,children:n.t("traitManager.empty")})})}const Oh=ce(v7),b7="gs-panel-properties",y7=h.memo(ce(function({className:t,...n}){return c.jsx(Er,{className:N(b7,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(lf,{children:r=>c.jsx(Oh,{...r})})})})),w7=async({html:e="",css:t="",el:n})=>{const r=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,o={};if(document.body.attachShadow){const s=n.shadowRoot||n.attachShadow({mode:"open"});s.innerHTML=r}return o},S7=ce(function({rule:t,onSelect:n,onRemove:r,className:o}){const s=h.useRef(null),i=we().editor,l=Ie(),u=t.getDevice(),d=t.getState(),{isDarkTheme:p}=Fr(),[f,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,v]=h.useState(f),b=t.selectorsToString(),w=()=>{i.select(),setTimeout(()=>i.Selectors.select(t)),n==null||n()},y=()=>{i.Css.remove(t),r==null||r()},S=()=>{if(m){const C=i.Parser.parseCss(m)[0];C&&(t.setStyle(C.style),g(m))}};return h.useEffect(()=>{if(s.current){const C=s.current;w7({el:C,html:'<div class="prv-rule">Preview</div>',css:`
327
327
  .prv-rule {
328
328
  background-color: #fff;
329
329
  padding: 5px;
330
330
  }
331
- .prv-rule, ${p}
332
- `})}},[s,p]),c.jsx(Yn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(I,{className:ae("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:s,className:ae("relative flex items-center justify-center")})}),c.jsxs(I,{className:ae("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(I,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(B,{grow:!0,children:c.jsx("pre",{className:ae("text-xs bg-white/10",z.txt,te.rnd,Te.xyS),children:b})}),!!u&&u.getWidthMedia()&&c.jsx(B,{children:c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(ne,{icon:q.cellphoneLink,size:se.sx})})}),!!d&&c.jsx(B,{children:c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(ne,{icon:q.flare,size:se.sx})})})]}),c.jsxs(I,{nowrap:!0,className:ae(Pe.txtEllips),space:"s",children:[c.jsx(B,{className:ae("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(Ke,{onClick:w,className:ae("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(wr,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(Ct,{title:l.t("selectorManager.showCSS"),children:c.jsx(ne,{icon:q.codeBraces,size:se.sx})}),children:({close:C})=>c.jsxs(I,{className:ae("relative w-80 h-48"),col:!0,children:[c.jsx(B,{grow:!0,children:c.jsx(ho,{defaultValue:lp(p),onChange:v,language:"css",padding:5,isDarkTheme:f,clean:!0})}),c.jsx(Ke,{className:ae("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{S(),C()},children:l.t("update")})]})}),c.jsx(eu,{onConfirm:y,className:ae("w-48"),children:c.jsx(Ct,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(ne,{icon:q.delete,size:se.sx})})})]})]})]},t.cid)})}),b7=ce(function(){const[t]=jf(),n=Ca(),r=Ie(),[o,s]=h.useState(""),[a,i]=h.useState(""),u=we().editor,[d,f]=h.useState(u.Css.getRules("")),p=u.Devices.getDevices().map(v=>({id:v.id,label:v.getName()})),g=d.filter(v=>{var b;return!(o&&!Zs(v.selectorsToString(),o)||a&&((b=v.getDevice())==null?void 0:b.id)!==a)}),m=()=>f(u.Css.getRules(""));return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{items:"center",space:"m",children:[c.jsx(B,{children:c.jsx(rt,{size:"s",type:"search",value:o,onInput:s,placeholder:`${r.t("selectorManager.searchStyle")}...`})}),c.jsx(B,{children:c.jsx(Le,{includeEmpty:!0,size:"s",value:a,options:p,onChange:i,emptyState:r.t("deviceManager.allDevices"),handlerSelected:v=>c.jsxs(I,{space:"s",items:"center",children:[c.jsx(ne,{icon:q.cellphoneLink,size:se.sx}),c.jsx("span",{children:v.label})]})})})]}),c.jsx(B,{className:ae("gs-utl-h-[75vh] w-full overflow-auto"),children:g.length?c.jsx(Rc,{data:g,listClassName:ae("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(v,b)=>c.jsx(v7,{rule:b,onRemove:m,onSelect:n.close},b.cid)},t):c.jsx(I,{justify:"center",children:r.t("modals.styleCatalog.noStyles")})})]})}),y7=ce(function({selector:t,className:n,removable:r,toggleable:o}){const s=Ie(),a=we(),[i,l]=h.useState(),[u,d]=h.useState(t.getActive()),f=a.editor,{Selectors:p}=f,g=t.getLabel(),m=c.jsx(ne,{icon:q.dotsVertical,size:se.sx}),v=()=>{p.removeSelected(t)},b=E=>{i&&p.rename(i,E),l(void 0)},w=()=>{p.duplicateSelected(t)},y=()=>{const E=!t.getActive();d(E),t.setActive(E)},C=[{id:"rename",label:s.t("rename"),action:()=>l(t)},{id:"duplicate",label:s.t("duplicate"),action:w},r&&{id:"delete",label:s.t("delete"),action:v},o&&{id:"active",label:s.t(u?"disable":"enable"),action:y}].filter(Boolean),x=(E,T)=>_=>{E(),et(T)&&T(_)};return c.jsx(Ko,{className:ae(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",z.sel,n]),s:"s",children:c.jsxs(I,{items:"center",children:[c.jsx(B,{className:ae("gjs-mr-4",!i&&!u&&"opacity-50 line-through"),children:c.jsx(Ty,{value:g,onChange:b,active:!!i,unstyled:!0})}),c.jsx(I,{className:ae("absolute h-full right-0 transition-opacity",z.sel,z.selBr,te.bl),children:c.jsx(wr,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>C.map(T=>c.jsx(Pa,{className:ae(z.txt),label:T.label,action:x(E,T.action)},T.id))})})]})})}),w7=e=>(e==null?void 0:e.get("groups"))||[],S7=/^\.[a-zA-Z_][\w-]*$/;function C7(e,t={}){const n=e.Css.getAll().filter(r=>w7(r).some(o=>o.startsWith(Hs.globalStyles)));return t.withSingleClass?n.filter(r=>S7.test(r.getSelectorsString())):n}const x7=e=>{const{Selectors:t}=e,n=t.getAll({array:!0});return t.getSelectedAll().reduce((s,a)=>{const i=s.indexOf(a);return i>=0&&s.splice(i,1),s},n).filter(s=>s.isClass())},E7=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:r}=t.store,s=(n!=null&&n.showInClassSelectors?C7(e,{withSingleClass:!0}):[]).map(i=>{const l=i.getSelectorsString().replace(".","");return{id:l,label:`${r.t("globalStyleManager.globalStyles")}: ${l}`}});return[...x7(e).map(i=>({id:i,label:i.getLabel()})),...s]},T7=e=>{var r,o;let t=(r=e==null?void 0:e.selectorsToString)==null?void 0:r.call(e);const n=(o=e==null?void 0:e.getAtRule)==null?void 0:o.call(e);return t&&n&&(t=`${n} {
331
+ .prv-rule, ${f}
332
+ `})}},[s,f]),c.jsx(Jn,{padding:!1,className:ae("overflow-hidden max-w-full group",o),children:c.jsxs(I,{col:!0,space:"xs",children:[c.jsx(I,{className:ae("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:s,className:ae("relative flex items-center justify-center")})}),c.jsxs(I,{className:ae("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(I,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(B,{grow:!0,children:c.jsx("pre",{className:ae("text-xs bg-white/10",z.txt,te.rnd,Pe.xyS),children:b})}),!!u&&u.getWidthMedia()&&c.jsx(B,{children:c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(re,{icon:q.cellphoneLink,size:se.sx})})}),!!d&&c.jsx(B,{children:c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(re,{icon:q.flare,size:se.sx})})})]}),c.jsxs(I,{nowrap:!0,className:ae(Oe.txtEllips),space:"s",children:[c.jsx(B,{className:ae("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(Ke,{onClick:w,className:ae("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(Cr,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(Ct,{title:l.t("selectorManager.showCSS"),children:c.jsx(re,{icon:q.codeBraces,size:se.sx})}),children:({close:C})=>c.jsxs(I,{className:ae("relative w-80 h-48"),col:!0,children:[c.jsx(B,{grow:!0,children:c.jsx(mo,{defaultValue:cf(f),onChange:v,language:"css",padding:5,isDarkTheme:p,clean:!0})}),c.jsx(Ke,{className:ae("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{S(),C()},children:l.t("update")})]})}),c.jsx(tu,{onConfirm:y,className:ae("w-48"),children:c.jsx(Ct,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(re,{icon:q.delete,size:se.sx})})})]})]})]},t.cid)})}),C7=ce(function(){const[t]=jp(),n=xa(),r=Ie(),[o,s]=h.useState(""),[a,i]=h.useState(""),u=we().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!(o&&!Ys(v.selectorsToString(),o)||a&&((b=v.getDevice())==null?void 0:b.id)!==a)}),m=()=>p(u.Css.getRules(""));return c.jsxs(I,{col:!0,space:"m",children:[c.jsxs(I,{items:"center",space:"m",children:[c.jsx(B,{children:c.jsx(rt,{size:"s",type:"search",value:o,onInput:s,placeholder:`${r.t("selectorManager.searchStyle")}...`})}),c.jsx(B,{children:c.jsx(Le,{includeEmpty:!0,size:"s",value:a,options:f,onChange:i,emptyState:r.t("deviceManager.allDevices"),handlerSelected:v=>c.jsxs(I,{space:"s",items:"center",children:[c.jsx(re,{icon:q.cellphoneLink,size:se.sx}),c.jsx("span",{children:v.label})]})})})]}),c.jsx(B,{className:ae("gs-utl-h-[75vh] w-full overflow-auto"),children:g.length?c.jsx(eu,{data:g,listClassName:ae("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(v,b)=>c.jsx(S7,{rule:b,onRemove:m,onSelect:n.close},b.cid)},t):c.jsx(I,{justify:"center",children:r.t("modals.styleCatalog.noStyles")})})]})}),x7=ce(function({selector:t,className:n,removable:r,toggleable:o}){const s=Ie(),a=we(),[i,l]=h.useState(),[u,d]=h.useState(t.getActive()),p=a.editor,{Selectors:f}=p,g=t.getLabel(),m=c.jsx(re,{icon:q.dotsVertical,size:se.sx}),v=()=>{f.removeSelected(t)},b=E=>{i&&f.rename(i,E),l(void 0)},w=()=>{f.duplicateSelected(t)},y=()=>{const E=!t.getActive();d(E),t.setActive(E)},C=[{id:"rename",label:s.t("rename"),action:()=>l(t)},{id:"duplicate",label:s.t("duplicate"),action:w},r&&{id:"delete",label:s.t("delete"),action:v},o&&{id:"active",label:s.t(u?"disable":"enable"),action:y}].filter(Boolean),x=(E,T)=>_=>{E(),et(T)&&T(_)};return c.jsx(Zo,{className:ae(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",z.sel,n]),s:"s",children:c.jsxs(I,{items:"center",children:[c.jsx(B,{className:ae("gjs-mr-4",!i&&!u&&"opacity-50 line-through"),children:c.jsx(Ty,{value:g,onChange:b,active:!!i,unstyled:!0})}),c.jsx(I,{className:ae("absolute h-full right-0 transition-opacity",z.sel,z.selBr,te.bl),children:c.jsx(Cr,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>C.map(T=>c.jsx(Oa,{className:ae(z.txt),label:T.label,action:x(E,T.action)},T.id))})})]})})}),E7=e=>(e==null?void 0:e.get("groups"))||[],T7=/^\.[a-zA-Z_][\w-]*$/;function P7(e,t={}){const n=e.Css.getAll().filter(r=>E7(r).some(o=>o.startsWith(js.globalStyles)));return t.withSingleClass?n.filter(r=>T7.test(r.getSelectorsString())):n}const O7=e=>{const{Selectors:t}=e,n=t.getAll({array:!0});return t.getSelectedAll().reduce((s,a)=>{const i=s.indexOf(a);return i>=0&&s.splice(i,1),s},n).filter(s=>s.isClass())},_7=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:r}=t.store,s=(n!=null&&n.showInClassSelectors?P7(e,{withSingleClass:!0}):[]).map(i=>{const l=i.getSelectorsString().replace(".","");return{id:l,label:`${r.t("globalStyleManager.globalStyles")}: ${l}`}});return[...O7(e).map(i=>({id:i,label:i.getLabel()})),...s]},A7=e=>{var r,o;let t=(r=e==null?void 0:e.selectorsToString)==null?void 0:r.call(e);const n=(o=e==null?void 0:e.getAtRule)==null?void 0:o.call(e);return t&&n&&(t=`${n} {
333
333
  ${t}
334
- }`),t},nr="gs-cmp-selector-manager",Oh={},zw=ce(function(t){var le,ge,Ee;const{selectedState:n,states:r,setState:o,styleCatalog:s,stateSelector:a}=t,i=we(),[l,u]=h.useState(!1),[d,f]=h.useState([]),[p,g]=h.useState(Oh),{toggleCssPanel:m,isCssPanelActive:v,editor:b,store:w}=we(),{i18nStore:y,modalStore:S}=w,C=b==null?void 0:b.getSelected(),x=b==null?void 0:b.Styles.getSelected();if(h.useEffect(()=>{if(b&&x&&i){const Ce=setTimeout(()=>{let tt=Oh;const Qe=C==null?void 0:C.get("selectorManager");C&&et(Qe)&&(tt=Qe({editor:b,component:C})),g(tt||Oh),f(E7(b,i))});return()=>clearTimeout(Ce)}},[C,b,x,i]),!b)return null;const{Selectors:E}=b,T=p.disableClasses,_=p.disableComponent,O=T&&_,P=E.getComponentFirst()&&!_,A=E.getSelectedAll(),M=b.getSelectedAll(),$=r.map(Ce=>({id:Ce.getName(),label:Ce.getLabel()})),j=b.getModel(),L=(le=x==null?void 0:x.getDevice)==null?void 0:le.call(x),D=(ge=x==null?void 0:x.getState)==null?void 0:ge.call(x),W=N("gs-utl-overflow-hidden",te.b,te.rnd,z.br),F=N(z.bA),k=N("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",te.br,z.br),H=`${z.bgA}`,V=T7(x),U=A.length>0,J=M.length>0,Y=U||J,X=P&&J||!P&&!U,Q=X?"Components":"Selectors",ee=Ce=>y.t(`selectorManager.${Ce}`),G=y.t("modals.styleCatalog.title"),R=()=>S.open({title:G,content:c.jsx(b7,{})});return c.jsxs(I,{className:nr,gap:"s",col:!0,full:!0,children:[c.jsxs(I,{className:N(`${nr}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(I,{className:N(`${nr}__head-start`),items:"center",gap:"s",children:[c.jsx(B,{className:N(`${nr}__head-title`),children:ee("selection")}),s!==!1&&c.jsx(B,{className:N(`${nr}__style-catalog`),children:c.jsx(Wt,{className:"gs-utl-cursor-pointer",onClick:R,title:G,children:c.jsx(ne,{icon:q.paletteSwatch,size:se.s})})})]}),!!x&&a!==!1&&!O&&c.jsx(B,{className:`${nr}__head-end`,children:c.jsx(Le,{size:"s",value:n,options:$,includeEmpty:!0,onChange:o,emptyState:`- ${ee("state")} -`,className:N(n&&z.bA)})})]}),Y&&!O?c.jsxs(c.Fragment,{children:[!T&&c.jsxs(I,{className:N(`${nr}__field-selectors`,W,!X&&F),items:"stretch",gap:"xs",children:[c.jsx(Wt,{title:ee(U?"applyOnSelector":"noSelectors"),className:N(k,!X&&H),onClick:()=>U&&E.setComponentFirst(!1),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:q.tag,size:se.sx})})}),c.jsx(B,{grow:!0,children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(Lw,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:ee("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:Ce=>{Ce&&(E.addSelected(Ce.id||Ce.label),u(!1))}}):c.jsxs(c.Fragment,{children:[J&&c.jsx(Ct,{title:ee("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(ne,{icon:q.plus,size:se.sx})}),A.map(Ce=>c.jsx(y7,{selector:Ce,removable:J,toggleable:J&&A.filter(tt=>tt.getActive()||tt===Ce).length>1},Ce.toString()))]})})})]}),!_&&c.jsxs(I,{className:N(`${nr}__field-components`,W,X&&F),items:"stretch",gap:"xs",children:[c.jsx(Wt,{title:ee(J?"applyOnComponents":"noComponents"),onClick:()=>J&&E.setComponentFirst(!0),className:N(k,X&&H),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:q.targetVariant,size:se.sx})})}),c.jsx(B,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:M.map(Ce=>c.jsx(Ko,{s:"s",className:N("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",z.cmp),onPointerEnter:()=>j.setHovered(Ce),onPointerOut:()=>j.setHovered(),label:Ce.getName()},Ce.getId()))})})]}),c.jsxs(I,{className:`${nr}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:ee("selected")}),c.jsx("pre",{className:N("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",te.rnd,Te.xyS),children:V}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:ee("currentSelection")})]}),children:c.jsx(Ko,{className:N(te.b,te.rnd,z.br),s:"xs",nopad:!0,block:!0,children:c.jsx(ne,{icon:q.target,size:se.sx})})}),c.jsx(B,{className:"gs-utl-text-sm",children:c.jsx(Ko,{className:N(te.b,te.rnd,z.br),s:"xs",nopad:!0,children:c.jsxs(I,{space:"xs",items:"center",nowrap:!0,children:[!!L&&L.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[ee("device"),": ",c.jsx("b",{children:L.getName()})]}),children:c.jsx(ne,{icon:q.cellphoneLink,size:se.sx})}),c.jsx(B,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[ee("target"),": ",c.jsx("b",{children:Q}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(Ee=x==null?void 0:x.selectorsToString)==null?void 0:Ee.call(x,{skipState:1})]})]}),children:c.jsx(ne,{icon:X?q.targetVariant:q.tag,size:se.sx})}),!!D&&c.jsxs(c.Fragment,{children:[c.jsx(B,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[ee("state"),": ",c.jsx("b",{children:D.getLabel()})]}),children:c.jsx(ne,{icon:q.flare,size:se.sx})})]})]})})}),c.jsx(Ct,{title:y.t("toggleCss"),onClick:m,active:v,size:"s",children:c.jsx(ne,{icon:q.codeBraces,size:se.sx})})]})]}):c.jsxs(I,{className:N(`${nr}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(B,{className:`${nr}__empty-state-title`,children:ee("noSelecton")}),c.jsxs("ul",{className:N(`${nr}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:ee("selectFromCanvas")}),c.jsx("li",{children:ee("selectFromList")})]})]})]})}),P7="gs-panel-selectors",O7=h.memo(ce(function({className:t,styleCatalog:n,stateSelector:r,...o}){return c.jsx(Cr,{className:N(P7,t),...o,children:c.jsx(_b,{children:s=>c.jsx(zw,{...s,styleCatalog:n,stateSelector:r})})})}));function rs({label:e,property:t,hasValue:n,empty:r,onClear:o,children:s,shallow:a,row:i,tooltip:l,skipClear:u,className:d,...f}){const p=e||(t==null?void 0:t.getLabel()),g=t==null?void 0:t.getParentTarget(),m=n||!r&&(t==null?void 0:t.hasValue({noParent:!0})),v=!m&&(t==null?void 0:t.hasValue())&&g,b=g==null?void 0:g.getDevice(),w=g==null?void 0:g.getState(),y=g==null?void 0:g.getComponent(),S=()=>o?o():t==null?void 0:t.clear(),C={className:N(d,"gs-utl-text-sm gs-utl-w-full"),col:!i,items:i?"center":void 0,...f},x=N("gs-utl-flex-1",m&&!a&&z.tAo);return t&&!t.isVisible()?null:c.jsxs(I,{gap:"xs",...C,children:[c.jsxs(I,{className:x,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(B,{children:c.jsx(Wt,{title:l,children:c.jsx(ne,{icon:q.information,size:se.sx})})}),c.jsx(B,{children:r?c.jsx("span",{children:" "}):p}),!!v&&!a&&c.jsx(Wt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N("gs-utl-mb-1"),children:"Value inherited from"}),!!b&&c.jsxs(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(ne,{icon:q.cellphoneLink,size:se.sx})}),c.jsx(B,{children:c.jsx("b",{children:b.getName()})})]}),c.jsxs(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(ne,{icon:y?q.targetVariant:q.tag,size:se.sx})}),c.jsxs(B,{children:[c.jsx("b",{children:y?"Components":"Selectors"}),c.jsxs("span",{className:N("gs-utl-text-xs gs-utl-opacity-75"),children:[" ",g==null?void 0:g.selectorsToString({skipState:1})]})]})]}),!!w&&c.jsxs(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(ne,{icon:q.flare,size:se.sx})}),c.jsx(B,{children:c.jsx("b",{children:w.getLabel()})})]})]}),children:c.jsx("div",{className:N("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",z.bgW)})}),m&&!a&&!u&&c.jsx(Wt,{title:"Clear value",onClick:S,children:c.jsx(ne,{className:Pe.click,icon:q.close,size:se.s2x})})]}),!!s&&c.jsx(B,{grow:!0,className:"gs-utl-max-w-full",children:s})]})}function Tu(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 _7=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,A7=/,(?![^(]*\))/,_h=/\s(?![^(]*\))/,L7=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Ah=/^circle|ellipse/i,Lh=e=>{var d;const t=[],{name:n,value:r}=Tu(e),[o,...s]=r.split(A7).map(f=>f.trim()).filter(Boolean),a=s.length>1,i=a?o:"",l={type:"none"},u=a?s:[o,...s];if(_7.test(i))l.type="angle",l.value=i;else if(/^to\s/.test(i))l.type="side-or-corner",l.value=i;else if(L7.test(i))l.type="size",l.value=i;else if(Ah.test(i)||/^at\s/.test(i)||/\sat\s/.test(i)){l.type="at",l.value=i;const f=((d=i.match(Ah))==null?void 0:d[0])||"circle";l.shape=f;const p={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,v]=i.replace(Ah,"").trim().split("at").map(b=>b.trim());if(m){const[b,w]=m.split(_h);p.x=b,p.y=w||b}if(v){const[b,w]=v.split(_h);g.x=b,g.y=w||b}l.size=p,l.position=g}return u.forEach(f=>{const[p,g]=f.split(_h);t.push({color:p,hint:g?parseFloat(g):null})}),t.forEach((f,p)=>{f.hint===null&&(f.hint=p/(t.length-1)*100)}),{name:n,orientation:l,colorStops:t}},os=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const o=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(s=>`${s.color} ${s.hint?`${s.hint}%`:""}`.trim()).join(", ");return o?`${n}(${t}, ${o})`:"none"},M7=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),N7="gs-cmp-grad-picker";function $7({className:e,value:t,onChange:n}){var D,W,F;const r=Lh(t),[o,s]=h.useState(r.colorStops),[a,i]=h.useState(null),l=h.useRef(null),u=Z(N7,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,te.rnd),d=r.name||"linear-gradient",f=d.indexOf("radial")>=0,p=d.indexOf("repeating")>=0,g=r.orientation.value,m=`${parseFloat(`${g}`)||180}`,v=`${parseFloat(`${(D=r.orientation.size)==null?void 0:D.x}`)||0}`,b=`${parseFloat(`${(W=r.orientation.position)==null?void 0:W.x}`)||0}`,w=`${parseFloat(`${(F=r.orientation.position)==null?void 0:F.y}`)||0}`,y=0,S=100,C=(k,H=!1)=>{const V=M7(k);s(V),n==null||n(os({name:d,orientation:g,stops:V}),H)},x=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${k}deg`}),H)},E=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${k}px at ${b}% ${w}%`}),H)},T=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${v}px at ${k}% ${w}%`}),H)},_=(k,H=!1)=>{n==null||n(os({stops:o,name:d,orientation:`${v}px at ${b}% ${k}%`}),H)},O=k=>{const H=`${k?"repeating-":""}${f?"radial":"linear"}-gradient`;n==null||n(os({stops:o,orientation:g,name:H}))},P=k=>{const H=`${p?"repeating-":""}${k?"radial":"linear"}-gradient`;n==null||n(os({stops:o,orientation:k?"100px at 50% 50%":"90deg",name:H}))};h.useEffect(()=>{if(!a)return;const k=parseFloat(`${a.stop.hint}`),H=U=>{let Y=(U.clientX-a.x)*100;Y=Y/a.w,Y=k+Y,Y=Y<y?y:Y,Y=Y>S?S:Y,a.stop.hint=parseInt(`${Y}`,10),C(o,!0)},V=()=>{i(null),C(o)};return window.addEventListener("pointermove",H),window.addEventListener("pointerup",V),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V),V()}},[a]);const A=(k,H)=>{const V=l.current;i({stop:H,w:(V==null?void 0:V.clientWidth)||0,h:(V==null?void 0:V.clientHeight)||0,x:k.clientX,y:k.clientY})},M=k=>{const H=l.current,V=(H==null?void 0:H.clientWidth)||0,U=(H==null?void 0:H.clientHeight)||0,J=k.nativeEvent.offsetX-((H==null?void 0:H.clientLeft)||0),Y=k.nativeEvent.offsetY-((H==null?void 0:H.clientTop)||0),X=J/V*100,Q=document.createElement("canvas"),ee=Q.getContext("2d");if(!ee)return;Q.width=V,Q.height=U;const G=ee.createLinearGradient(0,0,V,U);o.forEach(Ce=>G.addColorStop(parseFloat(`${Ce.hint}`)/100,Ce.color)),ee.fillStyle=G,ee.fillRect(0,0,Q.width,Q.height),Q.style.background="black";const R=ee.getImageData(J,Y,1,1).data,le=R[3]?(100/255*R[3]/100).toFixed(2):0,ge=`rgba(${R[0]}, ${R[1]}, ${R[2]}, ${le})`,Ee=ge==="rgba(0, 0, 0, 0)"?"#000":ge;C([...o,{color:Ee,hint:X}])},$=k=>{C(o.filter(H=>H!==k))},j=(k,H,V)=>{H&&(k.color=H),C(o,V)},L=k=>(a==null?void 0:a.stop)===k;return c.jsxs(I,{className:u,col:!0,children:[!!(a!=null&&a.stop)&&c.jsx("div",{className:Z("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:Z("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:Z("bg-checker h-8",te.rnd),children:c.jsx("div",{ref:l,className:Z("w-full h-full cursor-cross",te.b,te.rnd,z.br),style:{backgroundImage:os({stops:o})},onClick:M})}),o.map((k,H)=>c.jsxs("div",{className:Z("absolute top-0 h-full"),style:{left:`${k.hint}%`},children:[c.jsx("div",{className:Z("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>$(k),children:c.jsx(ne,{icon:q.close,size:se.s3x})}),c.jsx("div",{onPointerDown:V=>A(V,k),className:Z("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",te.br,te.bl,L(k)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:Z("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(My,{value:k.color,onChange:(V,U)=>j(k,V,U),className:Z("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},H))]}),c.jsxs(I,{space:"s",items:"center",children:[c.jsx(B,{grow:!0,children:c.jsx(tl,{label:"Repeat",value:p,onChange:O})}),c.jsx(B,{grow:!0,children:c.jsx(tl,{label:"Radial",value:f,onChange:P})})]}),f?c.jsxs(I,{space:"s",col:!0,children:[c.jsx(B,{children:c.jsx(I,{space:"s",items:"center",children:c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"S",size:"s",value:v,onChange:E,valueUnit:"px",units:["px"]})})})}),c.jsx(B,{children:c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"X",size:"s",value:b,onChange:T,valueUnit:"%",units:["%"]})}),c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"Y",size:"s",value:w,onChange:_,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(I,{space:"s",items:"center",nowrap:!0,children:c.jsx(B,{grow:!0,children:c.jsx($e,{pan:"A",size:"s",value:m,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}const k7="gs-sm-custom-type",I7=ce(function({property:t,editor:n}){const r=h.useRef(null),o=t.getType(),s=n.StyleManager,a=s.getType(o),i=a==null?void 0:a.view;return h.useEffect(()=>{const l=r.current;if(i&&l){const u=new i({model:t,config:s.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[i,t,n]),i&&c.jsx("div",{className:k7,ref:r})});function Uw(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const Ww="gs-cmp-style-field";function Gw({property:e,sector:t,styleManagerDataConfig:n,fieldProps:r}){const o=N(Ww,`${Ww}__${e.id}`),s={sector:t,styleManagerDataConfig:n},a=t.em.getEditor(),i=e.getType();switch(i){case"selectFont":return c.jsx(hu,{className:o,...eS(e,s),...r});case"number":case"slider":case"integer":return c.jsx($e,{className:o,...lt(e,s),...r});case"color":return c.jsx(vo,{className:o,...Gs(e,s),...r});case"select":return c.jsx(Le,{className:o,...Lt(e,s),...r});case"radio":return c.jsx(Qt,{className:o,...Jr(e,s),...r});case"file":return c.jsx(ll,{className:o,...oV(e,s),...r});case"composite":return c.jsx(xn,{className:o,property:e,corners:e.get("corners"),generic:e.get("generic"),...s});case"stack":{const l=e.getProperties();return c.jsx(Zr,{className:o,...as(e,s),children:c.jsx(Yr,{properties:l,sector:t})})}default:{const l=a.StyleManager.getType(i);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(I7,{editor:a,property:e}):c.jsx(rt,{className:o,...Ih(e,s)})}}}const qw="gs-cmp-style-prop-row";function Yr({properties:e,sector:t,styleManagerDataConfig:n}){const r={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(o=>{const s=o.getId(),a=N(qw,`${qw}__${s}`,Uw(o)&&"gs-utl-col-span-full");return o.isVisible()?c.jsx("div",{className:a,children:c.jsx(Gw,{property:o,...r})},s):null})})}function V7({sector:e,styleManagerDataConfig:t}){const n=Ai(),r=e.getProperties().filter(o=>o.isVisible()).map(o=>(n.sdkAddFonts&&o.getId()==="font-family"&&o.set("type","selectFont"),o));return c.jsx("div",{className:N("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(Yr,{properties:r,sector:e,styleManagerDataConfig:t})})}const H7="gs-cmp-sector-row";function be({className:e,children:t,bottom:n,separator:r,separatorTop:o,property:s,...a}){const i=c.jsx("div",{className:Z("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",te.bb,z.br)}),l=Z(H7,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(s)?s:[s]).filter(Boolean);return(u.length?u.some(f=>f.isVisible()):!0)?c.jsxs(c.Fragment,{children:[o&&i,c.jsx(I,{className:l,nowrap:!0,...a,children:t}),r&&i]}):null}function vl(e,t,n={}){const r=e.getType(),{compact:o=!1,sector:s,styleManagerDataConfig:a}=n,i=e.getParent(),l={sector:s,styleManagerDataConfig:a},u=e.getDefaultValue();if(r==="select"){const f={property:i.getName()};return c.jsx(Le,{...Lt(e,l,f),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,f)||u:"Custom",onChange:p=>t.all.map(g=>g.upValue(p))}:{},label:void 0})}else return r==="color"?c.jsx(vo,{...Gs(e,l),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,f)=>t.all.map(p=>p.upValue(d,{partial:f}))}:{},label:void 0}):c.jsx($e,{...lt(e,l),...o?{pan:e.getLabel()[0]}:{},...t?{value:t.same?e.getValue({noDefault:!0}):"",valueUnit:t.same?e.getUnit():"",placeholder:t.same?u:"Custom",onChange:(d,f)=>t.all.map(p=>p.upValue(d,{partial:f})),onChangeUnit:d=>t.all.map(f=>f.upUnit(d))}:{},label:void 0})}const Pu="gs-cmp-style-prop-composite";function xn({className:e,property:t,sector:n,styleManagerDataConfig:r,corners:o,compact:s,generic:a,children:i,options:l}){const[u,d]=h.useState(null);if(!(t!=null&&t.isVisible()))return null;const f={id:"custom",label:c.jsx(ne,{icon:q.borderStyle,size:se.s}),title:"Custom"},p=[{id:"all",label:c.jsx(ne,{icon:q.borderAllVariant,size:se.s}),title:"All"},f],g=t.isDetached(),m=t.getProperties(),v=m.length,[b,w,y,S]=m,C=b.getFullValue(),E=m.map(F=>F.getFullValue()).every(F=>F===C),T=u!==null?u:E||l?"all":f.id,_=l?[...l,f]:[],O=t.getFullValue(),P=_.some(F=>F.id===O),A=T===f.id||(l?!P:!1)||!!a,M={compact:s,sector:n,styleManagerDataConfig:r},$=c.jsx(rs,{property:s?null:b,shallow:!g,children:vl(b,null,M)}),j=c.jsx(rs,{property:s?null:w,shallow:!g,children:vl(w,null,M)}),L=!!y&&c.jsx(rs,{property:s?null:y,shallow:!g,children:vl(y,null,M)}),D=!!S&&c.jsx(rs,{property:s?null:S,shallow:!g,children:vl(S,null,M)}),W=s?{label:t.getLabel()}:{property:t};return c.jsxs(I,{className:Z(Pu,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(be,{className:`${Pu}__main`,children:c.jsx(rs,{...W,children:!a&&c.jsx(be,{bottom:"0",children:i!==void 0?i:l?c.jsx(c.Fragment,{children:c.jsx(B,{grow:!0,children:c.jsx(Qt,{size:"s",options:_,value:A?f.id:O,onChange:F=>{F===f.id?d(F):(t.upValue(F),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(B,{grow:!0,children:vl(b,{same:E,all:m},M)}),c.jsx(B,{grow:!0,children:c.jsx(Qt,{size:"s",options:p,value:T,onChange:d})})]})})})}),A&&c.jsx(be,{col:!0,className:Z(`${Pu}__details`,"gjs-px-2 gjs-py-1",z.bgH2,te.rnd,te.b,z.br),children:a?c.jsx("div",{className:Z(`${Pu}__props`,"grid grid-cols-2 gap-2"),children:m.map(F=>c.jsx(rs,{property:F,shallow:!g,className:Z(Uw(F)&&"col-span-full"),children:c.jsx(Gw,{property:F,...M,fieldProps:{label:void 0}})},F.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:$}),c.jsx(B,{grow:!0,children:j})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:$}),c.jsx(B,{grow:!0,children:j})]}),c.jsx(I,{space:"s",children:c.jsx(B,{grow:!0,children:L})})]}):o?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:$}),c.jsx(B,{grow:!0,children:j})]}),c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:D}),c.jsx(B,{grow:!0,children:L})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:$}),c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:D}),c.jsx(B,{grow:!0,children:j})]}),c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:L})]})})]})}var ss=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(ss||{});const Ou="background-image",Xr="__background-type",bl=Ou,Kw="https://placehold.co/150/777/white.png?text=IMAGE",Mh="50px",j7={[Xr]:"image","background-image":`url("${Kw}")`,"background-size":`${Mh} ${Mh}`,"background-repeat":"repeat","background-position":"0px 0px"},D7=e=>(e.includes("gradient(")?Lh(e).colorStops[0].color:e)||"";function F7({sector:e,styleManagerDataConfig:t}){var C;const n=Di(),r=e.getProperty("background"),o=r.getProperty(Xr),s=r.getProperty("background-image"),a=r.getProperty("background-position"),i=r.getProperty("background-size"),l=e.getProperty("background-color"),u=e.getProperty("background-clip"),d={sector:e,styleManagerDataConfig:t},f=[r,l,u].map(x=>x==null?void 0:x.id),p=e.getProperties().filter(x=>!f.includes(`${x.id}`)),g=((C=r.getSelectedLayer())==null?void 0:C.getIndex())||-1,m=o==null?void 0:o.getValue(),v=m==="image",b=s.getValue(),w=()=>{const x=n.Assets;x.open({select(E){const T=E.getSrc();s.upValue(`url("${T}")`),x.close()}})},y=x=>{let E="none",T="100%";x==="image"?(E=`url("${Kw}")`,T=Mh):x==="gradient"?E="linear-gradient(90deg, black 10%, white 90%)":x==="color"&&(E="rgba(0, 0, 0, 0.5)"),s.upValue(E),o.upValue(x),a.upValue("0 0"),i.upValue(`${T} ${T}`)},S=nV(o,[{id:"image",label:c.jsx(ne,{icon:q.image,size:se.s})},{id:"gradient",label:c.jsx(ne,{icon:q.gradientVertical,size:se.s})},{id:"color",label:c.jsx(ne,{icon:q.checkboxBlank,size:se.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(be,{property:r,separator:!0,children:c.jsxs(Zr,{...as(r,d,j7),previewStyle:x=>r.getStyleFromLayer(x,{camelCase:!0}),children:[c.jsx(be,{children:c.jsx(Qt,{...Jr(o,d),options:S,onChange:y,label:void 0})}),c.jsx(be,{children:c.jsxs(rs,{children:[v&&c.jsx(ll,{value:Tu(b).value,onOpen:w}),m==="color"&&c.jsx(vo,{...Gs(s,d),value:D7(b),label:void 0}),m==="gradient"&&c.jsx($7,{value:b,onChange:(x,E)=>s.upValue(x,{partial:E})},g)]})}),v&&c.jsxs(c.Fragment,{children:[c.jsx(be,{col:!0,children:c.jsx(xn,{property:a,...d})}),c.jsx(be,{col:!0,children:c.jsx(xn,{property:i,...d})}),c.jsxs(be,{children:[c.jsx(Le,{...Lt(r.getProperty("background-repeat"),{sector:e})}),c.jsx(Le,{...Lt(r.getProperty("background-attachment"),{sector:e})})]}),c.jsx(be,{children:c.jsx(Le,{...Lt(r.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(be,{property:l,children:c.jsx(vo,{...Gs(l,d)})}),c.jsx(be,{property:u,children:c.jsx(Le,{...Lt(u,d)})}),p.length>0&&c.jsx(Yr,{properties:p,...d})]})}function B7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),r=e.getProperty("border-width"),o=e.getProperty("border-style"),s=e.getProperty("border-color"),a={sector:e,styleManagerDataConfig:t},i=[n,r,o,s].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!i.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(xn,{property:n,corners:!0,...a}),c.jsx(xn,{property:r,...a}),c.jsx(xn,{property:o,...a}),c.jsx(xn,{property:s,...a}),l.length>0&&c.jsx(Yr,{properties:l,...a})]})}const Ws=e=>ou({value:parseFloat(e),min:-3,max:3}),Nh=(e,t="filter",n)=>{const r=e.getProperty(`${t}-value`),o=e.getProperty(`${t}-name`).getOption()||{},s=o.units||[],a=r.getUnit(),i=E6(a,s)?a:s[0];return{...lt(r,n),units:s,valueUnit:i,onChange:(l,u)=>{r.upValue(l,{partial:u,units:s,min:o.min,max:o.max})}}},Zw=(e,t,n,r)=>{const o=e.getProperty(`${t}-name`),s=e.getProperty(`${t}-value`);return{...Lt(o,n,r),onChange:a=>{o.upValue(a),s.upValue("")}}},z7={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function U7({sector:e,styleManagerDataConfig:t}){const n=Ie(),r=_=>n.t(`styleManager.effects.${_}`),o=e.getProperty("box-shadow"),s=e.getProperty("text-shadow"),a=e.getProperty("filter"),i=e.getProperty("backdrop-filter"),l=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),f=e.getProperty("backface-visibility"),p=e.getProperty("perspective"),g=e.getProperty("transform-style"),m=e.getProperty("opacity"),v=e.getProperty("mix-blend-mode"),b=e.getProperty("cursor"),w=e.getProperty("transform-origin"),y=e.getProperty("overflow"),S={sector:e,styleManagerDataConfig:t},C=[o,s,a,i,l,u,d,f,p,g,m,v,b,w,y].map(_=>_==null?void 0:_.id),x=e.getProperties().filter(_=>!C.includes(`${_.id}`)),E=_=>{const{boxShadowH:O,boxShadowV:P,boxShadowBlur:A,boxShadowColor:M,boxShadowSpread:$,boxShadowType:j}=_.getValues({camelCase:!0}),L=Ws(O),D=Ws(P),W=Ws(A),F=Ws($),k=`${L}px ${D}px ${W}px ${F}px ${M} ${j}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(B,{grow:!0,children:[O," ",P," ",A," ",$]}),c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:k}})})]})},T=_=>{const{textShadowH:O,textShadowV:P,textShadowBlur:A,textShadowColor:M}=_.getValues({camelCase:!0}),$=Ws(O),j=Ws(P),L=Ws(A),D=`${$}px ${j}px ${L}px ${M}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(B,{grow:!0,children:[O," ",P," ",A]}),c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:D}})})]})};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:[m,v],children:[c.jsx($e,{...lt(m,S)}),c.jsx(Le,{...Lt(v,S)})]}),c.jsx(be,{property:b,separator:!0,children:c.jsx(Le,{...Lt(b,S)})}),c.jsx(be,{property:o,separator:!0,children:c.jsxs(Zr,{...as(o,S),renderItem:E,children:[c.jsx(be,{children:c.jsx(Qt,{...Jr(o.getProperty("box-shadow-type"),S),label:""})}),c.jsxs(be,{children:[c.jsx($e,{...lt(o.getProperty("box-shadow-h"),S),label:r("boxShadow.xOffset")}),c.jsx($e,{...lt(o.getProperty("box-shadow-v"),S),label:r("boxShadow.yOffset")})]}),c.jsxs(be,{children:[c.jsx($e,{...lt(o.getProperty("box-shadow-blur"),S),label:r("boxShadow.blur")}),c.jsx($e,{...lt(o.getProperty("box-shadow-spread"),S),label:r("boxShadow.spread")})]}),c.jsx(be,{children:c.jsx(vo,{...Gs(o.getProperty("box-shadow-color"),S),label:r("boxShadow.color")})})]})}),c.jsx(be,{property:s,separator:!0,children:c.jsxs(Zr,{...as(s,S,z7),renderItem:T,children:[c.jsxs(be,{children:[c.jsx($e,{...lt(s.getProperty("text-shadow-h"),S),label:r("textShadow.xOffset")}),c.jsx($e,{...lt(s.getProperty("text-shadow-v"),S),label:r("textShadow.yOffset")})]}),c.jsx(be,{children:c.jsx($e,{...lt(s.getProperty("text-shadow-blur"),S),label:r("textShadow.blur")})}),c.jsx(be,{children:c.jsx(vo,{...Gs(s.getProperty("text-shadow-color"),S),label:r("textShadow.color")})})]})}),c.jsx(be,{property:a,separator:!0,children:c.jsx(Zr,{...as(a,S,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(Le,{...Zw(a,"filter",S),label:r("filter.type")}),c.jsx($e,{...Nh(a,void 0,S),label:r("filter.value")})]})})}),c.jsx(be,{property:i,separator:!0,children:c.jsx(Zr,{...as(i,S,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(Le,{...Lt(i.getProperty("backdrop-filter-name"),S),label:r("backdropFilter.type")}),c.jsx($e,{...Nh(i,"backdrop-filter",S),label:r("backdropFilter.value")})]})})}),c.jsx(be,{property:l,separator:!0,children:c.jsxs(Zr,{...as(l,S),children:[c.jsx(be,{children:c.jsx(Le,{...Lt(l.getProperty("transition-property"),S),label:r("transition.type")})}),c.jsx(be,{children:c.jsx(Le,{...Lt(l.getProperty("transition-timing-function"),S),label:r("transition.easing")})}),c.jsxs(be,{children:[c.jsx($e,{...lt(l.getProperty("transition-duration"),S),label:r("transition.duration")}),c.jsx($e,{...lt(l.getProperty("transition-delay"),S),label:r("transition.delay")})]})]})}),c.jsx(be,{property:u,separator:!0,children:c.jsx(Zr,{...as(u,S),children:c.jsxs(be,{children:[c.jsx(Le,{...Zw(u,"transform",S),label:r("transform.type")}),c.jsx($e,{...Nh(u,"transform",S),label:r("transform.value")})]})})}),c.jsx(xn,{property:w,...S}),c.jsx(xn,{property:y,...S}),c.jsx(be,{property:f,children:c.jsx(Qt,{...Jr(f,S)})}),c.jsx(be,{property:[p,g,d],separatorTop:!0,children:r("childrenTransform")}),c.jsxs(be,{property:[p,g],children:[c.jsx($e,{...lt(p,S)}),c.jsx(Qt,{...Jr(g,S)})]}),c.jsx(xn,{property:d,...S}),x.length>0&&c.jsx(Yr,{properties:x,...S})]})}function W7(e,t){return e.indexOf(t)>=0}const bt=se.s,_u="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",Au="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",Lu="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",Yw="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",Xw="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",G7="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",$h="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function q7({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),r=Ie(),[o,s]=h.useState({}),[a,i]=h.useState({}),l=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),f=e.getProperty("align-items"),p=e.getProperty("flex-wrap"),g=e.getProperty("align-content"),m=e.getProperty("align-self"),v=e.getProperty("order"),b=e.getProperty("gap"),w=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},S=[l,u,d,f,p,g,m,v,b,w].map(F=>F.id),C=e.getProperties().filter(F=>!S.includes(`${F.id}`)),x=F=>r.t(`styleManager.layout.${F}`),E=l.getValue(),T=E==="flex",_=(a.display||"").indexOf("flex")>=0,O=u.getValue(),P=O.indexOf("reverse")>=0,A=!W7(["column","column-reverse"],O),M=[{id:"row",label:c.jsx(ne,{icon:q.arrowRight,size:se.sx}),title:x("direction.title.row")},{id:"row-reverse",label:c.jsx(ne,{icon:q.arrowRight,size:bt,horizontal:!0}),title:x("direction.title.row-reverse")},{id:"column",label:c.jsx(ne,{icon:q.arrowDown,size:se.sx}),title:x("direction.title.column")},{id:"column-reverse",label:c.jsx(ne,{icon:q.arrowDown,size:bt,vertical:!0}),title:x("direction.title.column-reverse")}],$=[{id:"flex-start",title:x("justify.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:x("justify.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:A?0:90})},{id:"flex-end",title:x("justify.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:x("justify.title.spaceBetween"),label:c.jsx(ne,{icon:Yw,size:bt,rotate:A?0:90})},{id:"space-around",title:x("justify.title.spaceAround"),label:c.jsx(ne,{icon:Xw,size:bt,rotate:A?0:90})},{id:"space-evenly",title:x("justify.title.spaceEvenly"),label:c.jsx(ne,{icon:G7,size:bt,rotate:A?0:90})}],j=[{id:"stretch",title:x("align.title.stretch"),label:c.jsx(ne,{icon:$h,size:bt,rotate:A?0:90})},{id:"flex-start",title:x("align.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:A?90:0})},{id:"center",title:x("align.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:A?90:0})},{id:"flex-end",title:x("align.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:A?90:0})}],L=[{id:"flex-start",title:x("alignContent.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:x("alignContent.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:A?90:0})},{id:"flex-end",title:x("alignContent.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:x("alignContent.title.spaceBetween"),label:c.jsx(ne,{icon:Yw,size:bt,rotate:A?90:0})},{id:"space-around",title:x("alignContent.title.spaceAround"),label:c.jsx(ne,{icon:Xw,size:bt,rotate:A?90:0})},{id:"stretch",title:x("alignContent.title.stretch"),label:c.jsx(ne,{icon:$h,size:bt,rotate:A?0:90})}],D=[{id:"auto",title:x("alignSelf.title.auto"),label:c.jsx(ne,{icon:q.close,size:bt})},{id:"flex-start",title:x("alignSelf.title.start"),label:c.jsx(ne,{icon:_u,size:bt,rotate:90})},{id:"center",title:x("alignSelf.title.center"),label:c.jsx(ne,{icon:Au,size:bt,rotate:90})},{id:"flex-end",title:x("alignSelf.title.end"),label:c.jsx(ne,{icon:Lu,size:bt,rotate:90})},{id:"stretch",title:x("alignSelf.title.stretch"),label:c.jsx(ne,{icon:$h,size:bt,rotate:0})}],W=[{id:"0 0 auto",label:c.jsx(ne,{icon:q.close,size:bt}),title:x("flex.title.auto")},{id:"1 1 0%",label:c.jsx(ne,{icon:q.unfoldMoreHorizontal,size:bt,rotate:90}),title:x("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(ne,{icon:q.unfoldLessHorizontal,size:bt,rotate:90}),title:x("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:F}=n,k=()=>{const V=n.getSelected();let U={},J={};if(V){const Y=V.getEl();if(Y){U=window.getComputedStyle(Y);const X=Y.parentElement;X&&(J=window.getComputedStyle(X))}}s(U),i(J)},H=F.events.target;return n.on(H,k),k(),()=>n.off(H,k)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Le,{...Lt(l,y),...kh,tip:x(`display.tips.${E}`)})}),T&&c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Qt,{...Jr(u,y),options:M})}),c.jsx(be,{children:c.jsx(Qt,{...Jr(d,y),options:$})}),c.jsx(be,{children:c.jsx(Qt,{...Jr(f,y),options:j})}),c.jsx(be,{children:c.jsx(xn,{property:b,...y})}),c.jsx(be,{children:c.jsx(Le,{...Lt(p,y),...kh})}),p.getValue()!=="nowrap"&&c.jsx(be,{children:c.jsx(Qt,{...Jr(g,y),options:L})})]}),_&&c.jsxs(c.Fragment,{children:[c.jsx(be,{separatorTop:!0,children:x("flexChild")}),c.jsx(be,{children:c.jsx(xn,{property:w,options:W,...y})}),c.jsx(be,{children:c.jsx(Qt,{...Jr(m,y),options:D})}),c.jsx(be,{children:c.jsx($e,{...lt(v,{sector:e,styleManagerDataConfig:t})})})]}),C.length>0&&c.jsx(Yr,{properties:C,...y})]})}const K7=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function Z7({sector:e,styleManagerDataConfig:t}){var w;const n=Ie(),r=e.getProperty("position"),o=r.getValue(),s=e.getProperty("top"),a=e.getProperty("right"),i=e.getProperty("bottom"),l=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},f=y=>n.t(`styleManager.position.${y}`),p=[r,s,a,i,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!p.includes(`${y.id}`)),m=K7.map(y=>({id:y,label:f(`presets.options.${y}`)})),v=["absolute","fixed"].includes(o),b=y=>{let S="auto",C="auto",x="auto",E="auto";switch(y){case"topLeft":S="0%",E="0%";break;case"topRight":S="0%",C="0%";break;case"bottomLeft":x="0%",E="0%";break;case"bottomRight":x="0%",C="0%";break;case"left":S="0%",x="0%",E="0%";break;case"right":S="0%",x="0%",C="0%";break;case"bottom":E="0%",x="0%",C="0%";break;case"top":E="0%",S="0%",C="0%";break;case"full":E="0%",S="0%",C="0%",x="0%";break}s.upValue(S),a.upValue(C),i.upValue(x),l.upValue(E)};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:r,children:[c.jsx(Le,{...Lt(r,d),tip:f(`tips.${(w=r.getOption())==null?void 0:w.id}`),...kh}),v&&c.jsx(B,{children:c.jsx(Wt,{title:f("presets.title"),children:c.jsx(Le,{options:m,onChange:b,emptyState:"P",size:"s",caret:"",value:!0})})})]}),o!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(be,{col:!0,children:[c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx($e,{...lt(s,d)})}),c.jsxs(I,{gap:"s",children:[c.jsx(B,{grow:!0,children:c.jsx($e,{...lt(l,d)})}),c.jsx(B,{grow:!0,children:c.jsx($e,{...lt(a,d)})})]}),c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx($e,{...lt(i,d)})})]}),c.jsx(be,{children:c.jsx($e,{...lt(u,d)})})]}),g.length>0&&c.jsx(Yr,{properties:g,...d})]})}function Y7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),r=e.getProperty("min-width"),o=e.getProperty("max-width"),s=e.getProperty("height"),a=e.getProperty("min-height"),i=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,r,o,s,a,i].map(f=>f==null?void 0:f.id),d=e.getProperties().filter(f=>!u.includes(`${f.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:[n,s],children:[c.jsx($e,{...lt(n,l)}),c.jsx($e,{...lt(s,l)})]}),c.jsxs(be,{property:[r,a],children:[c.jsx($e,{...lt(r,l)}),c.jsx($e,{...lt(a,l)})]}),c.jsxs(be,{property:[o,i],children:[c.jsx($e,{...lt(o,l)}),c.jsx($e,{...lt(i,l)})]}),d.length>0&&c.jsx(Yr,{properties:d,...l})]})}function X7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),r=e.getProperty("margin"),o={sector:e,styleManagerDataConfig:t},s=[n,r].map(i=>i==null?void 0:i.id),a=e.getProperties().filter(i=>!s.includes(`${i.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(xn,{property:n,...o}),c.jsx(xn,{property:r,...o}),a.length>0&&c.jsx(Yr,{properties:a,...o})]})}function J7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),r=e.getProperty("color"),o=e.getProperty("font-size"),s=e.getProperty("font-weight"),a=e.getProperty("line-height"),i=e.getProperty("letter-spacing"),l=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),f=e.getProperty("text-transform"),p=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},v=[n,r,o,s,a,i,l,u,d,f,p,g].map(y=>y==null?void 0:y.id),b=e.getProperties().filter(y=>!v.includes(`${y.id}`)),{sdkAddFonts:w}=Ai();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(be,{property:n,children:w?c.jsx(hu,{...eS(n,m)}):c.jsx(Le,{...Lt(n,m)})}),!!r&&c.jsx(be,{property:r,children:c.jsx(vo,{...Gs(r,m)})}),c.jsxs(be,{property:[o,s],children:[!!o&&c.jsx($e,{...lt(o,m)}),!!s&&c.jsx(Le,{...Lt(s,m)})]}),c.jsxs(be,{property:[a,i],children:[!!a&&c.jsx($e,{...lt(a,m)}),!!i&&c.jsx($e,{...lt(i,m)})]}),c.jsxs(be,{property:[l,u],children:[!!l&&c.jsx(Le,{...Lt(l,m)}),!!u&&c.jsx(Le,{...Lt(u,m)})]}),c.jsxs(be,{property:[f,p],children:[!!f&&c.jsx(Le,{...Lt(f,m)}),!!p&&c.jsx(Le,{...Lt(p,m)})]}),c.jsxs(be,{property:[g,d],children:[!!g&&c.jsx(Le,{...Lt(g,m)}),!!d&&c.jsx(Le,{...Lt(d,m)})]}),b.length>0&&c.jsx(Yr,{properties:b,...m})]})}const kh={row:!0,classNameLabel:"gs-utl-w-full"},Q7=({property:e,skipClear:t,label:n,afterLabelButtons:r=[]})=>c.jsxs(I,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(B,{grow:!1,children:c.jsx(rs,{property:e,skipClear:t,label:n})}),!!r.length&&c.jsx(I,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:r.map((o,s)=>c.jsx(Ct,{...o},s))})]}),Jw="gs-style-manager",Mu=`${Jw}-sector`,R7=`${Mu}-header`,eV=`${Mu}-content`,Qw=(e,t=0,n=!0)=>N(R7,z.bgH2,Te.xyS,z.br,t&&te.bt,(e||n)&&te.bb),tV=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),nV=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),yl=(e,t)=>{const n=rV(e,t),r=Hw(n),{hasDataResolverValue:o}=n,{label:s}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:o,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:r.length?"span":void 0,label:c.jsx(Q7,{property:e,skipClear:o,label:s,afterLabelButtons:r})}}},Ih=(e,t)=>{const{connectDataSources:n,commonProps:r}=yl(e,t);return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,s)=>e.upValue(o,{partial:s})}},Rw=(e,t,n)=>{const{connectDataSources:r,commonProps:o}=yl(e,t),{hasDataResolverValue:s,initialDataValue:a}=r;return{fieldProps:{...o,value:s?a:e.getValue(),options:tV(e,n??{}),onChange:i=>e.upValue(i)},connectDataSources:r}},Jr=(e,t,n)=>Rw(e,t,n).fieldProps,Lt=(e,t,n)=>{const{fieldProps:r,connectDataSources:o}=Rw(e,t,n),{hasDataResolverValue:s}=o,a=s?e.getValue()||" ":r.emptyState;return{...r,emptyState:a,hideCaret:s}},eS=(e,t)=>{const{commonProps:n,connectDataSources:r}=yl(e,t),o=r.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:o,hideCaret:r.hasDataResolverValue,value:r.dataResolverValue??e.getValue(),onChange:s=>e.upValue(s)}},as=(e,t,n={})=>{const{connectDataSources:r,commonProps:o}=yl(e,t),{hasDataResolverValue:s,dataResolverValue:a}=r;return{...o,title:e.getLabel(),emptyState:s?a:void 0,titleAdd:`Add new ${e.getLabel()}`,items:s?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:i=>e.getLayerLabel(i),add:s?void 0:()=>e.addLayer(n,{at:0}),select:i=>e.selectLayer(i),remove:i=>e.removeLayer(i),move:(i,l=0)=>e.moveLayer(i,l)}},lt=(e,t)=>{const{connectDataSources:n,commonProps:r}=yl(e,t),{hasDataResolverValue:o}=n;return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(s,a)=>e.upValue(s,{partial:a}),valueUnit:e.getUnit(),pan:!o,units:o?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:s=>e.upUnit(s)}};function rV(e,t){const{styleManagerDataConfig:n=!1,sector:r}=t,o=e.em.getEditor(),{Styles:s}=o,a=o.getSelected(),i=s.getSelectedAll(),l=s.getSelected();let u=!1;n===!0?u=!0:a&&Rr(n)&&et(n.enable)&&(u=n.enable({property:e,sector:r,component:a,editor:o}));const d=e.getName(),f=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",p=es(f),g=a==null?void 0:a.collectionsStateMap;return{hasDataResolverValue:p,dataResolverValue:p?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:f,handleDataValueChange:m=>{i.forEach(v=>{v.addStyle({[d]:m})})},handleValueClear:()=>{i.forEach(m=>{const v=m.getStyle()[d]??"";m.addStyle({[d]:v})})},editor:o,additionalSources:g}}const Gs=(e,t)=>Ih(e,t),oV=(e,t)=>{const{label:n,...r}=Ih(e,t);return{...r,label:n,isContain:e.get("contain")??!0,hideButton:r.disabled,inputField:e.get("inputField"),onOpen(){const o=e.em.Assets;o.open({select(s){e.upValue(s.getSrc()),o.close()}})}}},sV=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let r=V7;switch(n){case"gs-layout":r=q7;break;case"gs-size":r=Y7;break;case"gs-space":r=X7;break;case"gs-position":r=Z7;break;case"gs-borders":r=B7;break;case"gs-effects":r=U7;break;case"gs-typography":r=J7;break;case"gs-background":r=F7;break}return c.jsx(r,{sector:e,styleManagerDataConfig:t})},Vh={},tS=ce(function({className:t,sectors:n}){var p;const[r,o]=h.useState(Vh),s=we(),{editor:a}=s,i=a==null?void 0:a.Styles,l=i==null?void 0:i.getSelected(),u=a==null?void 0:a.getSelected();if(h.useEffect(()=>{if(u&&a){const g=setTimeout(()=>{let m=Vh;const v=u.get("styleManager");et(v)&&(m=v({editor:a,component:u})),o(m||Vh)});return()=>clearTimeout(g)}},[u,a]),!i||!l)return null;const d=n.length?n:i.getSectors({visible:!0}),f=(p=s.sdkOptions.dataSources)==null?void 0:p.styleManager;return r.disabled?null:c.jsx("div",{className:N(Jw,t,"gs-utl-select-none"),children:d.map((g,m)=>c.jsx(mo,{open:g.isOpen(),onChange:({open:v})=>g.setOpen(v),classNameWrap:N(Mu,`${Mu}__${g.id}`),sticky:!0,handler:()=>{const v=g.getProperties({withValue:!0}).length>0,b=g.getProperties({withParentValue:!0}).length>0;return c.jsxs(I,{gap:"xs",items:"center",children:[c.jsx(B,{className:"gs-utl-mr-2",children:g.getName()}),v&&c.jsx(B,{children:c.jsx("div",{className:N(Pe.dot,z.bgA2)})}),b&&c.jsx(B,{children:c.jsx("div",{className:N(Pe.dot,z.bgW)})})]})},className:v=>Qw(v,m,m===d.length-1),children:c.jsx(I,{className:N(eV,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:sV(g,{styleManagerDataConfig:f})})},g.id))})}),aV=h.forwardRef(function({children:t,className:n,content:r,...o},s){return c.jsx("div",{className:N(ae("gs-design-manager-tab"),n),ref:s,...o,children:t})}),nS="gs-cmp-sidebar-right",rS="gs-cmp-traits-provider",Hh=N("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function iV(){var y,S,C;const{isCssPanelActive:e,selectedDesignerTab:t,showSelectors:n,setSelectedDesignerTab:r,sdkProps:o,sdkOptions:s,isProjectTypeEmail:a}=we(),i=Ie(),l=N(e&&"gs-utl-hidden"),d=(((y=Xn(o.children,aV))==null?void 0:y.filter(Boolean))||[]).map(({props:x},E)=>({id:x.id,label:x.label,content:c.jsx(Fi,{children:x.children}),order:x.order??2+E+1})),f=(S=s.designPanel)==null?void 0:S.propsInStyles,p=(C=s.designPanel)==null?void 0:C.hideTabs,g=f===!0||a&&f!==!1,m=p===!0||a&&p!==!1,v=i.t("traitManager.panelLabel"),w=[{id:"style",label:i.t("styleManager.panelLabel"),order:1,content:c.jsxs(I,{col:!0,full:!0,children:[!!n&&c.jsx(B,{className:N("gs-cmp-selectors-provider",Te.s,te.bb,z.br),children:c.jsx(_b,{children:x=>c.jsx(zw,{...x})})}),g&&c.jsx(B,{className:N(rS,Hh),children:c.jsx(mo,{handler:v,className:Qw(!1),sticky:!0,open:!0,children:c.jsx(ip,{children:x=>c.jsx(Ph,{...x,className:N("gs-utl-p-2",z.br,te.bb)})})})}),c.jsx(B,{className:N("gs-cmp-styles-provider",Hh),grow:!0,children:c.jsx(Ab,{children:x=>c.jsxs(c.Fragment,{children:[e&&c.jsx(Lb,{}),c.jsx(tS,{className:l,...x})]})})})]})},!g&&{id:"props",label:v,order:2,content:c.jsx(I,{className:rS,col:!0,full:!0,children:c.jsx(B,{className:N(Te.s,Hh),children:c.jsx(ip,{children:x=>c.jsx(Ph,{...x})})})})},...d].filter(Boolean).sort((x,E)=>x.order-E.order);return c.jsx(I,{className:nS,col:!0,full:!0,nowrap:!0,children:c.jsx(Zo,{value:t,onChange:r,tabs:w,className:N(`${nS}__tabs`,m&&"gs-utl-hidden")})})}const oS=ce(iV),lV="gs-panel-sidebar-tabs",cV=h.memo(ce(function({className:t,...n}){return c.jsx(Cr,{className:N(lV,"gs-utl-h-full",t),...n,children:c.jsx(oS,{})})})),uV="gs-panel-styles",dV=h.memo(ce(function({className:t,...n}){const{isCssPanelActive:r}=we(),o=N(r&&" gs-utl-hidden");return c.jsx(Cr,{className:N(uV,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Ab,{children:s=>c.jsxs(c.Fragment,{children:[r&&c.jsx(Lb,{}),c.jsx(tS,{className:o,...s})]})})})})),fV="gs-panel-templates",pV=h.memo(ce(function({className:t,templates:n,content:r,onSelect:o,...s}){const a=xv(),{projectTypeFilter:i}=a;let l=n??a.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),h.useEffect(()=>{n||a.loadTemplates()},[n]),c.jsx(Cr,{className:N(fV,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(I,{className:ae("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(I,{className:ae("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(j0,{templates:l,projectType:xt[i],content:r,onSelect:o,skipProjectNamePopover:!0})})})})})),hV="gs-cmp-row",gV=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(Cn,{className:N(hV,z.bg,"gs-utl-flex",r&&"gs-utl-w-full",t),...o,children:$t(n)})}),mV="gs-cmp-select-field",vV=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,options:a,size:i,onChange:l,required:u,disabled:d,emptyState:f,editorEvents:p}){const{editor:g}=we(),[m,v]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:r,name:o,value:s,options:a,size:i,emptyState:f})),b=w=>{l({value:w,editor:g,state:m,setState:y=>v(S=>({...S,...y}))})};return is({editor:g,editorEvents:p,localState:m,setLocalState:v}),c.jsx(Le,{classNameContainer:N(mV,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})})),bV="gs-cmp-select-field",yV=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,onChange:i,required:l,disabled:u,emptyState:d,editorEvents:f}){const{editor:p}=we(),[g,m]=h.useState(()=>({required:l,disabled:u,style:n,className:t,label:r,name:o,value:s,size:a,emptyState:d})),v=b=>{i({value:b,editor:p,state:g,setState:w=>m(y=>({...y,...w}))})};return is({editor:p,editorEvents:f,localState:g,setLocalState:m}),c.jsx(hu,{classNameContainer:N(bV,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})})),wV="gs-sidebar-bottom",SV=h.memo(ce(function({children:t,className:n,style:r,height:o,...s}){const{isInPreview:a,isBottomSidebarOpen:i}=we(),l=o??35,u=h.useMemo(()=>({height:l,marginBottom:a||!i?`-${l}px`:0,...r}),[a,i,r]);return c.jsx(Cn,{className:N(wV,"gs-utl-flex gs-utl-transition-spacing",te.bt,z.br,n),style:u,...s,children:t?$t(t):void 0})})),CV=ce(function(t){var S;const{leftSidebarSize:n,setLeftSidebarSize:r,editor:o,isInPreview:s,isLeftSidebarOpen:a,sdkProps:i,showPages:l}=we(),u=i.children,d=((S=t.style)==null?void 0:S.width)??t.width,f=d??n,p=t.resizable===!1,g=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.br,z.br),m=N("gs-utl-w-full",te.bb,z.br),v=N("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),b=h.useMemo(()=>({marginLeft:s||!a?`-${f}px`:0,...t.style}),[f,s,a,t.style]),w=()=>o==null?void 0:o.refresh(),y=(C,x,E)=>{r(E.getBoundingClientRect().width)};return c.jsx(fu,{className:g,enable:p?!1:void 0,right:!p,style:b,height:"100%",width:f,minWidth:d??200,maxWidth:d??400,onResize:w,onResizeStop:y,children:t.children??c.jsxs(I,{full:!0,col:!0,children:[l&&c.jsx(B,{className:m,children:c.jsx(Ob,{children:C=>c.jsxs(c.Fragment,{children:[Xn(u,_w),c.jsx(Pw,{...C}),Xn(u,Ow)]})})}),c.jsx(B,{className:v,grow:!0,children:c.jsx(Pb,{children:C=>c.jsxs(c.Fragment,{children:[Xn(u,Uy),c.jsx(By,{...C}),Xn(u,zy)]})})})]})})}),xV="gs-sidebar-left",EV=h.memo(ce(function({children:t,width:n,resizable:r,...o}){return c.jsx(CV,{className:N(xV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",kc(o)),width:n,resizable:r,style:Ic(o),children:t?$t(t):void 0})})),TV=ce(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:r,editor:o,isInPreview:s,isRightSidebarOpen:a}=we(),i=((m=t.style)==null?void 0:m.width)??t.width,l=i??n,u=t.resizable===!1,d=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.bl,z.br),f=h.useMemo(()=>({marginRight:s||!a?`-${l}px`:0,...t.style}),[l,s,a,t.style]),p=()=>o==null?void 0:o.refresh(),g=(v,b,w)=>{r(w.getBoundingClientRect().width)};return c.jsx(fu,{className:d,enable:u?!1:void 0,left:!u,style:f,height:"100%",width:l,minWidth:i??200,maxWidth:i??400,onResize:p,onResizeStop:g,children:t.children??c.jsx(oS,{})})}),PV="gs-sidebar-right",OV=h.memo(ce(function({children:t,resizable:n,...r}){return c.jsx(TV,{className:N(PV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",kc(r)),resizable:n,style:Ic(r),children:t?$t(t):void 0})})),_V=ce(function({className:t,variant:n,value:r,tabs:o,style:s,editorEvents:a,onChange:i}){const{editor:l}=we(),[u,d]=h.useState(()=>({tabs:o,style:s,value:r,variant:n,className:t})),f=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:$t(m.children)})))||[]},[u.tabs]),p=g=>{i&&l?i({value:g,editor:l,state:u,setState:m=>d(v=>({...v,...m}))}):d(m=>({...m,value:g}))};return is({editor:l,editorEvents:a,localState:u,setLocalState:d}),c.jsx(Zo,{tabs:f,className:N(u.className),variant:u.variant,value:u.value,style:u.style,onChange:p})}),AV="gs-cmp-text",LV=h.memo(function({className:t,content:n,children:r,...o}){return c.jsx(Cn,{className:N(AV,t),...o,children:r||n})}),MV="gs-cmp-virtual-list",NV=ce(function({id:t,items:n,itemLayout:r,footerLayout:o,onRef:s,itemsPerRow:a=12,className:i,style:l,htmlAttrs:u}){const[d,f]=h.useState(0),{editor:p,transitionTime:g}=we(),m=Ap(a),v=a===1;h.useEffect(()=>{const S=setTimeout(()=>f(C=>++C),g);return()=>clearTimeout(S)},[g]);const b={id:t,...u},w=!!d&&!!p,y={data:n,style:l,className:N(MV,"gs-utl-h-full",i),itemContent:(S,C)=>c.jsx(h.Fragment,{children:r?$t(r({item:C,index:S,editor:p})):c.jsx("pre",{children:JSON.stringify(C,void 0,2)})},C.id??S),components:{Footer:o&&p?()=>$t(o({editor:p})):void 0}};return w&&(v?c.jsx(J$,{...b,...y,ref:s},t):c.jsx(Rc,{...b,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:s},t))});var jh=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",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))(jh||{});const $V={icon:ne,row:gV,column:d6,text:LV,tabs:_V,button:Nc,buttonMenu:hN,buttonGroupField:mN,colorPicker:c6,menuList:n8,inputField:e8,codeField:Vk,selectField:vV,selectFontField:yV,devices:B0,panelPages:Aw,panelPageSettings:I9,panelLayers:Wy,panelPagesLayers:z9,panelBlocks:$8,panelGlobalStyles:Z8,panelSelectors:O7,panelStyles:dV,panelProperties:g7,panelSidebarTabs:cV,panelAssets:E8,panelTemplates:pV,sidebarRight:OV,sidebarLeft:EV,sidebarTop:z0,sidebarBottom:SV,canvas:kb,canvasSidebarTop:kk,virtualList:NV,dataPathField:G6,panelDataVariablePicker:Q6,panelDataConditionPicker:U6,panelDataCollectionPicker:L6,panelDataValuePicker:Z6},$t=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=s4();return t.filter(Boolean).map((r,o)=>{const{type:s,...a}=ct(r)?{type:jh.text,content:r}:r||{},i=a.id||"",l=$V[s],u=n.layoutChildren.get(i),d=n.customLayoutComponents.get(s),f=i||o;if(u)return c.jsx(Ff,{id:i,...u},f);if(d){const p=d({id:i,...a});return $t([p])[0]}else{if(s===jh.custom)return c.jsx(Ff,{id:i,...a},f);if(l)return c.jsx(l,{id:i,...a},f)}return null})},kV=ce(({components:e})=>(Cv().customLayoutComponents,$t(e))),is=e=>{const{editorEvents:t,editor:n,localState:r,setLocalState:o}=e;h.useEffect(()=>{if(!t||!n)return;const s=Object.keys(t).reduce((i,l)=>(i[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:r,setState:f=>o(p=>({...p,...f}))})},i),{}),a=Object.keys(s);return a.forEach(i=>n.on(i,s[i])),()=>{a.forEach(i=>n.off(i,s[i]))}},[n,r])},IV=e=>e.Assets.getAll().reduce((r,o)=>{const s=o.getSrc(),a=s.match(/^data:([^;]+);/);if(a){const i=s.split(",")[1],l=N3(o.get("name"));r[s]={mime:a[1],name:l,base64:i}}return r},{}),VV=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sS=(e,t,n={})=>{let r=e;const o=n.pathPfx||"";for(const s in t)if(r.includes(s)){const a=t[s];r=r.replace(new RegExp(VV(s),"g"),`${o}${a.name}`),a.found=!0}return r},HV=(e,t,n)=>`${t||""}${e||""}${n||""}`,jV=(e,t)=>{const n=e?`<div ${wc}>${e}</div>`:"",r=t?`<div ${wc} data-gjs-global>${t}</div>`:"";return`${n}${r}`},DV=async(e,t={})=>{const{page:n,skipProject:r,assetsFolder:o="assets",filenameCss:s="style.css",styles:a,isMJML:i,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:f}=t,p={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),v=IV(e),b=`${o}/`,w=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=sS(w,v,{pathPfx:b}),S=a==="inline",C=a==="skip",x=a==="skipInPage",E=f==="skip",T=u?{}:Sa(e).globalPageSettings||{},_=[],O=(P,A)=>{var Gt,wo,qs;const{pageSettingOpts:M}=A||{},$=P.getName(),j=S||(M==null?void 0:M.replaceDataSources),L=Do(P,"title",M)||$,D=Do(P,"favicon",M),W=Do(P,"description",M),F=Do(P,"keywords",M),k=Do(P,"socialTitle",M),H=Do(P,"socialDescription",M),V=Do(P,"socialImage",M),U=u?"":tv(Do(P,"fonts")),J=ln({page:P,key:"customCodeHead",opts:M})??"",Y=HV(J,T.customCodeHead,U),X=ln({page:P,key:"customCodeBody",opts:M})??"",Q=d?"":jV(X,T.customCodeBody),ee=P.getMainComponent(),G=E?"":e.getJs({component:ee}),R=G?`<script>${G}<\/script>`:"",le=[],ge=[],Ee={asDocument:!1,...p},Ce=ee.toHTML(Ee).replace("</body>",()=>`${Q}${R}</body>`),tt=ee.head;let Qe=L&&`<title>${L}</title>`,Ot=D&&`<link rel="icon" href="${D}"/>`,ut=W&&`<meta name="description" content="${W}"/>`,Se=F&&`<meta name="keywords" content="${F}"/>`,ot=k&&`<meta property="og:title" content="${k}"/>`,st=H&&`<meta property="og:description" content="${H}"/>`,wt=V&&`<meta property="og:image" content="${V}"/>`,Ne='<meta charset="utf-8">',mt='<meta name="viewport" content="width=device-width,initial-scale=1">',dt='<meta name="robots" content="index,follow">',Ue='<meta name="generator" content="GrapesJS Studio">';tt.components().forEach(Re=>{const St=Re.toHTML(p);pt.title({cmp:Re})?Qe=St:pt.favicon({cmp:Re})?Ot=St:pt.description({cmp:Re})?ut=St:pt.keywords({cmp:Re})?Se=St:pt.socialTitle({cmp:Re})?ot=St:pt.socialDescription({cmp:Re})?st=St:pt.socialImage({cmp:Re})?wt=St:pt.charset({cmp:Re})?Ne=St:pt.viewport({cmp:Re})?mt=St:pt.robots({cmp:Re})?dt=St:pt.generator({cmp:Re})&&(Ue=St)}),Qe&&le.push(Qe),Ne&&le.push(Ne),mt&&le.push(mt),dt&&le.push(dt),Ue&&le.push(Ue),ut&&le.push(ut),Se&&le.push(Se),ot&&le.push(ot),st&&le.push(st),wt&&le.push(wt),Ot&&le.push(Ot),ge.length&&le.push(...ge),Y&&le.push(Y),y&&!(C||x)&&le.push(j?`<style>${y}</style>`:`<link rel="stylesheet" href="./${s}">`);const he=ee.doctype||"<!DOCTYPE html>",De=(wo=(Gt=ee.docEl).__attrToString)==null?void 0:wo.call(Gt,p),Fe=(qs=tt.__attrToString)==null?void 0:qs.call(tt,p),He=e.getHtml(p).trim(),Mt=i?e.runCommand(Oc,{mjml:He}).html:`${he}
334
+ }`),t},or="gs-cmp-selector-manager",_h={},zw=ce(function(t){var le,ge,Te;const{selectedState:n,states:r,setState:o,styleCatalog:s,stateSelector:a}=t,i=we(),[l,u]=h.useState(!1),[d,p]=h.useState([]),[f,g]=h.useState(_h),{toggleCssPanel:m,isCssPanelActive:v,editor:b,store:w}=we(),{i18nStore:y,modalStore:S}=w,C=b==null?void 0:b.getSelected(),x=b==null?void 0:b.Styles.getSelected();if(h.useEffect(()=>{if(b&&x&&i){const Ce=setTimeout(()=>{let tt=_h;const Qe=C==null?void 0:C.get("selectorManager");C&&et(Qe)&&(tt=Qe({editor:b,component:C})),g(tt||_h),p(_7(b,i))});return()=>clearTimeout(Ce)}},[C,b,x,i]),!b)return null;const{Selectors:E}=b,T=f.disableClasses,_=f.disableComponent,O=T&&_,P=E.getComponentFirst()&&!_,A=E.getSelectedAll(),M=b.getSelectedAll(),k=r.map(Ce=>({id:Ce.getName(),label:Ce.getLabel()})),j=b.getModel(),L=(le=x==null?void 0:x.getDevice)==null?void 0:le.call(x),D=(ge=x==null?void 0:x.getState)==null?void 0:ge.call(x),W=N("gs-utl-overflow-hidden",te.b,te.rnd,z.br),F=N(z.bA),$=N("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",te.br,z.br),H=`${z.bgA}`,V=A7(x),U=A.length>0,J=M.length>0,Y=U||J,X=P&&J||!P&&!U,Q=X?"Components":"Selectors",ee=Ce=>y.t(`selectorManager.${Ce}`),G=y.t("modals.styleCatalog.title"),R=()=>S.open({title:G,content:c.jsx(C7,{})});return c.jsxs(I,{className:or,gap:"s",col:!0,full:!0,children:[c.jsxs(I,{className:N(`${or}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(I,{className:N(`${or}__head-start`),items:"center",gap:"s",children:[c.jsx(B,{className:N(`${or}__head-title`),children:ee("selection")}),s!==!1&&c.jsx(B,{className:N(`${or}__style-catalog`),children:c.jsx(Ut,{className:"gs-utl-cursor-pointer",onClick:R,title:G,children:c.jsx(re,{icon:q.paletteSwatch,size:se.s})})})]}),!!x&&a!==!1&&!O&&c.jsx(B,{className:`${or}__head-end`,children:c.jsx(Le,{size:"s",value:n,options:k,includeEmpty:!0,onChange:o,emptyState:`- ${ee("state")} -`,className:N(n&&z.bA)})})]}),Y&&!O?c.jsxs(c.Fragment,{children:[!T&&c.jsxs(I,{className:N(`${or}__field-selectors`,W,!X&&F),items:"stretch",gap:"xs",children:[c.jsx(Ut,{title:ee(U?"applyOnSelector":"noSelectors"),className:N($,!X&&H),onClick:()=>U&&E.setComponentFirst(!1),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(re,{icon:q.tag,size:se.sx})})}),c.jsx(B,{grow:!0,children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(Lw,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:ee("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:Ce=>{Ce&&(E.addSelected(Ce.id||Ce.label),u(!1))}}):c.jsxs(c.Fragment,{children:[J&&c.jsx(Ct,{title:ee("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(re,{icon:q.plus,size:se.sx})}),A.map(Ce=>c.jsx(x7,{selector:Ce,removable:J,toggleable:J&&A.filter(tt=>tt.getActive()||tt===Ce).length>1},Ce.toString()))]})})})]}),!_&&c.jsxs(I,{className:N(`${or}__field-components`,W,X&&F),items:"stretch",gap:"xs",children:[c.jsx(Ut,{title:ee(J?"applyOnComponents":"noComponents"),onClick:()=>J&&E.setComponentFirst(!0),className:N($,X&&H),children:c.jsx(I,{className:"gs-utl-h-full",items:"center",children:c.jsx(re,{icon:q.targetVariant,size:se.sx})})}),c.jsx(B,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:M.map(Ce=>c.jsx(Zo,{s:"s",className:N("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",z.cmp),onPointerEnter:()=>j.setHovered(Ce),onPointerOut:()=>j.setHovered(),label:Ce.getName()},Ce.getId()))})})]}),c.jsxs(I,{className:`${or}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:ee("selected")}),c.jsx("pre",{className:N("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",te.rnd,Pe.xyS),children:V}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:ee("currentSelection")})]}),children:c.jsx(Zo,{className:N(te.b,te.rnd,z.br),s:"xs",nopad:!0,block:!0,children:c.jsx(re,{icon:q.target,size:se.sx})})}),c.jsx(B,{className:"gs-utl-text-sm",children:c.jsx(Zo,{className:N(te.b,te.rnd,z.br),s:"xs",nopad:!0,children:c.jsxs(I,{space:"xs",items:"center",nowrap:!0,children:[!!L&&L.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[ee("device"),": ",c.jsx("b",{children:L.getName()})]}),children:c.jsx(re,{icon:q.cellphoneLink,size:se.sx})}),c.jsx(B,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[ee("target"),": ",c.jsx("b",{children:Q}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(Te=x==null?void 0:x.selectorsToString)==null?void 0:Te.call(x,{skipState:1})]})]}),children:c.jsx(re,{icon:X?q.targetVariant:q.tag,size:se.sx})}),!!D&&c.jsxs(c.Fragment,{children:[c.jsx(B,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[ee("state"),": ",c.jsx("b",{children:D.getLabel()})]}),children:c.jsx(re,{icon:q.flare,size:se.sx})})]})]})})}),c.jsx(Ct,{title:y.t("toggleCss"),onClick:m,active:v,size:"s",children:c.jsx(re,{icon:q.codeBraces,size:se.sx})})]})]}):c.jsxs(I,{className:N(`${or}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(B,{className:`${or}__empty-state-title`,children:ee("noSelecton")}),c.jsxs("ul",{className:N(`${or}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:ee("selectFromCanvas")}),c.jsx("li",{children:ee("selectFromList")})]})]})]})}),L7="gs-panel-selectors",M7=h.memo(ce(function({className:t,styleCatalog:n,stateSelector:r,...o}){return c.jsx(Er,{className:N(L7,t),...o,children:c.jsx(_b,{children:s=>c.jsx(zw,{...s,styleCatalog:n,stateSelector:r})})})}));function os({label:e,property:t,hasValue:n,empty:r,onClear:o,children:s,shallow:a,row:i,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||!r&&(t==null?void 0:t.hasValue({noParent:!0})),v=!m&&(t==null?void 0:t.hasValue())&&g,b=g==null?void 0:g.getDevice(),w=g==null?void 0:g.getState(),y=g==null?void 0:g.getComponent(),S=()=>o?o():t==null?void 0:t.clear(),C={className:N(d,"gs-utl-text-sm gs-utl-w-full"),col:!i,items:i?"center":void 0,...p},x=N("gs-utl-flex-1",m&&!a&&z.tAo);return t&&!t.isVisible()?null:c.jsxs(I,{gap:"xs",...C,children:[c.jsxs(I,{className:x,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(B,{children:c.jsx(Ut,{title:l,children:c.jsx(re,{icon:q.information,size:se.sx})})}),c.jsx(B,{children:r?c.jsx("span",{children:" "}):f}),!!v&&!a&&c.jsx(Ut,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N("gs-utl-mb-1"),children:"Value inherited from"}),!!b&&c.jsxs(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(re,{icon:q.cellphoneLink,size:se.sx})}),c.jsx(B,{children:c.jsx("b",{children:b.getName()})})]}),c.jsxs(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(re,{icon:y?q.targetVariant:q.tag,size:se.sx})}),c.jsxs(B,{children:[c.jsx("b",{children:y?"Components":"Selectors"}),c.jsxs("span",{className:N("gs-utl-text-xs gs-utl-opacity-75"),children:[" ",g==null?void 0:g.selectorsToString({skipState:1})]})]})]}),!!w&&c.jsxs(I,{gap:"s",children:[c.jsx(B,{children:c.jsx(re,{icon:q.flare,size:se.sx})}),c.jsx(B,{children:c.jsx("b",{children:w.getLabel()})})]})]}),children:c.jsx("div",{className:N("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",z.bgW)})}),m&&!a&&!u&&c.jsx(Ut,{title:"Clear value",onClick:S,children:c.jsx(re,{className:Oe.click,icon:q.close,size:se.s2x})})]}),!!s&&c.jsx(B,{grow:!0,className:"gs-utl-max-w-full",children:s})]})}function Pu(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 N7=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,k7=/,(?![^(]*\))/,Ah=/\s(?![^(]*\))/,$7=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Lh=/^circle|ellipse/i,Mh=e=>{var d;const t=[],{name:n,value:r}=Pu(e),[o,...s]=r.split(k7).map(p=>p.trim()).filter(Boolean),a=s.length>1,i=a?o:"",l={type:"none"},u=a?s:[o,...s];if(N7.test(i))l.type="angle",l.value=i;else if(/^to\s/.test(i))l.type="side-or-corner",l.value=i;else if($7.test(i))l.type="size",l.value=i;else if(Lh.test(i)||/^at\s/.test(i)||/\sat\s/.test(i)){l.type="at",l.value=i;const p=((d=i.match(Lh))==null?void 0:d[0])||"circle";l.shape=p;const f={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,v]=i.replace(Lh,"").trim().split("at").map(b=>b.trim());if(m){const[b,w]=m.split(Ah);f.x=b,f.y=w||b}if(v){const[b,w]=v.split(Ah);g.x=b,g.y=w||b}l.size=f,l.position=g}return u.forEach(p=>{const[f,g]=p.split(Ah);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}},ss=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const o=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(s=>`${s.color} ${s.hint?`${s.hint}%`:""}`.trim()).join(", ");return o?`${n}(${t}, ${o})`:"none"},I7=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),V7="gs-cmp-grad-picker";function H7({className:e,value:t,onChange:n}){var D,W,F;const r=Mh(t),[o,s]=h.useState(r.colorStops),[a,i]=h.useState(null),l=h.useRef(null),u=Z(V7,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,te.rnd),d=r.name||"linear-gradient",p=d.indexOf("radial")>=0,f=d.indexOf("repeating")>=0,g=r.orientation.value,m=`${parseFloat(`${g}`)||180}`,v=`${parseFloat(`${(D=r.orientation.size)==null?void 0:D.x}`)||0}`,b=`${parseFloat(`${(W=r.orientation.position)==null?void 0:W.x}`)||0}`,w=`${parseFloat(`${(F=r.orientation.position)==null?void 0:F.y}`)||0}`,y=0,S=100,C=($,H=!1)=>{const V=I7($);s(V),n==null||n(ss({name:d,orientation:g,stops:V}),H)},x=($,H=!1)=>{n==null||n(ss({stops:o,name:d,orientation:`${$}deg`}),H)},E=($,H=!1)=>{n==null||n(ss({stops:o,name:d,orientation:`${$}px at ${b}% ${w}%`}),H)},T=($,H=!1)=>{n==null||n(ss({stops:o,name:d,orientation:`${v}px at ${$}% ${w}%`}),H)},_=($,H=!1)=>{n==null||n(ss({stops:o,name:d,orientation:`${v}px at ${b}% ${$}%`}),H)},O=$=>{const H=`${$?"repeating-":""}${p?"radial":"linear"}-gradient`;n==null||n(ss({stops:o,orientation:g,name:H}))},P=$=>{const H=`${f?"repeating-":""}${$?"radial":"linear"}-gradient`;n==null||n(ss({stops:o,orientation:$?"100px at 50% 50%":"90deg",name:H}))};h.useEffect(()=>{if(!a)return;const $=parseFloat(`${a.stop.hint}`),H=U=>{let Y=(U.clientX-a.x)*100;Y=Y/a.w,Y=$+Y,Y=Y<y?y:Y,Y=Y>S?S:Y,a.stop.hint=parseInt(`${Y}`,10),C(o,!0)},V=()=>{i(null),C(o)};return window.addEventListener("pointermove",H),window.addEventListener("pointerup",V),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V),V()}},[a]);const A=($,H)=>{const V=l.current;i({stop:H,w:(V==null?void 0:V.clientWidth)||0,h:(V==null?void 0:V.clientHeight)||0,x:$.clientX,y:$.clientY})},M=$=>{const H=l.current,V=(H==null?void 0:H.clientWidth)||0,U=(H==null?void 0:H.clientHeight)||0,J=$.nativeEvent.offsetX-((H==null?void 0:H.clientLeft)||0),Y=$.nativeEvent.offsetY-((H==null?void 0:H.clientTop)||0),X=J/V*100,Q=document.createElement("canvas"),ee=Q.getContext("2d");if(!ee)return;Q.width=V,Q.height=U;const G=ee.createLinearGradient(0,0,V,U);o.forEach(Ce=>G.addColorStop(parseFloat(`${Ce.hint}`)/100,Ce.color)),ee.fillStyle=G,ee.fillRect(0,0,Q.width,Q.height),Q.style.background="black";const R=ee.getImageData(J,Y,1,1).data,le=R[3]?(100/255*R[3]/100).toFixed(2):0,ge=`rgba(${R[0]}, ${R[1]}, ${R[2]}, ${le})`,Te=ge==="rgba(0, 0, 0, 0)"?"#000":ge;C([...o,{color:Te,hint:X}])},k=$=>{C(o.filter(H=>H!==$))},j=($,H,V)=>{H&&($.color=H),C(o,V)},L=$=>(a==null?void 0:a.stop)===$;return c.jsxs(I,{className:u,col:!0,children:[!!(a!=null&&a.stop)&&c.jsx("div",{className:Z("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:Z("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:Z("bg-checker h-8",te.rnd),children:c.jsx("div",{ref:l,className:Z("w-full h-full cursor-cross",te.b,te.rnd,z.br),style:{backgroundImage:ss({stops:o})},onClick:M})}),o.map(($,H)=>c.jsxs("div",{className:Z("absolute top-0 h-full"),style:{left:`${$.hint}%`},children:[c.jsx("div",{className:Z("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>k($),children:c.jsx(re,{icon:q.close,size:se.s3x})}),c.jsx("div",{onPointerDown:V=>A(V,$),className:Z("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",te.br,te.bl,L($)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:Z("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(My,{value:$.color,onChange:(V,U)=>j($,V,U),className:Z("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},H))]}),c.jsxs(I,{space:"s",items:"center",children:[c.jsx(B,{grow:!0,children:c.jsx(nl,{label:"Repeat",value:f,onChange:O})}),c.jsx(B,{grow:!0,children:c.jsx(nl,{label:"Radial",value:p,onChange:P})})]}),p?c.jsxs(I,{space:"s",col:!0,children:[c.jsx(B,{children:c.jsx(I,{space:"s",items:"center",children:c.jsx(B,{grow:!0,children:c.jsx(ke,{pan:"S",size:"s",value:v,onChange:E,valueUnit:"px",units:["px"]})})})}),c.jsx(B,{children:c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:c.jsx(ke,{pan:"X",size:"s",value:b,onChange:T,valueUnit:"%",units:["%"]})}),c.jsx(B,{grow:!0,children:c.jsx(ke,{pan:"Y",size:"s",value:w,onChange:_,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(I,{space:"s",items:"center",nowrap:!0,children:c.jsx(B,{grow:!0,children:c.jsx(ke,{pan:"A",size:"s",value:m,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}const j7="gs-sm-custom-type",D7=ce(function({property:t,editor:n}){const r=h.useRef(null),o=t.getType(),s=n.StyleManager,a=s.getType(o),i=a==null?void 0:a.view;return h.useEffect(()=>{const l=r.current;if(i&&l){const u=new i({model:t,config:s.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[i,t,n]),i&&c.jsx("div",{className:j7,ref:r})});function Uw(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const Ww="gs-cmp-style-field";function Gw({property:e,sector:t,styleManagerDataConfig:n,fieldProps:r}){const o=N(Ww,`${Ww}__${e.id}`),s={sector:t,styleManagerDataConfig:n},a=t.em.getEditor(),i=e.getType();switch(i){case"selectFont":return c.jsx(gu,{className:o,...eS(e,s),...r});case"number":case"slider":case"integer":return c.jsx(ke,{className:o,...lt(e,s),...r});case"color":return c.jsx(yo,{className:o,...qs(e,s),...r});case"select":return c.jsx(Le,{className:o,...Lt(e,s),...r});case"radio":return c.jsx(Rt,{className:o,...Rr(e,s),...r});case"file":return c.jsx(cl,{className:o,...lV(e,s),...r});case"composite":return c.jsx(En,{className:o,property:e,corners:e.get("corners"),generic:e.get("generic"),...s});case"stack":{const l=e.getProperties();return c.jsx(Xr,{className:o,...is(e,s),children:c.jsx(Jr,{properties:l,sector:t})})}default:{const l=a.StyleManager.getType(i);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(D7,{editor:a,property:e}):c.jsx(rt,{className:o,...Vh(e,s)})}}}const qw="gs-cmp-style-prop-row";function Jr({properties:e,sector:t,styleManagerDataConfig:n}){const r={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(o=>{const s=o.getId(),a=N(qw,`${qw}__${s}`,Uw(o)&&"gs-utl-col-span-full");return o.isVisible()?c.jsx("div",{className:a,children:c.jsx(Gw,{property:o,...r})},s):null})})}function F7({sector:e,styleManagerDataConfig:t}){const n=Li(),r=e.getProperties().filter(o=>o.isVisible()).map(o=>(n.sdkAddFonts&&o.getId()==="font-family"&&o.set("type","selectFont"),o));return c.jsx("div",{className:N("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(Jr,{properties:r,sector:e,styleManagerDataConfig:t})})}const B7="gs-cmp-sector-row";function be({className:e,children:t,bottom:n,separator:r,separatorTop:o,property:s,...a}){const i=c.jsx("div",{className:Z("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",te.bb,z.br)}),l=Z(B7,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(s)?s:[s]).filter(Boolean);return(u.length?u.some(p=>p.isVisible()):!0)?c.jsxs(c.Fragment,{children:[o&&i,c.jsx(I,{className:l,nowrap:!0,...a,children:t}),r&&i]}):null}function bl(e,t,n={}){const r=e.getType(),{compact:o=!1,sector:s,styleManagerDataConfig:a}=n,i=e.getParent(),l={sector:s,styleManagerDataConfig:a},u=e.getDefaultValue();if(r==="select"){const p={property:i.getName()};return c.jsx(Le,{...Lt(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 r==="color"?c.jsx(yo,{...qs(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(ke,{...lt(e,l),...o?{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 Ou="gs-cmp-style-prop-composite";function En({className:e,property:t,sector:n,styleManagerDataConfig:r,corners:o,compact:s,generic:a,children:i,options:l}){const[u,d]=h.useState(null);if(!(t!=null&&t.isVisible()))return null;const p={id:"custom",label:c.jsx(re,{icon:q.borderStyle,size:se.s}),title:"Custom"},f=[{id:"all",label:c.jsx(re,{icon:q.borderAllVariant,size:se.s}),title:"All"},p],g=t.isDetached(),m=t.getProperties(),v=m.length,[b,w,y,S]=m,C=b.getFullValue(),E=m.map(F=>F.getFullValue()).every(F=>F===C),T=u!==null?u:E||l?"all":p.id,_=l?[...l,p]:[],O=t.getFullValue(),P=_.some(F=>F.id===O),A=T===p.id||(l?!P:!1)||!!a,M={compact:s,sector:n,styleManagerDataConfig:r},k=c.jsx(os,{property:s?null:b,shallow:!g,children:bl(b,null,M)}),j=c.jsx(os,{property:s?null:w,shallow:!g,children:bl(w,null,M)}),L=!!y&&c.jsx(os,{property:s?null:y,shallow:!g,children:bl(y,null,M)}),D=!!S&&c.jsx(os,{property:s?null:S,shallow:!g,children:bl(S,null,M)}),W=s?{label:t.getLabel()}:{property:t};return c.jsxs(I,{className:Z(Ou,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(be,{className:`${Ou}__main`,children:c.jsx(os,{...W,children:!a&&c.jsx(be,{bottom:"0",children:i!==void 0?i:l?c.jsx(c.Fragment,{children:c.jsx(B,{grow:!0,children:c.jsx(Rt,{size:"s",options:_,value:A?p.id:O,onChange:F=>{F===p.id?d(F):(t.upValue(F),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(B,{grow:!0,children:bl(b,{same:E,all:m},M)}),c.jsx(B,{grow:!0,children:c.jsx(Rt,{size:"s",options:f,value:T,onChange:d})})]})})})}),A&&c.jsx(be,{col:!0,className:Z(`${Ou}__details`,"gjs-px-2 gjs-py-1",z.bgH2,te.rnd,te.b,z.br),children:a?c.jsx("div",{className:Z(`${Ou}__props`,"grid grid-cols-2 gap-2"),children:m.map(F=>c.jsx(os,{property:F,shallow:!g,className:Z(Uw(F)&&"col-span-full"),children:c.jsx(Gw,{property:F,...M,fieldProps:{label:void 0}})},F.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:k}),c.jsx(B,{grow:!0,children:j})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:k}),c.jsx(B,{grow:!0,children:j})]}),c.jsx(I,{space:"s",children:c.jsx(B,{grow:!0,children:L})})]}):o?c.jsxs(c.Fragment,{children:[c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:k}),c.jsx(B,{grow:!0,children:j})]}),c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:D}),c.jsx(B,{grow:!0,children:L})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:k}),c.jsxs(I,{space:"s",children:[c.jsx(B,{grow:!0,children:D}),c.jsx(B,{grow:!0,children:j})]}),c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:L})]})})]})}var as=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(as||{});const _u="background-image",Qr="__background-type",yl=_u,Kw="https://placehold.co/150/777/white.png?text=IMAGE",Nh="50px",z7={[Qr]:"image","background-image":`url("${Kw}")`,"background-size":`${Nh} ${Nh}`,"background-repeat":"repeat","background-position":"0px 0px"},U7=e=>(e.includes("gradient(")?Mh(e).colorStops[0].color:e)||"";function W7({sector:e,styleManagerDataConfig:t}){var C;const n=Fi(),r=e.getProperty("background"),o=r.getProperty(Qr),s=r.getProperty("background-image"),a=r.getProperty("background-position"),i=r.getProperty("background-size"),l=e.getProperty("background-color"),u=e.getProperty("background-clip"),d={sector:e,styleManagerDataConfig:t},p=[r,l,u].map(x=>x==null?void 0:x.id),f=e.getProperties().filter(x=>!p.includes(`${x.id}`)),g=((C=r.getSelectedLayer())==null?void 0:C.getIndex())||-1,m=o==null?void 0:o.getValue(),v=m==="image",b=s.getValue(),w=()=>{const x=n.Assets;x.open({select(E){const T=E.getSrc();s.upValue(`url("${T}")`),x.close()}})},y=x=>{let E="none",T="100%";x==="image"?(E=`url("${Kw}")`,T=Nh):x==="gradient"?E="linear-gradient(90deg, black 10%, white 90%)":x==="color"&&(E="rgba(0, 0, 0, 0.5)"),s.upValue(E),o.upValue(x),a.upValue("0 0"),i.upValue(`${T} ${T}`)},S=aV(o,[{id:"image",label:c.jsx(re,{icon:q.image,size:se.s})},{id:"gradient",label:c.jsx(re,{icon:q.gradientVertical,size:se.s})},{id:"color",label:c.jsx(re,{icon:q.checkboxBlank,size:se.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(be,{property:r,separator:!0,children:c.jsxs(Xr,{...is(r,d,z7),previewStyle:x=>r.getStyleFromLayer(x,{camelCase:!0}),children:[c.jsx(be,{children:c.jsx(Rt,{...Rr(o,d),options:S,onChange:y,label:void 0})}),c.jsx(be,{children:c.jsxs(os,{children:[v&&c.jsx(cl,{value:Pu(b).value,onOpen:w}),m==="color"&&c.jsx(yo,{...qs(s,d),value:U7(b),label:void 0}),m==="gradient"&&c.jsx(H7,{value:b,onChange:(x,E)=>s.upValue(x,{partial:E})},g)]})}),v&&c.jsxs(c.Fragment,{children:[c.jsx(be,{col:!0,children:c.jsx(En,{property:a,...d})}),c.jsx(be,{col:!0,children:c.jsx(En,{property:i,...d})}),c.jsxs(be,{children:[c.jsx(Le,{...Lt(r.getProperty("background-repeat"),{sector:e})}),c.jsx(Le,{...Lt(r.getProperty("background-attachment"),{sector:e})})]}),c.jsx(be,{children:c.jsx(Le,{...Lt(r.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(be,{property:l,children:c.jsx(yo,{...qs(l,d)})}),c.jsx(be,{property:u,children:c.jsx(Le,{...Lt(u,d)})}),f.length>0&&c.jsx(Jr,{properties:f,...d})]})}function G7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),r=e.getProperty("border-width"),o=e.getProperty("border-style"),s=e.getProperty("border-color"),a={sector:e,styleManagerDataConfig:t},i=[n,r,o,s].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!i.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(En,{property:n,corners:!0,...a}),c.jsx(En,{property:r,...a}),c.jsx(En,{property:o,...a}),c.jsx(En,{property:s,...a}),l.length>0&&c.jsx(Jr,{properties:l,...a})]})}const Gs=e=>su({value:parseFloat(e),min:-3,max:3}),kh=(e,t="filter",n)=>{const r=e.getProperty(`${t}-value`),o=e.getProperty(`${t}-name`).getOption()||{},s=o.units||[],a=r.getUnit(),i=_6(a,s)?a:s[0];return{...lt(r,n),units:s,valueUnit:i,onChange:(l,u)=>{r.upValue(l,{partial:u,units:s,min:o.min,max:o.max})}}},Zw=(e,t,n,r)=>{const o=e.getProperty(`${t}-name`),s=e.getProperty(`${t}-value`);return{...Lt(o,n,r),onChange:a=>{o.upValue(a),s.upValue("")}}},q7={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function K7({sector:e,styleManagerDataConfig:t}){const n=Ie(),r=_=>n.t(`styleManager.effects.${_}`),o=e.getProperty("box-shadow"),s=e.getProperty("text-shadow"),a=e.getProperty("filter"),i=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"),w=e.getProperty("transform-origin"),y=e.getProperty("overflow"),S={sector:e,styleManagerDataConfig:t},C=[o,s,a,i,l,u,d,p,f,g,m,v,b,w,y].map(_=>_==null?void 0:_.id),x=e.getProperties().filter(_=>!C.includes(`${_.id}`)),E=_=>{const{boxShadowH:O,boxShadowV:P,boxShadowBlur:A,boxShadowColor:M,boxShadowSpread:k,boxShadowType:j}=_.getValues({camelCase:!0}),L=Gs(O),D=Gs(P),W=Gs(A),F=Gs(k),$=`${L}px ${D}px ${W}px ${F}px ${M} ${j}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(B,{grow:!0,children:[O," ",P," ",A," ",k]}),c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:$}})})]})},T=_=>{const{textShadowH:O,textShadowV:P,textShadowBlur:A,textShadowColor:M}=_.getValues({camelCase:!0}),k=Gs(O),j=Gs(P),L=Gs(A),D=`${k}px ${j}px ${L}px ${M}`.trim();return c.jsxs(I,{space:"s",items:"center",children:[c.jsxs(B,{grow:!0,children:[O," ",P," ",A]}),c.jsx(B,{children:c.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:D}})})]})};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:[m,v],children:[c.jsx(ke,{...lt(m,S)}),c.jsx(Le,{...Lt(v,S)})]}),c.jsx(be,{property:b,separator:!0,children:c.jsx(Le,{...Lt(b,S)})}),c.jsx(be,{property:o,separator:!0,children:c.jsxs(Xr,{...is(o,S),renderItem:E,children:[c.jsx(be,{children:c.jsx(Rt,{...Rr(o.getProperty("box-shadow-type"),S),label:""})}),c.jsxs(be,{children:[c.jsx(ke,{...lt(o.getProperty("box-shadow-h"),S),label:r("boxShadow.xOffset")}),c.jsx(ke,{...lt(o.getProperty("box-shadow-v"),S),label:r("boxShadow.yOffset")})]}),c.jsxs(be,{children:[c.jsx(ke,{...lt(o.getProperty("box-shadow-blur"),S),label:r("boxShadow.blur")}),c.jsx(ke,{...lt(o.getProperty("box-shadow-spread"),S),label:r("boxShadow.spread")})]}),c.jsx(be,{children:c.jsx(yo,{...qs(o.getProperty("box-shadow-color"),S),label:r("boxShadow.color")})})]})}),c.jsx(be,{property:s,separator:!0,children:c.jsxs(Xr,{...is(s,S,q7),renderItem:T,children:[c.jsxs(be,{children:[c.jsx(ke,{...lt(s.getProperty("text-shadow-h"),S),label:r("textShadow.xOffset")}),c.jsx(ke,{...lt(s.getProperty("text-shadow-v"),S),label:r("textShadow.yOffset")})]}),c.jsx(be,{children:c.jsx(ke,{...lt(s.getProperty("text-shadow-blur"),S),label:r("textShadow.blur")})}),c.jsx(be,{children:c.jsx(yo,{...qs(s.getProperty("text-shadow-color"),S),label:r("textShadow.color")})})]})}),c.jsx(be,{property:a,separator:!0,children:c.jsx(Xr,{...is(a,S,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(Le,{...Zw(a,"filter",S),label:r("filter.type")}),c.jsx(ke,{...kh(a,void 0,S),label:r("filter.value")})]})})}),c.jsx(be,{property:i,separator:!0,children:c.jsx(Xr,{...is(i,S,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(Le,{...Lt(i.getProperty("backdrop-filter-name"),S),label:r("backdropFilter.type")}),c.jsx(ke,{...kh(i,"backdrop-filter",S),label:r("backdropFilter.value")})]})})}),c.jsx(be,{property:l,separator:!0,children:c.jsxs(Xr,{...is(l,S),children:[c.jsx(be,{children:c.jsx(Le,{...Lt(l.getProperty("transition-property"),S),label:r("transition.type")})}),c.jsx(be,{children:c.jsx(Le,{...Lt(l.getProperty("transition-timing-function"),S),label:r("transition.easing")})}),c.jsxs(be,{children:[c.jsx(ke,{...lt(l.getProperty("transition-duration"),S),label:r("transition.duration")}),c.jsx(ke,{...lt(l.getProperty("transition-delay"),S),label:r("transition.delay")})]})]})}),c.jsx(be,{property:u,separator:!0,children:c.jsx(Xr,{...is(u,S),children:c.jsxs(be,{children:[c.jsx(Le,{...Zw(u,"transform",S),label:r("transform.type")}),c.jsx(ke,{...kh(u,"transform",S),label:r("transform.value")})]})})}),c.jsx(En,{property:w,...S}),c.jsx(En,{property:y,...S}),c.jsx(be,{property:p,children:c.jsx(Rt,{...Rr(p,S)})}),c.jsx(be,{property:[f,g,d],separatorTop:!0,children:r("childrenTransform")}),c.jsxs(be,{property:[f,g],children:[c.jsx(ke,{...lt(f,S)}),c.jsx(Rt,{...Rr(g,S)})]}),c.jsx(En,{property:d,...S}),x.length>0&&c.jsx(Jr,{properties:x,...S})]})}function Z7(e,t){return e.indexOf(t)>=0}const bt=se.s,Au="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",Lu="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",Mu="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",Yw="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",Xw="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",Y7="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",$h="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function X7({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),r=Ie(),[o,s]=h.useState({}),[a,i]=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"),w=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},S=[l,u,d,p,f,g,m,v,b,w].map(F=>F.id),C=e.getProperties().filter(F=>!S.includes(`${F.id}`)),x=F=>r.t(`styleManager.layout.${F}`),E=l.getValue(),T=E==="flex",_=(a.display||"").indexOf("flex")>=0,O=u.getValue(),P=O.indexOf("reverse")>=0,A=!Z7(["column","column-reverse"],O),M=[{id:"row",label:c.jsx(re,{icon:q.arrowRight,size:se.sx}),title:x("direction.title.row")},{id:"row-reverse",label:c.jsx(re,{icon:q.arrowRight,size:bt,horizontal:!0}),title:x("direction.title.row-reverse")},{id:"column",label:c.jsx(re,{icon:q.arrowDown,size:se.sx}),title:x("direction.title.column")},{id:"column-reverse",label:c.jsx(re,{icon:q.arrowDown,size:bt,vertical:!0}),title:x("direction.title.column-reverse")}],k=[{id:"flex-start",title:x("justify.title.start"),label:c.jsx(re,{icon:Au,size:bt,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:x("justify.title.center"),label:c.jsx(re,{icon:Lu,size:bt,rotate:A?0:90})},{id:"flex-end",title:x("justify.title.end"),label:c.jsx(re,{icon:Mu,size:bt,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:x("justify.title.spaceBetween"),label:c.jsx(re,{icon:Yw,size:bt,rotate:A?0:90})},{id:"space-around",title:x("justify.title.spaceAround"),label:c.jsx(re,{icon:Xw,size:bt,rotate:A?0:90})},{id:"space-evenly",title:x("justify.title.spaceEvenly"),label:c.jsx(re,{icon:Y7,size:bt,rotate:A?0:90})}],j=[{id:"stretch",title:x("align.title.stretch"),label:c.jsx(re,{icon:$h,size:bt,rotate:A?0:90})},{id:"flex-start",title:x("align.title.start"),label:c.jsx(re,{icon:Au,size:bt,rotate:A?90:0})},{id:"center",title:x("align.title.center"),label:c.jsx(re,{icon:Lu,size:bt,rotate:A?90:0})},{id:"flex-end",title:x("align.title.end"),label:c.jsx(re,{icon:Mu,size:bt,rotate:A?90:0})}],L=[{id:"flex-start",title:x("alignContent.title.start"),label:c.jsx(re,{icon:Au,size:bt,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:x("alignContent.title.center"),label:c.jsx(re,{icon:Lu,size:bt,rotate:A?90:0})},{id:"flex-end",title:x("alignContent.title.end"),label:c.jsx(re,{icon:Mu,size:bt,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:x("alignContent.title.spaceBetween"),label:c.jsx(re,{icon:Yw,size:bt,rotate:A?90:0})},{id:"space-around",title:x("alignContent.title.spaceAround"),label:c.jsx(re,{icon:Xw,size:bt,rotate:A?90:0})},{id:"stretch",title:x("alignContent.title.stretch"),label:c.jsx(re,{icon:$h,size:bt,rotate:A?0:90})}],D=[{id:"auto",title:x("alignSelf.title.auto"),label:c.jsx(re,{icon:q.close,size:bt})},{id:"flex-start",title:x("alignSelf.title.start"),label:c.jsx(re,{icon:Au,size:bt,rotate:90})},{id:"center",title:x("alignSelf.title.center"),label:c.jsx(re,{icon:Lu,size:bt,rotate:90})},{id:"flex-end",title:x("alignSelf.title.end"),label:c.jsx(re,{icon:Mu,size:bt,rotate:90})},{id:"stretch",title:x("alignSelf.title.stretch"),label:c.jsx(re,{icon:$h,size:bt,rotate:0})}],W=[{id:"0 0 auto",label:c.jsx(re,{icon:q.close,size:bt}),title:x("flex.title.auto")},{id:"1 1 0%",label:c.jsx(re,{icon:q.unfoldMoreHorizontal,size:bt,rotate:90}),title:x("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(re,{icon:q.unfoldLessHorizontal,size:bt,rotate:90}),title:x("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:F}=n,$=()=>{const V=n.getSelected();let U={},J={};if(V){const Y=V.getEl();if(Y){U=window.getComputedStyle(Y);const X=Y.parentElement;X&&(J=window.getComputedStyle(X))}}s(U),i(J)},H=F.events.target;return n.on(H,$),$(),()=>n.off(H,$)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Le,{...Lt(l,y),...Ih,tip:x(`display.tips.${E}`)})}),T&&c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Rt,{...Rr(u,y),options:M})}),c.jsx(be,{children:c.jsx(Rt,{...Rr(d,y),options:k})}),c.jsx(be,{children:c.jsx(Rt,{...Rr(p,y),options:j})}),c.jsx(be,{children:c.jsx(En,{property:b,...y})}),c.jsx(be,{children:c.jsx(Le,{...Lt(f,y),...Ih})}),f.getValue()!=="nowrap"&&c.jsx(be,{children:c.jsx(Rt,{...Rr(g,y),options:L})})]}),_&&c.jsxs(c.Fragment,{children:[c.jsx(be,{separatorTop:!0,children:x("flexChild")}),c.jsx(be,{children:c.jsx(En,{property:w,options:W,...y})}),c.jsx(be,{children:c.jsx(Rt,{...Rr(m,y),options:D})}),c.jsx(be,{children:c.jsx(ke,{...lt(v,{sector:e,styleManagerDataConfig:t})})})]}),C.length>0&&c.jsx(Jr,{properties:C,...y})]})}const J7=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function Q7({sector:e,styleManagerDataConfig:t}){var w;const n=Ie(),r=e.getProperty("position"),o=r.getValue(),s=e.getProperty("top"),a=e.getProperty("right"),i=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=[r,s,a,i,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!f.includes(`${y.id}`)),m=J7.map(y=>({id:y,label:p(`presets.options.${y}`)})),v=["absolute","fixed"].includes(o),b=y=>{let S="auto",C="auto",x="auto",E="auto";switch(y){case"topLeft":S="0%",E="0%";break;case"topRight":S="0%",C="0%";break;case"bottomLeft":x="0%",E="0%";break;case"bottomRight":x="0%",C="0%";break;case"left":S="0%",x="0%",E="0%";break;case"right":S="0%",x="0%",C="0%";break;case"bottom":E="0%",x="0%",C="0%";break;case"top":E="0%",S="0%",C="0%";break;case"full":E="0%",S="0%",C="0%",x="0%";break}s.upValue(S),a.upValue(C),i.upValue(x),l.upValue(E)};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:r,children:[c.jsx(Le,{...Lt(r,d),tip:p(`tips.${(w=r.getOption())==null?void 0:w.id}`),...Ih}),v&&c.jsx(B,{children:c.jsx(Ut,{title:p("presets.title"),children:c.jsx(Le,{options:m,onChange:b,emptyState:"P",size:"s",caret:"",value:!0})})})]}),o!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(be,{col:!0,children:[c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(ke,{...lt(s,d)})}),c.jsxs(I,{gap:"s",children:[c.jsx(B,{grow:!0,children:c.jsx(ke,{...lt(l,d)})}),c.jsx(B,{grow:!0,children:c.jsx(ke,{...lt(a,d)})})]}),c.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(ke,{...lt(i,d)})})]}),c.jsx(be,{children:c.jsx(ke,{...lt(u,d)})})]}),g.length>0&&c.jsx(Jr,{properties:g,...d})]})}function R7({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),r=e.getProperty("min-width"),o=e.getProperty("max-width"),s=e.getProperty("height"),a=e.getProperty("min-height"),i=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,r,o,s,a,i].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(be,{property:[n,s],children:[c.jsx(ke,{...lt(n,l)}),c.jsx(ke,{...lt(s,l)})]}),c.jsxs(be,{property:[r,a],children:[c.jsx(ke,{...lt(r,l)}),c.jsx(ke,{...lt(a,l)})]}),c.jsxs(be,{property:[o,i],children:[c.jsx(ke,{...lt(o,l)}),c.jsx(ke,{...lt(i,l)})]}),d.length>0&&c.jsx(Jr,{properties:d,...l})]})}function eV({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),r=e.getProperty("margin"),o={sector:e,styleManagerDataConfig:t},s=[n,r].map(i=>i==null?void 0:i.id),a=e.getProperties().filter(i=>!s.includes(`${i.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(En,{property:n,...o}),c.jsx(En,{property:r,...o}),a.length>0&&c.jsx(Jr,{properties:a,...o})]})}function tV({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),r=e.getProperty("color"),o=e.getProperty("font-size"),s=e.getProperty("font-weight"),a=e.getProperty("line-height"),i=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,r,o,s,a,i,l,u,d,p,f,g].map(y=>y==null?void 0:y.id),b=e.getProperties().filter(y=>!v.includes(`${y.id}`)),{sdkAddFonts:w}=Li();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(be,{property:n,children:w?c.jsx(gu,{...eS(n,m)}):c.jsx(Le,{...Lt(n,m)})}),!!r&&c.jsx(be,{property:r,children:c.jsx(yo,{...qs(r,m)})}),c.jsxs(be,{property:[o,s],children:[!!o&&c.jsx(ke,{...lt(o,m)}),!!s&&c.jsx(Le,{...Lt(s,m)})]}),c.jsxs(be,{property:[a,i],children:[!!a&&c.jsx(ke,{...lt(a,m)}),!!i&&c.jsx(ke,{...lt(i,m)})]}),c.jsxs(be,{property:[l,u],children:[!!l&&c.jsx(Le,{...Lt(l,m)}),!!u&&c.jsx(Le,{...Lt(u,m)})]}),c.jsxs(be,{property:[p,f],children:[!!p&&c.jsx(Le,{...Lt(p,m)}),!!f&&c.jsx(Le,{...Lt(f,m)})]}),c.jsxs(be,{property:[g,d],children:[!!g&&c.jsx(Le,{...Lt(g,m)}),!!d&&c.jsx(Le,{...Lt(d,m)})]}),b.length>0&&c.jsx(Jr,{properties:b,...m})]})}const Ih={row:!0,classNameLabel:"gs-utl-w-full"},nV=({property:e,skipClear:t,label:n,afterLabelButtons:r=[]})=>c.jsxs(I,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(B,{grow:!1,children:c.jsx(os,{property:e,skipClear:t,label:n})}),!!r.length&&c.jsx(I,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:r.map((o,s)=>c.jsx(Ct,{...o},s))})]}),Jw="gs-style-manager",Nu=`${Jw}-sector`,rV=`${Nu}-header`,oV=`${Nu}-content`,Qw=(e,t=0,n=!0)=>N(rV,z.bgH2,Pe.xyS,z.br,t&&te.bt,(e||n)&&te.bb),sV=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),aV=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),wl=(e,t)=>{const n=iV(e,t),r=Hw(n),{hasDataResolverValue:o}=n,{label:s}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:o,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:r.length?"span":void 0,label:c.jsx(nV,{property:e,skipClear:o,label:s,afterLabelButtons:r})}}},Vh=(e,t)=>{const{connectDataSources:n,commonProps:r}=wl(e,t);return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,s)=>e.upValue(o,{partial:s})}},Rw=(e,t,n)=>{const{connectDataSources:r,commonProps:o}=wl(e,t),{hasDataResolverValue:s,initialDataValue:a}=r;return{fieldProps:{...o,value:s?a:e.getValue(),options:sV(e,n??{}),onChange:i=>e.upValue(i)},connectDataSources:r}},Rr=(e,t,n)=>Rw(e,t,n).fieldProps,Lt=(e,t,n)=>{const{fieldProps:r,connectDataSources:o}=Rw(e,t,n),{hasDataResolverValue:s}=o,a=s?e.getValue()||" ":r.emptyState;return{...r,emptyState:a,hideCaret:s}},eS=(e,t)=>{const{commonProps:n,connectDataSources:r}=wl(e,t),o=r.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:o,hideCaret:r.hasDataResolverValue,value:r.dataResolverValue??e.getValue(),onChange:s=>e.upValue(s)}},is=(e,t,n={})=>{const{connectDataSources:r,commonProps:o}=wl(e,t),{hasDataResolverValue:s,dataResolverValue:a}=r;return{...o,title:e.getLabel(),emptyState:s?a:void 0,titleAdd:`Add new ${e.getLabel()}`,items:s?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:i=>e.getLayerLabel(i),add:s?void 0:()=>e.addLayer(n,{at:0}),select:i=>e.selectLayer(i),remove:i=>e.removeLayer(i),move:(i,l=0)=>e.moveLayer(i,l)}},lt=(e,t)=>{const{connectDataSources:n,commonProps:r}=wl(e,t),{hasDataResolverValue:o}=n;return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(s,a)=>e.upValue(s,{partial:a}),valueUnit:e.getUnit(),pan:!o,units:o?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:s=>e.upUnit(s)}};function iV(e,t){const{styleManagerDataConfig:n=!1,sector:r}=t,o=e.em.getEditor(),{Styles:s}=o,a=o.getSelected(),i=s.getSelectedAll(),l=s.getSelected();let u=!1;n===!0?u=!0:a&&to(n)&&et(n.enable)&&(u=n.enable({property:e,sector:r,component:a,editor:o}));const d=e.getName(),p=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",f=ts(p),g=a==null?void 0:a.collectionsStateMap;return{hasDataResolverValue:f,dataResolverValue:f?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:p,handleDataValueChange:m=>{i.forEach(v=>{v.addStyle({[d]:m})})},handleValueClear:()=>{i.forEach(m=>{const v=m.getStyle()[d]??"";m.addStyle({[d]:v})})},editor:o,additionalSources:g}}const qs=(e,t)=>Vh(e,t),lV=(e,t)=>{const{label:n,...r}=Vh(e,t);return{...r,label:n,isContain:e.get("contain")??!0,hideButton:r.disabled,inputField:e.get("inputField"),onOpen(){const o=e.em.Assets;o.open({select(s){e.upValue(s.getSrc()),o.close()}})}}},cV=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let r=F7;switch(n){case"gs-layout":r=X7;break;case"gs-size":r=R7;break;case"gs-space":r=eV;break;case"gs-position":r=Q7;break;case"gs-borders":r=G7;break;case"gs-effects":r=K7;break;case"gs-typography":r=tV;break;case"gs-background":r=W7;break}return c.jsx(r,{sector:e,styleManagerDataConfig:t})},Hh={},tS=ce(function({className:t,sectors:n}){var f;const[r,o]=h.useState(Hh),s=we(),{editor:a}=s,i=a==null?void 0:a.Styles,l=i==null?void 0:i.getSelected(),u=a==null?void 0:a.getSelected();if(h.useEffect(()=>{if(u&&a){const g=setTimeout(()=>{let m=Hh;const v=u.get("styleManager");et(v)&&(m=v({editor:a,component:u})),o(m||Hh)});return()=>clearTimeout(g)}},[u,a]),!i||!l)return null;const d=n.length?n:i.getSectors({visible:!0}),p=(f=s.sdkOptions.dataSources)==null?void 0:f.styleManager;return r.disabled?null:c.jsx("div",{className:N(Jw,t,"gs-utl-select-none"),children:d.map((g,m)=>c.jsx(bo,{open:g.isOpen(),onChange:({open:v})=>g.setOpen(v),classNameWrap:N(Nu,`${Nu}__${g.id}`),sticky:!0,handler:()=>{const v=g.getProperties({withValue:!0}).length>0,b=g.getProperties({withParentValue:!0}).length>0;return c.jsxs(I,{gap:"xs",items:"center",children:[c.jsx(B,{className:"gs-utl-mr-2",children:g.getName()}),v&&c.jsx(B,{children:c.jsx("div",{className:N(Oe.dot,z.bgA2)})}),b&&c.jsx(B,{children:c.jsx("div",{className:N(Oe.dot,z.bgW)})})]})},className:v=>Qw(v,m,m===d.length-1),children:c.jsx(I,{className:N(oV,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:cV(g,{styleManagerDataConfig:p})})},g.id))})}),uV=qt(function({children:t,className:n,content:r,...o},s){return c.jsx("div",{className:N(ae("gs-design-manager-tab"),n),ref:s,...o,children:t})}),nS="gs-cmp-sidebar-right",rS="gs-cmp-traits-provider",jh=N("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function dV(){var y,S,C;const{isCssPanelActive:e,selectedDesignerTab:t,showSelectors:n,setSelectedDesignerTab:r,sdkProps:o,sdkOptions:s,isProjectTypeEmail:a}=we(),i=Ie(),l=N(e&&"gs-utl-hidden"),d=(((y=Qn(o.children,uV))==null?void 0:y.filter(Boolean))||[]).map(({props:x},E)=>({id:x.id,label:x.label,content:c.jsx(Bi,{children:x.children}),order:x.order??2+E+1})),p=(S=s.designPanel)==null?void 0:S.propsInStyles,f=(C=s.designPanel)==null?void 0:C.hideTabs,g=p===!0||a&&p!==!1,m=f===!0||a&&f!==!1,v=i.t("traitManager.panelLabel"),w=[{id:"style",label:i.t("styleManager.panelLabel"),order:1,content:c.jsxs(I,{col:!0,full:!0,children:[!!n&&c.jsx(B,{className:N("gs-cmp-selectors-provider",Pe.s,te.bb,z.br),children:c.jsx(_b,{children:x=>c.jsx(zw,{...x})})}),g&&c.jsx(B,{className:N(rS,jh),children:c.jsx(bo,{handler:v,className:Qw(!1),sticky:!0,open:!0,children:c.jsx(lf,{children:x=>c.jsx(Oh,{...x,className:N("gs-utl-p-2",z.br,te.bb)})})})}),c.jsx(B,{className:N("gs-cmp-styles-provider",jh),grow:!0,children:c.jsx(Ab,{children:x=>c.jsxs(c.Fragment,{children:[e&&c.jsx(Lb,{}),c.jsx(tS,{className:l,...x})]})})})]})},!g&&{id:"props",label:v,order:2,content:c.jsx(I,{className:rS,col:!0,full:!0,children:c.jsx(B,{className:N(Pe.s,jh),children:c.jsx(lf,{children:x=>c.jsx(Oh,{...x})})})})},...d].filter(Boolean).sort((x,E)=>x.order-E.order);return c.jsx(I,{className:nS,col:!0,full:!0,nowrap:!0,children:c.jsx(Yo,{value:t,onChange:r,tabs:w,className:N(`${nS}__tabs`,m&&"gs-utl-hidden")})})}const oS=ce(dV),pV="gs-panel-sidebar-tabs",fV=h.memo(ce(function({className:t,...n}){return c.jsx(Er,{className:N(pV,"gs-utl-h-full",t),...n,children:c.jsx(oS,{})})})),hV="gs-panel-styles",gV=h.memo(ce(function({className:t,...n}){const{isCssPanelActive:r}=we(),o=N(r&&" gs-utl-hidden");return c.jsx(Er,{className:N(hV,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-auto"),...n,children:c.jsx(Ab,{children:s=>c.jsxs(c.Fragment,{children:[r&&c.jsx(Lb,{}),c.jsx(tS,{className:o,...s})]})})})})),mV="gs-panel-templates",vV=h.memo(ce(function({className:t,templates:n,content:r,onSelect:o,...s}){const a=xv(),{projectTypeFilter:i}=a;let l=n??a.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),h.useEffect(()=>{n||a.loadTemplates()},[n]),c.jsx(Er,{className:N(mV,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(I,{className:ae("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(I,{className:ae("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(j0,{templates:l,projectType:xt[i],content:r,onSelect:o,skipProjectNamePopover:!0})})})})})),bV="gs-cmp-row",yV=h.memo(function({className:t,children:n,full:r,...o}){return c.jsx(xn,{className:N(bV,z.bg,"gs-utl-flex",r&&"gs-utl-w-full",t),...o,children:kt(n)})}),wV="gs-cmp-select-field",SV=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,options:a,size:i,onChange:l,required:u,disabled:d,emptyState:p,editorEvents:f}){const{editor:g}=we(),[m,v]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:r,name:o,value:s,options:a,size:i,emptyState:p})),b=w=>{l({value:w,editor:g,state:m,setState:y=>v(S=>({...S,...y}))})};return ls({editor:g,editorEvents:f,localState:m,setLocalState:v}),c.jsx(Le,{classNameContainer:N(wV,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})})),CV="gs-cmp-select-field",xV=h.memo(ce(function({className:t,style:n,label:r,name:o,value:s,size:a,onChange:i,required:l,disabled:u,emptyState:d,editorEvents:p}){const{editor:f}=we(),[g,m]=h.useState(()=>({required:l,disabled:u,style:n,className:t,label:r,name:o,value:s,size:a,emptyState:d})),v=b=>{i({value:b,editor:f,state:g,setState:w=>m(y=>({...y,...w}))})};return ls({editor:f,editorEvents:p,localState:g,setLocalState:m}),c.jsx(gu,{classNameContainer:N(CV,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})})),EV="gs-sidebar-bottom",TV=h.memo(ce(function({children:t,className:n,style:r,height:o,...s}){const{isInPreview:a,isBottomSidebarOpen:i}=we(),l=o??35,u=h.useMemo(()=>({height:l,marginBottom:a||!i?`-${l}px`:0,...r}),[a,i,r]);return c.jsx(xn,{className:N(EV,"gs-utl-flex gs-utl-transition-spacing",te.bt,z.br,n),style:u,...s,children:t?kt(t):void 0})})),PV=ce(function(t){var S;const{leftSidebarSize:n,setLeftSidebarSize:r,editor:o,isInPreview:s,isLeftSidebarOpen:a,sdkProps:i,showPages:l}=we(),u=i.children,d=((S=t.style)==null?void 0:S.width)??t.width,p=d??n,f=t.resizable===!1,g=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.br,z.br),m=N("gs-utl-w-full",te.bb,z.br),v=N("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),b=h.useMemo(()=>({marginLeft:s||!a?`-${p}px`:0,...t.style}),[p,s,a,t.style]),w=()=>o==null?void 0:o.refresh(),y=(C,x,E)=>{r(E.getBoundingClientRect().width)};return c.jsx(fu,{className:g,enable:f?!1:void 0,right:!f,style:b,height:"100%",width:p,minWidth:d??200,maxWidth:d??400,onResize:w,onResizeStop:y,children:t.children??c.jsxs(I,{full:!0,col:!0,children:[l&&c.jsx(B,{className:m,children:c.jsx(Ob,{children:C=>c.jsxs(c.Fragment,{children:[Qn(u,_w),c.jsx(Pw,{...C}),Qn(u,Ow)]})})}),c.jsx(B,{className:v,grow:!0,children:c.jsx(Pb,{children:C=>c.jsxs(c.Fragment,{children:[Qn(u,Uy),c.jsx(By,{...C}),Qn(u,zy)]})})})]})})}),OV="gs-sidebar-left",_V=h.memo(ce(function({children:t,width:n,resizable:r,...o}){return c.jsx(PV,{className:N(OV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Ic(o)),width:n,resizable:r,style:Vc(o),children:t?kt(t):void 0})})),AV=ce(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:r,editor:o,isInPreview:s,isRightSidebarOpen:a}=we(),i=((m=t.style)==null?void 0:m.width)??t.width,l=i??n,u=t.resizable===!1,d=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.bl,z.br),p=h.useMemo(()=>({marginRight:s||!a?`-${l}px`:0,...t.style}),[l,s,a,t.style]),f=()=>o==null?void 0:o.refresh(),g=(v,b,w)=>{r(w.getBoundingClientRect().width)};return c.jsx(fu,{className:d,enable:u?!1:void 0,left:!u,style:p,height:"100%",width:l,minWidth:i??200,maxWidth:i??400,onResize:f,onResizeStop:g,children:t.children??c.jsx(oS,{})})}),LV="gs-sidebar-right",MV=h.memo(ce(function({children:t,resizable:n,...r}){return c.jsx(AV,{className:N(LV,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",Ic(r)),resizable:n,style:Vc(r),children:t?kt(t):void 0})})),NV=ce(function({className:t,variant:n,value:r,tabs:o,style:s,editorEvents:a,onChange:i}){const{editor:l}=we(),[u,d]=h.useState(()=>({tabs:o,style:s,value:r,variant:n,className:t})),p=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:kt(m.children)})))||[]},[u.tabs]),f=g=>{i&&l?i({value:g,editor:l,state:u,setState:m=>d(v=>({...v,...m}))}):d(m=>({...m,value:g}))};return ls({editor:l,editorEvents:a,localState:u,setLocalState:d}),c.jsx(Yo,{tabs:p,className:N(u.className),variant:u.variant,value:u.value,style:u.style,onChange:f})}),kV="gs-cmp-text",$V=h.memo(function({className:t,content:n,children:r,...o}){return c.jsx(xn,{className:N(kV,t),...o,children:r||n})}),IV="gs-cmp-virtual-list",VV=ce(function({id:t,items:n,itemLayout:r,footerLayout:o,onRef:s,itemsPerRow:a=12,className:i,style:l,htmlAttrs:u}){const[d,p]=h.useState(0),{editor:f,transitionTime:g}=we(),m=Lf(a),v=a===1;h.useEffect(()=>{const S=setTimeout(()=>p(C=>++C),g);return()=>clearTimeout(S)},[g]);const b={id:t,...u},w=!!d&&!!f,y={data:n,style:l,className:N(IV,"gs-utl-h-full",i),itemContent:(S,C)=>c.jsx(h.Fragment,{children:r?kt(r({item:C,index:S,editor:f})):c.jsx("pre",{children:JSON.stringify(C,void 0,2)})},C.id??S),components:{Footer:o&&f?()=>kt(o({editor:f})):void 0}};return w&&(v?c.jsx(t$,{...b,...y,ref:s},t):c.jsx(eu,{...b,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:s},t))});var Dh=(e=>(e.icon="icon",e.text="text",e.row="row",e.column="column",e.button="button",e.buttonMenu="buttonMenu",e.buttonGroupField="buttonGroupField",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))(Dh||{});const HV={icon:re,row:yV,column:g6,text:$V,tabs:NV,button:kc,buttonMenu:bN,buttonGroupField:wN,colorPicker:f6,menuList:a8,inputField:o8,codeField:F$,selectField:SV,selectFontField:xV,devices:B0,panelPages:Aw,panelPageSettings:D9,panelLayers:Wy,panelPagesLayers:q9,panelBlocks:H8,panelGlobalStyles:Q8,panelSelectors:M7,panelStyles:gV,panelProperties:y7,panelSidebarTabs:fV,panelAssets:_8,panelTemplates:vV,sidebarRight:MV,sidebarLeft:_V,sidebarTop:z0,sidebarBottom:TV,canvas:$b,canvasSidebarTop:j$,virtualList:VV,dataPathField:Y6,panelDataVariablePicker:n8,panelDataConditionPicker:K6,panelDataCollectionPicker:$6,panelDataValuePicker:Q6},kt=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=c4();return t.filter(Boolean).map((r,o)=>{const{type:s,...a}=ct(r)?{type:Dh.text,content:r}:r||{},i=a.id||"",l=HV[s],u=n.layoutChildren.get(i),d=n.customLayoutComponents.get(s),p=i||o;if(u)return c.jsx(Fp,{id:i,...u},p);if(d){const f=d({id:i,...a});return kt([f])[0]}else{if(s===Dh.custom)return c.jsx(Fp,{id:i,...a},p);if(l)return c.jsx(l,{id:i,...a},p)}return null})},jV=ce(({components:e})=>(Cv().customLayoutComponents,kt(e))),ls=e=>{const{editorEvents:t,editor:n,localState:r,setLocalState:o}=e;h.useEffect(()=>{if(!t||!n)return;const s=Object.keys(t).reduce((i,l)=>(i[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:r,setState:p=>o(f=>({...f,...p}))})},i),{}),a=Object.keys(s);return a.forEach(i=>n.on(i,s[i])),()=>{a.forEach(i=>n.off(i,s[i]))}},[n,r])},DV=e=>e.Assets.getAll().reduce((r,o)=>{const s=o.getSrc(),a=s.match(/^data:([^;]+);/);if(a){const i=s.split(",")[1],l=V3(o.get("name"));r[s]={mime:a[1],name:l,base64:i}}return r},{}),FV=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sS=(e,t,n={})=>{let r=e;const o=n.pathPfx||"";for(const s in t)if(r.includes(s)){const a=t[s];r=r.replace(new RegExp(FV(s),"g"),`${o}${a.name}`),a.found=!0}return r},BV=(e,t,n)=>`${t||""}${e||""}${n||""}`,zV=(e,t)=>{const n=e?`<div ${Sc}>${e}</div>`:"",r=t?`<div ${Sc} data-gjs-global>${t}</div>`:"";return`${n}${r}`},UV=async(e,t={})=>{const{page:n,skipProject:r,assetsFolder:o="assets",filenameCss:s="style.css",styles:a,isMJML:i,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:p}=t,f={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),v=DV(e),b=`${o}/`,w=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=sS(w,v,{pathPfx:b}),S=a==="inline",C=a==="skip",x=a==="skipInPage",E=p==="skip",T=u?{}:Ca(e).globalPageSettings||{},_=[],O=(P,A)=>{var Wt,Co,Ks;const{pageSettingOpts:M}=A||{},k=P.getName(),j=S||(M==null?void 0:M.replaceDataSources),L=Fo(P,"title",M)||k,D=Fo(P,"favicon",M),W=Fo(P,"description",M),F=Fo(P,"keywords",M),$=Fo(P,"socialTitle",M),H=Fo(P,"socialDescription",M),V=Fo(P,"socialImage",M),U=u?"":tv(Fo(P,"fonts")),J=cn({page:P,key:"customCodeHead",opts:M})??"",Y=BV(J,T.customCodeHead,U),X=cn({page:P,key:"customCodeBody",opts:M})??"",Q=d?"":zV(X,T.customCodeBody),ee=P.getMainComponent(),G=E?"":e.getJs({component:ee}),R=G?`<script>${G}<\/script>`:"",le=[],ge=[],Te={asDocument:!1,...f},Ce=ee.toHTML(Te).replace("</body>",()=>`${Q}${R}</body>`),tt=ee.head;let Qe=L&&`<title>${L}</title>`,Ot=D&&`<link rel="icon" href="${D}"/>`,ut=W&&`<meta name="description" content="${W}"/>`,Se=F&&`<meta name="keywords" content="${F}"/>`,ot=$&&`<meta property="og:title" content="${$}"/>`,st=H&&`<meta property="og:description" content="${H}"/>`,wt=V&&`<meta property="og:image" content="${V}"/>`,Ne='<meta charset="utf-8">',mt='<meta name="viewport" content="width=device-width,initial-scale=1">',dt='<meta name="robots" content="index,follow">',Ue='<meta name="generator" content="GrapesJS Studio">';tt.components().forEach(Re=>{const St=Re.toHTML(f);ft.title({cmp:Re})?Qe=St:ft.favicon({cmp:Re})?Ot=St:ft.description({cmp:Re})?ut=St:ft.keywords({cmp:Re})?Se=St:ft.socialTitle({cmp:Re})?ot=St:ft.socialDescription({cmp:Re})?st=St:ft.socialImage({cmp:Re})?wt=St:ft.charset({cmp:Re})?Ne=St:ft.viewport({cmp:Re})?mt=St:ft.robots({cmp:Re})?dt=St:ft.generator({cmp:Re})&&(Ue=St)}),Qe&&le.push(Qe),Ne&&le.push(Ne),mt&&le.push(mt),dt&&le.push(dt),Ue&&le.push(Ue),ut&&le.push(ut),Se&&le.push(Se),ot&&le.push(ot),st&&le.push(st),wt&&le.push(wt),Ot&&le.push(Ot),ge.length&&le.push(...ge),Y&&le.push(Y),y&&!(C||x)&&le.push(j?`<style>${y}</style>`:`<link rel="stylesheet" href="./${s}">`);const he=ee.doctype||"<!DOCTYPE html>",De=(Co=(Wt=ee.docEl).__attrToString)==null?void 0:Co.call(Wt,f),Fe=(Ks=tt.__attrToString)==null?void 0:Ks.call(tt,f),He=e.getHtml(f).trim(),Mt=i?e.runCommand(_c,{mjml:He}).html:`${he}
335
335
  <html${De?` ${De}`:""}>
336
336
  <head${Fe?` ${Fe}`:""}>
337
337
  ${le.join(`
@@ -339,21 +339,21 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
339
339
  </head>
340
340
  ${Ce}
341
341
  </html>
342
- `;return{filename:If(e,P),content:sS(Mt,v,{pathPfx:b}),mimeType:"text/html"}};m.forEach(P=>{if(Cc(P)){const M=P.getMainComponent(),{dataSourceItem:$}=t,j=$?[$]:M.getDataSourceItems(),L=M.resolverCurrentItem;Object.entries(j).forEach(([D,W])=>{const F=W;M.setResolverCurrentItem(F.id??D);const k=O(P,{pageSettingOpts:{replaceDataSources:!0}}),{path:H,filename:V}=pv(P,{currentItem:F});k.path=H,k.filename=V,_.push(k)}),M.setResolverCurrentItem(L)}else _.push(O(P))}),g.push(..._),i&&m.forEach(P=>{g.push({filename:If(e,P,"mjml"),content:P.getMainComponent().toHTML(p),mimeType:"text/mjml"})});for(const P in v){const A=v[P];A.found&&g.push({path:o,filename:A.name,content:atob(A.base64),mimeType:A.mime})}return y&&!S&&!C&&g.push({filename:s,content:y,mimeType:"text/css"}),r||g.push({filename:"gjs-project.grapesjs",content:JSON.stringify(e.getProjectData()),mimeType:"application/json"}),g};function FV(e){const{Components:t,Blocks:n}=e,r=o=>{const{model:s,id:a}=o,i=s.getDefaults(),l=n.get(a),u=i.icon,d=l==null?void 0:l.get("media"),f='<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>',p=u&&u!==f&&!d?u:d||f;t.addType(a,{model:{defaults:{icon:p}}})};t.getTypes().forEach(r),e.on("component:type:add",r)}const BV=(e,t)=>{const{contextMenu:n}=t.appStore.store,{Canvas:r}=e;e.on(r.events.frameLoad,({window:o,el:s})=>{o.document.addEventListener("contextmenu",async i=>{if(!n.isEnabled||e.getEditing())return;i.preventDefault();const l=i.target,u=e.getModel().get("componentHovered")||e.Utils.helpers.getModel(l);if(u){const d=s.getBoundingClientRect(),f=r.getZoomDecimal();e.runCommand(re.contextMenuComponent,{component:u,event:i,x:i.clientX*f+d.left,y:i.clientY*f+d.top})}})})};function zV(e,t){var g;const{Components:n,I18n:r}=e,{appStore:o}=t,s=r.t("dataSources.collection"),a=Bt.collection,i=Bt.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,f=m=>{const v=m.is(a)?m:m.closestType(a);if(!v)return;const b="dataCollectionPicker",w={id:b,header:!1,layout:{type:"panelDataCollectionPicker",component:v,onConfirm:()=>e.runCommand(re.layoutRemove,{id:b})},placer:{type:"dialog",title:r.t("dataSources.editCollection"),size:"l"}};e.runCommand(re.layoutToggle,{...w})},p=({items:m,component:v})=>[{id:`open-${a}-picker`,label:zp,command:()=>f(v)},...m];n.addType(i,{isComponent:m=>wa(m,i),model:{defaults:{...Gp(o),name:r.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:p}}}),n.addType(a,{isComponent:m=>Ti(m,l)||wa(m,a),block:d&&{label:s,media:u,content:{type:a,components:{type:i},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...Up},model:{defaults:{...Wp(o),icon:u,name:s,attributes:{[l]:!0},toolbarItems:p},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(),f(this.model)}}})}function UV(e,t){var w;const{Components:n,I18n:r}=e,o=r.t("dataSources.condition"),s=r.t("dataSources.conditionTrue"),a=r.t("dataSources.conditionFalse"),i=r.t("dataSources.conditionElse"),{appStore:l}=t,u=(w=l.sdkOptions.dataSources)==null?void 0:w.blocks,d=Bt.condition,f=Bt.conditionTrue,p=Bt.conditionFalse,g="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
342
+ `;return{filename:Ip(e,P),content:sS(Mt,v,{pathPfx:b}),mimeType:"text/html"}};m.forEach(P=>{if(xc(P)){const M=P.getMainComponent(),{dataSourceItem:k}=t,j=k?[k]:M.getDataSourceItems(),L=M.resolverCurrentItem;Object.entries(j).forEach(([D,W])=>{const F=W;M.setResolverCurrentItem(F.id??D);const $=O(P,{pageSettingOpts:{replaceDataSources:!0}}),{path:H,filename:V}=fv(P,{currentItem:F});$.path=H,$.filename=V,_.push($)}),M.setResolverCurrentItem(L)}else _.push(O(P))}),g.push(..._),i&&m.forEach(P=>{g.push({filename:Ip(e,P,"mjml"),content:P.getMainComponent().toHTML(f),mimeType:"text/mjml"})});for(const P in v){const A=v[P];A.found&&g.push({path:o,filename:A.name,content:atob(A.base64),mimeType:A.mime})}return y&&!S&&!C&&g.push({filename:s,content:y,mimeType:"text/css"}),r||g.push({filename:"gjs-project.grapesjs",content:JSON.stringify(e.getProjectData()),mimeType:"application/json"}),g};function WV(e){const{Components:t,Blocks:n}=e,r=o=>{const{model:s,id:a}=o,i=s.getDefaults(),l=n.get(a),u=i.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(a,{model:{defaults:{icon:f}}})};t.getTypes().forEach(r),e.on("component:type:add",r)}const GV=(e,t)=>{const{contextMenu:n}=t.appStore.store,{Canvas:r}=e;e.on(r.events.frameLoad,({window:o,el:s})=>{o.document.addEventListener("contextmenu",async i=>{if(!n.isEnabled||e.getEditing())return;i.preventDefault();const l=i.target,u=e.getModel().get("componentHovered")||e.Utils.helpers.getModel(l);if(u){const d=s.getBoundingClientRect(),p=r.getZoomDecimal();e.runCommand(ne.contextMenuComponent,{component:u,event:i,x:i.clientX*p+d.left,y:i.clientY*p+d.top})}})})};function qV(e,t){var g;const{Components:n,I18n:r}=e,{appStore:o}=t,s=r.t("dataSources.collection"),a=Ft.collection,i=Ft.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(a)?m:m.closestType(a);if(!v)return;const b="dataCollectionPicker",w={id:b,header:!1,layout:{type:"panelDataCollectionPicker",component:v,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:b})},placer:{type:"dialog",title:r.t("dataSources.editCollection"),size:"l"}};e.runCommand(ne.layoutToggle,{...w})},f=({items:m,component:v})=>[{id:`open-${a}-picker`,label:Uf,command:()=>p(v)},...m];n.addType(i,{isComponent:m=>Sa(m,i),model:{defaults:{...qf(o),name:r.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(a,{isComponent:m=>Pi(m,l)||Sa(m,a),block:d&&{label:s,media:u,content:{type:a,components:{type:i},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...Wf},model:{defaults:{...Gf(o),icon:u,name:s,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 KV(e,t){var w;const{Components:n,I18n:r}=e,o=r.t("dataSources.condition"),s=r.t("dataSources.conditionTrue"),a=r.t("dataSources.conditionFalse"),i=r.t("dataSources.conditionElse"),{appStore:l}=t,u=(w=l.sdkOptions.dataSources)==null?void 0:w.blocks,d=Ft.condition,p=Ft.conditionTrue,f=Ft.conditionFalse,g="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 S=y.is(d)?y:y.closestType(d);if(!S)return;const C="dataConditionPicker",x={id:C,header:!1,layout:{type:"panelDataConditionPicker",component:S,onConfirm:()=>e.runCommand(re.layoutRemove,{id:C})},placer:{type:"dialog",title:r.t("dataSources.editCondition"),size:"l"}};e.runCommand(re.layoutToggle,{...x})},b=({items:y,component:S})=>[{id:`open-${d}-picker`,label:zp,command:()=>v(S)},...y];n.addType(f,{isComponent:y=>wa(y,f),model:{defaults:{...Gp(l),tagName:"span",name:s,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(p,{isComponent:y=>wa(y,p),model:{defaults:{...Gp(l),tagName:"span",name:a,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=>Ti(y,g)||wa(y,d),block:u&&{label:o,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:f},{type:p}]},...Up},model:{defaults:{...Wp(l),icon:m,name:o,textable:!0,stylable:!1,tagName:"span",attributes:{[g]:!0},toolbarItems:b}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,Pn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),v(this.model))},getConditionString(){const{model:y}=this,{operator:S,statements:C=[]}=y.getCondition(),x=S==="AND"?" AND ":" OR ",T=C.map(_=>{const{left:O="",operator:P="",right:A=""}=_,M=ay(O),$=ay(A);return`(${M} ${P} ${$})`}).join(x);return`${o}: ${T}`},renderDataResolver(){const y=this.model,S=y.getIfTrueContent(),C=y.getIfFalseContent(),x=S==null?void 0:S.getEl(),E=C==null?void 0:C.getEl();if(e.runCommand(re.getStateDataSource).showPlaceholder){x&&(x.style.display="",x.style.setProperty(Bs,`"${this.getConditionString()} "`)),E&&(E.style.display="",E.style.setProperty(Bs,`" ${i} "`));return}const _=y.isTrue();x&&(x.style.removeProperty(Bs),x.style.display=_?"":"none"),E&&(E.style.removeProperty(Bs),E.style.display=_?"none":"")}}})}function WV(e,t){var f;const{Components:n,I18n:r}=e,o=Bt.variable,s="data-type-data-variable",a="Variable",i=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${Ul.codeBraces}"/></svg>`,{appStore:l}=t,u=(f=l.sdkOptions.dataSources)==null?void 0:f.blocks,d=p=>{const g="dataVariablePicker",m={id:g,header:!1,layout:{type:"panelDataVariablePicker",component:p,onConfirm:()=>e.runCommand(re.layoutRemove,{id:g})},placer:{type:"dialog",title:r.t("dataSources.editVariable"),size:"l"}};e.runCommand(re.layoutToggle,{...m})};n.addType(o,{isComponent:p=>Ti(p,s)||wa(p,o),block:u&&{label:a,media:i,content:{type:o,dataResolver:{path:"",defaultValue:r.t("dataSources.defaultValue")}},...Up},model:{defaults:{...Wp(l),icon:i,name:a,textable:!0,tagName:"span",attributes:{[s]:!0},toolbarItems:({items:p,component:g})=>[{id:`open-${o}-modal`,label:zp,command:()=>d(g)},...p]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:p}=this;this.listenTo(p,Pn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(p){e.getEditing()||(p==null||p.stopPropagation(),d(this.model))},renderDataResolver(){const{model:p,el:g}=this;if(e.runCommand(re.getStateDataSource).showPlaceholder){const v=p.getPath();g.textContent="",g.style.setProperty(Bs,`"${iy(v)}"`);return}g.style.removeProperty(Bs),g.textContent=p.getDataValue()}}})}const Ha=(e,t,n)=>{const r=e.Components.getType(t);if(!r){console.warn(`Component type ${t} not found`);return}const o=r.model;e.Components.addType(t,{model:{...n,toHTML(s){var i;const{exporter:a}=s??{};return a?((i=n.toHTML)==null?void 0:i.call(this,s))??"":o.prototype.toHTML.call(this,s)??""}}})};function Nu({component:e,value:t,getCustomPath:n}){if(Rr(t)&&t.path&&!t.collectionId&&n){const r=t.path??"",o=r.split(".");return{...t,path:n({component:e,path:r,paths:o})}}return t}function GV(e,{isProjectTypeEmail:t}){const n=({content:s})=>t?`<mj-raw>${s}</mj-raw>`:s,r=({content:s})=>s;function o(s){const a=this.getInnerHTML(s);if(t||s.skipTags)return a;const i=this.tagName,l=this.__attrToString(s),u=l?` ${l}`:"",d=`<${i}${u}>`,f=`</${i}>`;return`${d}${a}${f}`}Ha(e,Bt.variable,{toHTML(s){var b;const a=s.skipTags??t,i=s.exporter,l=s.wrapTemplateContent??r,u=w=>l({component:this,content:w}),d=this.tagName,f=this.__attrToString(s),p=(b=this.getDataResolver)==null?void 0:b.call(this),g=Nu({component:this,value:p,getCustomPath:s==null?void 0:s.getCustomPath}),m=i.getVariableSyntax({component:this,dataResolver:g}),v=u(m);return a?v:`<${d}${f?` ${f}`:""}>${v}</${d}>`}}),Ha(e,Bt.condition,{toHTML(s){var S,C,x;const{exporter:a}=s,i=s.wrapTemplateContent??n,l=E=>i({component:this,content:E}),u={component:this},d=s==null?void 0:s.getCustomPath,[f,p]=((S=this.components())==null?void 0:S.models)??[],g=(C=this.getDataResolver)==null?void 0:C.call(this),m=((x=this.resolveCondition)==null?void 0:x.call(this,g==null?void 0:g.condition,d))??{};let v="";if(p){const E=a.getConditionElseSyntax(u);v=`
344
+ </svg>`,v=y=>{const S=y.is(d)?y:y.closestType(d);if(!S)return;const C="dataConditionPicker",x={id:C,header:!1,layout:{type:"panelDataConditionPicker",component:S,onConfirm:()=>e.runCommand(ne.layoutRemove,{id:C})},placer:{type:"dialog",title:r.t("dataSources.editCondition"),size:"l"}};e.runCommand(ne.layoutToggle,{...x})},b=({items:y,component:S})=>[{id:`open-${d}-picker`,label:Uf,command:()=>v(S)},...y];n.addType(p,{isComponent:y=>Sa(y,p),model:{defaults:{...qf(l),tagName:"span",name:s,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=>Sa(y,f),model:{defaults:{...qf(l),tagName:"span",name:a,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=>Pi(y,g)||Sa(y,d),block:u&&{label:o,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:p},{type:f}]},...Wf},model:{defaults:{...Gf(l),icon:m,name:o,textable:!0,stylable:!1,tagName:"span",attributes:{[g]:!0},toolbarItems:b}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,On.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),v(this.model))},getConditionString(){const{model:y}=this,{operator:S,statements:C=[]}=y.getCondition(),x=S==="AND"?" AND ":" OR ",T=C.map(_=>{const{left:O="",operator:P="",right:A=""}=_,M=ay(O),k=ay(A);return`(${M} ${P} ${k})`}).join(x);return`${o}: ${T}`},renderDataResolver(){const y=this.model,S=y.getIfTrueContent(),C=y.getIfFalseContent(),x=S==null?void 0:S.getEl(),E=C==null?void 0:C.getEl();if(e.runCommand(ne.getStateDataSource).showPlaceholder){x&&(x.style.display="",x.style.setProperty(zs,`"${this.getConditionString()} "`)),E&&(E.style.display="",E.style.setProperty(zs,`" ${i} "`));return}const _=y.isTrue();x&&(x.style.removeProperty(zs),x.style.display=_?"":"none"),E&&(E.style.removeProperty(zs),E.style.display=_?"none":"")}}})}function ZV(e,t){var p;const{Components:n,I18n:r}=e,o=Ft.variable,s="data-type-data-variable",a="Variable",i=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${Wl.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:r.t("dataSources.editVariable"),size:"l"}};e.runCommand(ne.layoutToggle,{...m})};n.addType(o,{isComponent:f=>Pi(f,s)||Sa(f,o),block:u&&{label:a,media:i,content:{type:o,dataResolver:{path:"",defaultValue:r.t("dataSources.defaultValue")}},...Wf},model:{defaults:{...Gf(l),icon:i,name:a,textable:!0,tagName:"span",attributes:{[s]:!0},toolbarItems:({items:f,component:g})=>[{id:`open-${o}-modal`,label:Uf,command:()=>d(g)},...f]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:f}=this;this.listenTo(f,On.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(zs,`"${iy(v)}"`);return}g.style.removeProperty(zs),g.textContent=f.getDataValue()}}})}const ja=(e,t,n)=>{const r=e.Components.getType(t);if(!r){console.warn(`Component type ${t} not found`);return}const o=r.model;e.Components.addType(t,{model:{...n,toHTML(s){var i;const{exporter:a}=s??{};return a?((i=n.toHTML)==null?void 0:i.call(this,s))??"":o.prototype.toHTML.call(this,s)??""}}})};function ku({component:e,value:t,getCustomPath:n}){if(to(t)&&t.path&&!t.collectionId&&n){const r=t.path??"",o=r.split(".");return{...t,path:n({component:e,path:r,paths:o})}}return t}function YV(e,{isProjectTypeEmail:t}){const n=({content:s})=>t?`<mj-raw>${s}</mj-raw>`:s,r=({content:s})=>s;function o(s){const a=this.getInnerHTML(s);if(t||s.skipTags)return a;const i=this.tagName,l=this.__attrToString(s),u=l?` ${l}`:"",d=`<${i}${u}>`,p=`</${i}>`;return`${d}${a}${p}`}ja(e,Ft.variable,{toHTML(s){var b;const a=s.skipTags??t,i=s.exporter,l=s.wrapTemplateContent??r,u=w=>l({component:this,content:w}),d=this.tagName,p=this.__attrToString(s),f=(b=this.getDataResolver)==null?void 0:b.call(this),g=ku({component:this,value:f,getCustomPath:s==null?void 0:s.getCustomPath}),m=i.getVariableSyntax({component:this,dataResolver:g}),v=u(m);return a?v:`<${d}${p?` ${p}`:""}>${v}</${d}>`}}),ja(e,Ft.condition,{toHTML(s){var S,C,x;const{exporter:a}=s,i=s.wrapTemplateContent??n,l=E=>i({component:this,content:E}),u={component:this},d=s==null?void 0:s.getCustomPath,[p,f]=((S=this.components())==null?void 0:S.models)??[],g=(C=this.getDataResolver)==null?void 0:C.call(this),m=((x=this.resolveCondition)==null?void 0:x.call(this,g==null?void 0:g.condition,d))??{};let v="";if(f){const E=a.getConditionElseSyntax(u);v=`
345
345
  ${l(E)}
346
- ${p.toHTML(s)??""}`}const b=a.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),w=a.getConditionalEndSyntax(u);return`
346
+ ${f.toHTML(s)??""}`}const b=a.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),w=a.getConditionalEndSyntax(u);return`
347
347
  ${`${l(b)}
348
- ${(f==null?void 0:f.toHTML(s))??""}${v}
348
+ ${(p==null?void 0:p.toHTML(s))??""}${v}
349
349
  ${l(w)}`}
350
- `},resolveCondition(s,a){if(typeof s=="boolean")return s;if(!s)return{};if(h6(s))return{...s,statements:s.statements.map(l=>this.resolveCondition(l,a))??[]};const i={component:this,getCustomPath:a};return{...s,left:Nu({...i,value:s.left}),right:Nu({...i,value:s.right})}}}),Ha(e,Bt.collection,{toHTML(s){const a=s.skipTags??t,{exporter:i}=s,l=s.wrapTemplateContent??n,u=T=>l({component:this,content:T}),d={component:this},f=this.getDataResolver(),p={...f,dataSource:Nu({component:this,value:f==null?void 0:f.dataSource,getCustomPath:s==null?void 0:s.getCustomPath})},g=this.components().at(0),m=i.getCollectionStartSyntax({...d,dataResolver:p}),v=i.getCollectionEndSyntax(d),b=(g==null?void 0:g.toHTML(s))??"",w=`${u(m)}
350
+ `},resolveCondition(s,a){if(typeof s=="boolean")return s;if(!s)return{};if(b6(s))return{...s,statements:s.statements.map(l=>this.resolveCondition(l,a))??[]};const i={component:this,getCustomPath:a};return{...s,left:ku({...i,value:s.left}),right:ku({...i,value:s.right})}}}),ja(e,Ft.collection,{toHTML(s){const a=s.skipTags??t,{exporter:i}=s,l=s.wrapTemplateContent??n,u=T=>l({component:this,content:T}),d={component:this},p=this.getDataResolver(),f={...p,dataSource:ku({component:this,value:p==null?void 0:p.dataSource,getCustomPath:s==null?void 0:s.getCustomPath})},g=this.components().at(0),m=i.getCollectionStartSyntax({...d,dataResolver:f}),v=i.getCollectionEndSyntax(d),b=(g==null?void 0:g.toHTML(s))??"",w=`${u(m)}
351
351
  ${b}
352
352
  ${u(v)}`;if(a)return`
353
353
  ${w}
354
354
  `;const y=this.tagName,S=this.__attrToString(s),C=S?` ${S}`:"",x=`<${y}${C}>`,E=`</${y}>`;return`
355
355
  ${x}${w}${E}
356
- `}}),Ha(e,Bt.conditionTrue,{toHTML:o}),Ha(e,Bt.conditionFalse,{toHTML:o}),Ha(e,Bt.collectionItem,{toHTML:o})}const qV=function(e,t){const{Components:n,Canvas:r,events:o}=e;if(!n.getType(Bt.conditionTrue))return;const{isProjectTypeEmail:s,sdkOptions:a}=t.appStore,{dataSources:i}=a;i!=null&&i.globalData&&e.on(o.projectLoad,()=>{e.DataSources.add({id:Hs.globalData,records:ly(i.globalData),skipFromStorage:!0})}),e.on(r.events.frameLoadBody,({window:l})=>{const u="data-outline-ds",d=l.document;if(d.querySelector(`style[${u}]`))return;const p=d.createElement("style"),g=[Bt.variable,Bt.condition,Bt.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);p.setAttribute(u,""),p.textContent=`
356
+ `}}),ja(e,Ft.conditionTrue,{toHTML:o}),ja(e,Ft.conditionFalse,{toHTML:o}),ja(e,Ft.collectionItem,{toHTML:o})}const XV=function(e,t){const{Components:n,Canvas:r,events:o}=e;if(!n.getType(Ft.conditionTrue))return;const{isProjectTypeEmail:s,sdkOptions:a}=t.appStore,{dataSources:i}=a;i!=null&&i.globalData&&e.on(o.projectLoad,()=>{e.DataSources.add({id:js.globalData,records:ly(i.globalData),skipFromStorage:!0})}),e.on(r.events.frameLoadBody,({window:l})=>{const u="data-outline-ds",d=l.document;if(d.querySelector(`style[${u}]`))return;const f=d.createElement("style"),g=[Ft.variable,Ft.condition,Ft.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);f.setAttribute(u,""),f.textContent=`
357
357
  ${g.join(",")} {
358
358
  outline: 2px dotted #8b5cf6;
359
359
  }
@@ -366,7 +366,7 @@ ${x}${w}${E}
366
366
  [data-gjs-type="data-variable"]::before,
367
367
  [data-gjs-type="data-condition-true-content"]::before,
368
368
  [data-gjs-type="data-condition-false-content"]::before {
369
- content: var(${Bs});
369
+ content: var(${zs});
370
370
  font-style: italic;
371
371
  color: #666;
372
372
  white-space: nowrap;
@@ -377,7 +377,7 @@ ${x}${w}${E}
377
377
  font-weight: 500;
378
378
  font-family: sans-serif;
379
379
  }
380
- `,d.head.appendChild(p)}),WV(e,t),UV(e,t),zV(e,t),GV(e,{isProjectTypeEmail:s})};function KV(e){const{Components:t}=e,n=r=>{const{id:o,model:s}=r;if(o==="custom-code"){const a="<span>Insert here your custom code</span>";t.addType(o,{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:a,"custom-code-plugin__code":a,styles:".gjs-custom-code { padding: 5px; }"}}})}if(o==="typed"){const a=s.getDefaults().traits.map(i=>i.name==="strings"?{...i,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(f=>f.label);l.set({strings:d}),l.trigger("rerender")},properties:[{name:"label"}]}:i);t.addType(o,{model:{defaults:{traits:a,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)}),ZV(e,t),KV(e,t),qV(e,t),YV(e,{isProjectTypeEmail:s})};function JV(e){const{Components:t}=e,n=r=>{const{id:o,model:s}=r;if(o==="custom-code"){const a="<span>Insert here your custom code</span>";t.addType(o,{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:a,"custom-code-plugin__code":a,styles:".gjs-custom-code { padding: 5px; }"}}})}if(o==="typed"){const a=s.getDefaults().traits.map(i=>i.name==="strings"?{...i,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"}]}:i);t.addType(o,{model:{defaults:{traits:a,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 @@ ${x}${w}${E}
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};o==="tab"&&(i.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(iS),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(o,{model:{defaults:i}})}};e.on("component:type:add",n)}const ZV=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:r})=>r&&n.onLoad())},YV=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:r}=e;r.getConfig().uploadFile=async(...o)=>{const s=o[0],a=await n.handleUpload(s),i=o[1];a&&(i==null||i({data:a}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},XV=()=>{const{baseApiUrl:e}=vv();return`${e}/sdk/projects`},aS=e=>`${XV()}/${e}`,JV=async({licenseKey:e,projectId:t,...n})=>{const r=await kr.put(aS(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return r==null?void 0:r.result},QV=async(e,t)=>await kr.put(t,{body:e,headers:{"Content-Type":"application/json"}}),RV=async(e,t,n,r)=>{const o=JSON.stringify(e),s=await JV({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([o]).size},identityId:r,name:e.name,description:e.description});if(!s)throw new Error("Project not found");const{uploadUrl:a}=s;await QV(o,a)},eH=(e,t,n)=>kr.get(aS(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),tH=async e=>await kr.get(e),nH=async(e,t,n,r)=>{const o=await eH(t,n,r),s=o==null?void 0:o.result,a=o==null?void 0:o.errorData;if(!s&&(a!=null&&a.notFoundInDb))return{id:n,project:{}};if(!s)throw new Error("Project not found");const{downloadUrl:i}=s,l=await tH(i);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},rH=(e,t)=>{const{appEditorStore:n,toastStore:r,i18nStore:o}=t.appStore.store,{isUsingProjectSelfHosted:s,isUsingProjectCloud:a,sdkOptions:i}=n,l=i.storage||{},{project:u,onLoad:d,onSave:f,autosaveChanges:p,autosaveIntervalMs:g}=l;let m,v,b,w;if(s)b=d,w=f,m=p,v=g;else if(a){const E=i.licenseKey,T=n.sdkProjectId,_=n.sdkIdentityId,O=10,P=1e4;w=({project:A})=>RV(A,E,T,_),b=({editor:A})=>nH(A,E,T,_),m=Math.max(O,p??O),g&&(v=Math.max(P,g))}const{Storage:y,events:S}=e,{events:C}=y;let x=!1;if(e.once(S.projectLoad,E=>{x=!!E.loaded}),e.once("change:readyLoad",()=>{var T;const E=(T=i.project)==null?void 0:T.default;!x&&E&&e.loadProjectData(E)}),e.on(C.startStore,()=>n.setIsSaving(!0)),e.on(C.endStore,()=>n.setIsSaving(!1)),(b||u)&&w){const E="remote";y.setCurrent(E),y.add(E,{async load(){return u||(await b({editor:e})).project},async store(T){await w({project:T,editor:e})}}),e.on(C.errorLoad,T=>{r.addError("storage-error-load",{header:o.t("storageManager.errorLoad"),content:T.message})}),e.on(C.errorStore,T=>{r.addError("storage-error-store",{header:o.t("storageManager.errorStore"),content:T.message})}),m&&y.setStepsBeforeSave(m),v&&e.onReady(()=>{const T=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},v);e.on("destroy",()=>clearInterval(T))})}},$u="select-target",iS="enable-sm";function oH(e,t){var L,D,W,F;const{appStore:n}=t,{appEditorStore:r,blockManagerStore:o,toastStore:s,modalStore:a,layoutStore:i,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:f,nextProjectData:p,sdkOptions:g}=r,m=()=>o.toggleOpen(),v=()=>r.toggleLeftSidebar(),b=()=>r.toggleRightSidebar(),w=e.getConfig(),{Assets:y,Storage:S,Commands:C}=e,x=C.events,E=e.events,T=(D=(L=g.gjsOptions)==null?void 0:L.assetManager)==null?void 0:D.custom;let _=!1;if(y.all.model.prototype.idAttribute="src",Ht(T)&&(y.getConfig().custom=T),p&&(w.projectData=p,r.setNextProjectData()),f){const k=S.getConfig().options;k&&(k.local.key=f)}e.on(E.projectLoad,({project:k})=>{var H;n.setProjectDataCustom(k.custom||{projectType:(H=r.sdkOptions.project)==null?void 0:H.type}),d.loadFonts()}),e.on(E.projectGet,({project:k})=>{k.custom=Sa(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:O}=e,P=Fo(()=>r.setCanvasPanning(!1),200);e.on(O.events.coords,()=>{r.setCanvasPanning(!0),P()}),e.on(O.events.frameLoad,({el:k})=>{k.tabIndex=-1});const{Parser:A}=e,M=((W=r.sdkOptions.parser)==null?void 0:W.showErrors)!==!1;(F=A.events)!=null&&F.css&&M&&e.on(A.events.css,k=>{const{error:H}=k;if(H){const V=ct(H)?H:H.name&&H.reason?`${H.name}: ${H.reason}`:H.message;s.addError("css-error",{header:"CSS Parser Error",content:V})}}),[{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:re.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:re.symbolDetach}].forEach(({id:k,keys:H,cmd:V})=>{e.Keymaps.add(`preset:${k}`,H,V,{prevent:!0})}),e.on(`${x.runCommand}core:preview`,()=>{r.setPreview(!0),o.setOpen(!1),pb(e,!1)}),e.on(`${x.stopCommand}core:preview`,()=>{r.setPreview(!1),pb(e,!0),setTimeout(()=>{e.refresh()},r.transitionTime)});const $="target-selection",{Components:j}=e;C.add($u,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(k,H){const V={id:$,type:"target",component:H};H?O.addSpot(V):O.removeSpots(V)},beforeSelect(k,H={}){H.abort=!0,H.useValid=!1,this.opts.onSelect(k),e.stopCommand($u)},run(k,H,V){this.opts=V,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),O.removeSpots({id:$}),r.setSelectingTarget(!1)}}),C.add(iS,()=>{r.setSelectedDesignerTab("style")}),C.add(re.toastAdd,(k,H,V)=>{s.add(V.id,V)}),C.add(re.toastRemove,(k,H,V)=>{s.remove(V.id)}),C.add(re.dialogOpen,(k,H,V)=>{a.open(V)}),C.add(re.dialogClose,()=>{a.close()}),C.add(re.dialogExportCode,()=>{a.open({title:e.t("actions.showCode.title"),content:()=>{var k,H;return h.createElement(dN,{options:(H=(k=g.commands)==null?void 0:k.options)==null?void 0:H[vr.showCode]})}})}),C.add(re.dialogImportCode,()=>{a.open({title:e.t("actions.importCode.title"),content:()=>h.createElement(fb)})}),C.add(re.sidebarLeftGet,()=>({visible:r.isLeftSidebarOpen})),C.add(re.sidebarLeftSet,(k,H,V)=>{r.setLeftSidebarOpen(!!V.visible)}),C.add(re.sidebarLeftToggle,()=>{r.setLeftSidebarOpen(!r.isLeftSidebarOpen)}),C.add(re.sidebarRightGet,()=>({visible:r.isRightSidebarOpen})),C.add(re.sidebarRightSet,(k,H,V)=>{r.setRightSidebarOpen(!!V.visible)}),C.add(re.sidebarRightToggle,()=>{r.setRightSidebarOpen(!r.isRightSidebarOpen)}),C.add(re.sidebarTopGet,()=>({visible:r.isTopSidebarOpen})),C.add(re.sidebarTopSet,(k,H,V)=>{r.setTopSidebarOpen(!!V.visible)}),C.add(re.sidebarTopToggle,()=>{r.setTopSidebarOpen(!r.isTopSidebarOpen)}),C.add(re.sidebarBottomGet,()=>({visible:r.isBottomSidebarOpen})),C.add(re.sidebarBottomSet,(k,H,V)=>{r.setBottomSidebarOpen(!!V.visible)}),C.add(re.sidebarBottomToggle,()=>{r.setBottomSidebarOpen(!r.isBottomSidebarOpen)}),C.add(re.layoutAdd,(k,H,V)=>{V.id&&i.add(V.id,V)}),C.add(re.layoutRemove,(k,H,V)=>{const{id:U,...J}=V;i.remove(U,J)}),C.add(re.layoutToggle,(k,H,V)=>{const{id:U,...J}=V;U&&(i.get(U)?i.remove(U,J):i.add(U,J))}),C.add(re.layoutUpdate,(k,H,V)=>{const U=V;e.runCommand(re.layoutRemove,{id:U.id,layout:{placer:{...U.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(re.layoutAdd,{...U}))}),C.add(re.layoutGet,(k,H,V)=>[To(i.get(V.id))]),C.add(re.layoutConfigGet,()=>To(i.customConfig)),C.add(re.layoutConfigSet,(k,H,V)=>{const U=V;i.setCustomConfig(U)}),C.add(re.layoutComponentAdd,(k,H,V)=>{const{type:U,component:J}=V;U&&J&&i.addCustomLayoutComponent(U,J)}),C.add(re.layoutComponentGet,(k,H,V)=>i.getCustomLayoutComponent(V.type)),C.add(re.layoutComponentRemove,(k,H,V)=>{i.removeCustomLayoutComponent(V.type)}),C.add(re.layoutComponentRender,(k,H,V)=>h.createElement(kV,{components:V.components})),C.add(re.getStateTheme,()=>r.publicStateTheme),C.add(re.setStateTheme,(k,H,V)=>r.setPublicStateTheme(V)),C.add(re.getPagesConfig,()=>r.sdkPagesConfig),C.add(re.setPagesConfig,(k,H,V)=>{const{config:U}=V||{};Ht(U)&&r.setSdkPagesConfig(U)}),C.add(re.getPageSettings,()=>JSON.parse(JSON.stringify(r.panelPageSettings))),C.add(re.setPageSettings,(k,H,V)=>{r.setPanelPageSettings(V)}),C.add(re.clearPage,()=>{const k=H=>e.t(`actions.${H}`);a.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()}})}),C.add(re.projectFiles,(k,H,V)=>{var X,Q;const U=(X=r.sdkOptions.dataSources)==null?void 0:X.exportConfig,J=((Q=V.exportConfig)==null?void 0:Q.exportPreset)??U,Y={isMJML:r.isProjectTypeEmail,exportConfig:J,...V};return DV(k,Y)}),C.add(re.validateCode,(k,H,V)=>qv({...V,appStore:n})),C.add(re.getBlocksPanel,()=>({isOpen:o.isOpen})),C.add(re.setBlocksPanel,(k,H,V)=>{const U=V||{};Ht(U.isOpen)&&o.setOpen(U.isOpen)}),C.add(re.canvasReload,()=>{const k=e.getSelected(),H=O.getCanvasView(),{frames:V}=O.canvas;V.once("loaded:all",()=>{const U=k==null?void 0:k.getView();U&&!U.isInViewport()&&U.el.scrollIntoView({block:"center"})}),H.renderFrames()}),C.add(re.contextMenuComponent,(k,H,V)=>{const{component:U,...J}=V;l.showForComponent(U,J)}),C.add(re.getStateContextMenu,()=>l.publicState),C.add(re.setStateContextMenu,(k,H,V)=>{l.setPublicState(V)}),C.add(re.symbolAdd,(k,H,V)=>{const U=V.component||e.getSelected();if(U)return j.getSymbolInfo(U).isSymbol?s.add("skip-symbol",{header:"The selected element is already a symbol",variant:on.Warning}):j.addSymbol(U)}),C.add(re.symbolDetach,(k,H,V)=>{const U=V.component||e.getSelected();U&&j.getSymbolInfo(U).isRoot&&j.detachSymbol(U)}),C.add(re.symbolOverride,(k,H,V)=>{const U=V.component||e.getSelected();U&&(U.setSymbolOverride(V.override),e.Layers.updateLayer(U))}),C.add(re.symbolPropagateStyles,(k,H,V)=>{const U=V.component||e.getSelected();if(!U)return;const{Css:J}=e,Y=J.getComponentRules(U,{current:!0})[0];if(Y){const{state:X,mediaText:Q}=Y.attributes,ee=Y.getStyle();j.getSymbolInfo(U).relatives.forEach(G=>{J.setIdRule(G.getId(),ee,{state:X,mediaText:Q})})}V.deep&&U.components().forEach(X=>e.runCommand(re.symbolPropagateStyles,{...V,component:X}))}),C.add(re.assetProviderGet,()=>To(u.allProviders)),C.add(re.assetProviderAdd,(k,H,{provider:V,index:U})=>{u.addProvider(V,U)}),C.add(re.assetProviderRemove,(k,H,{id:V})=>{const U=u.allProviders.filter(J=>J.id!==V);u.setAllProviders(U)}),C.add(re.fontGet,()=>To(d.fonts)),C.add(re.fontAdd,(k,H,{font:V})=>{d.addFont(V)}),C.add(re.fontRemove,(k,H,{family:V})=>{d.removeFont(V)}),C.add(re.fontManagerOpen,(k,H,V)=>{nh(k,V)}),C.add(re.menuFontLoad,(k,H,{font:V})=>kf(V,!1)),C.add(re.toggleStateDataSource,()=>(_=!_,e.trigger(Pn.toggleDataSourcesPreview,{showPlaceholder:_}),e.refresh({tools:!0}),{showPlaceholder:_})),C.add(re.getStateDataSource,()=>({showPlaceholder:_})),C.add(re.dataSourceSetGlobalData,(k,H,{globalData:V})=>{const U=ly(V);return e.DataSources.get(Hs.globalData).setRecords(U)}),C.add(re.setDragAbsolute,(k,H,{enabled:V})=>{r.setIsDraggingAbsolute(!!V)}),C.add(re.dataSourceSetImporter,(k,H,V)=>{e.on(e.Parser.events.htmlBefore,U=>{U.input=V.import(U.input)})}),C.add(re.dataSourceSetExporter,(k,H,V)=>{e.config.optsHtml={...e.config.optsHtml,exporter:V}}),YV(e,t),rH(e,t),ZV(e,t),KV(e),FV(e),DM(e),BV(e,t),qV(e,t)}const sH=/\s(?![^(]*\))/,lS=/^-?[0-9]+[a-zA-Z%]{0,}$/;function cS(e){const t=e.split(sH),n=t.indexOf("inset")>=0,r=t.filter(d=>d!=="inset"),o=r.filter(d=>!lS.test(d))[0]||"currentColor",s=r.filter(d=>lS.test(d)),[a="0",i="0",l="0",u="0"]=s;return{x:a,y:i,blur:l,spread:u,inset:n,color:o}}const ku=["%"],Iu=["s","ms"],wl=["deg","rad","grad"],Qr=["px","%","em","rem","vw","vh"],uS={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},aH=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Vu=e=>({id:e,label:e.split("-").map(Pr).join(" ")}),dS=e=>({property:t,to:n})=>{if(n.value){const r=t.getOption(),o=t.getParent().getProperty(e),s=o.getUnit(),a={units:r.units||[],min:r.min,max:r.max,unit:""};(!s||(a==null?void 0:a.units.indexOf(s))<0)&&(a.unit=(a==null?void 0:a.units[0])||""),o.up(a)}},iH=e=>{const t=`${e}-name`,n=`${e}-value`;return(r,{separatorLayers:o})=>{const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=Tu(a);return{[t]:i,[n]:l}}):[]}},fS=e=>{const t={[bl]:e};if(e.indexOf("url(")>-1)t[Xr]=ss.Image;else if(e.indexOf("gradient(")>-1){const n=Lh(e),r=n.colorStops,o=n.name.indexOf("linear")>=0;r.length===2&&o&&r[0].color===r[1].color?t[Xr]=ss.Color:t[Xr]=ss.Gradient}else t[Xr]=ss.Color,t[bl]=aH(e);return t},pS=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(r,{separatorLayers:o}){const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=Tu(a);return{[t]:i,[n]:l}}):[]},toStyle(r,{name:o}){return{[o]:`${r[t]}(${r[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:dS(n)},{property:n,type:"integer"}]}},Hu=(e,{x:t,y:n,mergable:r}={})=>{const o={property:`${e}-x`,type:"integer",units:Qr,...t},s={property:`${e}-y`,type:"integer",units:Qr,...n};return{property:e,type:"composite",properties:[o,s],...r&&{fromStyle(a,{name:i,separator:l,property:u}){const[d,f]=u.getProperties(),[p,g]=(a[i]||"").split(l);return{[d.getId()]:a[d.getName()]||p||"",[f.getId()]:a[f.getName()]||g||p||""}},toStyle(a,{name:i,property:l}){const[u,d]=l.getProperties(),f=a[u.getId()],p=a[d.getId()];return{[i]:f===p?f:`${f} ${p}`}}}}},lH=(e,t="")=>{const n=`${e}-name`,r=`${e}-value`;return(o,{name:s})=>({[s]:`${o[n]}(${o[r]||t})`})};["top","middle","bottom"].map(Vu),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Vu),["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"})),Hu("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Vu),US("(?<!\\(.*[^)]),(?![^()]*\\))"),ss.Image,ss.Gradient,ss.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:Qr,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:Qr,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:Qr})),["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"})),Hu("overflow",{x:uS,y:uS,mergable:!0}),pS(),pS("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(Vu),Iu[0],Iu[0],iH("transform"),lH("transform","0"),dS("transform-value"),Hu("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),Hu("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function hS(e,t){return[n=>KM(n,t),...qM[e],n=>oH(n,t),zM(e,t)]}class cH{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,sn(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const r=(yield dH()).filter(o=>o.projectType.includes(t));this.setProjectPlugins(r)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const r=[...hS(t,{appStore:n}),...this.projectPlugins||[]],o=n.sdkOptions.plugins||[];return et(o)?o({plugins:r}):[...r,...o]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;r.includes(o)?this.pendingUninstalled=r.filter(s=>s!==o):n.includes(o)||n.push(o)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;n.includes(o)?this.pendingInstalled=n.filter(s=>s!==o):r.push(o)}setSelectedShown(t){this.selectedShown=t}}const uH={db:Um.gjsStudio},dH=()=>new Promise(async e=>{let t=[];try{t=await s3(mc.Settings,"plugins",uH)||[]}catch(n){Tr()&&console.error(n)}e(t)}),fH=h.createContext(void 0);class pH{constructor(t){this.blockManagerStore=new c4(this),this.appEditorStore=new G3(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new hL(t==null?void 0:t.localSettingsStore),this.toastStore=new l4(this),this.modalStore=new gL(this),this.i18nStore=new n4(this),this.pluginStore=new cH(this),this.pointerBadgeStore=new a4(this),this.contextMenu=new hH(this),this.layoutStore=new o4(this),this.templatesStore=new i4(this),this.assetsStore=new e4(this),this.globalStylesStore=new uL(this),this.fontsStore=new t4(this),this.appEditorStore.init(),zu()&&(window.__gjss=this)}}const En=()=>{const e=h.useContext(fH);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},Dh=()=>{throw new Error("Store has not been initialized")};class hH{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=ws(function*(n,r={}){var w;if(!(n!=null&&n.em))return[];const o=n.em.getEditor(),{isSymbol:s,isRoot:a}=o.Components.getSymbolInfo(n),i=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),f=[u&&{id:Ho.selectParent,icon:q.arrowUp,label:"Select parent",onClick:()=>{o.runCommand("core:component-exit",{force:!0})}},d&&{id:Ho.duplicate,icon:q.contentCopy,label:"Duplicate",onClick:()=>{o.runCommand("tlb-clone")}},!s&&l&&{id:Ho.symbolCreate,icon:q.rhombusSplit,label:"Create Symbol",onClick:()=>{o.runCommand(re.symbolAdd)}},s&&a&&{id:Ho.symbolDetach,icon:q.alertRhombus,label:"Detach instance",onClick:()=>{o.runCommand(re.symbolDetach)}},s&&!i&&{id:Ho.symbolOverride,icon:q.rhombusOutline,label:"Make overridable",onClick:()=>{o.runCommand(re.symbolOverride,{override:!0})}},s&&i&&{id:Ho.symbolOverrideClear,icon:q.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{o.runCommand(re.symbolOverride)}},l&&{id:Ho.delete,icon:q.delete,label:"Delete",onClick:()=>{o.runCommand("core:component-delete")}}].filter(Boolean),p=n.get("contextMenu"),g={...r,items:f,component:n,editor:o,type:n.get("type")||"default",source:r.source||Nf.canvas},m=yield gS(p,g),v=(w=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:w.contextMenu;return yield gS(v,{...g,items:m})}),this.store=t,sn(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const r=t==null?void 0:t.em;if(!r)return;n.skipSelect||r.selected.hasComponent(t)||r.setSelected(t);const o=yield this.getItemsForComponent(t,n);o.length&&this.show({...n,items:o})}show({items:t,x:n,y:r,w:o,h:s}){this.isOpen=!0,this.coordinates={x:n,y:r,w:o,h:s},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const gS=async(e,t)=>et(e)?(await e(t)).filter(Boolean):t.items,gH=()=>En().contextMenu,mS=Tr()&&document.body,Fh=(e={})=>({...ap,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??mS}},{name:"preventOverflow",options:{boundary:e.boundary??mS}}]}),mH=Fh(),ju="gs-ctx-menu-list",vH=ce(function({onItemClick:t,open:n,items:r,x:o,y:s,w:a,h:i,className:l}){const u=gH(),[d,f]=h.useState(),[p,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(o,s,a,i)}),[o,s,a,i,n]),{styles:v,attributes:b}=wi(m,p,mH),w=N(`${ju}-wrp gs-utl-z-20`,l),y=N(`${ju} gs-utl-z-20`),S=N(`${ju}-body gs-utl-max-w-56`),C=N(`${ju}-item`),x="gs-utl-max-w-40",E=T=>{const{action:_,onClick:O}=T;if(_||O)return P=>{const A={editor:u.store.appEditorStore.editor,...P};et(_)?(_(A),u.hide()):et(O)&&(O(A),u.hide())}};return c.jsx("div",{className:w,ref:g,style:v.popper,...b.popper,children:c.jsx(gf,{show:!!n,...gT,unmount:!1,children:c.jsx(Yn,{padding:!1,className:y,classNameBody:S,children:r.map((T,_)=>h.createElement(Pa,{onItemClick:t,...T,key:T.id??_,className:C,classNameLabel:x,action:E(T),onActive:()=>f(T),active:d===T}))})})})}),Bh="gs-cmp-tooltip";function Wt({className:e,classNameWrp:t,classNameContent:n,strategy:r,placement:o="bottom",children:s,title:a,onClick:i,inline:l,size:u}){const[d,f]=h.useState(!1),[p,g]=h.useState(!1),m=Ht(u),[v,b]=h.useState(null),[w,y]=h.useState(null),S=wi(v,w,{...Fh(),placement:o,...r?{strategy:r}:{}});h.useEffect(()=>{var E;d&&((E=S.update)==null||E.call(S))},[d,S.update]),h.useEffect(()=>{const E=setTimeout(()=>f(p),10);return()=>clearTimeout(E)},[p]);const C=N(`${Bh}-target`,!l&&"gs-utl-block",e,!i&&"gs-utl-cursor-auto"),x=N(`${Bh}-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:N(Bh,"gs-utl-relative",t),children:[c.jsx("span",{ref:b,className:C,onMouseEnter:()=>a&&g(!0),onMouseLeave:()=>g(!1),children:c.jsx("div",{className:N(l&&"gs-utl-inline-block"),onClick:()=>{g(!1),i==null||i()},children:s})}),!!p&&c.jsx("div",{className:x,ref:y,style:S.styles.popper,...S.attributes.popper,children:c.jsx(gf,{show:!!d,unmount:!1,...S1,children:c.jsx(Yn,{className:C1.txt,bg:C1.bg,size:"s",border:!1,children:a})})})]})}function Ct({children:e,title:t,classNameWrp:n,tooltipProps:r,...o}){return c.jsx(Wt,{title:t,classNameWrp:n,...r,children:c.jsx(Ke,{...o,children:e})})}const ja="gs-cmp-ai-chat-assets",bH=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},yH=e=>e.mediaType==="application/pdf",vS=({editor:e,assets:t,className:n,onRemove:r,style:o})=>{const s=`${ja}__asset-item`,a=N(`${ja}__asset-image`,"gs-utl-object-cover",te.rnd,Wl.m),i=N(`${ja}__asset-pdf`,"gs-utl-overflow-hidden",te.rnd,Wl.m),l=N(`${ja}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",te.rnd,Wl.m,z.bgH2),u=N(`${ja}__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",Wl.s,te.pill,z.bgRed,z.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const f=(p,g)=>{const m={params:{num:g+1}},v=e.t(`${d}.imageAlt`,m),b=e.t(`${d}.pdfTitle`,m);return bH(p)?c.jsx("img",{src:p.src,alt:v,className:a}):yH(p)?c.jsx("iframe",{src:p.src,title:b,className:i}):c.jsx("div",{className:l,children:c.jsx(ne,{icon:XC,size:se.l})})};return c.jsx(I,{className:N(ja,n),gap:"xs",wrap:"wrap",style:o,children:t.map((p,g)=>c.jsxs("div",{className:N(s,"gs-utl-relative gs-utl-inline-block"),children:[f(p,g),r&&c.jsx(Ct,{title:e.t(`${d}.remove`),icon:{icon:q.close,size:se.s3x},onClick:()=>r(g),size:"x2s",border:!1,className:u})]},p.src))})},hn="gs-cmp-ai-chat-input",wH=e=>{const{className:t,style:n,editor:r,disabled:o,maxAssets:s,currentAssetsCount:a,acceptAssetType:i,onFilesSelected:l,onAssetSelected:u}=e,d=h.useRef(null);if(s<=0)return null;const f=`${hn}__attach-btn`,p=`${hn}__file-input`,g=a>=s,m="aiChat.input.attach",v=r.t(`${m}.upload`),b=r.t(`${m}.selectFromAssets`),w=r.t(`${m}.title`),y=r.t(`${m}.maxAssets`,{params:{count:s}}),S=x=>{const E=Array.from(x.target.files||[]);E.length>0&&l(E),d.current&&(d.current.value="")},C=x=>{if(!r||g)return;const E="btnAttachImages",T=()=>r.runCommand(re.layoutRemove,{id:E});r.runCommand(re.layoutToggle,{id:E,header:!1,placer:{type:"popover",target:x.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:T,items:[{id:"upload",label:v,icon:q.trayArrowDown,onClick:()=>{var _;return(_=d.current)==null?void 0:_.click()}},{id:"assets",label:b,icon:a2,onClick:()=>{r.Assets.open({onSelect:({asset:_})=>{const O=_.getSrc();O&&u(O)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:i,multiple:!0,onChange:S,className:p,style:{display:"none"}}),c.jsx(Ct,{className:N(f,te.pill,t),style:n,title:g?y:w,icon:q.plus,border:!1,onClick:C,disabled:o||g,size:"s",block:!0})]})},SH=({editor:e,className:t,style:n,contextComponents:r,disabled:o})=>{const[s,a]=h.useState(()=>e.getSelectedAll()),i="aiChat.input.context";h.useEffect(()=>{const y=e.Components.events.select,S=()=>a(e.getSelectedAll());return e.on(y,S),()=>{e.off(y,S)}},[e]),h.useEffect(()=>{r.clear(),s.forEach(y=>r.add(y))},[s,r]);const l=()=>a([]);if(s.length===0)return null;const u=`${hn}__context`,d=`${hn}__context-icon`,f=`${hn}__context-badge`,p=`${hn}__context-name`,g=`${hn}__context-divider`,m=s.length===1,v=s[0],b=e.t(`${i}.multiple`,{params:{count:s.length}}),w=m?v.getName():b;return c.jsxs(I,{className:N(u,o&&Pe.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:q.target,size:se.sx,className:N(d,z.txtLowEmphasis)}),c.jsx(Ko,{className:N(f,P1(v).bg,Te.xyS2),s:"s",children:c.jsxs(I,{gap:"xs",items:"center",nowrap:!0,children:[m&&lv(v),c.jsx("div",{className:N(p,Pe.txtEllips,"gs-utl-max-w-36"),children:w}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N(g,te.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(Ct,{title:e.t(`${i}.clear`),icon:{icon:q.close,size:se.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function bS(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function CH(){const[e,t]=h.useState(""),[n,r]=h.useState(!1),[o,s]=h.useState(!1),a=h.useRef();h.useEffect(()=>s(!!bS()),[]);const i=()=>{const u=bS();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>r(!0),d.onend=l,d.onresult=f=>{const g=Array.from(f.results).map(m=>m[0].transcript).join("");t(g)},d.onerror=f=>{console.error("Speech recognition error",f),l()},a.current=d,d.start()},l=()=>{var u;(u=a.current)==null||u.stop(),r(!1)};return{transcript:e,isSupported:o,isListening:n,start:i,stop:l}}const xH=({editor:e,disabled:t,onTranscript:n,onListeningChange:r,className:o,style:s})=>{const a=`${hn}__dictate`,{transcript:i,isSupported:l,isListening:u,start:d,stop:f}=CH(),p="aiChat.input.dictate",g=e.t(`${p}.start`),m=e.t(`${p}.stop`),v=u?m:g;return h.useEffect(()=>{i&&n(i)},[i]),h.useEffect(()=>{r==null||r(u)},[u]),l?c.jsx(Ct,{block:!0,size:"s",border:!1,className:N(a,te.pill,o),style:s,title:v,disabled:t,icon:u?b2:v2,onClick:u?f:d,variant:u?"danger":"out-clear"}):null},EH=({autoResize:e,autoFocus:t,style:n={},...r})=>{const o=h.useRef(null);return h.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[r.value,e]),h.useEffect(()=>{const s=o.current;if(s&&t){const a=setTimeout(()=>s==null?void 0:s.focus(),150);return()=>clearTimeout(a)}},[o.current,t]),c.jsx("textarea",{ref:o,style:{...n,...e?{resize:"none"}:{}},...r})},yS=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},wS=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,TH=({className:e,style:t,chatContext:n,editor:r,maxAssets:o=5,acceptAssetType:s="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:a,layoutBefore:i,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:f,assetsSectionProps:p,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:v,value:b})=>{const[w,y]=h.useState(b||""),[S,C]=h.useState(""),[x,E]=h.useState(!1),[T,_]=h.useState([]),[O,P]=h.useState(!1),A="aiChat.input",M=r.runCommand(pr.getChatApi),$=r.runCommand(pr.getChatState),{status:j,stop:L,sendMessage:D,setError:W}=n||M,F=j==="streaming"||j==="submitted",k=T.length>0,H=S?wS(w,S):w,V=!O&&(F||H.trim()||k),U={input:H,assets:T},J=Se=>{const ot=o-T.length,st=Se.slice(0,ot);if(st.length===0)return;const wt=st.map(Ne=>({src:URL.createObjectURL(Ne),file:Ne,mediaType:Ne.type}));_(Ne=>[...Ne,...wt])},Y=Se=>{T.length>=o||_(ot=>[...ot,{src:Se,mediaType:"image/*"}])},X=Se=>{const ot=T[Se];ot!=null&&ot.file&&yS([ot.src]),_(st=>st.filter((wt,Ne)=>Ne!==Se))},Q=async Se=>{if(Se.preventDefault(),F||O)return;const ot=()=>ee();if(u){u({event:Se,submit:ot,state:U});return}ot()},ee=async()=>{if(F||O)return;const Se=H.trim();if(!Se&&!k)return;const ot=T.filter(Ne=>Ne.file).map(Ne=>Ne.file);let wt=T.filter(Ne=>!Ne.file).map(Ne=>({type:"file",url:Ne.src.trim(),mediaType:Ne.mediaType}));if(ot.length>0){P(!0);try{const mt=await async function(Ue){return a?await a({files:Ue}):new Promise((en,he)=>{try{const De={dataTransfer:{files:Ue}};r.Assets.FileUploader().uploadFile(De,({data:Fe})=>{en(Fe)})}catch(De){he(De)}})}(ot),dt=T.filter(Ue=>Ue.file).map(Ue=>Ue.src);wt=[...wt,...mt.map(Ue=>({type:"file",url:Ue.src,mediaType:Ue.mimeType}))],yS(dt)}catch(Ne){const mt=r.t(`${A}.uploadError`);W(Ne instanceof Error?Ne:new Error(mt)),P(!1);return}finally{P(!1)}}D({text:Se,files:wt.length>0?wt:void 0,metadata:{createdAt:Date.now()}}),y(""),_([])},G=Se=>{Se.key==="Enter"&&!Se.shiftKey&&(Se.preventDefault(),Q(Se))};h.useEffect(()=>{x||y(Se=>wS(Se,S)),C("")},[x]);const R=`${hn}__root`,le=`${hn}__actions`,ge=`${hn}__actions-left`,Ee=`${hn}__actions-right`,Ce=`${hn}__submit-btn`,tt=N(`${hn}__textarea gs-utl-w-full`,z.bgTr,Ao.inputText,Pe.noFocusOut,Pe.noResize),Qe=r.t(`${A}.placeholder`),Ot=i==null?void 0:i({state:U}),ut=l==null?void 0:l({state:U});return c.jsxs("form",{onSubmit:Q,className:N(hn,Te.s,te.bt,z.br,e),style:t,children:[Ot&&Jt(r,Ot),c.jsxs(I,{className:N(R,te.b,te.rndLg,z.br,z.bg,Te.s,"gs-utl-relative"),col:!0,gap:"s",children:[O&&c.jsx(Lo,{abs:!0,full:!0,className:z.bgH25}),c.jsx(SH,{editor:r,disabled:F,contextComponents:$.contextComponents,...d}),c.jsx(EH,{value:H,name:"prompt",onChange:Se=>y(Se.target.value),onKeyDown:G,placeholder:Qe,readOnly:x,disabled:F,className:tt,style:{minHeight:40,maxHeight:100},autoResize:!0,...f}),c.jsx(vS,{editor:r,assets:T,onRemove:X,...p}),c.jsxs(I,{className:le,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(I,{className:ge,gap:"s",items:"center",children:c.jsx(wH,{editor:r,disabled:F,maxAssets:o,currentAssetsCount:T.length,acceptAssetType:s,onFilesSelected:J,onAssetSelected:Y,...g})}),c.jsxs(I,{className:Ee,gap:"s",items:"center",children:[c.jsx(xH,{editor:r,disabled:F,onTranscript:C,onListeningChange:E,...m}),c.jsx(Ke,{className:N(Ce,te.pill),size:"s",type:F?"button":"submit",onClick:F?L:void 0,icon:F?q.stop:q.arrowUp,variant:F?"out-clear":"pr",disabled:!V,disabledClassName:Pe.disabledM,...v})]})]})]}),ut&&Jt(r,ut)]})},PH="gs-cmp-ai-chat-loading-state",OH=({className:e,chatContext:t,editor:n,...r})=>c.jsx(I,{className:N(PH,e),items:"center",justify:"center",full:!0,col:!0,...r,children:c.jsx(Lo,{})}),_H="file-refs",SS="gs-cmp-ai-chat-markdown",yt=`${SS}__el`,AH={ul:({children:e})=>c.jsx("ul",{className:`${yt}-ul ${jt.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${yt}-ol ${jt.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${yt}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${yt}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${yt}-h1 ${jt.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${yt}-h2 ${jt.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${yt}-h3 ${jt.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${yt}-h4 ${jt.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${yt}-h5 ${jt.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${yt}-h6 ${jt.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${yt}-a ${Ao.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${yt}-code-inline ${jt.codeInline}`,children:e}):c.jsx("code",{className:`${yt}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${yt}-pre ${jt.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${yt}-blockquote ${jt.blockquote} ${z.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${yt}-hr ${jt.hr} ${z.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${yt}-strong ${jt.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${yt}-em ${jt.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${yt}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${yt}-table ${jt.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${yt}-thead ${jt.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${yt}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${yt}-tr ${jt.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${yt}-th ${jt.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${yt}-td ${jt.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${yt}-checkbox gs-utl-mr-2`,readOnly:!0}),[_H]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function LH(e){return AS.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const MH=h.memo(function({content:t}){return c.jsx(LS,{components:AH,remarkPlugins:[MS],children:t})},(e,t)=>e.content===t.content),CS=h.memo(function({content:t,id:n,className:r}){const o=h.useMemo(()=>LH(t),[t]);return c.jsx("div",{className:`${SS} ${r||""}`,children:o.map((s,a)=>c.jsx(MH,{content:s},`${n}-block_${a}`))})});function zh(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function xS(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const Uh="gs-cmp-ai-chat-message",Da="aiChat.message",NH=h.memo(function({className:t,style:n,message:r,isStreaming:o,showSources:s=!1,editor:a,chatContext:i,layoutBeforeMessage:l,layoutAfterMessage:u,layoutPart:d,layoutPartToolLabel:f,layoutPartToolDetail:p,layoutPartToolResult:g}){const m=r.parts||[],v=m.filter(sr.isFileUIPart),b=m.filter(O=>!sr.isFileUIPart(O)&&(s||!zh(O)&&!xS(O))),w=v.map(O=>({src:O.url,mediaType:O.mediaType??"image/*"})),y=b.length-1,S=r.role==="user",C=N(Uh,`${Uh}--${r.role}`,Te.s,t),x=N(`${Uh}__content gs-utl-break-words`,S?N(z.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Te.xyS,te.rnd):"gs-utl-w-full"),E={editor:a,chatContext:i,message:r},T=l==null?void 0:l(E),_=u==null?void 0:u(E);return c.jsxs(I,{col:!0,gap:"s",className:C,style:n,children:[T&&Jt(a,T),c.jsxs(I,{gap:"s",className:N(x,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((O,P)=>c.jsx($H,{part:O,messageId:r.id,partIndex:P,isStreamingPart:P===y&&o,layoutPart:d,layoutPartToolLabel:f,layoutPartToolDetail:p,layoutPartToolResult:g,layoutProps:E},`${r.id}-part-${P}`)),c.jsx(vS,{editor:a,assets:w,className:"gs-utl-justify-end"})]}),_&&Jt(a,_)]})}),yo="gs-cmp-ai-chat-message-part",$H=h.memo(function({part:t,messageId:n,partIndex:r,isStreamingPart:o,layoutPart:s,layoutPartToolLabel:a,layoutPartToolDetail:i,layoutPartToolResult:l,layoutProps:u}){var d,f;if(s){const p=s({...u,part:t,partIndex:r});if(p)return Jt(u.editor,p)}if(sr.isReasoningUIPart(t)){const{text:p,state:g}=t,m=p==null?void 0:p.trim(),v=o&&g==="streaming",b=`${yo} ${yo}__reasoning`,w=u.editor.t(`${Da}.reasoning`);return!!m&&c.jsx(mo,{className:N(b,z.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(I,{className:N(`${b}-label`,mn.semibold),items:"center",gap:"s",children:[v?c.jsx(Lo,{size:"xs",currentColor:!0}):c.jsx(Ba,{path:u2,size:se.s2x}),c.jsx("div",{children:w})]}),children:c.jsx("div",{className:N(`${b}-text`,z.txtLowEmphasis,vn.xs,mn.italic),children:c.jsx(CS,{id:`${n}-${r}`,content:m})})})}if(sr.isTextUIPart(t)){const p=t.text;if(!p)return null;const g=`${yo} ${yo}__text`;return c.jsx(CS,{content:p,id:`${n}-${r}`,className:g})}if(sr.isToolUIPart(t)){const{type:p,toolCallId:g,input:m="",output:v="",errorText:b}=t,w=p.replace("tool-","").replace("dynamic-",""),y=typeof m=="string"?m:JSON.stringify(m),S=typeof v=="string"?v:JSON.stringify(v),C=typeof t.state=="string"?t.state:void 0,x=C==="output-available",E=!!o&&(C==="input-streaming"||C==="input-available"),T=`${yo}__tool`,_=`${yo}__tool-result`,O=`${T}-detail`,P=N(O,"gs-utl-max-w-full"),A="gs-utl-max-w-full gs-utl-whitespace-normal",M=N(`${O}-info gs-utl-max-h-24 gs-utl-overflow-auto`,A,z.txtLowEmphasis,vn.xs),$=N(`${yo}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,A,z.txtLowEmphasis,vn.xs),j=`${T}-section-label`,L=y&&y!=="{}",D=S&&S!=="{}",W=!!b,F=L||D||W,k=u.editor.t(`${Da}.tool.input`),H=u.editor.t(`${Da}.tool.output`),V=u.editor.t(`${Da}.tool.error`),J=u.editor.t(`${Da}.tools.${w}`,{params:m||{}})||w,X=u.editor.runCommand(pr.getChatManager).tools[w],Q={...u,part:t,partIndex:r,toolName:w,isCompleted:x,isProcessing:E,input:t.input,output:t.output},ee=(a==null?void 0:a(Q))||((d=X==null?void 0:X.layoutToolLabel)==null?void 0:d.call(X,Q)),G=i==null?void 0:i(Q),R=(l==null?void 0:l(Q))||((f=X==null?void 0:X.layoutToolResult)==null?void 0:f.call(X,Q)),le=ee?Jt(u.editor,ee):J,ge=R?Jt(u.editor,R):null,Ee=G?Jt(u.editor,G):c.jsxs(I,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[L&&c.jsxs(I,{className:N(P,`${O}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:k}),c.jsx("pre",{className:M,children:y})]}),D&&c.jsxs(I,{className:N(P,`${O}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:H}),c.jsx("pre",{className:M,children:S})]}),W&&c.jsxs(I,{className:N(P,`${O}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:V}),c.jsx("pre",{className:M,children:b})]})]});return c.jsxs(I,{className:N(`${yo} ${T}`,z.bgH2,te.rnd,Te.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(mo,{disabled:!F&&!G,handler:c.jsxs(I,{className:N(`${T}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${T}-status`,children:x?c.jsx(Ba,{className:`${T}-status-success`,path:ng,size:se.s2x}):E?c.jsx(Lo,{className:`${T}-status-processing`,size:"xs",currentColor:!0}):c.jsx(Ba,{className:`${T}-status-error`,path:rg,size:se.s2x})}),c.jsx("div",{className:N(`${T}-name`,mT.all),children:le})]}),children:Ee}),c.jsx(kH,{toolCallId:g,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:o,className:$}),!!ge&&c.jsx("div",{className:_,children:ge})]})}if(zh(t)||xS(t)){const p=`${yo}__source`,m=zh(t)?t.url:void 0,v=t.title,b=u.editor.t(`${Da}.source.document`),w=v||m||b,y=m?new URL(m).hostname:"",S=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:N(`${p}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:N(`${p}-title`,mn.semibold,vn.sm,"gs-utl-truncate"),children:w}),y&&c.jsx("div",{className:N(`${p}-url`,z.txtLowEmphasis,vn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(Ba,{className:N(`${p}-icon`,z.txtLowEmphasis),path:og,size:se.s2x})]}),C=N(p,z.bgH2,te.rnd,Te.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&Pe.hoverM);return m?c.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:C,children:S}):c.jsx("div",{className:C,children:S})}return null}),kH=h.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:r,className:o}){const[s,a]=h.useState(""),i=h.useRef(null);return h.useEffect(()=>{if(!r||!t){a("");return}const l=n.get(t);l!=null&&l.content&&a(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&a(d.content),d!=null&&d.completed&&(clearInterval(u),a(""))},100);return()=>clearInterval(u)},[t,n,r]),h.useEffect(()=>{i.current&&s&&(i.current.scrollTop=i.current.scrollHeight)},[s]),!s||!r?null:c.jsx("pre",{ref:i,className:o,children:s})}),IH="gs-cmp-ai-chat-messages-status",VH=({className:e,chatContext:t,style:n})=>{const{status:r}=t,o=r==="streaming"||r==="submitted",s=N(z.bgA,Pe.dot,Pe.bounce);return o?c.jsxs(I,{items:"center",gap:"xs",className:N(IH,e,Te.s),style:n,children:[c.jsx("div",{className:s}),c.jsx("div",{className:s,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:s,style:{animationDelay:"0.3s"}})]}):null},Wh="gs-cmp-ai-chat-messages";function HH({editor:e,chatContext:t,messages:n,pluginOptions:r}){const o=h.useRef(null),[s,a]=h.useState(null),{status:i}=t,l=i==="streaming"||i==="submitted",u=N(Wh,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=h.useCallback(({item:g,index:m})=>Td(e,{type:"aiChatMessage",chatContext:t,message:g,isStreaming:l&&m===n.length-1},r),[t,e,l,n.length,r]),f=h.useCallback(()=>({type:"column",className:`${Wh}__footer`,children:Td(e,{type:"aiChatMessagesStatus",chatContext:t},r)}),[t,e,r]),p=g=>{requestAnimationFrame(()=>{s==null||s.scrollToIndex({index:n.length-1,align:"end",behavior:g?"smooth":void 0})})};return h.useEffect(()=>{p(!0)},[n]),h.useEffect(()=>{p()},[s]),c.jsx(I,{ref:o,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?Jt(e,{type:"aiChatEmptyState",chatContext:t},r):Jt(e,{type:"virtualList",className:`${Wh}__list`,itemsPerRow:1,items:n,onRef:a,itemLayout:d,footerLayout:f})})}const ES=h.createContext(void 0),jH=({chatManager:e,children:t})=>{const n=e.currentChatState,r=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(ES.Provider,{value:r,children:t})},DH=()=>h.useContext(ES),FH="gs-cmp-ai-chat-panel";function BH({editor:e,pluginOptions:t,style:n,className:r}){const{chatState:o}=DH(),[,s]=h.useState(0),[a,i]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:f}=o;h.useEffect(()=>o.onUpdate(()=>s(E=>++E)),[]);const p=rn.useChat({chat:o.chat}),{messages:g,sendMessage:m,status:v,setMessages:b,error:w}=p,y=w||a,S=h.useMemo(()=>({id:p.id,messages:g,setMessages:b,sendMessage:m,status:v,stop:()=>(l.forEach(x=>x.abort()),l.clear(),p.stop()),addToolApprovalResponse:p.addToolApprovalResponse,addToolOutput:p.addToolOutput,error:y,setError:x=>i(typeof x=="string"?new Error(x):x),clearError:()=>{p.clearError(),i(void 0)},toolStatusProgress:u,contextComponents:d}),[e,v,g,y]),C=N(FH,r,"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(I,{className:C,style:n,col:!0,nowrap:!0,children:f?c.jsxs(c.Fragment,{children:[Jt(e,{type:"aiChatHeader",chatContext:S},t),c.jsx(HH,{editor:e,chatContext:S,messages:g,pluginOptions:t}),S.error&&Jt(e,{type:"aiChatError",chatContext:S},t),Jt(e,{type:"aiChatInput",chatContext:S},t)]}):Jt(e,{type:"aiChatLoadingState",chatContext:S},t)})}const zH=(e,t,n)=>(e.runCommand(re.layoutComponentAdd,{type:"aiChatPanel",component:r=>({type:"custom",noWrapper:!0,component:()=>c.jsx(jH,{chatManager:n,children:c.jsx(BH,{...r,editor:e,pluginOptions:t})})})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatHeader",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:r5})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatError",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:n5})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatLoadingState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:OH})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatInput",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:TH})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatEmptyState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:t5})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatMessage",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:NH})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatMessagesStatus",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:VH})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(r=>{e.runCommand(re.layoutComponentRemove,{type:r})})}),UH={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"}}}},WH="aiChat",GH=Ys.startup;return nC(function(e,t={}){t.getAccessToken&&(Xt.getAccessToken=t.getAccessToken),_1();const n=new QT(e,t),{Commands:r}=e;r.add(pr.getChatManager,()=>n),r.add(pr.getChatState,()=>n.currentChatState),r.add(pr.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:UH});const o=zH(e,t,n),s=()=>{delete r.commands[pr.getChatManager],delete r.commands[pr.getChatState],delete r.commands[pr.getChatApi],o(),bT()};rC({editor:e,licenseKey:t.licenseKey,plan:GH,pluginName:WH,onLicenseCheckResponse:a=>{a?Xt.license=a:Xt.license=void 0},cleanup:s})})});
388
+ `:void 0};o==="tab"&&(i.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(iS),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(o,{model:{defaults:i}})}};e.on("component:type:add",n)}const QV=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:r})=>r&&n.onLoad())},RV=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:r}=e;r.getConfig().uploadFile=async(...o)=>{const s=o[0],a=await n.handleUpload(s),i=o[1];a&&(i==null||i({data:a}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},eH=()=>{const{baseApiUrl:e}=vv();return`${e}/sdk/projects`},aS=e=>`${eH()}/${e}`,tH=async({licenseKey:e,projectId:t,...n})=>{const r=await Vr.put(aS(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return r==null?void 0:r.result},nH=async(e,t)=>await Vr.put(t,{body:e,headers:{"Content-Type":"application/json"}}),rH=async(e,t,n,r)=>{const o=JSON.stringify(e),s=await tH({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([o]).size},identityId:r,name:e.name,description:e.description});if(!s)throw new Error("Project not found");const{uploadUrl:a}=s;await nH(o,a)},oH=(e,t,n)=>Vr.get(aS(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),sH=async e=>await Vr.get(e),aH=async(e,t,n,r)=>{const o=await oH(t,n,r),s=o==null?void 0:o.result,a=o==null?void 0:o.errorData;if(!s&&(a!=null&&a.notFoundInDb))return{id:n,project:{}};if(!s)throw new Error("Project not found");const{downloadUrl:i}=s,l=await sH(i);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},iH=(e,t)=>{const{appEditorStore:n,toastStore:r,i18nStore:o}=t.appStore.store,{isUsingProjectSelfHosted:s,isUsingProjectCloud:a,sdkOptions:i}=n,l=i.storage||{},{project:u,onLoad:d,onSave:p,autosaveChanges:f,autosaveIntervalMs:g}=l;let m,v,b,w;if(s)b=d,w=p,m=f,v=g;else if(a){const E=i.licenseKey,T=n.sdkProjectId,_=n.sdkIdentityId,O=10,P=1e4;w=({project:A})=>rH(A,E,T,_),b=({editor:A})=>aH(A,E,T,_),m=Math.max(O,f??O),g&&(v=Math.max(P,g))}const{Storage:y,events:S}=e,{events:C}=y;let x=!1;if(e.once(S.projectLoad,E=>{x=!!E.loaded}),e.once("change:readyLoad",()=>{var T;const E=(T=i.project)==null?void 0:T.default;!x&&E&&e.loadProjectData(E)}),e.on(C.startStore,()=>n.setIsSaving(!0)),e.on(C.endStore,()=>n.setIsSaving(!1)),(b||u)&&w){const E="remote";y.setCurrent(E),y.add(E,{async load(){return u||(await b({editor:e})).project},async store(T){await w({project:T,editor:e})}}),e.on(C.errorLoad,T=>{r.addError("storage-error-load",{header:o.t("storageManager.errorLoad"),content:T.message})}),e.on(C.errorStore,T=>{r.addError("storage-error-store",{header:o.t("storageManager.errorStore"),content:T.message})}),m&&y.setStepsBeforeSave(m),v&&e.onReady(()=>{const T=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},v);e.on("destroy",()=>clearInterval(T))})}},$u="select-target",iS="enable-sm";function lH(e,t){var L,D,W,F;const{appStore:n}=t,{appEditorStore:r,blockManagerStore:o,toastStore:s,modalStore:a,layoutStore:i,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:p,nextProjectData:f,sdkOptions:g}=r,m=()=>o.toggleOpen(),v=()=>r.toggleLeftSidebar(),b=()=>r.toggleRightSidebar(),w=e.getConfig(),{Assets:y,Storage:S,Commands:C}=e,x=C.events,E=e.events,T=(D=(L=g.gjsOptions)==null?void 0:L.assetManager)==null?void 0:D.custom;let _=!1;if(y.all.model.prototype.idAttribute="src",Vt(T)&&(y.getConfig().custom=T),f&&(w.projectData=f,r.setNextProjectData()),p){const $=S.getConfig().options;$&&($.local.key=p)}e.on(E.projectLoad,({project:$})=>{var H;n.setProjectDataCustom($.custom||{projectType:(H=r.sdkOptions.project)==null?void 0:H.type}),d.loadFonts()}),e.on(E.projectGet,({project:$})=>{$.custom=Ca(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:O}=e,P=Bo(()=>r.setCanvasPanning(!1),200);e.on(O.events.coords,()=>{r.setCanvasPanning(!0),P()}),e.on(O.events.frameLoad,({el:$})=>{$.tabIndex=-1});const{Parser:A}=e,M=((W=r.sdkOptions.parser)==null?void 0:W.showErrors)!==!1;(F=A.events)!=null&&F.css&&M&&e.on(A.events.css,$=>{const{error:H}=$;if(H){const V=ct(H)?H:H.name&&H.reason?`${H.name}: ${H.reason}`:H.message;s.addError("css-error",{header:"CSS Parser Error",content:V})}}),[{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:$,keys:H,cmd:V})=>{e.Keymaps.add(`preset:${$}`,H,V,{prevent:!0})}),e.on(`${x.runCommand}core:preview`,()=>{r.setPreview(!0),o.setOpen(!1),fb(e,!1)}),e.on(`${x.stopCommand}core:preview`,()=>{r.setPreview(!1),fb(e,!0),setTimeout(()=>{e.refresh()},r.transitionTime)});const k="target-selection",{Components:j}=e;C.add($u,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover($,H){const V={id:k,type:"target",component:H};H?O.addSpot(V):O.removeSpots(V)},beforeSelect($,H={}){H.abort=!0,H.useValid=!1,this.opts.onSelect($),e.stopCommand($u)},run($,H,V){this.opts=V,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),O.removeSpots({id:k}),r.setSelectingTarget(!1)}}),C.add(iS,()=>{r.setSelectedDesignerTab("style")}),C.add(ne.toastAdd,($,H,V)=>{s.add(V.id,V)}),C.add(ne.toastRemove,($,H,V)=>{s.remove(V.id)}),C.add(ne.dialogOpen,($,H,V)=>{a.open(V)}),C.add(ne.dialogClose,()=>{a.close()}),C.add(ne.dialogExportCode,()=>{a.open({title:e.t("actions.showCode.title"),content:()=>{var $,H;return h.createElement(gN,{options:(H=($=g.commands)==null?void 0:$.options)==null?void 0:H[yr.showCode]})}})}),C.add(ne.dialogImportCode,()=>{a.open({title:e.t("actions.importCode.title"),content:()=>h.createElement(pb)})}),C.add(ne.sidebarLeftGet,()=>({visible:r.isLeftSidebarOpen})),C.add(ne.sidebarLeftSet,($,H,V)=>{r.setLeftSidebarOpen(!!V.visible)}),C.add(ne.sidebarLeftToggle,()=>{r.setLeftSidebarOpen(!r.isLeftSidebarOpen)}),C.add(ne.sidebarRightGet,()=>({visible:r.isRightSidebarOpen})),C.add(ne.sidebarRightSet,($,H,V)=>{r.setRightSidebarOpen(!!V.visible)}),C.add(ne.sidebarRightToggle,()=>{r.setRightSidebarOpen(!r.isRightSidebarOpen)}),C.add(ne.sidebarTopGet,()=>({visible:r.isTopSidebarOpen})),C.add(ne.sidebarTopSet,($,H,V)=>{r.setTopSidebarOpen(!!V.visible)}),C.add(ne.sidebarTopToggle,()=>{r.setTopSidebarOpen(!r.isTopSidebarOpen)}),C.add(ne.sidebarBottomGet,()=>({visible:r.isBottomSidebarOpen})),C.add(ne.sidebarBottomSet,($,H,V)=>{r.setBottomSidebarOpen(!!V.visible)}),C.add(ne.sidebarBottomToggle,()=>{r.setBottomSidebarOpen(!r.isBottomSidebarOpen)}),C.add(ne.layoutAdd,($,H,V)=>{V.id&&i.add(V.id,V)}),C.add(ne.layoutRemove,($,H,V)=>{const{id:U,...J}=V;i.remove(U,J)}),C.add(ne.layoutToggle,($,H,V)=>{const{id:U,...J}=V;U&&(i.get(U)?i.remove(U,J):i.add(U,J))}),C.add(ne.layoutUpdate,($,H,V)=>{const U=V;e.runCommand(ne.layoutRemove,{id:U.id,layout:{placer:{...U.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(ne.layoutAdd,{...U}))}),C.add(ne.layoutGet,($,H,V)=>[ur(i.get(V.id))]),C.add(ne.layoutConfigGet,()=>ur(i.customConfig)),C.add(ne.layoutConfigSet,($,H,V)=>{const U=V;i.setCustomConfig(U)}),C.add(ne.layoutComponentAdd,($,H,V)=>{const{type:U,component:J}=V;U&&J&&i.addCustomLayoutComponent(U,J)}),C.add(ne.layoutComponentGet,($,H,V)=>i.getCustomLayoutComponent(V.type)),C.add(ne.layoutComponentRemove,($,H,V)=>{i.removeCustomLayoutComponent(V.type)}),C.add(ne.layoutComponentRender,($,H,V)=>h.createElement(jV,{components:V.components})),C.add(ne.getStateTheme,()=>r.publicStateTheme),C.add(ne.setStateTheme,($,H,V)=>r.setPublicStateTheme(V)),C.add(ne.settings,()=>({baseUrl:r.baseApiUrl,licenseKey:r.licenseKey,license:ur(r.sdkLicense),licenseError:r.sdkLicenseError||void 0,licensePlan:ur(r.licensePlan),loadsInfo:ur(r.loadsInfo)})),C.add(ne.getPagesConfig,()=>r.sdkPagesConfig),C.add(ne.setPagesConfig,($,H,V)=>{const{config:U}=V||{};Vt(U)&&r.setSdkPagesConfig(U)}),C.add(ne.getPageSettings,()=>JSON.parse(JSON.stringify(r.panelPageSettings))),C.add(ne.setPageSettings,($,H,V)=>{r.setPanelPageSettings(V)}),C.add(ne.clearPage,()=>{const $=H=>e.t(`actions.${H}`);a.confirm({title:$("clearCanvas.title"),content:$("clearCanvas.content"),confirmButton:{variant:"danger",children:$("clearCanvas.title")},onConfirm:()=>{F3(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),C.add(ne.projectFiles,($,H,V)=>{var X,Q;const U=(X=r.sdkOptions.dataSources)==null?void 0:X.exportConfig,J=((Q=V.exportConfig)==null?void 0:Q.exportPreset)??U,Y={isMJML:r.isProjectTypeEmail,exportConfig:J,...V};return UV($,Y)}),C.add(ne.validateCode,($,H,V)=>qv({...V,appStore:n})),C.add(ne.getBlocksPanel,()=>({isOpen:o.isOpen})),C.add(ne.setBlocksPanel,($,H,V)=>{const U=V||{};Vt(U.isOpen)&&o.setOpen(U.isOpen)}),C.add(ne.canvasReload,()=>{const $=e.getSelected(),H=O.getCanvasView(),{frames:V}=O.canvas;V.once("loaded:all",()=>{const U=$==null?void 0:$.getView();U&&!U.isInViewport()&&U.el.scrollIntoView({block:"center"})}),H.renderFrames()}),C.add(ne.contextMenuComponent,($,H,V)=>{const{component:U,...J}=V;l.showForComponent(U,J)}),C.add(ne.getStateContextMenu,()=>l.publicState),C.add(ne.setStateContextMenu,($,H,V)=>{l.setPublicState(V)}),C.add(ne.symbolAdd,($,H,V)=>{const U=V.component||e.getSelected();if(U)return j.getSymbolInfo(U).isSymbol?s.add("skip-symbol",{header:"The selected element is already a symbol",variant:sn.Warning}):j.addSymbol(U)}),C.add(ne.symbolDetach,($,H,V)=>{const U=V.component||e.getSelected();U&&j.getSymbolInfo(U).isRoot&&j.detachSymbol(U)}),C.add(ne.symbolOverride,($,H,V)=>{const U=V.component||e.getSelected();U&&(U.setSymbolOverride(V.override),e.Layers.updateLayer(U))}),C.add(ne.symbolPropagateStyles,($,H,V)=>{const U=V.component||e.getSelected();if(!U)return;const{Css:J}=e,Y=J.getComponentRules(U,{current:!0})[0];if(Y){const{state:X,mediaText:Q}=Y.attributes,ee=Y.getStyle();j.getSymbolInfo(U).relatives.forEach(G=>{J.setIdRule(G.getId(),ee,{state:X,mediaText:Q})})}V.deep&&U.components().forEach(X=>e.runCommand(ne.symbolPropagateStyles,{...V,component:X}))}),C.add(ne.assetProviderGet,()=>ur(u.allProviders)),C.add(ne.assetProviderAdd,($,H,{provider:V,index:U})=>{u.addProvider(V,U)}),C.add(ne.assetProviderRemove,($,H,{id:V})=>{const U=u.allProviders.filter(J=>J.id!==V);u.setAllProviders(U)}),C.add(ne.fontGet,()=>ur(d.fonts)),C.add(ne.fontAdd,($,H,{font:V})=>{d.addFont(V)}),C.add(ne.fontRemove,($,H,{family:V})=>{d.removeFont(V)}),C.add(ne.fontManagerOpen,($,H,V)=>{rh($,V)}),C.add(ne.menuFontLoad,($,H,{font:V})=>$p(V,!1)),C.add(ne.toggleStateDataSource,()=>(_=!_,e.trigger(On.toggleDataSourcesPreview,{showPlaceholder:_}),e.refresh({tools:!0}),{showPlaceholder:_})),C.add(ne.getStateDataSource,()=>({showPlaceholder:_})),C.add(ne.dataSourceSetGlobalData,($,H,{globalData:V})=>{const U=ly(V);return e.DataSources.get(js.globalData).setRecords(U)}),C.add(ne.setDragAbsolute,($,H,{enabled:V})=>{r.setIsDraggingAbsolute(!!V)}),C.add(ne.dataSourceSetImporter,($,H,V)=>{e.on(e.Parser.events.htmlBefore,U=>{U.input=V.import(U.input)})}),C.add(ne.dataSourceSetExporter,($,H,V)=>{e.config.optsHtml={...e.config.optsHtml,exporter:V}}),RV(e,t),iH(e,t),QV(e,t),JV(e),WV(e),UM(e),GV(e,t),XV(e,t)}const cH=/\s(?![^(]*\))/,lS=/^-?[0-9]+[a-zA-Z%]{0,}$/;function cS(e){const t=e.split(cH),n=t.indexOf("inset")>=0,r=t.filter(d=>d!=="inset"),o=r.filter(d=>!lS.test(d))[0]||"currentColor",s=r.filter(d=>lS.test(d)),[a="0",i="0",l="0",u="0"]=s;return{x:a,y:i,blur:l,spread:u,inset:n,color:o}}const Iu=["%"],Vu=["s","ms"],Sl=["deg","rad","grad"],eo=["px","%","em","rem","vw","vh"],uS={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},uH=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Hu=e=>({id:e,label:e.split("-").map(_r).join(" ")}),dS=e=>({property:t,to:n})=>{if(n.value){const r=t.getOption(),o=t.getParent().getProperty(e),s=o.getUnit(),a={units:r.units||[],min:r.min,max:r.max,unit:""};(!s||(a==null?void 0:a.units.indexOf(s))<0)&&(a.unit=(a==null?void 0:a.units[0])||""),o.up(a)}},dH=e=>{const t=`${e}-name`,n=`${e}-value`;return(r,{separatorLayers:o})=>{const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=Pu(a);return{[t]:i,[n]:l}}):[]}},pS=e=>{const t={[yl]:e};if(e.indexOf("url(")>-1)t[Qr]=as.Image;else if(e.indexOf("gradient(")>-1){const n=Mh(e),r=n.colorStops,o=n.name.indexOf("linear")>=0;r.length===2&&o&&r[0].color===r[1].color?t[Qr]=as.Color:t[Qr]=as.Gradient}else t[Qr]=as.Color,t[yl]=uH(e);return t},fS=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(r,{separatorLayers:o}){const s=r[e]||"";return s?s.split(o).map(a=>{const{name:i,value:l}=Pu(a);return{[t]:i,[n]:l}}):[]},toStyle(r,{name:o}){return{[o]:`${r[t]}(${r[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:dS(n)},{property:n,type:"integer"}]}},ju=(e,{x:t,y:n,mergable:r}={})=>{const o={property:`${e}-x`,type:"integer",units:eo,...t},s={property:`${e}-y`,type:"integer",units:eo,...n};return{property:e,type:"composite",properties:[o,s],...r&&{fromStyle(a,{name:i,separator:l,property:u}){const[d,p]=u.getProperties(),[f,g]=(a[i]||"").split(l);return{[d.getId()]:a[d.getName()]||f||"",[p.getId()]:a[p.getName()]||g||f||""}},toStyle(a,{name:i,property:l}){const[u,d]=l.getProperties(),p=a[u.getId()],f=a[d.getId()];return{[i]:p===f?p:`${p} ${f}`}}}}},pH=(e,t="")=>{const n=`${e}-name`,r=`${e}-value`;return(o,{name:s})=>({[s]:`${o[n]}(${o[r]||t})`})};["top","middle","bottom"].map(Hu),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Hu),["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"})),ju("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Hu),GS("(?<!\\(.*[^)]),(?![^()]*\\))"),as.Image,as.Gradient,as.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:eo,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:eo,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:eo})),["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"})),ju("overflow",{x:uS,y:uS,mergable:!0}),fS(),fS("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(Hu),Vu[0],Vu[0],dH("transform"),pH("transform","0"),dS("transform-value"),ju("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),ju("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function hS(e,t){return[n=>JM(n,t),...XM[e],n=>lH(n,t),qM(e,t)]}class fH{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,an(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const r=(yield gH()).filter(o=>o.projectType.includes(t));this.setProjectPlugins(r)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const r=[...hS(t,{appStore:n}),...this.projectPlugins||[]],o=n.sdkOptions.plugins||[];return et(o)?o({plugins:r}):[...r,...o]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;r.includes(o)?this.pendingUninstalled=r.filter(s=>s!==o):n.includes(o)||n.push(o)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,o=t.id;n.includes(o)?this.pendingInstalled=n.filter(s=>s!==o):r.push(o)}setSelectedShown(t){this.selectedShown=t}}const hH={db:Um.gjsStudio},gH=()=>new Promise(async e=>{let t=[];try{t=await c3(vc.Settings,"plugins",hH)||[]}catch(n){Or()&&console.error(n)}e(t)}),mH=h.createContext(void 0);class vH{constructor(t){this.blockManagerStore=new f4(this),this.appEditorStore=new Y3(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new bL(t==null?void 0:t.localSettingsStore),this.toastStore=new p4(this),this.modalStore=new yL(this),this.i18nStore=new a4(this),this.pluginStore=new fH(this),this.pointerBadgeStore=new u4(this),this.contextMenu=new bH(this),this.layoutStore=new l4(this),this.templatesStore=new d4(this),this.assetsStore=new o4(this),this.globalStylesStore=new hL(this),this.fontsStore=new s4(this),this.appEditorStore.init(),Uu()&&(window.__gjss=this)}}const Tn=()=>{const e=h.useContext(mH);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},Fh=()=>{throw new Error("Store has not been initialized")};class bH{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=Ss(function*(n,r={}){var w;if(!(n!=null&&n.em))return[];const o=n.em.getEditor(),{isSymbol:s,isRoot:a}=o.Components.getSymbolInfo(n),i=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),p=[u&&{id:jo.selectParent,icon:q.arrowUp,label:"Select parent",onClick:()=>{o.runCommand("core:component-exit",{force:!0})}},d&&{id:jo.duplicate,icon:q.contentCopy,label:"Duplicate",onClick:()=>{o.runCommand("tlb-clone")}},!s&&l&&{id:jo.symbolCreate,icon:q.rhombusSplit,label:"Create Symbol",onClick:()=>{o.runCommand(ne.symbolAdd)}},s&&a&&{id:jo.symbolDetach,icon:q.alertRhombus,label:"Detach instance",onClick:()=>{o.runCommand(ne.symbolDetach)}},s&&!i&&{id:jo.symbolOverride,icon:q.rhombusOutline,label:"Make overridable",onClick:()=>{o.runCommand(ne.symbolOverride,{override:!0})}},s&&i&&{id:jo.symbolOverrideClear,icon:q.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{o.runCommand(ne.symbolOverride)}},l&&{id:jo.delete,icon:q.delete,label:"Delete",onClick:()=>{o.runCommand("core:component-delete")}}].filter(Boolean),f=n.get("contextMenu"),g={...r,items:p,component:n,editor:o,type:n.get("type")||"default",source:r.source||Np.canvas},m=yield gS(f,g),v=(w=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:w.contextMenu;return yield gS(v,{...g,items:m})}),this.store=t,an(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const r=t==null?void 0:t.em;if(!r)return;n.skipSelect||r.selected.hasComponent(t)||r.setSelected(t);const o=yield this.getItemsForComponent(t,n);o.length&&this.show({...n,items:o})}show({items:t,x:n,y:r,w:o,h:s}){this.isOpen=!0,this.coordinates={x:n,y:r,w:o,h:s},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const gS=async(e,t)=>et(e)?(await e(t)).filter(Boolean):t.items,yH=()=>Tn().contextMenu,mS=Or()&&document.body,Bh=(e={})=>({...af,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??mS}},{name:"preventOverflow",options:{boundary:e.boundary??mS}}]}),wH=Bh(),Du="gs-ctx-menu-list",SH=ce(function({onItemClick:t,open:n,items:r,x:o,y:s,w:a,h:i,className:l}){const u=yH(),[d,p]=h.useState(),[f,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(o,s,a,i)}),[o,s,a,i,n]),{styles:v,attributes:b}=Si(m,f,wH),w=N(`${Du}-wrp gs-utl-z-20`,l),y=N(`${Du} gs-utl-z-20`),S=N(`${Du}-body gs-utl-max-w-56`),C=N(`${Du}-item`),x="gs-utl-max-w-40",E=T=>{const{action:_,onClick:O}=T;if(_||O)return P=>{const A={editor:u.store.appEditorStore.editor,...P};et(_)?(_(A),u.hide()):et(O)&&(O(A),u.hide())}};return c.jsx("div",{className:w,ref:g,style:v.popper,...b.popper,children:c.jsx(gp,{show:!!n,...yT,unmount:!1,children:c.jsx(Jn,{padding:!1,className:y,classNameBody:S,children:r.map((T,_)=>h.createElement(Oa,{onItemClick:t,...T,key:T.id??_,className:C,classNameLabel:x,action:E(T),onActive:()=>p(T),active:d===T}))})})})}),zh="gs-cmp-tooltip";function Ut({className:e,classNameWrp:t,classNameContent:n,strategy:r,placement:o="bottom",children:s,title:a,onClick:i,inline:l,size:u}){const[d,p]=h.useState(!1),[f,g]=h.useState(!1),m=Vt(u),[v,b]=h.useState(null),[w,y]=h.useState(null),S=Si(v,w,{...Bh(),placement:o,...r?{strategy:r}:{}});h.useEffect(()=>{var E;d&&((E=S.update)==null||E.call(S))},[d,S.update]),h.useEffect(()=>{const E=setTimeout(()=>p(f),10);return()=>clearTimeout(E)},[f]);const C=N(`${zh}-target`,!l&&"gs-utl-block",e,!i&&"gs-utl-cursor-auto"),x=N(`${zh}-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:N(zh,"gs-utl-relative",t),children:[c.jsx("span",{ref:b,className:C,onMouseEnter:()=>a&&g(!0),onMouseLeave:()=>g(!1),children:c.jsx("div",{className:N(l&&"gs-utl-inline-block"),onClick:()=>{g(!1),i==null||i()},children:s})}),!!f&&c.jsx("div",{className:x,ref:y,style:S.styles.popper,...S.attributes.popper,children:c.jsx(gp,{show:!!d,unmount:!1,...S1,children:c.jsx(Jn,{className:C1.txt,bg:C1.bg,size:"s",border:!1,children:a})})})]})}function Ct({children:e,title:t,classNameWrp:n,tooltipProps:r,...o}){return c.jsx(Ut,{title:t,classNameWrp:n,...r,children:c.jsx(Ke,{...o,children:e})})}const Da="gs-cmp-ai-chat-assets",CH=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},xH=e=>e.mediaType==="application/pdf",vS=({editor:e,assets:t,className:n,onRemove:r,style:o})=>{const s=`${Da}__asset-item`,a=N(`${Da}__asset-image`,"gs-utl-object-cover",te.rnd,Gl.m),i=N(`${Da}__asset-pdf`,"gs-utl-overflow-hidden",te.rnd,Gl.m),l=N(`${Da}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",te.rnd,Gl.m,z.bgH2),u=N(`${Da}__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",Gl.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 CH(f)?c.jsx("img",{src:f.src,alt:v,className:a}):xH(f)?c.jsx("iframe",{src:f.src,title:b,className:i}):c.jsx("div",{className:l,children:c.jsx(re,{icon:RC,size:se.l})})};return c.jsx(I,{className:N(Da,n),gap:"xs",wrap:"wrap",style:o,children:t.map((f,g)=>c.jsxs("div",{className:N(s,"gs-utl-relative gs-utl-inline-block"),children:[p(f,g),r&&c.jsx(Ct,{title:e.t(`${d}.remove`),icon:{icon:q.close,size:se.s3x},onClick:()=>r(g),size:"x2s",border:!1,className:u})]},f.src))})},gn="gs-cmp-ai-chat-input",EH=e=>{const{className:t,style:n,editor:r,disabled:o,maxAssets:s,currentAssetsCount:a,acceptAssetType:i,onFilesSelected:l,onAssetSelected:u}=e,d=h.useRef(null);if(s<=0)return null;const p=`${gn}__attach-btn`,f=`${gn}__file-input`,g=a>=s,m="aiChat.input.attach",v=r.t(`${m}.upload`),b=r.t(`${m}.selectFromAssets`),w=r.t(`${m}.title`),y=r.t(`${m}.maxAssets`,{params:{count:s}}),S=x=>{const E=Array.from(x.target.files||[]);E.length>0&&l(E),d.current&&(d.current.value="")},C=x=>{if(!r||g)return;const E="btnAttachImages",T=()=>r.runCommand(ne.layoutRemove,{id:E});r.runCommand(ne.layoutToggle,{id:E,header:!1,placer:{type:"popover",target:x.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:T,items:[{id:"upload",label:v,icon:q.trayArrowDown,onClick:()=>{var _;return(_=d.current)==null?void 0:_.click()}},{id:"assets",label:b,icon:c2,onClick:()=>{r.Assets.open({onSelect:({asset:_})=>{const O=_.getSrc();O&&u(O)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:i,multiple:!0,onChange:S,className:f,style:{display:"none"}}),c.jsx(Ct,{className:N(p,te.pill,t),style:n,title:g?y:w,icon:q.plus,border:!1,onClick:C,disabled:o||g,size:"s",block:!0})]})},TH=({editor:e,className:t,style:n,contextComponents:r,disabled:o})=>{const[s,a]=h.useState(()=>e.getSelectedAll()),i="aiChat.input.context";h.useEffect(()=>{const y=e.Components.events.select,S=()=>a(e.getSelectedAll());return e.on(y,S),()=>{e.off(y,S)}},[e]),h.useEffect(()=>{r.clear(),s.forEach(y=>r.add(y))},[s,r]);const l=()=>a([]);if(s.length===0)return null;const u=`${gn}__context`,d=`${gn}__context-icon`,p=`${gn}__context-badge`,f=`${gn}__context-name`,g=`${gn}__context-divider`,m=s.length===1,v=s[0],b=e.t(`${i}.multiple`,{params:{count:s.length}}),w=m?v.getName():b;return c.jsxs(I,{className:N(u,o&&Oe.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(re,{icon:q.target,size:se.sx,className:N(d,z.txtLowEmphasis)}),c.jsx(Zo,{className:N(p,P1(v).bg,Pe.xyS2),s:"s",children:c.jsxs(I,{gap:"xs",items:"center",nowrap:!0,children:[m&&lv(v),c.jsx("div",{className:N(f,Oe.txtEllips,"gs-utl-max-w-36"),children:w}),!o&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N(g,te.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(Ct,{title:e.t(`${i}.clear`),icon:{icon:q.close,size:se.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function bS(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function PH(){const[e,t]=h.useState(""),[n,r]=h.useState(!1),[o,s]=h.useState(!1),a=h.useRef();h.useEffect(()=>s(!!bS()),[]);const i=()=>{const u=bS();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>r(!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()},a.current=d,d.start()},l=()=>{var u;(u=a.current)==null||u.stop(),r(!1)};return{transcript:e,isSupported:o,isListening:n,start:i,stop:l}}const OH=({editor:e,disabled:t,onTranscript:n,onListeningChange:r,className:o,style:s})=>{const a=`${gn}__dictate`,{transcript:i,isSupported:l,isListening:u,start:d,stop:p}=PH(),f="aiChat.input.dictate",g=e.t(`${f}.start`),m=e.t(`${f}.stop`),v=u?m:g;return h.useEffect(()=>{i&&n(i)},[i]),h.useEffect(()=>{r==null||r(u)},[u]),l?c.jsx(Ct,{block:!0,size:"s",border:!1,className:N(a,te.pill,o),style:s,title:v,disabled:t,icon:u?S2:w2,onClick:u?p:d,variant:u?"danger":"out-clear"}):null},_H=({autoResize:e,autoFocus:t,style:n={},...r})=>{const o=h.useRef(null);return h.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[r.value,e]),h.useEffect(()=>{const s=o.current;if(s&&t){const a=setTimeout(()=>s==null?void 0:s.focus(),150);return()=>clearTimeout(a)}},[o.current,t]),c.jsx("textarea",{ref:o,style:{...n,...e?{resize:"none"}:{}},...r})},yS=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},wS=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,AH=({className:e,style:t,chatContext:n,editor:r,maxAssets:o=5,acceptAssetType:s="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:a,layoutBefore:i,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:p,assetsSectionProps:f,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:v,value:b})=>{const[w,y]=h.useState(b||""),[S,C]=h.useState(""),[x,E]=h.useState(!1),[T,_]=h.useState([]),[O,P]=h.useState(!1),A="aiChat.input",M=r.runCommand(gr.getChatApi),k=r.runCommand(gr.getChatState),{status:j,stop:L,sendMessage:D,setError:W}=n||M,F=j==="streaming"||j==="submitted",$=T.length>0,H=S?wS(w,S):w,V=!O&&(F||H.trim()||$),U={input:H,assets:T},J=Se=>{const ot=o-T.length,st=Se.slice(0,ot);if(st.length===0)return;const wt=st.map(Ne=>({src:URL.createObjectURL(Ne),file:Ne,mediaType:Ne.type}));_(Ne=>[...Ne,...wt])},Y=Se=>{T.length>=o||_(ot=>[...ot,{src:Se,mediaType:"image/*"}])},X=Se=>{const ot=T[Se];ot!=null&&ot.file&&yS([ot.src]),_(st=>st.filter((wt,Ne)=>Ne!==Se))},Q=async Se=>{if(Se.preventDefault(),F||O)return;const ot=()=>ee();if(u){u({event:Se,submit:ot,state:U});return}ot()},ee=async()=>{if(F||O)return;const Se=H.trim();if(!Se&&!$)return;const ot=T.filter(Ne=>Ne.file).map(Ne=>Ne.file);let wt=T.filter(Ne=>!Ne.file).map(Ne=>({type:"file",url:Ne.src.trim(),mediaType:Ne.mediaType}));if(ot.length>0){P(!0);try{const mt=await async function(Ue){return a?await a({files:Ue}):new Promise((tn,he)=>{try{const De={dataTransfer:{files:Ue}};r.Assets.FileUploader().uploadFile(De,({data:Fe})=>{tn(Fe)})}catch(De){he(De)}})}(ot),dt=T.filter(Ue=>Ue.file).map(Ue=>Ue.src);wt=[...wt,...mt.map(Ue=>({type:"file",url:Ue.src,mediaType:Ue.mimeType}))],yS(dt)}catch(Ne){const mt=r.t(`${A}.uploadError`);W(Ne instanceof Error?Ne:new Error(mt)),P(!1);return}finally{P(!1)}}D({text:Se,files:wt.length>0?wt:void 0,metadata:{createdAt:Date.now()}}),y(""),_([])},G=Se=>{Se.key==="Enter"&&!Se.shiftKey&&(Se.preventDefault(),Q(Se))};h.useEffect(()=>{x||y(Se=>wS(Se,S)),C("")},[x]);const R=`${gn}__root`,le=`${gn}__actions`,ge=`${gn}__actions-left`,Te=`${gn}__actions-right`,Ce=`${gn}__submit-btn`,tt=N(`${gn}__textarea gs-utl-w-full`,z.bgTr,Lo.inputText,Oe.noFocusOut,Oe.noResize),Qe=r.t(`${A}.placeholder`),Ot=i==null?void 0:i({state:U}),ut=l==null?void 0:l({state:U});return c.jsxs("form",{onSubmit:Q,className:N(gn,Pe.s,te.bt,z.br,e),style:t,children:[Ot&&Qt(r,Ot),c.jsxs(I,{className:N(R,te.b,te.rndLg,z.br,z.bg,Pe.s,"gs-utl-relative"),col:!0,gap:"s",children:[O&&c.jsx(Mo,{abs:!0,full:!0,className:z.bgH25}),c.jsx(TH,{editor:r,disabled:F,contextComponents:k.contextComponents,...d}),c.jsx(_H,{value:H,name:"prompt",onChange:Se=>y(Se.target.value),onKeyDown:G,placeholder:Qe,readOnly:x,disabled:F,className:tt,style:{minHeight:40,maxHeight:100},autoResize:!0,...p}),c.jsx(vS,{editor:r,assets:T,onRemove:X,...f}),c.jsxs(I,{className:le,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(I,{className:ge,gap:"s",items:"center",children:c.jsx(EH,{editor:r,disabled:F,maxAssets:o,currentAssetsCount:T.length,acceptAssetType:s,onFilesSelected:J,onAssetSelected:Y,...g})}),c.jsxs(I,{className:Te,gap:"s",items:"center",children:[c.jsx(OH,{editor:r,disabled:F,onTranscript:C,onListeningChange:E,...m}),c.jsx(Ke,{className:N(Ce,te.pill),size:"s",type:F?"button":"submit",onClick:F?L:void 0,icon:F?q.stop:q.arrowUp,variant:F?"out-clear":"pr",disabled:!V,disabledClassName:Oe.disabledM,...v})]})]})]}),ut&&Qt(r,ut)]})},LH="gs-cmp-ai-chat-loading-state",MH=({className:e,chatContext:t,editor:n,...r})=>c.jsx(I,{className:N(LH,e),items:"center",justify:"center",full:!0,col:!0,...r,children:c.jsx(Mo,{})}),NH="file-refs",SS="gs-cmp-ai-chat-markdown",yt=`${SS}__el`,kH={ul:({children:e})=>c.jsx("ul",{className:`${yt}-ul ${Ht.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${yt}-ol ${Ht.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${yt}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${yt}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${yt}-h1 ${Ht.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${yt}-h2 ${Ht.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${yt}-h3 ${Ht.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${yt}-h4 ${Ht.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${yt}-h5 ${Ht.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${yt}-h6 ${Ht.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${yt}-a ${Lo.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${yt}-code-inline ${Ht.codeInline}`,children:e}):c.jsx("code",{className:`${yt}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${yt}-pre ${Ht.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${yt}-blockquote ${Ht.blockquote} ${z.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${yt}-hr ${Ht.hr} ${z.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${yt}-strong ${Ht.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${yt}-em ${Ht.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${yt}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${yt}-table ${Ht.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${yt}-thead ${Ht.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${yt}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${yt}-tr ${Ht.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${yt}-th ${Ht.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${yt}-td ${Ht.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${yt}-checkbox gs-utl-mr-2`,readOnly:!0}),[NH]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function $H(e){return LS.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const IH=h.memo(function({content:t}){return c.jsx(MS,{components:kH,remarkPlugins:[NS],children:t})},(e,t)=>e.content===t.content),CS=h.memo(function({content:t,id:n,className:r}){const o=h.useMemo(()=>$H(t),[t]);return c.jsx("div",{className:`${SS} ${r||""}`,children:o.map((s,a)=>c.jsx(IH,{content:s},`${n}-block_${a}`))})});function Uh(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function xS(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const Wh="gs-cmp-ai-chat-message",Fa="aiChat.message",VH=h.memo(function({className:t,style:n,message:r,isStreaming:o,showSources:s=!1,editor:a,chatContext:i,layoutBeforeMessage:l,layoutAfterMessage:u,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:g}){const m=r.parts||[],v=m.filter(ar.isFileUIPart),b=m.filter(O=>!ar.isFileUIPart(O)&&(s||!Uh(O)&&!xS(O))),w=v.map(O=>({src:O.url,mediaType:O.mediaType??"image/*"})),y=b.length-1,S=r.role==="user",C=N(Wh,`${Wh}--${r.role}`,Pe.s,t),x=N(`${Wh}__content gs-utl-break-words`,S?N(z.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Pe.xyS,te.rnd):"gs-utl-w-full"),E={editor:a,chatContext:i,message:r},T=l==null?void 0:l(E),_=u==null?void 0:u(E);return c.jsxs(I,{col:!0,gap:"s",className:C,style:n,children:[T&&Qt(a,T),c.jsxs(I,{gap:"s",className:N(x,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((O,P)=>c.jsx(HH,{part:O,messageId:r.id,partIndex:P,isStreamingPart:P===y&&o,layoutPart:d,layoutPartToolLabel:p,layoutPartToolDetail:f,layoutPartToolResult:g,layoutProps:E},`${r.id}-part-${P}`)),c.jsx(vS,{editor:a,assets:w,className:"gs-utl-justify-end"})]}),_&&Qt(a,_)]})}),So="gs-cmp-ai-chat-message-part",HH=h.memo(function({part:t,messageId:n,partIndex:r,isStreamingPart:o,layoutPart:s,layoutPartToolLabel:a,layoutPartToolDetail:i,layoutPartToolResult:l,layoutProps:u}){var d,p;if(s){const f=s({...u,part:t,partIndex:r});if(f)return Qt(u.editor,f)}if(ar.isReasoningUIPart(t)){const{text:f,state:g}=t,m=f==null?void 0:f.trim(),v=o&&g==="streaming",b=`${So} ${So}__reasoning`,w=u.editor.t(`${Fa}.reasoning`);return!!m&&c.jsx(bo,{className:N(b,z.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(I,{className:N(`${b}-label`,vn.semibold),items:"center",gap:"s",children:[v?c.jsx(Mo,{size:"xs",currentColor:!0}):c.jsx(za,{path:f2,size:se.s2x}),c.jsx("div",{children:w})]}),children:c.jsx("div",{className:N(`${b}-text`,z.txtLowEmphasis,bn.xs,vn.italic),children:c.jsx(CS,{id:`${n}-${r}`,content:m})})})}if(ar.isTextUIPart(t)){const f=t.text;if(!f)return null;const g=`${So} ${So}__text`;return c.jsx(CS,{content:f,id:`${n}-${r}`,className:g})}if(ar.isToolUIPart(t)){const{type:f,toolCallId:g,input:m="",output:v="",errorText:b}=t,w=f.replace("tool-","").replace("dynamic-",""),y=typeof m=="string"?m:JSON.stringify(m),S=typeof v=="string"?v:JSON.stringify(v),C=typeof t.state=="string"?t.state:void 0,x=C==="output-available",E=!!o&&(C==="input-streaming"||C==="input-available"),T=`${So}__tool`,_=`${So}__tool-result`,O=`${T}-detail`,P=N(O,"gs-utl-max-w-full"),A="gs-utl-max-w-full gs-utl-whitespace-normal",M=N(`${O}-info gs-utl-max-h-24 gs-utl-overflow-auto`,A,z.txtLowEmphasis,bn.xs),k=N(`${So}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,A,z.txtLowEmphasis,bn.xs),j=`${T}-section-label`,L=y&&y!=="{}",D=S&&S!=="{}",W=!!b,F=L||D||W,$=u.editor.t(`${Fa}.tool.input`),H=u.editor.t(`${Fa}.tool.output`),V=u.editor.t(`${Fa}.tool.error`),J=u.editor.t(`${Fa}.tools.${w}`,{params:m||{}})||w,X=u.editor.runCommand(gr.getChatManager).tools[w],Q={...u,part:t,partIndex:r,toolName:w,isCompleted:x,isProcessing:E,input:t.input,output:t.output},ee=(a==null?void 0:a(Q))||((d=X==null?void 0:X.layoutToolLabel)==null?void 0:d.call(X,Q)),G=i==null?void 0:i(Q),R=(l==null?void 0:l(Q))||((p=X==null?void 0:X.layoutToolResult)==null?void 0:p.call(X,Q)),le=ee?Qt(u.editor,ee):J,ge=R?Qt(u.editor,R):null,Te=G?Qt(u.editor,G):c.jsxs(I,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[L&&c.jsxs(I,{className:N(P,`${O}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:$}),c.jsx("pre",{className:M,children:y})]}),D&&c.jsxs(I,{className:N(P,`${O}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:H}),c.jsx("pre",{className:M,children:S})]}),W&&c.jsxs(I,{className:N(P,`${O}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:j,children:V}),c.jsx("pre",{className:M,children:b})]})]});return c.jsxs(I,{className:N(`${So} ${T}`,z.bgH2,te.rnd,Pe.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(bo,{disabled:!F&&!G,handler:c.jsxs(I,{className:N(`${T}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${T}-status`,children:x?c.jsx(za,{className:`${T}-status-success`,path:ng,size:se.s2x}):E?c.jsx(Mo,{className:`${T}-status-processing`,size:"xs",currentColor:!0}):c.jsx(za,{className:`${T}-status-error`,path:rg,size:se.s2x})}),c.jsx("div",{className:N(`${T}-name`,wT.all),children:le})]}),children:Te}),c.jsx(jH,{toolCallId:g,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:o,className:k}),!!ge&&c.jsx("div",{className:_,children:ge})]})}if(Uh(t)||xS(t)){const f=`${So}__source`,m=Uh(t)?t.url:void 0,v=t.title,b=u.editor.t(`${Fa}.source.document`),w=v||m||b,y=m?new URL(m).hostname:"",S=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:N(`${f}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:N(`${f}-title`,vn.semibold,bn.sm,"gs-utl-truncate"),children:w}),y&&c.jsx("div",{className:N(`${f}-url`,z.txtLowEmphasis,bn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(za,{className:N(`${f}-icon`,z.txtLowEmphasis),path:og,size:se.s2x})]}),C=N(f,z.bgH2,te.rnd,Pe.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&Oe.hoverM);return m?c.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:C,children:S}):c.jsx("div",{className:C,children:S})}return null}),jH=h.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:r,className:o}){const[s,a]=h.useState(""),i=h.useRef(null);return h.useEffect(()=>{if(!r||!t){a("");return}const l=n.get(t);l!=null&&l.content&&a(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&a(d.content),d!=null&&d.completed&&(clearInterval(u),a(""))},100);return()=>clearInterval(u)},[t,n,r]),h.useEffect(()=>{i.current&&s&&(i.current.scrollTop=i.current.scrollHeight)},[s]),!s||!r?null:c.jsx("pre",{ref:i,className:o,children:s})}),DH="gs-cmp-ai-chat-messages-status",FH=({className:e,chatContext:t,style:n})=>{const{status:r}=t,o=r==="streaming"||r==="submitted",s=N(z.bgA,Oe.dot,Oe.bounce);return o?c.jsxs(I,{items:"center",gap:"xs",className:N(DH,e,Pe.s),style:n,children:[c.jsx("div",{className:s}),c.jsx("div",{className:s,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:s,style:{animationDelay:"0.3s"}})]}):null},Gh="gs-cmp-ai-chat-messages";function BH({editor:e,chatContext:t,messages:n,pluginOptions:r}){const o=h.useRef(null),[s,a]=h.useState(null),{status:i}=t,l=i==="streaming"||i==="submitted",u=N(Gh,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=h.useCallback(({item:g,index:m})=>Pd(e,{type:"aiChatMessage",chatContext:t,message:g,isStreaming:l&&m===n.length-1},r),[t,e,l,n.length,r]),p=h.useCallback(()=>({type:"column",className:`${Gh}__footer`,children:Pd(e,{type:"aiChatMessagesStatus",chatContext:t},r)}),[t,e,r]),f=g=>{requestAnimationFrame(()=>{s==null||s.scrollToIndex({index:n.length-1,align:"end",behavior:g?"smooth":void 0})})};return h.useEffect(()=>{f(!0)},[n]),h.useEffect(()=>{f()},[s]),c.jsx(I,{ref:o,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?Qt(e,{type:"aiChatEmptyState",chatContext:t},r):Qt(e,{type:"virtualList",className:`${Gh}__list`,itemsPerRow:1,items:n,onRef:a,itemLayout:d,footerLayout:p})})}const ES=h.createContext(void 0),zH=({chatManager:e,children:t})=>{const n=e.currentChatState,r=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(ES.Provider,{value:r,children:t})},UH=()=>h.useContext(ES),WH="gs-cmp-ai-chat-panel";function GH({editor:e,pluginOptions:t,style:n,className:r}){const{chatState:o}=UH(),[,s]=h.useState(0),[a,i]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:p}=o;h.useEffect(()=>o.onUpdate(()=>s(E=>++E)),[]);const f=on.useChat({chat:o.chat}),{messages:g,sendMessage:m,status:v,setMessages:b,error:w}=f,y=w||a,S=h.useMemo(()=>({id:f.id,messages:g,setMessages:b,sendMessage:m,status:v,stop:()=>(l.forEach(x=>x.abort()),l.clear(),f.stop()),addToolApprovalResponse:f.addToolApprovalResponse,addToolOutput:f.addToolOutput,error:y,setError:x=>i(typeof x=="string"?new Error(x):x),clearError:()=>{f.clearError(),i(void 0)},toolStatusProgress:u,contextComponents:d}),[e,v,g,y]),C=N(WH,r,"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(I,{className:C,style:n,col:!0,nowrap:!0,children:p?c.jsxs(c.Fragment,{children:[Qt(e,{type:"aiChatHeader",chatContext:S},t),c.jsx(BH,{editor:e,chatContext:S,messages:g,pluginOptions:t}),S.error&&Qt(e,{type:"aiChatError",chatContext:S},t),Qt(e,{type:"aiChatInput",chatContext:S},t)]}):Qt(e,{type:"aiChatLoadingState",chatContext:S},t)})}const qH=(e,t,n)=>(e.runCommand(ne.layoutComponentAdd,{type:"aiChatPanel",component:r=>({type:"custom",noWrapper:!0,component:()=>c.jsx(zH,{chatManager:n,children:c.jsx(GH,{...r,editor:e,pluginOptions:t})})})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatHeader",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:i5})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatError",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:a5})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatLoadingState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:MH})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatInput",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:AH})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatEmptyState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:s5})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatMessage",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:VH})}),e.runCommand(ne.layoutComponentAdd,{type:"aiChatMessagesStatus",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:FH})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(r=>{e.runCommand(ne.layoutComponentRemove,{type:r})})}),KH={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"}}}},ZH="aiChat",YH=Xs.startup;return oC(function(e,t={}){t.getAccessToken&&(Jt.getAccessToken=t.getAccessToken),_1();const n=new n5(e,t),{Commands:r}=e;r.add(gr.getChatManager,()=>n),r.add(gr.getChatState,()=>n.currentChatState),r.add(gr.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:KH});const o=qH(e,t,n),s=()=>{delete r.commands[gr.getChatManager],delete r.commands[gr.getChatState],delete r.commands[gr.getChatApi],o(),CT()};sC({editor:e,licenseKey:t.licenseKey,plan:YH,pluginName:ZH,onLicenseCheckResponse:a=>{a?Jt.license=a:Jt.license=void 0},cleanup:s})})});