@grapesjs/studio-sdk-plugins 1.0.34 → 1.0.35
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.
- package/dist/aiChat/clientTools.d.ts +3 -3
- package/dist/aiChat/clientToolsProcessors.d.ts +5 -2
- package/dist/aiChat/components/AiChatHeader.d.ts +22 -2
- package/dist/aiChat/components/AiChatToolGenerateImage.d.ts +7 -0
- package/dist/aiChat/components/utils.d.ts +2 -0
- package/dist/aiChat/index.cjs.js +88 -99
- package/dist/aiChat/index.es.js +12677 -11001
- package/dist/aiChat/index.js +88 -99
- package/dist/aiChat/index.umd.js +97 -108
- package/dist/aiChat/locales/en.d.ts +38 -0
- package/dist/aiChat/server/index.cjs.js +91 -237
- package/dist/aiChat/server/index.es.js +721 -631
- package/dist/aiChat/server/index.js +91 -237
- package/dist/aiChat/server/index.umd.js +91 -237
- package/dist/aiChat/server/prompts.d.ts +15 -11
- package/dist/aiChat/server/tools.d.ts +74 -122
- package/dist/aiChat/server/types.d.ts +61 -3
- package/dist/aiChat/types.d.ts +69 -11
- package/dist/aiChat/typesSchema.d.ts +27 -0
- package/dist/googleFontsAssetProvider/index.cjs.js +1 -1
- package/dist/googleFontsAssetProvider/index.es.js +11 -11
- package/dist/googleFontsAssetProvider/index.umd.js +1 -1
- package/dist/iconifyComponent/index.cjs.js +2 -2
- package/dist/iconifyComponent/index.es.js +11 -11
- package/dist/iconifyComponent/index.umd.js +2 -2
- package/dist/index.cjs.js +20 -20
- package/dist/index.es.js +208 -208
- package/dist/index.umd.js +1 -1
- package/dist/layoutSidebarButtons/index.cjs.js +1 -1
- package/dist/layoutSidebarButtons/index.es.js +7 -7
- package/dist/layoutSidebarButtons/index.umd.js +1 -1
- package/dist/presetPrintable/index.cjs.js +2 -2
- package/dist/presetPrintable/index.es.js +5 -5
- package/dist/presetPrintable/index.umd.js +3 -3
- package/dist/prosemirror/index.cjs.js +1 -1
- package/dist/prosemirror/index.es.js +1 -1
- package/dist/prosemirror/index.umd.js +1 -1
- package/dist/rteTinyMce/index.cjs.js +2 -2
- package/dist/rteTinyMce/index.es.js +12 -12
- package/dist/rteTinyMce/index.umd.js +2 -2
- package/dist/tableComponent/index.cjs.js +1 -1
- package/dist/tableComponent/index.es.js +83 -83
- package/dist/tableComponent/index.umd.js +1 -1
- package/dist/youtubeAssetProvider/index.cjs.js +1 -1
- package/dist/youtubeAssetProvider/index.es.js +15 -15
- package/dist/youtubeAssetProvider/index.umd.js +1 -1
- package/package.json +1 -1
package/dist/aiChat/index.umd.js
CHANGED
|
@@ -1,24 +1,10 @@
|
|
|
1
|
-
(function(Kt,En){typeof exports=="object"&&typeof module<"u"?module.exports=En(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"],En):(Kt=typeof globalThis<"u"?globalThis:Kt||self,Kt.StudioSdkPlugins_aiChat=En(Kt.AiSdkReact,Kt.Ai,Kt.jsxRuntime,Kt.React,Kt.ReactDOM,Kt.ReactDOMClient,Kt.Marked,Kt.ReactMarkdown,Kt.RemarkGfm))})(this,function(Kt,En,l,f,Pn,gw,mw,bw,vw){"use strict";function nh(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 Ye=nh(f),yw=nh(Pn),rh="app.grapesjs.com",sh="app-stage.grapesjs.com",oh=[rh,"app2.grapesjs.com",sh,"app-stage2.grapesjs.com","localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],ah="license:check:start",uu="license:check:end",lr=()=>typeof window<"u",Gs=e=>e&&e.stopPropagation(),ww=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),Sw=(e,t)=>{const n=r=>r.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},Cw=(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)},xw=e=>Sw("Escape",e),Ew=(e,t={})=>{const n=et(e)?{id:e,src:e}:e;return new Promise((r,s)=>{var h,g;const{loadedScripts:o}=t,{id:a,src:i}=n,c=document.querySelector(`script[src="${i}"]`);if(c){if((h=t.onScript)==null||h.call(t,c),o&&!o.get(i)){c.addEventListener("load",()=>r(a)),c.addEventListener("error",()=>s(a));return}return r(a)}const u=window.define;window.define=void 0;const d=()=>{o==null||o.set(i,!0),window.define=u},p=document.createElement("script");p.src=i,p.onload=()=>{r(a),d()},p.onerror=()=>{s(a),d()},document.head.appendChild(p),(g=t.onScript)==null||g.call(t,p)})},Pw=e=>{const t=e.map(n=>Ew(n));return Promise.allSettled(t)};function Tw(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 ih(e){const t=r=>{var s;if(r.length){const o=r.shift(),a=Tw(o);a.onerror=a.onload=t.bind(null,r),(s=o.parentNode)==null||s.replaceChild(a,o)}},n=Array.from(e.querySelectorAll("script"));t(n)}const lh=e=>new DOMParser().parseFromString(e,"text/html"),Ow=(e="")=>lh(`<body>${e}</body>`).body.innerHTML,Aw=(e="")=>lh(`<head>${e}</head>`).head.innerHTML,_w=(e="",t)=>{const r=new DOMParser().parseFromString(e,"text/html");if(t){const o=r.querySelectorAll("svg")[0].style||{},a=Iw(t)?`${t}px`:t;o.width=a,o.height=a,o.fill="currentColor"}return new XMLSerializer().serializeToString(r)},du=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?sh:rh}`}/${n?"platform-api":"api"}`,Mw=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},ch=(e={})=>{const{width:t=300,height:n,text:r="IMAGE",bg:s="777",fg:o="white"}=e,a=n?`x${n}`:"";return`https://placehold.co/${t}${a}/${s}/${o}.png?text=${r}`},Lw=ch(),pu=()=>{const e=lr()&&window.location.hostname;return!!e&&(oh.includes(e)||oh.some(t=>e.endsWith(t)))},cr=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),Nw=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),$w=()=>{},kw=240,Ot=e=>typeof e<"u",et=e=>typeof e=="string",Iw=e=>typeof e=="number";function Ke(e){return typeof e=="function"}function Ir(e){return e&&!Array.isArray(e)&&typeof e=="object"}const Vw=e=>!e||Object.keys(e).length===0,_o=(e,t)=>{const n=(e||"").toLocaleLowerCase(),r=(t||"").toLocaleLowerCase();return n.includes(r)},Hw=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},jw=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=n.length;for(let s=0;s<e;s++)t+=n.charAt(Math.floor(Math.random()*r));return t},Dw=e=>!!e.Components.getType("mjml"),Yi=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),Fw=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(o,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,(o,a)=>`{{ ${a} }}`)};async function Bw({path:e,baseApiUrl:t,method:n="GET",headers:r={},params:s,body:o}){const i=`${t||du({isDev:!1,isStage:!1})}${e}`,c={method:n,headers:{"Content-Type":"application/json",...r}};o&&(c.body=JSON.stringify(o));const u=s?new URLSearchParams(s).toString():"",d=u?`?${u}`:"",p=await fetch(`${i}${d}`,c);if(!p.ok)throw new Error(`HTTP error! status: ${p.status}`);return p.json()}var Mo=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Mo||{}),Zt=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(Zt||{}),re=(e=>(e.toastAdd="studio:toastAdd",e.toastRemove="studio:toastRemove",e.dialogOpen="studio:dialogOpen",e.dialogClose="studio:dialogClose",e.dialogExportCode="studio:dialogExportCode",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||{}),hn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(hn||{}),ss=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(ss||{}),ht=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(ht||{});const uh={[Mo.free]:0,[Mo.startup]:10,[Mo.business]:20,[Mo.enterprise]:30};function zw(e){const t=e;return t.init=n=>r=>e(r,n),t}const Uw=e=>zw(e);async function Ww({editor:e,plan:t,pluginName:n,licenseKey:r,onLicenseCheckResponse:s,cleanup:o}){let a="",i=!1;const c=pu(),u=p=>{console.warn("Cleanup plugin:",n,"Reason:",p),o()},d=(p={})=>{var v;const{error:h,sdkLicense:g}=p,m=(v=p.plan)==null?void 0:v.category;if(!(g||p.license)||h)u(h||"Invalid license");else if(m){const w=uh[t],y=uh[m];w>y&&u({pluginRequiredPlan:t,licensePlan:m})}};e.on(ah,p=>{a=p==null?void 0:p.baseApiUrl,i=!0}),e.on(uu,p=>{s==null||s(p),d(p)}),setTimeout(async()=>{if(!i){if(c)return;if(r){const p=await Gw({licenseKey:r,pluginName:n,baseApiUrl:a});s==null||s(p),p&&d(p)}else u("The `licenseKey` option not provided")}},2e3)}async function Gw(e){const{licenseKey:t,pluginName:n,baseApiUrl:r}=e;try{return(await Bw({baseApiUrl:r,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(s){return console.error("Error during SDK license check:",s),!1}}const Ft={accessToken:""},qw=()=>{Ft.timeout&&(clearTimeout(Ft.timeout),Ft.timeout=void 0),Ft.accessToken="",Ft.license=void 0},dh=async()=>{var t;let e={accessToken:""};try{const n=await((t=Ft.getAccessToken)==null?void 0:t.call(Ft));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Ft.getAccessToken&&console.error("Failed to get access token");return}if(Ft.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Ft.timeout||void 0),Ft.timeout=setTimeout(dh,n-Date.now()-1)}},ph=e=>{var t;return((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},Kw=e=>ph(e)==="email",Lo=(e,t={})=>{var h;const{selectedComponents:n=[],withPageContent:r=!1,imageUrls:s=[]}=t,o=e.Pages.getSelected(),a=e.getSelected(),i=ph(e),c=Yw(e),u=c.length<=1&&((h=e.getWrapper())==null?void 0:h.components().length)===0,d=o?{id:o.getId(),name:o.getName(),content:r?eS(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(g=>({id:g.getId(),content:""})),projectType:i,availablePages:c,globalStyles:Zw(e),installedPlugins:Xw(e),devices:Rw(e),isEmail:i==="email",imageUrls:s}},Yt=(e,t,n)=>{const{layoutComponents:r}=n||{},s=t,o=s.type,a=o?r==null?void 0:r[o]:void 0,i=a?{...s,...a({editor:e,props:t})}:t;return e.runCommand(re.layoutComponentRender,{components:i})};function Zw(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
|
|
2
|
-
`)}const Yw=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),Xw=e=>{const t=Qw(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},Jw=e=>e.getModel().get("customData")??{},Qw=e=>e&&Jw(e).plugins||[];function Rw(e){return e.Devices.getAll().map(t=>t.toJSON())}function wa(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const qs=(e="",t,n={})=>{!t||!e||(t.innerHTML=wa(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"})})))},fh=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function Ks(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function Zs(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}const Xi=e=>{var o;const{error:t,abortMsg:n,msg:r}=e,s=t.name==="AbortError"||((o=t.message)==null?void 0:o.includes("abort"));return s||console.error(t),{error:s?n:r,abortedByUser:s?!0:void 0}};function eS(e){const t=e.getWrapper(),n=fh(t);return`<style>${e.getCss()||""}</style>${n}`}const hh=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],r=new Map,s=document.createElement("div");s.setAttribute("data-temp-els","true");const o=(a,i)=>{try{i.innerHTML=a.innerHTML,Array.from(a.attributes).forEach(c=>i.setAttribute(c.name,c.value))}catch{}};return{cleanup(){s==null||s.remove()},update:a=>{var h;const i=new DOMParser,c=wa(a),u=i.parseFromString(`<body>${c}</body>`,"text/html"),d=Array.from(u.body.children),p=e.getWrapper();return(h=p==null?void 0:p.getEl())==null||h.appendChild(s),d.forEach(g=>{var b,v;let m=g.id;if(m){const w=r.get(m),y=t.getById(m),S=y==null?void 0:y.getEl();S&&(o(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=[((b=g.tagName)==null?void 0:b.toLowerCase())||"",...Array.from(g.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const w=(v=r.get(m))==null?void 0:v.newNode;w?o(g,w):(s.appendChild(g),r.set(m,{newNode:g}))}}),r}}},gh=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:r,Css:s}=n,{html:o,css:a}=r.parseHtml(t,{returnArray:!0}),i=o[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&&s.addCollection(a,{extend:!0})):e.components(t)};var Wn=(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.SHOW_PANEL="showPanel",e))(Wn||{}),Vr=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(Vr||{}),ur=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(ur||{});function mh(e,t){var g;const{componentId:n,position:r}=t;Ks(e);const s=document.createElement("div");s.style.display="contents";const{Components:o}=e;let i=o.getById(n)||e.getSelected(),c=i==null?void 0:i.parent();const u=i==null?void 0:i.index(),d=i==null?void 0:i.getEl();let p="afterend",h;switch(r){case"before":p="beforebegin",i=c,h=u;break;case"beforeInside":p="afterbegin",h=0;break;case"afterInside":p="beforeend";break;case"after":p="afterend",i=c,h=(u??0)+1;break}return i||(i=e.getWrapper(),c=i,h=void 0),d?d==null||d.insertAdjacentElement(p,s):(g=c==null?void 0:c.getEl())==null||g.appendChild(s),{target:i,at:h,domPosition:p,tempTargetEl:d,tempDOM:s,cleanUp(){s==null||s.remove(),Zs(e)}}}function bh(e,t,n){const{target:r,at:s}=t,o=r==null?void 0:r.append(n,{at:s})[0];return o&&e.select(o),o}function tS(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:s,id:o}=n,{status:a}=s;let i=r.get(o);const c=()=>{i==null||i.toolSetup.cleanUp(),r.delete(o)};if(a==="in-progress"||a==="streaming"){i||(i={type:Vr.ADD_COMPONENT_CODE,toolSetup:mh(t,s.input),content:""},r.set(o,i)),a==="streaming"&&s.content&&(i.content=s.content,qs(s.content,i.toolSetup.tempDOM,{skipScroll:!0}));return}if(a==="done"&&i&&s.content){if(i.completed)return;bh(t,i.toolSetup,s.content),i.completed=!0,c()}if(a==="error"){c();return}}function nS(e){Ks(e);const t=hh(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),Zs(e)}}}function rS(e,t){const n=e.getWrapper();t.mapUpdates.forEach(r=>{const{cmp:s,newNode:o}=r,{outerHTML:a}=o;s?gh(s,a):n==null||n.append(a)})}function sS(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:s,id:o}=n,{status:a}=s;let i=r.get(o);const c=()=>{i==null||i.toolSetup.cleanUp(),r.delete(o)};if(a==="in-progress"||a==="streaming"){i||(i={type:Vr.EDIT_COMPONENT_CODE,toolSetup:nS(t),content:""},r.set(o,i)),a==="streaming"&&s.content&&(i.content=s.content,i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(s.content));return}if(a==="done"&&i&&s.content){if(i.completed)return;i.toolSetup.mapUpdates=i.toolSetup.toUpdate.update(s.content),rS(t,i.toolSetup),i.completed=!0,c()}if(a==="error"){c();return}}function oS(e,t){const{name:n}=t,{Pages:r,Components:s}=e;Ks(e);const o=r.add({name:n,component:"<h1></h1>"},{select:!0}),a=o.getMainComponent();return a.once(s.events.render,()=>{const i=a.getEl();i&&qs(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
|
|
3
|
-
Generating ${n?`"${n}" `:""}page...
|
|
4
|
-
</h1>`,i,{skipScroll:!0})}),{pageId:o.getId(),cmpRoot:a,cleanUp(){Zs(e)}}}function aS(e,t){const{cmpRoot:n}=e;n.components(t)}function iS(e){const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:s,id:o}=n,{status:a}=s;let i=r.get(o);const c=()=>{i==null||i.toolSetup.cleanUp(),r.delete(o)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:Vr.ADD_PAGE_CODE,toolSetup:oS(t,s.input),content:""},r.set(o,i)),a==="streaming"&&s.content){i.content=s.content;const u=i.toolSetup.cmpRoot.getEl();u&&qs(s.content,u,{skipScroll:!0})}return}if(a==="done"&&i&&s.content){if(i.completed)return;aS(i.toolSetup,s.content),i.completed=!0,c()}if(a==="error"){c();return}}function lS(e){Ks(e);const t=e.getWrapper(),n=Lo(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){Zs(e)}}}function cS(e,t,n){var s;const{Pages:r}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(s=r.getSelected())==null||s.setName(n)}const vh="mjml-code-to-html";function uS(e){var u;const{editor:t,toolStatus:n,toolStatusProgress:r}=e,{data:s,id:o}=n,{status:a}=s;let i=r.get(o);const c=()=>{i==null||i.toolSetup.cleanUp(),r.delete(o)};if(a==="in-progress"||a==="streaming"){if(i||(i={type:Vr.ADD_PROJECT_PAGE_CODE,toolSetup:lS(t),content:""},r.set(o,i)),a==="streaming"&&s.content){i.content=s.content;const{isEmail:d,cmpRoot:p}=i.toolSetup,h=p.getEl();let g=s.content;if(d){const m=wa(g);try{const b=(u=t.runCommand(vh,{mjml:m}))==null?void 0:u.html;b&&(g=b)}catch{}}h&&qs(g,h,{skipScroll:!0})}return}if(a==="done"&&i&&s.content){if(i.completed)return;cS(t,s.content,s.input.name),i.completed=!0,c()}if(a==="error"){c();return}}const yh={[Vr.ADD_COMPONENT_CODE]:tS,[Vr.EDIT_COMPONENT_CODE]:sS,[Vr.ADD_PAGE_CODE]:iS,[Vr.ADD_PROJECT_PAGE_CODE]:uS},dS=({editor:e,data:t,toolStatusProgress:n})=>{var a;if(t.type!=="data-tool-status")return;const r=t,s=((a=r.data)==null?void 0:a.name)||"",o=yh[s];o?o({editor:e,toolStatus:r,toolStatusProgress:n}):pS({toolStatus:r,toolStatusProgress:n})};function pS({toolStatus:e,toolStatusProgress:t}){const{id:n,data:r}=e;if(!n||!r)return;const{status:s,content:o}=r;let a=t.get(n);a||(a={type:"generic",content:"",completed:!1},t.set(n,a)),s==="streaming"&&o&&(a.content=o),s==="done"&&(o&&(a.content=o),t.delete(n)),s==="error"&&t.delete(n)}const fS={addComponent:"/api/ai/add-component-stream",editComponent:"/api/ai/edit-component-stream",addPage:"/api/ai/add-page-stream",generateProject:"/api/ai/generate-project-stream",scrapeWebsite:"/api/ai/scrape-website"};async function Ji(e,t,n={}){var u;const{onContent:r,abortController:s}=n,o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:s==null?void 0:s.signal});if(!o.ok)throw new Error(`Failed to fetch: ${o.statusText}`);const a=(u=o.body)==null?void 0:u.getReader();if(!a)throw new Error("No reader available");const i=new TextDecoder;let c="";for(;;){if(s!=null&&s.signal.aborted){a.cancel();break}const{done:d,value:p}=await a.read();if(d)break;const h=i.decode(p);c+=h,r==null||r(c)}return wa(c)}function fu({lastUserMessage:e}){return(e==null?void 0:e.parts.filter(t=>En.isTextUIPart(t)).map(t=>t.text).join(""))||""}function hS(e,t={}){const n={...fS,...t},r={async execute(g,m){const{plan:b,name:v,imageUrls:w}=g,y=fu(m);let S;try{S=mh(e,g);const{tempDOM:C}=S,x=await Ji(n.addComponent,{userPrompt:`${y}
|
|
5
|
-
${b?`
|
|
6
|
-
Plan: ${b}`:""}
|
|
7
|
-
${v?`
|
|
8
|
-
Component Name: ${v}`:""}
|
|
9
|
-
`.trim(),id:"",imageUrls:w,messages:[],trigger:m.toolCallId,projectContext:Lo(e,{imageUrls:w,withPageContent:!0})},{onContent:P=>qs(P,C,{skipScroll:!0}),abortController:m.abortController});if(!x)throw new Error("Failed to generate component content");const E=bh(e,S,x);return{newComponentId:E==null?void 0:E.getId(),newComponentName:v}}catch(C){return Xi({error:C,msg:"Failed to add component",abortMsg:"Cancelled adding component"})}finally{S==null||S.cleanUp()}}},s={async execute(g,m){const{plan:b,imageUrls:v}=g,w=e.getWrapper(),y=hh(e);let S=new Map;try{if(Ks(e),await Ji(n.editComponent,{userPrompt:b,projectContext:Lo(e,{imageUrls:v,withPageContent:!0}),imageUrls:v,id:"",messages:[],trigger:m.toolCallId},{abortController:m.abortController,onContent:C=>{S=y.update(C)}}),!S.size)throw new Error("Failed to generate component content");return S.forEach(C=>{const{cmp:x,newNode:E}=C,{outerHTML:P}=E;x?gh(x,P):w==null||w.append(P)}),{success:!0}}catch(C){return Xi({error:C,msg:"Failed to edit component",abortMsg:"Cancelled editing component"})}finally{y.cleanup(),Zs(e)}}},o={async execute(g){const{componentId:m}=g,b=e.Components.getById(m);return b?(b.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${m}'`}}},a={async execute(g){const{sourceId:m,targetId:b,targetIndex:v}=g,w=e.Components.getById(m),y=e.Components.getById(b);return w?y?(y.append(w,{at:v}),e.select(w,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${b}'`}:{success:!1,error:`Source component not found with ID '${m}'`}}},i={async execute(g,m){const{name:b,plan:v,imageUrls:w}=g,{Pages:y,Components:S}=e;try{Ks(e);const C=fu(m),x=y.add({name:b,component:"<h1></h1>"},{select:!0}),E=x.getMainComponent(),P=A=>{const T=E.getEl();qs(A,T,{skipScroll:!0})};E.once(S.events.render,()=>{P(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
|
|
10
|
-
Generating ${b?`"${b}" `:""}page...
|
|
11
|
-
</h1>`)});const O=await Ji(n.addPage,{userPrompt:`${C}
|
|
12
|
-
${v?`
|
|
13
|
-
Plan: ${v}`:""}
|
|
14
|
-
`.trim(),id:"",imageUrls:w,messages:[],trigger:m.toolCallId,projectContext:Lo(e,{imageUrls:w,withPageContent:!0})},{onContent:P,abortController:m.abortController});if(!O)throw new Error("Failed to generate page content");return E.components(O),{success:!0,data:{pageId:x.getId(),pageName:b}}}catch(C){return Xi({error:C,msg:"Failed to create page",abortMsg:"Cancelled creating page"})}finally{Zs(e)}}},c={async execute(g){const{pageId:m}=g,b=e.Pages.get(m),v=b==null?void 0:b.getMainComponent();return v?{content:fh(v)}:{success:!1,error:"Page not found"}}},u={async execute(){return{pages:e.Pages.getAll().map(m=>({id:m.getId(),name:m.getName()}))}}},d={async execute(g){const{url:m,name:b}=g,v=await fetch(n.scrapeWebsite,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({url:m})});if(!v.ok)return{success:!1,error:"Failed to fetch website"};const w=await v.json();return e.Pages.add({name:b,component:w.html},{select:!0}),{success:!0,data:{pageName:b,subPages:w.subPages||[]}}}},p={async execute(g){const{panelId:m}=g;await new Promise(b=>setTimeout(b,1500));try{e.runCommand(`open:${m}`)}catch{return{success:!1,error:`Panel ${m} not found`}}return{success:!0}}},h={async execute(g,m){var C;const{name:b,plan:v,imageUrls:w}=g,y=Lo(e,{imageUrls:w,withPageContent:!0}),{isEmail:S}=y;Ks(e);try{const{Pages:x}=e,E=e.getWrapper(),P=fu(m),O=T=>{var L;let _="";if(S){const $=wa(T);try{const D=(L=e.runCommand(vh,{mjml:$}))==null?void 0:L.html;D&&(_=D)}catch{}}else _=T;qs(_,E.getEl(),{skipScroll:!0})},A=await Ji(n.generateProject,{userPrompt:`${P}${v?`
|
|
15
|
-
Plan: ${v}`:""}`,projectContext:y,imageUrls:w,id:"",messages:[],trigger:m.toolCallId},{abortController:m.abortController,onContent:O});return e.loadProjectData({pages:[{name:b,component:A}]}),(C=x.getSelected())==null||C.setName(b),{success:!0,data:{pageName:b}}}catch(x){return Xi({error:x,msg:"Failed to create a project page",abortMsg:"Cancelled creating project page"})}finally{Zs(e)}}};return{[Wn.ADD_NEW_COMPONENT]:r,[Wn.EDIT_COMPONENT]:s,[Wn.REMOVE_COMPONENT]:o,[Wn.MOVE_COMPONENT]:a,[Wn.ADD_NEW_PAGE]:i,[Wn.GET_PAGE_CONTENT]:c,[Wn.LIST_PAGES]:u,[Wn.FETCH_WEBSITE]:d,[Wn.SHOW_PANEL]:p,[Wn.ADD_NEW_PROJECT_PAGE]:h}}var gS={NODE_ENV:"production"};class mS{constructor(t,n){var o;this.chatStates=new Map,this.editor=t,this.options=n;const r=hS(t);this.tools=((o=n.tools)==null?void 0:o.call(n,{defaultTools:r,editor:t}))||r;const{chat:s}=this.createChat();this.currentChatId=s.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,s=new Set,o=new Set,{chatApi:a,onTool:i,body:c,defaultTransportOptions:u={},chatOptions:d={},onMessagesUpdate:p,messages:h}=this.options,{onFinish:g,onData:m,...b}=d,v=typeof h=="function",w=new Kt.Chat({id:t,messages:Array.isArray(h)?h:void 0,sendAutomaticallyWhen:En.lastAssistantMessageIsCompleteWithToolCalls,transport:new En.DefaultChatTransport({...u,async prepareSendMessagesRequest({headers:E,messages:P,body:O,id:A,trigger:T,credentials:_}){var k;const L={...O,id:A,trigger:T,messages:P.slice(-10),projectContext:Lo(n,{withPageContent:!0,selectedComponents:Array.from(o)}),userPrompt:""},$=typeof c=="function"?c({editor:n,body:L,messages:P}):c,{accessToken:D,license:N}=Ft,B=gS.NODE_ENV!=="production",q=`${du({isDev:B,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!N||["enterprise","business"].includes(((k=N==null?void 0:N.plan)==null?void 0:k.category)??"free"))&&typeof a<"u"?typeof a=="function"?a():a:q,headers:{...E,...D?{Authorization:`Bearer ${D}`}:{}},credentials:_,body:{...L,...$}}}}),onToolCall:async({toolCall:E})=>{i==null||i({toolCall:E});const P=!!yh[E.toolName];if(E.dynamic||P)return;const{toolName:O,input:A,toolCallId:T}=E,_=this.tools[O];if(_&&_.execute){const L=new AbortController;s.add(L);try{const{messages:$}=w,D=await Promise.race([_.execute(A||{},{editor:n,messages:$,lastUserMessage:$.findLast(N=>N.role==="user"),toolCallId:T,abortController:L}),new Promise((N,B)=>{L.signal.addEventListener("abort",()=>B(new Error("Aborted")))})]);if(D&&typeof D.error=="string")throw new Error(D.error);w.addToolOutput({tool:O,toolCallId:T,output:D})}catch($){w.addToolOutput({tool:O,toolCallId:T,state:"output-error",errorText:$ instanceof Error?$.message:"Unknown error"})}finally{s.delete(L)}}},onData(E){m==null||m(E),dS({editor:n,data:E,toolStatusProgress:r})},onFinish(E){p==null||p({messages:E.messages,editor:n}),E.isAbort&&(r.forEach(P=>{"toolSetup"in P&&P.toolSetup.cleanUp()}),r.clear()),g==null||g(E)},...b}),y=new Set,S={get messages(){return w.messages},get lastMessage(){return w.lastMessage},get status(){return w.status},get error(){return w.error},sendMessage:(...E)=>w.sendMessage(...E),setMessages:E=>{w.messages=E},clearError:()=>w.clearError(),stop:()=>w.stop(),setError:E=>{const P=E instanceof Error?E:new Error(String(E));w.setStatus({status:"error",error:P})}},C={chat:w,chatApi:S,isMessagesLoaded:!v,toolStatusProgress:r,toolAbortControllers:s,contextComponents:o,onUpdate:E=>(y.add(E),()=>{y.delete(E)}),emitUpdate:()=>{y.forEach(E=>E())}};this.chatStates.set(w.id,C);const x=()=>{w["~registerMessagesCallback"](()=>{w.status==="ready"&&(p==null||p({messages:w.messages,editor:n}))})};return v?h({editor:n}).then(E=>{w.messages=E,x()}).catch(E=>S.setError(E)).finally(()=>{C.isMessagesLoaded=!0,C.emitUpdate()}):x(),C}}var bS="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",vS="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",yS="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",wS="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",SS="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",CS="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",xS="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",ES="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",PS="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",TS="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",OS="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",AS="M3,21V3H21V21H3M5,5V19H19V5H5Z",_S="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",MS="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",LS="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",NS="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",$S="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",wh="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",kS="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",IS="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",VS="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",HS="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",jS="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",DS="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",Sh="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",FS="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",BS="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",zS="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",US="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",WS="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",GS="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",qS="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",KS="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",ZS="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",YS="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",XS="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",JS="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",QS="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",RS="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",e2="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",t2="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",n2="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",r2="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",s2="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",o2="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",a2="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",i2="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",l2="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",c2="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",u2="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",d2="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",p2="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",f2="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",h2="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",g2="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",m2="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",b2="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",v2="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",y2="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",w2="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",S2="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",C2="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",x2="M11 15H6L13 1V9H18L11 23V15Z",E2="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",T2="M12,17A2,2 0 0,0 14,15C14,13.89 13.1,13 12,13A2,2 0 0,0 10,15A2,2 0 0,0 12,17M18,8A2,2 0 0,1 20,10V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V10C4,8.89 4.9,8 6,8H7V6A5,5 0 0,1 12,1A5,5 0 0,1 17,6V8H18M12,3A3,3 0 0,0 9,6V8H15V6A3,3 0 0,0 12,3Z",O2="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",A2="M7,10L12,15L17,10H7Z",_2="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",M2="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",L2="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",N2="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",$2="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",Ch="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",k2="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",I2="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",V2="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",H2="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",j2="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",D2="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",F2="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",B2="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",z2="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",U2="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",W2="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",G2="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",q2="M18,18H6V6H18V18Z",K2="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",Z2="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",Y2="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",X2="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",J2="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",Q2="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",R2="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",eC="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",tC="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",nC="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",rC="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",sC="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",oC="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",aC="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(s=>typeof s=="string"?s.split(" ").map(o=>{if(o=o.replace(/gjs-/g,"gs-utl-"),!o.includes("gs-utl-")&&!o.startsWith("gs-")){const a=o.split(":"),i=a.pop(),c=a.join(":"),u=i==null?void 0:i.startsWith("!"),p=`gs-utl-${u?i==null?void 0:i.slice(1):i}`,h=u?`!${p}`:p;return c?`${c}:${h}`:h}return o}):s).join(" ")}const I=f.forwardRef(function({as:t,children:n,className:r,col:s,revert:o,full:a,nowrap:i,space:c,gap:u,justify:d,items:p,...h},g){const m=t||"div";return l.jsx(m,{ref:g,className:Z([r,"gs-utl-flex",s&&!o&&"gs-utl-flex-col",s&&o&&"gs-utl-flex-col-reverse",!s&&o&&"gs-utl-flex-row-reverse",a&&!s&&"gs-utl-w-full",a&&s&&"gs-utl-h-full",i?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",c==="x2s"&&(s?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),c==="xs"&&(s?"gs-utl-space-y-1":"gs-utl-space-x-1"),c==="s"&&(s?"gs-utl-space-y-2":"gs-utl-space-x-2"),c==="m"&&(s?"gs-utl-space-y-4":"gs-utl-space-x-4"),c==="l"&&(s?"gs-utl-space-y-6":"gs-utl-space-x-6"),c==="xl"&&(s?"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"]),...h,children:n})}),j=f.forwardRef(function({children:t,className:n,grow:r,...s},o){return l.jsx("div",{ref:o,className:Z([n,r&&"flex-1"]),...s,children:t})});function hu(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var gu={exports:{}},mu,xh;function iC(){if(xh)return mu;xh=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return mu=e,mu}var bu,Eh;function lC(){if(Eh)return bu;Eh=1;var e=iC();function t(){}function n(){}return n.resetWarningCache=t,bu=function(){function r(a,i,c,u,d,p){if(p!==e){var h=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 h.name="Invariant Violation",h}}r.isRequired=r;function s(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:s,element:r,elementType:r,instanceOf:s,node:r,objectOf:s,oneOf:s,oneOfType:s,shape:s,exact:s,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},bu}var Ph;function cC(){return Ph||(Ph=1,gu.exports=lC()()),gu.exports}var uC=function(e){var t={};function n(r){if(t[r])return t[r].exports;var s=t[r]={i:r,l:!1,exports:{}};return e[r].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(r,s,o){n.o(r,s)||Object.defineProperty(r,s,{enumerable:!0,get:o})},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,s){if(1&s&&(r=n(r)),8&s||4&s&&typeof r=="object"&&r&&r.__esModule)return r;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:r}),2&s&&typeof r!="string")for(var a in r)n.d(o,a,(function(i){return r[i]}).bind(null,a));return o},n.n=function(r){var s=r&&r.__esModule?function(){return r.default}:function(){return r};return n.d(s,"a",s),s},n.o=function(r,s){return Object.prototype.hasOwnProperty.call(r,s)},n.p="",n(n.s=2)}([function(e,t){e.exports=cC()},function(e,t){e.exports=f},function(e,t,n){n.r(t);var r=n(1),s=n(0),o=function(){return(o=Object.assign||function(m){for(var b,v=1,w=arguments.length;v<w;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},a=function(m,b){var v={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&b.indexOf(w)<0&&(v[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)b.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(v[w[y]]=m[w[y]])}return v},i=0,c=r.forwardRef(function(m,b){var v=m.title,w=v===void 0?null:v,y=m.description,S=y===void 0?null:y,C=m.size,x=C===void 0?null:C,E=m.color,P=E===void 0?"currentColor":E,O=m.horizontal,A=O===void 0?null:O,T=m.vertical,_=T===void 0?null:T,L=m.rotate,$=L===void 0?null:L,D=m.spin,N=D===void 0?null:D,B=m.style,q=B===void 0?{}:B,F=m.children,k=a(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);i++;var H,V=N!==null&&N,U=r.Children.map(F,function(ee){var te=ee;V!==!0&&(V=(N===null?te.props.spin:N)===!0);var K=te.props.size;typeof x=="number"&&typeof te.props.size=="number"&&(K=te.props.size/x);var ne={size:K,color:P===null?te.props.color:P,horizontal:A===null?te.props.horizontal:A,vertical:_===null?te.props.vertical:_,rotate:$===null?te.props.rotate:$,spin:N===null?te.props.spin:N,inStack:!0};return r.cloneElement(te,ne)});x!==null&&(q.width=typeof x=="string"?x:1.5*x+"rem");var X,Y="stack_labelledby_"+i,R="stack_describedby_"+i;if(w)H=S?Y+" "+R:Y;else if(X="presentation",S)throw new Error("title attribute required when description is set");return r.createElement("svg",o({ref:b,viewBox:"0 0 24 24",style:q,role:X,"aria-labelledby":H},k),w&&r.createElement("title",{id:Y},w),S&&r.createElement("desc",{id:R},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)});c.displayName="Stack",c.propTypes={size:s.oneOfType([s.number,s.string]),color:s.string,horizontal:s.bool,vertical:s.bool,rotate:s.number,spin:s.oneOfType([s.bool,s.number]),children:s.oneOfType([s.arrayOf(s.node),s.node]).isRequired,className:s.string,style:s.object},c.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var u=c;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 b,v=1,w=arguments.length;v<w;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},p=function(m,b){var v={};for(var w in m)Object.prototype.hasOwnProperty.call(m,w)&&b.indexOf(w)<0&&(v[w]=m[w]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(w=Object.getOwnPropertySymbols(m);y<w.length;y++)b.indexOf(w[y])<0&&Object.prototype.propertyIsEnumerable.call(m,w[y])&&(v[w[y]]=m[w[y]])}return v},h=0,g=r.forwardRef(function(m,b){var v=m.path,w=m.id,y=w===void 0?++h:w,S=m.title,C=S===void 0?null:S,x=m.description,E=x===void 0?null:x,P=m.size,O=P===void 0?null:P,A=m.color,T=A===void 0?"currentColor":A,_=m.horizontal,L=_!==void 0&&_,$=m.vertical,D=$!==void 0&&$,N=m.rotate,B=N===void 0?0:N,q=m.spin,F=q!==void 0&&q,k=m.style,H=k===void 0?{}:k,V=m.inStack,U=V!==void 0&&V,X=p(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Y={},R=[];O!==null&&(U?R.push("scale("+O+")"):(H.width=typeof O=="string"?O:1.5*O+"rem",H.height=H.width)),L&&R.push("scaleX(-1)"),D&&R.push("scaleY(-1)"),B!==0&&R.push("rotate("+B+"deg)"),T!==null&&(Y.fill=T);var ee=r.createElement("path",d({d:v,style:Y},U?X:{})),te=ee;R.length>0&&(H.transform=R.join(" "),H.transformOrigin="center",U&&(te=r.createElement("g",{style:H},ee,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var K,ne=te,ce=F===!0||typeof F!="number"?2:F,ge=!U&&(L||D);if(ce<0&&(ge=!ge),F&&(ne=r.createElement("g",{style:{animation:"spin"+(ge?"-inverse":"")+" linear "+Math.abs(ce)+"s infinite",transformOrigin:"center"}},te,!(L||D||B!==0)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),U)return ne;var De,ve="icon_labelledby_"+y,Ze="icon_describedby_"+y;if(C)K=E?ve+" "+Ze:ve;else if(De="presentation",E)throw new Error("title attribute required when description is set");return r.createElement("svg",d({ref:b,viewBox:"0 0 24 24",style:H,role:De,"aria-labelledby":K},X),C&&r.createElement("title",{id:ve},C),E&&r.createElement("desc",{id:Ze},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) } }")),ne)});g.displayName="Icon",g.propTypes={path:s.string.isRequired,size:s.oneOfType([s.number,s.string]),color:s.string,horizontal:s.bool,vertical:s.bool,rotate:s.number,spin:s.oneOfType([s.bool,s.number]),style:s.object,inStack:s.bool,className:s.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const Sa=hu(uC);var Th={exports:{}};/*!
|
|
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:{}};/*!
|
|
16
2
|
Copyright (c) 2018 Jed Watson.
|
|
17
3
|
Licensed under the MIT License (MIT), see
|
|
18
4
|
http://jedwatson.github.io/classnames
|
|
19
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var
|
|
20
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
21
|
-
'`+o.annotationType_+"' can only be used on properties with a function value."))}function kC(e,t,n,r){t.annotationType_,r.value}function jh(e,t,n,r,s){var o,a,i,c,u,d,p;s===void 0&&(s=de.safeDescriptors),kC(e,t,n,r);var h=r.value;if((o=t.options_)!=null&&o.bound){var g;h=h.bind((g=e.proxy_)!=null?g:e.target_)}return{value:Qs((a=(i=t.options_)==null?void 0:i.name)!=null?a:n.toString(),h,(c=(u=t.options_)==null?void 0:u.autoAction)!=null?c:!1,(d=t.options_)!=null&&d.bound?(p=e.proxy_)!=null?p:e.target_:void 0),configurable:s?e.isPlainObject_:!0,enumerable:!1,writable:!s}}function Dh(e,t){return{annotationType_:e,options_:t,make_:IC,extend_:VC,decorate_20223_:HC}}function IC(e,t,n,r){var s;if(r===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((s=this.options_)!=null&&s.bound&&(!Dr(e.target_,t)||!La(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(La(n.value))return 1;var o=Fh(e,this,t,n,!1,!1);return dr(r,t,o),2}function VC(e,t,n,r){var s,o=Fh(e,this,t,n,(s=this.options_)==null?void 0:s.bound);return e.defineProperty_(t,o,r)}function HC(e,t){var n,r=t.name,s=t.addInitializer;return La(e)||(e=to(e)),(n=this.options_)!=null&&n.bound&&s(function(){var o=this,a=o[r].bind(o);a.isMobXFlow=!0,o[r]=a}),e}function jC(e,t,n,r){t.annotationType_,r.value}function Fh(e,t,n,r,s,o){o===void 0&&(o=de.safeDescriptors),jC(e,t,n,r);var a=r.value;if(La(a)||(a=to(a)),s){var i;a=a.bind((i=e.proxy_)!=null?i:e.target_),a.isMobXFlow=!0}return{value:a,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Su(e,t){return{annotationType_:e,options_:t,make_:DC,extend_:FC,decorate_20223_:BC}}function DC(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function FC(e,t,n,r){return zC(e,this,t,n),e.defineComputedProperty_(t,Xs({},this.options_,{get:n.get,set:n.set}),r)}function BC(e,t){var n=this,r=t.name,s=t.addInitializer;return s(function(){var o=no(this)[we],a=Xs({},n.options_,{get:e,context:this});a.name||(a.name="ObservableObject."+r.toString()),o.values_.set(r,new Kn(a))}),function(){return this[we].getObservablePropValue_(r)}}function zC(e,t,n,r){t.annotationType_,r.get}function rl(e,t){return{annotationType_:e,options_:t,make_:UC,extend_:WC,decorate_20223_:GC}}function UC(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function WC(e,t,n,r){var s,o;return qC(e,this),e.defineObservableProperty_(t,n.value,(s=(o=this.options_)==null?void 0:o.enhancer)!=null?s:Js,r)}function GC(e,t){var n=this,r=t.kind,s=t.name,o=new WeakSet;function a(i,c){var u,d,p=no(i)[we],h=new is(c,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:Js,"ObservableObject."+s.toString(),!1);p.values_.set(s,h),o.add(i)}if(r=="accessor")return{get:function(){return o.has(this)||a(this,e.get.call(this)),this[we].getObservablePropValue_(s)},set:function(c){return o.has(this)||a(this,c),this[we].setObservablePropValue_(s,c)},init:function(c){return o.has(this)||a(this,c),c}}}function qC(e,t,n,r){t.annotationType_}var KC="true",ZC=Bh();function Bh(e){return{annotationType_:KC,options_:e,make_:YC,extend_:XC,decorate_20223_:JC}}function YC(e,t,n,r){var s,o;if(n.get)return al.make_(e,t,n,r);if(n.set){var a=Qs(t.toString(),n.set);return r===e.target_?e.defineProperty_(t,{configurable:de.safeDescriptors?e.isPlainObject_:!0,set:a})===null?0:2:(dr(r,t,{configurable:!0,set:a}),2)}if(r!==e.target_&&typeof n.value=="function"){var i;if(Lh(n.value)){var c,u=(c=this.options_)!=null&&c.autoBind?to.bound:to;return u.make_(e,t,n,r)}var d=(i=this.options_)!=null&&i.autoBind?_a.bound:_a;return d.make_(e,t,n,r)}var p=((s=this.options_)==null?void 0:s.deep)===!1?Vt.ref:Vt;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var h;n.value=n.value.bind((h=e.proxy_)!=null?h:e.target_)}return p.make_(e,t,n,r)}function XC(e,t,n,r){var s,o;if(n.get)return al.extend_(e,t,n,r);if(n.set)return e.defineProperty_(t,{configurable:de.safeDescriptors?e.isPlainObject_:!0,set:Qs(t.toString(),n.set)},r);if(typeof n.value=="function"&&(s=this.options_)!=null&&s.autoBind){var a;n.value=n.value.bind((a=e.proxy_)!=null?a:e.target_)}var i=((o=this.options_)==null?void 0:o.deep)===!1?Vt.ref:Vt;return i.extend_(e,t,n,r)}function JC(e,t){Ve("'"+this.annotationType_+"' cannot be used as a decorator")}var QC="observable",RC="observable.ref",ex="observable.shallow",tx="observable.struct",zh={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(zh);function sl(e){return e||zh}var Cu=rl(QC),nx=rl(RC,{enhancer:nl}),rx=rl(ex,{enhancer:OC}),sx=rl(tx,{enhancer:AC}),Uh=pr(Cu);function ol(e){return e.deep===!0?Js:e.deep===!1?nl:ax(e.defaultDecorator)}function ox(e){var t;return e?(t=e.defaultDecorator)!=null?t:Bh(e):void 0}function ax(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Js}function Wh(e,t,n){if(Pa(t))return Cu.decorate_20223_(e,t);if(Ys(t)){Ea(e,t,Cu);return}return $u(e)?e:Hr(e)?Vt.object(e,t,n):Array.isArray(e)?Vt.array(e,t):$o(e)?Vt.map(e,t):jr(e)?Vt.set(e,t):typeof e=="object"&&e!==null?e:Vt.box(e,t)}Oh(Wh,Uh);var ix={box:function(t,n){var r=sl(n);return new is(t,ol(r),r.name,!0,r.equals)},array:function(t,n){var r=sl(n);return(de.useProxies===!1||r.proxy===!1?a5:Xx)(t,ol(r),r.name)},map:function(t,n){var r=sl(n);return new gg(t,ol(r),r.name)},set:function(t,n){var r=sl(n);return new bg(t,ol(r),r.name)},object:function(t,n,r){return ds(function(){return cg(de.useProxies===!1||(r==null?void 0:r.proxy)===!1?no({},r):qx({},r),t,n)})},ref:pr(nx),shallow:pr(rx),deep:Uh,struct:pr(sx)},Vt=Oh(Wh,ix),Gh="computed",lx="computed.struct",xu=Su(Gh),cx=Su(lx,{equals:tl.structural}),al=function(t,n){if(Pa(n))return xu.decorate_20223_(t,n);if(Ys(n))return Ea(t,n,xu);if(Hr(t))return pr(Su(Gh,t));var r=Hr(n)?n:{};return r.get=t,r.name||(r.name=t.name||""),new Kn(r)};Object.assign(al,xu),al.struct=pr(cx);var qh,Kh,il=0,ux=1,dx=(qh=(Kh=Ri(function(){},"name"))==null?void 0:Kh.configurable)!=null?qh:!1,Zh={value:"action",configurable:!0,writable:!1,enumerable:!1};function Qs(e,t,n,r){n===void 0&&(n=!1);function s(){return px(e,n,t,r||this,arguments)}return s.isMobxAction=!0,s.toString=function(){return t.toString()},dx&&(Zh.value=e,dr(s,"name",Zh)),s}function px(e,t,n,r,s){var o=fx(e,t);try{return n.apply(r,s)}catch(a){throw o.error_=a,a}finally{hx(o)}}function fx(e,t,n,r){var s=Bt.NODE_ENV!=="production",o=0,a=de.trackingDerivation,i=!t||!a;Tn();var c=de.allowStateChanges;i&&(Rs(),c=Eu(!0));var u=Au(!0),d={runAsAction_:i,prevDerivation_:a,prevAllowStateChanges_:c,prevAllowStateReads_:u,notifySpy_:s,startTime_:o,actionId_:ux++,parentActionId_:il};return il=d.actionId_,d}function hx(e){il!==e.actionId_&&Ve(30),il=e.parentActionId_,e.error_!==void 0&&(de.suppressReactionErrors=!0),Pu(e.prevAllowStateChanges_),Aa(e.prevAllowStateReads_),On(),e.runAsAction_&&Fr(e.prevDerivation_),de.suppressReactionErrors=!1}function Eu(e){var t=de.allowStateChanges;return de.allowStateChanges=e,t}function Pu(e){de.allowStateChanges=e}var is=function(e){function t(r,s,o,a,i){var c;return o===void 0&&(o="ObservableValue"),i===void 0&&(i=tl.default),c=e.call(this,o)||this,c.enhancer=void 0,c.name_=void 0,c.equals=void 0,c.hasUnreportedChange_=!1,c.interceptors_=void 0,c.changeListeners_=void 0,c.value_=void 0,c.dehancer=void 0,c.enhancer=s,c.name_=o,c.equals=i,c.value_=s(r,void 0,o),c}Vh(t,e);var n=t.prototype;return n.dehanceValue=function(s){return this.dehancer!==void 0?this.dehancer(s):s},n.set=function(s){this.value_,s=this.prepareNewValue_(s),s!==de.UNCHANGED&&this.setNewValue_(s)},n.prepareNewValue_=function(s){if(An(this)){var o=_n(this,{object:this,type:fr,newValue:s});if(!o)return de.UNCHANGED;s=o.newValue}return s=this.enhancer(s,this.value_,this.name_),this.equals(this.value_,s)?de.UNCHANGED:s},n.setNewValue_=function(s){var o=this.value_;this.value_=s,this.reportChanged(),Zn(this)&&Yn(this,{type:fr,object:this,newValue:s,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(s){return Na(this,s)},n.observe_=function(s,o){return o&&s({observableKind:"value",debugObjectName:this.name_,object:this,type:fr,newValue:this.value_,oldValue:void 0}),$a(this,s)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return kh(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(as),gx=os("ObservableValue",is),Kn=function(){function e(n){this.dependenciesState_=ze.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=ze.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new cl(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=ll.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||Ve(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Qs("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(){wx(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&&Ve(32,this.name_,this.derivation),de.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)Tu(this)&&(this.warnAboutUntrackedRead_(),Tn(),this.value_=this.computeValue_(!1),On());else if(tg(this),Tu(this)){var r=de.trackingContext;this.keepAlive_&&!r&&(de.trackingContext=this),this.trackAndCompute()&&yx(this),de.trackingContext=r}var s=this.value_;if(ul(s))throw s.cause;return s},t.set=function(r){if(this.setter_){this.isRunningSetter&&Ve(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,r)}finally{this.isRunningSetter=!1}}else Ve(34,this.name_)},t.trackAndCompute=function(){var r=this.value_,s=this.dependenciesState_===ze.NOT_TRACKING_,o=this.computeValue_(!0),a=s||ul(r)||ul(o)||!this.equals_(r,o);return a&&(this.value_=o),a},t.computeValue_=function(r){this.isComputing=!0;var s=Eu(!1),o;if(r)o=Yh(this,this.derivation,this.scope_);else if(de.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(a){o=new cl(a)}return Pu(s),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(Ou(this),this.value_=void 0)},t.observe_=function(r,s){var o=this,a=!0,i=void 0;return Mx(function(){var c=o.get();if(!a||s){var u=Rs();r({observableKind:"computed",debugObjectName:o.name_,type:fr,object:o,newValue:c,oldValue:i}),Fr(u)}a=!1,i=c})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return kh(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Io(e,[{key:"isComputing",get:function(){return gn(this.flags_,e.isComputingMask_)},set:function(r){this.flags_=mn(this.flags_,e.isComputingMask_,r)}},{key:"isRunningSetter",get:function(){return gn(this.flags_,e.isRunningSetterMask_)},set:function(r){this.flags_=mn(this.flags_,e.isRunningSetterMask_,r)}},{key:"isBeingObserved",get:function(){return gn(this.flags_,e.isBeingObservedMask_)},set:function(r){this.flags_=mn(this.flags_,e.isBeingObservedMask_,r)}},{key:"isPendingUnobservation",get:function(){return gn(this.flags_,e.isPendingUnobservationMask_)},set:function(r){this.flags_=mn(this.flags_,e.isPendingUnobservationMask_,r)}},{key:"diffValue",get:function(){return gn(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=mn(this.flags_,e.diffValueMask_,r===1)}}])}();Kn.isComputingMask_=1,Kn.isRunningSetterMask_=2,Kn.isBeingObservedMask_=4,Kn.isPendingUnobservationMask_=8,Kn.diffValueMask_=16;var Oa=os("ComputedValue",Kn),ze;(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_"})(ze||(ze={}));var ll;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(ll||(ll={}));var cl=function(t){this.cause=void 0,this.cause=t};function ul(e){return e instanceof cl}function Tu(e){switch(e.dependenciesState_){case ze.UP_TO_DATE_:return!1;case ze.NOT_TRACKING_:case ze.STALE_:return!0;case ze.POSSIBLY_STALE_:{for(var t=Au(!0),n=Rs(),r=e.observing_,s=r.length,o=0;o<s;o++){var a=r[o];if(Oa(a)){if(de.disableErrorBoundaries)a.get();else try{a.get()}catch{return Fr(n),Aa(t),!0}if(e.dependenciesState_===ze.STALE_)return Fr(n),Aa(t),!0}}return Jh(e),Fr(n),Aa(t),!1}}}function JI(e){}function Yh(e,t,n){var r=Au(!0);Jh(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++de.runId;var s=de.trackingDerivation;de.trackingDerivation=e,de.inBatch++;var o;if(de.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(a){o=new cl(a)}return de.inBatch--,de.trackingDerivation=s,mx(e),Aa(r),o}function mx(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,r=ze.UP_TO_DATE_,s=0,o=e.unboundDepsCount_,a=0;a<o;a++){var i=n[a];i.diffValue===0&&(i.diffValue=1,s!==a&&(n[s]=i),s++),i.dependenciesState_>r&&(r=i.dependenciesState_)}for(n.length=s,e.newObserving_=null,o=t.length;o--;){var c=t[o];c.diffValue===0&&Rh(c,e),c.diffValue=0}for(;s--;){var u=n[s];u.diffValue===1&&(u.diffValue=0,vx(u,e))}r!==ze.UP_TO_DATE_&&(e.dependenciesState_=r,e.onBecomeStale_())}function Ou(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Rh(t[n],e);e.dependenciesState_=ze.NOT_TRACKING_}function Xh(e){var t=Rs();try{return e()}finally{Fr(t)}}function Rs(){var e=de.trackingDerivation;return de.trackingDerivation=null,e}function Fr(e){de.trackingDerivation=e}function Au(e){var t=de.allowStateReads;return de.allowStateReads=e,t}function Aa(e){de.allowStateReads=e}function Jh(e){if(e.dependenciesState_!==ze.UP_TO_DATE_){e.dependenciesState_=ze.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=ze.UP_TO_DATE_}}var dl=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},pl=!0,Qh=!1,de=function(){var e=Qi();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(pl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new dl().version&&(pl=!1),pl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new dl):(setTimeout(function(){Qh||Ve(35)},1),new dl)}();function bx(){if((de.pendingReactions.length||de.inBatch||de.isRunningReactions)&&Ve(36),Qh=!0,pl){var e=Qi();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),de=new dl}}function vx(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Rh(e,t){e.observers_.delete(t),e.observers_.size===0&&eg(e)}function eg(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,de.pendingUnobservations.push(e))}function Tn(){de.inBatch++}function On(){if(--de.inBatch===0){rg();for(var e=de.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 Kn&&n.suspend_())}de.pendingUnobservations=[]}}function tg(e){var t=de.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&de.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&de.inBatch>0&&eg(e),!1)}function ng(e){e.lowestObserverState_!==ze.STALE_&&(e.lowestObserverState_=ze.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ze.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=ze.STALE_}))}function yx(e){e.lowestObserverState_!==ze.STALE_&&(e.lowestObserverState_=ze.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ze.POSSIBLY_STALE_?t.dependenciesState_=ze.STALE_:t.dependenciesState_===ze.UP_TO_DATE_&&(e.lowestObserverState_=ze.UP_TO_DATE_)}))}function wx(e){e.lowestObserverState_===ze.UP_TO_DATE_&&(e.lowestObserverState_=ze.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===ze.UP_TO_DATE_&&(t.dependenciesState_=ze.POSSIBLY_STALE_,t.onBecomeStale_())}))}var Br=function(){function e(n,r,s,o){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=ze.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=ll.NONE,this.name_=n,this.onInvalidate_=r,this.errorHandler_=s,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,de.pendingReactions.push(this),rg())},t.runReaction_=function(){if(!this.isDisposed){Tn(),this.isScheduled=!1;var r=de.trackingContext;if(de.trackingContext=this,Tu(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Bt.NODE_ENV!=="production"&&this.isTrackPending&&eo()}catch(s){this.reportExceptionInDerivation_(s)}}de.trackingContext=r,On()}},t.track=function(r){if(!this.isDisposed){Tn(),this.isRunning=!0;var s=de.trackingContext;de.trackingContext=this;var o=Yh(this,r,void 0);de.trackingContext=s,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ou(this),ul(o)&&this.reportExceptionInDerivation_(o.cause),On()}},t.reportExceptionInDerivation_=function(r){var s=this;if(this.errorHandler_){this.errorHandler_(r,this);return}if(de.disableErrorBoundaries)throw r;var o="[mobx] uncaught error in '"+this+"'";de.suppressReactionErrors||console.error(o,r),de.globalReactionErrorHandlers.forEach(function(a){return a(r,s)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Tn(),Ou(this),On()))},t.getDisposer_=function(r){var s=this,o=function a(){s.dispose(),r==null||r.removeEventListener==null||r.removeEventListener("abort",a)};return r==null||r.addEventListener==null||r.addEventListener("abort",o),o[we]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(r){},Io(e,[{key:"isDisposed",get:function(){return gn(this.flags_,e.isDisposedMask_)},set:function(r){this.flags_=mn(this.flags_,e.isDisposedMask_,r)}},{key:"isScheduled",get:function(){return gn(this.flags_,e.isScheduledMask_)},set:function(r){this.flags_=mn(this.flags_,e.isScheduledMask_,r)}},{key:"isTrackPending",get:function(){return gn(this.flags_,e.isTrackPendingMask_)},set:function(r){this.flags_=mn(this.flags_,e.isTrackPendingMask_,r)}},{key:"isRunning",get:function(){return gn(this.flags_,e.isRunningMask_)},set:function(r){this.flags_=mn(this.flags_,e.isRunningMask_,r)}},{key:"diffValue",get:function(){return gn(this.flags_,e.diffValueMask_)?1:0},set:function(r){this.flags_=mn(this.flags_,e.diffValueMask_,r===1)}}])}();Br.isDisposedMask_=1,Br.isScheduledMask_=2,Br.isTrackPendingMask_=4,Br.isRunningMask_=8,Br.diffValueMask_=16;var Sx=100,_u=function(t){return t()};function rg(){de.inBatch>0||de.isRunningReactions||_u(Cx)}function Cx(){de.isRunningReactions=!0;for(var e=de.pendingReactions,t=0;e.length>0;){++t===Sx&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),r=0,s=n.length;r<s;r++)n[r].runReaction_()}de.isRunningReactions=!1}var fl=os("Reaction",Br);function xx(e){var t=_u;_u=function(r){return e(function(){return t(r)})}}function eo(){return Bt.NODE_ENV!=="production"}function QI(e){}function RI(e){}function eV(e){}function Ex(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var sg="action",Px="action.bound",og="autoAction",Tx="autoAction.bound",Ox="<unnamed action>",Mu=Ta(sg),Ax=Ta(Px,{bound:!0}),Lu=Ta(og,{autoAction:!0}),_x=Ta(Tx,{autoAction:!0,bound:!0});function ag(e){var t=function(r,s){if(Gn(r))return Qs(r.name||Ox,r,e);if(Gn(s))return Qs(r,s,e);if(Pa(s))return(e?Lu:Mu).decorate_20223_(r,s);if(Ys(s))return Ea(r,s,e?Lu:Mu);if(Ys(r))return pr(Ta(e?og:sg,{name:r,autoAction:e}))};return t}var Ho=ag(!1);Object.assign(Ho,Mu);var _a=ag(!0);Object.assign(_a,Lu),Ho.bound=pr(Ax),_a.bound=pr(_x);function Ma(e){return Gn(e)&&e.isMobxAction===!0}function Mx(e,t){var n,r,s,o;t===void 0&&(t=Ah);var a=(n=(r=t)==null?void 0:r.name)!=null?n:"Autorun",i=!t.scheduler&&!t.delay,c;if(i)c=new Br(a,function(){this.track(p)},t.onError,t.requiresObservable);else{var u=Nx(t),d=!1;c=new Br(a,function(){d||(d=!0,u(function(){d=!1,c.isDisposed||c.track(p)}))},t.onError,t.requiresObservable)}function p(){e(c)}return(s=t)!=null&&(s=s.signal)!=null&&s.aborted||c.schedule_(),c.getDisposer_((o=t)==null?void 0:o.signal)}var Lx=function(t){return t()};function Nx(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Lx}var $x="onBO",kx="onBUO";function Ix(e,t,n){return lg($x,e,t,n)}function ig(e,t,n){return lg(kx,e,t,n)}function lg(e,t,n,r){var s=vl(t),o=Gn(r)?r:n,a=e+"L";return s[a]?s[a].add(o):s[a]=new Set([o]),function(){var i=s[a];i&&(i.delete(o),i.size===0&&delete s[a])}}var Vx="never",hl="always",Hx="observed";function jx(e){e.isolateGlobalState===!0&&bx();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(de.useProxies=t===hl?!0:t===Vx?!1:typeof Proxy<"u"),t==="ifavailable"&&(de.verifyProxies=!0),n!==void 0){var r=n===hl?hl:n===Hx;de.enforceActions=r,de.allowStateChanges=!(r===!0||r===hl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(s){s in e&&(de[s]=!!e[s])}),de.allowStateReads=!de.observableRequiresReaction,e.reactionScheduler&&xx(e.reactionScheduler)}function cg(e,t,n,r){var s=bC(t);return ds(function(){var o=no(e,r)[we];ko(s).forEach(function(a){o.extend_(a,s[a],n&&a in n?n[a]:!0)})}),e}function Dx(e,t){return ug(vl(e,t))}function ug(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Fx(e.observing_).map(ug)),t}function Fx(e){return Array.from(new Set(e))}var Bx=0;function dg(){this.message="FLOW_CANCELLED"}dg.prototype=Object.create(Error.prototype);var Nu=Dh("flow"),zx=Dh("flow.bound",{bound:!0}),to=Object.assign(function(t,n){if(Pa(n))return Nu.decorate_20223_(t,n);if(Ys(n))return Ea(t,n,Nu);var r=t,s=r.name||"<unnamed flow>",o=function(){var i=this,c=arguments,u=++Bx,d=Ho(s+" - runid: "+u+" - init",r).apply(i,c),p,h=void 0,g=new Promise(function(m,b){var v=0;p=b;function w(C){h=void 0;var x;try{x=Ho(s+" - runid: "+u+" - yield "+v++,d.next).call(d,C)}catch(E){return b(E)}S(x)}function y(C){h=void 0;var x;try{x=Ho(s+" - runid: "+u+" - yield "+v++,d.throw).call(d,C)}catch(E){return b(E)}S(x)}function S(C){if(Gn(C==null?void 0:C.then)){C.then(S,b);return}return C.done?m(C.value):(h=Promise.resolve(C.value),h.then(w,y))}w(void 0)});return g.cancel=Ho(s+" - runid: "+u+" - cancel",function(){try{h&&pg(h);var m=d.return(void 0),b=Promise.resolve(m.value);b.then(No,No),pg(b),p(new dg)}catch(v){p(v)}}),g};return o.isMobXFlow=!0,o},Nu);to.bound=pr(zx);function pg(e){Gn(e.cancel)&&e.cancel()}function La(e){return(e==null?void 0:e.isMobXFlow)===!0}function Ux(e,t){return e?Ia(e)||!!e[we]||wu(e)||fl(e)||Oa(e):!1}function $u(e){return Ux(e)}function Wx(e){if(Ia(e))return e[we].ownKeys_();Ve(38)}function gl(e,t,n){return e.set(t,n),n}function jo(e,t){if(e==null||typeof e!="object"||e instanceof Date||!$u(e))return e;if(gx(e)||Oa(e))return jo(e.get(),t);if(t.has(e))return t.get(e);if(ka(e)){var n=gl(t,e,new Array(e.length));return e.forEach(function(a,i){n[i]=jo(a,t)}),n}if(Jn(e)){var r=gl(t,e,new Set);return e.forEach(function(a){r.add(jo(a,t))}),r}if(us(e)){var s=gl(t,e,new Map);return e.forEach(function(a,i){s.set(i,jo(a,t))}),s}else{var o=gl(t,e,{});return Wx(e).forEach(function(a){Ca.propertyIsEnumerable.call(e,a)&&(o[a]=jo(e[a],t))}),o}}function ls(e,t){return jo(e,new Map)}function zr(e,t){t===void 0&&(t=void 0),Tn();try{return e.apply(t)}finally{On()}}function Do(e){return e[we]}var Gx={has:function(t,n){return Do(t).has_(n)},get:function(t,n){return Do(t).get_(n)},set:function(t,n,r){var s;return Ys(n)?(s=Do(t).set_(n,r,!0))!=null?s:!0:!1},deleteProperty:function(t,n){var r;return Ys(n)?(r=Do(t).delete_(n,!0))!=null?r:!0:!1},defineProperty:function(t,n,r){var s;return(s=Do(t).defineProperty_(n,r))!=null?s:!0},ownKeys:function(t){return Do(t).ownKeys_()},preventExtensions:function(t){Ve(13)}};function qx(e,t){var n,r;return _h(),e=no(e,t),(r=(n=e[we]).proxy_)!=null?r:n.proxy_=new Proxy(e,Gx)}function An(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Na(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Mh(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function _n(e,t){var n=Rs();try{for(var r=[].concat(e.interceptors_||[]),s=0,o=r.length;s<o&&(t=r[s](t),t&&!t.type&&Ve(14),!!t);s++);return t}finally{Fr(n)}}function Zn(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function $a(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Mh(function(){var r=n.indexOf(t);r!==-1&&n.splice(r,1)})}function Yn(e,t){var n=Rs(),r=e.changeListeners_;if(r){r=r.slice();for(var s=0,o=r.length;s<o;s++)r[s](t);Fr(n)}}function Kx(e,t,n){return ds(function(){var r,s=no(e,n)[we];Bt.NODE_ENV!=="production"&&t&&e[qn],(r=t)!=null||(t=CC(e)),ko(t).forEach(function(o){return s.make_(o,t[o])})}),e}var ku=Symbol("mobx-keys");function Xt(e,t,n){return Hr(e)?cg(e,e,t,n):(ds(function(){var r=no(e,n)[we];if(!e[ku]){var s=Object.getPrototypeOf(e),o=new Set([].concat(ko(e),ko(s)));o.delete("constructor"),o.delete(we),xa(s,ku,o)}e[ku].forEach(function(a){return r.make_(a,t&&a in t?t[a]:!0)})}),e)}var fg="splice",fr="update",Zx=1e4,Yx={get:function(t,n){var r=t[we];return n===we?r:n==="length"?r.getArrayLength_():typeof n=="string"&&!isNaN(n)?r.get_(parseInt(n)):Dr(ml,n)?ml[n]:t[n]},set:function(t,n,r){var s=t[we];return n==="length"&&s.setArrayLength_(r),typeof n=="symbol"||isNaN(n)?t[n]=r:s.set_(parseInt(n),r),!0},preventExtensions:function(){Ve(15)}},Iu=function(){function e(n,r,s,o){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=s,this.legacyMode_=o,this.atom_=new as(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 Na(this,r)},t.observe_=function(r,s){return s===void 0&&(s=!1),s&&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}),$a(this,r)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(r){(typeof r!="number"||isNaN(r)||r<0)&&Ve("Out of range: "+r);var s=this.values_.length;if(r!==s)if(r>s){for(var o=new Array(r-s),a=0;a<r-s;a++)o[a]=void 0;this.spliceWithArray_(s,0,o)}else this.spliceWithArray_(r,s-r)},t.updateArrayLength_=function(r,s){r!==this.lastKnownLength_&&Ve(16),this.lastKnownLength_+=s,this.legacyMode_&&s>0&&Tg(r+s+1)},t.spliceWithArray_=function(r,s,o){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?s=i-r:s==null?s=0:s=Math.max(0,Math.min(s,i-r)),o===void 0&&(o=vu),An(this)){var c=_n(this,{object:this.proxy_,type:fg,index:r,removedCount:s,added:o});if(!c)return vu;s=c.removedCount,o=c.added}if(o=o.length===0?o:o.map(function(p){return a.enhancer_(p,void 0)}),this.legacyMode_||Bt.NODE_ENV!=="production"){var u=o.length-s;this.updateArrayLength_(i,u)}var d=this.spliceItemsIntoValues_(r,s,o);return(s!==0||o.length!==0)&&this.notifyArraySplice_(r,o,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(r,s,o){if(o.length<Zx){var a;return(a=this.values_).splice.apply(a,[r,s].concat(o))}else{var i=this.values_.slice(r,r+s),c=this.values_.slice(r+s);this.values_.length+=o.length-s;for(var u=0;u<o.length;u++)this.values_[r+u]=o[u];for(var d=0;d<c.length;d++)this.values_[r+o.length+d]=c[d];return i}},t.notifyArrayChildUpdate_=function(r,s,o){var a=!this.owned_&&eo(),i=Zn(this),c=i||a?{observableKind:"array",object:this.proxy_,type:fr,debugObjectName:this.atom_.name_,index:r,newValue:s,oldValue:o}:null;this.atom_.reportChanged(),i&&Yn(this,c)},t.notifyArraySplice_=function(r,s,o){var a=!this.owned_&&eo(),i=Zn(this),c=i||a?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:fg,index:r,removed:o,added:s,removedCount:o.length,addedCount:s.length}:null;this.atom_.reportChanged(),i&&Yn(this,c)},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,s){var o=this.values_;if(this.legacyMode_&&r>o.length&&Ve(17,r,o.length),r<o.length){this.atom_;var a=o[r];if(An(this)){var i=_n(this,{type:fr,object:this.proxy_,index:r,newValue:s});if(!i)return;s=i.newValue}s=this.enhancer_(s,a);var c=s!==a;c&&(o[r]=s,this.notifyArrayChildUpdate_(r,s,a))}else{for(var u=new Array(r+1-o.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=s,this.spliceWithArray_(o.length,0,u)}},e}();function Xx(e,t,n,r){return n===void 0&&(n="ObservableArray"),r===void 0&&(r=!1),_h(),ds(function(){var s=new Iu(n,t,r,!1);Nh(s.values_,we,s);var o=new Proxy(s.values_,Yx);return s.proxy_=o,e&&e.length&&s.spliceWithArray_(0,0,e),o})}var ml={clear:function(){return this.splice(0)},replace:function(t){var n=this[we];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var r=arguments.length,s=new Array(r>2?r-2:0),o=2;o<r;o++)s[o-2]=arguments[o];var a=this[we];switch(arguments.length){case 0:return[];case 1:return a.spliceWithArray_(t);case 2:return a.spliceWithArray_(t,n)}return a.spliceWithArray_(t,n,s)},spliceWithArray:function(t,n,r){return this[we].spliceWithArray_(t,n,r)},push:function(){for(var t=this[we],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(t.values_.length,0,r),t.values_.length},pop:function(){return this.splice(Math.max(this[we].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[we],n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.spliceWithArray_(0,0,r),t.values_.length},reverse:function(){return de.trackingDerivation&&Ve(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){de.trackingDerivation&&Ve(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[we],r=n.dehanceValues_(n.values_).indexOf(t);return r>-1?(this.splice(r,1),!0):!1}};lt("at",bn),lt("concat",bn),lt("flat",bn),lt("includes",bn),lt("indexOf",bn),lt("join",bn),lt("lastIndexOf",bn),lt("slice",bn),lt("toString",bn),lt("toLocaleString",bn),lt("toSorted",bn),lt("toSpliced",bn),lt("with",bn),lt("every",Xn),lt("filter",Xn),lt("find",Xn),lt("findIndex",Xn),lt("findLast",Xn),lt("findLastIndex",Xn),lt("flatMap",Xn),lt("forEach",Xn),lt("map",Xn),lt("some",Xn),lt("toReversed",Xn),lt("reduce",hg),lt("reduceRight",hg);function lt(e,t){typeof Array.prototype[e]=="function"&&(ml[e]=t(e))}function bn(e){return function(){var t=this[we];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function Xn(e){return function(t,n){var r=this,s=this[we];s.atom_.reportObserved();var o=s.dehanceValues_(s.values_);return o[e](function(a,i){return t.call(n,a,i,r)})}}function hg(e){return function(){var t=this,n=this[we];n.atom_.reportObserved();var r=n.dehanceValues_(n.values_),s=arguments[0];return arguments[0]=function(o,a,i){return s(o,a,i,t)},r[e].apply(r,arguments)}}var Jx=os("ObservableArrayAdministration",Iu);function ka(e){return el(e)&&Jx(e[we])}var Qx={},cs="add",bl="delete",gg=function(){function e(n,r,s){var o=this;r===void 0&&(r=Js),s===void 0&&(s="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[we]=Qx,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_=s,Gn(Map)||Ve(18),ds(function(){o.keysAtom_=Hh(Bt.NODE_ENV!=="production"?o.name_+".keys()":"ObservableMap.keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var t=e.prototype;return t.has_=function(r){return this.data_.has(r)},t.has=function(r){var s=this;if(!de.trackingDerivation)return this.has_(r);var o=this.hasMap_.get(r);if(!o){var a=o=new is(this.has_(r),nl,"ObservableMap.key?",!1);this.hasMap_.set(r,a),ig(a,function(){return s.hasMap_.delete(r)})}return o.get()},t.set=function(r,s){var o=this.has_(r);if(An(this)){var a=_n(this,{type:o?fr:cs,object:this,newValue:s,name:r});if(!a)return this;s=a.newValue}return o?this.updateValue_(r,s):this.addValue_(r,s),this},t.delete=function(r){var s=this;if(this.keysAtom_,An(this)){var o=_n(this,{type:bl,object:this,name:r});if(!o)return!1}if(this.has_(r)){var a=eo(),i=Zn(this),c=i||a?{observableKind:"map",debugObjectName:this.name_,type:bl,object:this,oldValue:this.data_.get(r).value_,name:r}:null;return zr(function(){var u;s.keysAtom_.reportChanged(),(u=s.hasMap_.get(r))==null||u.setNewValue_(!1);var d=s.data_.get(r);d.setNewValue_(void 0),s.data_.delete(r)}),i&&Yn(this,c),!0}return!1},t.updateValue_=function(r,s){var o=this.data_.get(r);if(s=o.prepareNewValue_(s),s!==de.UNCHANGED){var a=eo(),i=Zn(this),c=i||a?{observableKind:"map",debugObjectName:this.name_,type:fr,object:this,oldValue:o.value_,name:r,newValue:s}:null;o.setNewValue_(s),i&&Yn(this,c)}},t.addValue_=function(r,s){var o=this;this.keysAtom_,zr(function(){var u,d=new is(s,o.enhancer_,"ObservableMap.key",!1);o.data_.set(r,d),s=d.value_,(u=o.hasMap_.get(r))==null||u.setNewValue_(!0),o.keysAtom_.reportChanged()});var a=eo(),i=Zn(this),c=i||a?{observableKind:"map",debugObjectName:this.name_,type:cs,object:this,name:r,newValue:s}:null;i&&Yn(this,c)},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,s=this.keys();return mg({next:function(){var a=s.next(),i=a.done,c=a.value;return{done:i,value:i?void 0:r.get(c)}}})},t.entries=function(){var r=this,s=this.keys();return mg({next:function(){var a=s.next(),i=a.done,c=a.value;return{done:i,value:i?void 0:[c,r.get(c)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(r,s){for(var o=Vo(this),a;!(a=o()).done;){var i=a.value,c=i[0],u=i[1];r.call(s,u,c,this)}},t.merge=function(r){var s=this;return us(r)&&(r=new Map(r)),zr(function(){Hr(r)?mC(r).forEach(function(o){return s.set(o,r[o])}):Array.isArray(r)?r.forEach(function(o){var a=o[0],i=o[1];return s.set(a,i)}):$o(r)?(gC(r)||Ve(19,r),r.forEach(function(o,a){return s.set(a,o)})):r!=null&&Ve(20,r)}),this},t.clear=function(){var r=this;zr(function(){Xh(function(){for(var s=Vo(r.keys()),o;!(o=s()).done;){var a=o.value;r.delete(a)}})})},t.replace=function(r){var s=this;return zr(function(){for(var o=Rx(r),a=new Map,i=!1,c=Vo(s.data_.keys()),u;!(u=c()).done;){var d=u.value;if(!o.has(d)){var p=s.delete(d);if(p)i=!0;else{var h=s.data_.get(d);a.set(d,h)}}}for(var g=Vo(o.entries()),m;!(m=g()).done;){var b=m.value,v=b[0],w=b[1],y=s.data_.has(v);if(s.set(v,w),s.data_.has(v)){var S=s.data_.get(v);a.set(v,S),y||(i=!0)}}if(!i)if(s.data_.size!==a.size)s.keysAtom_.reportChanged();else for(var C=s.data_.keys(),x=a.keys(),E=C.next(),P=x.next();!E.done;){if(E.value!==P.value){s.keysAtom_.reportChanged();break}E=C.next(),P=x.next()}s.data_=a}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(r,s){return $a(this,r)},t.intercept_=function(r){return Na(this,r)},Io(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),us=os("ObservableMap",gg);function mg(e){return e[Symbol.toStringTag]="MapIterator",Bu(e)}function Rx(e){if($o(e)||us(e))return e;if(Array.isArray(e))return new Map(e);if(Hr(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return Ve(21,e)}var e5={},bg=function(){function e(n,r,s){var o=this;r===void 0&&(r=Js),s===void 0&&(s="ObservableSet"),this.name_=void 0,this[we]=e5,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_=s,Gn(Set)||Ve(22),this.enhancer_=function(a,i){return r(a,i,s)},ds(function(){o.atom_=Hh(o.name_),n&&o.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;zr(function(){Xh(function(){for(var s=Vo(r.data_.values()),o;!(o=s()).done;){var a=o.value;r.delete(a)}})})},t.forEach=function(r,s){for(var o=Vo(this),a;!(a=o()).done;){var i=a.value;r.call(s,i,i,this)}},t.add=function(r){var s=this;if(this.atom_,An(this)){var o=_n(this,{type:cs,object:this,newValue:r});if(!o)return this}if(!this.has(r)){zr(function(){s.data_.add(s.enhancer_(r,void 0)),s.atom_.reportChanged()});var a=Bt.NODE_ENV!=="production",i=Zn(this),c=i||a?{observableKind:"set",debugObjectName:this.name_,type:cs,object:this,newValue:r}:null;i&&Yn(this,c)}return this},t.delete=function(r){var s=this;if(An(this)){var o=_n(this,{type:bl,object:this,oldValue:r});if(!o)return!1}if(this.has(r)){var a=Bt.NODE_ENV!=="production",i=Zn(this),c=i||a?{observableKind:"set",debugObjectName:this.name_,type:bl,object:this,oldValue:r}:null;return zr(function(){s.atom_.reportChanged(),s.data_.delete(r)}),i&&Yn(this,c),!0}return!1},t.has=function(r){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(r))},t.entries=function(){var r=0,s=Array.from(this.keys()),o=Array.from(this.values());return vg({next:function(){var i=r;return r+=1,i<o.length?{value:[s[i],o[i]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var r=this,s=0,o=Array.from(this.data_.values());return vg({next:function(){return s<o.length?{value:r.dehanceValue_(o[s++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(r){if(jr(r)&&!Jn(r))return r.intersection(this);var s=new Set(this);return s.intersection(r)},t.union=function(r){if(jr(r)&&!Jn(r))return r.union(this);var s=new Set(this);return s.union(r)},t.difference=function(r){return new Set(this).difference(r)},t.symmetricDifference=function(r){if(jr(r)&&!Jn(r))return r.symmetricDifference(this);var s=new Set(this);return s.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(jr(r)&&!Jn(r))return r.isDisjointFrom(this);var s=new Set(this);return s.isDisjointFrom(r)},t.replace=function(r){var s=this;return Jn(r)&&(r=new Set(r)),zr(function(){Array.isArray(r)?(s.clear(),r.forEach(function(o){return s.add(o)})):jr(r)?(s.clear(),r.forEach(function(o){return s.add(o)})):r!=null&&Ve("Cannot initialize set from "+r)}),this},t.observe_=function(r,s){return $a(this,r)},t.intercept_=function(r){return Na(this,r)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Io(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),Jn=os("ObservableSet",bg);function vg(e){return e[Symbol.toStringTag]="SetIterator",Bu(e)}var yg=Object.create(null),wg="remove",Sg=function(){function e(n,r,s,o){r===void 0&&(r=new Map),o===void 0&&(o=ZC),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_=s,this.defaultAnnotation_=o,this.keysAtom_=new as("ObservableObject.keys"),this.isPlainObject_=Hr(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(r){return this.values_.get(r).get()},t.setObservablePropValue_=function(r,s){var o=this.values_.get(r);if(o instanceof Kn)return o.set(s),!0;if(An(this)){var a=_n(this,{type:fr,object:this.proxy_||this.target_,name:r,newValue:s});if(!a)return null;s=a.newValue}if(s=o.prepareNewValue_(s),s!==de.UNCHANGED){var i=Zn(this),c=Bt.NODE_ENV!=="production",u=i||c?{type:fr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:r,newValue:s}:null;o.setNewValue_(s),i&&Yn(this,u)}return!0},t.get_=function(r){return de.trackingDerivation&&!Dr(this.target_,r)&&this.has_(r),this.target_[r]},t.set_=function(r,s,o){return o===void 0&&(o=!1),Dr(this.target_,r)?this.values_.has(r)?this.setObservablePropValue_(r,s):o?Reflect.set(this.target_,r,s):(this.target_[r]=s,!0):this.extend_(r,{value:s,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(r){if(!de.trackingDerivation)return r in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var s=this.pendingKeys_.get(r);return s||(s=new is(r in this.target_,nl,"ObservableObject.key?",!1),this.pendingKeys_.set(r,s)),s.get()},t.make_=function(r,s){if(s===!0&&(s=this.defaultAnnotation_),s!==!1){if(!(r in this.target_)){var o;if((o=this.target_[qn])!=null&&o[r])return;Ve(1,s.annotationType_,this.name_+"."+r.toString())}for(var a=this.target_;a&&a!==Ca;){var i=Ri(a,r);if(i){var c=s.make_(this,r,i,a);if(c===0)return;if(c===1)break}a=Object.getPrototypeOf(a)}xg(this,s,r)}},t.extend_=function(r,s,o,a){if(a===void 0&&(a=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(r,s,a);var i=o.extend_(this,r,s,a);return i&&xg(this,o,r),i},t.defineProperty_=function(r,s,o){o===void 0&&(o=!1),this.keysAtom_;try{Tn();var a=this.delete_(r);if(!a)return a;if(An(this)){var i=_n(this,{object:this.proxy_||this.target_,name:r,type:cs,newValue:s.value});if(!i)return null;var c=i.newValue;s.value!==c&&(s=Xs({},s,{value:c}))}if(o){if(!Reflect.defineProperty(this.target_,r,s))return!1}else dr(this.target_,r,s);this.notifyPropertyAddition_(r,s.value)}finally{On()}return!0},t.defineObservableProperty_=function(r,s,o,a){a===void 0&&(a=!1),this.keysAtom_;try{Tn();var i=this.delete_(r);if(!i)return i;if(An(this)){var c=_n(this,{object:this.proxy_||this.target_,name:r,type:cs,newValue:s});if(!c)return null;s=c.newValue}var u=Cg(r),d={configurable:de.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(a){if(!Reflect.defineProperty(this.target_,r,d))return!1}else dr(this.target_,r,d);var p=new is(s,o,Bt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key",!1);this.values_.set(r,p),this.notifyPropertyAddition_(r,p.value_)}finally{On()}return!0},t.defineComputedProperty_=function(r,s,o){o===void 0&&(o=!1),this.keysAtom_;try{Tn();var a=this.delete_(r);if(!a)return a;if(An(this)){var i=_n(this,{object:this.proxy_||this.target_,name:r,type:cs,newValue:void 0});if(!i)return null}s.name||(s.name=Bt.NODE_ENV!=="production"?this.name_+"."+r.toString():"ObservableObject.key"),s.context=this.proxy_||this.target_;var c=Cg(r),u={configurable:de.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:c.get,set:c.set};if(o){if(!Reflect.defineProperty(this.target_,r,u))return!1}else dr(this.target_,r,u);this.values_.set(r,new Kn(s)),this.notifyPropertyAddition_(r,void 0)}finally{On()}return!0},t.delete_=function(r,s){if(s===void 0&&(s=!1),this.keysAtom_,!Dr(this.target_,r))return!0;if(An(this)){var o=_n(this,{object:this.proxy_||this.target_,name:r,type:wg});if(!o)return null}try{var a;Tn();var i=Zn(this),c=Bt.NODE_ENV!=="production"&&eo(),u=this.values_.get(r),d=void 0;if(!u&&(i||c)){var p;d=(p=Ri(this.target_,r))==null?void 0:p.value}if(s){if(!Reflect.deleteProperty(this.target_,r))return!1}else delete this.target_[r];if(Bt.NODE_ENV,u&&(this.values_.delete(r),u instanceof is&&(d=u.value_),ng(u)),this.keysAtom_.reportChanged(),(a=this.pendingKeys_)==null||(a=a.get(r))==null||a.set(r in this.target_),i||c){var h={type:wg,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:r};Bt.NODE_ENV,i&&Yn(this,h),Bt.NODE_ENV}}finally{On()}return!0},t.observe_=function(r,s){return $a(this,r)},t.intercept_=function(r){return Na(this,r)},t.notifyPropertyAddition_=function(r,s){var o,a=Zn(this),i=Bt.NODE_ENV!=="production";if(a||i){var c=a||i?{type:cs,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:r,newValue:s}:null;a&&Yn(this,c)}(o=this.pendingKeys_)==null||(o=o.get(r))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ko(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function no(e,t){var n;if(Dr(e,we))return e;var r=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",s=new Sg(e,new Map,String(r),ox(t));return xa(e,we,s),e}var t5=os("ObservableObjectAdministration",Sg);function Cg(e){return yg[e]||(yg[e]={get:function(){return this[we].getObservablePropValue_(e)},set:function(n){return this[we].setObservablePropValue_(e,n)}})}function Ia(e){return el(e)?t5(e[we]):!1}function xg(e,t,n){var r;(r=e.target_[qn])==null||delete r[n]}var n5=Pg(0),r5=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Vu=0,Eg=function(){};function s5(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}s5(Eg,Array.prototype);var Hu=function(e){function t(r,s,o,a){var i;return o===void 0&&(o="ObservableArray"),a===void 0&&(a=!1),i=e.call(this)||this,ds(function(){var c=new Iu(o,s,a,!0);c.proxy_=i,Nh(i,we,c),r&&r.length&&i.spliceWithArray(0,0,r),r5&&Object.defineProperty(i,"0",n5)}),i}Vh(t,e);var n=t.prototype;return n.concat=function(){this[we].atom_.reportObserved();for(var s=arguments.length,o=new Array(s),a=0;a<s;a++)o[a]=arguments[a];return Array.prototype.concat.apply(this.slice(),o.map(function(i){return ka(i)?i.slice():i}))},n[Symbol.iterator]=function(){var r=this,s=0;return Bu({next:function(){return s<r.length?{value:r[s++],done:!1}:{done:!0,value:void 0}}})},Io(t,[{key:"length",get:function(){return this[we].getArrayLength_()},set:function(s){this[we].setArrayLength_(s)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(Eg);Object.entries(ml).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&xa(Hu.prototype,t,n)});function Pg(e){return{enumerable:!1,configurable:!0,get:function(){return this[we].get_(e)},set:function(n){this[we].set_(e,n)}}}function o5(e){dr(Hu.prototype,""+e,Pg(e))}function Tg(e){if(e>Vu){for(var t=Vu;t<e+100;t++)o5(t);Vu=e}}Tg(1e3);function a5(e,t,n){return new Hu(e,t,n)}function vl(e,t){if(typeof e=="object"&&e!==null){if(ka(e))return t!==void 0&&Ve(23),e[we].atom_;if(Jn(e))return e.atom_;if(us(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||Ve(25,t,ju(e)),n}if(Ia(e)){if(!t)return Ve(26);var r=e[we].values_.get(t);return r||Ve(27,t,ju(e)),r}if(wu(e)||Oa(e)||fl(e))return e}else if(Gn(e)&&fl(e[we]))return e[we];Ve(28)}function i5(e,t){if(e||Ve(29),wu(e)||Oa(e)||fl(e)||us(e)||Jn(e))return e;if(e[we])return e[we];Ve(24,e)}function ju(e,t){var n;if(t!==void 0)n=vl(e,t);else{if(Ma(e))return e.name;Ia(e)||us(e)||Jn(e)?n=i5(e):n=vl(e)}return n.name_}function ds(e){var t=Rs(),n=Eu(!0);Tn();try{return e()}finally{On(),Pu(n),Fr(t)}}var Og=Ca.toString;function Du(e,t,n){return n===void 0&&(n=-1),Fu(e,t,n)}function Fu(e,t,n,r,s){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var a=Og.call(e);if(a!==Og.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=Ag(e),t=Ag(t);var i=a==="[object Array]";if(!i){if(typeof e!="object"||typeof t!="object")return!1;var c=e.constructor,u=t.constructor;if(c!==u&&!(Gn(c)&&c instanceof c&&Gn(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),r=r||[],s=s||[];for(var d=r.length;d--;)if(r[d]===e)return s[d]===t;if(r.push(e),s.push(t),i){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Fu(e[d],t[d],n-1,r,s))return!1}else{var p=Object.keys(e),h;if(d=p.length,Object.keys(t).length!==d)return!1;for(;d--;)if(h=p[d],!(Dr(t,h)&&Fu(e[h],t[h],n-1,r,s)))return!1}return r.pop(),s.pop(),!0}function Ag(e){return ka(e)?e.slice():$o(e)||us(e)||jr(e)||Jn(e)?Array.from(e.entries()):e}var _g,l5=((_g=Qi().Iterator)==null?void 0:_g.prototype)||{};function Bu(e){return e[Symbol.iterator]=c5,Object.assign(Object.create(l5),e)}function c5(){return this}if(["Symbol","Map","Set"].forEach(function(e){var t=Qi();typeof t[e]>"u"&&Ve("MobX requires global '"+e+"' to be available or polyfilled")}),typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Ex,extras:{getDebugName:ju},$mobx:we}),!f.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Kx)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function u5(e){e()}function d5(e){e||(e=u5),jx({reactionScheduler:e})}function p5(e){return Dx(e)}var f5=1e4,h5=1e4,g5=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=f5),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var s=Date.now();n.registrations.forEach(function(o,a){s-o.registeredAt>=r&&(n.finalize(o.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,h5))}}),e}(),m5=typeof FinalizationRegistry<"u"?FinalizationRegistry:g5,zu=new m5(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),Mg={exports:{}},Uu={};/**
|
|
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={};/**
|
|
22
8
|
* @license React
|
|
23
9
|
* use-sync-external-store-shim.production.min.js
|
|
24
10
|
*
|
|
@@ -26,35 +12,38 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
26
12
|
*
|
|
27
13
|
* This source code is licensed under the MIT license found in the
|
|
28
14
|
* LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/var Lg;function b5(){if(Lg)return Uu;Lg=1;var e=f;function t(p,h){return p===h&&(p!==0||1/p===1/h)||p!==p&&h!==h}var n=typeof Object.is=="function"?Object.is:t,r=e.useState,s=e.useEffect,o=e.useLayoutEffect,a=e.useDebugValue;function i(p,h){var g=h(),m=r({inst:{value:g,getSnapshot:h}}),b=m[0].inst,v=m[1];return o(function(){b.value=g,b.getSnapshot=h,c(b)&&v({inst:b})},[p,g,h]),s(function(){return c(b)&&v({inst:b}),p(function(){c(b)&&v({inst:b})})},[p]),a(g),g}function c(p){var h=p.getSnapshot;p=p.value;try{var g=h();return!n(p,g)}catch{return!0}}function u(p,h){return h()}var d=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?u:i;return Uu.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,Uu}Mg.exports=b5();var v5=Mg.exports;function Ng(e){e.reaction=new Br("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function y5(e,t){t===void 0&&(t="observed");var n=f.useRef(null);if(!n.current){var r={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(i){return zu.unregister(r),r.onStoreChange=i,r.reaction||(Ng(r),r.stateVersion=Symbol()),function(){var c;r.onStoreChange=null,(c=r.reaction)===null||c===void 0||c.dispose(),r.reaction=null}},getSnapshot:function(){return r.stateVersion}};n.current=r}var s=n.current;s.reaction||(Ng(s),zu.register(n,s,s)),f.useDebugValue(s.reaction,p5),v5.useSyncExternalStore(s.subscribe,s.getSnapshot,s.getSnapshot);var o,a;if(s.reaction.track(function(){try{o=e()}catch(i){a=i}}),a)throw a;return o}var Wu,Gu,$g=typeof Symbol=="function"&&Symbol.for,w5=(Gu=(Wu=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Wu===void 0?void 0:Wu.configurable)!==null&&Gu!==void 0?Gu:!1,kg=$g?Symbol.for("react.forward_ref"):typeof f.forwardRef=="function"&&f.forwardRef(function(e){return null}).$$typeof,Ig=$g?Symbol.for("react.memo"):typeof f.memo=="function"&&f.memo(function(e){return null}).$$typeof;function ie(e,t){var n;if(Ig&&e.$$typeof===Ig)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,s=e,o=e.displayName||e.name;if(kg&&e.$$typeof===kg&&(r=!0,s=e.render,typeof s!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var a=function(i,c){return y5(function(){return s(i,c)},o)};return a.displayName=e.displayName,w5&&Object.defineProperty(a,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(a.contextTypes=e.contextTypes),r&&(a=f.forwardRef(a)),a=f.memo(a),C5(e,a),a}var S5={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function C5(e,t){Object.keys(e).forEach(function(n){S5[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var qu;d5(Pn.unstable_batchedUpdates),qu=zu.finalizeAllImmediately;const Vg=new Map,x5=(e,t)=>`${t}-${e}`,Hg=f.forwardRef(function({svg:t,iconSize:n,...r},s){const o=x5(t,n);let a=Vg.get(o);return a||(a=_w(t,n),Vg.set(o,a)),l.jsx("div",{...r,ref:s,dangerouslySetInnerHTML:{__html:a}})});let jg;const E5=e=>{jg=e},P5=()=>jg;var W=(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))(W||{});const yl={alertRhombus:bS,alignHorizontalCenter:vS,alignHorizontalLeft:yS,alignHorizontalRight:wS,applicationBracketsOutline:SS,arrowDown:CS,arrowExpandAll:xS,arrowRight:ES,arrowULeftTop:PS,arrowURightTop:TS,borderAllVariant:AS,borderRadius:_S,borderStyle:MS,calendar:LS,cellphoneLink:NS,check:wh,checkBold:kS,checkboxBlank:IS,chevronUp:DS,chevronDown:VS,chevronLeft:HS,chevronRight:jS,close:Sh,codeBraces:BS,cog:WS,contentCopy:GS,contentSave:qS,delete:RS,dotsVertical:e2,email:t2,emailOutline:n2,eye:r2,eyedropperVariant:i2,eyeOff:s2,eyeOffOutline:o2,eyeOutline:a2,fire:c2,flare:u2,floppy:d2,folder:p2,fullscreen:f2,gradientVertical:h2,helpCircle:g2,home:m2,image:b2,information:y2,informationVariant:w2,layers:S2,link:E2,lock:T2,lockOpenVariant:O2,menuDown:A2,newspaperVariantOutline:L2,openInNew:Ch,paletteSwatch:k2,panVertical:I2,pencil:V2,phone:H2,plus:j2,plusBox:D2,powerPlug:F2,refresh:B2,rhombusOutline:z2,rhombusSplit:U2,rhombusSplitOutline:W2,tag:K2,target:Z2,targetVariant:Y2,textBoxMultiple:X2,trayArrowDown:R2,unfoldLessHorizontal:eC,unfoldMoreHorizontal:tC,viewDayOutline:rC,viewGridPlus:sC,web:oC,xml:aC,database:ZS,databaseOutline:JS,databaseOutlineOn:XS,databaseOutlineOff:YS,databaseOutlineRemove:QS,codeBrackets:zS,toggleSwitchOutline:Q2,toggleSwitchOffOutline:J2,null:N2,string:US,number:$2,cloudUpload:FS,chat:$S,creation:KS,viewDashboard:nC,rocketLaunch:G2,lightningBolt:x2,stop:q2,arrowUp:OS},T5="gs-cmp-icon",Q=ie(function({className:t,icon:n,size:r,rotate:s,horizontal:o,vertical:a}){const i=P5(),c=(i==null?void 0:i[n])||(yl==null?void 0:yl[n])||n,u=[o&&"scaleX(-1)",a&&"scaleY(-1)",s&&`rotate(${s}deg)`].filter(p=>!!p).join(" ");if(!c)return null;const d=M(T5,t);return c.startsWith("<svg")||c.startsWith("<?xml")?l.jsx(Hg,{className:d,style:{transform:u||void 0},svg:c,iconSize:r}):l.jsx(Sa,{className:d,path:c,size:r,rotate:s,horizontal:o,vertical:a})}),Ku=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"},Dg={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"},O5={...{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"}},Se={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"},Zu={bg:z.bg,bgH:z.bgH},Fg={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"},J={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"},Va={focus:"gs-theme-ring-focus focus:gs-utl-outline-none focus-visible:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80",deepFocus:"focus:gs-utl-outline-none [&:has(:focus-visible)]:gs-utl-ring-2 gs-utl-ring-violet-300 gs-utl-ring-opacity-80"},oe={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Ce={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"},ps={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"},rn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},Mn={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"},Ur="gs-utl-my-2",A5="gs-utl-my-3",Bg=` gs-utl-rounded ${Mn.xs} ${rn.mono} ${z.bgH25}`,zg=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${Ur} gs-utl-ml-1`,At={h1:`${Mn.xl2} ${rn.bold} ${A5}`,h2:`${Mn.xl} ${rn.bold} ${Ur}`,h3:`${Mn.lg} ${rn.semibold} ${Ur}`,h4:`${Mn.base} ${rn.semibold} ${Ur}`,h5:`${Mn.sm} ${rn.semibold} ${Ur}`,h6:`${Mn.xs} ${rn.semibold} ${Ur}`,strong:rn.bold,em:rn.italic,ul:`gs-utl-list-disc ${zg}`,ol:`gs-utl-list-decimal ${zg}`,codeInline:`${Bg} gs-utl-px-1 gs-utl-py-0.5`,pre:`${Bg} gs-utl-p-3 gs-utl-overflow-x-auto ${Ur}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${Ur} ${rn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${Ur}`,thead:`${z.bgH2}`,tr:`gs-utl-border-b ${z.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${rn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},wl={s:"gs-utl-size-5",m:"gs-utl-size-10"},Yu={itemList:({index:e=0,open:t=!1,length:n=0}={})=>Z(z.bgH2,Se.xyS,z.br,e&&J.bt,(t||e===n-1)&&J.bb)},Ug=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),Wg=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},Gg=({variant:e,size:t="m",className:n,disabledClassName:r,active:s,border:o=!0,rounded:a=!0,disabled:i=!1,withBg:c,block:u,full:d})=>{const p=e==="pr",h=e==="out",g=e==="out-clear",m=e==="warn",b=e==="danger",v=o&&(h||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&&J.rnd,c&&z.bg,v?Z(J.b,z.br,h&&z.bA,h&&z.tAo,!i&&z.hBgH):Z(J.b,J.bT),m&&Z(z.bgW,!i&&z.hBgW,"gs-utl-text-white"),b&&Z(z.bgRed,!i&&z.hBgRed,"gs-utl-text-white"),p&&Z(z.bgA2,!i&&z.hBgAct),s&&z.bgA,i&&(r??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",Va.focus]};function Ue({children:e,...t}){const{variant:n,size:r,active:s,border:o,rounded:a,block:i,full:c,className:u,icon:d,loading:p,withBg:h,disabled:g,type:m="button",disabledClassName:b,...v}=t,w=p?{icon:P2,size:"18px",className:Z("animate-spin-fast")}:et(d)?{icon:d,size:"18px"}:d;return l.jsx("button",{className:Z(Gg(t)),disabled:g||p,type:m,...v,children:w?l.jsxs(I,{className:Z("gap-2"),items:"center",justify:"center",nowrap:!0,children:[l.jsx(j,{children:l.jsx(Q,{...w})}),e&&l.jsx(j,{children:e})]}):e})}const _5=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],M5=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],Fo="gs-cmp-ai-chat-empty",L5=({className:e,style:t,chatContext:n,editor:r,suggestions:s})=>{const{sendMessage:o}=n,a="aiChat.emptyState",i=M(Fo,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"),c=r.t(`${a}.title`),u=r.t(`${a}.subtitle`),d=Kw(r)?M5:_5,p=s??d;return l.jsxs(I,{className:i,style:t,gap:"m",col:!0,nowrap:!0,children:[l.jsxs(I,{className:`${Fo}__header`,gap:"xs",col:!0,children:[l.jsx("h3",{className:M(`${Fo}__title`,"gs-utl-font-semibold"),children:c}),l.jsx("p",{className:M(`${Fo}__subtitle`,z.txtLowEmphasis),children:u})]}),l.jsx(I,{col:!0,className:`${Fo}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:p.map(h=>{const g=r.t(`${a}.suggestions.${h.id}`)||h.label,m=h.prompt??g;return l.jsx(Ue,{className:`${Fo}__suggestion`,onClick:()=>o({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},h.id)})})]})},Ha="gs-cmp-ai-chat-error",N5=({className:e,style:t,chatContext:n,editor:r})=>{var i;const s=M(Ha,e,z.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),o=`${Ha}__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 l.jsxs(I,{className:s,style:t,gap:"xs",col:!0,children:[l.jsxs(I,{className:`${Ha}__header`,items:"center",gap:"xs",children:[l.jsx(j,{className:`${Ha}__header-title`,grow:!0,children:r.t("aiChat.error.title")}),l.jsx(Ue,{className:`${Ha}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),l.jsx(j,{className:o,grow:!0,children:(i=n.error)==null?void 0:i.message})]})},Xu="gs-cmp-ai-chat-header",$5=({className:e,chatContext:t,editor:n,...r})=>{const{messages:s,setMessages:o}=t,a=M(Xu,e,J.bb,z.br,Se.s),i="aiChat.header";return l.jsxs(I,{className:a,items:"center",gap:"xs",...r,children:[l.jsx(j,{className:`${Xu}__title`,grow:!0,children:n.t(`${i}.title`)}),s.length>0&&l.jsx(Ue,{className:M(`${Xu}__btn-clear`,Ce.hover,J.none,Se.xS),onClick:()=>o([]),size:"xs",border:!1,icon:"delete",children:n.t(`${i}.clear`)})]})};function ro({full:e,abs:t,small:n,size:r,className:s,bg:o,currentColor:a}){const i=M(e&&"gs-utl-w-full gs-utl-h-full",t?Ce.coverAbs:"gs-utl-relative",s),c=M(!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",J.pill,J.bS,a?"gs-utl-border-current":J.bA);return l.jsxs(I,{className:i,items:"center",justify:"center",children:[!!o&&l.jsx("div",{className:M(Ce.coverAbs,z.bg,Ce.disabled)}),l.jsx("div",{className:c})]})}function Bo(e,t,n){let r=n.initialDeps??[],s;return()=>{var o,a,i,c;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==r.length||d.some((g,m)=>r[m]!==g)))return s;r=d;let h;if(n.key&&((a=n.debug)!=null&&a.call(n))&&(h=Date.now()),s=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()-h)*100)/100,b=m/16,v=(w,y)=>{for(w=String(w);w.length<y;)w=" "+w;return w};console.info(`%c⏱ ${v(m,5)} /${v(g,5)} ms`,`
|
|
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">
|
|
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`,`
|
|
30
19
|
font-size: .6rem;
|
|
31
20
|
font-weight: bold;
|
|
32
|
-
color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(c=n==null?void 0:n.onChange)==null||c.call(n,s),s}}function Ju(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const k5=(e,t)=>Math.abs(e-t)<1,I5=(e,t,n)=>{let r;return function(...s){e.clearTimeout(r),r=e.setTimeout(()=>t.apply(this,s),n)}};var ja={NODE_ENV:"production"};const V5=e=>e,H5=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),r=[];for(let s=t;s<=n;s++)r.push(s);return r},j5=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;const s=a=>{const{width:i,height:c}=a;t({width:Math.round(i),height:Math.round(c)})};if(s(n.getBoundingClientRect()),!r.ResizeObserver)return()=>{};const o=new r.ResizeObserver(a=>{const i=a[0];if(i!=null&&i.borderBoxSize){const c=i.borderBoxSize[0];if(c){s({width:c.inlineSize,height:c.blockSize});return}}s(n.getBoundingClientRect())});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},qg={passive:!0},D5=typeof window>"u"?!0:"onscrollend"in window,F5=(e,t)=>{const n=e.scrollElement;if(!n)return;const r=e.targetWindow;if(!r)return;let s=0;const o=D5?()=>{}:I5(r,()=>{t(s,!1)},e.options.isScrollingResetDelay),a=u=>()=>{const{horizontal:d,isRtl:p}=e.options;s=d?n.scrollLeft*(p&&-1||1):n.scrollTop,o(),t(s,u)},i=a(!0),c=a(!1);return c(),n.addEventListener("scroll",i,qg),n.addEventListener("scrollend",c,qg),()=>{n.removeEventListener("scroll",i),n.removeEventListener("scrollend",c)}},B5=(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"])},z5=(e,{adjustments:t=0,behavior:n},r)=>{var s,o;const a=e+t;(o=(s=r.scrollElement)==null?void 0:s.scrollTo)==null||o.call(s,{[r.options.horizontal?"left":"top"]:a,behavior:n})};class U5{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(s=>{s.forEach(o=>{this._measureElement(o.target,o)})}));return{disconnect:()=>{var s;(s=r())==null||s.disconnect(),n=null},observe:s=>{var o;return(o=r())==null?void 0:o.observe(s,{box:"border-box"})},unobserve:s=>{var o;return(o=r())==null?void 0:o.unobserve(s)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([r,s])=>{typeof s>"u"&&delete n[r]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:V5,rangeExtractor:H5,onChange:()=>{},measureElement:B5,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,s;(s=(r=this.options).onChange)==null||s.call(r,this,n)},this.maybeNotify=Bo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:ja.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(s=>{this.observer.observe(s)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,s=>{this.scrollRect=s,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(s,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<s?"forward":"backward":null,this.scrollOffset=s,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,r)=>{const s=new Map,o=new Map;for(let a=r-1;a>=0;a--){const i=n[a];if(s.has(i.lane))continue;const c=o.get(i.lane);if(c==null||i.end>c.end?o.set(i.lane,i):i.end<c.end&&s.set(i.lane,!0),s.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((a,i)=>a.end===i.end?a.index-i.index:a.end-i.end)[0]:void 0},this.getMeasurementOptions=Bo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,r,s,o,a)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:r,scrollMargin:s,getItemKey:o,enabled:a}),{key:!1}),this.getMeasurements=Bo(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:r,scrollMargin:s,getItemKey:o,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 c=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,c);for(let d=c;d<n;d++){const p=o(d),h=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=h?h.end+this.options.gap:r+s,m=i.get(p),b=typeof m=="number"?m:this.options.estimateSize(d),v=g+b,w=h?h.lane:d%this.options.lanes;u[d]={index:d,start:g,size:b,end:v,key:p,lane:w}}return this.measurementsCache=u,u},{key:ja.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=Bo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,r,s)=>this.range=n.length>0&&r>0?W5({measurements:n,outerSize:r,scrollOffset:s}):null,{key:ja.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=Bo(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,r,s,o)=>r===null?[]:n({startIndex:r.startIndex,endIndex:r.endIndex,overscan:s,count:o}),{key:ja.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const r=this.options.indexAttribute,s=n.getAttribute(r);return s?parseInt(s,10):(console.warn(`Missing attribute name '${r}={index}' on measured element.`),-1)},this._measureElement=(n,r)=>{const s=this.indexFromElement(n),o=this.measurementsCache[s];if(!o)return;const a=o.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(s,this.options.measureElement(n,r,this))},this.resizeItem=(n,r)=>{const s=this.measurementsCache[n];if(!s)return;const o=this.itemSizeCache.get(s.key)??s.size,a=r-o;a!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(s,a,this):s.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=a,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(s.index),this.itemSizeCache=new Map(this.itemSizeCache.set(s.key,r)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((r,s)=>{r.isConnected||(this.observer.unobserve(r),this.elementsCache.delete(s))});return}this._measureElement(n,void 0)},this.getVirtualItems=Bo(()=>[this.getIndexes(),this.getMeasurements()],(n,r)=>{const s=[];for(let o=0,a=n.length;o<a;o++){const i=n[o],c=r[i];s.push(c)}return s},{key:ja.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const r=this.getMeasurements();if(r.length!==0)return Ju(r[Kg(0,r.length-1,s=>Ju(r[s]).start,n)])},this.getOffsetForAlignment=(n,r)=>{const s=this.getSize(),o=this.getScrollOffset();r==="auto"&&(n<=o?r="start":n>=o+s?r="end":r="start"),r==="start"?n=n:r==="end"?n=n-s:r==="center"&&(n=n-s/2);const a=this.options.horizontal?"scrollWidth":"scrollHeight",c=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[a]:this.scrollElement[a]:0)-s;return Math.max(Math.min(c,n),0)},this.getOffsetForIndex=(n,r="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const s=this.measurementsCache[n];if(!s)return;const o=this.getSize(),a=this.getScrollOffset();if(r==="auto")if(s.end>=a+o-this.options.scrollPaddingEnd)r="end";else if(s.start<=a+this.options.scrollPaddingStart)r="start";else return[a,r];const i=r==="end"?s.end+this.options.scrollPaddingEnd:s.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:s}={})=>{this.cancelScrollToIndex(),s==="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:s})},this.scrollToIndex=(n,{align:r="auto",behavior:s}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const o=this.getOffsetForIndex(n,r);if(!o)return;const[a,i]=o;this._scrollToOffset(a,{adjustments:void 0,behavior:s}),s!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=Ju(this.getOffsetForIndex(n,i));k5(u,this.getScrollOffset())||this.scrollToIndex(n,{align:i,behavior:s})}else this.scrollToIndex(n,{align:i,behavior:s})}))},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 s;return r.length===0?s=this.options.paddingStart:s=this.options.lanes===1?((n=r[r.length-1])==null?void 0:n.end)??0:Math.max(...r.slice(-this.options.lanes).map(o=>o.end)),Math.max(s-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:r,behavior:s})=>{this.options.scrollToFn(n,{behavior:s,adjustments:r},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const Kg=(e,t,n,r)=>{for(;e<=t;){const s=(e+t)/2|0,o=n(s);if(o<r)e=s+1;else if(o>r)t=s-1;else return s}return e>0?e-1:0};function W5({measurements:e,outerSize:t,scrollOffset:n}){const r=e.length-1,o=Kg(0,r,i=>e[i].start,n);let a=o;for(;a<r&&e[a].end<n+t;)a++;return{startIndex:o,endIndex:a}}const G5=typeof document<"u"?Ye.useLayoutEffect:Ye.useEffect;function q5(e){const t=Ye.useReducer(()=>({}),{})[1],n={...e,onChange:(s,o)=>{var a;o?Pn.flushSync(t):t(),(a=e.onChange)==null||a.call(e,s,o)}},[r]=Ye.useState(()=>new U5(n));return r.setOptions(n),Ye.useEffect(()=>r._didMount(),[]),G5(()=>r._willUpdate()),r}function K5(e){return q5({observeElementRect:j5,observeElementOffset:F5,scrollToFn:z5,...e})}var Z5=Object.defineProperty,Y5=(e,t,n)=>t in e?Z5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Qu=(e,t,n)=>(Y5(e,typeof t!="symbol"?t+"":t,n),n);let X5=class{constructor(){Qu(this,"current",this.detect()),Qu(this,"handoffState","pending"),Qu(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"}},Wr=new X5,Fe=(e,t)=>{Wr.isServer?f.useEffect(e,t):f.useLayoutEffect(e,t)};function _t(e){let t=f.useRef(e);return Fe(()=>{t.current=e},[e]),t}function Da(e,t){let[n,r]=f.useState(e),s=_t(e);return Fe(()=>r(s.current),[s,r,...t]),n}let se=function(e){let t=_t(e);return f.useCallback((...n)=>t.current(...n),[t])};function Sl(e,t,n){let[r,s]=f.useState(n),o=e!==void 0,a=f.useRef(o),i=f.useRef(!1),c=f.useRef(!1);return o&&!a.current&&!i.current?(i.current=!0,a.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&a.current&&!c.current&&(c.current=!0,a.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:r,se(u=>(o||s(u),t==null?void 0:t(u)))]}function Ru(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function hr(){let e=[],t={addEventListener(n,r,s,o){return n.addEventListener(r,s,o),t.add(()=>n.removeEventListener(r,s,o))},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 Ru(()=>{r.current&&n[0]()}),t.add(()=>{r.current=!1})},style(n,r,s){let o=n.style.getPropertyValue(r);return Object.assign(n.style,{[r]:s}),this.add(()=>{Object.assign(n.style,{[r]:o})})},group(n){let r=hr();return n(r),this.add(()=>r.dispose())},add(n){return e.push(n),()=>{let r=e.indexOf(n);if(r>=0)for(let s of e.splice(r,1))s()}},dispose(){for(let n of e.splice(0))n()}};return t}function Qn(){let[e]=f.useState(hr);return f.useEffect(()=>()=>e.dispose(),[e]),e}function J5(){let e=typeof document>"u";return"useSyncExternalStore"in Ye?(t=>t.useSyncExternalStore)(Ye)(()=>()=>{},()=>!1,()=>!e):!1}function Cl(){let e=J5(),[t,n]=Ye.useState(Wr.isHandoffComplete);return t&&Wr.isHandoffComplete===!1&&n(!1),Ye.useEffect(()=>{t!==!0&&n(!0)},[t]),Ye.useEffect(()=>Wr.handoff(),[]),e?!1:t}var Zg;let gt=(Zg=f.useId)!=null?Zg:function(){let e=Cl(),[t,n]=f.useState(e?()=>Wr.nextId():null);return Fe(()=>{t===null&&n(Wr.nextId())},[t]),t!=null?""+t:void 0};function Ae(e,t,...n){if(e in t){let s=t[e];return typeof s=="function"?s(...n):s}let r=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(s=>`"${s}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ae),r}function fs(e){return Wr.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let ed=["[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 vt=(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))(vt||{}),gr=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(gr||{}),Q5=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(Q5||{});function xl(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(ed)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var El=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(El||{});function td(e,t=0){var n;return e===((n=fs(e))==null?void 0:n.body)?!1:Ae(t,{0(){return e.matches(ed)},1(){let r=e;for(;r!==null;){if(r.matches(ed))return!0;r=r.parentElement}return!1}})}var R5=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(R5||{});typeof window<"u"&&typeof document<"u"&&(document.addEventListener("keydown",e=>{e.metaKey||e.altKey||e.ctrlKey||(document.documentElement.dataset.headlessuiFocusVisible="")},!0),document.addEventListener("click",e=>{e.detail===1?delete document.documentElement.dataset.headlessuiFocusVisible:e.detail===0&&(document.documentElement.dataset.headlessuiFocusVisible="")},!0));let eE=["textarea","input"].join(",");function tE(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,eE))!=null?n:!1}function Gr(e,t=n=>n){return e.slice().sort((n,r)=>{let s=t(n),o=t(r);if(s===null||o===null)return 0;let a=s.compareDocumentPosition(o);return a&Node.DOCUMENT_POSITION_FOLLOWING?-1:a&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function Jt(e,t,{sorted:n=!0,relativeTo:r=null,skipElements:s=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,a=Array.isArray(e)?n?Gr(e):e:xl(e);s.length>0&&a.length>1&&(a=a.filter(g=>!s.includes(g))),r=r??o.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")})(),c=(()=>{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,h;do{if(d>=p||d+p<=0)return 0;let g=c+d;if(t&16)g=(g+p)%p;else{if(g<0)return 3;if(g>=p)return 1}h=a[g],h==null||h.focus(u),d+=i}while(h!==o.activeElement);return t&6&&tE(h)&&h.select(),2}function nE(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function rE(){return/Android/gi.test(window.navigator.userAgent)}function Yg(){return nE()||rE()}function Pl(e,t,n){let r=_t(t);f.useEffect(()=>{function s(o){r.current(o)}return document.addEventListener(e,s,n),()=>document.removeEventListener(e,s,n)},[e,n])}function Xg(e,t,n){let r=_t(t);f.useEffect(()=>{function s(o){r.current(o)}return window.addEventListener(e,s,n),()=>window.removeEventListener(e,s,n)},[e,n])}function nd(e,t,n=!0){let r=f.useRef(!1);f.useEffect(()=>{requestAnimationFrame(()=>{r.current=n})},[n]);function s(a,i){if(!r.current||a.defaultPrevented)return;let c=i(a);if(c===null||!c.getRootNode().contains(c)||!c.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(c)||a.composed&&a.composedPath().includes(p))return}return!td(c,El.Loose)&&c.tabIndex!==-1&&a.preventDefault(),t(a,c)}let o=f.useRef(null);Pl("pointerdown",a=>{var i,c;r.current&&(o.current=((c=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:c[0])||a.target)},!0),Pl("mousedown",a=>{var i,c;r.current&&(o.current=((c=(i=a.composedPath)==null?void 0:i.call(a))==null?void 0:c[0])||a.target)},!0),Pl("click",a=>{Yg()||o.current&&(s(a,()=>o.current),o.current=null)},!0),Pl("touchend",a=>s(a,()=>a.target instanceof HTMLElement?a.target:null),!0),Xg("blur",a=>s(a,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function so(...e){return f.useMemo(()=>fs(...e),[...e])}function Jg(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 zo(e,t){let[n,r]=f.useState(()=>Jg(e));return Fe(()=>{r(Jg(e))},[e.type,e.as]),Fe(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&r("button")},[n,t]),n}let Qg=Symbol();function rd(e,t=!0){return Object.assign(e,{[Qg]:t})}function Be(...e){let t=f.useRef(e);f.useEffect(()=>{t.current=e},[e]);let n=se(r=>{for(let s of t.current)s!=null&&(typeof s=="function"?s(r):s.current=r)});return e.every(r=>r==null||(r==null?void 0:r[Qg]))?void 0:n}function Rg(e){return[e.screenX,e.screenY]}function e1(){let e=f.useRef([-1,-1]);return{wasMoved(t){let n=Rg(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Rg(t)}}}function t1({container:e,accept:t,walk:n,enabled:r=!0}){let s=f.useRef(t),o=f.useRef(n);f.useEffect(()=>{s.current=t,o.current=n},[t,n]),Fe(()=>{if(!e||!r)return;let a=fs(e);if(!a)return;let i=s.current,c=o.current,u=Object.assign(p=>i(p),{acceptNode:i}),d=a.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)c(d.currentNode)},[e,r,s,o])}function n1(e,t){let n=f.useRef([]),r=se(e);f.useEffect(()=>{let s=[...n.current];for(let[o,a]of t.entries())if(n.current[o]!==a){let i=r(t,s);return n.current=t,i}},[r,...t])}function Tl(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var sn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(sn||{}),hs=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(hs||{});function $e({ourProps:e,theirProps:t,slot:n,defaultTag:r,features:s,visible:o=!0,name:a,mergeRefs:i}){i=i??sE;let c=r1(t,e);if(o)return Ol(c,n,r,a,i);let u=s??0;if(u&2){let{static:d=!1,...p}=c;if(d)return Ol(p,n,r,a,i)}if(u&1){let{unmount:d=!0,...p}=c;return Ae(d?0:1,{0(){return null},1(){return Ol({...p,hidden:!0,style:{display:"none"}},n,r,a,i)}})}return Ol(c,n,r,a,i)}function Ol(e,t={},n,r,s){let{as:o=n,children:a,refName:i="ref",...c}=od(e,["unmount","static"]),u=e.ref!==void 0?{[i]:e.ref}:{},d=typeof a=="function"?a(t):a;"className"in c&&c.className&&typeof c.className=="function"&&(c.className=c.className(t));let p={};if(t){let h=!1,g=[];for(let[m,b]of Object.entries(t))typeof b=="boolean"&&(h=!0),b===!0&&g.push(m);h&&(p["data-headlessui-state"]=g.join(" "))}if(o===f.Fragment&&Object.keys(Uo(c)).length>0){if(!f.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(c).map(b=>` - ${b}`).join(`
|
|
33
|
-
`),"","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(
|
|
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(`
|
|
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(`
|
|
34
23
|
`)].join(`
|
|
35
|
-
`));let h=d.props,g=typeof(h==null?void 0:h.className)=="function"?(...b)=>Tl(h==null?void 0:h.className(...b),c.className):Tl(h==null?void 0:h.className,c.className),m=g?{className:g}:{};return f.cloneElement(d,Object.assign({},r1(d.props,Uo(od(c,["ref"]))),p,u,{ref:s(d.ref,u.ref)},m))}return f.createElement(o,Object.assign({},od(c,["ref"]),o!==f.Fragment&&u,o!==f.Fragment&&p),d)}function sd(){let e=f.useRef([]),t=f.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 sE(...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 r1(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let r of e)for(let s in r)s.startsWith("on")&&typeof r[s]=="function"?(n[s]!=null||(n[s]=[]),n[s].push(r[s])):t[s]=r[s];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](s,...o){let a=n[r];for(let i of a){if((s instanceof Event||(s==null?void 0:s.nativeEvent)instanceof Event)&&s.defaultPrevented)return;i(s,...o)}}});return t}function ke(e){var t;return Object.assign(f.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function Uo(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function od(e,t=[]){let n=Object.assign({},e);for(let r of t)r in n&&delete n[r];return n}let oE="div";var Rn=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(Rn||{});function aE(e,t){var n;let{features:r=1,...s}=e,o={ref:t,"aria-hidden":(r&2)===2?!0:(n=s["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 $e({ourProps:o,theirProps:s,slot:{},defaultTag:oE,name:"Hidden"})}let er=ke(aE),ad=f.createContext(null);ad.displayName="OpenClosedContext";var rt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(rt||{});function oo(){return f.useContext(ad)}function Fa({value:e,children:t}){return f.createElement(ad.Provider,{value:e},t)}function iE(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let ao=[];iE(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&ao[0]!==t.target&&(ao.unshift(t.target),ao=ao.filter(n=>n!=null&&n.isConnected),ao.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 gs(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&&lE(n)?!1:r}function lE(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function cE(e){throw new Error("Unexpected object: "+e)}var We=(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))(We||{});function id(e,t){let n=t.resolveItems();if(n.length<=0)return null;let r=t.resolveActiveIndex(),s=r??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 1:{for(let o=s-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 2:{for(let o=s+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return r}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return r}case 5:return null;default:cE(e)}}function Al(e={},t=null,n=[]){for(let[r,s]of Object.entries(e))o1(n,s1(t,r),s);return n}function s1(e,t){return e?e+"["+t+"]":t}function o1(e,t,n){if(Array.isArray(n))for(let[r,s]of n.entries())o1(e,s1(t,r.toString()),s);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,""]):Al(n,t,e)}function a1(e){var t,n;let r=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(r){for(let s of r.elements)if(s!==e&&(s.tagName==="INPUT"&&s.type==="submit"||s.tagName==="BUTTON"&&s.type==="submit"||s.nodeName==="INPUT"&&s.type==="image")){s.click();return}(n=r.requestSubmit)==null||n.call(r)}}var fe=(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))(fe||{}),uE={NODE_ENV:"production"},dE=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(dE||{}),pE=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(pE||{}),fE=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(fE||{}),hE=(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))(hE||{});function ld(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=t(e.options.slice()),s=r.length>0&&r[0].dataRef.current.order!==null?r.sort((a,i)=>a.dataRef.current.order-i.dataRef.current.order):Gr(r,a=>a.dataRef.current.domRef.current),o=n?s.indexOf(n):null;return o===-1&&(o=null),{options:s,activeOptionIndex:o}}let gE={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,s,o,a;if((n=e.dataRef.current)!=null&&n.disabled||(r=e.dataRef.current)!=null&&r.optionsRef.current&&!((s=e.dataRef.current)!=null&&s.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===We.Specific?t.idx:id(t,{resolveItems:()=>e.virtual.options,resolveActiveIndex:()=>{var h,g;return(g=(h=e.activeOptionIndex)!=null?h:e.virtual.options.findIndex(m=>!e.virtual.disabled(m)))!=null?g:null},resolveDisabled:e.virtual.disabled,resolveId(){throw new Error("Function not implemented.")}}),p=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===p?e:{...e,activeOptionIndex:d,activationTrigger:p}}let i=ld(e);if(i.activeOptionIndex===null){let d=i.options.findIndex(p=>!p.dataRef.current.disabled);d!==-1&&(i.activeOptionIndex=d)}let c=t.focus===We.Specific?t.idx:id(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===c&&e.activationTrigger===u?e:{...e,...i,activeOptionIndex:c,activationTrigger:u}},3:(e,t)=>{var n,r,s;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,a=ld(e,c=>(c.push(o),c));e.activeOptionIndex===null&&(r=e.dataRef.current)!=null&&r.isSelected(t.payload.dataRef.current.value)&&(a.activeOptionIndex=a.options.indexOf(o));let i={...e,...a,activationTrigger:2};return(s=e.dataRef.current)!=null&&s.__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(s=>s.id!==t.id)};let r=ld(e,s=>{let o=s.findIndex(a=>a.id===t.id);return o!==-1&&s.splice(o,1),s});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 s=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);s!==-1?r=s:r=null}return{...e,activeOptionIndex:r,virtual:Object.assign({},e.virtual,{options:t.options})}}},cd=f.createContext(null);cd.displayName="ComboboxActionsContext";function Ba(e){let t=f.useContext(cd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ba),n}return t}let i1=f.createContext(null);function mE(e){var t;let n=io("VirtualProvider"),[r,s]=f.useMemo(()=>{let c=n.optionsRef.current;if(!c)return[0,0];let u=window.getComputedStyle(c);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[n.optionsRef.current]),o=K5({scrollPaddingStart:r,scrollPaddingEnd:s,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var c;return(c=n.optionsRef.current)!=null?c:null},overscan:12}),[a,i]=f.useState(0);return Fe(()=>{i(c=>c+1)},[(t=n.virtual)==null?void 0:t.options]),f.createElement(i1.Provider,{value:o},f.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:c=>{if(c){if(typeof process<"u"&&uE.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&o.scrollToIndex(n.activeOptionIndex)}}},o.getVirtualItems().map(c=>{var u;return f.createElement(f.Fragment,{key:c.key},f.cloneElement((u=e.children)==null?void 0:u.call(e,{option:n.virtual.options[c.index],open:n.comboboxState===0}),{key:`${a}-${c.key}`,"data-index":c.index,"aria-setsize":n.virtual.options.length,"aria-posinset":c.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${c.start}px)`,overflowAnchor:"none"}}))})))}let ud=f.createContext(null);ud.displayName="ComboboxDataContext";function io(e){let t=f.useContext(ud);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,io),n}return t}function bE(e,t){return Ae(t.type,gE,e,t)}let vE=f.Fragment;function yE(e,t){let{value:n,defaultValue:r,onChange:s,form:o,name:a,by:i=null,disabled:c=!1,__demoMode:u=!1,nullable:d=!1,multiple:p=!1,immediate:h=!1,virtual:g=null,...m}=e,b=!1,v=null,[w=p?[]:void 0,y]=Sl(n,s,r),[S,C]=f.useReducer(bE,{dataRef:f.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),x=f.useRef(!1),E=f.useRef({static:!1,hold:!1}),P=f.useRef(null),O=f.useRef(null),A=f.useRef(null),T=f.useRef(null),_=se(typeof i=="string"?(ne,ce)=>{let ge=i;return(ne==null?void 0:ne[ge])===(ce==null?void 0:ce[ge])}:i??((ne,ce)=>ne===ce)),L=se(ne=>S.options.findIndex(ce=>_(ce.dataRef.current.value,ne))),$=f.useCallback(ne=>Ae(N.mode,{1:()=>w.some(ce=>_(ce,ne)),0:()=>_(w,ne)}),[w]),D=se(ne=>S.activeOptionIndex===L(ne)),N=f.useMemo(()=>({...S,immediate:b,optionsPropsRef:E,labelRef:P,inputRef:O,buttonRef:A,optionsRef:T,value:w,defaultValue:r,disabled:c,mode:p?1:0,virtual:S.virtual,get activeOptionIndex(){if(x.current&&S.activeOptionIndex===null&&S.options.length>0){let ne=S.options.findIndex(ce=>!ce.dataRef.current.disabled);if(ne!==-1)return ne}return S.activeOptionIndex},calculateIndex:L,compare:_,isSelected:$,isActive:D,nullable:d,__demoMode:u}),[w,r,c,p,d,u,S,v]);Fe(()=>{},[v,void 0]),Fe(()=>{S.dataRef.current=N},[N]),nd([N.buttonRef,N.inputRef,N.optionsRef],()=>R.closeCombobox(),N.comboboxState===0);let B=f.useMemo(()=>{var ne,ce,ge;return{open:N.comboboxState===0,disabled:c,activeIndex:N.activeOptionIndex,activeOption:N.activeOptionIndex===null?null:N.virtual?N.virtual.options[(ne=N.activeOptionIndex)!=null?ne:0]:(ge=(ce=N.options[N.activeOptionIndex])==null?void 0:ce.dataRef.current.value)!=null?ge:null,value:w}},[N,c,w]),q=se(()=>{if(N.activeOptionIndex!==null){if(N.virtual)X(N.virtual.options[N.activeOptionIndex]);else{let{dataRef:ne}=N.options[N.activeOptionIndex];X(ne.current.value)}R.goToOption(We.Specific,N.activeOptionIndex)}}),F=se(()=>{C({type:0}),x.current=!0}),k=se(()=>{C({type:1}),x.current=!1}),H=se((ne,ce,ge)=>(x.current=!1,ne===We.Specific?C({type:2,focus:We.Specific,idx:ce,trigger:ge}):C({type:2,focus:ne,trigger:ge}))),V=se((ne,ce)=>(C({type:3,payload:{id:ne,dataRef:ce}}),()=>{N.isActive(ce.current.value)&&(x.current=!0),C({type:4,id:ne})})),U=se(ne=>(C({type:5,id:ne}),()=>C({type:5,id:null}))),X=se(ne=>Ae(N.mode,{0(){return y==null?void 0:y(ne)},1(){let ce=N.value.slice(),ge=ce.findIndex(De=>_(De,ne));return ge===-1?ce.push(ne):ce.splice(ge,1),y==null?void 0:y(ce)}})),Y=se(ne=>{C({type:6,trigger:ne})}),R=f.useMemo(()=>({onChange:X,registerOption:V,registerLabel:U,goToOption:H,closeCombobox:k,openCombobox:F,setActivationTrigger:Y,selectActiveOption:q}),[]),ee=t===null?{}:{ref:t},te=f.useRef(null),K=Qn();return f.useEffect(()=>{te.current&&r!==void 0&&K.addEventListener(te.current,"reset",()=>{y==null||y(r)})},[te,y]),f.createElement(cd.Provider,{value:R},f.createElement(ud.Provider,{value:N},f.createElement(Fa,{value:Ae(N.comboboxState,{0:rt.Open,1:rt.Closed})},a!=null&&w!=null&&Al({[a]:w}).map(([ne,ce],ge)=>f.createElement(er,{features:Rn.Hidden,ref:ge===0?De=>{var ve;te.current=(ve=De==null?void 0:De.closest("form"))!=null?ve:null}:void 0,...Uo({key:ne,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:c,name:ne,value:ce})})),$e({ourProps:ee,theirProps:m,slot:B,defaultTag:vE,name:"Combobox"}))))}let wE="input";function SE(e,t){var n,r,s,o,a;let i=gt(),{id:c=`headlessui-combobox-input-${i}`,onChange:u,displayValue:d,type:p="text",...h}=e,g=io("Combobox.Input"),m=Ba("Combobox.Input"),b=Be(g.inputRef,t),v=so(g.inputRef),w=f.useRef(!1),y=Qn(),S=se(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(We.Nothing)}),C=function(){var N;return typeof d=="function"&&g.value!==void 0?(N=d(g.value))!=null?N:"":typeof g.value=="string"?g.value:""}();n1(([N,B],[q,F])=>{if(w.current)return;let k=g.inputRef.current;k&&((F===0&&B===1||N!==q)&&(k.value=N),requestAnimationFrame(()=>{if(w.current||!k||(v==null?void 0:v.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,v]),n1(([N],[B])=>{if(N===0&&B===1){if(w.current)return;let q=g.inputRef.current;if(!q)return;let F=q.value,{selectionStart:k,selectionEnd:H,selectionDirection:V}=q;q.value="",q.value=F,V!==null?q.setSelectionRange(k,H,V):q.setSelectionRange(k,H)}},[g.comboboxState]);let x=f.useRef(!1),E=se(()=>{x.current=!0}),P=se(()=>{y.nextFrame(()=>{x.current=!1})}),O=se(N=>{switch(w.current=!0,N.key){case fe.Enter:if(w.current=!1,g.comboboxState!==0||x.current)return;if(N.preventDefault(),N.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case fe.ArrowDown:return w.current=!1,N.preventDefault(),N.stopPropagation(),Ae(g.comboboxState,{0:()=>m.goToOption(We.Next),1:()=>m.openCombobox()});case fe.ArrowUp:return w.current=!1,N.preventDefault(),N.stopPropagation(),Ae(g.comboboxState,{0:()=>m.goToOption(We.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(We.Last)})}});case fe.Home:if(N.shiftKey)break;return w.current=!1,N.preventDefault(),N.stopPropagation(),m.goToOption(We.First);case fe.PageUp:return w.current=!1,N.preventDefault(),N.stopPropagation(),m.goToOption(We.First);case fe.End:if(N.shiftKey)break;return w.current=!1,N.preventDefault(),N.stopPropagation(),m.goToOption(We.Last);case fe.PageDown:return w.current=!1,N.preventDefault(),N.stopPropagation(),m.goToOption(We.Last);case fe.Escape:return w.current=!1,g.comboboxState!==0?void 0:(N.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&N.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&S(),m.closeCombobox());case fe.Tab:if(w.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),A=se(N=>{u==null||u(N),g.nullable&&g.mode===0&&N.target.value===""&&S(),m.openCombobox()}),T=se(N=>{var B,q,F;let k=(B=N.relatedTarget)!=null?B:ao.find(H=>H!==N.currentTarget);if(w.current=!1,!((q=g.optionsRef.current)!=null&&q.contains(k))&&!((F=g.buttonRef.current)!=null&&F.contains(k))&&g.comboboxState===0)return N.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?S():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),_=se(N=>{var B,q,F;let k=(B=N.relatedTarget)!=null?B:ao.find(H=>H!==N.currentTarget);(q=g.buttonRef.current)!=null&&q.contains(k)||(F=g.optionsRef.current)!=null&&F.contains(k)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),L=Da(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),$=f.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),D={ref:b,id:c,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(N=>{var B;return!((B=g.virtual)!=null&&B.disabled(N.dataRef.current.value))&&g.compare(N.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:r.id:(s=g.options[g.activeOptionIndex])==null?void 0:s.id,"aria-labelledby":L,"aria-autocomplete":"list",defaultValue:(a=(o=e.defaultValue)!=null?o:g.defaultValue!==void 0?d==null?void 0:d(g.defaultValue):null)!=null?a:g.defaultValue,disabled:g.disabled,onCompositionStart:E,onCompositionEnd:P,onKeyDown:O,onChange:A,onFocus:_,onBlur:T};return $e({ourProps:D,theirProps:h,slot:$,defaultTag:wE,name:"Combobox.Input"})}let CE="button";function xE(e,t){var n;let r=io("Combobox.Button"),s=Ba("Combobox.Button"),o=Be(r.buttonRef,t),a=gt(),{id:i=`headlessui-combobox-button-${a}`,...c}=e,u=Qn(),d=se(b=>{switch(b.key){case fe.ArrowDown:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&s.openCombobox(),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case fe.ArrowUp:return b.preventDefault(),b.stopPropagation(),r.comboboxState===1&&(s.openCombobox(),u.nextFrame(()=>{r.value||s.goToOption(We.Last)})),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case fe.Escape:return r.comboboxState!==0?void 0:(b.preventDefault(),r.optionsRef.current&&!r.optionsPropsRef.current.static&&b.stopPropagation(),s.closeCombobox(),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})}));default:return}}),p=se(b=>{if(gs(b.currentTarget))return b.preventDefault();r.comboboxState===0?s.closeCombobox():(b.preventDefault(),s.openCombobox()),u.nextFrame(()=>{var v;return(v=r.inputRef.current)==null?void 0:v.focus({preventScroll:!0})})}),h=Da(()=>{if(r.labelId)return[r.labelId,i].join(" ")},[r.labelId,i]),g=f.useMemo(()=>({open:r.comboboxState===0,disabled:r.disabled,value:r.value}),[r]),m={ref:o,id:i,type:zo(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":h,disabled:r.disabled,onClick:p,onKeyDown:d};return $e({ourProps:m,theirProps:c,slot:g,defaultTag:CE,name:"Combobox.Button"})}let EE="label";function PE(e,t){let n=gt(),{id:r=`headlessui-combobox-label-${n}`,...s}=e,o=io("Combobox.Label"),a=Ba("Combobox.Label"),i=Be(o.labelRef,t);Fe(()=>a.registerLabel(r),[r]);let c=se(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=f.useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]);return $e({ourProps:{ref:i,id:r,onClick:c},theirProps:s,slot:u,defaultTag:EE,name:"Combobox.Label"})}let TE="ul",OE=sn.RenderStrategy|sn.Static;function AE(e,t){let n=gt(),{id:r=`headlessui-combobox-options-${n}`,hold:s=!1,...o}=e,a=io("Combobox.Options"),i=Be(a.optionsRef,t),c=oo(),u=c!==null?(c&rt.Open)===rt.Open:a.comboboxState===0;Fe(()=>{var g;a.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[a.optionsPropsRef,e.static]),Fe(()=>{a.optionsPropsRef.current.hold=s},[a.optionsPropsRef,s]),t1({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=Da(()=>{var g,m;return(m=a.labelId)!=null?m:(g=a.buttonRef.current)==null?void 0:g.id},[a.labelId,a.buttonRef.current]),p=f.useMemo(()=>({open:a.comboboxState===0,option:void 0}),[a]),h={"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(o,{children:f.createElement(mE,null,o.children)}),$e({ourProps:h,theirProps:o,slot:p,defaultTag:TE,features:OE,visible:u,name:"Combobox.Options"})}let _E="li";function ME(e,t){var n;let r=gt(),{id:s=`headlessui-combobox-option-${r}`,disabled:o=!1,value:a,order:i=null,...c}=e,u=io("Combobox.Option"),d=Ba("Combobox.Option"),p=u.virtual?u.activeOptionIndex===u.calculateIndex(a):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===s,h=u.isSelected(a),g=f.useRef(null),m=_t({disabled:o,value:a,domRef:g,order:i}),b=f.useContext(i1),v=Be(t,g,b?b.measureElement:null),w=se(()=>d.onChange(a));Fe(()=>d.registerOption(s,m),[m,s]);let y=f.useRef(!(u.virtual||u.__demoMode));Fe(()=>{if(!u.virtual||!u.__demoMode)return;let T=hr();return T.requestAnimationFrame(()=>{y.current=!0}),T.dispose},[u.virtual,u.__demoMode]),Fe(()=>{if(!y.current||u.comboboxState!==0||!p||u.activationTrigger===0)return;let T=hr();return T.requestAnimationFrame(()=>{var _,L;(L=(_=g.current)==null?void 0:_.scrollIntoView)==null||L.call(_,{block:"nearest"})}),T.dispose},[g,p,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let S=se(T=>{var _;if(o||(_=u.virtual)!=null&&_.disabled(a))return T.preventDefault();w(),Yg()||requestAnimationFrame(()=>{var L;return(L=u.inputRef.current)==null?void 0:L.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),C=se(()=>{var T;if(o||(T=u.virtual)!=null&&T.disabled(a))return d.goToOption(We.Nothing);let _=u.calculateIndex(a);d.goToOption(We.Specific,_)}),x=e1(),E=se(T=>x.update(T)),P=se(T=>{var _;if(!x.wasMoved(T)||o||(_=u.virtual)!=null&&_.disabled(a)||p)return;let L=u.calculateIndex(a);d.goToOption(We.Specific,L,0)}),O=se(T=>{var _;x.wasMoved(T)&&(o||(_=u.virtual)!=null&&_.disabled(a)||p&&(u.optionsPropsRef.current.hold||d.goToOption(We.Nothing)))}),A=f.useMemo(()=>({active:p,selected:h,disabled:o}),[p,h,o]);return $e({ourProps:{id:s,ref:v,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":h,disabled:void 0,onClick:S,onFocus:C,onPointerEnter:E,onMouseEnter:E,onPointerMove:P,onMouseMove:P,onPointerLeave:O,onMouseLeave:O},theirProps:c,slot:A,defaultTag:_E,name:"Combobox.Option"})}let LE=ke(yE),NE=ke(xE),$E=ke(SE),kE=ke(PE),IE=ke(AE),VE=ke(ME),Wo=Object.assign(LE,{Input:$E,Button:NE,Label:kE,Options:IE,Option:VE});function HE(e,t,n,r){let s=_t(n);f.useEffect(()=>{e=e??window;function o(a){s.current(a)}return e.addEventListener(t,o,r),()=>e.removeEventListener(t,o,r)},[e,t,r])}function _l(){let e=f.useRef(!1);return Fe(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function jE(e){let t=se(e),n=f.useRef(!1);f.useEffect(()=>(n.current=!1,()=>{n.current=!0,Ru(()=>{n.current&&t()})}),[t])}var qr=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(qr||{});function l1(){let e=f.useRef(0);return Xg("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let DE=f.createContext(!1);function FE(){return f.useContext(DE)}function BE(e){let t=FE(),n=f.useContext(c1),r=so(e),[s,o]=f.useState(()=>{if(!t&&n!==null||Wr.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 f.useEffect(()=>{s!==null&&(r!=null&&r.body.contains(s)||r==null||r.body.appendChild(s))},[s,r]),f.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),s}let zE=f.Fragment;function UE(e,t){let n=e,r=f.useRef(null),s=Be(rd(d=>{r.current=d}),t),o=so(r),a=BE(r),[i]=f.useState(()=>{var d;return Wr.isServer?null:(d=o==null?void 0:o.createElement("div"))!=null?d:null}),c=f.useContext(dd),u=Cl();return Fe(()=>{!a||!i||a.contains(i)||(i.setAttribute("data-headlessui-portal",""),a.appendChild(i))},[a,i]),Fe(()=>{if(i&&c)return c.register(i)},[c,i]),jE(()=>{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:Pn.createPortal($e({ourProps:{ref:s},theirProps:n,defaultTag:zE,name:"Portal"}),i):null}let WE=f.Fragment,c1=f.createContext(null);function GE(e,t){let{target:n,...r}=e,s={ref:Be(t)};return f.createElement(c1.Provider,{value:n},$e({ourProps:s,theirProps:r,defaultTag:WE,name:"Popover.Group"}))}let dd=f.createContext(null);function qE(){let e=f.useContext(dd),t=f.useRef([]),n=se(o=>(t.current.push(o),e&&e.register(o),()=>r(o))),r=se(o=>{let a=t.current.indexOf(o);a!==-1&&t.current.splice(a,1),e&&e.unregister(o)}),s=f.useMemo(()=>({register:n,unregister:r,portals:t}),[n,r,t]);return[t,f.useMemo(()=>function({children:o}){return f.createElement(dd.Provider,{value:s},o)},[s])]}let KE=ke(UE),ZE=ke(GE);Object.assign(KE,{Group:ZE});function YE({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var r;let s=f.useRef((r=n==null?void 0:n.current)!=null?r:null),o=so(s),a=se(()=>{var i,c,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=o==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?i:[])p!==document.body&&p!==document.head&&p instanceof HTMLElement&&p.id!=="headlessui-portal-root"&&(p.contains(s.current)||p.contains((u=(c=s.current)==null?void 0:c.getRootNode())==null?void 0:u.host)||d.some(h=>p.contains(h))||d.push(p));return d});return{resolveContainers:a,contains:se(i=>a().some(c=>c.contains(i))),mainTreeNodeRef:s,MainTreeNode:f.useMemo(()=>function(){return n!=null?null:f.createElement(er,{features:Rn.Hidden,ref:s})},[s,n])}}function XE(){let e=f.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:f.useMemo(()=>function(){return f.createElement(er,{features:Rn.Hidden,ref:e})},[e])}}let u1=f.createContext(null);function d1(){let e=f.useContext(u1);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,d1),t}return e}function pd(){let[e,t]=f.useState([]);return[e.length>0?e.join(" "):void 0,f.useMemo(()=>function(n){let r=se(o=>(t(a=>[...a,o]),()=>t(a=>{let i=a.slice(),c=i.indexOf(o);return c!==-1&&i.splice(c,1),i}))),s=f.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return f.createElement(u1.Provider,{value:s},n.children)},[t])]}let JE="p";function QE(e,t){let n=gt(),{id:r=`headlessui-description-${n}`,...s}=e,o=d1(),a=Be(t);Fe(()=>o.register(r),[r,o.register]);let i={ref:a,...o.props,id:r};return $e({ourProps:i,theirProps:s,slot:o.slot||{},defaultTag:JE,name:o.name||"Description"})}let RE=ke(QE),p1=Object.assign(RE,{});var f1;let eP=(f1=f.startTransition)!=null?f1:function(e){e()};var tP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(tP||{}),nP=(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))(nP||{});let rP={0:e=>({...e,disclosureState:Ae(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}}},fd=f.createContext(null);fd.displayName="DisclosureContext";function hd(e){let t=f.useContext(fd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,hd),n}return t}let gd=f.createContext(null);gd.displayName="DisclosureAPIContext";function h1(e){let t=f.useContext(gd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,h1),n}return t}let md=f.createContext(null);md.displayName="DisclosurePanelContext";function sP(){return f.useContext(md)}function oP(e,t){return Ae(t.type,rP,e,t)}let aP=f.Fragment;function iP(e,t){let{defaultOpen:n=!1,...r}=e,s=f.useRef(null),o=Be(t,rd(v=>{s.current=v},e.as===void 0||e.as===f.Fragment)),a=f.useRef(null),i=f.useRef(null),c=f.useReducer(oP,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:i,panelRef:a,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},p]=c,h=se(v=>{p({type:1});let w=fs(s);if(!w||!d)return;let y=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:w.getElementById(d):w.getElementById(d);y==null||y.focus()}),g=f.useMemo(()=>({close:h}),[h]),m=f.useMemo(()=>({open:u===0,close:h}),[u,h]),b={ref:o};return f.createElement(fd.Provider,{value:c},f.createElement(gd.Provider,{value:g},f.createElement(Fa,{value:Ae(u,{0:rt.Open,1:rt.Closed})},$e({ourProps:b,theirProps:r,slot:m,defaultTag:aP,name:"Disclosure"}))))}let lP="button";function cP(e,t){let n=gt(),{id:r=`headlessui-disclosure-button-${n}`,...s}=e,[o,a]=hd("Disclosure.Button"),i=sP(),c=i===null?!1:i===o.panelId,u=f.useRef(null),d=Be(u,t,c?null:o.buttonRef),p=sd();f.useEffect(()=>{if(!c)return a({type:2,buttonId:r}),()=>{a({type:2,buttonId:null})}},[r,a,c]);let h=se(y=>{var S;if(c){if(o.disclosureState===1)return;switch(y.key){case fe.Space:case fe.Enter:y.preventDefault(),y.stopPropagation(),a({type:0}),(S=o.buttonRef.current)==null||S.focus();break}}else switch(y.key){case fe.Space:case fe.Enter:y.preventDefault(),y.stopPropagation(),a({type:0});break}}),g=se(y=>{switch(y.key){case fe.Space:y.preventDefault();break}}),m=se(y=>{var S;gs(y.currentTarget)||e.disabled||(c?(a({type:0}),(S=o.buttonRef.current)==null||S.focus()):a({type:0}))}),b=f.useMemo(()=>({open:o.disclosureState===0}),[o]),v=zo(e,u),w=c?{ref:d,type:v,onKeyDown:h,onClick:m}:{ref:d,id:r,type:v,"aria-expanded":o.disclosureState===0,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:h,onKeyUp:g,onClick:m};return $e({mergeRefs:p,ourProps:w,theirProps:s,slot:b,defaultTag:lP,name:"Disclosure.Button"})}let uP="div",dP=sn.RenderStrategy|sn.Static;function pP(e,t){let n=gt(),{id:r=`headlessui-disclosure-panel-${n}`,...s}=e,[o,a]=hd("Disclosure.Panel"),{close:i}=h1("Disclosure.Panel"),c=sd(),u=Be(t,o.panelRef,m=>{eP(()=>a({type:m?4:5}))});f.useEffect(()=>(a({type:3,panelId:r}),()=>{a({type:3,panelId:null})}),[r,a]);let d=oo(),p=d!==null?(d&rt.Open)===rt.Open:o.disclosureState===0,h=f.useMemo(()=>({open:o.disclosureState===0,close:i}),[o,i]),g={ref:u,id:r};return f.createElement(md.Provider,{value:o.panelId},$e({mergeRefs:c,ourProps:g,theirProps:s,slot:h,defaultTag:uP,features:dP,visible:p,name:"Disclosure.Panel"}))}let fP=ke(iP),hP=ke(cP),gP=ke(pP),bd=Object.assign(fP,{Button:hP,Panel:gP}),g1=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function m1(e){var t,n;let r=(t=e.innerText)!=null?t:"",s=e.cloneNode(!0);if(!(s instanceof HTMLElement))return r;let o=!1;for(let i of s.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))i.remove(),o=!0;let a=o?(n=s.innerText)!=null?n:"":r;return g1.test(a)&&(a=a.replace(g1,"")),a}function mP(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(s=>{let o=document.getElementById(s);if(o){let a=o.getAttribute("aria-label");return typeof a=="string"?a.trim():m1(o).trim()}return null}).filter(Boolean);if(r.length>0)return r.join(", ")}return m1(e).trim()}function bP(e){let t=f.useRef(""),n=f.useRef("");return se(()=>{let r=e.current;if(!r)return"";let s=r.innerText;if(t.current===s)return n.current;let o=mP(r).trim().toLowerCase();return t.current=s,n.current=o,o})}var vP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(vP||{}),yP=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(yP||{}),wP=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(wP||{}),SP=(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))(SP||{});function vd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,r=Gr(t(e.options.slice()),o=>o.dataRef.current.domRef.current),s=n?r.indexOf(n):null;return s===-1&&(s=null),{options:r,activeOptionIndex:s}}let CP={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(s=>n(s.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=vd(e),s=id(t,{resolveItems:()=>r.options,resolveActiveIndex:()=>r.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return{...e,...r,searchQuery:"",activeOptionIndex:s,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(),s=(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))}),o=s?e.options.indexOf(s):-1;return o===-1||o===e.activeOptionIndex?{...e,searchQuery:r}:{...e,searchQuery:r,activeOptionIndex:o,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},r=vd(e,s=>[...s,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=vd(e,r=>{let s=r.findIndex(o=>o.id===t.id);return s!==-1&&r.splice(s,1),r});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},yd=f.createContext(null);yd.displayName="ListboxActionsContext";function za(e){let t=f.useContext(yd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,za),n}return t}let wd=f.createContext(null);wd.displayName="ListboxDataContext";function Ua(e){let t=f.useContext(wd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ua),n}return t}function xP(e,t){return Ae(t.type,CP,e,t)}let EP=f.Fragment;function PP(e,t){let{value:n,defaultValue:r,form:s,name:o,onChange:a,by:i=(Y,R)=>Y===R,disabled:c=!1,horizontal:u=!1,multiple:d=!1,...p}=e;const h=u?"horizontal":"vertical";let g=Be(t),[m=d?[]:void 0,b]=Sl(n,a,r),[v,w]=f.useReducer(xP,{dataRef:f.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=f.useRef({static:!1,hold:!1}),S=f.useRef(null),C=f.useRef(null),x=f.useRef(null),E=se(typeof i=="string"?(Y,R)=>{let ee=i;return(Y==null?void 0:Y[ee])===(R==null?void 0:R[ee])}:i),P=f.useCallback(Y=>Ae(O.mode,{1:()=>m.some(R=>E(R,Y)),0:()=>E(m,Y)}),[m]),O=f.useMemo(()=>({...v,value:m,disabled:c,mode:d?1:0,orientation:h,compare:E,isSelected:P,optionsPropsRef:y,labelRef:S,buttonRef:C,optionsRef:x}),[m,c,d,v]);Fe(()=>{v.dataRef.current=O},[O]),nd([O.buttonRef,O.optionsRef],(Y,R)=>{var ee;w({type:1}),td(R,El.Loose)||(Y.preventDefault(),(ee=O.buttonRef.current)==null||ee.focus())},O.listboxState===0);let A=f.useMemo(()=>({open:O.listboxState===0,disabled:c,value:m}),[O,c,m]),T=se(Y=>{let R=O.options.find(ee=>ee.id===Y);R&&q(R.dataRef.current.value)}),_=se(()=>{if(O.activeOptionIndex!==null){let{dataRef:Y,id:R}=O.options[O.activeOptionIndex];q(Y.current.value),w({type:2,focus:We.Specific,id:R})}}),L=se(()=>w({type:0})),$=se(()=>w({type:1})),D=se((Y,R,ee)=>Y===We.Specific?w({type:2,focus:We.Specific,id:R,trigger:ee}):w({type:2,focus:Y,trigger:ee})),N=se((Y,R)=>(w({type:5,id:Y,dataRef:R}),()=>w({type:6,id:Y}))),B=se(Y=>(w({type:7,id:Y}),()=>w({type:7,id:null}))),q=se(Y=>Ae(O.mode,{0(){return b==null?void 0:b(Y)},1(){let R=O.value.slice(),ee=R.findIndex(te=>E(te,Y));return ee===-1?R.push(Y):R.splice(ee,1),b==null?void 0:b(R)}})),F=se(Y=>w({type:3,value:Y})),k=se(()=>w({type:4})),H=f.useMemo(()=>({onChange:q,registerOption:N,registerLabel:B,goToOption:D,closeListbox:$,openListbox:L,selectActiveOption:_,selectOption:T,search:F,clearSearch:k}),[]),V={ref:g},U=f.useRef(null),X=Qn();return f.useEffect(()=>{U.current&&r!==void 0&&X.addEventListener(U.current,"reset",()=>{b==null||b(r)})},[U,b]),f.createElement(yd.Provider,{value:H},f.createElement(wd.Provider,{value:O},f.createElement(Fa,{value:Ae(O.listboxState,{0:rt.Open,1:rt.Closed})},o!=null&&m!=null&&Al({[o]:m}).map(([Y,R],ee)=>f.createElement(er,{features:Rn.Hidden,ref:ee===0?te=>{var K;U.current=(K=te==null?void 0:te.closest("form"))!=null?K:null}:void 0,...Uo({key:Y,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:s,disabled:c,name:Y,value:R})})),$e({ourProps:V,theirProps:p,slot:A,defaultTag:EP,name:"Listbox"}))))}let TP="button";function OP(e,t){var n;let r=gt(),{id:s=`headlessui-listbox-button-${r}`,...o}=e,a=Ua("Listbox.Button"),i=za("Listbox.Button"),c=Be(a.buttonRef,t),u=Qn(),d=se(v=>{switch(v.key){case fe.Space:case fe.Enter:case fe.ArrowDown:v.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(We.First)});break;case fe.ArrowUp:v.preventDefault(),i.openListbox(),u.nextFrame(()=>{a.value||i.goToOption(We.Last)});break}}),p=se(v=>{switch(v.key){case fe.Space:v.preventDefault();break}}),h=se(v=>{if(gs(v.currentTarget))return v.preventDefault();a.listboxState===0?(i.closeListbox(),u.nextFrame(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.focus({preventScroll:!0})})):(v.preventDefault(),i.openListbox())}),g=Da(()=>{if(a.labelId)return[a.labelId,s].join(" ")},[a.labelId,s]),m=f.useMemo(()=>({open:a.listboxState===0,disabled:a.disabled,value:a.value}),[a]),b={ref:c,id:s,type:zo(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:h};return $e({ourProps:b,theirProps:o,slot:m,defaultTag:TP,name:"Listbox.Button"})}let AP="label";function _P(e,t){let n=gt(),{id:r=`headlessui-listbox-label-${n}`,...s}=e,o=Ua("Listbox.Label"),a=za("Listbox.Label"),i=Be(o.labelRef,t);Fe(()=>a.registerLabel(r),[r]);let c=se(()=>{var d;return(d=o.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=f.useMemo(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]);return $e({ourProps:{ref:i,id:r,onClick:c},theirProps:s,slot:u,defaultTag:AP,name:"Listbox.Label"})}let MP="ul",LP=sn.RenderStrategy|sn.Static;function NP(e,t){var n;let r=gt(),{id:s=`headlessui-listbox-options-${r}`,...o}=e,a=Ua("Listbox.Options"),i=za("Listbox.Options"),c=Be(a.optionsRef,t),u=Qn(),d=Qn(),p=oo(),h=p!==null?(p&rt.Open)===rt.Open:a.listboxState===0;f.useEffect(()=>{var w;let y=a.optionsRef.current;y&&a.listboxState===0&&y!==((w=fs(y))==null?void 0:w.activeElement)&&y.focus({preventScroll:!0})},[a.listboxState,a.optionsRef]);let g=se(w=>{switch(d.dispose(),w.key){case fe.Space:if(a.searchQuery!=="")return w.preventDefault(),w.stopPropagation(),i.search(w.key);case fe.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(),hr().nextFrame(()=>{var y;return(y=a.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case Ae(a.orientation,{vertical:fe.ArrowDown,horizontal:fe.ArrowRight}):return w.preventDefault(),w.stopPropagation(),i.goToOption(We.Next);case Ae(a.orientation,{vertical:fe.ArrowUp,horizontal:fe.ArrowLeft}):return w.preventDefault(),w.stopPropagation(),i.goToOption(We.Previous);case fe.Home:case fe.PageUp:return w.preventDefault(),w.stopPropagation(),i.goToOption(We.First);case fe.End:case fe.PageDown:return w.preventDefault(),w.stopPropagation(),i.goToOption(We.Last);case fe.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 fe.Tab:w.preventDefault(),w.stopPropagation();break;default:w.key.length===1&&(i.search(w.key),d.setTimeout(()=>i.clearSearch(),350));break}}),m=Da(()=>{var w;return(w=a.buttonRef.current)==null?void 0:w.id},[a.buttonRef.current]),b=f.useMemo(()=>({open:a.listboxState===0}),[a]),v={"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:s,onKeyDown:g,role:"listbox",tabIndex:0,ref:c};return $e({ourProps:v,theirProps:o,slot:b,defaultTag:MP,features:LP,visible:h,name:"Listbox.Options"})}let $P="li";function kP(e,t){let n=gt(),{id:r=`headlessui-listbox-option-${n}`,disabled:s=!1,value:o,...a}=e,i=Ua("Listbox.Option"),c=za("Listbox.Option"),u=i.activeOptionIndex!==null?i.options[i.activeOptionIndex].id===r:!1,d=i.isSelected(o),p=f.useRef(null),h=bP(p),g=_t({disabled:s,value:o,domRef:p,get textValue(){return h()}}),m=Be(t,p);Fe(()=>{if(i.listboxState!==0||!u||i.activationTrigger===0)return;let E=hr();return E.requestAnimationFrame(()=>{var P,O;(O=(P=p.current)==null?void 0:P.scrollIntoView)==null||O.call(P,{block:"nearest"})}),E.dispose},[p,u,i.listboxState,i.activationTrigger,i.activeOptionIndex]),Fe(()=>c.registerOption(r,g),[g,r]);let b=se(E=>{if(s)return E.preventDefault();c.onChange(o),i.mode===0&&(c.closeListbox(),hr().nextFrame(()=>{var P;return(P=i.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})}))}),v=se(()=>{if(s)return c.goToOption(We.Nothing);c.goToOption(We.Specific,r)}),w=e1(),y=se(E=>w.update(E)),S=se(E=>{w.wasMoved(E)&&(s||u||c.goToOption(We.Specific,r,0))}),C=se(E=>{w.wasMoved(E)&&(s||u&&c.goToOption(We.Nothing))}),x=f.useMemo(()=>({active:u,selected:d,disabled:s}),[u,d,s]);return $e({ourProps:{id:r,ref:m,role:"option",tabIndex:s===!0?void 0:-1,"aria-disabled":s===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:b,onFocus:v,onPointerEnter:y,onMouseEnter:y,onPointerMove:S,onMouseMove:S,onPointerLeave:C,onMouseLeave:C},theirProps:a,slot:x,defaultTag:$P,name:"Listbox.Option"})}let IP=ke(PP),VP=ke(OP),HP=ke(_P),jP=ke(NP),DP=ke(kP),Wa=Object.assign(IP,{Button:VP,Label:HP,Options:jP,Option:DP});var FP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(FP||{}),BP=(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))(BP||{});let zP={0:e=>{let t={...e,popoverState:Ae(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}}},Sd=f.createContext(null);Sd.displayName="PopoverContext";function Ml(e){let t=f.useContext(Sd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ml),n}return t}let Cd=f.createContext(null);Cd.displayName="PopoverAPIContext";function xd(e){let t=f.useContext(Cd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,xd),n}return t}let Ed=f.createContext(null);Ed.displayName="PopoverGroupContext";function b1(){return f.useContext(Ed)}let Ll=f.createContext(null);Ll.displayName="PopoverPanelContext";function UP(){return f.useContext(Ll)}function WP(e,t){return Ae(t.type,zP,e,t)}let GP="div";function qP(e,t){var n;let{__demoMode:r=!1,...s}=e,o=f.useRef(null),a=Be(t,rd(B=>{o.current=B})),i=f.useRef([]),c=f.useReducer(WP,{__demoMode:r,popoverState:r?0:1,buttons:i,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:f.createRef(),afterPanelSentinel:f.createRef()}),[{popoverState:u,button:d,buttonId:p,panel:h,panelId:g,beforePanelSentinel:m,afterPanelSentinel:b},v]=c,w=so((n=o.current)!=null?n:d),y=f.useMemo(()=>{if(!d||!h)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(h)))return!0;let B=xl(),q=B.indexOf(d),F=(q+B.length-1)%B.length,k=(q+1)%B.length,H=B[F],V=B[k];return!h.contains(H)&&!h.contains(V)},[d,h]),S=_t(p),C=_t(g),x=f.useMemo(()=>({buttonId:S,panelId:C,close:()=>v({type:1})}),[S,C,v]),E=b1(),P=E==null?void 0:E.registerPopover,O=se(()=>{var B;return(B=E==null?void 0:E.isFocusWithinPopoverGroup())!=null?B:(w==null?void 0:w.activeElement)&&((d==null?void 0:d.contains(w.activeElement))||(h==null?void 0:h.contains(w.activeElement)))});f.useEffect(()=>P==null?void 0:P(x),[P,x]);let[A,T]=qE(),_=YE({mainTreeNodeRef:E==null?void 0:E.mainTreeNodeRef,portals:A,defaultContainers:[d,h]});HE(w==null?void 0:w.defaultView,"focus",B=>{var q,F,k,H;B.target!==window&&B.target instanceof HTMLElement&&u===0&&(O()||d&&h&&(_.contains(B.target)||(F=(q=m.current)==null?void 0:q.contains)!=null&&F.call(q,B.target)||(H=(k=b.current)==null?void 0:k.contains)!=null&&H.call(k,B.target)||v({type:1})))},!0),nd(_.resolveContainers,(B,q)=>{v({type:1}),td(q,El.Loose)||(B.preventDefault(),d==null||d.focus())},u===0);let L=se(B=>{v({type:1});let q=B?B instanceof HTMLElement?B:"current"in B&&B.current instanceof HTMLElement?B.current:d:d;q==null||q.focus()}),$=f.useMemo(()=>({close:L,isPortalled:y}),[L,y]),D=f.useMemo(()=>({open:u===0,close:L}),[u,L]),N={ref:a};return f.createElement(Ll.Provider,{value:null},f.createElement(Sd.Provider,{value:c},f.createElement(Cd.Provider,{value:$},f.createElement(Fa,{value:Ae(u,{0:rt.Open,1:rt.Closed})},f.createElement(T,null,$e({ourProps:N,theirProps:s,slot:D,defaultTag:GP,name:"Popover"}),f.createElement(_.MainTreeNode,null))))))}let KP="button";function ZP(e,t){let n=gt(),{id:r=`headlessui-popover-button-${n}`,...s}=e,[o,a]=Ml("Popover.Button"),{isPortalled:i}=xd("Popover.Button"),c=f.useRef(null),u=`headlessui-focus-sentinel-${gt()}`,d=b1(),p=d==null?void 0:d.closeOthers,h=UP()!==null;f.useEffect(()=>{if(!h)return a({type:3,buttonId:r}),()=>{a({type:3,buttonId:null})}},[h,r,a]);let[g]=f.useState(()=>Symbol()),m=Be(c,t,h?null:_=>{if(_)o.buttons.current.push(g);else{let L=o.buttons.current.indexOf(g);L!==-1&&o.buttons.current.splice(L,1)}o.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),_&&a({type:2,button:_})}),b=Be(c,t),v=so(c),w=se(_=>{var L,$,D;if(h){if(o.popoverState===1)return;switch(_.key){case fe.Space:case fe.Enter:_.preventDefault(),($=(L=_.target).click)==null||$.call(L),a({type:1}),(D=o.button)==null||D.focus();break}}else switch(_.key){case fe.Space:case fe.Enter:_.preventDefault(),_.stopPropagation(),o.popoverState===1&&(p==null||p(o.buttonId)),a({type:0});break;case fe.Escape:if(o.popoverState!==0)return p==null?void 0:p(o.buttonId);if(!c.current||v!=null&&v.activeElement&&!c.current.contains(v.activeElement))return;_.preventDefault(),_.stopPropagation(),a({type:1});break}}),y=se(_=>{h||_.key===fe.Space&&_.preventDefault()}),S=se(_=>{var L,$;gs(_.currentTarget)||e.disabled||(h?(a({type:1}),(L=o.button)==null||L.focus()):(_.preventDefault(),_.stopPropagation(),o.popoverState===1&&(p==null||p(o.buttonId)),a({type:0}),($=o.button)==null||$.focus()))}),C=se(_=>{_.preventDefault(),_.stopPropagation()}),x=o.popoverState===0,E=f.useMemo(()=>({open:x}),[x]),P=zo(e,c),O=h?{ref:b,type:P,onKeyDown:w,onClick:S}:{ref:m,id:o.buttonId,type:P,"aria-expanded":o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:w,onKeyUp:y,onClick:S,onMouseDown:C},A=l1(),T=se(()=>{let _=o.panel;if(!_)return;function L(){Ae(A.current,{[qr.Forwards]:()=>Jt(_,vt.First),[qr.Backwards]:()=>Jt(_,vt.Last)})===gr.Error&&Jt(xl().filter($=>$.dataset.headlessuiFocusGuard!=="true"),Ae(A.current,{[qr.Forwards]:vt.Next,[qr.Backwards]:vt.Previous}),{relativeTo:o.button})}L()});return f.createElement(f.Fragment,null,$e({ourProps:O,theirProps:s,slot:E,defaultTag:KP,name:"Popover.Button"}),x&&!h&&i&&f.createElement(er,{id:u,features:Rn.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let YP="div",XP=sn.RenderStrategy|sn.Static;function JP(e,t){let n=gt(),{id:r=`headlessui-popover-overlay-${n}`,...s}=e,[{popoverState:o},a]=Ml("Popover.Overlay"),i=Be(t),c=oo(),u=c!==null?(c&rt.Open)===rt.Open:o===0,d=se(h=>{if(gs(h.currentTarget))return h.preventDefault();a({type:1})}),p=f.useMemo(()=>({open:o===0}),[o]);return $e({ourProps:{ref:i,id:r,"aria-hidden":!0,onClick:d},theirProps:s,slot:p,defaultTag:YP,features:XP,visible:u,name:"Popover.Overlay"})}let QP="div",RP=sn.RenderStrategy|sn.Static;function eT(e,t){let n=gt(),{id:r=`headlessui-popover-panel-${n}`,focus:s=!1,...o}=e,[a,i]=Ml("Popover.Panel"),{close:c,isPortalled:u}=xd("Popover.Panel"),d=`headlessui-focus-sentinel-before-${gt()}`,p=`headlessui-focus-sentinel-after-${gt()}`,h=f.useRef(null),g=Be(h,t,O=>{i({type:4,panel:O})}),m=so(h),b=sd();Fe(()=>(i({type:5,panelId:r}),()=>{i({type:5,panelId:null})}),[r,i]);let v=oo(),w=v!==null?(v&rt.Open)===rt.Open:a.popoverState===0,y=se(O=>{var A;switch(O.key){case fe.Escape:if(a.popoverState!==0||!h.current||m!=null&&m.activeElement&&!h.current.contains(m.activeElement))return;O.preventDefault(),O.stopPropagation(),i({type:1}),(A=a.button)==null||A.focus();break}});f.useEffect(()=>{var O;e.static||a.popoverState===1&&((O=e.unmount)==null||O)&&i({type:4,panel:null})},[a.popoverState,e.unmount,e.static,i]),f.useEffect(()=>{if(a.__demoMode||!s||a.popoverState!==0||!h.current)return;let O=m==null?void 0:m.activeElement;h.current.contains(O)||Jt(h.current,vt.First)},[a.__demoMode,s,h,a.popoverState]);let S=f.useMemo(()=>({open:a.popoverState===0,close:c}),[a,c]),C={ref:g,id:r,onKeyDown:y,onBlur:s&&a.popoverState===0?O=>{var A,T,_,L,$;let D=O.relatedTarget;D&&h.current&&((A=h.current)!=null&&A.contains(D)||(i({type:1}),((_=(T=a.beforePanelSentinel.current)==null?void 0:T.contains)!=null&&_.call(T,D)||($=(L=a.afterPanelSentinel.current)==null?void 0:L.contains)!=null&&$.call(L,D))&&D.focus({preventScroll:!0})))}:void 0,tabIndex:-1},x=l1(),E=se(()=>{let O=h.current;if(!O)return;function A(){Ae(x.current,{[qr.Forwards]:()=>{var T;Jt(O,vt.First)===gr.Error&&((T=a.afterPanelSentinel.current)==null||T.focus())},[qr.Backwards]:()=>{var T;(T=a.button)==null||T.focus({preventScroll:!0})}})}A()}),P=se(()=>{let O=h.current;if(!O)return;function A(){Ae(x.current,{[qr.Forwards]:()=>{var T;if(!a.button)return;let _=xl(),L=_.indexOf(a.button),$=_.slice(0,L+1),D=[..._.slice(L+1),...$];for(let N of D.slice())if(N.dataset.headlessuiFocusGuard==="true"||(T=a.panel)!=null&&T.contains(N)){let B=D.indexOf(N);B!==-1&&D.splice(B,1)}Jt(D,vt.First,{sorted:!1})},[qr.Backwards]:()=>{var T;Jt(O,vt.Previous)===gr.Error&&((T=a.button)==null||T.focus())}})}A()});return f.createElement(Ll.Provider,{value:r},w&&u&&f.createElement(er,{id:d,ref:a.beforePanelSentinel,features:Rn.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}),$e({mergeRefs:b,ourProps:C,theirProps:o,slot:S,defaultTag:QP,features:RP,visible:w,name:"Popover.Panel"}),w&&u&&f.createElement(er,{id:p,ref:a.afterPanelSentinel,features:Rn.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let tT="div";function nT(e,t){let n=f.useRef(null),r=Be(n,t),[s,o]=f.useState([]),a=XE(),i=se(b=>{o(v=>{let w=v.indexOf(b);if(w!==-1){let y=v.slice();return y.splice(w,1),y}return v})}),c=se(b=>(o(v=>[...v,b]),()=>i(b))),u=se(()=>{var b;let v=fs(n);if(!v)return!1;let w=v.activeElement;return(b=n.current)!=null&&b.contains(w)?!0:s.some(y=>{var S,C;return((S=v.getElementById(y.buttonId.current))==null?void 0:S.contains(w))||((C=v.getElementById(y.panelId.current))==null?void 0:C.contains(w))})}),d=se(b=>{for(let v of s)v.buttonId.current!==b&&v.close()}),p=f.useMemo(()=>({registerPopover:c,unregisterPopover:i,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:a.mainTreeNodeRef}),[c,i,u,d,a.mainTreeNodeRef]),h=f.useMemo(()=>({}),[]),g=e,m={ref:r};return f.createElement(Ed.Provider,{value:p},$e({ourProps:m,theirProps:g,slot:h,defaultTag:tT,name:"Popover.Group"}),f.createElement(a.MainTreeNode,null))}let rT=ke(qP),sT=ke(ZP),oT=ke(JP),aT=ke(eT),iT=ke(nT),Pd=Object.assign(rT,{Button:sT,Overlay:oT,Panel:aT,Group:iT}),v1=f.createContext(null);function y1(){let e=f.useContext(v1);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,y1),t}return e}function Td(){let[e,t]=f.useState([]);return[e.length>0?e.join(" "):void 0,f.useMemo(()=>function(n){let r=se(o=>(t(a=>[...a,o]),()=>t(a=>{let i=a.slice(),c=i.indexOf(o);return c!==-1&&i.splice(c,1),i}))),s=f.useMemo(()=>({register:r,slot:n.slot,name:n.name,props:n.props}),[r,n.slot,n.name,n.props]);return f.createElement(v1.Provider,{value:s},n.children)},[t])]}let lT="label";function cT(e,t){let n=gt(),{id:r=`headlessui-label-${n}`,passive:s=!1,...o}=e,a=y1(),i=Be(t);Fe(()=>a.register(r),[r,a.register]);let c={ref:i,...a.props,id:r};return s&&("onClick"in c&&(delete c.htmlFor,delete c.onClick),"onClick"in o&&delete o.onClick),$e({ourProps:c,theirProps:o,slot:a.slot||{},defaultTag:lT,name:a.name||"Label"})}let uT=ke(cT),w1=Object.assign(uT,{});function S1(e=0){let[t,n]=f.useState(e),r=_l(),s=f.useCallback(c=>{r.current&&n(u=>u|c)},[t,r]),o=f.useCallback(c=>!!(t&c),[t]),a=f.useCallback(c=>{r.current&&n(u=>u&~c)},[n,r]),i=f.useCallback(c=>{r.current&&n(u=>u^c)},[n]);return{flags:t,addFlag:s,hasFlag:o,removeFlag:a,toggleFlag:i}}var dT=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(dT||{});let pT={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Gr(n,r=>r.element.current)}},1(e,t){let n=e.options.slice(),r=e.options.findIndex(s=>s.id===t.id);return r===-1?e:(n.splice(r,1),{...e,options:n})}},Od=f.createContext(null);Od.displayName="RadioGroupDataContext";function C1(e){let t=f.useContext(Od);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,C1),n}return t}let Ad=f.createContext(null);Ad.displayName="RadioGroupActionsContext";function x1(e){let t=f.useContext(Ad);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,x1),n}return t}function fT(e,t){return Ae(t.type,pT,e,t)}let hT="div";function gT(e,t){let n=gt(),{id:r=`headlessui-radiogroup-${n}`,value:s,defaultValue:o,form:a,name:i,onChange:c,by:u=(k,H)=>k===H,disabled:d=!1,...p}=e,h=se(typeof u=="string"?(k,H)=>{let V=u;return(k==null?void 0:k[V])===(H==null?void 0:H[V])}:u),[g,m]=f.useReducer(fT,{options:[]}),b=g.options,[v,w]=Td(),[y,S]=pd(),C=f.useRef(null),x=Be(C,t),[E,P]=Sl(s,c,o),O=f.useMemo(()=>b.find(k=>!k.propsRef.current.disabled),[b]),A=f.useMemo(()=>b.some(k=>h(k.propsRef.current.value,E)),[b,E]),T=se(k=>{var H;if(d||h(k,E))return!1;let V=(H=b.find(U=>h(U.propsRef.current.value,k)))==null?void 0:H.propsRef.current;return V!=null&&V.disabled?!1:(P==null||P(k),!0)});t1({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 _=se(k=>{let H=C.current;if(!H)return;let V=fs(H),U=b.filter(X=>X.propsRef.current.disabled===!1).map(X=>X.element.current);switch(k.key){case fe.Enter:a1(k.currentTarget);break;case fe.ArrowLeft:case fe.ArrowUp:if(k.preventDefault(),k.stopPropagation(),Jt(U,vt.Previous|vt.WrapAround)===gr.Success){let X=b.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));X&&T(X.propsRef.current.value)}break;case fe.ArrowRight:case fe.ArrowDown:if(k.preventDefault(),k.stopPropagation(),Jt(U,vt.Next|vt.WrapAround)===gr.Success){let X=b.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));X&&T(X.propsRef.current.value)}break;case fe.Space:{k.preventDefault(),k.stopPropagation();let X=b.find(Y=>Y.element.current===(V==null?void 0:V.activeElement));X&&T(X.propsRef.current.value)}break}}),L=se(k=>(m({type:0,...k}),()=>m({type:1,id:k.id}))),$=f.useMemo(()=>({value:E,firstOption:O,containsCheckedOption:A,disabled:d,compare:h,...g}),[E,O,A,d,h,g]),D=f.useMemo(()=>({registerOption:L,change:T}),[L,T]),N={ref:x,id:r,role:"radiogroup","aria-labelledby":v,"aria-describedby":y,onKeyDown:_},B=f.useMemo(()=>({value:E}),[E]),q=f.useRef(null),F=Qn();return f.useEffect(()=>{q.current&&o!==void 0&&F.addEventListener(q.current,"reset",()=>{T(o)})},[q,T]),f.createElement(S,{name:"RadioGroup.Description"},f.createElement(w,{name:"RadioGroup.Label"},f.createElement(Ad.Provider,{value:D},f.createElement(Od.Provider,{value:$},i!=null&&E!=null&&Al({[i]:E}).map(([k,H],V)=>f.createElement(er,{features:Rn.Hidden,ref:V===0?U=>{var X;q.current=(X=U==null?void 0:U.closest("form"))!=null?X:null}:void 0,...Uo({key:k,as:"input",type:"radio",checked:H!=null,hidden:!0,readOnly:!0,form:a,disabled:d,name:k,value:H})})),$e({ourProps:N,theirProps:p,slot:B,defaultTag:hT,name:"RadioGroup"})))))}var mT=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(mT||{});let bT="div";function vT(e,t){var n;let r=gt(),{id:s=`headlessui-radiogroup-option-${r}`,value:o,disabled:a=!1,...i}=e,c=f.useRef(null),u=Be(c,t),[d,p]=Td(),[h,g]=pd(),{addFlag:m,removeFlag:b,hasFlag:v}=S1(1),w=_t({value:o,disabled:a}),y=C1("RadioGroup.Option"),S=x1("RadioGroup.Option");Fe(()=>S.registerOption({id:s,element:c,propsRef:w}),[s,S,c,w]);let C=se(L=>{var $;if(gs(L.currentTarget))return L.preventDefault();S.change(o)&&(m(2),($=c.current)==null||$.focus())}),x=se(L=>{if(gs(L.currentTarget))return L.preventDefault();m(2)}),E=se(()=>b(2)),P=((n=y.firstOption)==null?void 0:n.id)===s,O=y.disabled||a,A=y.compare(y.value,o),T={ref:u,id:s,role:"radio","aria-checked":A?"true":"false","aria-labelledby":d,"aria-describedby":h,"aria-disabled":O?!0:void 0,tabIndex:O?-1:A||!y.containsCheckedOption&&P?0:-1,onClick:O?void 0:C,onFocus:O?void 0:x,onBlur:O?void 0:E},_=f.useMemo(()=>({checked:A,disabled:O,active:v(2)}),[A,O,v]);return f.createElement(g,{name:"RadioGroup.Description"},f.createElement(p,{name:"RadioGroup.Label"},$e({ourProps:T,theirProps:i,slot:_,defaultTag:bT,name:"RadioGroup.Option"})))}let yT=ke(gT),wT=ke(vT),E1=Object.assign(yT,{Option:wT,Label:w1,Description:p1}),_d=f.createContext(null);_d.displayName="GroupContext";let ST=f.Fragment;function CT(e){var t;let[n,r]=f.useState(null),[s,o]=Td(),[a,i]=pd(),c=f.useMemo(()=>({switch:n,setSwitch:r,labelledby:s,describedby:a}),[n,r,s,a]),u={},d=e;return f.createElement(i,{name:"Switch.Description"},f.createElement(o,{name:"Switch.Label",props:{htmlFor:(t=c.switch)==null?void 0:t.id,onClick(p){n&&(p.currentTarget.tagName==="LABEL"&&p.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},f.createElement(_d.Provider,{value:c},$e({ourProps:u,theirProps:d,defaultTag:ST,name:"Switch.Group"}))))}let xT="button";function ET(e,t){var n;let r=gt(),{id:s=`headlessui-switch-${r}`,checked:o,defaultChecked:a=!1,onChange:i,disabled:c=!1,name:u,value:d,form:p,...h}=e,g=f.useContext(_d),m=f.useRef(null),b=Be(m,t,g===null?null:g.setSwitch),[v,w]=Sl(o,i,a),y=se(()=>w==null?void 0:w(!v)),S=se(A=>{if(gs(A.currentTarget))return A.preventDefault();A.preventDefault(),y()}),C=se(A=>{A.key===fe.Space?(A.preventDefault(),y()):A.key===fe.Enter&&a1(A.currentTarget)}),x=se(A=>A.preventDefault()),E=f.useMemo(()=>({checked:v}),[v]),P={id:s,ref:b,role:"switch",type:zo(e,m),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":v,"aria-labelledby":g==null?void 0:g.labelledby,"aria-describedby":g==null?void 0:g.describedby,disabled:c,onClick:S,onKeyUp:C,onKeyPress:x},O=Qn();return f.useEffect(()=>{var A;let T=(A=m.current)==null?void 0:A.closest("form");T&&a!==void 0&&O.addEventListener(T,"reset",()=>{w(a)})},[m,w]),f.createElement(f.Fragment,null,u!=null&&v&&f.createElement(er,{features:Rn.Hidden,...Uo({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:c,form:p,checked:v,name:u,value:d})}),$e({ourProps:P,theirProps:h,slot:E,defaultTag:xT,name:"Switch"}))}let PT=ke(ET),TT=CT,Md=Object.assign(PT,{Group:TT,Label:w1,Description:p1});function OT({onFocus:e}){let[t,n]=f.useState(!0),r=_l();return t?f.createElement(er,{as:"button",type:"button",features:Rn.Focusable,onFocus:s=>{s.preventDefault();let o,a=50;function i(){if(a--<=0){o&&cancelAnimationFrame(o);return}if(e()){if(cancelAnimationFrame(o),!r.current)return;n(!1);return}o=requestAnimationFrame(i)}o=requestAnimationFrame(i)}}):null}const P1=Ye.createContext(null);function AT(){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 s=(n=r.get(t))!=null?n:0;r.set(t,s+1);let o=Array.from(r.keys()).indexOf(t);function a(){let i=r.get(t);i>1?r.set(t,i-1):r.delete(t)}return[o,a]}}}function _T({children:e}){let t=Ye.useRef(AT());return Ye.createElement(P1.Provider,{value:t},e)}function T1(e){let t=Ye.useContext(P1);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=MT(),[r,s]=t.current.get(e,n);return Ye.useEffect(()=>s,[]),r}function MT(){var e,t,n;let r=(n=(t=(e=Ye.__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 s=[],o=r;for(;o;)s.push(o.index),o=o.return;return"$."+s.join(".")}var LT=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(LT||{}),NT=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(NT||{}),$T=(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))($T||{});let kT={0(e,t){var n;let r=Gr(e.tabs,d=>d.current),s=Gr(e.panels,d=>d.current),o=r.filter(d=>{var p;return!((p=d.current)!=null&&p.hasAttribute("disabled"))}),a={...e,tabs:r,panels:s};if(t.index<0||t.index>r.length-1){let d=Ae(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Ae(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(o.length===0)return a;let p=Ae(d,{0:()=>r.indexOf(o[0]),1:()=>r.indexOf(o[o.length-1])});return{...a,selectedIndex:p===-1?e.selectedIndex:p}}let i=r.slice(0,t.index),c=[...r.slice(t.index),...i].find(d=>o.includes(d));if(!c)return a;let u=(n=r.indexOf(c))!=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=Gr([...e.tabs,t.tab],o=>o.current),s=e.selectedIndex;return e.info.current.isControlled||(s=r.indexOf(n),s===-1&&(s=e.selectedIndex)),{...e,tabs:r,selectedIndex:s}},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:Gr([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},Ld=f.createContext(null);Ld.displayName="TabsDataContext";function Go(e){let t=f.useContext(Ld);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Go),n}return t}let Nd=f.createContext(null);Nd.displayName="TabsActionsContext";function $d(e){let t=f.useContext(Nd);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,$d),n}return t}function IT(e,t){return Ae(t.type,kT,e,t)}let VT=f.Fragment;function HT(e,t){let{defaultIndex:n=0,vertical:r=!1,manual:s=!1,onChange:o,selectedIndex:a=null,...i}=e;const c=r?"vertical":"horizontal",u=s?"manual":"auto";let d=a!==null,p=_t({isControlled:d}),h=Be(t),[g,m]=f.useReducer(IT,{info:p,selectedIndex:a??n,tabs:[],panels:[]}),b=f.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),v=_t(o||(()=>{})),w=_t(g.tabs),y=f.useMemo(()=>({orientation:c,activation:u,...g}),[c,u,g]),S=se(A=>(m({type:1,tab:A}),()=>m({type:2,tab:A}))),C=se(A=>(m({type:3,panel:A}),()=>m({type:4,panel:A}))),x=se(A=>{E.current!==A&&v.current(A),d||m({type:0,index:A})}),E=_t(d?e.selectedIndex:g.selectedIndex),P=f.useMemo(()=>({registerTab:S,registerPanel:C,change:x}),[]);Fe(()=>{m({type:0,index:a??n})},[a]),Fe(()=>{if(E.current===void 0||g.tabs.length<=0)return;let A=Gr(g.tabs,T=>T.current);A.some((T,_)=>g.tabs[_]!==T)&&x(A.indexOf(g.tabs[E.current]))});let O={ref:h};return f.createElement(_T,null,f.createElement(Nd.Provider,{value:P},f.createElement(Ld.Provider,{value:y},y.tabs.length<=0&&f.createElement(OT,{onFocus:()=>{var A,T;for(let _ of w.current)if(((A=_.current)==null?void 0:A.tabIndex)===0)return(T=_.current)==null||T.focus(),!0;return!1}}),$e({ourProps:O,theirProps:i,slot:b,defaultTag:VT,name:"Tabs"}))))}let jT="div";function DT(e,t){let{orientation:n,selectedIndex:r}=Go("Tab.List"),s=Be(t);return $e({ourProps:{ref:s,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:r},defaultTag:jT,name:"Tabs.List"})}let FT="button";function BT(e,t){var n,r;let s=gt(),{id:o=`headlessui-tabs-tab-${s}`,...a}=e,{orientation:i,activation:c,selectedIndex:u,tabs:d,panels:p}=Go("Tab"),h=$d("Tab"),g=Go("Tab"),m=f.useRef(null),b=Be(m,t);Fe(()=>h.registerTab(m),[h,m]);let v=T1("tabs"),w=d.indexOf(m);w===-1&&(w=v);let y=w===u,S=se(T=>{var _;let L=T();if(L===gr.Success&&c==="auto"){let $=(_=fs(m))==null?void 0:_.activeElement,D=g.tabs.findIndex(N=>N.current===$);D!==-1&&h.change(D)}return L}),C=se(T=>{let _=d.map(L=>L.current).filter(Boolean);if(T.key===fe.Space||T.key===fe.Enter){T.preventDefault(),T.stopPropagation(),h.change(w);return}switch(T.key){case fe.Home:case fe.PageUp:return T.preventDefault(),T.stopPropagation(),S(()=>Jt(_,vt.First));case fe.End:case fe.PageDown:return T.preventDefault(),T.stopPropagation(),S(()=>Jt(_,vt.Last))}if(S(()=>Ae(i,{vertical(){return T.key===fe.ArrowUp?Jt(_,vt.Previous|vt.WrapAround):T.key===fe.ArrowDown?Jt(_,vt.Next|vt.WrapAround):gr.Error},horizontal(){return T.key===fe.ArrowLeft?Jt(_,vt.Previous|vt.WrapAround):T.key===fe.ArrowRight?Jt(_,vt.Next|vt.WrapAround):gr.Error}}))===gr.Success)return T.preventDefault()}),x=f.useRef(!1),E=se(()=>{var T;x.current||(x.current=!0,(T=m.current)==null||T.focus({preventScroll:!0}),h.change(w),Ru(()=>{x.current=!1}))}),P=se(T=>{T.preventDefault()}),O=f.useMemo(()=>{var T;return{selected:y,disabled:(T=e.disabled)!=null?T:!1}},[y,e.disabled]),A={ref:b,onKeyDown:C,onMouseDown:P,onClick:E,id:o,role:"tab",type:zo(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 $e({ourProps:A,theirProps:a,slot:O,defaultTag:FT,name:"Tabs.Tab"})}let zT="div";function UT(e,t){let{selectedIndex:n}=Go("Tab.Panels"),r=Be(t),s=f.useMemo(()=>({selectedIndex:n}),[n]);return $e({ourProps:{ref:r},theirProps:e,slot:s,defaultTag:zT,name:"Tabs.Panels"})}let WT="div",GT=sn.RenderStrategy|sn.Static;function qT(e,t){var n,r,s,o;let a=gt(),{id:i=`headlessui-tabs-panel-${a}`,tabIndex:c=0,...u}=e,{selectedIndex:d,tabs:p,panels:h}=Go("Tab.Panel"),g=$d("Tab.Panel"),m=f.useRef(null),b=Be(m,t);Fe(()=>g.registerPanel(m),[g,m,i]);let v=T1("panels"),w=h.indexOf(m);w===-1&&(w=v);let y=w===d,S=f.useMemo(()=>({selected:y}),[y]),C={ref:b,id:i,role:"tabpanel","aria-labelledby":(r=(n=p[w])==null?void 0:n.current)==null?void 0:r.id,tabIndex:y?c:-1};return!y&&((s=u.unmount)==null||s)&&!((o=u.static)!=null&&o)?f.createElement(er,{as:"span","aria-hidden":"true",...C}):$e({ourProps:C,theirProps:u,slot:S,defaultTag:WT,features:GT,visible:y,name:"Tabs.Panel"})}let KT=ke(BT),ZT=ke(HT),YT=ke(DT),XT=ke(UT),JT=ke(qT),Ga=Object.assign(KT,{Group:ZT,List:YT,Panels:XT,Panel:JT});function QT(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function kd(e,...t){e&&t.length>0&&e.classList.add(...t)}function Id(e,...t){e&&t.length>0&&e.classList.remove(...t)}function RT(e,t){let n=hr();if(!e)return n.dispose;let{transitionDuration:r,transitionDelay:s}=getComputedStyle(e),[o,a]=[r,s].map(c=>{let[u=0]=c.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,p)=>p-d);return u}),i=o+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 c=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),c())})}else t();return n.add(()=>t()),n.dispose}function eO(e,t,n,r){let s=n?"enter":"leave",o=hr(),a=r!==void 0?QT(r):()=>{};s==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let i=Ae(s,{enter:()=>t.enter,leave:()=>t.leave}),c=Ae(s,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=Ae(s,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return Id(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),kd(e,...t.base,...i,...u),o.nextFrame(()=>{Id(e,...t.base,...i,...u),kd(e,...t.base,...i,...c),RT(e,()=>(Id(e,...t.base,...i),kd(e,...t.base,...t.entered),a()))}),o.dispose}function tO({immediate:e,container:t,direction:n,classes:r,onStart:s,onStop:o}){let a=_l(),i=Qn(),c=_t(n);Fe(()=>{e&&(c.current="enter")},[e]),Fe(()=>{let u=hr();i.add(u.dispose);let d=t.current;if(d&&c.current!=="idle"&&a.current)return u.dispose(),s.current(c.current),u.add(eO(d,r.current,c.current==="enter",()=>{u.dispose(),o.current(c.current)})),u.dispose},[n])}function ms(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Nl=f.createContext(null);Nl.displayName="TransitionContext";var nO=(e=>(e.Visible="visible",e.Hidden="hidden",e))(nO||{});function rO(){let e=f.useContext(Nl);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function sO(){let e=f.useContext($l);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let $l=f.createContext(null);$l.displayName="NestingContext";function kl(e){return"children"in e?kl(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function O1(e,t){let n=_t(e),r=f.useRef([]),s=_l(),o=Qn(),a=se((g,m=hs.Hidden)=>{let b=r.current.findIndex(({el:v})=>v===g);b!==-1&&(Ae(m,{[hs.Unmount](){r.current.splice(b,1)},[hs.Hidden](){r.current[b].state="hidden"}}),o.microTask(()=>{var v;!kl(r)&&s.current&&((v=n.current)==null||v.call(n))}))}),i=se(g=>{let m=r.current.find(({el:b})=>b===g);return m?m.state!=="visible"&&(m.state="visible"):r.current.push({el:g,state:"visible"}),()=>a(g,hs.Unmount)}),c=f.useRef([]),u=f.useRef(Promise.resolve()),d=f.useRef({enter:[],leave:[],idle:[]}),p=se((g,m,b)=>{c.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([v])=>v!==g)),t==null||t.chains.current[m].push([g,new Promise(v=>{c.current.push(v)})]),t==null||t.chains.current[m].push([g,new Promise(v=>{Promise.all(d.current[m].map(([w,y])=>y)).then(()=>v())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(m)):b(m)}),h=se((g,m,b)=>{Promise.all(d.current[m].splice(0).map(([v,w])=>w)).then(()=>{var v;(v=c.current.shift())==null||v()}).then(()=>b(m))});return f.useMemo(()=>({children:r,register:i,unregister:a,onStart:p,onStop:h,wait:u,chains:d}),[i,a,r,p,h,d,u])}function oO(){}let aO=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function A1(e){var t;let n={};for(let r of aO)n[r]=(t=e[r])!=null?t:oO;return n}function iO(e){let t=f.useRef(A1(e));return f.useEffect(()=>{t.current=A1(e)},[e]),t}let lO="div",_1=sn.RenderStrategy;function cO(e,t){var n,r;let{beforeEnter:s,afterEnter:o,beforeLeave:a,afterLeave:i,enter:c,enterFrom:u,enterTo:d,entered:p,leave:h,leaveFrom:g,leaveTo:m,...b}=e,v=f.useRef(null),w=Be(v,t),y=(n=b.unmount)==null||n?hs.Unmount:hs.Hidden,{show:S,appear:C,initial:x}=rO(),[E,P]=f.useState(S?"visible":"hidden"),O=sO(),{register:A,unregister:T}=O;f.useEffect(()=>A(v),[A,v]),f.useEffect(()=>{if(y===hs.Hidden&&v.current){if(S&&E!=="visible"){P("visible");return}return Ae(E,{hidden:()=>T(v),visible:()=>A(v)})}},[E,v,A,T,S,y]);let _=_t({base:ms(b.className),enter:ms(c),enterFrom:ms(u),enterTo:ms(d),entered:ms(p),leave:ms(h),leaveFrom:ms(g),leaveTo:ms(m)}),L=iO({beforeEnter:s,afterEnter:o,beforeLeave:a,afterLeave:i}),$=Cl();f.useEffect(()=>{if($&&E==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,E,$]);let D=x&&!C,N=C&&S&&x,B=!$||D?"idle":S?"enter":"leave",q=S1(0),F=se(Y=>Ae(Y,{enter:()=>{q.addFlag(rt.Opening),L.current.beforeEnter()},leave:()=>{q.addFlag(rt.Closing),L.current.beforeLeave()},idle:()=>{}})),k=se(Y=>Ae(Y,{enter:()=>{q.removeFlag(rt.Opening),L.current.afterEnter()},leave:()=>{q.removeFlag(rt.Closing),L.current.afterLeave()},idle:()=>{}})),H=O1(()=>{P("hidden"),T(v)},O),V=f.useRef(!1);tO({immediate:N,container:v,classes:_,direction:B,onStart:_t(Y=>{V.current=!0,H.onStart(v,Y,F)}),onStop:_t(Y=>{V.current=!1,H.onStop(v,Y,k),Y==="leave"&&!kl(H)&&(P("hidden"),T(v))})});let U=b,X={ref:w};return N?U={...U,className:Tl(b.className,..._.current.enter,..._.current.enterFrom)}:V.current&&(U.className=Tl(b.className,(r=v.current)==null?void 0:r.className),U.className===""&&delete U.className),f.createElement($l.Provider,{value:H},f.createElement(Fa,{value:Ae(E,{visible:rt.Open,hidden:rt.Closed})|q.flags},$e({ourProps:X,theirProps:U,defaultTag:lO,features:_1,visible:E==="visible",name:"Transition.Child"})))}function uO(e,t){let{show:n,appear:r=!1,unmount:s=!0,...o}=e,a=f.useRef(null),i=Be(a,t);Cl();let c=oo();if(n===void 0&&c!==null&&(n=(c&rt.Open)===rt.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=f.useState(n?"visible":"hidden"),p=O1(()=>{d("hidden")}),[h,g]=f.useState(!0),m=f.useRef([n]);Fe(()=>{h!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),g(!1))},[m,n]);let b=f.useMemo(()=>({show:n,appear:r,initial:h}),[n,r,h]);f.useEffect(()=>{if(n)d("visible");else if(!kl(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 v={unmount:s},w=se(()=>{var S;h&&g(!1),(S=e.beforeEnter)==null||S.call(e)}),y=se(()=>{var S;h&&g(!1),(S=e.beforeLeave)==null||S.call(e)});return f.createElement($l.Provider,{value:p},f.createElement(Nl.Provider,{value:b},$e({ourProps:{...v,as:f.Fragment,children:f.createElement(M1,{ref:i,...v,...o,beforeEnter:w,beforeLeave:y})},theirProps:{},defaultTag:f.Fragment,features:_1,visible:u==="visible",name:"Transition"})))}function dO(e,t){let n=f.useContext(Nl)!==null,r=oo()!==null;return f.createElement(f.Fragment,null,!n&&r?f.createElement(Vd,{ref:t,...e}):f.createElement(M1,{ref:t,...e}))}let Vd=ke(uO),M1=ke(cO),pO=ke(dO),Hd=Object.assign(Vd,{Child:pO,Root:Vd});var L1=function(t){return t.reduce(function(n,r){var s=r[0],o=r[1];return n[s]=o,n},{})},N1=typeof window<"u"&&window.document&&window.document.createElement?Ye.useLayoutEffect:Ye.useEffect,on="top",Ln="bottom",Nn="right",an="left",jd="auto",qa=[on,Ln,Nn,an],qo="start",Ka="end",fO="clippingParents",$1="viewport",Za="popper",hO="reference",k1=qa.reduce(function(e,t){return e.concat([t+"-"+qo,t+"-"+Ka])},[]),I1=[].concat(qa,[jd]).reduce(function(e,t){return e.concat([t,t+"-"+qo,t+"-"+Ka])},[]),gO="beforeRead",mO="read",bO="afterRead",vO="beforeMain",yO="main",wO="afterMain",SO="beforeWrite",CO="write",xO="afterWrite",EO=[gO,mO,bO,vO,yO,wO,SO,CO,xO];function mr(e){return e?(e.nodeName||"").toLowerCase():null}function vn(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function lo(e){var t=vn(e).Element;return e instanceof t||e instanceof Element}function $n(e){var t=vn(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Dd(e){if(typeof ShadowRoot>"u")return!1;var t=vn(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function PO(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var r=t.styles[n]||{},s=t.attributes[n]||{},o=t.elements[n];!$n(o)||!mr(o)||(Object.assign(o.style,r),Object.keys(s).forEach(function(a){var i=s[a];i===!1?o.removeAttribute(a):o.setAttribute(a,i===!0?"":i)}))})}function TO(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 s=t.elements[r],o=t.attributes[r]||{},a=Object.keys(t.styles.hasOwnProperty(r)?t.styles[r]:n[r]),i=a.reduce(function(c,u){return c[u]="",c},{});!$n(s)||!mr(s)||(Object.assign(s.style,i),Object.keys(o).forEach(function(c){s.removeAttribute(c)}))})}}const OO={name:"applyStyles",enabled:!0,phase:"write",fn:PO,effect:TO,requires:["computeStyles"]};function br(e){return e.split("-")[0]}var co=Math.max,Il=Math.min,Ko=Math.round;function Fd(){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 V1(){return!/^((?!chrome|android).)*safari/i.test(Fd())}function Zo(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var r=e.getBoundingClientRect(),s=1,o=1;t&&$n(e)&&(s=e.offsetWidth>0&&Ko(r.width)/e.offsetWidth||1,o=e.offsetHeight>0&&Ko(r.height)/e.offsetHeight||1);var a=lo(e)?vn(e):window,i=a.visualViewport,c=!V1()&&n,u=(r.left+(c&&i?i.offsetLeft:0))/s,d=(r.top+(c&&i?i.offsetTop:0))/o,p=r.width/s,h=r.height/o;return{width:p,height:h,top:d,right:u+p,bottom:d+h,left:u,x:u,y:d}}function Bd(e){var t=Zo(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 H1(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Dd(n)){var r=t;do{if(r&&e.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Kr(e){return vn(e).getComputedStyle(e)}function AO(e){return["table","td","th"].indexOf(mr(e))>=0}function bs(e){return((lo(e)?e.ownerDocument:e.document)||window.document).documentElement}function Vl(e){return mr(e)==="html"?e:e.assignedSlot||e.parentNode||(Dd(e)?e.host:null)||bs(e)}function j1(e){return!$n(e)||Kr(e).position==="fixed"?null:e.offsetParent}function _O(e){var t=/firefox/i.test(Fd()),n=/Trident/i.test(Fd());if(n&&$n(e)){var r=Kr(e);if(r.position==="fixed")return null}var s=Vl(e);for(Dd(s)&&(s=s.host);$n(s)&&["html","body"].indexOf(mr(s))<0;){var o=Kr(s);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return s;s=s.parentNode}return null}function Ya(e){for(var t=vn(e),n=j1(e);n&&AO(n)&&Kr(n).position==="static";)n=j1(n);return n&&(mr(n)==="html"||mr(n)==="body"&&Kr(n).position==="static")?t:n||_O(e)||t}function zd(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Xa(e,t,n){return co(e,Il(t,n))}function MO(e,t,n){var r=Xa(e,t,n);return r>n?n:r}function D1(){return{top:0,right:0,bottom:0,left:0}}function F1(e){return Object.assign({},D1(),e)}function B1(e,t){return t.reduce(function(n,r){return n[r]=e,n},{})}var LO=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,F1(typeof t!="number"?t:B1(t,qa))};function NO(e){var t,n=e.state,r=e.name,s=e.options,o=n.elements.arrow,a=n.modifiersData.popperOffsets,i=br(n.placement),c=zd(i),u=[an,Nn].indexOf(i)>=0,d=u?"height":"width";if(!(!o||!a)){var p=LO(s.padding,n),h=Bd(o),g=c==="y"?on:an,m=c==="y"?Ln:Nn,b=n.rects.reference[d]+n.rects.reference[c]-a[c]-n.rects.popper[d],v=a[c]-n.rects.reference[c],w=Ya(o),y=w?c==="y"?w.clientHeight||0:w.clientWidth||0:0,S=b/2-v/2,C=p[g],x=y-h[d]-p[m],E=y/2-h[d]/2+S,P=Xa(C,E,x),O=c;n.modifiersData[r]=(t={},t[O]=P,t.centerOffset=P-E,t)}}function $O(e){var t=e.state,n=e.options,r=n.element,s=r===void 0?"[data-popper-arrow]":r;s!=null&&(typeof s=="string"&&(s=t.elements.popper.querySelector(s),!s)||H1(t.elements.popper,s)&&(t.elements.arrow=s))}const kO={name:"arrow",enabled:!0,phase:"main",fn:NO,effect:$O,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Yo(e){return e.split("-")[1]}var IO={top:"auto",right:"auto",bottom:"auto",left:"auto"};function VO(e,t){var n=e.x,r=e.y,s=t.devicePixelRatio||1;return{x:Ko(n*s)/s||0,y:Ko(r*s)/s||0}}function z1(e){var t,n=e.popper,r=e.popperRect,s=e.placement,o=e.variation,a=e.offsets,i=e.position,c=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,p=e.isFixed,h=a.x,g=h===void 0?0:h,m=a.y,b=m===void 0?0:m,v=typeof d=="function"?d({x:g,y:b}):{x:g,y:b};g=v.x,b=v.y;var w=a.hasOwnProperty("x"),y=a.hasOwnProperty("y"),S=an,C=on,x=window;if(u){var E=Ya(n),P="clientHeight",O="clientWidth";if(E===vn(n)&&(E=bs(n),Kr(E).position!=="static"&&i==="absolute"&&(P="scrollHeight",O="scrollWidth")),E=E,s===on||(s===an||s===Nn)&&o===Ka){C=Ln;var A=p&&E===x&&x.visualViewport?x.visualViewport.height:E[P];b-=A-r.height,b*=c?1:-1}if(s===an||(s===on||s===Ln)&&o===Ka){S=Nn;var T=p&&E===x&&x.visualViewport?x.visualViewport.width:E[O];g-=T-r.width,g*=c?1:-1}}var _=Object.assign({position:i},u&&IO),L=d===!0?VO({x:g,y:b},vn(n)):{x:g,y:b};if(g=L.x,b=L.y,c){var $;return Object.assign({},_,($={},$[C]=y?"0":"",$[S]=w?"0":"",$.transform=(x.devicePixelRatio||1)<=1?"translate("+g+"px, "+b+"px)":"translate3d("+g+"px, "+b+"px, 0)",$))}return Object.assign({},_,(t={},t[C]=y?b+"px":"",t[S]=w?g+"px":"",t.transform="",t))}function HO(e){var t=e.state,n=e.options,r=n.gpuAcceleration,s=r===void 0?!0:r,o=n.adaptive,a=o===void 0?!0:o,i=n.roundOffsets,c=i===void 0?!0:i,u={placement:br(t.placement),variation:Yo(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:s,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,z1(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:a,roundOffsets:c})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,z1(Object.assign({},u,{offsets:t.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-placement":t.placement})}const jO={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:HO,data:{}};var Hl={passive:!0};function DO(e){var t=e.state,n=e.instance,r=e.options,s=r.scroll,o=s===void 0?!0:s,a=r.resize,i=a===void 0?!0:a,c=vn(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(d){d.addEventListener("scroll",n.update,Hl)}),i&&c.addEventListener("resize",n.update,Hl),function(){o&&u.forEach(function(d){d.removeEventListener("scroll",n.update,Hl)}),i&&c.removeEventListener("resize",n.update,Hl)}}const FO={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:DO,data:{}};var BO={left:"right",right:"left",bottom:"top",top:"bottom"};function jl(e){return e.replace(/left|right|bottom|top/g,function(t){return BO[t]})}var zO={start:"end",end:"start"};function U1(e){return e.replace(/start|end/g,function(t){return zO[t]})}function Ud(e){var t=vn(e),n=t.pageXOffset,r=t.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Wd(e){return Zo(bs(e)).left+Ud(e).scrollLeft}function UO(e,t){var n=vn(e),r=bs(e),s=n.visualViewport,o=r.clientWidth,a=r.clientHeight,i=0,c=0;if(s){o=s.width,a=s.height;var u=V1();(u||!u&&t==="fixed")&&(i=s.offsetLeft,c=s.offsetTop)}return{width:o,height:a,x:i+Wd(e),y:c}}function WO(e){var t,n=bs(e),r=Ud(e),s=(t=e.ownerDocument)==null?void 0:t.body,o=co(n.scrollWidth,n.clientWidth,s?s.scrollWidth:0,s?s.clientWidth:0),a=co(n.scrollHeight,n.clientHeight,s?s.scrollHeight:0,s?s.clientHeight:0),i=-r.scrollLeft+Wd(e),c=-r.scrollTop;return Kr(s||n).direction==="rtl"&&(i+=co(n.clientWidth,s?s.clientWidth:0)-o),{width:o,height:a,x:i,y:c}}function Gd(e){var t=Kr(e),n=t.overflow,r=t.overflowX,s=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+s+r)}function W1(e){return["html","body","#document"].indexOf(mr(e))>=0?e.ownerDocument.body:$n(e)&&Gd(e)?e:W1(Vl(e))}function Ja(e,t){var n;t===void 0&&(t=[]);var r=W1(e),s=r===((n=e.ownerDocument)==null?void 0:n.body),o=vn(r),a=s?[o].concat(o.visualViewport||[],Gd(r)?r:[]):r,i=t.concat(a);return s?i:i.concat(Ja(Vl(a)))}function qd(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function GO(e,t){var n=Zo(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 G1(e,t,n){return t===$1?qd(UO(e,n)):lo(t)?GO(t,n):qd(WO(bs(e)))}function qO(e){var t=Ja(Vl(e)),n=["absolute","fixed"].indexOf(Kr(e).position)>=0,r=n&&$n(e)?Ya(e):e;return lo(r)?t.filter(function(s){return lo(s)&&H1(s,r)&&mr(s)!=="body"}):[]}function KO(e,t,n,r){var s=t==="clippingParents"?qO(e):[].concat(t),o=[].concat(s,[n]),a=o[0],i=o.reduce(function(c,u){var d=G1(e,u,r);return c.top=co(d.top,c.top),c.right=Il(d.right,c.right),c.bottom=Il(d.bottom,c.bottom),c.left=co(d.left,c.left),c},G1(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 q1(e){var t=e.reference,n=e.element,r=e.placement,s=r?br(r):null,o=r?Yo(r):null,a=t.x+t.width/2-n.width/2,i=t.y+t.height/2-n.height/2,c;switch(s){case on:c={x:a,y:t.y-n.height};break;case Ln:c={x:a,y:t.y+t.height};break;case Nn:c={x:t.x+t.width,y:i};break;case an:c={x:t.x-n.width,y:i};break;default:c={x:t.x,y:t.y}}var u=s?zd(s):null;if(u!=null){var d=u==="y"?"height":"width";switch(o){case qo:c[u]=c[u]-(t[d]/2-n[d]/2);break;case Ka:c[u]=c[u]+(t[d]/2-n[d]/2);break}}return c}function Qa(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=r===void 0?e.placement:r,o=n.strategy,a=o===void 0?e.strategy:o,i=n.boundary,c=i===void 0?fO:i,u=n.rootBoundary,d=u===void 0?$1:u,p=n.elementContext,h=p===void 0?Za:p,g=n.altBoundary,m=g===void 0?!1:g,b=n.padding,v=b===void 0?0:b,w=F1(typeof v!="number"?v:B1(v,qa)),y=h===Za?hO:Za,S=e.rects.popper,C=e.elements[m?y:h],x=KO(lo(C)?C:C.contextElement||bs(e.elements.popper),c,d,a),E=Zo(e.elements.reference),P=q1({reference:E,element:S,strategy:"absolute",placement:s}),O=qd(Object.assign({},S,P)),A=h===Za?O:E,T={top:x.top-A.top+w.top,bottom:A.bottom-x.bottom+w.bottom,left:x.left-A.left+w.left,right:A.right-x.right+w.right},_=e.modifiersData.offset;if(h===Za&&_){var L=_[s];Object.keys(T).forEach(function($){var D=[Nn,Ln].indexOf($)>=0?1:-1,N=[on,Ln].indexOf($)>=0?"y":"x";T[$]+=L[N]*D})}return T}function ZO(e,t){t===void 0&&(t={});var n=t,r=n.placement,s=n.boundary,o=n.rootBoundary,a=n.padding,i=n.flipVariations,c=n.allowedAutoPlacements,u=c===void 0?I1:c,d=Yo(r),p=d?i?k1:k1.filter(function(m){return Yo(m)===d}):qa,h=p.filter(function(m){return u.indexOf(m)>=0});h.length===0&&(h=p);var g=h.reduce(function(m,b){return m[b]=Qa(e,{placement:b,boundary:s,rootBoundary:o,padding:a})[br(b)],m},{});return Object.keys(g).sort(function(m,b){return g[m]-g[b]})}function YO(e){if(br(e)===jd)return[];var t=jl(e);return[U1(e),t,U1(t)]}function XO(e){var t=e.state,n=e.options,r=e.name;if(!t.modifiersData[r]._skip){for(var s=n.mainAxis,o=s===void 0?!0:s,a=n.altAxis,i=a===void 0?!0:a,c=n.fallbackPlacements,u=n.padding,d=n.boundary,p=n.rootBoundary,h=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,b=n.allowedAutoPlacements,v=t.options.placement,w=br(v),y=w===v,S=c||(y||!m?[jl(v)]:YO(v)),C=[v].concat(S).reduce(function(Y,R){return Y.concat(br(R)===jd?ZO(t,{placement:R,boundary:d,rootBoundary:p,padding:u,flipVariations:m,allowedAutoPlacements:b}):R)},[]),x=t.rects.reference,E=t.rects.popper,P=new Map,O=!0,A=C[0],T=0;T<C.length;T++){var _=C[T],L=br(_),$=Yo(_)===qo,D=[on,Ln].indexOf(L)>=0,N=D?"width":"height",B=Qa(t,{placement:_,boundary:d,rootBoundary:p,altBoundary:h,padding:u}),q=D?$?Nn:an:$?Ln:on;x[N]>E[N]&&(q=jl(q));var F=jl(q),k=[];if(o&&k.push(B[L]<=0),i&&k.push(B[q]<=0,B[F]<=0),k.every(function(Y){return Y})){A=_,O=!1;break}P.set(_,k)}if(O)for(var H=m?3:1,V=function(R){var ee=C.find(function(te){var K=P.get(te);if(K)return K.slice(0,R).every(function(ne){return ne})});if(ee)return A=ee,"break"},U=H;U>0;U--){var X=V(U);if(X==="break")break}t.placement!==A&&(t.modifiersData[r]._skip=!0,t.placement=A,t.reset=!0)}}const JO={name:"flip",enabled:!0,phase:"main",fn:XO,requiresIfExists:["offset"],data:{_skip:!1}};function K1(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 Z1(e){return[on,Nn,Ln,an].some(function(t){return e[t]>=0})}function QO(e){var t=e.state,n=e.name,r=t.rects.reference,s=t.rects.popper,o=t.modifiersData.preventOverflow,a=Qa(t,{elementContext:"reference"}),i=Qa(t,{altBoundary:!0}),c=K1(a,r),u=K1(i,s,o),d=Z1(c),p=Z1(u);t.modifiersData[n]={referenceClippingOffsets:c,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:p},t.attributes.popper=Object.assign({},t.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":p})}const RO={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:QO};function e3(e,t,n){var r=br(e),s=[an,on].indexOf(r)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,a=o[0],i=o[1];return a=a||0,i=(i||0)*s,[an,Nn].indexOf(r)>=0?{x:i,y:a}:{x:a,y:i}}function t3(e){var t=e.state,n=e.options,r=e.name,s=n.offset,o=s===void 0?[0,0]:s,a=I1.reduce(function(d,p){return d[p]=e3(p,t.rects,o),d},{}),i=a[t.placement],c=i.x,u=i.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=c,t.modifiersData.popperOffsets.y+=u),t.modifiersData[r]=a}const n3={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:t3};function r3(e){var t=e.state,n=e.name;t.modifiersData[n]=q1({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const s3={name:"popperOffsets",enabled:!0,phase:"read",fn:r3,data:{}};function o3(e){return e==="x"?"y":"x"}function a3(e){var t=e.state,n=e.options,r=e.name,s=n.mainAxis,o=s===void 0?!0:s,a=n.altAxis,i=a===void 0?!1:a,c=n.boundary,u=n.rootBoundary,d=n.altBoundary,p=n.padding,h=n.tether,g=h===void 0?!0:h,m=n.tetherOffset,b=m===void 0?0:m,v=Qa(t,{boundary:c,rootBoundary:u,padding:p,altBoundary:d}),w=br(t.placement),y=Yo(t.placement),S=!y,C=zd(w),x=o3(C),E=t.modifiersData.popperOffsets,P=t.rects.reference,O=t.rects.popper,A=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,T=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),_=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(E){if(o){var $,D=C==="y"?on:an,N=C==="y"?Ln:Nn,B=C==="y"?"height":"width",q=E[C],F=q+v[D],k=q-v[N],H=g?-O[B]/2:0,V=y===qo?P[B]:O[B],U=y===qo?-O[B]:-P[B],X=t.elements.arrow,Y=g&&X?Bd(X):{width:0,height:0},R=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:D1(),ee=R[D],te=R[N],K=Xa(0,P[B],Y[B]),ne=S?P[B]/2-H-K-ee-T.mainAxis:V-K-ee-T.mainAxis,ce=S?-P[B]/2+H+K+te+T.mainAxis:U+K+te+T.mainAxis,ge=t.elements.arrow&&Ya(t.elements.arrow),De=ge?C==="y"?ge.clientTop||0:ge.clientLeft||0:0,ve=($=_==null?void 0:_[C])!=null?$:0,Ze=q+ne-ve-De,Ge=q+ce-ve,bt=Xa(g?Il(F,Ze):F,q,g?co(k,Ge):k);E[C]=bt,L[C]=bt-q}if(i){var tt,be=C==="x"?on:an,Je=C==="x"?Ln:Nn,Qe=E[x],dt=x==="y"?"height":"width",Te=Qe+v[be],it=Qe-v[Je],nt=[on,an].indexOf(w)!==-1,Ie=(tt=_==null?void 0:_[x])!=null?tt:0,Wt=nt?Te:Qe-P[dt]-O[dt]-Ie+T.altAxis,pe=nt?Qe+P[dt]+O[dt]-Ie-T.altAxis:it,Le=g&&nt?MO(Wt,Qe,pe):Xa(g?Wt:Te,Qe,g?pe:it);E[x]=Le,L[x]=Le-Qe}t.modifiersData[r]=L}}const i3={name:"preventOverflow",enabled:!0,phase:"main",fn:a3,requiresIfExists:["offset"]};function l3(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function c3(e){return e===vn(e)||!$n(e)?Ud(e):l3(e)}function u3(e){var t=e.getBoundingClientRect(),n=Ko(t.width)/e.offsetWidth||1,r=Ko(t.height)/e.offsetHeight||1;return n!==1||r!==1}function d3(e,t,n){n===void 0&&(n=!1);var r=$n(t),s=$n(t)&&u3(t),o=bs(t),a=Zo(e,s,n),i={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!n)&&((mr(t)!=="body"||Gd(o))&&(i=c3(t)),$n(t)?(c=Zo(t,!0),c.x+=t.clientLeft,c.y+=t.clientTop):o&&(c.x=Wd(o))),{x:a.left+i.scrollLeft-c.x,y:a.top+i.scrollTop-c.y,width:a.width,height:a.height}}function p3(e){var t=new Map,n=new Set,r=[];e.forEach(function(o){t.set(o.name,o)});function s(o){n.add(o.name);var a=[].concat(o.requires||[],o.requiresIfExists||[]);a.forEach(function(i){if(!n.has(i)){var c=t.get(i);c&&s(c)}}),r.push(o)}return e.forEach(function(o){n.has(o.name)||s(o)}),r}function f3(e){var t=p3(e);return EO.reduce(function(n,r){return n.concat(t.filter(function(s){return s.phase===r}))},[])}function h3(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function g3(e){var t=e.reduce(function(n,r){var s=n[r.name];return n[r.name]=s?Object.assign({},s,r,{options:Object.assign({},s.options,r.options),data:Object.assign({},s.data,r.data)}):r,n},{});return Object.keys(t).map(function(n){return t[n]})}var Y1={placement:"bottom",modifiers:[],strategy:"absolute"};function X1(){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 m3(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,r=n===void 0?[]:n,s=t.defaultOptions,o=s===void 0?Y1:s;return function(i,c,u){u===void 0&&(u=o);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Y1,o),modifiersData:{},elements:{reference:i,popper:c},attributes:{},styles:{}},p=[],h=!1,g={state:d,setOptions:function(w){var y=typeof w=="function"?w(d.options):w;b(),d.options=Object.assign({},o,d.options,y),d.scrollParents={reference:lo(i)?Ja(i):i.contextElement?Ja(i.contextElement):[],popper:Ja(c)};var S=f3(g3([].concat(r,d.options.modifiers)));return d.orderedModifiers=S.filter(function(C){return C.enabled}),m(),g.update()},forceUpdate:function(){if(!h){var w=d.elements,y=w.reference,S=w.popper;if(X1(y,S)){d.rects={reference:d3(y,Ya(S),d.options.strategy==="fixed"),popper:Bd(S)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(T){return d.modifiersData[T.name]=Object.assign({},T.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,P=x.options,O=P===void 0?{}:P,A=x.name;typeof E=="function"&&(d=E({state:d,options:O,name:A,instance:g})||d)}}}},update:h3(function(){return new Promise(function(v){g.forceUpdate(),v(d)})}),destroy:function(){b(),h=!0}};if(!X1(i,c))return g;g.setOptions(u).then(function(v){!h&&u.onFirstUpdate&&u.onFirstUpdate(v)});function m(){d.orderedModifiers.forEach(function(v){var w=v.name,y=v.options,S=y===void 0?{}:y,C=v.effect;if(typeof C=="function"){var x=C({state:d,name:w,instance:g,options:S}),E=function(){};p.push(x||E)}})}function b(){p.forEach(function(v){return v()}),p=[]}return g}}var b3=[FO,s3,jO,OO,n3,JO,i3,kO,RO],v3=m3({defaultModifiers:b3}),y3=typeof Element<"u",w3=typeof Map=="function",S3=typeof Set=="function",C3=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Dl(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,s;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(r=n;r--!==0;)if(!Dl(e[r],t[r]))return!1;return!0}var o;if(w3&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;for(o=e.entries();!(r=o.next()).done;)if(!Dl(r.value[1],t.get(r.value[0])))return!1;return!0}if(S3&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(r=o.next()).done;)if(!t.has(r.value[0]))return!1;return!0}if(C3&&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(s=Object.keys(e),n=s.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!Object.prototype.hasOwnProperty.call(t,s[r]))return!1;if(y3&&e instanceof Element)return!1;for(r=n;r--!==0;)if(!((s[r]==="_owner"||s[r]==="__v"||s[r]==="__o")&&e.$$typeof)&&!Dl(e[s[r]],t[s[r]]))return!1;return!0}return e!==e&&t!==t}var x3=function(t,n){try{return Dl(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 E3=hu(x3);var P3=[],Ra=function(t,n,r){r===void 0&&(r={});var s=Ye.useRef(null),o={onFirstUpdate:r.onFirstUpdate,placement:r.placement||"bottom",strategy:r.strategy||"absolute",modifiers:r.modifiers||P3},a=Ye.useState({styles:{popper:{position:o.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),i=a[0],c=a[1],u=Ye.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,b=Object.keys(m.elements);yw.flushSync(function(){c({styles:L1(b.map(function(v){return[v,m.styles[v]||{}]})),attributes:L1(b.map(function(v){return[v,m.attributes[v]]}))})})},requires:["computeStyles"]}},[]),d=Ye.useMemo(function(){var h={onFirstUpdate:o.onFirstUpdate,placement:o.placement,strategy:o.strategy,modifiers:[].concat(o.modifiers,[u,{name:"applyStyles",enabled:!1}])};return E3(s.current,h)?s.current||h:(s.current=h,h)},[o.onFirstUpdate,o.placement,o.strategy,o.modifiers,u]),p=Ye.useRef();return N1(function(){p.current&&p.current.setOptions(d)},[d]),N1(function(){if(!(t==null||n==null)){var h=r.createPopper||v3,g=h(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 kn=f.forwardRef(function({children:t,title:n,onClose:r,icon:s,skipOverflow:o,shadow:a=!0,padding:i=!0,border:c=!0,round:u=!0,className:d,classNameBody:p,size:h="m",titleClass:g=Z("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:b,...v},w){const y=Ir(s)?s:{};return l.jsxs("div",{...v,ref:w,style:m,className:Z(["gs-utl-card",d,b||Zu.bg,J.b,u&&J.rnd,c?z.br:J.bT,!o&&"gs-utl-overflow-auto",a&&"gs-utl-shadow-md",i&&h==="l"&&"gs-utl-p-5",i&&h==="m"&&"gs-utl-px-4 gs-utl-py-2",i&&h==="s"&&"gs-utl-px-2 gs-utl-py-1",i&&h==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",i&&h==="x2s"&&"gs-utl-px-0.5"]),children:[(n||r)&&n!==!1&&l.jsxs(I,{className:Z("gs-utl-card-title",g),items:"center",children:[l.jsx(j,{className:Z("truncate"),grow:!0,children:n}),(r||s)&&l.jsx(j,{onClick:r,className:Z("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:l.jsx(Q,{icon:(et(s)?s:"")||W.close,size:"18px",...y})})]}),l.jsx("div",{className:Z("gs-utl-card-body",p),children:t})]})});var Fl,T3=new Uint8Array(16);function O3(){if(!Fl&&(Fl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Fl))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Fl(T3)}const A3=/^(?:[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 _3(e){return typeof e=="string"&&A3.test(e)}for(var Ht=[],Kd=0;Kd<256;++Kd)Ht.push((Kd+256).toString(16).substr(1));function M3(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Ht[e[t+0]]+Ht[e[t+1]]+Ht[e[t+2]]+Ht[e[t+3]]+"-"+Ht[e[t+4]]+Ht[e[t+5]]+"-"+Ht[e[t+6]]+Ht[e[t+7]]+"-"+Ht[e[t+8]]+Ht[e[t+9]]+"-"+Ht[e[t+10]]+Ht[e[t+11]]+Ht[e[t+12]]+Ht[e[t+13]]+Ht[e[t+14]]+Ht[e[t+15]]).toLowerCase();if(!_3(n))throw TypeError("Stringified UUID is invalid");return n}function J1(e,t,n){e=e||{};var r=e.random||(e.rng||O3)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,M3(r)}class L3 extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const ei=async(e,{onError:t,onLoading:n,onResult:r,params:s,rawText:o,...a})=>{try{n==null||n(!0);const i=s?new URLSearchParams(s).toString():"",c=i?`?${i}`:"",u=await fetch(`${e}${c}`,a);if(!u.ok){const p=await u.json();throw new L3(p.error||"Request failed!",p.errorData)}let d;if(o)d=await u.text();else try{d=await u.json()}catch{d=void 0}return r==null||r(d),d}catch(i){const c=i instanceof Error?i:new Error(i);if(t==null||t(c),a.throwError)throw c;return c}finally{n==null||n(!1)}};class vr{static async get(t,n){return ei(t,{...n,method:"GET"})}static async post(t,n){return ei(t,{...n,method:"POST"})}static async put(t,n){return ei(t,{...n,method:"PUT"})}static async patch(t,n){return ei(t,{...n,method:"PATCH"})}static async delete(t,n){return ei(t,{...n,method:"DELETE"})}}var Bl=(e=>(e.Projects="projects",e.Settings="settings",e))(Bl||{}),Q1=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(Q1||{});const R1={},N3=1,$3=(e={})=>new Promise((t,n)=>{const r=(e==null?void 0:e.db)||"gjs",s=r==="gjs-studio"?N3:1,o=R1[r];if(o)t(o);else{if(!lr())return n(new Error("window context not found"));const a=window.indexedDB.open(r,s);a.onerror=n,a.onsuccess=()=>{const i=a.result;i.onerror=n,R1[r]=i,t(i)},a.onupgradeneeded=()=>{const i=a.result;i.objectStoreNames.contains("projects")||i.createObjectStore("projects"),i.objectStoreNames.contains("settings")||i.createObjectStore("settings")}}}),Zd=async(e,t)=>(await $3(t)).transaction([e],"readwrite").objectStore(e),k3=async(e,t)=>{const n=await Zd(e,t);return new Promise((r,s)=>{const o=[],a=n.openCursor();a.onerror=s,a.onsuccess=function(i){const u=i.target.result;if(u){const d=u.primaryKey,p=u.value;o.push({key:d,data:p}),u.continue()}else r(o)}})},I3=async(e,t,n)=>{const r=await Zd(e,n);return new Promise((s,o)=>{const a=r.get(t);a.onerror=o,a.onsuccess=()=>s(a.result)})},V3=async(e,t,n)=>{const r=await Zd(e,n);return new Promise((s,o)=>{const a=r.delete(t);a.onerror=o,a.onsuccess=()=>s()})};var ti=(e=>(e.Existing="existing",e.Templates="templates",e))(ti||{});const H3=e=>{const t=xA();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},j3=(e,t)=>vr.get(H3(e),{...t}),D3=async e=>{try{const t=await j3(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},em=async(e=ht.web)=>typeof window>"u"?[]:(await k3(Bl.Projects)).map(({key:r,data:s})=>{var o;return{id:`${r}`,name:`${((o=s.custom)==null?void 0:o.projectName)||r}`,data:s}}).filter(r=>{var s;return((s=r.data.custom)==null?void 0:s.projectType)===e}),tm=new Set,yn=new WeakMap,Xo=new WeakMap,uo=new WeakMap,Yd=new WeakMap,F3=new WeakMap,Jo=new WeakMap,zl=new WeakMap;let vs;const po="__aa_tgt",Xd="__aa_del",B3=e=>{const t=q3(e);t&&t.forEach(n=>K3(n))},z3=e=>{e.forEach(t=>{t.target===vs&&W3(),yn.has(t.target)&&fo(t.target)})};function U3(e){const t=Yd.get(e);t==null||t.disconnect();let n=yn.get(e),r=0;const s=5;n||(n=Ro(e),yn.set(e,n));const{offsetWidth:o,offsetHeight:a}=vs,c=[n.top-s,o-(n.left+s+n.width),a-(n.top+s+n.height),n.left-s].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++r>1&&fo(e)},{root:vs,threshold:1,rootMargin:c});u.observe(e),Yd.set(e,u)}function fo(e){clearTimeout(zl.get(e));const t=Ul(e),n=typeof t=="function"?500:t.duration;zl.set(e,setTimeout(()=>{const r=uo.get(e);(!r||r.finished)&&(yn.set(e,Ro(e)),U3(e))},n))}function W3(){clearTimeout(zl.get(vs)),zl.set(vs,setTimeout(()=>{tm.forEach(e=>sm(e,t=>nm(()=>fo(t))))},100))}function G3(e){setTimeout(()=>{F3.set(e,setInterval(()=>nm(fo.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function nm(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Jd,Qo;typeof window<"u"&&(vs=document.documentElement,Jd=new MutationObserver(B3),Qo=new ResizeObserver(z3),Qo.observe(vs));function q3(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Qd(n.target),!t.has(n.target)){t.add(n.target);for(let r=0;r<n.target.children.length;r++){const s=n.target.children.item(r);if(s){if(Xd in s)return!1;Qd(n.target,s),t.add(s)}}}if(n.removedNodes.length)for(let r=0;r<n.removedNodes.length;r++){const s=n.removedNodes[r];if(Xd in s)return!1;s instanceof Element&&(t.add(s),Qd(n.target,s),Xo.set(s,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Qd(e,t){!t&&!(po in e)?Object.defineProperty(e,po,{value:e}):t&&!(po in t)&&Object.defineProperty(t,po,{value:e})}function K3(e){var t;const n=vs.contains(e),r=yn.has(e);n&&Xo.has(e)&&Xo.delete(e),uo.has(e)&&((t=uo.get(e))===null||t===void 0||t.cancel()),r&&n?Z3(e):r&&!n?X3(e):Y3(e)}function yr(e){return Number(e.replace(/[^0-9.\-]/g,""))}function Ro(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function rm(e,t,n){let r=t.width,s=t.height,o=n.width,a=n.height;const i=getComputedStyle(e);if(i.getPropertyValue("box-sizing")==="content-box"){const u=yr(i.paddingTop)+yr(i.paddingBottom)+yr(i.borderTopWidth)+yr(i.borderBottomWidth),d=yr(i.paddingLeft)+yr(i.paddingRight)+yr(i.borderRightWidth)+yr(i.borderLeftWidth);r-=d,o-=d,s-=u,a-=u}return[r,o,s,a].map(Math.round)}function Ul(e){return po in e&&Jo.has(e[po])?Jo.get(e[po]):{duration:250,easing:"ease-in-out"}}function sm(e,...t){t.forEach(n=>n(e,Jo.has(e)));for(let n=0;n<e.children.length;n++){const r=e.children.item(n);r&&t.forEach(s=>s(r,Jo.has(r)))}}function Z3(e){const t=yn.get(e),n=Ro(e);let r;if(!t)return;const s=Ul(e);if(typeof s!="function"){const o=t.left-n.left,a=t.top-n.top,[i,c,u,d]=rm(e,t,n),p={transform:`translate(${o}px, ${a}px)`},h={transform:"translate(0, 0)"};i!==c&&(p.width=`${i}px`,h.width=`${c}px`),u!==d&&(p.height=`${u}px`,h.height=`${d}px`),r=e.animate([p,h],s)}else r=new Animation(s(e,"remain",t,n)),r.play();uo.set(e,r),yn.set(e,n),r.addEventListener("finish",fo.bind(null,e))}function Y3(e){const t=Ro(e);yn.set(e,t);const n=Ul(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()),uo.set(e,r),r.addEventListener("finish",fo.bind(null,e))}function X3(e){if(!Xo.has(e)||!yn.has(e))return;const[t,n]=Xo.get(e);Object.defineProperty(e,Xd,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[r,s,o,a]=J3(e),i=Ul(e),c=yn.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${r}px`,left:`${s}px`,width:`${o}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",c)),u.play()),uo.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),yn.delete(e),Xo.delete(e),uo.delete(e),(d=Yd.get(e))===null||d===void 0||d.disconnect()})}function J3(e){const t=yn.get(e),[n,,r]=rm(e,t,Ro(e));let s=e.parentElement;for(;s&&(getComputedStyle(s).position==="static"||s instanceof HTMLBodyElement);)s=s.parentElement;s||(s=document.body);const o=getComputedStyle(s),a=yn.get(s)||Ro(s),i=Math.round(t.top-a.top)-yr(o.borderTopWidth),c=Math.round(t.left-a.left)-yr(o.borderLeftWidth);return[i,c,n,r]}function Q3(e,t={}){Jd&&Qo&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),sm(e,fo,G3,n=>Qo==null?void 0:Qo.observe(n)),typeof t=="function"?Jo.set(e,t):Jo.set(e,{duration:250,easing:"ease-in-out",...t}),Jd.observe(e,{childList:!0}),tm.add(e))}function R3(e){const t=f.useRef(null);return f.useEffect(()=>{t.current instanceof HTMLElement&&Q3(t.current,e)},[t]),t}const eA={[Zt.Info]:z.bgA,[Zt.Error]:"bg-red-500",[Zt.Success]:"bg-green-500",[Zt.Warning]:"bg-orange-400"},tA=f.forwardRef(function(t,n){const r={[Zt.Info]:W.informationVariant,[Zt.Error]:W.fire,[Zt.Success]:W.checkBold,[Zt.Warning]:W.alertRhombus},{children:s,className:o,content:a,id:i,buttons:c=[],variant:u=Zt.Info,autoHideTimeout:d=3e3}=t,p=f.useRef(null),h=f.useRef(),g=r[u],m=eA[u];f.useImperativeHandle(n,()=>p.current,[]);const b=()=>{var S;return(S=t.onDismiss)==null?void 0:S.call(t,i)},v=()=>{d&&(h.current=setTimeout(b,d))},w=()=>h.current&&clearTimeout(h.current);f.useEffect(()=>(v(),w),[]);const y=a||s;return l.jsx(kn,{className:ae(o,"overflow-hidden relative"),ref:p,onPointerEnter:w,onPointerLeave:v,children:l.jsxs(I,{space:"m",items:"center",className:ae(Se.y),children:[l.jsx(j,{className:ae(m,J.pill,"text-white gjs-p-1"),children:l.jsx(Q,{icon:g,size:oe.s})}),l.jsx(j,{grow:!0,className:ae("gjs-pr-3"),children:l.jsxs(I,{col:!0,space:"xs",children:[l.jsx(j,{className:ae("text-lg font-medium leading-6"),children:t.header}),y&&l.jsx(j,{className:ae(z.txtLowEmphasis),children:y}),!!c.length&&l.jsx(I,{space:"m",justify:"end",children:c.map(({id:S,...C})=>l.jsx(Ue,{...C},S))})]})}),l.jsx(j,{className:ae("absolute top-1 right-1"),children:l.jsx(ft,{onClick:b,border:!1,children:l.jsx(Q,{icon:W.close,size:oe.s})})})]})})});ie(f.forwardRef(function({className:t,toasts:n,onDismiss:r,...s},o){const a=R3({});return l.jsx("div",{className:ae(t,"w-80 gs-utl-z-30"),...s,ref:a,children:n.map(i=>l.jsx(tA,{...i,className:ae("gjs-mb-2"),onDismiss:r},i.uuid||i.id))})}));var Rd=(e=>(e.self="self",e.cloud="cloud",e))(Rd||{}),ho=(e=>(e.image="image",e.video="video",e))(ho||{}),tr=(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))(tr||{}),ep=(e=>(e.canvas="canvas",e.layers="layers",e))(ep||{}),ys=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(ys||{}),Lt=(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))(Lt||{}),tp=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(tp||{});const ni=e=>e.replaceAll('"',"").replaceAll("'",""),go=e=>e.includes(",")?e:/\s/.test(e)?`'${ni(e)}'`:ni(e),om=(e,t,n)=>({family:e,variant:t,...n}),ri=(e,t)=>{e=go(e);const{menuVariant:n,variants:r}=t;return{family:e,familyLabel:ni(e),menuVariant:n&&om(go(`menuFont-${ni(e)}`),"regular",n),variants:Object.assign({},...Object.entries(r).map(([s,o])=>({[s]:om(e,s,o)})))}},np=(e,t)=>{var i;const n=ri(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:s,descriptors:o}=r,a=ni(r.family);if(!t){const c=new FontFace(a,`url("${s}")`,o),u=Array.from(document.fonts.values()).filter(d=>d.family===a);for(const d of u)document.fonts.delete(d);document.fonts.add(c),c.load().catch(()=>{})}return go(a)},wr=", sans-serif",am=["Arial, Helvetica"+wr,"Arial Black, Gadget"+wr,"Brush Script MT"+wr,"Comic Sans MS, cursive"+wr,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+wr,"Impact, Charcoal"+wr,"Lucida Sans Unicode, Lucida Grande"+wr,"Tahoma, Geneva"+wr,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+wr,"Verdana, Geneva"+wr].map(e=>({id:e,label:e.split(",")[0]})),nA=String.raw,Zr=(e,t)=>{if(!t)return"";const n=e[0],r=e[1];return`${n}${t}${r}`},rA=({family:e,source:t,descriptors:n})=>{const{display:r,ascentOverride:s,descentOverride:o,featureSettings:a,lineGapOverride:i,stretch:c,style:u,unicodeRange:d,weight:p}=n??{},h=[Zr`font-ascent-override: ${s};`,Zr`font-display: ${r};`,Zr`font-descent-override: ${o};`,Zr`font-feature-settings: ${a};`,Zr`font-line-gap-override: ${i};`,Zr`font-stretch: ${c};`,Zr`font-style: ${u};`,Zr`font-unicode-range: ${d};`,Zr`font-weight: ${p};`].filter(Boolean);return nA`
|
|
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`
|
|
36
25
|
@font-face {
|
|
37
26
|
font-family: ${e};
|
|
38
27
|
src: url('${t}');
|
|
39
|
-
${
|
|
28
|
+
${p.join(`
|
|
40
29
|
`)}
|
|
41
30
|
}
|
|
42
|
-
`},
|
|
43
|
-
`;return n.trim()},
|
|
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}>
|
|
44
33
|
${t}
|
|
45
|
-
</style>`:""},
|
|
46
|
-
`);a.innerHTML=u,
|
|
47
|
-
`))}if(n.customCodeBody=wm(e,n.customCodeBody).html,t.replaceDataSources&&Kl(e)){const{currentItem:a}=((o=r.getCollectionsState)==null?void 0:o.call(r))||{};a&&Object.keys(n).forEach(i=>{const c=i,u=n[c];et(u)&&(n[c]=Sm(u,a))})}return n},Sm=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,r)=>{const s=t[r.trim()];return s!==void 0?String(s):""}),Cm=(e,t={})=>{const{currentItem:n}=t,r=t.ext??"html",s=Qt({page:e,key:"slug"})??"",o=n?Sm(s,n):s,a=o.lastIndexOf("/"),i=a>=0,c=i?o.substring(a+1):o,u=i?o.substring(0,a):void 0,d=`${Yi(c)}${r?`.${r}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},gA=(e,t)=>e.get(`${ql}${t}`)||"",mA=(e,t,n)=>{e.set({[`${ql}${t}`]:n})},bA=(e,t)=>{Object.entries(t).forEach(([n,r])=>{e[`${dA}${n}`]=r})},vA=(e,t)=>{e.getModel().set("customData",{...na(e),...t})},na=e=>e.getModel().get("customData")??{},op=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},Qt=e=>{const{page:t,key:n,appEditorStore:r,def:s,defPage:o,opts:a}=e;return t?hA(t,a)[n]??o:op(r)[n]??s},Ss=(e,t,n)=>{const r=e.em.getEditor(),o=na(r).globalPageSettings||{};return Qt({page:e,key:t,opts:n})||o[t]},xm=(e,t)=>{const n=(e==null?void 0:e.getName())??"",r={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:Qt({...r,key:"slug",defPage:Yi(n)}),title:Qt({...r,key:"title",defPage:n}),description:Qt({...r,key:"description"}),favicon:Qt({...r,key:"favicon"}),keywords:Qt({...r,key:"keywords"}),socialTitle:Qt({...r,key:"socialTitle",defPage:n}),socialImage:Qt({...r,key:"socialImage"}),socialDescription:Qt({...r,key:"socialDescription"}),customCodeHead:Qt({...r,key:"customCodeHead"}),customCodeBody:Qt({...r,key:"customCodeBody"})}},Yl=({icon:e,layout:t,tooltip:n,className:r,forceRemove:s,removeLayouts:o})=>({type:"button",icon:e,tooltip:n,className:r,size:"s",editorEvents:{[`${hn.layoutToggleId}${t.id}`]:({fromEvent:a,setState:i})=>{i({active:a.isOpen})}},onClick:({editor:a})=>{o==null||o.forEach(i=>a.runCommand(re.layoutRemove,{id:i,force:s})),a.runCommand(re.layoutToggle,{...t})}}),Em={type:"static",layoutId:"leftPanelsContainer"},Pm={width:240,overflow:"hidden"};Yl({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:Pm,placer:Em}}),Yl({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:Pm,placer:Em}}),Yl({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Yl({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:()=>l.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const yA={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var wA={NODE_ENV:"production"};class SA{constructor(t,n){var o,a;this.projectType=ht.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=wA.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 c=i,u=n[c];u!==void 0&&(this[c]=u)});const r=lr()?window.location.search:"";this.queryParams=Hw(r),Xt(this,{sdkProps:!1},{autoBind:!0});const s=(a=(o=this.sdkProps.options)==null?void 0:o.customTheme)==null?void 0:a.icons;s&&E5(s)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return du({isDev:t,isStage:n})}get projectId(){var r,s;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((s=(r=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:r.custom)==null?void 0:s.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:s}=r.layoutStore,o=(s==null?void 0:s.responsive)||(t==null?void 0:t.responsive);let a=(s==null?void 0:s.default)||(t==null?void 0:t.default)||yA;if(n&&o){const c=Object.keys(o).map(Number).sort((u,d)=>u-d).find(u=>n<=u);a=c?o[c]:a}return a}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===ht.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)===tp.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===tp.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,h;const{store:t,sdkOptions:n}=this,{lastProjectId:r,lastProjectType:s}=t.localSettingsStore,o=(p=n.project)==null?void 0:p.default,{project:a}=n.storage||{};let i,c;s&&(this.store.templatesStore._projectTypeFilter=s),r&&(i=(h=(yield em(s)).find(m=>m.id===r))==null?void 0:h.data),i?c=i:a?c=a:o&&(c=o);const u=(c==null?void 0:c.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:s,isTemplate:o}=t,a=n.Storage.getConfig().options.local,i=o?`${r}__${jw()}`:r;this._projectId=i,a.key=i,Vw(s)||this.loadProjectData({...s,custom:{...s.custom,id:i,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||ht.web,this.editor&&vA(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(CA(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:s}=this;t==null||t.trigger(ah,{baseApiUrl:r});const o=yield vr.post(`${r}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:s}});if(o instanceof Error)throw o;const a=o.result||{},{license:i,error:c,plan:u}=a;c?this.sdkLicenseError=c:(this.sdkLicense=i,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(uu,a)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(uu,{}))}}*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 CA=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||ht.web},me=()=>pn().appEditorStore,Tm=()=>Jf().appEditorStore,xA=()=>{try{return Jf().appEditorStore}catch{}},ap=()=>{const[e,t]=f.useState(0),n=pn().appEditorStore,{transitionTime:r}=n;return f.useEffect(()=>{setTimeout(()=>t(s=>++s),r)},[r]),[e]},ip=()=>{const{baseApiUrl:e}=Tm();return`${e}/assets/sdk`},EA=e=>`${ip()}/${e}`,PA=async(e,t,n)=>{const r=await vr.get(ip(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((r==null?void 0:r.result)??[]).map(({asset:s,cdnUrl:o})=>({...s,size:parseInt(s.size),src:o}))},TA=async(e,t,n,r)=>{const s=await vr.post(ip(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return s==null?void 0:s.result},OA=async(e,t)=>await vr.put(t,{body:e,rawText:!0}),AA=async(e,t,n,r)=>Promise.all(e.map(s=>TA({name:s.name,size:s.size,type:s.type},t,n,r).then(async o=>{if(!o)throw new Error("No asset");const{asset:a,cdnUrl:i,uploadUrl:c}=o,u=await OA(s,c);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...a,size:parseInt(a.size),src:i,type:ho.image}}))),_A=async(e,t,n,r)=>{const s=await vr.delete(EA(e),{body:JSON.stringify({projectId:n,identityId:r}),params:{d:window.location.hostname,licenseKey:t}});return s==null?void 0:s.result},Om=async(e,t,n,r)=>Promise.all(e.map(s=>_A(s.id||s.src,t,n,r)));function Cs(e,t,n){let r,s,o,a,i;const c=t===void 0?100:t;function u(){const p=Date.now()-a;p<c&&p>=0?r=setTimeout(u,c-p):(r=null,i=e.apply(o,s),o=s=null)}const d=function(){return o=this,s=arguments,a=Date.now(),r||(r=setTimeout(u,c)),i};return d.clear=function(){r&&(clearTimeout(r),r=null)},d.flush=function(){r&&(i=e.apply(o,s),o=s=null,clearTimeout(r),r=null)},d}class Am{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,Xt(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Cs(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(ho.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,c,u,d;const{assetsStore:n}=this,{editor:r}=n;if(!r||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const s=((i=this.customPages)==null?void 0:i.length)??0,o=(u=(c=this.customPages)==null?void 0:c.at(-1))==null?void 0:u.nextPageCustomData,a=await this.provider.onLoad({editor:r,assetTypeFilter:this.typeFilter,pageIndex:s,searchValue:this.searchValue,pageCustomData:o})??[];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(s){console.error(s),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:s}=n.store,{editor:o}=s;if(!(!o||!r))try{n.setIsLoadingAssets(!0),await r({assets:[n.toAsset(t)],assetProps:[t],editor:o,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 _m=e=>pn().assetsStore.assetPanelStores[e];class MA{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${J1()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new Am(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),Xt(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Rd.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Rd.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,s=n.options.licenseKey,o=t.sdkProjectId,a=t.sdkIdentityId,i=({files:c})=>AA(c,s,o,a);return this.isUsingAssetCloud?i:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:r}=this;return n?t?async s=>{await t(s),this.deleteFromProjectAssets(s)}:void 0:r?async s=>{var c,u;const{sdkOptions:o}=this.store.appEditorStore,a=(c=o.project)==null?void 0:c.id,i=(u=o.identity)==null?void 0:u.id;await Om(s.assetProps,o.licenseKey,a,i),this.deleteFromProjectAssets(s)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var i,c;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,r=(i=n.project)==null?void 0:i.id,s=(c=n.identity)==null?void 0:c.id,o=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:ho.image,onLoad:()=>PA(o,r,s),onDelete:async u=>{const{assetProps:d,loadAssets:p}=u;await Om(d,o,r,s),this.deleteFromProjectAssets(u),await p({clearExisting:!1})}}}onEditor(){const t=Cs(()=>!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=Ke(t)?t({providers:ls(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const r=[...this.allProviders];let s=this.allProviders.findIndex(a=>a.id===t.id);const o=s!==-1;r.splice(n,0,t),o&&(s>=n&&(s+=1),r.splice(s,1)),this.setAllProviders(r)}hasType(t){return!!this.allProviders.find(n=>et(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new Am(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:r,customOnLoad:s}=this,{toastStore:o}=this.store;let a;if(t){try{if(this.setIsLoadingAssets(!0),n&&s)if(r)a=r;else{const i=await s({editor:t});this.cachedOnLoadAssetProps=i.map(this.toAssetProps),a=this.cachedOnLoadAssetProps}else a=t.Assets.getAll().map(this.toAssetProps)}catch(i){console.error(i),o.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:s,customOnLoad:o}=this;if(o){if(s){const a=r.map(i=>i.id);this.cachedOnLoadAssetProps=s.filter(({id:i})=>!a.includes(i)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(a=>n.Assets.remove(a)),gm(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:r,customOnLoad:s}=this;s?r&&(this.cachedOnLoadAssetProps=[...t,...r],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),gm(n))}async handleUpload(t){var o,a;const{editor:n,onCloudOrCustomUpload:r}=this,{toastStore:s}=this.store;if(!(!n||!r))try{this.setIsLoadingAssets(!0);const i=((o=t.dataTransfer)==null?void 0:o.files)||((a=t.target)==null?void 0:a.files)||[],c=Array.from(i),u=await r({files:c,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),s.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()??ho.image,asset:r}}return{...t,type:t.type||ho.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 ii=()=>pn().assetsStore;class LA{constructor(t){var r;this.store=t,this.fonts={},Xt(this,{},{autoBind:!0});const n=(r=this.sdkFontOptions)==null?void 0:r.default;this.sdkDefaultFonts=Ke(n)?n({baseDefault:am}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>et(t)?{id:t,label:t}:dm(t)?t:null).filter(t=>!!t):am}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!et(n)&&!dm(n)).map(n=>ri(n.family,n)):[]}get sortedFonts(){return oA(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return aA([...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 Ot(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Ot(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=na(t)??{},{fonts:r}=n??{};if(r)for(const[s,o]of Object.entries(r)){const a=ri(s,o);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=go(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:r=!0}={}){const s=ri(t.family,t),{editor:o}=this.store.appEditorStore;if(!o)return;const{family:a}=s;!r&&this.fonts[a]||(this.fonts[a]=s,n||this.updateProjectFonts(o))}removeFont(t){t=go(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const r={...na(t).globalPageSettings,fonts:ls(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:r}),vm(t),t.trigger(hn.pageSettingsUpdate,{data:r})}}const li=()=>pn().fontsStore;class NA{constructor(t){this.store=t,Xt(this,{},{autoBind:!0})}t(t,n={}){var s;const{editor:r}=this.store.appEditorStore;return((s=r==null?void 0:r.I18n)==null?void 0:s.t(t,n))||""}tScoped(t){return(n,r)=>this.t(`${t}.${n}`,r)}}const _e=()=>pn().i18nStore,In=(e,t)=>f.Children.map(e,n=>n&&n.type===t?n:null),Mm="gs-custom-layout",$A=f.forwardRef(function({className:t,component:n,noWrapper:r,id:s,render:o,componentProps:a,...i},c){const{editor:u}=me(),d=f.useRef(null),p=n,h=p&&u?l.jsx(p,{...a,editor:u}):null,g=M(Mm,s&&`${Mm}__${s}`,t),m=r&&!o;return f.useImperativeHandle(c,()=>d.current,[]),f.useEffect(()=>{const b=d.current;if(!o||!b)return;const v=S=>b.appendChild(S),w=S=>b.removeChild(S),y=o({editor:u,addEl:v,removeEl:w});if(et(y))b.innerHTML=y;else{if(y instanceof HTMLElement)return v(y),()=>{w(y)};if(Ke(y))return()=>{y()}}},[o,u,d.current]),m?h:l.jsx("div",{className:g,ref:d,...i,children:h})}),lp=ie($A);class kA{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,Xt(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(`${hn.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var s;const r=n==null?void 0:n.layout;r&&this.layouts.forEach(o=>{o.id===t&&Object.assign(o,r)}),this.layouts=n!=null&&n.force?this.layouts.filter(o=>o.id!==t):this.layouts.map(o=>o.id===t?{...o,toRemove:!0}:o),(s=this.editor)==null||s.trigger(`${hn.layoutToggleId}${t}`,{isOpen:!1})}get(t){return this.layouts.find(n=>n.id===t)}clear(){this.layouts=[]}addCustomLayoutComponent(t,n){this.customLayoutComponents.set(t,n)}getCustomLayoutComponent(t){return this.customLayoutComponents.get(t)}removeCustomLayoutComponent(t){this.customLayoutComponents.delete(t)}get layoutChildren(){var r;const{children:t}=this.store.appEditorStore.sdkProps,n=((r=In(t,lp))==null?void 0:r.filter(Boolean))||[];return new Map(n.map(({props:s})=>[s.id,s]))}}const Lm=()=>pn().layoutStore,IA=()=>Jf().layoutStore;class VA{constructor(t){this.isActive=!1,this.content="",this.store=t,Xt(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class HA{constructor(t){this.store=t,this._projectSourceFilter=ti.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,Xt(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===ti.Existing?this.projects:this.templates}async loadProjects(){const t=await em(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var s;const t=(s=this.store.appEditorStore.sdkOptions.templates)==null?void 0:s.onLoad,n=async()=>await D3(this.projectTypeFilter);let r;if(t){const o=this.store.appEditorStore.editor;r=await t({editor:o,fetchCommunityTemplates:n})}else r=await n();this.setTemplates(r)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){V3(Bl.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 Nm=()=>pn().templatesStore;class jA{constructor(t){this.toasts=[],this.store=t,Xt(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,{...et(n)?{header:n}:n,variant:Zt.Error})}addWarning(t,n){this.add(t,{...et(n)?{header:n}:n,variant:Zt.Warning})}addSuccess(t,n){this.add(t,{...et(n)?{header:n}:n,variant:Zt.Success})}addInfo(t,n){this.add(t,{...et(n)?{header:n}:n,variant:Zt.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class DA{constructor(t){this.isOpen=!1,this.store=t,Xt(this,{},{autoBind:!0})}setOpen(t){this.isOpen=t,this.triggerEvent()}toggleOpen(){this.isOpen=!this.isOpen,this.triggerEvent()}triggerEvent(){var t;(t=this.store.appEditorStore.editor)==null||t.trigger(hn.toggleBlocksPanel,{isOpen:this.isOpen})}}const FA=()=>pn().blockManagerStore,$m=":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",BA=$m+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",zA="["+$m+"]["+BA+"]*",UA=new RegExp("^"+zA+"$");function km(e,t){const n=[];let r=t.exec(e);for(;r;){const s=[];s.startIndex=t.lastIndex-r[0].length;const o=r.length;for(let a=0;a<o;a++)s.push(r[a]);n.push(s),r=t.exec(e)}return n}const Xl=function(e){const t=UA.exec(e);return!(t===null||typeof t>"u")};function WA(e){return typeof e<"u"}const GA={allowBooleanAttributes:!1,unpairedTags:[]};function qA(e,t){t=Object.assign({},GA,t);const n=[];let r=!1,s=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=Vm(e,o),o.err)return o}else if(e[o]==="<"){let a=o;if(o++,e[o]==="!"){o=Hm(e,o);continue}else{let i=!1;e[o]==="/"&&(i=!0,o++);let c="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
|
|
48
|
-
`&&e[
|
|
49
|
-
`||e==="\r"}function Vm(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 Ct("InvalidXml","XML declaration allowed only at the start of the document.",Rt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Hm(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 KA='"',ZA="'";function YA(e,t){let n="",r="",s=!1;for(;t<e.length;t++){if(e[t]===KA||e[t]===ZA)r===""?r=e[t]:r!==e[t]||(r="");else if(e[t]===">"&&r===""){s=!0;break}n+=e[t]}return r!==""?!1:{value:n,index:t,tagClosed:s}}const XA=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function jm(e,t){const n=km(e,XA),r={};for(let s=0;s<n.length;s++){if(n[s][1].length===0)return Ct("InvalidAttr","Attribute '"+n[s][2]+"' has no space in starting.",ci(n[s]));if(n[s][3]!==void 0&&n[s][4]===void 0)return Ct("InvalidAttr","Attribute '"+n[s][2]+"' is without value.",ci(n[s]));if(n[s][3]===void 0&&!t.allowBooleanAttributes)return Ct("InvalidAttr","boolean attribute '"+n[s][2]+"' is not allowed.",ci(n[s]));const o=n[s][2];if(!RA(o))return Ct("InvalidAttr","Attribute '"+o+"' is an invalid name.",ci(n[s]));if(!r.hasOwnProperty(o))r[o]=1;else return Ct("InvalidAttr","Attribute '"+o+"' is repeated.",ci(n[s]))}return!0}function JA(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 QA(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,JA(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 Ct(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function RA(e){return Xl(e)}function e_(e){return Xl(e)}function Rt(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function ci(e){return e.startIndex+e[1].length}const t_={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},n_=function(e){return Object.assign({},t_,e)};let Jl;typeof Symbol!="function"?Jl="@@xmlMetadata":Jl=Symbol("XML Node Metadata");class mo{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][Jl]={startIndex:n})}static getMetaDataSymbol(){return Jl}}class r_{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 s=1,o=!1,a=!1,i="";for(;n<t.length;n++)if(t[n]==="<"&&!a){if(o&&bo(t,"!ENTITY",n)){n+=7;let c,u;[c,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(r[c]={regx:RegExp(`&${c};`,"g"),val:u})}else if(o&&bo(t,"!ELEMENT",n)){n+=8;const{index:c}=this.readElementExp(t,n+1);n=c}else if(o&&bo(t,"!ATTLIST",n))n+=8;else if(o&&bo(t,"!NOTATION",n)){n+=9;const{index:c}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=c}else if(bo(t,"!--",n))a=!0;else throw new Error("Invalid DOCTYPE");s++,i=""}else if(t[n]===">"){if(a?t[n-1]==="-"&&t[n-2]==="-"&&(a=!1,s--):s--,s===0)break}else t[n]==="["?o=!0:i+=t[n];if(s!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:n}}readEntityExp(t,n){n=ln(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)r+=t[n],n++;if(ui(r),n=ln(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 s="";return[n,s]=this.readIdentifierVal(t,n,"entity"),n--,[r,s,n]}readNotationExp(t,n){n=ln(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;!this.suppressValidationErr&&ui(r),n=ln(t,n);const s=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&s!=="SYSTEM"&&s!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${s}"`);n+=s.length,n=ln(t,n);let o=null,a=null;if(s==="PUBLIC")[n,o]=this.readIdentifierVal(t,n,"publicIdentifier"),n=ln(t,n),(t[n]==='"'||t[n]==="'")&&([n,a]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(s==="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:o,systemIdentifier:a,index:--n}}readIdentifierVal(t,n,r){let s="";const o=t[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(n++;n<t.length&&t[n]!==o;)s+=t[n],n++;if(t[n]!==o)throw new Error(`Unterminated ${r} value`);return n++,[n,s]}readElementExp(t,n){n=ln(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!this.suppressValidationErr&&!Xl(r))throw new Error(`Invalid element name: "${r}"`);n=ln(t,n);let s="";if(t[n]==="E"&&bo(t,"MPTY",n))n+=4;else if(t[n]==="A"&&bo(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)s+=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:s.trim(),index:n}}readAttlistExp(t,n){n=ln(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;ui(r),n=ln(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;if(!ui(s))throw new Error(`Invalid attribute name: "${s}"`);n=ln(t,n);let o="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(o="NOTATION",n+=8,n=ln(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let i=[];for(;n<t.length&&t[n]!==")";){let c="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)c+=t[n],n++;if(c=c.trim(),!ui(c))throw new Error(`Invalid notation name: "${c}"`);i.push(c),t[n]==="|"&&(n++,n=ln(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,o+=" ("+i.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;const i=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!i.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=ln(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:s,attributeType:o,defaultValue:a,index:n}}}const ln=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function bo(e,t,n){for(let r=0;r<t.length;r++)if(t[r]!==e[n+r+1])return!1;return!0}function ui(e){if(Xl(e))return e;throw new Error(`Invalid entity name ${e}`)}const s_=/^[-+]?0x[a-fA-F0-9]+$/,o_=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,a_={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function i_(e,t={}){if(t=Object.assign({},a_,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&&s_.test(n))return d_(n,16);if(n.search(/.+[eE].+/)!==-1)return c_(e,n,t);{const r=o_.exec(n);if(r){const s=r[1]||"",o=r[2];let a=u_(r[3]);const i=s?e[o.length+1]===".":e[o.length]===".";if(!t.leadingZeros&&(o.length>1||o.length===1&&!i))return e;{const c=Number(n),u=String(c);if(c===0)return c;if(u.search(/[eE]/)!==-1)return t.eNotation?c:e;if(n.indexOf(".")!==-1)return u==="0"||u===a||u===`${s}${a}`?c:e;let d=o?a:n;return o?d===u||s+d===u?c:e:d===u||d===s+u?c:e}}else return e}}const l_=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function c_(e,t,n){if(!n.eNotation)return e;const r=t.match(l_);if(r){let s=r[1]||"";const o=r[3].indexOf("e")===-1?"E":"e",a=r[2],i=s?e[a.length+1]===o:e[a.length]===o;return a.length>1&&i?e:a.length===1&&(r[3].startsWith(`.${o}`)||r[3][0]===o)?Number(t):n.leadingZeros&&!i?(t=(r[1]||"")+r[3],Number(t)):e}else return e}function u_(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 d_(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 Dm(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 p_{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=f_,this.parseXml=v_,this.parseTextData=h_,this.resolveNameSpace=g_,this.buildAttributesMap=b_,this.isItStopNode=C_,this.replaceEntitiesValue=w_,this.readStopNodeData=E_,this.saveTextToParentTag=S_,this.addChild=y_,this.ignoreAttributesFn=Dm(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 f_(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 h_(e,t,n,r,s,o,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,s,o);return i==null?e:typeof i!=typeof e||i!==e?i:this.options.trimValues?up(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?up(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function g_(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 m_=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function b_(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const r=km(e,m_),s=r.length,o={};for(let a=0;a<s;a++){const i=this.resolveNameSpace(r[a][1]);if(this.ignoreAttributesFn(i,t))continue;let c=r[a][4],u=this.options.attributeNamePrefix+i;if(i.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),c!==void 0){this.options.trimValues&&(c=c.trim()),c=this.replaceEntitiesValue(c);const d=this.options.attributeValueProcessor(i,c,t);d==null?o[u]=c:typeof d!=typeof c||d!==c?o[u]=d:o[u]=up(c,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const a={};return a[this.options.attributesGroupName]=o,a}return o}}const v_=function(e){e=e.replace(/\r\n?/g,`
|
|
50
|
-
`);const t=new
|
|
51
|
-
`;function
|
|
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 '
'");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:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],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=`>
|
|
52
41
|
`,this.newLine=`
|
|
53
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}xs.prototype.build=function(e){return this.options.preserveOrder?L_(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)},xs.prototype.j2x=function(e,t,n){let r="",s="";const o=n.join(".");for(let a in e)if(Object.prototype.hasOwnProperty.call(e,a))if(typeof e[a]>"u")this.isAttribute(a)&&(s+="");else if(e[a]===null)this.isAttribute(a)||a===this.options.cdataPropName?s+="":a[0]==="?"?s+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(e[a]instanceof Date)s+=this.buildTextValNode(e[a],a,"",t);else if(typeof e[a]!="object"){const i=this.isAttribute(a);if(i&&!this.ignoreAttributesFn(i,o))r+=this.buildAttrPairStr(i,""+e[a]);else if(!i)if(a===this.options.textNodeName){let c=this.options.tagValueProcessor(a,""+e[a]);s+=this.replaceEntitiesValue(c)}else s+=this.buildTextValNode(e[a],a,"",t)}else if(Array.isArray(e[a])){const i=e[a].length;let c="",u="";for(let d=0;d<i;d++){const p=e[a][d];if(!(typeof p>"u"))if(p===null)a[0]==="?"?s+=this.indentate(t)+"<"+a+"?"+this.tagEndChar:s+=this.indentate(t)+"<"+a+"/"+this.tagEndChar;else if(typeof p=="object")if(this.options.oneListGroup){const h=this.j2x(p,t+1,n.concat(a));c+=h.val,this.options.attributesGroupName&&p.hasOwnProperty(this.options.attributesGroupName)&&(u+=h.attrStr)}else c+=this.processTextOrObjNode(p,a,t,n);else if(this.options.oneListGroup){let h=this.options.tagValueProcessor(a,p);h=this.replaceEntitiesValue(h),c+=h}else c+=this.buildTextValNode(p,a,"",t)}this.options.oneListGroup&&(c=this.buildObjectNode(c,a,u,t)),s+=c}else if(this.options.attributesGroupName&&a===this.options.attributesGroupName){const i=Object.keys(e[a]),c=i.length;for(let u=0;u<c;u++)r+=this.buildAttrPairStr(i[u],""+e[a][i[u]])}else s+=this.processTextOrObjNode(e[a],a,t,n);return{attrStr:r,val:s}},xs.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 I_(e,t,n,r){const s=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,s.attrStr,n):this.buildObjectNode(s.val,t,s.attrStr,n)}xs.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 s="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",s=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(r)+"<"+t+n+o+">"+e+s:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(r)+`<!--${e}-->`+this.newLine:this.indentate(r)+"<"+t+n+o+this.tagEndChar+e+this.indentate(r)+s}},xs.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t},xs.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 s=this.options.tagValueProcessor(t,e);return s=this.replaceEntitiesValue(s),s===""?this.indentate(r)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(r)+"<"+t+n+">"+s+"</"+t+this.tagEndChar}},xs.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 V_(e){return this.options.indentBy.repeat(e)}function H_(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const Ql="mjml-code-to-html";function Wm(e,t){const n=t==null?void 0:t.sanitizer;if(Ke(n))return n(e);if(n==="xml-sanitizer"){const p=e.replace(/(<[a-zA-Z!/])|</g,(E,P)=>P??"<").replace(/&(?!#?\w+;)/g,"&"),h=["br","hr"],g=new Set(h),m=E=>{const P=[];for(const O of E){const A=Object.keys(O).find(T=>T!==":@");if(A&&g.has(A)){const T=O[A];Array.isArray(T)&&T.length>0?(P.push({...O,[A]:[]}),P.push(...m(T))):P.push(O)}else A&&Array.isArray(O[A])?P.push({...O,[A]:m(O[A])}):P.push(O)}return P},b={commentPropName:"#comment",unpairedTags:h,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},v=new __({...b,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),w=new xs({...b}),S=v.parse(`<root>${p}</root>`)[0].root,C=m(S);return w.build(C)}function r(p){const h=document.createElement("textarea");return h.innerHTML=p,h.value}const s=r(e||""),o=["checked","disabled","readonly","required","autofocus","multiple","selected","hidden","async","defer","formnovalidate","novalidate","ismap","allowfullscreen","autoplay","controls","loop","muted","open","reversed","scoped","seamless","typemustmatch","default","full-width","crossorigin"],a={crossorigin:"anonymous","full-width":"true"},i=new RegExp(`\\s+(${o.join("|")})(?=\\s|\\/?>)`,"gi");return s.replace(/<[^>]+>/g,p=>p.replace(i,(h,g)=>{const m=a[g]??g;return` ${g}="${m}"`})).replace(/(\s[\w:-]+=\s*)("[^"]*"|'[^']*')/g,(p,h,g)=>{const m=g.slice(1,-1).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`${h}"${m}"`}).replace(/&(?!#?\w+;)/g,(p,h,g)=>h>0&&g[h-1]==="&"?p:"&").replace(/(<[a-zA-Z!/])|</g,(p,h)=>h??"<")}var di=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(di||{}),pp=(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))(pp||{}),Es=(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))(Es||{}),yo=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(yo||{});function j_(e){const t=new Map,n={items:[]};return e.forEach(s=>{const{category:o,item:a}=s;if(o){const i=t.get(o.id);i?(i.items.push(a),i.category={...i.category,...o}):t.set(o.id,{category:o,items:[a]})}else n.items.push(a)}),[...Array.from(t).map(([,s])=>s),n].filter(s=>s.items.length)}const Gm=e=>(e==null?void 0:e.get("groups"))||[],qm=(e,t)=>Gm(e).includes(t),D_=(e,t)=>{qm(e,t)||e.set("groups",[...Gm(e),t])};class F_{constructor(t){this.dataSourceKeyid=yo.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,Xt(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=[],s=t.reduce((o,a)=>(o.set(a.get("id"),a),o),new Map);return n.forEach(({id:o})=>{const a=s.get(o);a&&(r.push(a),s.delete(o))}),Array.from(s).map(([,o])=>{o.get("_internal")||r.push(o)}),j_(r.map(o=>({category:o.get("category"),item:o})))}setCategoryOpen(t,n){this.openCategories.set(t,n)}getDataSource(){var t;return(t=this.DataSources)==null?void 0:t.get(this.dataSourceKeyid)}getRuleByGroup(t){var n;return(n=this.editor)==null?void 0:n.CssComposer.getAll().find(r=>qm(r,t))}addStyleRule(t,n={}){var p,h;const{editor:r}=this,s=t.get("id"),o=t.get("selector")||"",a=t.get("property"),i=t.getPath("value"),c=`${this.dataSourceKeyid}:${s}`,u={[a]:{type:"data-variable",path:i,defaultValue:t.get("defaultValue")}};if(r&&Dw(r)&&o.startsWith("mj-")){const g=r.Components.getWrapper(),{head:m}=di,{attributes:b}=pp,v=g.findFirstType(di.root),w=v.findFirstType(m)||v.append({type:m},{at:0})[0],y=w.findFirstType(b)||w.append({type:b})[0],S=y.findType(o).pop()||y.append({type:o})[0],C=(S.get("attributes")||{})[a];Ot(C)&&C!==""&&t.set("value",C),S.addAttributes(u,{silent:!0});return}let d=((h=(p=n.selectorToRuleMap)==null?void 0:p.get(o))==null?void 0:h.rule)||this.getRuleByGroup(c);d?d.addStyle(u):d=r==null?void 0:r.CssComposer.addCollection([{selectors:[],selectorsAdd:o,style:u}],{extend:!0,at:t.index})[0],d&&D_(d,c)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var o,a;const{sdkOptionStyles:t}=this,n=new Map,r=(o=this.editor)==null?void 0:o.Css;if(!t.length){this.records=[];return}const s=this.getDataSource()||this.createDataSource();t.forEach(i=>{const{id:c,selector:u,label:d,field:p,property:h,category:g}=i,m=s.getRecord(c);if(m){const b={label:d,field:p,category:g};m.set({...b,_undo:!0})}else{const b=n.get(u),v=(b==null?void 0:b.rule)||(r==null?void 0:r.getRule(u)),w=(b==null?void 0:b.styles)||(v==null?void 0:v.getStyle())||{},y=w[h]||i.defaultValue;n.set(u,{rule:v,styles:w}),s.addRecord({value:void 0,...i,defaultValue:y,_internal:!0,_undo:!0})}}),s.getRecords().forEach(i=>{this.addStyleRule(i,{selectorToRuleMap:n})}),s.listenTo(s.records,"add",i=>{this.addStyleRule(i)}),(a=this.editor)==null||a.UndoManager.add(s.records),this.records=s.getRecords()}}const B_=()=>pn().globalStylesStore,z_=(e,t)=>{let n;try{const r=lr()&&e&&localStorage.getItem(e);r&&(n=JSON.parse(r))}catch(r){console.error(r)}return{lastProjectId:"",...t,...n}},Km=(e,t)=>{const r={...z_(e),...t};try{lr()&&e&&localStorage.setItem(e,JSON.stringify(r))}catch(s){console.error(s)}return r},Zm="gs-utl-dark",U_=()=>lr()&&window.matchMedia("(prefers-color-scheme: dark)").matches,Ym=e=>e==="dark"||e==="auto"&&U_(),Xm=(e,t)=>{if(e&&lr()&&t.rootEl){const{classList:n}=t.rootEl;let r=!1;if(Ym(e)?(n.add(Zm),r=!0):n.remove(Zm),t.updateAppShell){const s=document.head.querySelector('meta[name="theme-color"]');s&&(s.content=r?"#18181b":"#ffffff")}t.resolvedTheme=r?ss.dark:ss.light}};class W_{constructor(t){this.key="",this.theme=ss.auto,this.resolvedTheme=ss.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const r=n,s=t[r];s!==void 0&&(this[r]=s)}),this.resolvedTheme=this.theme,Xt(this,{},{autoBind:!0}),this.init()}init(){Xm(this.theme,this)}changeTheme(t){Xm(t,this),Km(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const r=n,s=t[r];s!==void 0&&(this[r]=s)}),Km(this.key,t)}get isDarkTheme(){return Ym(this.theme)}}const Cr=()=>pn().localSettingsStore;class G_{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,Xt(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:s,...o}){this.isOpen=!0,this.content=t;const a=()=>{r==null||r(),this.close()};this.setModalProps({...o,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:a,size:"m2",variant:"pr",...s}]})}}const ra=()=>pn().modalStore,Jm="column1",Qm="column2",Rm="column3",fp="column3-7",q_=function(e,t={}){const{Components:n,Blocks:r}=e,s="gridRow",o="gridColumn",a="gjs-grid-row",i="gjs-grid-column",c={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,p=1,h=1;n.addType(s,{isComponent:v=>ws(v,a),model:{defaults:{emptyState:!0,droppable:Sr(o),highlightable:!1,attributes:{class:a},resizable:{...c,keyHeight:"min-height"},icon:`
|
|
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??"<").replace(/&(?!#?\w+;)/g,"&"),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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");return`${p}"${m}"`}).replace(/&(?!#?\w+;)/g,(f,p,g)=>p>0&&g[p-1]==="&"?f:"&").replace(/(<[a-zA-Z!/])|</g,(f,p)=>p??"<")}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:`
|
|
54
43
|
<svg viewBox="0 0 24 24">
|
|
55
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>
|
|
56
45
|
</svg>
|
|
57
|
-
`,"stylable-require":["flex-align-items","flex-align-items-v","flex-direction-id","flex-multiline"],traits:["id","title",{name:"add-column",labelButton:"Add column",type:"button",full:!0,command:
|
|
46
|
+
`,"stylable-require":["flex-align-items","flex-align-items-v","flex-direction-id","flex-multiline"],traits:["id","title",{name:"add-column",labelButton:"Add column",type:"button",full:!0,command:b=>{b.getSelected().components().add({type:s})}}],styles:`
|
|
58
47
|
.${a} {
|
|
59
48
|
display: flex;
|
|
60
49
|
justify-content: flex-start;
|
|
@@ -68,7 +57,7 @@ ${t}
|
|
|
68
57
|
flex-direction: column;
|
|
69
58
|
}
|
|
70
59
|
}
|
|
71
|
-
`}}}),n.addType(
|
|
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:`
|
|
72
61
|
<svg viewBox="0 0 24 24">
|
|
73
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>
|
|
74
63
|
</svg>
|
|
@@ -77,51 +66,51 @@ ${t}
|
|
|
77
66
|
flex: 1 1 0%;
|
|
78
67
|
padding: 5px 0;
|
|
79
68
|
}
|
|
80
|
-
`},init(){this.listenTo(this,"change:center-content",this.handleCenter)},handleCenter(){const
|
|
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:`
|
|
81
70
|
<svg viewBox="0 0 24 24">
|
|
82
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" />
|
|
83
72
|
</svg>
|
|
84
|
-
`,content:{type
|
|
85
|
-
.${
|
|
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} {
|
|
86
75
|
display: flex;
|
|
87
76
|
padding: 50px 0;
|
|
88
77
|
}
|
|
89
|
-
`}}}),n.addType(
|
|
90
|
-
.${
|
|
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} {
|
|
91
80
|
width: 90%;
|
|
92
81
|
margin: 0 auto;
|
|
93
82
|
max-width: 1200px;
|
|
94
83
|
}
|
|
95
|
-
`}}})},
|
|
84
|
+
`}}})},bL=function(e,t={}){const{Components:n,Blocks:r}=e,o="divider",s="gjs-divider";r.add(o,{label:o,media:`
|
|
96
85
|
<svg viewBox="0 0 24 24">
|
|
97
86
|
<path d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
|
|
98
87
|
</svg>
|
|
99
|
-
`,content:{type:
|
|
100
|
-
.${
|
|
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:`
|
|
89
|
+
.${s} {
|
|
101
90
|
height: 3px;
|
|
102
91
|
width: 100%;
|
|
103
92
|
margin: 10px;
|
|
104
93
|
background-color: rgba(0, 0, 0, 0.05);
|
|
105
94
|
}
|
|
106
|
-
`}}})},
|
|
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:`
|
|
107
96
|
<svg viewBox="0 0 24 24">
|
|
108
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>
|
|
109
98
|
</svg>
|
|
110
|
-
`,content:{type:
|
|
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:`
|
|
111
100
|
<svg viewBox="0 0 24 24">
|
|
112
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" />
|
|
113
102
|
</svg>
|
|
114
|
-
`,content:{type:
|
|
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:`
|
|
115
104
|
.${a} {
|
|
116
105
|
height: 200px;
|
|
117
106
|
width: 100%;
|
|
118
107
|
}
|
|
119
|
-
`},getAttrToHTML(...i){return
|
|
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:`
|
|
120
109
|
<svg viewBox="0 0 24 24">
|
|
121
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" />
|
|
122
111
|
</svg>
|
|
123
|
-
`,content:{type:
|
|
124
|
-
.${
|
|
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:`
|
|
113
|
+
.${s} {
|
|
125
114
|
color: inherit;
|
|
126
115
|
display: inline-block;
|
|
127
116
|
vertical-align: top;
|
|
@@ -129,10 +118,10 @@ ${t}
|
|
|
129
118
|
max-width: 100%;
|
|
130
119
|
text-decoration: none;
|
|
131
120
|
}
|
|
132
|
-
`}}})};function
|
|
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">
|
|
133
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>
|
|
134
|
-
</svg>`,
|
|
135
|
-
.${
|
|
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:`
|
|
124
|
+
.${s} {
|
|
136
125
|
display: inline-block;
|
|
137
126
|
text-decoration: none;
|
|
138
127
|
color: inherit;
|
|
@@ -141,9 +130,9 @@ ${t}
|
|
|
141
130
|
width: 50px;
|
|
142
131
|
height: 50px;
|
|
143
132
|
}
|
|
144
|
-
`},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
|
|
145
|
-
`).trim();
|
|
146
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
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!
|
|
147
136
|
You are using deprecated way of configuration.
|
|
148
137
|
|
|
149
138
|
Instead of using
|
|
@@ -152,7 +141,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
152
141
|
monaco.config({ paths: { vs: '...' } })
|
|
153
142
|
|
|
154
143
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
155
|
-
`},cb=_4($4)(lb),k4={config:L4},I4=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];return function(s){return n.reduceRight(function(o,a){return a(o)},s)}};function ub(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],ub(e[n],t[n]))}),sb(sb({},e),t)}var V4={type:"cancelation",msg:"operation is manually canceled"};function yp(e){var t=!1,n=new Promise(function(r,s){e.then(function(o){return t?s(V4):r(o)}),e.catch(s)});return n.cancel=function(){return t=!0},n}var H4=O4.create({config:A4,isInitialized:!1,resolve:null,reject:null,monaco:null}),db=l4(H4,2),gi=db[0],tc=db[1];function j4(e){var t=k4.config(e),n=t.monaco,r=i4(t,["monaco"]);tc(function(s){return{config:ub(s.config,r),monaco:n}})}function D4(){var e=gi(function(t){var n=t.monaco,r=t.isInitialized,s=t.resolve;return{monaco:n,isInitialized:r,resolve:s}});if(!e.isInitialized){if(tc({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),yp(wp);if(window.monaco&&window.monaco.editor)return pb(window.monaco),e.resolve(window.monaco),yp(wp);I4(F4,z4)(U4)}return yp(wp)}function F4(e){return document.body.appendChild(e)}function B4(e){var t=document.createElement("script");return e&&(t.src=e),t}function z4(e){var t=gi(function(r){var s=r.config,o=r.reject;return{config:s,reject:o}}),n=B4("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function U4(){var e=gi(function(n){var r=n.config,s=n.resolve,o=n.reject;return{config:r,resolve:s,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){pb(n),e.resolve(n)},function(n){e.reject(n)})}function pb(e){gi().monaco||tc({monaco:e})}function W4(){return gi(function(e){var t=e.monaco;return t})}var wp=new Promise(function(e,t){return tc({resolve:e,reject:t})}),fb={config:j4,init:D4,__getMonacoInstance:W4},G4={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},Sp=G4,q4={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},K4=q4;function Z4({children:e}){return f.createElement("div",{style:K4.container},e)}var Y4=Z4,X4=Y4;function J4({width:e,height:t,isEditorReady:n,loading:r,_ref:s,className:o,wrapperProps:a}){return f.createElement("section",{style:{...Sp.wrapper,width:e,height:t},...a},!n&&f.createElement(X4,null,r),f.createElement("div",{ref:s,style:{...Sp.fullWidth,...!n&&Sp.hide},className:o}))}var Q4=J4,hb=f.memo(Q4);function R4(e){f.useEffect(e,[])}var gb=R4;function eM(e,t,n=!0){let r=f.useRef(!0);f.useEffect(r.current||!n?()=>{r.current=!1}:e,t)}var wn=eM;function mi(){}function sa(e,t,n,r){return tM(e,r)||nM(e,t,n,r)}function tM(e,t){return e.editor.getModel(mb(e,t))}function nM(e,t,n,r){return e.editor.createModel(t,n,r?mb(e,r):void 0)}function mb(e,t){return e.Uri.parse(t)}function rM({original:e,modified:t,language:n,originalLanguage:r,modifiedLanguage:s,originalModelPath:o,modifiedModelPath:a,keepCurrentOriginalModel:i=!1,keepCurrentModifiedModel:c=!1,theme:u="light",loading:d="Loading...",options:p={},height:h="100%",width:g="100%",className:m,wrapperProps:b={},beforeMount:v=mi,onMount:w=mi}){let[y,S]=f.useState(!1),[C,x]=f.useState(!0),E=f.useRef(null),P=f.useRef(null),O=f.useRef(null),A=f.useRef(w),T=f.useRef(v),_=f.useRef(!1);gb(()=>{let N=fb.init();return N.then(B=>(P.current=B)&&x(!1)).catch(B=>(B==null?void 0:B.type)!=="cancelation"&&console.error("Monaco initialization: error:",B)),()=>E.current?D():N.cancel()}),wn(()=>{if(E.current&&P.current){let N=E.current.getOriginalEditor(),B=sa(P.current,e||"",r||n||"text",o||"");B!==N.getModel()&&N.setModel(B)}},[o],y),wn(()=>{if(E.current&&P.current){let N=E.current.getModifiedEditor(),B=sa(P.current,t||"",s||n||"text",a||"");B!==N.getModel()&&N.setModel(B)}},[a],y),wn(()=>{let N=E.current.getModifiedEditor();N.getOption(P.current.editor.EditorOption.readOnly)?N.setValue(t||""):t!==N.getValue()&&(N.executeEdits("",[{range:N.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),N.pushUndoStop())},[t],y),wn(()=>{var N,B;(B=(N=E.current)==null?void 0:N.getModel())==null||B.original.setValue(e||"")},[e],y),wn(()=>{let{original:N,modified:B}=E.current.getModel();P.current.editor.setModelLanguage(N,r||n||"text"),P.current.editor.setModelLanguage(B,s||n||"text")},[n,r,s],y),wn(()=>{var N;(N=P.current)==null||N.editor.setTheme(u)},[u],y),wn(()=>{var N;(N=E.current)==null||N.updateOptions(p)},[p],y);let L=f.useCallback(()=>{var q;if(!P.current)return;T.current(P.current);let N=sa(P.current,e||"",r||n||"text",o||""),B=sa(P.current,t||"",s||n||"text",a||"");(q=E.current)==null||q.setModel({original:N,modified:B})},[n,t,s,e,r,o,a]),$=f.useCallback(()=>{var N;!_.current&&O.current&&(E.current=P.current.editor.createDiffEditor(O.current,{automaticLayout:!0,...p}),L(),(N=P.current)==null||N.editor.setTheme(u),S(!0),_.current=!0)},[p,u,L]);f.useEffect(()=>{y&&A.current(E.current,P.current)},[y]),f.useEffect(()=>{!C&&!y&&$()},[C,y,$]);function D(){var B,q,F,k;let N=(B=E.current)==null?void 0:B.getModel();i||((q=N==null?void 0:N.original)==null||q.dispose()),c||((F=N==null?void 0:N.modified)==null||F.dispose()),(k=E.current)==null||k.dispose()}return f.createElement(hb,{width:g,height:h,isEditorReady:y,loading:d,_ref:O,className:m,wrapperProps:b})}var sM=rM;f.memo(sM);function oM(e){let t=f.useRef();return f.useEffect(()=>{t.current=e},[e]),t.current}var aM=oM,nc=new Map;function iM({defaultValue:e,defaultLanguage:t,defaultPath:n,value:r,language:s,path:o,theme:a="light",line:i,loading:c="Loading...",options:u={},overrideServices:d={},saveViewState:p=!0,keepCurrentModel:h=!1,width:g="100%",height:m="100%",className:b,wrapperProps:v={},beforeMount:w=mi,onMount:y=mi,onChange:S,onValidate:C=mi}){let[x,E]=f.useState(!1),[P,O]=f.useState(!0),A=f.useRef(null),T=f.useRef(null),_=f.useRef(null),L=f.useRef(y),$=f.useRef(w),D=f.useRef(),N=f.useRef(r),B=aM(o),q=f.useRef(!1),F=f.useRef(!1);gb(()=>{let V=fb.init();return V.then(U=>(A.current=U)&&O(!1)).catch(U=>(U==null?void 0:U.type)!=="cancelation"&&console.error("Monaco initialization: error:",U)),()=>T.current?H():V.cancel()}),wn(()=>{var U,X,Y,R;let V=sa(A.current,e||r||"",t||s||"",o||n||"");V!==((U=T.current)==null?void 0:U.getModel())&&(p&&nc.set(B,(X=T.current)==null?void 0:X.saveViewState()),(Y=T.current)==null||Y.setModel(V),p&&((R=T.current)==null||R.restoreViewState(nc.get(o))))},[o],x),wn(()=>{var V;(V=T.current)==null||V.updateOptions(u)},[u],x),wn(()=>{!T.current||r===void 0||(T.current.getOption(A.current.editor.EditorOption.readOnly)?T.current.setValue(r):r!==T.current.getValue()&&(F.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:r,forceMoveMarkers:!0}]),T.current.pushUndoStop(),F.current=!1))},[r],x),wn(()=>{var U,X;let V=(U=T.current)==null?void 0:U.getModel();V&&s&&((X=A.current)==null||X.editor.setModelLanguage(V,s))},[s],x),wn(()=>{var V;i!==void 0&&((V=T.current)==null||V.revealLine(i))},[i],x),wn(()=>{var V;(V=A.current)==null||V.editor.setTheme(a)},[a],x);let k=f.useCallback(()=>{var V;if(!(!_.current||!A.current)&&!q.current){$.current(A.current);let U=o||n,X=sa(A.current,r||e||"",t||s||"",U||"");T.current=(V=A.current)==null?void 0:V.editor.create(_.current,{model:X,automaticLayout:!0,...u},d),p&&T.current.restoreViewState(nc.get(U)),A.current.editor.setTheme(a),i!==void 0&&T.current.revealLine(i),E(!0),q.current=!0}},[e,t,n,r,s,o,u,d,p,a,i]);f.useEffect(()=>{x&&L.current(T.current,A.current)},[x]),f.useEffect(()=>{!P&&!x&&k()},[P,x,k]),N.current=r,f.useEffect(()=>{var V,U;x&&S&&((V=D.current)==null||V.dispose(),D.current=(U=T.current)==null?void 0:U.onDidChangeModelContent(X=>{F.current||S(T.current.getValue(),X)}))},[x,S]),f.useEffect(()=>{if(x){let V=A.current.editor.onDidChangeMarkers(U=>{var Y;let X=(Y=T.current.getModel())==null?void 0:Y.uri;if(X&&U.find(R=>R.path===X.path)){let R=A.current.editor.getModelMarkers({resource:X});C==null||C(R)}});return()=>{V==null||V.dispose()}}return()=>{}},[x,C]);function H(){var V,U;(V=D.current)==null||V.dispose(),h?p&&nc.set(o,T.current.saveViewState()):(U=T.current.getModel())==null||U.dispose(),T.current.dispose()}return f.createElement(hb,{width:g,height:m,isEditorReady:x,loading:c,_ref:_,className:b,wrapperProps:v})}var lM=iM,cM=f.memo(lM),uM=cM;function Ts({className:e,as:t="label",bold:n,m:r="gjs-mb-1",size:s="m",capitalize:o=!0,children:a,tip:i,onClear:c,...u}){const d=t,p=!!c;return l.jsxs(d,{className:M(e,r,p&&z.tAo,o&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",s==="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&&l.jsx(kt,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:i,children:l.jsx(Q,{icon:W.information,size:oe.s2x})}),a,p&&l.jsx(ft,{title:"Clear value",onClick:c,icon:{icon:W.close,size:oe.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var bb=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e))(bb||{}),vb=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(vb||{});const dM="gs-cmp-button",rc=f.memo(ie(function({classNameBtn:t,className:n,children:r,tooltip:s,variant:o,onClick:a,editorEvents:i,label:c,size:u,icon:d,active:p,buttonType:h,disabled:g,...m}){const{editor:b}=me(),[v,w]=f.useState(()=>({disabled:g,variant:o,active:p,className:n,classNameBtn:t,tooltip:s,icon:d,size:u,label:c})),y=v.variant,S=y==="outline",C=y==="secondary",x=y==="primary"?"pr":S||C?"out-clear":void 0,E=v.label,P=A=>{b&&(a==null||a({event:A,editor:b,state:v,setState:T=>w(_=>({..._,...T}))}))};f.useEffect(()=>{if(!i||!b)return;const A=Object.keys(i).reduce((_,L)=>(_[L]=($={})=>{i[L]({fromEvent:$,editor:b,state:v,setState:D=>w(N=>({...N,...D}))})},_),{}),T=Object.keys(A);return T.forEach(_=>b.on(_,A[_])),()=>{T.forEach(_=>b.off(_,A[_]))}},[b,v]);const O=v.tooltip;return l.jsx(ft,{className:M(dM,v.classNameBtn),classNameWrp:v.className,variant:x,icon:v.icon,active:v.active,size:v.size,disabled:v.disabled,onClick:P,border:S||C,type:h,withBg:C,block:!0,...et(O)?{title:O}:{tooltipProps:O},...m,children:E?Ke(E)?E({editor:b}):E:r})}));var Cp=(e=>(e.m="m",e.s="s",e))(Cp||{});const yb="gs-input-field",sc=e=>Ot(e)?e:"",bi=(e={})=>M("gs-utl-w-full",z.bgTr,ps.inputText,e.disabled&&z.txtLowEmphasis),xp=({size:e="m"}={})=>M("gs-input-container gs-utl-w-full",z.bg,J.b,J.rnd,z.br,e==="m"&&Se.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),Os=({className:e,style:t,row:n})=>({className:M(e,"gs-utl-w-full gs-utl-flex",n?`${yb}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),nr=e=>{const{as:t,size:n="m",label:r,description:s,hasClear:o,onChange:a,tip:i,row:c,afterLabel:u,afterLabelButtons:d}=e,p=!!r,h=!!s,g=o!=null&&o(e)?()=>a==null?void 0:a(""):void 0;if(!p&&!(d!=null&&d.length)&&!h)return null;const m=l.jsx(l.Fragment,{children:p&&l.jsx(Ts,{as:t,className:"gs-utl-w-full",size:n,tip:h?void 0:i,onClear:g,m:"",children:r})}),b=u||d!=null&&d.length?l.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((v,w)=>l.jsx(rc,{...v},v.id??w))]}):null;return l.jsxs(I,{className:M("gs-label-field-container",c&&"gs-utl-whitespace-nowrap"),col:!0,children:[b?l.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[m,b]}):m,h&&l.jsx(Ts,{size:n,tip:i,as:"span",className:M(z.txtLowEmphasis),capitalize:!1,children:s})]})},Xe=f.forwardRef(function(t,n){const{className:r,value:s,type:o,placeholder:a,required:i,disabled:c,readOnly:u,name:d,autoFocus:p,onInput:h,onChange:g,onBlur:m,onKeyDown:b,labelAs:v}=t,[w,y]=f.useState(sc(s)),S=bi(t),C=f.useRef(null);f.useImperativeHandle(n,()=>C.current,[]),f.useEffect(()=>{y(sc(s))},[s]),f.useEffect(()=>{const T=C.current;if(T&&p){const _=T.querySelector("input"),L=setTimeout(()=>_==null?void 0:_.focus(),Ku);return()=>clearTimeout(L)}},[C.current,p]);const x=(T,_)=>{g==null||g(T,_)},E=T=>{const{key:_}=T;switch(b==null||b(T),_){case"Escape":return y(s);case"Enter":return x(w)}},P=()=>{x(w),m==null||m()},O=T=>{const _=T.target.value;y(_),h==null||h(_)},A=Os({...t,className:M(yb,r)});return l.jsxs("div",{...A,ref:C,children:[l.jsx(nr,{...t,as:v}),l.jsxs(I,{className:xp(t),items:"center",gap:"x2s",children:[t.beforeInput,l.jsx(j,{grow:!0,children:l.jsx("input",{className:S,name:d,value:w,onChange:O,placeholder:a,required:i,onBlur:P,onKeyDown:E,readOnly:u,disabled:c,type:o,maxLength:t.maxLength})}),t.afterInput]})]})}),wb=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},pM="gs-field-code",fM={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 Yr(e){const{defaultValue:t,value:n,language:r,onChange:s,clean:o,padding:a,isDarkTheme:i,className:c,containerClassName:u,minHeight:d="170px",onMount:p,readOnly:h,name:g,required:m,disabled:b,formatOnMount:v=!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),P=Os({...e,className:M(pM,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),O=M("gs-utl-relative gs-utl-flex-grow");return l.jsxs("div",{...P,children:[l.jsx(nr,{...e,as:y}),l.jsxs("div",{className:O,style:{minHeight:d},children:[g&&l.jsx("input",{className:Ce.hiddenVisually,name:g,value:E,disabled:b,required:m,onChange:()=>{}}),l.jsx("div",{className:M("gs-utl-absolute gs-utl-inset-0",b&&Ce.disabled),children:l.jsx(uM,{...S?{language:C,value:E}:{defaultLanguage:C,defaultValue:E},theme:i?"vs-dark":"light",className:M(J.b,J.rnd,z.br,c),options:{...fM,readOnly:h,...o&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Ot(a)&&{lineDecorationsWidth:a*2,padding:{top:a,bottom:a}},...w},onChange:s,onMount:(A,T)=>{if(v){let _=!1;const L=()=>wb(A);A.onDidChangeModelLanguageConfiguration(L),A.onDidScrollChange(()=>{_||(_=!0,L())}),setTimeout(L,10)}p==null||p(A,T)}})})]})]})}const Sb=ie(function({buttonProps:t,content:n,code:r,onAction:s}){const o=ra(),a=_e(),i=me(),{isProjectTypeEmail:c}=i,u=i.editor,{isDarkTheme:d}=Cr(),[p,h]=f.useState(),g=()=>{let b=(p||"").trim();const v=tb({code:b,appStore:i,showToastError:!0});if(!v.error)b=v.output;else return;s?s(b):c?u.loadProjectData({pages:[{component:b}]}):u.setComponents(b),o.close()};f.useEffect(()=>{r?h(r):(async()=>{var C,x;const v=await u.runCommand(re.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),w=(C=v.find(E=>E.mimeType==="text/html"))==null?void 0:C.content,y=(x=v.find(E=>E.mimeType==="text/mjml"))==null?void 0:x.content,S=c?y:w;S&&h(S)})()},[]);const m=(t==null?void 0:t.children)||a.t("actions.importCode.button");return l.jsxs(I,{col:!0,space:"m",children:[l.jsx(j,{children:n??a.t("actions.importCode.content")}),l.jsx(j,{className:Z("h-96"),children:p!==void 0&&l.jsx(Yr,{defaultValue:p,onChange:b=>h(b||""),isDarkTheme:d,language:"html"})}),l.jsx(I,{justify:"end",children:l.jsx(Ue,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),Ep="data-type-empty",Cb=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:r}=n,s=Array.from(r.getDoc().querySelectorAll(`style[${Ep}]`));for(const o of s)o.disabled=!t})},hM=(e,t,n="Empty",r={})=>{const s=`[${Ep}="${t}"]`;if(!e.frameView.getDoc())return;const o=e.frameView.getHead(),{midSelector:a="",styleOut:i="",styleIn:c=""}=r;if(!o.querySelector(`style${s}`)){const u=document.createElement("style");u.setAttribute(Ep,t),u.innerHTML=`
|
|
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=`
|
|
156
145
|
[data-gjs-type="${t}"]${a}:empty {
|
|
157
146
|
text-decoration: none;
|
|
158
147
|
padding: 5px;
|
|
@@ -179,19 +168,19 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
179
168
|
content: "${n}";
|
|
180
169
|
${r.limitH?"height: auto;":""}
|
|
181
170
|
${r.smallH?"min-height: 30px;":""}
|
|
182
|
-
${
|
|
183
|
-
}`,
|
|
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">
|
|
184
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" />
|
|
185
|
-
</svg>`},toJSON:
|
|
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">
|
|
186
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>
|
|
187
|
-
</svg>`})},toJSON:
|
|
188
|
-
`))},
|
|
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">
|
|
189
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" />
|
|
190
179
|
</svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),i("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
|
|
191
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" />
|
|
192
181
|
</svg>`,content:"<mj-button>Button</mj-button>"}),i("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
|
|
193
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" />
|
|
194
|
-
</svg>`,content:`<mj-image src="${
|
|
183
|
+
</svg>`,content:`<mj-image src="${WS}"/>`,activate:!0}),i("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
|
|
195
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" />
|
|
196
185
|
</svg>`,content:"<mj-divider/>"}),i("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
|
|
197
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" />
|
|
@@ -212,7 +201,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
212
201
|
<mj-navbar-link>BLOG</mj-navbar-link>
|
|
213
202
|
</mj-navbar>`}),i("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
|
|
214
203
|
<path fill="currentColor" d="M20,20H4A2,2 0 0,1 2,18V6A2,2 0 0,1 4,4H20A2,2 0 0,1 22,6V18A2,2 0 0,1 20,20M4,6V18H20V6H4M6,9H18V11H6V9M6,13H16V15H6V13Z" />
|
|
215
|
-
</svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${
|
|
204
|
+
</svg>`,content:`<mj-hero mode="fixed-height" height="469px" background-width="600px" background-height="469px" background-url="${eg({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
|
|
216
205
|
<mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
|
|
217
206
|
Heading title
|
|
218
207
|
</mj-text>
|
|
@@ -226,57 +215,57 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
226
215
|
<path d="M5.59 3.41L7 4.82L3.82 8L7 11.18L5.59 12.6L1 8L5.59 3.41M11.41 3.41L16 8L11.41 12.6L10 11.18L13.18 8L10 4.82L11.41 3.41M22 6V18C22 19.11 21.11 20 20 20H4C2.9 20 2 19.11 2 18V14H4V18H20V6H17.03V4H20C21.11 4 22 4.89 22 6Z" />
|
|
227
216
|
</svg>`,content:`<mj-raw>
|
|
228
217
|
<span>Insert here you custom HTML</span>
|
|
229
|
-
</mj-raw>`}),i("mj-1-column",{...
|
|
218
|
+
</mj-raw>`}),i("mj-1-column",{...s,label:"1 Column",mediaReact:c.jsx(I,{...o,children:c.jsx(B,{className:a,grow:!0})}),content:`<mj-section>
|
|
230
219
|
<mj-column></mj-column>
|
|
231
|
-
</mj-section>`}),i("mj-2-columns-50-50",{...
|
|
220
|
+
</mj-section>`}),i("mj-2-columns-50-50",{...s,label:"2 Columns 50/50",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0})]}),content:`<mj-section>
|
|
232
221
|
<mj-column></mj-column>
|
|
233
222
|
<mj-column></mj-column>
|
|
234
|
-
</mj-section>`}),i("mj-2-columns-25-75",{...
|
|
223
|
+
</mj-section>`}),i("mj-2-columns-25-75",{...s,label:"2 Columns 25/75",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-3/4")})]}),content:`<mj-section>
|
|
235
224
|
<mj-column width="25%"></mj-column>
|
|
236
225
|
<mj-column width="75%"></mj-column>
|
|
237
|
-
</mj-section>`}),i("mj-2-columns-33-67",{...
|
|
226
|
+
</mj-section>`}),i("mj-2-columns-33-67",{...s,label:"2 Columns 33/67",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-1/3")}),c.jsx(B,{className:ae(a,"gs-utl-basis-2/3")})]}),content:`<mj-section>
|
|
238
227
|
<mj-column width="33%"></mj-column>
|
|
239
228
|
<mj-column width="67%"></mj-column>
|
|
240
|
-
</mj-section>`}),i("mj-2-columns-67-33",{...
|
|
229
|
+
</mj-section>`}),i("mj-2-columns-67-33",{...s,label:"2 Columns 67/33",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-2/3")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/3")})]}),content:`<mj-section>
|
|
241
230
|
<mj-column width="67%"></mj-column>
|
|
242
231
|
<mj-column width="33%"></mj-column>
|
|
243
|
-
</mj-section>`}),i("mj-2-columns-75-25",{...
|
|
232
|
+
</mj-section>`}),i("mj-2-columns-75-25",{...s,label:"2 Columns 75/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-3/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
244
233
|
<mj-column width="75%"></mj-column>
|
|
245
234
|
<mj-column width="25%"></mj-column>
|
|
246
|
-
</mj-section>`}),i("mj-3-columns",{...
|
|
235
|
+
</mj-section>`}),i("mj-3-columns",{...s,label:"3 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0})]}),content:`<mj-section>
|
|
247
236
|
<mj-column></mj-column>
|
|
248
237
|
<mj-column></mj-column>
|
|
249
238
|
<mj-column></mj-column>
|
|
250
|
-
</mj-section>`}),i("mj-3-columns-25-25-50",{...
|
|
239
|
+
</mj-section>`}),i("mj-3-columns-25-25-50",{...s,label:"3 Columns 25/25/50",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-2/4")})]}),content:`<mj-section>
|
|
251
240
|
<mj-column width="25%"></mj-column>
|
|
252
241
|
<mj-column width="25%"></mj-column>
|
|
253
242
|
<mj-column width="50%"></mj-column>
|
|
254
|
-
</mj-section>`}),i("mj-3-columns-25-50-25",{...
|
|
243
|
+
</mj-section>`}),i("mj-3-columns-25-50-25",{...s,label:"3 Columns 25/50/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-2/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
255
244
|
<mj-column width="25%"></mj-column>
|
|
256
245
|
<mj-column width="50%"></mj-column>
|
|
257
246
|
<mj-column width="25%"></mj-column>
|
|
258
|
-
</mj-section>`}),i("mj-3-columns-50-25-25",{...
|
|
247
|
+
</mj-section>`}),i("mj-3-columns-50-25-25",{...s,label:"3 Columns 50/25/25",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:ae(a,"gs-utl-basis-2/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")}),c.jsx(B,{className:ae(a,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
259
248
|
<mj-column width="50%"></mj-column>
|
|
260
249
|
<mj-column width="25%"></mj-column>
|
|
261
250
|
<mj-column width="25%"></mj-column>
|
|
262
|
-
</mj-section>`}),i("mj-4-columns",{...
|
|
251
|
+
</mj-section>`}),i("mj-4-columns",{...s,label:"4 Columns",mediaReact:c.jsxs(I,{...o,children:[c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0}),c.jsx(B,{className:a,grow:!0})]}),content:`<mj-section>
|
|
263
252
|
<mj-column></mj-column>
|
|
264
253
|
<mj-column></mj-column>
|
|
265
254
|
<mj-column></mj-column>
|
|
266
255
|
<mj-column></mj-column>
|
|
267
|
-
</mj-section>`})}const vM=(e,t)=>({[ht.web]:r=>vp(r,t),[ht.document]:r=>vp(r,t),[ht.react]:r=>vp(r,t),[ht.email]:r=>mM(r,t)})[e],oa="https://cdn.jsdelivr.net/npm/",Pp={id:"gjs-blocks-basic",src:`${oa}grapesjs-blocks-basic@1.0.1/dist/index.js`},yM={id:"grapesjs-plugin-forms",src:`${oa}grapesjs-plugin-forms@2.0.5/dist/index.js`},Tp={id:"grapesjs-parser-postcss",src:`${oa}grapesjs-parser-postcss@1.0.1/dist/index.js`},wM={id:"grapesjs-navbar",src:`${oa}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},Op={id:"grapesjs-plugin-export",src:`${oa}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)}}},SM={id:"grapesjs-mjml",src:`${oa}grapesjs-mjml@1.0.7/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},CM={[ht.email]:[bM,SM],[ht.web]:[Pp,yM,Op,Tp,wM],[ht.document]:[Pp,Op,Tp],[ht.react]:[Pp,Op,Tp]};function xM(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 s=-r.canvasOffset.left;r.left<s&&(r.left=s)})}function Eb({onCopy:e,getValue:t,value:n,title:r="Copy",...s}){const[o,a]=f.useState(!1),i=()=>{Cw((t==null?void 0:t())??n),a(!0),e==null||e()};return f.useEffect(()=>{if(!o)return;const c=setTimeout(()=>a(!1),3e3);return()=>clearTimeout(c)},[o]),l.jsx(ft,{onClick:i,title:r,type:"button",size:"lg",withBg:!0,...s,children:l.jsx(Q,{className:ae(o&&z.tA),icon:o?W.check:W.contentCopy,size:oe.s})})}const EM=(e,t)=>e.filter(n=>n.id===t)[0]||null,Pb=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),PM=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,Tb=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 Ob(e){var o;const{option:t,active:n,selected:r}=e,s=((o=e.isSelected)==null?void 0:o.call(e))||!0;return l.jsxs(I,{items:"center",className:Z([Se.xy,n&&Zu.bgH]),children:[l.jsx(j,{className:Z("truncate"),grow:!0,children:t.label}),l.jsx(j,{className:Z("gjs-pl-2"),children:Pb(t,r)&&s&&l.jsx(Q,{className:Z(z.tA),icon:W.check,size:oe.s})})]})}const TM="gs-select-field";function Ab({option:e}){return l.jsxs(l.Fragment,{children:[e.icon&&l.jsx(Q,{...et(e.icon)?{icon:e.icon,size:oe.s2x}:e.icon}),l.jsx(j,{className:Z("truncate"),grow:!0,children:e.content||e.label})]})}function Ee(e){const{value:t,onChange:n,onBlur:r,onFocus:s,handlerSelected:o,label:a,options:i,includeEmpty:c,className:u,search:d,open:p,caret:h=W.chevronDown,size:g="m",border:m,emptyState:b="- Select an option -",name:v,required:w,disabled:y,classNameContainer:S,autoFocus:C,labelAs:x,hideCaret:E}=e,[P,O]=f.useState(null),[A,T]=f.useState(null),[_,L]=f.useState(""),{styles:$,attributes:D}=Ra(P,A,Ap),N=typeof d=="object"?d.onChange:void 0,B=[...i].filter(te=>d?N||PM(te,_):te),q=d&&(typeof d=="object"&&d.value||_),F=q&&B.length?B[0]:EM(B,t),k=te=>n(te.id,te),H={id:null,label:b},V=(F==null?void 0:F.content)||(F==null?void 0:F.label),U=F?o?o(F):F.icon?l.jsx(I,{items:"center",gap:"s",children:l.jsx(Ab,{option:F})}):V:o?o(H):b;c&&B.unshift(H);const X=te=>{const{value:K}=te.target,ne=K.trim();switch(te.key){case"Escape":n(null);break;case"Enter":n((B.length?B[0].id:ne)||null,B[0]);break;case" ":Gs(te);break}},Y=M("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",J.rnd,Va.focus),R=()=>{r==null||r()},ee=Os({...e,className:M(TM,S,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return l.jsx(Wa,{value:F,onChange:k,disabled:y,children:({open:te})=>l.jsxs("div",{...ee,children:[a&&l.jsx(Wa.Label,{as:x,className:e.classNameLabel,children:l.jsx(nr,{as:"span",...e})}),v&&l.jsx("input",{type:"input",name:v,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}),l.jsx(Wa.Button,{ref:O,className:Y,tabIndex:d?-1:void 0,children:d?l.jsx("input",{autoFocus:C,value:typeof d=="object"&&d.value||_,className:M([u,"gs-utl-w-full",J.rnd,Va.focus,Se.xyS]),onChange:K=>{L(K.target.value),N==null||N(K.target.value)},onKeyDown:X,onClick:Gs,onBlur:R,onFocus:s}):l.jsx(kn,{border:m,size:g,title:U,icon:E?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:h,shadow:!1,className:Z(u),titleClass:"",disabled:y})}),l.jsx(Wa.Options,{static:p,className:Tb,ref:T,style:$.popper,...D.popper,children:l.jsxs(kn,{padding:!1,className:Z("h-full"),style:{minWidth:`${P==null?void 0:P.offsetWidth}px`,maxHeight:200},children:[!B.length&&d&&d!==!0&&l.jsx("div",{className:Z(Se.xy),children:d.empty}),B.map((K,ne)=>l.jsx(Wa.Option,{value:K,children:({active:ce})=>l.jsxs(I,{items:"center",gap:"s",className:Z([K.className,Se.xy,ce&&Zu.bgH]),nowrap:!0,children:[l.jsx(Ab,{option:K}),l.jsx(j,{className:Z("gjs-pl-2"),children:Pb(K,F)&&!q&&l.jsx(Q,{className:Z(z.tA),icon:W.check,size:oe.s})})]})},ne))]})})]})})}const _b=f.createContext(null),OM=({children:e})=>{const[t,n]=f.useState({setEditor:r=>{n(s=>({...s,editor:r}))}});return l.jsx(_b.Provider,{value:t,children:e})},Vn=()=>{const e=f.useContext(_b);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},vi=()=>{const{editor:e}=Vn();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},AM=()=>Vn().editor,Mb=f.createContext(null),_M=({children:e})=>{const[t,n]=f.useState(()=>({setRefCanvas(r){n(s=>({...s,refCanvas:r}))},setCustomModal(r){n(s=>({...s,customModal:r}))},setCustomAssets(r){n(s=>({...s,customAssets:r}))},setCustomBlocks(r){n(s=>({...s,customBlocks:r}))},setCustomRte(r){n(s=>({...s,customRte:r}))},setCustomStyles(r){n(s=>({...s,customStyles:r}))},setCustomLayers(r){n(s=>({...s,customLayers:r}))},setCustomSelectors(r){n(s=>({...s,customSelectors:r}))},setCustomTraits(r){n(s=>({...s,customTraits:r}))},setReady(r){n(s=>({...s,ready:r}))}}));return l.jsx(Mb.Provider,{value:t,children:e})},xr=()=>{const e=f.useContext(Mb);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function MM(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function As(e){return typeof e=="function"}function rr(){}const Lb=e=>typeof e=="string",LM=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},Nb=e=>{const t=Lb(e)?{id:e,src:e}:e;return new Promise((n,r)=>{const s=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);s.src=t.src,s.onload=()=>n(t.id),s.onerror=()=>r(t.id),document.head.appendChild(s)})},NM=e=>{const t=e.map(n=>Nb(n));return Promise.allSettled(t)},$b=e=>function(){const t=f.useRef(null);return f.useEffect(()=>{const{current:n}=t;n&&(Lb(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),l.jsx("div",{ref:t})},kb=new WeakMap;function aa(e){if(!e)return()=>l.jsx(l.Fragment,{});const t=kb.get(e);if(t)return t;const n=function({children:r}){return Pn.createPortal(f.createElement("div",null,r),e)};return kb.set(e,n),n}f.memo(function({children:e}){const{editor:t}=Vn(),n=xr(),[r,s]=f.useState(!1),[o,a]=f.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>l.jsx(l.Fragment,{})});return f.useEffect(()=>{if(!t)return;const i=t.Assets.events.custom,c=({open:u,assets:d,types:p,select:h,close:g,container:m})=>{u&&a({assets:d,types:p,select:h,close:g,Container:aa(m)}),s(u)};return t.on(i,c),()=>{t.off(i,c)}},[t]),f.useEffect(()=>n.setCustomAssets(!0),[]),t?As(e)?e({open:r,...o}):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})}),f.memo(function({children:e}){const{editor:t}=Vn(),n=xr(),[r,s]=f.useState(()=>({blocks:[],dragStart:rr,dragStop:rr,mapCategoryBlocks:new Map,Container:()=>l.jsx(l.Fragment,{})}));return f.useEffect(()=>{if(!t)return;const o=t.Blocks.events.custom,a=({blocks:i,container:c,dragStart:u,dragStop:d})=>{const p=i.reduce((h,g)=>{const m=g.getCategoryLabel(),b=h.get(m);return b?b.push(g):h.set(m,[g]),h},new Map);s({blocks:i,dragStart:u,dragStop:d,mapCategoryBlocks:p,Container:aa(c)})};return t.on(o,a),t.Blocks.__trgCustom(),()=>{t.off(o,a)}},[t]),f.useEffect(()=>n.setCustomBlocks(!0),[]),t?As(e)?e(r):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})});function $M({children:e,...t}){const n=xr(),r=f.useRef(null);return f.useEffect(()=>{r.current&&n.setRefCanvas(r.current)},[r.current]),l.jsx("div",{...t,ref:r,children:e})}const kM=f.memo(function({children:e}){const{editor:t}=Vn(),[n,r]=f.useState(()=>({devices:[],selected:"",select:rr}));return f.useEffect(()=>{if(!t)return;const{Devices:s}=t,o=s.events.all,a=()=>{var i;r({devices:s.getDevices(),selected:(i=s.getSelected())==null?void 0:i.id,select:c=>s.select(c)})};return t.on(o,a),a(),()=>{t.off(o,a)}},[t]),t?As(e)?e(n):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})}),IM=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function VM(e){const t=e.map(({id:o,src:a})=>({id:o,src:a})),n=e.reduce((o,a)=>(o[a.id]=a,o),{}),r=[],s=[];return(await NM(t)).forEach(o=>{o.status==="fulfilled"?r.push(n[o.value]):s.push(n[o.reason])}),{loaded:r,failed:s}}const HM=async e=>{const t=[...e],n={};if(t.length){const r={},s=[];if(t.forEach((o,a)=>{IM(o)&&(r[o.id]={index:a},s.push(o))}),s.length){const{loaded:o}=await VM(s);o.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(o=>{const a=r[o];a.loaded?t[a.index]=o:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},jM=f.memo(function({children:e,className:t,style:n,options:r={},plugins:s=[],grapesjs:o,grapesjsCss:a,onEditor:i=rr,onReady:c,onUpdate:u,waitReady:d,...p}){const{setEditor:h}=Vn(),g=xr(),[m,b]=f.useState(!1),v=f.useRef(null);f.useEffect(()=>{if(!g.ready||!v.current)return;const P=v.current,O=g.refCanvas;let A,T={},_=[];const L=$=>{const D={height:"100%",...r,plugins:[..._,...r.plugins||[]],pluginsOpts:{...r.pluginsOpts,...T},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:O||P,customUI:!!O,...O?{panels:{defaults:[]}}:{}};A=$.init(D),h(A),i(A),u&&A.on("update",()=>{u(A.getProjectData(),A)}),A.onReady(()=>{b(!0),c==null||c(A)})};return(async()=>{a&&await LM(a);const $=await HM(s);_=$.plugins,T=$.pluginOptions,typeof o=="string"?(await Nb(o),L(window.grapesjs)):L(o)})(),()=>A==null?void 0:A.destroy()},[g.ready]);const w=r.height??"100%",y=r.width??"100%",S=MM("gjs-editor-wrapper",t),C=d&&!m,x=f.useMemo(()=>({...n,height:w,width:y}),[w,y,n]),E=f.useMemo(()=>({...x,...C?{opacity:0,width:0,height:0}:{}}),[x,C]);return l.jsxs(l.Fragment,{children:[d&&!m?l.jsx("div",{className:S,style:x,children:d}):null,l.jsx("div",{...p,ref:v,className:S,style:E,children:e})]})}),DM=f.memo(function(){const e=xr();return f.useEffect(()=>e.setReady(!0),[]),l.jsx(l.Fragment,{})});f.memo(function({children:e,...t}){return l.jsx(OM,{children:l.jsx(_M,{children:l.jsxs(jM,{...t,children:[e,l.jsx(DM,{})]})})})});const Ib=f.memo(function({children:e}){const{editor:t}=Vn(),n=xr(),[r,s]=f.useState(()=>({root:void 0,Container:()=>l.jsx(l.Fragment,{})}));return f.useEffect(()=>{if(!t)return;const{Layers:o}=t,a=o.events.custom,i=({container:c})=>{s({root:o.getRoot(),Container:aa(c)})};return t.on(a,i),o.__trgCustom({}),()=>{t.off(a,i)}},[t]),f.useEffect(()=>n.setCustomLayers(!0),[]),t?As(e)?e(r):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})});f.memo(function({children:e}){const{editor:t}=Vn(),n=xr(),[r,s]=f.useState(!1),[o,a]=f.useState({title:l.jsx(l.Fragment,{}),content:l.jsx(l.Fragment,{}),attributes:{},close:rr});return f.useEffect(()=>{if(!t)return;const i="modal",c=({open:u,title:d,content:p,close:h,attributes:g})=>{u&&a({title:f.createElement($b(d)),content:f.createElement($b(p)),attributes:g,close:h}),s(u)};return t.on(i,c),()=>{t.off(i,c)}},[t]),f.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:r,...o}):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})});const Vb=f.memo(function({children:e}){const{editor:t}=Vn(),[n,r]=f.useState(()=>({pages:[],selected:void 0,select:rr,add:rr,remove:rr}));return f.useEffect(()=>{if(!t)return;const{Pages:s}=t,o=s.events.all,a=()=>{r({pages:s.getAll(),selected:s.getSelected(),select:(...i)=>s.select(...i),add:(...i)=>s.add(...i),remove:(...i)=>s.remove(...i)})};return t.on(o,a),a(),()=>{t.off(o,a)}},[t]),t?As(e)?e(n):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})}),Hb=f.memo(function({children:e}){const{editor:t}=Vn(),n=xr(),[r,s]=f.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:rr,removeSelector:rr,setState:rr,Container:()=>l.jsx(l.Fragment,{})}));return f.useEffect(()=>{if(!t)return;const{Selectors:o}=t,a=o.events.custom,i=({container:c})=>{s({selectors:o.getSelected(),states:o.getStates(),selectedState:o.getState(),targets:o.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>o.addSelected(...u),removeSelector:(...u)=>o.removeSelected(...u),setState:(...u)=>o.setState(...u),Container:aa(c)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),f.useEffect(()=>n.setCustomSelectors(!0),[]),t?As(e)?e(r):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})}),jb=f.memo(function({children:e}){const{editor:t}=Vn(),n=xr(),[r,s]=f.useState(()=>({sectors:[],Container:()=>l.jsx(l.Fragment,{})}));return f.useEffect(()=>{if(!t)return;const{Styles:o}=t,a=o.events.custom,i=({container:c})=>{s({sectors:o.getSectors({visible:!0}),Container:aa(c)})};return t.on(a,i),()=>{t.off(a,i)}},[t]),f.useEffect(()=>n.setCustomStyles(!0),[]),t?As(e)?e(r):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})}),_p=f.memo(function({children:e}){const{editor:t}=Vn(),n=xr(),[r,s]=f.useState(()=>({traits:[],Container:()=>l.jsx(l.Fragment,{})}));return f.useEffect(()=>{if(!t)return;const{Traits:o}=t,a=o.events.custom,i=({container:c})=>{s({traits:o.getCurrent(),Container:aa(c)})};return t.on(a,i),o.__trgCustom(),()=>{t.off(a,i)}},[t]),f.useEffect(()=>n.setCustomTraits(!0),[]),t?As(e)?e(r):l.jsx(l.Fragment,{}):l.jsx(l.Fragment,{})}),yi=({children:e})=>AM()?l.jsx(l.Fragment,{children:e}):l.jsx(l.Fragment,{});function Mp(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 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 {
|
|
268
257
|
$2`),e=e.replace(/([^\s])\}([^\n]*)/g,`$1
|
|
269
258
|
}
|
|
270
259
|
$2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
271
|
-
$2`),e}const Db=ie(function(){const t=vi(),n=_e(),{Styles:r}=t,{isDarkTheme:s}=Cr(),o=r.getSelected(),[a,i]=f.useState(0),c=o?Mp(o==null?void 0:o.toCSS({allowEmpty:!0})):"",[u,d]=f.useState(c);f.useEffect(()=>{const h=()=>i(m=>++m),g=r.events.custom;return t.on(g,h),()=>{t.off(g,h)}},[r,t]);const p=()=>{if(u){const h=t.Parser.parseCss(u)[0];h&&(o==null||o.setStyle(h.style))}};return l.jsxs(I,{className:Z("relative"),col:!0,full:!0,children:[l.jsx(j,{grow:!0,children:o?l.jsx(Yr,{padding:5,language:"css",defaultValue:c,onChange:d,isDarkTheme:s,clean:!0},a):n.t("noCode")}),l.jsx(Ue,{className:Z("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:p,children:n.t("update")})]})}),Fb=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],FM=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(re.projectFiles),r={};for(const s in n){const o=n[s],{filename:a,content:i}=o;if(o.path){const c=o.path.split("/").filter(Boolean);let u=r;for(const d of c)u[d]=u[d]||{},u=u[d];u[a]=i}else r[a]=i}return r}})},BM=ie(function(t){const n=_e(),r=me(),{isProjectTypeEmail:s}=r,o=r.editor,[a,i]=f.useState(Fb[0].id),[c,u]=f.useState(),{isDarkTheme:d}=Cr(),[p]=f.useState(()=>Mp(o.getCss())),[h,g]=f.useState(),m=y=>n.t(`actions.showCode.${y}`),b={...t.options,...s?{export:!1}:{}},v=()=>FM(o);f.useEffect(()=>{(async()=>{var P,O;const S=await o.runCommand(re.projectFiles,{page:o.Pages.getSelected(),skipProject:!0,styles:"skip"}),C=((P=S.find(A=>A.mimeType==="text/html"))==null?void 0:P.content)??"",x=((O=S.find(A=>A.mimeType==="text/mjml"))==null?void 0:O.content)??"";u(a==="mjml"?x:C)})()},[a]),f.useEffect(()=>{var y;h&&((y=h.getModel())==null||y.setValue(c),wb(h))},[h,c]);const w={padding:5,isDarkTheme:d,clean:!0};return l.jsxs(I,{col:!0,space:"m",children:[l.jsxs(I,{className:Z("h-96"),space:"m",children:[l.jsxs(j,{className:Z("relative"),grow:!0,children:[s&&l.jsxs(I,{className:Z("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[l.jsx(Ee,{value:a,onChange:i,options:Fb,className:Z("min-w-24")}),l.jsx(Eb,{getValue:()=>h.getModel().getValue()})]}),c!==void 0&&l.jsx(Yr,{defaultValue:c,language:"html",onMount:g,...w})]}),!s&&l.jsx(j,{grow:!0,children:l.jsx(Yr,{defaultValue:p,language:"css",...w})})]}),b.export!==!1&&l.jsx(I,{justify:"end",children:l.jsx(Ue,{size:"m2",variant:"pr",onClick:v,children:m("exportButton")})})]})});function zM(e,t){f.useEffect(()=>{const n="pointerdown",{current:r}=e;if(!r||!t.enabled)return;function s(o){const a=o.target;r&&a&&!r.contains(a)&&t.onTrigger(a)}return document.addEventListener(n,s),()=>{document.removeEventListener(n,s)}},[e.current,t.enabled])}const Bb=e=>{const{ref:t,show:n,node:r,styles:s,update:o,reload:a}=e,i={all:"initial",zIndex:"10",fontFamily:"inherit",...s};f.useEffect(()=>{const c=t.current;if(c&&n){if(!c.__sh){const p=c.attachShadow({mode:"closed"});c.__sh=gw.createRoot(p)}c.__sh.render(r),Object.keys(i).forEach(p=>{c.style.setProperty(Nw(p),i[p],"important")});const u=new MutationObserver(a);u.observe(c,{attributeFilter:["style"]});const d=new MutationObserver(p=>{Array.from(p[0].removedNodes).includes(c)&&a()});return d.observe(c.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,o])},UM="gs-cmp-popover";function sr({children:e,handler:t,title:n,size:r,padding:s=!0,border:o=!0,overlay:a,clickAway:i,topIcon:c,placement:u="auto",offset:d,open:p,onClose:h,buttonAs:g,className:m,classNameBody:b,buttonProps:v={},disabled:w,hideCloseButton:y}){const[S,C]=f.useState(!!p),[x,E]=f.useState(S),[P,O]=f.useState(null),[A,T]=f.useState(null),_=Ra(P,A,{...Qf({offset:d}),placement:u}),L=()=>{E(!1),h==null||h()};zM({current:A},{onTrigger:L,enabled:i&&S}),f.useEffect(()=>{E(!!p)},[p]),f.useEffect(()=>{var N;S&&((N=_.update)==null||N.call(_))},[S,_.update]),f.useEffect(()=>{const N=setTimeout(()=>C(x),10);return()=>clearTimeout(N)},[x]);const $=Z("w-full transition-colors",w&&"pointer-events-none",...Gg({border:!1,size:"",...v})),D=Z(["fixed z-20",c&&"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 l.jsxs(Pd,{className:Z(UM,"relative flex",m),children:[l.jsx(Pd.Button,{ref:O,as:g,className:$,children:l.jsx("div",{onClick:N=>{Gs(N),!(Ot(p)||w)&&E(!S)},children:t})}),S&&a&&l.jsx("div",{onClick:L,className:Z("z-10 fixed inset-0")}),x&&l.jsx(Pd.Panel,{static:!0,className:D,ref:T,style:_.styles.popper,..._.attributes.popper,children:l.jsx(Hd,{as:f.Fragment,show:S,unmount:!1,...Dg,children:l.jsx(kn,{classNameBody:b,title:n,onClose:y?void 0:L,padding:s,border:o,children:typeof e=="function"?e({close:L,open:S}):e})})})]})}function ia(e){const{action:t,icon:n,label:r,className:s,items:o,onItemClick:a,selected:i,...c}=e,u=f.useRef(null),[d,p]=f.useState(),h=u.current,g=M([s,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",z.br,Se.xy,J.bb,c.disabled&&Ce.disabled,...t?[z.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=v=>{Ke(t)&&(t({event:v}),a==null||a({event:v,item:e}))};f.useEffect(()=>{if(!h)return;const v=setTimeout(()=>p(h.getBoundingClientRect()),c.active?0:Ku);return()=>clearTimeout(v)},[h,c.active]);const b=()=>{var v;return(v=c.onActive)==null?void 0:v.call(c)};return l.jsxs(I,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:b,children:[n&&l.jsx(j,{children:l.jsx(Q,{icon:n,size:oe.sx})}),!!r&&l.jsx(j,{className:M(c.classNameLabel,Ce.txtEllips),grow:!0,children:r}),!!i&&l.jsx(j,{children:l.jsx(Q,{className:z.tA,icon:W.check,size:oe.s})}),!!(o!=null&&o.length)&&l.jsxs(l.Fragment,{children:[l.jsx(j,{children:l.jsx(Q,{icon:W.chevronRight,size:oe.s,className:"-gs-utl-mr-2"})}),d&&c.active&&l.jsx(hI,{items:o,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:a,open:!0})]})]})}const oc=({className:e,grow:t,alignItems:n,justifyContent:r})=>M(e,z.br,t&&"gs-utl-flex-grow",n==="start"&&"gs-utl-items-start",n==="end"&&"gs-utl-items-end",n==="center"&&"gs-utl-items-center",n==="baseline"&&"gs-utl-items-baseline",n==="stretch"&&"gs-utl-items-stretch",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"),ac=({style:e,width:t,height:n,gap:r})=>({height:n,gap:r,width:t,...e}),cn=f.memo(ie(function({id:t,children:n,className:r,style:s,width:o,gap:a,height:i,grow:c,alignItems:u,justifyContent:d,htmlAttrs:p,...h}){const{layoutsById:g}=Lm(),[m,b]=f.useState({}),{className:v,style:w,...y}=p||{},S=r??v,C=s??w,x=f.useMemo(()=>ac({height:i,gap:a,width:o,style:C}),[C,o,i,a]),E=oc({className:S,grow:c,alignItems:u,justifyContent:d});f.useEffect(()=>{if(t)return g.set(t,{state:m,setState:b}),()=>{g.delete(t)}},[g,m]);const P=h.as??"div";return l.jsx(P,{style:x,className:E,...h,...y,children:m.children??n})})),ic="gs-cmp-button-menu",WM=f.memo(ie(function({className:t,style:n,icon:r,label:s,size:o,tooltip:a,value:i,disabled:c,options:u,children:d,editorEvents:p,classNameBtn:h,iconMenu:g="chevronDown",onClick:m,onClickMenu:b,onOptionSelect:v}){const{editor:w}=me(),[y,S]=f.useState(!1),[C,x]=f.useState(()=>({isOpen:y,className:t,style:n,tooltip:a,label:s,icon:r,iconMenu:g,size:o,disabled:c,value:i,options:u})),P={editor:w,state:C,setState:F=>x(k=>({...k,...F}))};Fs({editor:w,editorEvents:p,localState:C,setLocalState:x});const O=F=>{m==null||m({...P,event:F})},A=F=>{v==null||v({...P,option:F}),S(!1)},T=C.tooltip,_=et(T)?{title:T}:{tooltipProps:T},$=(()=>{var U,X;if(C.label)return Ke(C.label)?C.label(P):C.label;const F=(U=C.options)==null?void 0:U.find(Y=>Y.id===C.value),k=(X=C.options)==null?void 0:X[0],H=F||k,V=M((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}})(),D=Tt($),N=()=>{if(d){const F=Ke(d)?d(P):d;return Tt(F)}return C.options&&C.options.length>0?l.jsx("div",{className:`${ic}-options`,children:C.options.map(F=>l.jsx(ia,{label:F.label,icon:F.icon,selected:F.id===C.value,action:()=>A(F)},F.id))}):null},B=F=>{F.stopPropagation(),b?b({...P,event:F}):S(!y)},q=l.jsx(I,{items:"center",onClick:B,className:M(`${ic}__icon-menu`,z.hBgH2,z.txtHighEmphasisH),children:l.jsx(Q,{icon:C.iconMenu,size:"14px"})});return l.jsx(cn,{className:M(ic,"gs-utl-flex",C.className),style:C.style,children:l.jsx(sr,{handler:l.jsx(ft,{className:M(`${ic}__btn`,h),icon:C.icon,size:C.size,disabled:C.disabled,onClick:O,block:!0,..._,children:$?l.jsxs(I,{items:"center",gap:"s",nowrap:!0,children:[l.jsx(I,{items:"center",children:D}),q]}):q}),buttonAs:"div",open:y,onClose:()=>S(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:N()})})}));function zt(e){const{className:t,options:n,name:r,value:s,size:o="m",required:a,disabled:i,onChange:c,labelAs:u}=e,d=g=>{const m=n.filter(b=>b.id===g)[0];return n.indexOf(m)===n.length-1},p=(g,m)=>M("gs-utl-cursor-pointer",o==="m"&&Se.xy,o==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",o==="xs"&&"gs-utl-p-1 text-sm",z.br,g&&z.bgO,!d(m)&&J.br),h=Os({...e,className:"gs-field-buttons"});return l.jsxs(E1,{value:s,onChange:c,disabled:i,...h,children:[l.jsx(nr,{...e,as:u}),r&&l.jsx("input",{type:"hidden",name:r,value:s,required:a}),l.jsx(I,{className:M(t,J.b,J.rnd,z.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:g,label:m,title:b,icon:v})=>l.jsx(kt,{title:b,className:M("gs-utl-w-full"),classNameWrp:M("gs-utl-flex-1"),children:l.jsx(E1.Option,{value:g,className:({checked:w})=>p(w,g),children:l.jsxs(I,{justify:"center",gap:"s",full:!0,children:[!!v&&l.jsx(Q,{...et(v)?{icon:v,size:oe.s}:v}),m&&l.jsx(j,{children:m})]})})},g))})]})}const GM="gs-cmp-button-group-field",qM=f.memo(ie(function({className:t,label:n,name:r,value:s,options:o,size:a,required:i,disabled:c,onChange:u,editorEvents:d}){const{editor:p}=me(),[h,g]=f.useState(()=>({className:t,label:n,name:r,value:s,options:o,size:a,required:i,disabled:c})),m=b=>{u({value:b,editor:p,state:h,setState:v=>g(w=>({...w,...v}))})};return Fs({editor:p,editorEvents:d,localState:h,setLocalState:g}),l.jsx(zt,{className:M(GM,h.className),label:h.label,name:h.name,value:h.value,options:h.options??[],size:h.size,required:h.required,disabled:h.disabled,onChange:m})}));function lc({colors:e,...t}){return e?l.jsxs("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 79 79",...t,children:[l.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"}),l.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"}),l.jsx("defs",{children:l.jsxs("linearGradient",{id:"a",x1:"2.1",x2:"77.2",y1:"39.6",y2:"39.6",gradientUnits:"userSpaceOnUse",children:[l.jsx("stop",{stopColor:"#D7709E"}),l.jsx("stop",{offset:"1",stopColor:"#A84A87"})]})})]}):l.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 76 76",...t,children:l.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 KM=f.memo(ie(function(){const{isStage:e,updateStudio:t}=me(),{isDarkTheme:n}=Cr(),r=f.useRef(null),{bg:s,text:o}=Ug(n);return Bb({ref:r,show:e,update:n,reload:t,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",right:"0",left:"0"},node:l.jsxs(l.Fragment,{children:[l.jsx("style",{children:`
|
|
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:`
|
|
272
261
|
.gs-banner {
|
|
273
262
|
box-shadow: 0 0 5px #1c1b1b21;
|
|
274
263
|
padding: 30px 10px;
|
|
275
264
|
border-radius: 10px;
|
|
276
265
|
margin: 5px;
|
|
277
266
|
font-size: 30px;
|
|
278
|
-
background-color: ${
|
|
279
|
-
color: ${
|
|
267
|
+
background-color: ${o};
|
|
268
|
+
color: ${s};
|
|
280
269
|
width: 95%;
|
|
281
270
|
}
|
|
282
271
|
.gs-banner-row {
|
|
@@ -288,15 +277,15 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
288
277
|
.gs-gs-logo {
|
|
289
278
|
width: 35px;
|
|
290
279
|
}
|
|
291
|
-
`}),
|
|
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:`
|
|
292
281
|
.gs-banner {
|
|
293
282
|
box-shadow: 0 0 5px #1c1b1b21;
|
|
294
283
|
padding: 5px 10px;
|
|
295
284
|
border-radius: 9999px;
|
|
296
285
|
margin: 5px;
|
|
297
286
|
font-size: 12px;
|
|
298
|
-
background-color: ${
|
|
299
|
-
color: ${
|
|
287
|
+
background-color: ${o};
|
|
288
|
+
color: ${s};
|
|
300
289
|
}
|
|
301
290
|
.gs-banner-row {
|
|
302
291
|
justify-content: center;
|
|
@@ -311,7 +300,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
311
300
|
.gs-logo {
|
|
312
301
|
width: 20px;
|
|
313
302
|
}
|
|
314
|
-
`}),l.jsx(kn,{className:"gs-banner",children:l.jsxs(I,{className:"gs-banner-row",children:[l.jsx("a",{className:"gs-link",href:ZM(),target:"_blank",children:"GrapesJS Studio"}),l.jsx(lc,{className:"gs-logo",colors:!0})]})})]})}),l.jsx("div",{ref:r})})),zb="gs-canvas-content",XM=f.memo(ie(function({children:t}){const{isReady:n}=me(),r=M(`${zb}__overlay gs-utl-pointer-events-none gs-utl-absolute gs-utl-inset-0`,z.bgH2);return l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:zb,children:[l.jsx("div",{className:r}),!n&&l.jsx(ro,{className:M("gs-utl-z-10"),abs:!0,full:!0}),n&&Tt(t)]}),l.jsx(KM,{}),l.jsx(YM,{})]})})),JM="gs-canvas",Ub=f.memo(function({className:t,style:n,grow:r,children:s}){return l.jsx($M,{style:n,className:M(JM,"gs-utl-relative",r&&"gs-utl-flex-grow",t),children:l.jsx(yi,{children:l.jsx(XM,{children:s})})})}),Lp=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),QM=Lp?Promise.resolve().then(function(){return sL}):Promise.resolve().then(function(){return uL});async function RM(...e){return(await QM).default(...e)}Lp?Promise.resolve().then(function(){return aL}):Promise.resolve().then(function(){return pL});const eL=Lp?Promise.resolve().then(function(){return lL}):Promise.resolve().then(function(){return hL});async function tL(...e){return(await eL).default(...e)}const nL=async e=>{const t=await e.getFile();return t.handle=e,t};var rL=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((s,o)=>{t[o]={description:s.description||"Files",accept:{}},s.mimeTypes?s.mimeTypes.map(a=>{t[o].accept[a]=s.extensions||[]}):t[o].accept["*/*"]=s.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(nL));return e[0].multiple?r:r[0]},sL={__proto__:null,default:rL};function cc(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(s){return{value:s,done:r}})}return cc=function(n){this.s=n,this.n=n.next},cc.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 cc(e)}const Wb=async(e,t,n=e.name,r)=>{const s=[],o=[];var a,i=!1,c=!1;try{for(var u,d=function(p){var h,g,m,b=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,m=Symbol.iterator);b--;){if(g&&(h=p[g])!=null)return h.call(p);if(m&&(h=p[m])!=null)return new cc(h.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,h=`${n}/${p.name}`;p.kind==="file"?o.push(p.getFile().then(g=>(g.directoryHandle=e,g.handle=p,Object.defineProperty(g,"webkitRelativePath",{configurable:!0,enumerable:!0,get:()=>h})))):p.kind!=="directory"||!t||r&&r(p)||s.push(Wb(p,t,h,r))}}catch(p){c=!0,a=p}finally{try{i&&d.return!=null&&await d.return()}finally{if(c)throw a}}return[...(await Promise.all(s)).flat(),...await Promise.all(o)]};var oL=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]:Wb(t,e.recursive,void 0,e.skipDirectory)},aL={__proto__:null,default:oL},iL=async(e,t=[{}],n=null,r=!1,s=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const o=[];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)=>{o[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&a&&u.mimeTypes.push(a),u.mimeTypes.map(p=>{o[d].accept[p]=u.extensions||[]})):a?o[d].accept[a]=u.extensions||[]:o[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:o,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&s&&s(i);const c=await i.createWritable();return"stream"in e?(await e.stream().pipeTo(c),i):"body"in e?(await e.body.pipeTo(c),i):(await c.write(await e),await c.close(),i)},lL={__proto__:null,default:iL},cL=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const r=document.createElement("input");r.type="file";const s=[...e.map(c=>c.mimeTypes||[]),...e.map(c=>c.extensions||[])].join();r.multiple=e[0].multiple||!1,r.accept=s||"",r.style.display="none",document.body.append(r);const o=c=>{typeof a=="function"&&a(),t(c)},a=e[0].legacySetup&&e[0].legacySetup(o,()=>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(),o(r.multiple?Array.from(r.files):r.files[0])}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),uL={__proto__:null,default:cL},dL=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 s=a=>{typeof o=="function"&&o(),t(a)},o=e[0].legacySetup&&e[0].legacySetup(s,()=>o(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(c=>!e[0].skipDirectory({name:c,kind:"directory"})))):a=a.filter(i=>i.webkitRelativePath.split("/").length===2),s(a)}),"showPicker"in HTMLInputElement.prototype?r.showPicker():r.click()})),pL={__proto__:null,default:dL},fL=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 c=a.getReader(),u=new ReadableStream({start:h=>async function g(){return c.read().then(({done:m,value:b})=>{if(!m)return h.enqueue(b),g();h.close()})}()}),d=new Response(u),p=await d.blob();return c.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 s=()=>{typeof o=="function"&&o()},o=t.legacySetup&&t.legacySetup(s,()=>o(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),s()}),n.click(),null},hL={__proto__:null,default:fL};function _s({children:e,label:t,s:n="m",pill:r,border:s,nopad:o,className:a,block:i,...c}){return l.jsx("div",{className:M(!i&&"gs-utl-inline-block",a,!o&&Se.xyS2,r?J.pill:J.rnd,s&&`${J.b} ${z.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...c,children:t||e})}var Gb={NODE_ENV:"production"};const gL=Gb.REACT_APP_VERSION??Gb.NPM_PACKAGE_VERSION,mL=ie(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return l.jsxs(I,{col:!0,space:"m",children:[l.jsx(I,{justify:"center",children:l.jsxs(j,{className:ae("relative"),children:[l.jsx(lc,{className:ae("w-24 opacity-50")}),t&&l.jsx(_s,{className:ae(z.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),l.jsxs(j,{children:[l.jsxs("p",{children:[l.jsx("b",{children:"GrapesJS Studio"})," is an innovative experimental editor, initially created to improve and extend the customization capability of the"," ",l.jsx("a",{className:ae(ps.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."]}),l.jsx("br",{}),l.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"," ",l.jsx("a",{className:ae(ps.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),l.jsxs(j,{className:ae(z.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",gL]})]})}),bL=ie(function(){return l.jsxs(I,{col:!0,space:"m",children:[l.jsx(I,{justify:"center",children:l.jsx(j,{className:Z("relative"),children:l.jsx(lc,{className:Z("w-24 opacity-50")})})}),l.jsx(j,{children:l.jsxs("p",{children:["We're excited to introduce the GrapesJS Studio SDK, an embeddable version of the Studio editor.",l.jsx("br",{}),l.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.",l.jsx("br",{}),l.jsx("br",{}),"You can try the initial release of the Studio SDK by creating a license and following the instructions on the"," ",l.jsx("a",{className:Z(ps.link),href:"/dashboard/sdk/licenses",target:"_blank",children:"Studio SDK license page"}),l.jsx("br",{}),l.jsx("br",{}),"If you have any questions or need assistance with specific use cases, please fill out this"," ",l.jsx("a",{className:Z(ps.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),vL=()=>[{id:ht.web,label:cr(ht.web),content:l.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[l.jsx(Q,{icon:W.web,size:oe.s}),l.jsx("span",{children:cr(ht.web)})]})},{id:ht.email,label:cr(ht.email),content:l.jsxs(I,{gap:"s",items:"center",nowrap:!0,children:[l.jsx(Q,{icon:W.emailOutline,size:oe.s}),l.jsx("span",{children:cr(ht.email)})]})}],uc="gs-cmp-tabs";function Ms({tabs:e,className:t,classNamePanel:n,classNameTab:r,variant:s,style:o,onChange:a=$w,value:i}){const c=s==="pills",u=c?M("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",z.bgH):"",d=b=>c?M("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",b?z.bg:""):M("gs-utl-border-b-2",Se.xy),p=b=>{b&&(b.tabIndex=-1)},h=b=>{const v=b.currentTarget;setTimeout(()=>v.blur(),10)},g=Ot(i)?e.findIndex(b=>b.id===i):void 0,m=!e.some(b=>!!b.content);return l.jsxs(Ga.Group,{onChange:b=>a(e[b].id),defaultIndex:e.findIndex(b=>b.id===i),selectedIndex:g,children:[l.jsx(Ga.List,{as:I,className:M(uc,t,u),style:o,full:!0,nowrap:!0,children:e.map(b=>l.jsx(Ga,{disabled:b.disabled,className:({selected:v})=>M(`${uc}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",b.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",Va.focus,d(v),v?`${z.tAo} ${z.bA}`:z.br,r),children:b.label},b.id))}),l.jsx(Ga.Panels,{className:M(`${uc}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(b=>l.jsx(Ga.Panel,{tabIndex:-1,className:M(`${uc}__panel`,"gs-utl-h-full"),ref:p,onFocus:h,children:b.content},b.id))})]})}const dc=0,Ls=1,la=2,qb=4;function yL(e,t){return n=>e(t(n))}function wL(e,t){return t(e)}function Kb(e,t){return n=>e(t,n)}function Zb(e,t){return()=>e(t)}function Np(e,t){return t(e),e}function wo(...e){return e}function SL(e){e()}function Yb(e){return()=>e}function CL(...e){return()=>{e.map(SL)}}function pc(){}function Ut(e,t){return e(Ls,t)}function Nt(e,t){e(dc,t)}function $p(e){e(la)}function ca(e){return e(qb)}function ot(e,t){return Ut(e,Kb(t,dc))}function Xb(e,t){const n=e(Ls,r=>{n(),t(r)});return n}function xt(){const e=[];return(t,n)=>{switch(t){case la:e.splice(0,e.length);return;case Ls:return e.push(n),()=>{const r=e.indexOf(n);r>-1&&e.splice(r,1)};case dc:e.slice().forEach(r=>{r(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function ye(e){let t=e;const n=xt();return(r,s)=>{switch(r){case Ls:s(t);break;case dc:t=s;break;case qb:return t}return n(r,s)}}function xL(e){let t,n;const r=()=>t&&t();return function(s,o){switch(s){case Ls:return o?n===o?void 0:(r(),n=o,t=Ut(e,o),t):(r(),pc);case la:r(),n=null;return;default:throw new Error(`unrecognized action ${s}`)}}}function wi(e){return Np(xt(),t=>ot(e,t))}function ua(e,t){return Np(ye(t),n=>ot(e,n))}function EL(...e){return t=>e.reduceRight(wL,t)}function xe(e,...t){const n=EL(...t);return(r,s)=>{switch(r){case Ls:return Ut(e,n(s));case la:$p(e);return}}}function Jb(e,t){return e===t}function un(e=Jb){let t;return n=>r=>{e(t,r)||(t=r,n(r))}}function jt(e){return t=>n=>{e(n)&&t(n)}}function mt(e){return t=>yL(t,e)}function Ns(e){return t=>()=>t(e)}function fc(e,t){return n=>r=>n(t=e(t,r))}function kp(e){return t=>n=>{e>0?e--:t(n)}}function Si(e){let t=null,n;return r=>s=>{t=s,!n&&(n=setTimeout(()=>{n=void 0,r(t)},e))}}function Qb(e){let t,n;return r=>s=>{t=s,n&&clearTimeout(n),n=setTimeout(()=>{r(t)},e)}}function Er(...e){const t=new Array(e.length);let n=0,r=null;const s=Math.pow(2,e.length)-1;return e.forEach((o,a)=>{const i=Math.pow(2,a);Ut(o,c=>{const u=n;n=n|i,t[a]=c,u!==s&&n===s&&r&&(r(),r=null)})}),o=>a=>{const i=()=>o([a].concat(t));n===s?i():r=i}}function Rb(...e){return function(t,n){switch(t){case Ls:return CL(...e.map(r=>Ut(r,n)));case la:return;default:throw new Error(`unrecognized action ${t}`)}}}function He(e,t=Jb){return xe(e,un(t))}function Xr(...e){const t=xt(),n=new Array(e.length);let r=0;const s=Math.pow(2,e.length)-1;return e.forEach((o,a)=>{const i=Math.pow(2,a);Ut(o,c=>{n[a]=c,r=r|i,r===s&&Nt(t,n)})}),function(o,a){switch(o){case Ls:return r===s&&a(n),Ut(t,a);case la:return $p(t);default:throw new Error(`unrecognized action ${o}`)}}}function Pr(e,t=[],{singleton:n}={singleton:!0}){return{id:PL(),constructor:e,dependencies:t,singleton:n}}const PL=()=>Symbol();function TL(e){const t=new Map,n=({id:r,constructor:s,dependencies:o,singleton:a})=>{if(a&&t.has(r))return t.get(r);const i=s(o.map(c=>n(c)));return a&&t.set(r,i),i};return n(e)}function OL(e,t){const n={},r={};let s=0;const o=e.length;for(;s<o;)r[e[s]]=1,s+=1;for(const a in t)r.hasOwnProperty(a)||(n[a]=t[a]);return n}const hc=typeof document<"u"?f.useLayoutEffect:f.useEffect;function AL(e,t,n){const r=Object.keys(t.required||{}),s=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),a=Object.keys(t.events||{}),i=f.createContext({});function c(w,y){w.propsReady&&Nt(w.propsReady,!1);for(const S of r){const C=w[t.required[S]];Nt(C,y[S])}for(const S of s)if(S in y){const C=w[t.optional[S]];Nt(C,y[S])}w.propsReady&&Nt(w.propsReady,!0)}function u(w){return o.reduce((y,S)=>(y[S]=C=>{const x=w[t.methods[S]];Nt(x,C)},y),{})}function d(w){return a.reduce((y,S)=>(y[S]=xL(w[t.events[S]]),y),{})}const p=f.forwardRef((w,y)=>{const{children:S,...C}=w,[x]=f.useState(()=>Np(TL(e),O=>c(O,C))),[E]=f.useState(Zb(d,x));hc(()=>{for(const O of a)O in C&&Ut(E[O],C[O]);return()=>{Object.values(E).map($p)}},[C,E,x]),hc(()=>{c(x,C)}),f.useImperativeHandle(y,Yb(u(x)));const P=n;return l.jsx(i.Provider,{value:x,children:n?l.jsx(P,{...OL([...r,...s,...a],C),children:S}):S})}),h=w=>f.useCallback(Kb(Nt,f.useContext(i)[w]),[w]),g=w=>{const S=f.useContext(i)[w],C=f.useCallback(x=>Ut(S,x),[S]);return f.useSyncExternalStore(C,()=>ca(S),()=>ca(S))},m=w=>{const S=f.useContext(i)[w],[C,x]=f.useState(Zb(ca,S));return hc(()=>Ut(S,E=>{E!==C&&x(Yb(E))}),[S,C]),C},b=f.version.startsWith("18")?g:m;return{Component:p,usePublisher:h,useEmitterValue:b,useEmitter:(w,y)=>{const C=f.useContext(i)[w];hc(()=>Ut(C,y),[y,C])}}}const ev=typeof document<"u"?f.useLayoutEffect:f.useEffect;var Ip=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Ip||{});const _L={0:"debug",1:"log",2:"warn",3:"error"},ML=()=>typeof globalThis>"u"?window:globalThis,tv=Pr(()=>{const e=ye(3);return{log:ye((n,r,s=1)=>{var o;const a=(o=ML().VIRTUOSO_LOG_LEVEL)!=null?o:ca(e);s>=a&&console[_L[s]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,r)}),logLevel:e}},[],{singleton:!0});function nv(e,t,n){const r=f.useRef(null);let s=o=>{};if(typeof ResizeObserver<"u"){const o=f.useMemo(()=>new ResizeObserver(a=>{requestAnimationFrame(()=>{const c=a[0].target;c.offsetParent!==null&&e(c)})}),[e]);s=a=>{a&&t?(o.observe(a),r.current=a):(r.current&&o.unobserve(r.current),r.current=null)}}return{ref:r,callbackRef:s}}function gc(e,t,n){return nv(e,t).callbackRef}function mc(e,t){return Math.round(e.getBoundingClientRect()[t])}function rv(e,t){return Math.abs(e-t)<1.01}function sv(e,t,n,r=pc,s,o){const a=f.useRef(null),i=f.useRef(null),c=f.useRef(null),u=f.useCallback(h=>{const g=h.target,m=g===window||g===document,b=o?m?window.pageXOffset||document.documentElement.scrollLeft:g.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,v=o?m?document.documentElement.scrollWidth:g.scrollWidth:m?document.documentElement.scrollHeight:g.scrollHeight,w=o?m?window.innerWidth:g.offsetWidth:m?window.innerHeight:g.offsetHeight,y=()=>{e({scrollTop:Math.max(b,0),scrollHeight:v,viewportHeight:w})};h.suppressFlushSync?y():Pn.flushSync(y),i.current!==null&&(b===i.current||b<=0||b===v-w)&&(i.current=null,t(!0),c.current&&(clearTimeout(c.current),c.current=null))},[e,t]);f.useEffect(()=>{const h=s||a.current;return r(s||a.current),u({target:h,suppressFlushSync:!0}),h.addEventListener("scroll",u,{passive:!0}),()=>{r(null),h.removeEventListener("scroll",u)}},[a,u,n,r,s]);function d(h){const g=a.current;if(!g||(o?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=h.behavior==="smooth";let b,v,w;g===window?(v=Math.max(mc(document.documentElement,o?"width":"height"),o?document.documentElement.scrollWidth:document.documentElement.scrollHeight),b=o?window.innerWidth:window.innerHeight,w=o?document.documentElement.scrollLeft:document.documentElement.scrollTop):(v=g[o?"scrollWidth":"scrollHeight"],b=mc(g,o?"width":"height"),w=g[o?"scrollLeft":"scrollTop"]);const y=v-b;if(h.top=Math.ceil(Math.max(Math.min(y,h.top),0)),rv(b,v)||h.top===w){e({scrollTop:w,scrollHeight:v,viewportHeight:b}),m&&t(!0);return}m?(i.current=h.top,c.current&&clearTimeout(c.current),c.current=setTimeout(()=>{c.current=null,i.current=null,t(!0)},1e3)):i.current=null,o&&(h={left:h.top,behavior:h.behavior}),g.scrollTo(h)}function p(h){o&&(h={left:h.top,behavior:h.behavior}),a.current.scrollBy(h)}return{scrollerRef:a,scrollByCallback:p,scrollToCallback:d}}const bc=Pr(()=>{const e=xt(),t=xt(),n=ye(0),r=xt(),s=ye(0),o=xt(),a=xt(),i=ye(0),c=ye(0),u=ye(0),d=ye(0),p=xt(),h=xt(),g=ye(!1),m=ye(!1),b=ye(!1);return ot(xe(e,mt(({scrollTop:v})=>v)),t),ot(xe(e,mt(({scrollHeight:v})=>v)),a),ot(t,s),{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:i,fixedHeaderHeight:c,fixedFooterHeight:u,footerHeight:d,scrollHeight:a,smoothScrollTargetReached:r,horizontalDirection:m,skipAnimationFrameInResizeObserver:b,scrollTo:p,scrollBy:h,statefulScrollTop:s,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),LL=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function NL(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!LL)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const vc="up",Ci="down",$L="none",kL={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},IL=0,ov=Pr(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:r,footerHeight:s,scrollBy:o}])=>{const a=ye(!1),i=ye(!0),c=xt(),u=xt(),d=ye(4),p=ye(IL),h=ua(xe(Rb(xe(He(t),kp(1),Ns(!0)),xe(He(t),kp(1),Ns(!1),Qb(100))),un()),!1),g=ua(xe(Rb(xe(o,Ns(!0)),xe(o,Ns(!1),Qb(200))),un()),!1);ot(xe(Xr(He(t),He(p)),mt(([y,S])=>y<=S),un()),i),ot(xe(i,Si(50)),u);const m=wi(xe(Xr(e,He(n),He(r),He(s),He(d)),fc((y,[{scrollTop:S,scrollHeight:C},x,E,P,O])=>{const A=S+x-C>-O,T={viewportHeight:x,scrollTop:S,scrollHeight:C};if(A){let L,$;return S>y.state.scrollTop?(L="SCROLLED_DOWN",$=y.state.scrollTop-S):(L="SIZE_DECREASED",$=y.state.scrollTop-S||y.scrollTopDelta),{atBottom:!0,state:T,atBottomBecause:L,scrollTopDelta:$}}let _;return T.scrollHeight>y.state.scrollHeight?_="SIZE_INCREASED":x<y.state.viewportHeight?_="VIEWPORT_HEIGHT_DECREASING":S<y.state.scrollTop?_="SCROLLING_UPWARDS":_="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:_,state:T}},kL),un((y,S)=>y&&y.atBottom===S.atBottom))),b=ua(xe(e,fc((y,{scrollTop:S,scrollHeight:C,viewportHeight:x})=>{if(rv(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}),jt(y=>y.changed),mt(y=>y.jump)),0);ot(xe(m,mt(y=>y.atBottom)),a),ot(xe(a,Si(50)),c);const v=ye(Ci);ot(xe(e,mt(({scrollTop:y})=>y),un(),fc((y,S)=>ca(g)?{direction:y.direction,prevScrollTop:S}:{direction:S<y.prevScrollTop?vc:Ci,prevScrollTop:S},{direction:Ci,prevScrollTop:0}),mt(y=>y.direction)),v),ot(xe(e,Si(50),Ns($L)),v);const w=ye(0);return ot(xe(h,jt(y=>!y),Ns(0)),w),ot(xe(t,Si(100),Er(h),jt(([y,S])=>!!S),fc(([y,S],[C])=>[S,C],[0,0]),mt(([y,S])=>S-y)),w),{isScrolling:h,isAtTop:i,isAtBottom:a,atBottomState:m,atTopStateChange:u,atBottomStateChange:c,scrollDirection:v,atBottomThreshold:d,atTopThreshold:p,scrollVelocity:w,lastJumpDueToItemResize:b}},wo(bc)),VL=Pr(([{log:e}])=>{const t=ye(!1),n=wi(xe(t,jt(r=>r),un()));return Ut(t,r=>{r&&ca(e)("props updated",{},Ip.DEBUG)}),{propsReady:t,didMount:n}},wo(tv),{singleton:!0});function av(e,t){e==0?t():requestAnimationFrame(()=>av(e-1,t))}function HL(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}function Vp(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function jL(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const yc="top",wc="bottom",iv="none";function lv(e,t,n){return typeof e=="number"?n===vc&&t===yc||n===Ci&&t===wc?e:0:n===vc?t===yc?e.main:e.reverse:t===wc?e.main:e.reverse}function cv(e,t){return typeof e=="number"?e:e[t]||0}const DL=Pr(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:r,fixedHeaderHeight:s}])=>{const o=xt(),a=ye(0),i=ye(0),c=ye(0),u=ua(xe(Xr(He(e),He(t),He(r),He(o,Vp),He(c),He(a),He(s),He(n),He(i)),mt(([d,p,h,[g,m],b,v,w,y,S])=>{const C=d-y,x=v+w,E=Math.max(h-C,0);let P=iv;const O=cv(S,yc),A=cv(S,wc);return g-=y,g+=h+w,m+=h+w,m-=y,g>d+x-O&&(P=vc),m<d-E+p+A&&(P=Ci),P!==iv?[Math.max(C-h-lv(b,yc,P)-O,0),C-E-w+p+lv(b,wc,P)+A]:null}),jt(d=>d!=null),un(Vp)),[0,0]);return{listBoundary:o,overscan:c,topListHeight:a,increaseViewportBy:i,visibleRange:u}},wo(bc),{singleton:!0}),FL=Pr(([{scrollVelocity:e}])=>{const t=ye(!1),n=xt(),r=ye(!1);return ot(xe(e,Er(r,t,n),jt(([s,o])=>!!o),mt(([s,o,a,i])=>{const{exit:c,enter:u}=o;if(a){if(c(s,i))return!1}else if(u(s,i))return!0;return a}),un()),t),Ut(xe(Xr(t,e,n),Er(r)),([[s,o,a],i])=>s&&i&&i.change&&i.change(o,a)),{isSeeking:t,scrollSeekConfiguration:r,scrollVelocity:e,scrollSeekRangeChanged:n}},wo(ov),{singleton:!0});function BL(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const zL=Pr(([{scrollTo:e,scrollContainerState:t}])=>{const n=xt(),r=xt(),s=xt(),o=ye(!1),a=ye(void 0);return ot(xe(Xr(n,r),mt(([{viewportHeight:i,scrollTop:c,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,c-d),scrollHeight:u,viewportHeight:i}))),t),ot(xe(e,Er(r),mt(([i,{offsetTop:c}])=>({...i,top:i.top+c}))),s),{useWindowScroll:o,customScrollParent:a,windowScrollContainerState:n,windowViewportRect:r,windowScrollTo:s}},wo(bc)),Hp="-webkit-sticky",uv="sticky",dv=BL(()=>{if(typeof document>"u")return uv;const e=document.createElement("div");return e.style.position=Hp,e.style.position===Hp?Hp:uv});function UL(e,t,n){const r=f.useRef(null),s=f.useCallback(c=>{if(c===null||!c.offsetParent)return;const u=c.getBoundingClientRect(),d=u.width;let p,h;if(t){const g=t.getBoundingClientRect(),m=u.top-g.top;p=g.height-Math.max(0,m),h=m+t.scrollTop}else p=window.innerHeight-Math.max(0,u.top),h=u.top+window.pageYOffset;r.current={offsetTop:h,visibleHeight:p,visibleWidth:d},e(r.current)},[e,t]),{callbackRef:o,ref:a}=nv(s,!0),i=f.useCallback(()=>{s(a.current)},[s,a]);return f.useEffect(()=>{if(t){t.addEventListener("scroll",i);const c=new ResizeObserver(()=>{requestAnimationFrame(i)});return c.observe(t),()=>{t.removeEventListener("scroll",i),c.unobserve(t)}}else return window.addEventListener("scroll",i),window.addEventListener("resize",i),()=>{window.removeEventListener("scroll",i),window.removeEventListener("resize",i)}},[i,t]),o}f.createContext(void 0);const pv=f.createContext(void 0);function WL(e){return e}dv();const GL={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},qL={outline:"none",overflowX:"auto",position:"relative"},fv=e=>({width:"100%",height:"100%",position:"absolute",top:0});dv();function So(e,t){if(typeof e!="string")return{context:t}}function KL({usePublisher:e,useEmitter:t,useEmitterValue:n}){return f.memo(function({style:o,children:a,...i}){const c=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("scrollerRef"),h=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:b,scrollToCallback:v}=sv(c,d,u,p,void 0,g);t("scrollTo",v),t("scrollBy",b);const w=g?qL:GL;return l.jsx(u,{ref:m,style:{...w,...o},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...i,...So(u,h),children:a})})}function ZL({usePublisher:e,useEmitter:t,useEmitterValue:n}){return f.memo(function({style:o,children:a,...i}){const c=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),p=n("totalListHeight"),h=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:b,scrollByCallback:v,scrollToCallback:w}=sv(c,d,u,pc,g);return ev(()=>(b.current=g||window,()=>{b.current=null}),[b,g]),t("windowScrollTo",w),t("scrollBy",v),l.jsx(u,{style:{position:"relative",...o,...p!==0?{height:p+h}:{}},"data-virtuoso-scroller":!0,...i,...So(u,m),children:a})})}const hv={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},YL={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:gv,ceil:mv,floor:Sc,min:jp,max:xi}=Math;function XL(e){return{...YL,items:e}}function bv(e,t,n){return Array.from({length:t-e+1}).map((r,s)=>{const o=n===null?null:n[s+e];return{index:s+e,data:o}})}function JL(e,t){return e&&e.column===t.column&&e.row===t.row}function Cc(e,t){return e&&e.width===t.width&&e.height===t.height}const QL=Pr(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:r},{scrollTop:s,viewportHeight:o,scrollBy:a,scrollTo:i,smoothScrollTargetReached:c,scrollContainerState:u,footerHeight:d,headerHeight:p},h,g,{propsReady:m,didMount:b},{windowViewportRect:v,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,windowScrollTo:C},x])=>{const E=ye(0),P=ye(0),O=ye(hv),A=ye({height:0,width:0}),T=ye({height:0,width:0}),_=xt(),L=xt(),$=ye(0),D=ye(null),N=ye({row:0,column:0}),B=xt(),q=xt(),F=ye(!1),k=ye(0),H=ye(!0),V=ye(!1),U=ye(!1);Ut(xe(b,Er(k),jt(([K,ne])=>!!ne)),()=>{Nt(H,!1)}),Ut(xe(Xr(b,H,T,A,k,V),jt(([K,ne,ce,ge,,De])=>K&&!ne&&ce.height!==0&&ge.height!==0&&!De)),([,,,,K])=>{Nt(V,!0),av(1,()=>{Nt(_,K)}),Xb(xe(s),()=>{Nt(n,[0,0]),Nt(H,!0)})}),ot(xe(q,jt(K=>K!=null&&K.scrollTop>0),Ns(0)),P),Ut(xe(b,Er(q),jt(([,K])=>K!=null)),([,K])=>{K&&(Nt(A,K.viewport),Nt(T,K==null?void 0:K.item),Nt(N,K.gap),K.scrollTop>0&&(Nt(F,!0),Xb(xe(s,kp(1)),ne=>{Nt(F,!1)}),Nt(i,{top:K.scrollTop})))}),ot(xe(A,mt(({height:K})=>K)),o),ot(xe(Xr(He(A,Cc),He(T,Cc),He(N,(K,ne)=>K&&K.column===ne.column&&K.row===ne.row),He(s)),mt(([K,ne,ce,ge])=>({viewport:K,item:ne,gap:ce,scrollTop:ge}))),B),ot(xe(Xr(He(E),t,He(N,JL),He(T,Cc),He(A,Cc),He(D),He(P),He(F),He(H),He(k)),jt(([,,,,,,,K])=>!K),mt(([K,[ne,ce],ge,De,ve,Ze,Ge,,bt,tt])=>{const{row:be,column:Je}=ge,{height:Qe,width:dt}=De,{width:Te}=ve;if(Ge===0&&(K===0||Te===0))return hv;if(dt===0){const It=HL(tt,K),ns=Math.max(It+Ge-1,0);return XL(bv(It,ns,Ze))}const it=yv(Te,dt,Je);let nt,Ie;bt?ne===0&&ce===0&&Ge>0?(nt=0,Ie=Ge-1):(nt=it*Sc((ne+be)/(Qe+be)),Ie=it*mv((ce+be)/(Qe+be))-1,Ie=jp(K-1,xi(Ie,it-1)),nt=jp(Ie,xi(0,nt))):(nt=0,Ie=-1);const Wt=bv(nt,Ie,Ze),{top:pe,bottom:Le}=vv(ve,ge,De,Wt),Ne=mv(K/it),St=Ne*Qe+(Ne-1)*be-Le;return{items:Wt,offsetTop:pe,offsetBottom:St,top:pe,bottom:Le,itemHeight:Qe,itemWidth:dt}})),O),ot(xe(D,jt(K=>K!==null),mt(K=>K.length)),E),ot(xe(Xr(A,T,O,N),jt(([K,ne,{items:ce}])=>ce.length>0&&ne.height!==0&&K.height!==0),mt(([K,ne,{items:ce},ge])=>{const{top:De,bottom:ve}=vv(K,ge,ne,ce);return[De,ve]}),un(Vp)),n);const X=ye(!1);ot(xe(s,Er(X),mt(([K,ne])=>ne||K!==0)),X);const Y=wi(xe(He(O),jt(({items:K})=>K.length>0),Er(E,X),jt(([{items:K},ne,ce])=>ce&&K[K.length-1].index===ne-1),mt(([,K])=>K-1),un())),R=wi(xe(He(O),jt(({items:K})=>K.length>0&&K[0].index===0),Ns(0),un())),ee=wi(xe(He(O),Er(F),jt(([{items:K},ne])=>K.length>0&&!ne),mt(([{items:K}])=>({startIndex:K[0].index,endIndex:K[K.length-1].index})),un(jL),Si(0)));ot(ee,g.scrollSeekRangeChanged),ot(xe(_,Er(A,T,E,N),mt(([K,ne,ce,ge,De])=>{const ve=NL(K),{align:Ze,behavior:Ge,offset:bt}=ve;let tt=ve.index;tt==="LAST"&&(tt=ge-1),tt=xi(0,tt,jp(ge-1,tt));let be=Dp(ne,De,ce,tt);return Ze==="end"?be=gv(be-ne.height+ce.height):Ze==="center"&&(be=gv(be-ne.height/2+ce.height/2)),bt&&(be+=bt),{top:be,behavior:Ge}})),i);const te=ua(xe(O,mt(K=>K.offsetBottom+K.bottom)),0);return ot(xe(v,mt(K=>({width:K.visibleWidth,height:K.visibleHeight}))),A),{data:D,totalCount:E,viewportDimensions:A,itemDimensions:T,scrollTop:s,scrollHeight:L,overscan:e,increaseViewportBy:r,scrollBy:a,scrollTo:i,scrollToIndex:_,smoothScrollTargetReached:c,windowViewportRect:v,windowScrollTo:C,useWindowScroll:w,customScrollParent:y,windowScrollContainerState:S,deviation:$,scrollContainerState:u,footerHeight:d,headerHeight:p,initialItemCount:P,gap:N,restoreStateFrom:q,...g,initialTopMostItemIndex:k,horizontalDirection:U,gridState:O,totalListHeight:te,...h,startReached:R,endReached:Y,rangeChanged:ee,stateChanged:B,propsReady:m,stateRestoreInProgress:F,...x}},wo(DL,bc,ov,FL,VL,zL,tv));function vv(e,t,n,r){const{height:s}=n;if(s===void 0||r.length===0)return{top:0,bottom:0};const o=Dp(e,t,n,r[0].index),a=Dp(e,t,n,r[r.length-1].index)+s;return{top:o,bottom:a}}function Dp(e,t,n,r){const s=yv(e.width,n.width,t.column),o=Sc(r/s),a=o*n.height+xi(0,o-1)*t.row;return a>0?a+t.row:a}function yv(e,t,n){return xi(1,Sc((e+n)/(Sc(t)+n)))}const RL=Pr(([e,t])=>({...e,...t}),wo(QL,Pr(()=>{const e=ye(p=>`Item ${p}`),t=ye({}),n=ye(null),r=ye("virtuoso-grid-item"),s=ye("virtuoso-grid-list"),o=ye(WL),a=ye("div"),i=ye(pc),c=(p,h=null)=>ua(xe(t,mt(g=>g[p]),un()),h),u=ye(!1),d=ye(!1);return ot(He(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:o,itemClassName:r,listClassName:s,headerFooterTag:a,scrollerRef:i,FooterComponent:c("Footer"),HeaderComponent:c("Header"),ListComponent:c("List","div"),ItemComponent:c("Item","div"),ScrollerComponent:c("Scroller","div"),ScrollSeekPlaceholder:c("ScrollSeekPlaceholder","div")}}))),eN=f.memo(function(){const t=yt("gridState"),n=yt("listClassName"),r=yt("itemClassName"),s=yt("itemContent"),o=yt("computeItemKey"),a=yt("isSeeking"),i=Hn("scrollHeight"),c=yt("ItemComponent"),u=yt("ListComponent"),d=yt("ScrollSeekPlaceholder"),p=yt("context"),h=Hn("itemDimensions"),g=Hn("gap"),m=yt("log"),b=yt("stateRestoreInProgress"),v=Hn("reportReadyState"),w=gc(f.useMemo(()=>y=>{const S=y.parentElement.parentElement.scrollHeight;i(S);const C=y.firstChild;if(C){const{width:x,height:E}=C.getBoundingClientRect();h({width:x,height:E})}g({row:Sv("row-gap",getComputedStyle(y).rowGap,m),column:Sv("column-gap",getComputedStyle(y).columnGap,m)})},[i,h,g,m]),!0);return ev(()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)},[t]),b?null:l.jsx(u,{ref:w,className:n,...So(u,p),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const S=o(y.index,y.data,p);return a?l.jsx(d,{...So(d,p),index:y.index,height:t.itemHeight,width:t.itemWidth},S):f.createElement(c,{...So(c,p),className:r,"data-index":y.index,key:S},s(y.index,y.data,p))})})}),tN=f.memo(function(){const t=yt("HeaderComponent"),n=Hn("headerHeight"),r=yt("headerFooterTag"),s=gc(f.useMemo(()=>a=>n(mc(a,"height")),[n]),!0),o=yt("context");return t?l.jsx(r,{ref:s,children:l.jsx(t,{...So(t,o)})}):null}),nN=f.memo(function(){const t=yt("FooterComponent"),n=Hn("footerHeight"),r=yt("headerFooterTag"),s=gc(f.useMemo(()=>a=>n(mc(a,"height")),[n]),!0),o=yt("context");return t?l.jsx(r,{ref:s,children:l.jsx(t,{...So(t,o)})}):null}),rN=({children:e})=>{const t=f.useContext(pv),n=Hn("itemDimensions"),r=Hn("viewportDimensions"),s=gc(f.useMemo(()=>o=>{r(o.getBoundingClientRect())},[r]),!0);return f.useEffect(()=>{t&&(r({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,r,n]),l.jsx("div",{style:fv(),ref:s,children:e})},sN=({children:e})=>{const t=f.useContext(pv),n=Hn("windowViewportRect"),r=Hn("itemDimensions"),s=yt("customScrollParent"),o=UL(n,s);return f.useEffect(()=>{t&&(r({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,r]),l.jsx("div",{ref:o,style:fv(),children:e})},oN=f.memo(function({...t}){const n=yt("useWindowScroll"),r=yt("customScrollParent"),s=r||n?lN:iN,o=r||n?sN:rN;return l.jsx(s,{...t,children:l.jsxs(o,{children:[l.jsx(tN,{}),l.jsx(eN,{}),l.jsx(nN,{})]})})}),{Component:aN,usePublisher:Hn,useEmitterValue:yt,useEmitter:wv}=AL(RL,{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"}},oN),iN=KL({usePublisher:Hn,useEmitterValue:yt,useEmitter:wv}),lN=ZL({usePublisher:Hn,useEmitterValue:yt,useEmitter:wv});function Sv(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Ip.WARN),t==="normal"?0:parseInt(t??"0",10)}const xc=aN,Fp=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},cN=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function uN(e){const t=e.map(({id:a,src:i})=>({id:a,src:i})),n=e.reduce((a,i)=>(a[i.id]=i,a),{}),r=[],s=[];return(await Pw(t)).forEach(a=>{a.status==="fulfilled"?r.push(n[a.value]):s.push(n[a.reason])}),{loaded:r,failed:s}}const dN=async e=>{const t=[...e],n={};if(t.length){const r={},s=[];if(t.forEach((o,a)=>{cN(o)&&(r[o.id]={index:a},s.push(o))}),s.length){const{loaded:o}=await uN(s);o.forEach(({id:a,options:i})=>{r[a].loaded=!0,n[a]=i||{}})}Object.keys(r).forEach(o=>{const a=r[o];a.loaded?t[a.index]=o:t[a.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},pN=(e,t,n,r={})=>{const{skipReplace:s}=r;e.loadData(t);const o=e.getCss()||"",a=s?o:o.replace(/:root\s*{/gi,"[data-body]{");let i=`${e.getHtml()}<style>${a}</style>`;if(n===ht.email)try{i=e.runCommand(Ql).html}catch(c){console.error(c)}return r.removeScripts&&(i=i.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),s?i:i.replace("<body","<div data-body").replace("</body>","</div>")},fN=async(e,t,n)=>{const r=ew(t,{appStore:n}),s=await dN(r);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...s.plugins,o=>{o.Storage.setCurrent("")}],pluginsOpts:s.pluginOptions,protectedCss:`
|
|
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:`
|
|
315
304
|
* { box-sizing: border-box; }
|
|
316
305
|
[data-body] {
|
|
317
306
|
margin: 0;
|
|
@@ -329,42 +318,42 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
329
318
|
height: 0px;
|
|
330
319
|
overflow: hidden;
|
|
331
320
|
}
|
|
332
|
-
`})};function Ec({children:e,text:t,onConfirm:n,onCancel:r,className:s="w-[200px]",confirmButtonProps:o={},...a}){const i=_e();return l.jsx(sr,{...a,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:c})=>l.jsxs(I,{className:Z(s),space:"m",col:!0,children:[l.jsx(j,{grow:!0,className:Z("text-center"),children:t||i.t("confirmAction")}),l.jsxs(I,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[l.jsx(Ue,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{c(),n==null||n()},...o,children:o.children||i.t("confirm")}),l.jsx(Ue,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{c(),r==null||r()},children:i.t("cancel")})]})]})})}const Cv=new Map,xv=new Map,hN=async({html:e="",el:t})=>{const n=e,r={};if(document.body.attachShadow){const s=t.shadowRoot||t.attachShadow({mode:"open"});s.innerHTML=n}return r},gN=ie(function({template:t,projectType:n,skipProjectNamePopover:r,className:s,onSelect:o,onRemove:a}){var P;const i=_e(),c=me(),u=c.editor,[d,p]=f.useState(""),h=f.useRef(null),g=i.t("projectManager.projectName"),m=!t.isTemplate&&c.currentProjectId===((P=t.data.custom)==null?void 0:P.id),b=n===ht.web,v=!t.isTemplate||r,w=()=>{v&&(o==null||o({editor:u,template:t,loadTemplate:y}))},y=c.setProject,S=O=>{O.preventDefault(),o({editor:u,template:t,loadTemplate:y})};f.useEffect(()=>{const A=setTimeout(async()=>{if(!h.current||!u)return;const T=`${t.isTemplate?"t-":""}${t.id}`;let _=Cv.get(T);if(!_){let $=xv.get(n);if(!$){const D=new uI({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});$=await fN(u.config.grapesjs,n,D.appEditorStore),xv.set(n,$)}_=$?pN($,t.data,n):"",Cv.set(T,_)}const L=h.current;hN({el:L,html:_})});return()=>clearTimeout(A)},[h,u,n,t.data]);const{media:C,author:x}=t,E=l.jsx(Ue,{className:ae("text-sm"),size:"m2",variant:"pr",onClick:w,disabled:m,children:i.t("select")});return l.jsx(kn,{padding:!1,className:ae("overflow-hidden max-w-full group",s),children:l.jsxs(I,{col:!0,children:[l.jsxs(j,{className:ae("relative group h-36 bg-checker max-w-full"),children:[l.jsx("div",{className:ae("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:C?l.jsx("img",{src:C,alt:t.name,className:ae("max-w-full")}):l.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:h})}),m&&l.jsx(_s,{className:ae("absolute top-2 right-2",z.bgA2),label:i.t("current"),s:"s",pill:!0}),l.jsx(I,{justify:"center",items:"center",className:ae(Ce.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:v?E:l.jsx(sr,{overlay:!0,title:!1,buttonAs:"span",handler:E,children:()=>l.jsx("form",{onSubmit:S,children:l.jsxs(I,{space:"m",col:!0,children:[l.jsx(j,{children:l.jsx(Xe,{size:"s",value:d,onChange:p,placeholder:g,required:!0})}),l.jsx(j,{children:l.jsx(Ue,{type:"submit",variant:"pr",size:"m2",full:!0,children:i.t("load")})})]})})})})]}),l.jsxs(I,{className:ae("gjs-p-2 max-w-full",J.bt,z.br),col:!0,space:"s",children:[l.jsxs(I,{className:ae("text-sm w-full"),space:"s",nowrap:!0,children:[l.jsx(j,{className:ae(Ce.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!x&&l.jsxs(j,{children:["by"," ",l.jsx("a",{className:ae(ps.link),href:x.link,rel:"noreferrer",target:"_blank",children:x.name})]})]}),l.jsxs(I,{items:"center",children:[b&&l.jsxs(j,{className:ae("gjs-mr-auto"),children:[i.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&a&&l.jsx(j,{className:ae("gjs-ml-auto"),children:l.jsx(Ec,{onConfirm:()=>a(t),className:"",children:l.jsx(ft,{title:i.t("delete"),children:l.jsx(Q,{icon:W.delete,size:oe.sx})})})})]})]})]})})}),Ev=ie(function({templates:e,projectType:t,content:n,skipProjectNamePopover:r,onSelect:s,onRemove:o}){const[a]=ap(),c=_e().tScoped("templates"),d=me().editor,p=Fp(n==null?void 0:n.itemsPerRow),h=s??(({template:g,loadTemplate:m})=>m(g));return l.jsx(l.Fragment,{children:d&&e?e.length===0?l.jsx(I,{justify:"center",children:c("notFound")}):l.jsx(xc,{data:e,listClassName:ae("grid gap-2 gjs-pr-2",p),itemContent:(g,m)=>l.jsx(gN,{template:m,projectType:t,onSelect:h,onRemove:o,skipProjectNamePopover:r},m.id)},a):l.jsx(ro,{})})}),mN=ie(function(){var b;const t=me(),n=Nm(),{filteredTemplates:r,projectSourceFilter:s,projectTypeFilter:o}=n,a=_e(),i=ra(),{sdkOptions:c}=t,u=a.tScoped("projectManager"),d=async({loadTemplate:v,template:w})=>{v(w),i.close()},p=async v=>{n.setProjectTypeFilter(v),await n.loadAllTemplates()},h=v=>{n.removeProject(v.id),n.loadProjects()},g=f.useMemo(()=>[{id:ti.Existing,label:u("existentProjects")},{id:ti.Templates,label:u("templates")}],[a]),m=((b=c.project)==null?void 0:b.types)&&pu();return f.useEffect(()=>{n.loadAllTemplates()},[]),l.jsxs(I,{col:!0,full:!0,space:"m",children:[m&&l.jsx(I,{items:"center",space:"m",children:l.jsx(j,{className:ae("gjs-ml-auto"),children:l.jsx(Ee,{value:o,onChange:p,options:vL(),handlerSelected:v=>l.jsxs(l.Fragment,{children:[l.jsx("b",{children:u("projectType")}),": ",v.label]})})})}),l.jsx(j,{children:l.jsx(Ms,{tabs:g,value:s,onChange:n.setProjectSourceFilter})}),l.jsx(j,{grow:!0,children:l.jsx(Ev,{templates:r,projectType:ht[o],onSelect:d,onRemove:h,content:{itemsPerRow:3}})})]})}),bN=({items:e,editor:t,customItems:n})=>n===!1?[]:Ke(n)?n({items:e,editor:t}):n||e,Pv=e=>({icon:W.plus,size:oe.s,className:Z("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),Tv=e=>!e.type||e.type==="button",vN="gs-cmp-topbar-left",yN=ie(function({buttons:t,className:n,style:r}){const s=me(),o=_e(),{isOpen:a,toggleOpen:i}=FA(),c=s.editor,d=o.tScoped("blockManager")("blocks"),p=bN({items:[{id:`blocks-${d}`,tooltip:d,size:vb.s,icon:Pv(a),variant:bb.primary,editorEvents:{[hn.toggleBlocksPanel]:({fromEvent:h,setState:g})=>{g({icon:Pv(h.isOpen)})}},onClick:()=>i()}],customItems:t,editor:c});return l.jsx(I,{gap:"s",items:"center",justify:"start",className:Z(vN,Se.xS,n),style:r,nowrap:!0,children:p.map(({id:h,...g})=>Tv(g)?l.jsx(rc,{...g},h):Tt({id:h,...g}))})}),wN=[{id:ss.auto,label:"Auto"},{id:ss.dark,label:"Dark"},{id:ss.light,label:"Light"}],SN={size:"s"},Bp=".grapesjs",CN=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},xN=({actions:e,editor:t,buttons:n,sdkOptions:r})=>{const s=r.actions;return s===!1?[]:Ke(s)?s({actions:e,editor:t}):s||(n?Ke(n)?n({items:e,editor:t}):n:e)},EN="gs-cmp-topbar-right",PN=ie(function({editor:t,className:n,buttons:r,...s}){const o=me(),{theme:a,setTheme:i}=Cr(),{Commands:c,UndoManager:u}=t,{installEvent:d,appInstalled:p,isBrowserMode:h,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:b}=o,v=ra(),w=_e(),y=L=>w.t(`actions.${L}`),S=t.Storage.events,C=c.events,x="change:changesCount",E=(L,$)=>()=>{Ke(L)?L({editor:t}):c.isActive(L)?c.stop(L):c.run(L,$)},P=L=>({[`${C.runCommand}${L}`]:({setState:$})=>$({active:!0}),[`${C.stopCommand}${L}`]:({setState:$})=>$({active:!1})}),O=[{id:tr.componentOutline,icon:W.borderRadius,tooltip:y("componentOutline.title"),onClick:E("core:component-outline"),editorEvents:P("core:component-outline")},{id:tr.preview,icon:W.eye,tooltip:y("preview.title"),onClick:E("core:preview"),editorEvents:P("core:preview")},{id:tr.fullscreen,icon:W.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:E("core:fullscreen",{target:"body"}),editorEvents:P("core:fullscreen")},{id:tr.showCode,icon:W.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(re.dialogExportCode)},{id:tr.showImportCode,icon:W.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>v.open({title:y("importCode.title"),content:()=>l.jsx(Sb,{})})},{id:tr.clearCanvas,icon:W.delete,tooltip:y("clearCanvas.title"),onClick:()=>v.confirm({title:y("clearCanvas.title"),content:y("clearCanvas.content"),confirmButton:{variant:"danger",children:y("clearCanvas.title")},onConfirm:()=>{b?t.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):t.Components.clear()}})},{id:tr.store,tooltip:y("store.title"),onClick:async()=>!o.isSaving&&t.store(),editorEvents:{"change:changesCount":({setState:L})=>L({}),[S.startStore]:({setState:L})=>L({disabled:!0}),[S.endStore]:({setState:L})=>L({disabled:!1})},label:()=>l.jsxs("div",{className:Z("relative"),children:[l.jsx(Q,{icon:W.floppy,size:oe.s}),!!t.getDirtyCount()&&!o.isSaving&&l.jsx("div",{className:Z("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",z.bg),children:l.jsx("div",{className:Z(Ce.dot,z.bgW)})}),o.isSaving&&l.jsx("div",{className:Z("absolute right-0 bottom-0 gjs-rounded-full",z.bg),children:l.jsx(Q,{icon:W.refresh,size:"11px",className:Z(Ce.spin)})})]})},{id:tr.undo,icon:W.arrowULeftTop,disabled:!0,onClick:E("core:undo"),editorEvents:{[x]:({setState:L})=>L({disabled:!u.hasUndo()})}},{id:tr.redo,icon:W.arrowURightTop,disabled:!0,onClick:E("core:redo"),editorEvents:{[x]:({setState:L})=>L({disabled:!u.hasRedo()})}}],A=xN({actions:O,sdkOptions:m,editor:t,buttons:r}),T=[{id:"about",label:y("about.title"),icon:W.helpCircle,action:()=>v.open({size:"m",title:y("about.title"),content:()=>l.jsx(mL,{})})},{id:"embed",label:y("embed.title"),icon:W.powerPlug,action:()=>v.open({size:"m",title:y("embed.title"),content:()=>l.jsx(bL,{})})},{id:"openProject",label:y("open.title"),icon:W.folder,action:async()=>{let L="";try{L=await(await RM({extensions:[Bp]})).text()}catch($){return console.error($)}o.loadProjectData(JSON.parse(L))}},{id:"saveProject",label:y("save.title"),icon:W.contentSave,action:async()=>{const L=t.getProjectData(),$=new Blob([JSON.stringify(L)]),D=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await tL($,{fileName:`${D}${Bp}`,extensions:[Bp]})}catch(N){return console.error(N)}}},{id:"loadProject",label:y("newProject.title"),icon:W.newspaperVariantOutline,action:()=>v.open({fullH:!0,title:y("newProject.title"),content:()=>l.jsx(mN,{})})},{id:"installApp",label:y(p?"installApp.installed":"installApp.title"),icon:W.applicationBracketsOutline,action:async()=>{if(p)return;d==null||d.prompt();const L=await(d==null?void 0:d.userChoice);(L==null?void 0:L.outcome)==="accepted"&&g()}},...m.customTheme?[]:[{id:"theme",label:l.jsxs(I,{items:"center",space:"m",children:[l.jsx(j,{children:"Theme"}),l.jsx(j,{children:l.jsx(Ms,{tabs:wN,onChange:L=>i(L),value:a,variant:"pills"})})]})}]].filter(({id:L})=>!((!h||!d)&&L==="installApp"||!CN(m,L))),_=(L,$)=>D=>{Ke(L)&&(L(D),$())};return l.jsxs(I,{space:"s",items:"center",justify:"end",className:Z(EN,Se.xS,n),nowrap:!0,...s,children:[A.map(({id:L,...$})=>Tv($)?l.jsx(rc,{size:"s",...$},L):Tt({id:L,...$})),l.jsx(j,{children:m.settingsMenu!==!1&&T.length>0&&l.jsx(sr,{placement:"bottom-end",title:!1,padding:!1,handler:l.jsx(Q,{icon:W.cog,size:oe.s}),buttonProps:SN,overlay:!0,children:({close:L})=>l.jsx(l.Fragment,{children:T.map($=>l.jsx(ia,{action:_($.action,L),icon:$.icon,label:$.label},$.id))})})})]})});function TN({devices:e,selected:t,className:n,style:r,select:s}){const o=e.map(a=>({id:a.id,label:a.getName(),icon:a.attributes.icon}));return o.length?l.jsx(Ee,{size:"xs",className:n,style:r,value:t,options:o,onChange:s}):null}const ON="gs-devices",Ov=f.memo(function({className:t,style:n}){return l.jsx(kM,{children:r=>l.jsx(TN,{className:M(ON,t),style:n,...r})})}),Ei="gs-cmp-editor-topbar",AN=ie(function({className:t,height:n,style:r,children:s,leftContainer:o,rightContainer:a,devices:i}){const{topBarSize:c,isInPreview:u,editor:d,isTopSidebarOpen:p}=me(),h=n??c,g=f.useMemo(()=>({...r,minHeight:h,marginTop:u||!p?`-${h}px`:0}),[u,p,r]);return l.jsxs(l.Fragment,{children:[l.jsx(j,{className:M(Ei,"gs-utl-transition-spacing gs-utl-w-full",J.bb,z.br,t),style:g,children:s??l.jsxs(I,{className:M(`${Ei}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[l.jsx(j,{className:M(`${Ei}__wrp-left`),grow:!0,children:o!==!1&&l.jsx(yN,{...o})}),l.jsx(j,{className:M(`${Ei}__wrp-center`),children:i!==!1&&l.jsx(Ov,{...i})}),l.jsx(j,{className:M(`${Ei}__wrp-right`),grow:!0,children:a!==!1&&d&&l.jsx(PN,{editor:d,...a})})]})}),l.jsx(j,{className:M("gs-utl-transition-transform gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-z-10",!u&&"-gs-utl-translate-y-full"),children:l.jsx(Ue,{className:M("gs-cmp-close-preview gs-utl-m-4",z.bg),size:"s",onClick:()=>d==null?void 0:d.Commands.stop("core:preview"),children:l.jsx(Q,{icon:W.eyeOff,size:oe.s})})})]})}),_N="gs-sidebar-top",Av=f.memo(ie(function({height:t,children:n,...r}){return l.jsx(AN,{height:t,...r,style:ac(r),className:M(_N,"gs-utl-flex",oc(r)),children:n?Tt(n):void 0})})),MN="gs-canvas-sidebar-top",LN=f.memo(ie(function({className:t,sidebarTop:n,...r}){return l.jsxs(cn,{className:M(MN,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...r,children:[l.jsx(Av,{...n}),l.jsx(Ub,{grow:!0})]})})),NN="gs-code-field",$N=ie(function(e){const{editor:t}=me(),{isDarkTheme:n}=Cr(),{editorEvents:r,onChange:s}=e,[o,a]=f.useState(()=>e),i=u=>({value:u,editor:t,state:o,setState:d=>a(p=>({...p,...d}))}),c=u=>s==null?void 0:s(i(u||""));return Fs({editor:t,editorEvents:r,localState:o,setLocalState:a}),l.jsx(Yr,{className:M(NN,o.className),language:o.language,style:o.style,label:o.label,name:o.name,defaultValue:o.value,size:o.size,required:o.required,disabled:o.disabled,readOnly:o.readOnly,minHeight:o.minHeight,row:o.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:c})});var kN={grad:.9,turn:360,rad:360/(2*Math.PI)},Jr=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},$t=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},jn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},_v=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Mv=function(e){return{r:jn(e.r,0,255),g:jn(e.g,0,255),b:jn(e.b,0,255),a:jn(e.a)}},zp=function(e){return{r:$t(e.r),g:$t(e.g),b:$t(e.b),a:$t(e.a,3)}},IN=/^#([0-9a-f]{3,8})$/i,Pc=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Lv=function(e){var t=e.r,n=e.g,r=e.b,s=e.a,o=Math.max(t,n,r),a=o-Math.min(t,n,r),i=a?o===t?(n-r)/a:o===n?2+(r-t)/a:4+(t-n)/a:0;return{h:60*(i<0?i+6:i),s:o?a/o*100:0,v:o/255*100,a:s}},Nv=function(e){var t=e.h,n=e.s,r=e.v,s=e.a;t=t/360*6,n/=100,r/=100;var o=Math.floor(t),a=r*(1-n),i=r*(1-(t-o)*n),c=r*(1-(1-t+o)*n),u=o%6;return{r:255*[r,i,a,a,c,r][u],g:255*[c,r,r,i,a,a][u],b:255*[a,a,c,r,r,i][u],a:s}},$v=function(e){return{h:_v(e.h),s:jn(e.s,0,100),l:jn(e.l,0,100),a:jn(e.a)}},kv=function(e){return{h:$t(e.h),s:$t(e.s),l:$t(e.l),a:$t(e.a,3)}},Iv=function(e){return Nv((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},Pi=function(e){return{h:(t=Lv(e)).h,s:(s=(200-(n=t.s))*(r=t.v)/100)>0&&s<200?n*r/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,n,r,s},VN=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,HN=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,jN=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,DN=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Up={string:[[function(e){var t=IN.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?$t(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?$t(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=jN.exec(e)||DN.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Mv({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=VN.exec(e)||HN.exec(e);if(!t)return null;var n,r,s=$v({h:(n=t[1],r=t[2],r===void 0&&(r="deg"),Number(n)*(kN[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Iv(s)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,r=e.b,s=e.a,o=s===void 0?1:s;return Jr(t)&&Jr(n)&&Jr(r)?Mv({r:Number(t),g:Number(n),b:Number(r),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,n=e.s,r=e.l,s=e.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(n)||!Jr(r))return null;var a=$v({h:Number(t),s:Number(n),l:Number(r),a:Number(o)});return Iv(a)},"hsl"],[function(e){var t=e.h,n=e.s,r=e.v,s=e.a,o=s===void 0?1:s;if(!Jr(t)||!Jr(n)||!Jr(r))return null;var a=function(i){return{h:_v(i.h),s:jn(i.s,0,100),v:jn(i.v,0,100),a:jn(i.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(o)});return Nv(a)},"hsv"]]},Vv=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]},FN=function(e){return typeof e=="string"?Vv(e.trim(),Up.string):typeof e=="object"&&e!==null?Vv(e,Up.object):[null,void 0]},Wp=function(e,t){var n=Pi(e);return{h:n.h,s:jn(n.s+100*t,0,100),l:n.l,a:n.a}},Gp=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Hv=function(e,t){var n=Pi(e);return{h:n.h,s:n.s,l:jn(n.l+100*t,0,100),a:n.a}},qp=function(){function e(t){this.parsed=FN(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 $t(Gp(this.rgba),2)},e.prototype.isDark=function(){return Gp(this.rgba)<.5},e.prototype.isLight=function(){return Gp(this.rgba)>=.5},e.prototype.toHex=function(){return t=zp(this.rgba),n=t.r,r=t.g,s=t.b,a=(o=t.a)<1?Pc($t(255*o)):"","#"+Pc(n)+Pc(r)+Pc(s)+a;var t,n,r,s,o,a},e.prototype.toRgb=function(){return zp(this.rgba)},e.prototype.toRgbString=function(){return t=zp(this.rgba),n=t.r,r=t.g,s=t.b,(o=t.a)<1?"rgba("+n+", "+r+", "+s+", "+o+")":"rgb("+n+", "+r+", "+s+")";var t,n,r,s,o},e.prototype.toHsl=function(){return kv(Pi(this.rgba))},e.prototype.toHslString=function(){return t=kv(Pi(this.rgba)),n=t.h,r=t.s,s=t.l,(o=t.a)<1?"hsla("+n+", "+r+"%, "+s+"%, "+o+")":"hsl("+n+", "+r+"%, "+s+"%)";var t,n,r,s,o},e.prototype.toHsv=function(){return t=Lv(this.rgba),{h:$t(t.h),s:$t(t.s),v:$t(t.v),a:$t(t.a,3)};var t},e.prototype.invert=function(){return Tr({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),Tr(Wp(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),Tr(Wp(this.rgba,-t))},e.prototype.grayscale=function(){return Tr(Wp(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),Tr(Hv(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),Tr(Hv(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"?Tr({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):$t(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=Pi(this.rgba);return typeof t=="number"?Tr({h:t,s:n.s,l:n.l,a:n.a}):$t(n.h)},e.prototype.isEqual=function(t){return this.toHex()===Tr(t).toHex()},e}(),Tr=function(e){return e instanceof qp?e:new qp(e)},jv=[],BN=function(e){e.forEach(function(t){jv.indexOf(t)<0&&(t(qp,Up),jv.push(t))})};function zN(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 s in n)r[n[s]]=s;var o={};e.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var i,c,u=r[this.toHex()];if(u)return u;if(a!=null&&a.closest){var d=this.toRgb(),p=1/0,h="black";if(!o.length)for(var g in n)o[g]=new e(n[g]).toRgb();for(var m in n){var b=(i=d,c=o[m],Math.pow(i.r-c.r,2)+Math.pow(i.g-c.g,2)+Math.pow(i.b-c.b,2));b<p&&(p=b,h=m)}return h}},t.string.push([function(a){var i=a.toLowerCase(),c=i==="transparent"?"#0000":n[i];return c?new e(c).toRgb():null},"name"])}function Tc(){return(Tc=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 Dv(e,t){if(e==null)return{};var n,r,s={},o=Object.keys(e);for(r=0;r<o.length;r++)t.indexOf(n=o[r])>=0||(s[n]=e[n]);return s}function Kp(e){var t=f.useRef(e),n=f.useRef(function(r){t.current&&t.current(r)});return t.current=e,n.current}var da=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},Ti=function(e){return"touches"in e},Zp=function(e){return e&&e.ownerDocument.defaultView||self},Fv=function(e,t,n){var r=e.getBoundingClientRect(),s=Ti(t)?function(o,a){for(var i=0;i<o.length;i++)if(o[i].identifier===a)return o[i];return o[0]}(t.touches,n):t;return{left:da((s.pageX-(r.left+Zp(e).pageXOffset))/r.width),top:da((s.pageY-(r.top+Zp(e).pageYOffset))/r.height)}},Bv=function(e){!Ti(e)&&e.preventDefault()},Yp=f.memo(function(e){var t=e.onMove,n=e.onKey,r=Dv(e,["onMove","onKey"]),s=f.useRef(null),o=Kp(t),a=Kp(n),i=f.useRef(null),c=f.useRef(!1),u=f.useMemo(function(){var g=function(v){Bv(v),(Ti(v)?v.touches.length>0:v.buttons>0)&&s.current?o(Fv(s.current,v,i.current)):b(!1)},m=function(){return b(!1)};function b(v){var w=c.current,y=Zp(s.current),S=v?y.addEventListener:y.removeEventListener;S(w?"touchmove":"mousemove",g),S(w?"touchend":"mouseup",m)}return[function(v){var w=v.nativeEvent,y=s.current;if(y&&(Bv(w),!function(C,x){return x&&!Ti(C)}(w,c.current)&&y)){if(Ti(w)){c.current=!0;var S=w.changedTouches||[];S.length&&(i.current=S[0].identifier)}y.focus(),o(Fv(y,w,i.current)),b(!0)}},function(v){var w=v.which||v.keyCode;w<37||w>40||(v.preventDefault(),a({left:w===39?.05:w===37?-.05:0,top:w===40?.05:w===38?-.05:0}))},b]},[a,o]),d=u[0],p=u[1],h=u[2];return f.useEffect(function(){return h},[h]),f.createElement("div",Tc({},r,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:s,onKeyDown:p,tabIndex:0,role:"slider"}))}),Oc=function(e){return e.filter(Boolean).join(" ")},Xp=function(e){var t=e.color,n=e.left,r=e.top,s=r===void 0?.5:r,o=Oc(["react-colorful__pointer",e.className]);return f.createElement("div",{className:o,style:{top:100*s+"%",left:100*n+"%"}},f.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},en=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},zv=function(e){var t=e.s,n=e.v,r=e.a,s=(200-t)*n/100;return{h:en(e.h),s:en(s>0&&s<200?t*n/100/(s<=100?s:200-s)*100:0),l:en(s/2),a:en(r,2)}},Jp=function(e){var t=zv(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Qp=function(e){var t=zv(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},UN=function(e){var t=e.h,n=e.s,r=e.v,s=e.a;t=t/360*6,n/=100,r/=100;var o=Math.floor(t),a=r*(1-n),i=r*(1-(t-o)*n),c=r*(1-(1-t+o)*n),u=o%6;return{r:en(255*[r,i,a,a,c,r][u]),g:en(255*[c,r,r,i,a,a][u]),b:en(255*[a,a,c,r,r,i][u]),a:en(s,2)}},WN=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?GN({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}},GN=function(e){var t=e.r,n=e.g,r=e.b,s=e.a,o=Math.max(t,n,r),a=o-Math.min(t,n,r),i=a?o===t?(n-r)/a:o===n?2+(r-t)/a:4+(t-n)/a:0;return{h:en(60*(i<0?i+6:i)),s:en(o?a/o*100:0),v:en(o/255*100),a:s}},qN=f.memo(function(e){var t=e.hue,n=e.onChange,r=Oc(["react-colorful__hue",e.className]);return f.createElement("div",{className:r},f.createElement(Yp,{onMove:function(s){n({h:360*s.left})},onKey:function(s){n({h:da(t+360*s.left,0,360)})},"aria-label":"Hue","aria-valuenow":en(t),"aria-valuemax":"360","aria-valuemin":"0"},f.createElement(Xp,{className:"react-colorful__hue-pointer",left:t/360,color:Jp({h:t,s:100,v:100,a:1})})))}),KN=f.memo(function(e){var t=e.hsva,n=e.onChange,r={backgroundColor:Jp({h:t.h,s:100,v:100,a:1})};return f.createElement("div",{className:"react-colorful__saturation",style:r},f.createElement(Yp,{onMove:function(s){n({s:100*s.left,v:100-100*s.top})},onKey:function(s){n({s:da(t.s+100*s.left,0,100),v:da(t.v-100*s.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+en(t.s)+"%, Brightness "+en(t.v)+"%"},f.createElement(Xp,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Jp(t)})))}),ZN=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},YN=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function XN(e,t,n){var r=Kp(n),s=f.useState(function(){return e.toHsva(t)}),o=s[0],a=s[1],i=f.useRef({color:t,hsva:o});f.useEffect(function(){if(!e.equal(t,i.current.color)){var u=e.toHsva(t);i.current={hsva:u,color:t},a(u)}},[t,e]),f.useEffect(function(){var u;ZN(o,i.current.hsva)||e.equal(u=e.fromHsva(o),i.current.color)||(i.current={hsva:o,color:u},r(u))},[o,e,r]);var c=f.useCallback(function(u){a(function(d){return Object.assign({},d,u)})},[]);return[o,c]}var JN=typeof window<"u"?f.useLayoutEffect:f.useEffect,QN=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},Uv=new Map,RN=function(e){JN(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!Uv.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}`,Uv.set(t,n);var r=QN();r&&n.setAttribute("nonce",r),t.head.appendChild(n)}},[])},e$=function(e){var t=e.className,n=e.hsva,r=e.onChange,s={backgroundImage:"linear-gradient(90deg, "+Qp(Object.assign({},n,{a:0}))+", "+Qp(Object.assign({},n,{a:1}))+")"},o=Oc(["react-colorful__alpha",t]),a=en(100*n.a);return f.createElement("div",{className:o},f.createElement("div",{className:"react-colorful__alpha-gradient",style:s}),f.createElement(Yp,{onMove:function(i){r({a:i.left})},onKey:function(i){r({a:da(n.a+i.left)})},"aria-label":"Alpha","aria-valuetext":a+"%","aria-valuenow":a,"aria-valuemin":"0","aria-valuemax":"100"},f.createElement(Xp,{className:"react-colorful__alpha-pointer",left:n.a,color:Qp(n)})))},t$=function(e){var t=e.className,n=e.colorModel,r=e.color,s=r===void 0?n.defaultColor:r,o=e.onChange,a=Dv(e,["className","colorModel","color","onChange"]),i=f.useRef(null);RN(i);var c=XN(n,s,o),u=c[0],d=c[1],p=Oc(["react-colorful",t]);return f.createElement("div",Tc({},a,{ref:i,className:p}),f.createElement(KN,{hsva:u,onChange:d}),f.createElement(qN,{hue:u.h,onChange:d}),f.createElement(e$,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},n$={defaultColor:"rgba(0, 0, 0, 1)",toHsva:WN,fromHsva:function(e){var t=UN(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:YN},r$=function(e){return f.createElement(t$,Tc({},e,{colorModel:n$}))};BN([zN]);const s$=e=>e.startsWith("rgba")?e:Tr(e).toRgbString();function Wv({value:e,onChange:t,disabled:n}){const r=s$(e||""),s=f.useRef(r),[o,a]=f.useState(!1),i=lr()&&!!window.EyeDropper,c=g=>{s.current=g,t==null||t(g)},u=g=>{s.current=g,t==null||t(g,!0)},d=()=>{i&&new window.EyeDropper().open().then(m=>c(m.sRGBHex)).catch(console.warn)},p=()=>{a(!0)},h=()=>{t==null||t(s.current,!1),a(!1)};return l.jsxs(l.Fragment,{children:[o&&l.jsx("div",{onPointerUp:h,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),l.jsx(r$,{className:"color-picker",color:r,onChange:u,onPointerDown:p,onPointerUp:h}),l.jsxs(I,{className:"gs-utl-mt-3",gap:"s",children:[l.jsx(j,{grow:!0,children:l.jsx(Xe,{size:"s",value:r,onChange:c,disabled:n})}),i&&l.jsx(Ue,{type:"button",onClick:d,children:l.jsx(Q,{icon:W.eyedropperVariant,size:oe.s})})]})]})}const o$="gs-cmp-studio-color-picker",a$=f.memo(ie(function({className:t,style:n,value:r="",disabled:s,onChange:o,editorEvents:a}){const{editor:i}=me(),[c,u]=f.useState(()=>({className:t,style:n,value:r,disabled:s})),d=(p,h)=>{const g=p||"";o==null||o({value:g,partial:h,editor:i,state:c,setState:m=>u(b=>({...b,...m}))})};return Fs({editor:i,editorEvents:a,localState:c,setLocalState:u}),l.jsx("div",{className:M(o$,c.className,Se.m),style:c.style,children:l.jsx(Wv,{value:c.value||"",onChange:d,disabled:c.disabled})})})),i$="gs-cmp-column",l$=f.memo(function({className:t,children:n,full:r,...s}){return l.jsx(cn,{className:M(i$,z.bg,"gs-utl-flex gs-utl-flex-col",r&&"gs-utl-h-full",t),...s,children:Tt(n)})}),Rp=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
333
|
-
<path fill="currentColor" d="M20 6c0-2.168-3.663-4-8-4S4 3.832 4 6v2c0 2.168 3.663 4 8 4s8-1.832 8-4zm-8 13c-4.337 0-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4v-3c0 2.168-3.663 4-8 4"/><path fill="currentColor" d="M20 10c0 2.168-3.663 4-8 4s-8-1.832-8-4v3c0 2.168 3.663 4 8 4s8-1.832 8-4z"/></svg>`,Co="--before-content",ef={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},Gv={stylable:!1,traits:[]};function c$(e){return typeof e=="object"&&e.type===Lt.variable}function qv(e){if(c$(e)){const{path:t}=e;return Kv(t||"")}return e}function Kv(e){return`{{ ${e} }}`}function u$(e){const t={};return e.DataSources.getAll().forEach(n=>{const r=n.get("id");if(!r)return;const s=n.getRecords();if(!s){t[r]={};return}t[r]=s.reduce((o,a)=>{if(!a)return o;let i={...a.attributes};return delete i.__p,delete i.id,r===yo.globalStyles&&(i={value:i.value}),{...o,[a.id]:i}},{})}),t}function Zv(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const tf=e=>{var o,a;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((a=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:a.skipTags)??t?{...Gv}:{}},nf=e=>{var o,a;const{isProjectTypeEmail:t,sdkOptions:n}=e,r=(a=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:a.skipTags;return t||r===!0?{...Gv}:{}},d$=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,p$=e=>Array.isArray(e)?"array":e===null?"default":typeof e,f$=ie(({name:e,value:t,isActive:n,isCollection:r,onClick:s,className:o})=>{const a=_e().tScoped("dataSources"),i=typeof t=="object"&&t!==null,c={array:W.codeBrackets,object:W.codeBraces,string:W.codeString,number:W.number,boolean:W.toggleSwitchOffOutline,default:W.null},u=p$(t),d=M(o,"gs-utl-text-left",z.hBgH,J.b,J.rnd,Se.xy,n?[J.bA,z.tA]:[z.br,z.txtHighEmphasisH]),p=h=>typeof h=="object"?Array.isArray(h)?a("items",{params:{length:h.length}}):h?a("properties",{params:{length:Object.keys(h).length}}):"null":String(h);return l.jsx(Ue,{onClick:s,border:!1,className:d,full:!0,children:l.jsxs(I,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[l.jsxs(I,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[l.jsxs(I,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[l.jsx(Q,{icon:c[u],size:oe.s}),l.jsx(j,{className:M(Ce.txtEllips,r&&"gs-utl-font-bold"),children:e})]}),l.jsx(j,{className:M("gs-utl-w-full",Ce.txtEllips,Ce.disabled),children:p(t)})]}),i&&l.jsx(j,{children:l.jsx(Q,{size:oe.sx,icon:W.arrowRight,className:M(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),h$="gs-cmp-data-path-explorer",Yv=ie(function({additionalSources:t,onChange:n,path:r=""}){const{editor:s}=me(),o=f.useRef({}),[a,i]=f.useState(()=>r.split(".")),[c,u]=f.useState([]),d=f.useMemo(()=>({...s?u$(s):{},...t}),[s,t]),p=(b,v)=>{let w=o.current;for(let y=0;y<v&&y<b.length;y++){const S=b[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=b.slice(0,v).concat(y),x=a[v]===y,E=v===0&&Ir(S)&&S.collectionId===y,P=()=>{const O=x?C.slice(0,-1):C;n==null||n(O.join("."),{paths:O}),i(O)};return l.jsx(f$,{className:M(E&&"-gs-utl-order-1"),isCollection:E,name:y,value:S,isActive:x,onClick:P},y)})};f.useEffect(()=>{o.current=d;const b=[];for(let v=0;v<=a.length;v++){const w=p(a,v);w.length>0&&b.push(w)}u(b)},[d,a]);const h=M(h$,z.bg,z.br,J.b,J.rnd,Ce.scrollX,"gs-utl-h-full"),g=M("gs-utl-min-w-[220px]",z.br),m=M("gs-utl-h-full gs-utl-max-h-[60vh]",Ce.scrollY,Se.xyS);return l.jsx(I,{className:h,full:!0,nowrap:!0,children:c.map((b,v)=>l.jsx(j,{className:M(g,v!==c.length-1&&J.br),children:l.jsx(I,{col:!0,nowrap:!0,gap:"m",className:m,children:b})},v))})});function Xv(e){const{collectionId:t,variableType:n,path:r=""}=e;return t?[t,n,r].filter(Boolean).join("."):r}function rf(e,t){const[n="",r="",...s]=e.split(".");return n&&t[n]?{collectionId:n,variableType:r,path:s.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const g$=e=>{const{path:t,collectionId:n,variableType:r}=e.dataResolver||{};return n?[n,r,t].filter(Boolean).join("."):e.value||t||""},m$=e=>{const{dataResolver:t,editor:n,value:r,defaultValue:s,additionalSources:o}=e,{path:a="",collectionId:i,variableType:c}=t||{},u=n==null?void 0:n.DataSources;if(i){const d=o==null?void 0:o[i],p=c&&d?d[c]:d;return(u==null?void 0:u.getValue(a,s,{context:p}))||""}else return(u==null?void 0:u.getValue(r,s))||""},b$="gs-cmp-data-path-field",Oi=ie(e=>{const{size:t="m",value:n="",label:r,open:s,defaultValue:o,additionalSources:a,dataResolver:i,readOnly:c,disabled:u,pickerInPopover:d,onChange:p,onPickerToggle:h}=e,{editor:g}=me(),m=_e().tScoped("dataSources"),[b,v]=f.useState(!!s),[w,y]=f.useState(!1),S=!!c||b||w,C=()=>y(!w),x=F=>{const k=F??!b;v(k),h==null||h(k)},E=()=>x(!1),P=(...F)=>{p==null||p(...F)},O=F=>{S||p==null||p(F,{paths:F.split(".")})},A=g$({dataResolver:i,value:n}),T=w&&g?`"${m$({editor:g,dataResolver:i,additionalSources:a,value:n,defaultValue:o})}"`:A,_=t==="m",L=_?"lg":t,$=_?oe.l:oe.s,D=m(b?"closePathExplorer":"openPathExplorer"),N={icon:b?W.close:W.databaseOutline,size:oe.l},B={icon:w?W.eyeOff:W.eye,size:_?oe.m:$},q=l.jsx(ft,{block:!0,variant:"pr",size:L,title:D,onClick:()=>x(),icon:N});return l.jsxs(I,{className:b$,gap:t,col:!0,children:[l.jsxs(I,{gap:t,items:"end",nowrap:!0,children:[l.jsx(Xe,{readOnly:S,label:r,value:w?T:A,size:t,disabled:u,onChange:O,placeholder:m("selectVariablePath"),className:M("gs-utl-flex-grow",z.txt,Ce.txtEllips),afterInput:!!n&&l.jsx(ft,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:C,className:Ce.hover,icon:B})}),d?l.jsx(sr,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:q,onClose:E,overlay:!0,children:l.jsx(Yv,{path:A,onChange:P,additionalSources:a})}):q]}),!!b&&!d&&l.jsx(Yv,{path:A,onChange:P,additionalSources:a})]})}),v$=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},Jv=({value:e,step:t})=>{const n=parseFloat(`${e}`);let r=0;if(Math.floor(n)!==n&&t){const s=`${t}`.split(".")[1];r=(s==null?void 0:s.length)||0}return r?parseFloat(n.toFixed(r)):n},y$=({value:e,key:t,shiftKey:n,min:r,max:s,step:o=1})=>{const a=t==="ArrowUp",i=t==="ArrowDown";let c=null;if(a||i){c=Number(e);const u=parseFloat(`${o}`);a&&(c+=(n?10:1)*u),i&&(c-=(n?10:1)*u),c=`${Ac({min:r,max:s,value:c})}`,c=Jv({value:c,step:o})}return c},Ac=({min:e,max:t,value:n})=>{const r=parseFloat(`${n}`);let s=r||0;return Ot(e)&&(s=Math.max(s,parseFloat(`${e}`)||0)),Ot(t)&&(s=Math.min(s,parseFloat(`${t}`)||0)),`${`${r}`!=`${n}`?n:s}`},w$=(e,t,n,r={})=>{const s=parseInt(`${e}`,10)||0,{min:o,max:a,step:i=1}=r;let c=s;const u=p=>{const h=p.clientY-t,g=s-h*parseFloat(`${i}`);c=Jv({value:Ac({min:o,max:a,value:g}),step:i}),n(c,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(c)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},S$=(e,t,n={})=>{const{partial:r}=n,s=(o,a)=>o===a||r&&o.startsWith(a);return t.some(o=>s(typeof o=="string"?o:o.id,e))},Qv=e=>Ot(e)?e:"",C$="gs-cmp-number-field";function Oe(e){const{className:t,value:n,units:r,valueUnit:s,size:o="m",pan:a=!0,min:i,max:c,step:u,placeholder:d,disabled:p,onChange:h,onChangeUnit:g}=e,[m,b]=f.useState(Qv(n)),[v,w]=f.useState(!1),y=(r==null?void 0:r.map(A=>({id:A,label:A})))||[],S={min:i,max:c,step:u};f.useEffect(()=>{b(Qv(n))},[n,s]);const C=(A,T)=>{h==null||h(Ac({min:i,max:c,value:A}),T)},x=A=>{if(p)return;w(!0);const T=(_,L)=>{C(_,!!L),!L&&w(!1)};w$(m,A.clientY,T,S)},E=A=>{const{key:T,shiftKey:_}=A;switch(T){case"Escape":return b(n);case"Enter":return C(m)}const L=y$({step:u,value:n,key:T,shiftKey:_});L!==null&&(A.preventDefault(),C(L))},P=()=>{C(m)},O=Os({...e,className:M(C$,t)});return l.jsxs("div",{...O,children:[v&&l.jsx("div",{className:M("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),l.jsx(nr,{as:e.labelAs,...e}),l.jsxs(I,{className:xp(e),items:"center",space:"x2s",children:[!!a&&l.jsx(j,{onMouseDown:x,className:M("gs-utl-opacity-50 gs-utl-cursor-ns",o==="m"&&"-gs-utl-ml-3",o==="s"&&"-gs-utl-ml-2",a!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:a===!0?l.jsx(Q,{icon:W.panVertical,size:oe.s2x}):a}),l.jsx(j,{grow:!0,children:l.jsx("input",{className:bi(e),value:m,disabled:p,onChange:A=>b(A.target.value),placeholder:d,onBlur:P,onKeyDown:E})}),!!y.length&&l.jsx(j,{className:M(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:l.jsx(Ee,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:s,disabled:p,onChange:A=>g==null?void 0:g(A),options:y})})]})]})}const x$="gs-cmp-switch-field";function Ai(e){const{className:t,value:n,label:r,labelAs:s,border:o,disabled:a,onChange:i}=e,c=!!n,u=M("gs-utl-relative gs-utl-inline-flex gs-utl-items-center gs-utl-h-6 gs-utl-rounded-full gs-utl-w-11 gs-utl-transition-colors focus:gs-utl-outline-none",c?z.bgA:z.bgH,Va.focus,o&&`${z.br} ${J.b}`);return l.jsx(Md.Group,{children:l.jsxs(I,{items:"center",className:M(x$,t),full:!0,children:[!!r&&l.jsx(Md.Label,{as:s,className:M("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:l.jsx(nr,{...e,as:"span"})}),l.jsx(Md,{checked:c,onChange:i,className:u,disabled:a,children:l.jsx("span",{className:M(z.bg,"gs-utl-inline-block gs-utl-w-4 gs-utl-h-4 gs-utl-transform gs-utl-rounded-full gs-utl-transition-transform",c?"gs-utl-translate-x-6":"gs-utl-translate-x-1")})})]})})}function sf(e){var a;const[t,n]=f.useState(((a=e.getDataResolver)==null?void 0:a.call(e))??{}),r=f.useRef(t),s=i=>{const c={...r.current,...i};r.current=c,n(c)},o=()=>{e.setDataResolver(r.current)};return f.useEffect(()=>{const i="change:dataResolver",c=()=>{const u=e.getDataResolver();n(u)};return e.on(i,c),()=>{e.off(i,c)}},[e]),{localData:t,updateLocalData:s,syncToComponent:o}}const E$="gs-cmp-data-collection-picker",P$=ie(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:s}=sf(e),{collectionId:o="",dataSource:a={},startIndex:i=0,endIndex:c=10}=n,u=Xv(a),d=c===Number.MAX_VALUE,p=_e().tScoped("dataSources"),h=d?"":c,g=()=>{s(),t==null||t({value:n})},m=y=>r({dataSource:{...a,path:y}}),b=y=>r({startIndex:y}),v=y=>r({endIndex:y}),w=y=>r({endIndex:y?Number.MAX_VALUE:4});return l.jsxs(I,{className:E$,gap:"s",col:!0,nowrap:!0,children:[l.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[l.jsx(Xe,{className:"gs-utl-flex-grow",size:"s",label:p("collectionId"),value:o,readOnly:!0,disabled:!0}),l.jsx(Eb,{size:"s",value:o,block:!0})]}),l.jsx(Oi,{label:p("variablePath"),value:u,onChange:m,dataResolver:n}),l.jsxs(I,{items:"end",gap:"s",nowrap:!0,children:[l.jsx(Oe,{size:"s",className:"gs-utl-flex-grow",label:p("collectionStartIndex"),value:i==null?void 0:i.toString(),onChange:b}),l.jsx(Oe,{size:"s",label:p("collectionEndIndex"),placeholder:d?"-":"",value:h==null?void 0:h.toString(),onChange:v,className:M("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),l.jsx(j,{children:l.jsx(Ai,{label:p("collectionUpToEndIndex"),value:d,onChange:w})})]}),l.jsx(I,{full:!0,justify:"end",children:l.jsx(Ue,{onClick:g,variant:"pr",size:"m",children:p("confirm")})})]})}),T$="gs-data-collection-picker",O$=ie(function({className:t,component:n,onConfirm:r,...s}){return l.jsx(cn,{className:M(T$,t),...s,children:l.jsx(P$,{component:n,onConfirm:r})})});var Sn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Sn||{}),Cn=(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))(Cn||{}),of=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(of||{}),af=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(af||{});const A$=[...Object.values(af),...Object.values(of),...Object.values(Cn)],lf={string:Object.values(af),number:Object.values(of),dataSource:A$},_$=f.memo(function(t){const{additionalSources:n,side:r,type:s,value:o,onChange:a}=t;switch(s){case Sn.DATA_SOURCE:return l.jsx(Oi,{size:"s",pickerInPopover:!0,value:Xv(o),onChange:i=>a(r,i,s),additionalSources:n});case Sn.NUMBER:return l.jsx(Oe,{size:"s",value:o,onChange:i=>a(r,i,s)});default:return l.jsx(Xe,{size:"s",value:o,onChange:i=>a(r,i,s)})}}),M$="gs-cmp-statement-side",Rv=f.memo(function({side:t,type:n,value:r,label:s,onChange:o,onTypeChange:a,additionalSources:i,typeOptions:c}){return l.jsxs(I,{className:M(M$,"gs-utl-flex-grow"),col:!0,children:[l.jsx(Ts,{size:"s",children:s}),l.jsxs(I,{items:"center",gap:"xs",children:[l.jsx(j,{children:l.jsx(Ee,{size:"s",value:n,options:c,onChange:u=>a(t,u)})}),l.jsx(j,{grow:!0,children:l.jsx(_$,{additionalSources:i,side:t,type:n,value:r,onChange:o})})]})]})}),_c=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Sn.DATA_SOURCE:typeof e=="string"?Sn.STRING:typeof e=="number"?Sn.NUMBER:Sn.STRING,L$=(e,t,n)=>{switch(t){case Sn.STRING:return e||"";case Sn.NUMBER:return e?Number(e):0;case Sn.DATA_SOURCE:{const r=n||{};return{type:"data-variable",...(et(e)?rf(e,r):e)??{path:"",defaultValue:""}}}default:return e}},N$=e=>lf[e][0],$$=e=>![Cn.isTruthy,Cn.isFalsy,Cn.isDefined,Cn.isNull,Cn.isUndefined,Cn.isArray,Cn.isObject,Cn.isString,Cn.isNumber,Cn.isBoolean,Cn.isDefaultValue].includes(e),k$="gs-cmp-statement",I$=ie(e=>{const{statement:t,onChange:n,className:r,additionalSources:s}=e,o=_e().tScoped("dataSources"),[a,i]=f.useState(()=>_c(t.left)),[c,u]=f.useState(()=>_c(t.right)),d=lf[a]||lf[Sn.STRING],p=f.useMemo(()=>Object.values(Sn).map(C=>({id:C,label:cr(C)})),[]),h=f.useMemo(()=>d.map(C=>({id:C,label:o(`operators.${C}`)})),[d,o]);f.useEffect(()=>{i(_c(t.left)),u(_c(t.right))},[t.left,t.right]);const g=C=>{n({...t,...C})},m=(C,x,E)=>{const P=L$(x,E,s),O=C==="left",A=O&&E!==Sn.DATA_SOURCE;O?i(E):u(E),g({[C]:P,...A&&{operator:N$(E)}})},b=(C,x)=>m(C,null,x),v=C=>g({operator:C}),w=M(k$,r,z.br,J.b,J.rnd,Se.xy),y=$$(t.operator),S={additionalSources:s,onChange:m,onTypeChange:b,typeOptions:p};return l.jsx(I,{className:M(w,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:l.jsxs(I,{gap:"m",items:"center",full:!0,nowrap:!0,children:[l.jsx(Rv,{side:"left",type:a,value:t.left,label:o("leftValue"),...S}),l.jsx(j,{children:l.jsx(Ee,{size:"s",label:o("operator"),value:t.operator,options:h,onChange:v})}),y&&l.jsx(Rv,{side:"right",type:c,value:t.right,label:o("rightValue"),...S})]})})}),cf="gs-cmp-statements-group",V$=e=>e==="and"||e==="or",Mc=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),e0=ie(e=>{const{className:t,condition:n,onUpdate:r,additionalSources:s,skipAddCondition:o}=e,a=_e().tScoped("dataSources"),i=n.statements??[],c=n.logicalOperator||"and",u=m=>{V$(m)&&r({...n,logicalOperator:m})},d=()=>{Mc(n),r(Mc(n))},p=m=>{const b=i.filter((v,w)=>w!==m);r({...n,statements:b})},h=(m,b)=>{if(m>=0&&m<i.length){const v=[...i];v[m]=b,r({...n,statements:v})}},g=[{id:"and",label:a("conditionAnd")},{id:"or",label:a("conditionOr")}];return l.jsxs(I,{className:M(cf,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[i.length>1&&l.jsx(Ms,{value:c,onChange:u,tabs:g}),l.jsx(I,{className:`${cf}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:i.map((m,b)=>l.jsxs(I,{className:M(`${cf}__item`),gap:"s",col:!0,children:[l.jsx(I$,{additionalSources:s,statement:m,onChange:v=>h(b,v)}),b<i.length-1&&l.jsxs(I,{justify:"center",items:"center",gap:"m",children:[l.jsx("span",{className:M(z.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:c.toUpperCase()}),l.jsx(ft,{block:!0,variant:"out-clear",title:a("deleteCondition"),onClick:()=>p(b+1),icon:{icon:W.delete,size:oe.s}})]})]},`stmt-${b}`))}),!o&&l.jsx(I,{justify:"end",children:l.jsx(Ue,{variant:"pr",onClick:d,icon:{icon:W.plus,size:oe.s},children:a("addCondition")})})]})}),H$="gs-cmp-data-condition-picker",j$=ie(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:s}=sf(e),o=_e().tScoped("dataSources"),a=n.condition,i=d=>r({condition:d}),c=()=>{s(),t==null||t({value:n})},u=()=>{r({condition:Mc(a)})};return l.jsxs(I,{className:H$,items:"stretch",gap:"m",full:!0,col:!0,children:[l.jsx(e0,{additionalSources:e.collectionsStateMap??{},condition:a,onUpdate:i,skipAddCondition:!0}),l.jsxs(I,{gap:"m",justify:"end",full:!0,children:[l.jsx(Ue,{variant:"out",onClick:u,icon:{icon:W.plus,size:oe.s},children:o("addCondition")}),l.jsx(Ue,{onClick:c,variant:"pr",size:"m",children:o("confirm")})]})]})}),D$="gs-data-condition-picker",F$=ie(function({className:t,component:n,onConfirm:r,...s}){return l.jsx(cn,{className:M(D$,t),...s,children:l.jsx(j$,{component:n,onConfirm:r})})}),B$="gs-data-path-field",z$=ie(({className:e,value:t="",onChange:n,...r})=>l.jsx(cn,{className:M(B$,e),...r,children:l.jsx(Oi,{onChange:s=>n({value:s}),value:t})})),Lc={type:"data-variable",path:"",defaultValue:""},t0={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function $s(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const n0="gs-cmp-dynamic-value-picker",U$=ie(({value:e,onChange:t,onConfirm:n,additionalSources:r})=>{const[s,o]=f.useState(()=>$s(e)?e:Lc),[a,i]=f.useState(s.type),c=_e().tScoped("dataSources");f.useEffect(()=>{const S=$s(e)?e:Lc;(S.type!==s.type||JSON.stringify(S)!==JSON.stringify(s))&&(o(S),i(S.type))},[e]);const u=S=>{o(S),t==null||t({value:S})},d=S=>{const C=S;i(C);const x=s.type===C?s:C==="data-variable"?Lc:t0;u(x)},p=S=>{u({type:"data-variable",defaultValue:s.defaultValue,...rf(S,r)})},h=S=>{o(C=>{const x={...C,defaultValue:S};return t==null||t({value:x}),x})},g=S=>{u({...s,condition:S})},m=(S,C)=>{u({...s,[S]:C})},b=()=>{const S=s.condition;g(Mc(S))},v=[{id:"data-variable",label:c("variable")},{id:"data-condition",label:c("condition")}],w=(s==null?void 0:s.type)==="data-variable"?s:Lc,y=(s==null?void 0:s.type)==="data-condition"?s:t0;return l.jsxs(I,{className:n0,gap:"s",col:!0,nowrap:!0,children:[l.jsxs(I,{className:n0,gap:"m",col:!0,nowrap:!0,full:!0,children:[l.jsx(Ms,{value:a,onChange:d,tabs:v}),l.jsx(j,{grow:!0,className:Se.y,style:{overflowY:"auto",overflowX:"hidden"},children:a==="data-variable"?l.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[l.jsx(Oi,{value:w.path,label:c("variablePath"),additionalSources:r,defaultValue:w.defaultValue,onChange:p}),l.jsx(Xe,{label:c("defaultValue"),value:w.defaultValue||"",onChange:h})]}):l.jsxs(I,{gap:"m",col:!0,children:[l.jsx(e0,{additionalSources:r,condition:y.condition,onUpdate:g,skipAddCondition:!0}),l.jsxs(I,{gap:"s",col:!0,nowrap:!0,children:[l.jsx(Xe,{label:c("ifTrue"),value:y.ifTrue,onChange:S=>m("ifTrue",S)}),l.jsx(Xe,{label:c("ifFalse"),value:y.ifFalse,onChange:S=>m("ifFalse",S)})]})]})}),a==="data-condition"&&l.jsx(I,{full:!0,justify:"end",className:Se.x,children:l.jsx(Ue,{variant:"out",onClick:b,icon:{icon:W.plus,size:oe.s},children:c("addCondition")})})]}),l.jsx(I,{full:!0,justify:"end",className:Se.y,children:l.jsx(Ue,{onClick:()=>{n==null||n({value:s})},variant:"pr",size:"m",children:c("confirm")})})]})}),W$="gs-data-value-picker",G$=ie(({className:e,value:t={},onChange:n,onConfirm:r,additionalSources:s={},...o})=>l.jsx(cn,{className:M(W$,e),...o,children:l.jsx(U$,{value:t,onConfirm:a=>r==null?void 0:r(a),onChange:a=>n==null?void 0:n(a),additionalSources:s})})),q$="gs-cmp-data-variable-picker",K$=ie(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:r,syncToComponent:s}=sf(e),o=_e().tScoped("dataSources"),{path:a="",defaultValue:i=""}=n,c=e.collectionsStateMap,u=h=>{r(rf(h,c))},d=()=>{s(),t==null||t({value:n})},p=h=>r({defaultValue:h});return l.jsxs(I,{className:q$,gap:"s",col:!0,nowrap:!0,children:[l.jsx(Oi,{value:a,label:o("variablePath"),dataResolver:n,additionalSources:c,defaultValue:i,onChange:u}),l.jsx(Xe,{label:o("defaultValue"),value:i,onChange:p}),l.jsx(I,{full:!0,justify:"end",className:Se.y,children:l.jsx(Ue,{onClick:d,variant:"pr",size:"m",children:o("confirm")})})]})}),Z$="gs-data-variable-picker",Y$=ie(function({className:t,component:n,onConfirm:r,...s}){return l.jsx(cn,{className:M(Z$,t),...s,children:l.jsx(K$,{component:n,onConfirm:r})})}),X$="gs-cmp-input-field",J$=f.memo(ie(function({className:t,style:n,label:r,name:s,value:o,size:a,disabled:i,inputType:c,readOnly:u,required:d,placeholder:p,onChange:h,onInput:g,editorEvents:m}){const{editor:b}=me(),[v,w]=f.useState(()=>({className:t,style:n,label:r,name:s,value:o,size:a,readOnly:u,disabled:i,required:d,placeholder:p})),y=x=>({value:x,editor:b,state:v,setState:E=>w(P=>({...P,...E}))}),S=x=>h==null?void 0:h(y(x)),C=x=>g==null?void 0:g(y(x));return Fs({editor:b,editorEvents:m,localState:v,setLocalState:w}),l.jsx(Xe,{type:c,className:M(X$,v.className),style:v.style,label:v.label,name:v.name,value:v.value,size:v.size,required:v.required,disabled:v.disabled,readOnly:v.readOnly,placeholder:v.placeholder,onChange:S,onInput:C})})),Q$="gs-menu-list",R$=ie(function({className:e,items:t,onItemClick:n,...r}){const{editor:s}=me(),[o,a]=f.useState(),i=u=>{const{onClick:d}=u;if(d&&s)return p=>d({item:u,editor:s,...p})},c=()=>{if(n&&s)return u=>n({...u,editor:s})};return l.jsx(cn,{className:M(Q$,z.bg,"gs-utl-flex gs-utl-flex-col",e),...r,children:(t||[]).map((u,d)=>f.createElement(ia,{...u,label:u.layout?Tt(u.layout):u.label,key:u.id??d,className:u.className,action:i(u),onActive:()=>a(u),onItemClick:c(),active:o===u,items:u.items}))})});function ek({children:e,accept:t,onChange:n,multiple:r=!0,...s}){const o=_e(),a=f.useRef(null),i=()=>{const{current:c}=a;c&&(c.value="",c.click())};return l.jsxs(l.Fragment,{children:[l.jsx("input",{className:Z("hidden"),ref:a,type:"file",multiple:r,accept:t,onChange:n}),l.jsx(Ue,{variant:"pr",size:"m2",...s,onClick:i,children:e||o.t("upload")})]})}const tk=ie(ek),nk=ie(function({editor:t,assetProps:n,itemLayout:r,onSelect:s,onRemove:o}){const a=ii();return Tt(r({asset:ls(a.toAsset(n)),assetProps:ls(n),onSelect:i=>s(a.toAssetProps(i)),onDelete:o&&(i=>o(a.toAssetProps(i))),editor:t}))}),rk="gs-cmp-asset-card",sk=ie(function(t){var p;const{assetProps:n,onSelect:r,onRemove:s,className:o,itemLayout:a}=t,i=_e(),{editor:c}=me();if(a)return c?l.jsx(nk,{...t,editor:c,itemLayout:a}):null;const{src:u}=n,d=n.name||((p=u.split("/").pop())==null?void 0:p.split("?").shift());return l.jsx(kn,{padding:!1,className:ae(rk,"overflow-hidden max-w-full group",o),children:l.jsxs(I,{col:!0,children:[l.jsxs(j,{className:ae("relative group h-24 cursor-pointer bg-checker"),onClick:()=>r(n),children:[l.jsx("div",{className:ae("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),l.jsx(I,{justify:"center",items:"center",className:ae(Ce.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:l.jsx(Ue,{className:ae("text-sm"),size:"m2",variant:"pr",children:i.t("select")})})]}),l.jsxs(I,{className:ae("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[l.jsx(j,{className:ae(Ce.txtEllips,"text-sm gjs-mr-auto"),children:d}),s&&l.jsx(Ec,{onConfirm:()=>s==null?void 0:s(n),text:l.jsxs(I,{col:!0,space:"m",items:"stretch",children:[l.jsx("p",{className:ae("text-center",z.txtHighEmphasis),children:i.t("assetManager.deleteConfirmQuestion")}),l.jsx("p",{className:ae("text-center"),children:i.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:l.jsx(ft,{title:i.t("delete"),children:l.jsx(Q,{icon:W.delete,size:oe.sx})})})]})]})})}),Or="gs-asset-manager",ok={search:!0,addUrl:!0,upload:!0},ak=ie(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:r,typeFilter:s,providerFilter:o,searchValue:a,isLoading:i,optionalType:c,optionalProvider:u,useLocalSearch:d,itemLayout:p,content:h,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:b,onChangeSearchValue:v,onChangeUpload:w,onAddUrl:y,onRemove:S,onEndReached:C,layoutAfterHeader:x}){const E=me(),{editor:P}=E,O=_e(),[A]=ap(),T=Fp(h==null?void 0:h.itemsPerRow),[_,L]=f.useState(""),$=(h==null?void 0:h.header)===!1?!1:{...ok,...Ir(h==null?void 0:h.header)?h.header:{}};if(!P)return;const D=d?t.filter(N=>!(a&&!_o(N.src,a)&&!_o(N.name??"",a))):t;return l.jsxs(I,{className:Z(Or,"relative gs-utl-h-full",i&&Ce.disabled),nowrap:!0,col:!0,space:"m",children:[$!==!1&&l.jsxs(I,{className:`${Or}__header`,gap:"m",justify:"between",items:"center",children:[l.jsxs(I,{className:`${Or}__header-filters`,items:"center",gap:"m",children:[$.search&&l.jsx(j,{children:l.jsx(Xe,{className:`${Or}__search-filter`,size:"m",type:"search",value:a,onInput:v,placeholder:`${O.t("search")}...`})}),n.length>(c?0:1)&&l.jsx(j,{children:l.jsx(Ee,{className:Z(`${Or}__type-filter`,"items-center"),size:"m",options:n,value:s,onChange:m,emptyState:O.t("assetManager.assetTypes.all"),includeEmpty:c})}),r.length>(u?0:1)&&l.jsx(j,{children:l.jsx(Ee,{classNameContainer:Z(`${Or}__provider-filter`,"items-center"),size:"m",options:r.map(N=>({...N,label:Ke(N.label)?N.label({editor:P}):N.label,icon:N.icon})),value:o,onChange:b,emptyState:O.t("assetManager.noProvider"),includeEmpty:u})})]}),l.jsxs(I,{className:`${Or}__header-buttons`,items:"center",gap:"m",children:[$.upload&&l.jsx(j,{children:l.jsx(tk,{className:`${Or}__upload-field`,onChange:w})}),$.addUrl&&!!y&&l.jsx(j,{children:l.jsx(sr,{className:`${Or}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:l.jsx(Ue,{variant:"pr",size:"m2",children:O.t("assetManager.addUrl")}),children:({close:N})=>l.jsxs(I,{gap:"m",children:[l.jsx(j,{children:l.jsx(Xe,{type:"url",size:"s",value:_,onChange:L,placeholder:O.t("assetManager.inputPlh")})}),l.jsx(j,{children:l.jsx(Ue,{variant:"pr",size:"m2",onClick:()=>{y(_),N()},children:O.t("add")})})]})})})]}),x&&l.jsx(l.Fragment,{children:Tt(x({editor:P}))})]}),l.jsx(I,{className:Z(`${Or}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!i&&!D.length?l.jsx(I,{justify:"center",children:O.t("noItems")}):!!A&&l.jsx(xc,{data:D,listClassName:Z("gs-utl-grid gs-utl-gap-2",T),endReached:C,itemContent:(N,B)=>l.jsx(sk,{assetProps:B,onSelect:g,onRemove:S,itemLayout:p},B.id),components:{Footer:C?ik:void 0}})}),i&&l.jsx(ro,{abs:!0})]})}),ik=()=>l.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),lk=ie(function({panelId:t,content:n,assets:r,types:s,providers:o,typeId:a,providerId:i,optionalType:c,optionalProvider:u,onSelect:d,close:p,layoutAfterHeader:h}){const{appEditorStore:g,i18nStore:m}=pn(),{editor:b}=g,v=ii(),{customOnLoad:w}=v,y=_m(t);f.useEffect(()=>{const P=A=>et(A)?{id:A,label:m.t(`assetManager.assetTypes.${A}`)||A}:A;y.setCustomTypes(s==null?void 0:s.map(P)),y.setCustomProviders(et(o)?[o]:o),a?y.setTypeFilter(a):y.initTypeFilter(),i?y.setProviderFilter(i):y.initProviderFilter(),Ot(c)?y.setOptionalType(c):y.initOptionalType(),Ot(u)?y.setOptionalProvider(u):y.initOptionalProvider();const O=setTimeout(()=>y.loadAssets());return()=>clearTimeout(O)},[s,o,a,i,c,u]);const S=P=>{v.addToProjectAssets([{id:P,src:P,type:y.typeFilter??ho.image}])},C=P=>{b&&(d==null||d({asset:v.toAsset(P),assetProps:P,editor:b}),p==null||p())},x=r==null?void 0:r.map(v.toAssetProps),E=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return l.jsx(ak,{assetProps:x??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:P=>{y.setTypeFilter(P),y.loadAssets()},onChangeProviderFilter:P=>{y.setProviderFilter(P),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:C,onAddUrl:w?void 0:S,onChangeUpload:P=>v.uploadFile(P.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:h})});var ck=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},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)}}(),Pt=function(){return Pt=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Pt.apply(this,arguments)},r0={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},s0={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Nc={width:"20px",height:"20px",position:"absolute"},uk={top:Pt(Pt({},r0),{top:"-5px"}),right:Pt(Pt({},s0),{left:void 0,right:"-5px"}),bottom:Pt(Pt({},r0),{top:void 0,bottom:"-5px"}),left:Pt(Pt({},s0),{left:"-5px"}),topRight:Pt(Pt({},Nc),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Pt(Pt({},Nc),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Pt(Pt({},Nc),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Pt(Pt({},Nc),{left:"-10px",top:"-10px",cursor:"nw-resize"})},dk=function(e){ck(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 Ye.createElement("div",{className:this.props.className||"",style:Pt(Pt({position:"absolute",userSelect:"none"},uk[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(Ye.PureComponent),pk=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,s){r.__proto__=s}||function(r,s){for(var o in s)Object.prototype.hasOwnProperty.call(s,o)&&(r[o]=s[o])},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)}}(),Ar=function(){return Ar=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++){t=arguments[n];for(var s in t)Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s])}return e},Ar.apply(this,arguments)},fk={width:"auto",height:"auto"},$c=function(e,t,n){return Math.max(Math.min(e,n),t)},o0=function(e,t,n){var r=Math.round(e/t);return r*t+n*(r-1)},pa=function(e,t){return new RegExp(e,"i").test(t)},kc=function(e){return!!(e.touches&&e.touches.length)},hk=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},a0=function(e,t,n){n===void 0&&(n=0);var r=t.reduce(function(o,a,i){return Math.abs(a-e)<Math.abs(t[o]-e)?i:o},0),s=Math.abs(t[r]-e);return n===0||s<n?t[r]:e},uf=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"},Ic=function(e,t,n,r){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var s=Number(e.replace("%",""))/100;return t*s}if(e.endsWith("vw")){var s=Number(e.replace("vw",""))/100;return n*s}if(e.endsWith("vh")){var s=Number(e.replace("vh",""))/100;return r*s}}return e},gk=function(e,t,n,r,s,o,a){return r=Ic(r,e.width,t,n),s=Ic(s,e.height,t,n),o=Ic(o,e.width,t,n),a=Ic(a,e.height,t,n),{maxWidth:typeof r>"u"?void 0:Number(r),maxHeight:typeof s>"u"?void 0:Number(s),minWidth:typeof o>"u"?void 0:Number(o),minHeight:typeof a>"u"?void 0:Number(a)}},mk=function(e){return Array.isArray(e)?e:[e,e]},bk=["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"],i0="__resizable_base__",vk=function(e){pk(t,e);function t(n){var r,s,o,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 c=i.parentNode;if(!c)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(i0):u.className+=i0,c.appendChild(u),u},i.removeBase=function(c){var u=i.parentNode;u&&u.removeChild(c)},i.state={isResizing:!1,width:(s=(r=i.propsSize)===null||r===void 0?void 0:r.width)!==null&&s!==void 0?s:"auto",height:(a=(o=i.propsSize)===null||o===void 0?void 0:o.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||fk},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,r=0;if(this.resizable&&this.window){var s=this.resizable.offsetWidth,o=this.resizable.offsetHeight,a=this.resizable.style.position;a!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:s,r=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:o,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,s=function(i){var c;if(typeof n.state[i]>"u"||n.state[i]==="auto")return"auto";if(n.propsSize&&n.propsSize[i]&&(!((c=n.propsSize[i])===null||c===void 0)&&c.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 uf(n.state[i])},o=r&&typeof r.width<"u"&&!this.state.isResizing?uf(r.width):s("width"),a=r&&typeof r.height<"u"&&!this.state.isResizing?uf(r.height):s("height");return{width:o,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,s=this.parentNode.style.flexWrap;s!=="wrap"&&(r=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var o={width:n.offsetWidth,height:n.offsetHeight};return r&&(this.parentNode.style.flexWrap=s),this.removeBase(n),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,r){var s=this.propsSize&&this.propsSize[r];return this.state[r]==="auto"&&this.state.original[r]===n&&(typeof s>"u"||s==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,r){var s=this.props.boundsByDirection,o=this.state.direction,a=s&&pa("left",o),i=s&&pa("top",o),c,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(c=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&&(c=a?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=i?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(c=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 c&&Number.isFinite(c)&&(n=n&&n<c?n:c),u&&Number.isFinite(u)&&(r=r&&r<u?r:u),{maxWidth:n,maxHeight:r}},t.prototype.calculateNewSizeFromDirection=function(n,r){var s=this.props.scale||1,o=mk(this.props.resizeRatio||1),a=o[0],i=o[1],c=this.state,u=c.direction,d=c.original,p=this.props,h=p.lockAspectRatio,g=p.lockAspectRatioExtraHeight,m=p.lockAspectRatioExtraWidth,b=d.width,v=d.height,w=g||0,y=m||0;return pa("right",u)&&(b=d.width+(n-d.x)*a/s,h&&(v=(b-y)/this.ratio+w)),pa("left",u)&&(b=d.width-(n-d.x)*a/s,h&&(v=(b-y)/this.ratio+w)),pa("bottom",u)&&(v=d.height+(r-d.y)*i/s,h&&(b=(v-w)*this.ratio+y)),pa("top",u)&&(v=d.height-(r-d.y)*i/s,h&&(b=(v-w)*this.ratio+y)),{newWidth:b,newHeight:v}},t.prototype.calculateNewSizeFromAspectRatio=function(n,r,s,o){var a=this.props,i=a.lockAspectRatio,c=a.lockAspectRatioExtraHeight,u=a.lockAspectRatioExtraWidth,d=typeof o.width>"u"?10:o.width,p=typeof s.width>"u"||s.width<0?n:s.width,h=typeof o.height>"u"?10:o.height,g=typeof s.height>"u"||s.height<0?r:s.height,m=c||0,b=u||0;if(i){var v=(h-m)*this.ratio+b,w=(g-m)*this.ratio+b,y=(d-b)/this.ratio+m,S=(p-b)/this.ratio+m,C=Math.max(d,v),x=Math.min(p,w),E=Math.max(h,y),P=Math.min(g,S);n=$c(n,C,x),r=$c(r,E,P)}else n=$c(n,d,p),r=$c(r,h,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 s=r.getBoundingClientRect();this.parentLeft=s.left*n,this.parentTop=s.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left*n,this.targetTop=o.top*n}if(this.resizable){var a=this.resizable.getBoundingClientRect(),i=a.left,c=a.top,u=a.right,d=a.bottom;this.resizableLeft=i*n,this.resizableRight=u*n,this.resizableTop=c*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,r){if(!(!this.resizable||!this.window)){var s=0,o=0;if(n.nativeEvent&&hk(n.nativeEvent)?(s=n.nativeEvent.clientX,o=n.nativeEvent.clientY):n.nativeEvent&&kc(n.nativeEvent)&&(s=n.nativeEvent.touches[0].clientX,o=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,c=this.window.getComputedStyle(this.resizable);if(c.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",i=c.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var p={original:{x:s,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Ar(Ar({},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&&kc(n))try{n.preventDefault(),n.stopPropagation()}catch{}var s=this.props,o=s.maxWidth,a=s.maxHeight,i=s.minWidth,c=s.minHeight,u=kc(n)?n.touches[0].clientX:n.clientX,d=kc(n)?n.touches[0].clientY:n.clientY,p=this.state,h=p.direction,g=p.original,m=p.width,b=p.height,v=this.getParentSize(),w=gk(v,this.window.innerWidth,this.window.innerHeight,o,a,i,c);o=w.maxWidth,a=w.maxHeight,i=w.minWidth,c=w.minHeight;var y=this.calculateNewSizeFromDirection(u,d),S=y.newHeight,C=y.newWidth,x=this.calculateNewMaxFromBoundary(o,a);this.props.snap&&this.props.snap.x&&(C=a0(C,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(S=a0(S,this.props.snap.y,this.props.snapGap));var E=this.calculateNewSizeFromAspectRatio(C,S,{width:x.maxWidth,height:x.maxHeight},{width:i,height:c});if(C=E.newWidth,S=E.newHeight,this.props.grid){var P=o0(C,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),O=o0(S,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),A=this.props.snapGap||0,T=A===0||Math.abs(P-C)<=A?P:C,_=A===0||Math.abs(O-S)<=A?O:S;C=T,S=_}var L={width:C-g.width,height:S-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var $=C/v.width*100;C=$+"%"}else if(m.endsWith("vw")){var D=C/this.window.innerWidth*100;C=D+"vw"}else if(m.endsWith("vh")){var N=C/this.window.innerHeight*100;C=N+"vh"}}if(b&&typeof b=="string"){if(b.endsWith("%")){var $=S/v.height*100;S=$+"%"}else if(b.endsWith("vw")){var D=S/this.window.innerWidth*100;S=D+"vw"}else if(b.endsWith("vh")){var N=S/this.window.innerHeight*100;S=N+"vh"}}var B={width:this.createSizeForCssProperty(C,"width"),height:this.createSizeForCssProperty(S,"height")};this.flexDir==="row"?B.flexBasis=B.width:this.flexDir==="column"&&(B.flexBasis=B.height);var q=this.state.width!==B.width,F=this.state.height!==B.height,k=this.state.flexBasis!==B.flexBasis,H=q||F||k;H&&Pn.flushSync(function(){r.setState(B)}),this.props.onResize&&H&&this.props.onResize(n,h,this.resizable,L)}},t.prototype.onMouseUp=function(n){var r,s,o=this.state,a=o.isResizing,i=o.direction,c=o.original;if(!(!a||!this.resizable)){var u={width:this.size.width-c.width,height:this.size.height-c.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:(s=this.props.size.height)!==null&&s!==void 0?s:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Ar(Ar({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var r,s;this.setState({width:(r=n.width)!==null&&r!==void 0?r:"auto",height:(s=n.height)!==null&&s!==void 0?s:"auto"})},t.prototype.renderResizer=function(n){var r=this,s=this.props,o=s.enable,a=s.handleStyles,i=s.handleClasses,c=s.handleWrapperStyle,u=s.handleWrapperClass,d=s.handleComponent;if(!o)return null;var p=n.filter(function(h){return o[h]!==!1}).map(function(h){return o[h]!==!1?Ye.createElement(dk,{key:h,direction:h,onResizeStart:r.onResizeStart,replaceStyles:a&&a[h],className:i&&i[h]},d&&d[h]?d[h]:null):null});return Ye.createElement("div",{className:u,style:c},p)},t.prototype.render=function(){var n=this,r=Object.keys(this.props).reduce(function(a,i){return bk.indexOf(i)!==-1||(a[i]=n.props[i]),a},{}),s=Ar(Ar(Ar({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&&(s.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return Ye.createElement(o,Ar({style:s,className:this.props.className},r,{ref:function(a){a&&(n.resizable=a)}}),this.state.isResizing&&Ye.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}(Ye.PureComponent);function Vc({className:e,children:t,top:n,bottom:r,right:s,left:o,width:a,height:i,minHeight:c,minWidth:u,maxHeight:d,maxWidth:p,style:h,onResize:g,onResizeStop:m,...b}){const v={top:n||!1,right:s||!1,bottom:r||!1,left:o||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},w={width:a||"auto",height:i||"auto"},y=M("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 l.jsx(vk,{className:e,enable:b.enable??v,defaultSize:w,handleStyles:C,handleClasses:S,onResize:g,onResizeStop:m,minHeight:c,minWidth:u,maxHeight:d,maxWidth:p,style:h,children:t})}const df="gs-cmp-accordion",pf=`${df}-handler`,Hc=`${pf}__content`,yk=`${df}-content`;function Qr({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:r,style:s,handler:o,handlerIcon:a,children:i,inverted:c,disabled:u,sticky:d,onChange:p,open:h}){return l.jsx(bd,{as:"div",defaultOpen:h,className:Z(df,t,"relative"),children:({open:g})=>l.jsxs(l.Fragment,{children:[l.jsx(bd.Button,{as:u?"div":"button",disabled:u,style:s,onClick:m=>p==null?void 0:p({event:m,open:!g}),className:({open:m})=>M(pf,Ke(e)?e(m):e,d&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:m})=>l.jsxs(I,{items:"center",className:Z("gap-2"),full:!0,children:[l.jsx(j,{className:Z(Hc,r,"text-left"),grow:!0,children:Ke(o)?o(m):l.jsxs(I,{items:"center",className:Z(`${Hc}-wrp`,"gap-3"),nowrap:!0,children:[!!a&&l.jsx(Q,{className:Z(`${Hc}-icon`),icon:a,size:oe.s2x}),l.jsx(j,{className:Z(`${Hc}-label gs-utl-w-full`),children:o})]})}),l.jsx(j,{className:Z(`${pf}-toggle`,c&&"-order-1",u&&"gs-utl-hidden"),children:l.jsx(Q,{icon:W.chevronDown,className:Z("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),l.jsx(bd.Panel,{className:Z(yk,n),children:i})]})})}const _i="gs-studio-panel",l0=(e,t={})=>({...t,...e===!0?{}:e||void 0}),or=f.memo(function({children:t,header:n,resizable:r,className:s,classNameAccordion:o,classNameAccordionContent:a,...i}){const c=l.jsx(cn,{className:M(_i,s),...i,children:t}),u=r?r===!0?{top:!0,right:!0,bottom:!0,left:!0}:r:void 0,d=u?l.jsx(Vc,{className:M([`${_i}__resizer`]),...u,children:c}):c,p=n===!0?{collapsible:!0}:n||void 0;return p?l.jsx(Qr,{classNameWrap:M(`${_i}__accordion`,o),className:M(`${_i}__accordion-header`,Se.xy,p.className),classNameContent:M(`${_i}__accordion-content`,a),disabled:p.collapsible===!1,style:p.style,handler:l.jsxs(I,{space:"s",items:"center",children:[!!p.icon&&l.jsx(Q,{icon:p.icon,size:oe.s}),l.jsx(j,{grow:!0,children:p.label})]}),open:n?p.collapsed!==!0:!0,children:d}):d}),wk="gs-panel-assets",Sk=f.memo(ie(function({className:t,onSelect:n,content:r,assets:s,types:o,providers:a,typeId:i,providerId:c,optionalType:u,optionalProvider:d,projectAssetsOption:p,layoutAfterHeader:h,...g}){var x;const m=me(),b=ii(),v=m.editor,w=(x=m.sdkOptions.assets)==null?void 0:x.layoutAfterHeader,y=h||w,[S]=f.useState(()=>g.id||J1());return f.useEffect(()=>(b.createAssetManager(S),()=>{b.removeAssetManager(S)}),[S]),_m(S)?l.jsx(or,{className:M(wk,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...g,children:v&&l.jsx(lk,{panelId:S,assets:s,types:o,providers:a,onSelect:n,typeId:i,providerId:c,content:r,optionalType:u,optionalProvider:p??d,layoutAfterHeader:y})}):null}));var Mi=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(Mi||{}),_r=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(_r||{});const c0="gs-block-item",u0=ie(e=>{const{block:t,className:n,itemLayout:r,onClick:s,variant:o}=e,{editor:a}=me(),i=_e(),[,c]=f.useState(0),u=i.tScoped("blockManager.labels"),d=t.getId(),p=!!t.get("full"),h=s||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),b=t.getMedia(),v=t.get("attributes")||{},w=u(d)||t.getLabel(),y=o==="compact",S=M(c0,`${c0}--${d}`,n,"gs-utl-px-2 gs-utl-transition-colors",J.b,J.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?Ce.disabledM:M("gs-utl-cursor-pointer",z.hTAo,z.hBgH)),C=Ot(v.class)&&!y?v.class:M("gs-utl-block-media gs-utl-w-full",y?"gs-utl-max-h-7 gs-utl-max-w-7 gs-utl-overflow-hidden":"gs-utl-max-h-10 gs-utl-max-w-10"),x=M("gs-utl-text-center",Ce.txtEllips,!y&&"gs-utl-w-full");if(f.useEffect(()=>{if(!a)return;const{Blocks:_}=a,L=_.events.update,$=D=>D===t&&c(N=>++N);return a.on(L,$),()=>{a.off(L,$)}},[t,a]),!a)return null;const{Blocks:E}=a,A={className:S,...!g&&{onDragStart:()=>E.startDrag(t),onDragEnd:()=>E.endDrag(!1),draggable:!s},...!!h&&{onClick:()=>h(t,a)}},T=r==null?void 0:r({editor:a,block:t,attributes:A});return T&&Tt(T)||l.jsxs(I,{items:"center",...A,children:[m||l.jsx("div",{className:C,dangerouslySetInnerHTML:{__html:b}}),l.jsx("div",{className:x,title:w,children:w})]})});function ff({className:e,value:t,onChange:n}){const[r,s]=f.useState(t),o=f.useRef(null),a=u=>{const{value:d}=u.target;s(d)},i=()=>{n(r||t)},c=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(r||t);break}};return f.useEffect(()=>{o.current&&o.current.select()},[]),l.jsx("input",{autoFocus:!0,className:Z([e,"w-full",z.bgTr]),value:r,onChange:a,onBlur:i,onKeyDown:c,onPointerDown:Gs,ref:o})}function d0({className:e,value:t,active:n,unstyled:r,activable:s,onChange:o,onActive:a,...i}){const[c,u]=f.useState(n);f.useEffect(()=>{u(n)},[n]);const d=h=>{a==null||a(h),u(h)},p=h=>{o(h),d(!1)};return l.jsx("div",{className:Z("truncate",e),...i,onDoubleClick:()=>s&&d(!0),children:c?l.jsx(ff,{className:Z(r&&Ce.noFocusOut),value:t,onChange:p}):l.jsx(l.Fragment,{children:t})})}const p0=ae("text-sm w-full",Ce.txtEllips),Ck=ie(({symbol:e,className:t})=>{const n=vi(),{Components:r}=n,s=_e(),o=ra(),a=s.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}})},c=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),p=r.getSymbolInfo(e).instances.length,h=ae("h-10 w-10 block-media",z.grouphTAo),g=ae("gjs-pt-1 gjs-mt-2",J.bt,z.br),m=ae("cursor-pointer gjs-p-2 transition-colors group",J.b,J.rnd,z.br,z.hBgH,t),b=()=>{o.confirm({title:a("delete"),content:a("deleteConfirm"),onConfirm:()=>e.remove()})},v=w=>{e.set("custom-name",w)};return l.jsxs(I,{className:m,onDragStart:i,onDragEnd:c,items:"center",draggable:!0,col:!0,children:[l.jsx("div",{className:h,dangerouslySetInnerHTML:{__html:u}}),l.jsxs(I,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[l.jsx(j,{children:l.jsx(I,{className:ae(p0,"gjs-mr-auto"),children:l.jsx(kt,{title:`${p} ${a("instancesProject")}`,children:l.jsx(_s,{label:`${p}`,className:ae(z.bgH75)})})})}),l.jsx(j,{className:ae("truncate"),grow:!0,title:d,children:l.jsx(d0,{activable:!0,value:d,className:p0,onChange:v})}),l.jsx(j,{className:ae(Ce.hoverGroup),children:l.jsx(I,{justify:"end",full:!0,children:l.jsx(ft,{onClick:b,title:a("delete"),border:!1,size:"",block:!0,children:l.jsx(Q,{icon:W.delete,size:oe.s})})})})]})]})}),ks="gs-block-manager",f0={id:_r.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>'},xk={id:_r.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>'},Ek={id:_r.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>'},h0={id:_r.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>'},g0=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},m0=e=>{const t=e.getContent();return Ke(t)?e.getDragDef():t},Pk=e=>{const t=m0(e);return Array.isArray(t)?t[0]:t},Tk=ie(function({isOpen:t,className:n,hideCategories:r,target:s,variant:o,itemLayout:a,...i}){var Ie,Wt;const{editor:c}=me(),u=_e(),[d,p]=f.useState(0),[h,g]=f.useState(Mi.REGULAR),[m,b]=f.useState(""),[v,w]=f.useState(""),y=f.useRef(new Set),[S,C]=f.useState((s==null?void 0:s.position)||_r.after),[x,E]=f.useState(()=>(c==null?void 0:c.Components.getSymbols())||[]),P=h===Mi.SYMBOLS,O=f.useRef(null),A=u.tScoped("blockManager"),T=s==null?void 0:s.component;if(f.useEffect(()=>{if(!c)return;const{Blocks:pe,Components:Le}=c,Ne=pe.events.custom,Me=Le.events.symbol,St=()=>{E(Le.getSymbols()),p(It=>++It)};return c.on(Me,St),c.on(Ne,St),()=>{c.off(Me,St),c.off(Ne,St)}},[c]),f.useEffect(()=>{if(O.current&&t){const pe=O.current.querySelector("input");setTimeout(()=>pe==null?void 0:pe.focus(),Ku)}},[O.current,t]),!c)return null;const{Blocks:_,Components:L}=c,$=pe=>A(`labels.${pe.getId()}`)||pe.getLabel(),D=x.filter(pe=>_o(pe.getName(),m)),N=_.getAll().map(pe=>pe),B=((Ie=i.blocks)==null?void 0:Ie.call(i,{blocks:N}))||N,q=S===_r.before,F=S===_r.beforeInside,k=S===_r.afterInside,H=S===_r.after,V=!!(T!=null&&T.attributes.droppable),U=B.filter(pe=>{const Le=g0(c,pe.category);if(m&&!_o(Le,m)&&!_o($(pe),m))return!1;if(T){const Ne=Pk(pe);if(V&&(F||k)){const Me=F?0:void 0;return L.canMove(T,Ne,Me).result}else if(q||H){const Me=T.index(),St=T.parent(),It=q?Me:Me+1;return St&&L.canMove(St,Ne,It).result}}return!0}),X=_.getBlocksByCategory(U),Y=r?U:(Wt=X.find(pe=>!pe.category))==null?void 0:Wt.items,R=r?[]:X.filter(pe=>pe.category),ee=i.symbols!==!1,te=i.search!==!1,K=!ee&&!te,ne=o==="compact",ce=A("search")||u.t("search"),ge=M(ks,n,"gap-2"),De=M(`${ks}__header`,"gs-utl-pt-2",Se.xS,K&&"gs-utl-hidden"),ve=M(`${ks}__content`,Ce.scrollY,z.br,J.bt),Ze=M(`${ks}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Ge=M(`${ks}__not-found`,"gs-utl-text-center gs-utl-p-4"),bt=M(`${ks}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",ne?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),tt=M(`${ks}__no-category`,bt,z.br,R.length&&J.bb),be=M(z.tAo,z.bgH75,J.bA),Je=`${ks}__category`,Qe=[{id:Mi.REGULAR,label:A("types.regular")},{id:Mi.SYMBOLS,label:A("types.symbols")}],dt=V?[f0,xk,Ek,h0]:[f0,h0],Te=T?pe=>{const Le=m0(pe);if(!Le)return;let Ne;if(F||k){const Me=F?0:void 0;Ne=T.append(Le,{at:Me})[0]}else if(q||H){const Me=T.index(),St=T.parent(),It=q?Me:Me+1;Ne=St==null?void 0:St.append(Le,{at:It})[0]}if(Ne){const{activate:Me,select:St}=pe.attributes;St||Me&&St!==!1?c.em.setSelected(Ne,{activate:Me}):Me&&Ne.trigger("active")}}:void 0,it=pe=>{if(!T)return;const Le=Array.from(y.current);if(pe.key==="ArrowDown")pe.preventDefault(),w(Ne=>{const Me=Le.indexOf(Ne);return Le.at(Math.min(Me+1,Le.length-1))||""});else if(pe.key==="ArrowUp")pe.preventDefault(),w(Ne=>{const Me=Le.indexOf(Ne);return Le.at(Math.max(Me-1,0))||""});else if(pe.key==="Enter"&&v){const Ne=_.get(v);Ne&&(Te==null||Te(Ne))}},nt=pe=>{y.current.clear(),b(pe)};return l.jsxs(I,{className:ge,col:!0,full:!0,children:[l.jsxs(I,{className:De,gap:"s",col:!0,children:[ee&&l.jsx(Ms,{tabs:Qe,onChange:g,value:h,variant:"pills"}),T&&l.jsx(zt,{size:"s",options:dt,value:S,onChange:pe=>C(pe)}),te&&l.jsx(Xe,{ref:O,size:"s",value:m,onInput:nt,onKeyDown:it,placeholder:ce,type:"search"})]}),l.jsxs(j,{className:ve,grow:!0,children:[P&&(D.length?l.jsx(I,{className:Ze,children:D.map(pe=>l.jsx(Ck,{symbol:pe},`${d}_${pe.getId()}`))}):l.jsx(I,{className:Ge,justify:"center",children:A("symbols.notFound")})),!P&&(U.length?l.jsxs(l.Fragment,{children:[!!(Y!=null&&Y.length)&&l.jsx(I,{className:tt,children:Y==null?void 0:Y.map(pe=>(y.current.add(`${pe.id}`),l.jsx(u0,{block:pe,itemLayout:a,onClick:Te,variant:o,className:M(v===pe.id&&be)},pe.id)))}),R.map(({category:pe,items:Le},Ne)=>l.jsx(Qr,{sticky:!0,className:Me=>Yu.itemList({index:Ne,open:Me,length:R.length}),open:!!(pe!=null&&pe.get("open")),onChange:({open:Me})=>pe==null?void 0:pe.set({open:Me}),handler:g0(c,pe),handlerIcon:pe==null?void 0:pe.get("icon"),classNameWrap:M(Je,`${Je}--${pe==null?void 0:pe.id}`),children:l.jsx(I,{className:bt,children:Le.map(Me=>(y.current.add(`${Me.id}`),l.jsx(u0,{block:Me,itemLayout:a,onClick:Te,variant:o,className:M(v===Me.id&&be)},Me.id)))})},pe==null?void 0:pe.id))]}):l.jsx(I,{className:Ge,justify:"center",children:A("notFound")}))]})]})}),Ok=f.forwardRef(function({children:t,className:n,...r},s){return l.jsx("div",{className:M(ae("gs-block-manager-after"),n),ref:s,...r,children:t})}),Ak=f.forwardRef(function({children:t,className:n,...r},s){return l.jsx("div",{className:M(ae("gs-block-manager-before"),n),ref:s,...r,children:t})}),_k="gs-panel-blocks",Mk=f.memo(ie(function({className:t,symbols:n,search:r,hideCategories:s,target:o,variant:a,blocks:i,itemLayout:c,...u}){const d=me().sdkProps.children,p={search:r,symbols:n,hideCategories:s,isOpen:!0,target:o,variant:a,blocks:i,itemLayout:c};return l.jsx(or,{className:M(_k,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:l.jsxs(yi,{children:[In(d,Ak),l.jsx(Tk,{className:M("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...p}),In(d,Ok)]})})})),Lk="gs-cmp-color-picker",Nk={backgroundSize:"10px"},$k=[0,15];function b0({className:e,value:t,onChange:n,disabled:r}){const[s,o]=f.useState(!1),a=M(`${Lk}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,J.b,J.rnd,z.br),i=()=>{o(!1)},c=l.jsxs("div",{style:Nk,className:a,children:[s&&l.jsx("div",{onPointerUp:i,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),l.jsx("div",{className:"gs-utl-w-4 gs-utl-h-4",style:{backgroundColor:t}})]});return l.jsx(sr,{handler:c,title:"Color",size:"s",placement:"left-end",offset:$k,clickAway:!0,disabled:r,children:l.jsx(Wv,{value:t,onChange:n,disabled:r})})}const kk="gs-cmp-color-field";function Rr(e){const{className:t,value:n,placeholder:r,preventSubmitOnEnter:s=!1,onChange:o,labelAs:a,disabled:i}=e,[c,u]=f.useState(sc(n)),d=bi(e);f.useEffect(()=>{u(sc(n))},[n]);const p=(b,v)=>{o==null||o(b,v)},h=b=>{switch(b.key){case"Escape":return u(n);case"Enter":p(c),s&&(b.preventDefault(),b.stopPropagation())}},g=()=>{p(c)},m=Os({...e,className:M(kk,t)});return l.jsxs("div",{...m,children:[l.jsx(nr,{...e,as:a}),l.jsxs(I,{className:xp(e),items:"center",space:"s",children:[l.jsx(j,{children:l.jsx(b0,{value:n,onChange:o,disabled:i})}),l.jsx(j,{grow:!0,children:l.jsx("input",{className:M(d,i&&"gs-utl-pointer-events-none"),value:c,onChange:b=>u(b.target.value),placeholder:r,onBlur:g,onKeyDown:h,disabled:i})})]})]})}const Ik=(e,t)=>{t.runCommand(re.fontAdd,{font:e})},hf=(e,{onSelect:t,...n}={})=>{const r="font",a=e.runCommand(re.assetProviderGet).filter(i=>et(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 c=i.assetProps;Ik(c.customData.font,e),t==null||t(i)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},jc=ie(e=>{const{buttonClassName:t,value:n,...r}=e,{editor:s}=me(),o=_e(),a=ii(),i=li(),c=[...r.options||[],...i.fontFamilyOptions].map(u=>{const d=i.getFont(u.id),p=d?np(d):u.id;return{...u,content:l.jsx(I,{col:!0,children:l.jsx(j,{style:{fontFamily:p},children:u.label})})}});return l.jsx(Ee,{...r,value:go(n),options:c,afterLabel:i.sdkAddFonts&&a.hasType("font")&&l.jsx(ft,{className:t,title:o.t("fontManager.addFontToProject"),icon:W.plus,size:"xs",border:!1,block:!0,onClick:()=>s&&hf(s,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;r.onChange(go(d.family))}})})})}),Vk=(e,{t,id:n})=>t(`fields.${n}.label`)||cr(`${e}`.replace(/-/g," ")),v0=(e,{t,id:n})=>{const r=et(e)?{id:e,label:e}:e;return{...r,label:t(`fields.${n}.options.${r.id}`)||r.label}},y0=e=>e.get("defaultValue")||"",Li=e=>e.get("field"),w0=e=>{const t=Li(e);return et(t)?{type:t}:t},S0=e=>`${e.get("value")||y0(e)||w0(e).defaultValue||""}`,Hk=(e,t)=>e||y0(t)||"",Ni=({record:e,value:t,partial:n})=>{e.set({value:Hk(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},$i=(e,t)=>{const{className:n,defaultValue:r,size:s,...o}=w0(e),a=r??e.get("defaultValue");return{...o,hasClear:()=>{const i=e.get("value");return!!i&&Ot(a)&&i!==a},className:M(n,"gs-utl-w-full"),size:s||"s",value:S0(e),label:Vk(e.get("label")||e.id||"",t),onChange:(i,c)=>Ni({record:e,value:i,partial:c})}},jk=(e,t)=>{const n=Li(e),r=Ir(n)?n:void 0,s=(r==null?void 0:r.units)||[],o=v$(S0(e)),a=o.number,i=o.unit||s[0]||"";return{...$i(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:(c,u)=>{Ni({value:c?`${c}${i}`:"",record:e,partial:u})},onChangeUnit:c=>{Ni({value:a?`${a}${c}`:"",record:e})}}},C0=(e,t)=>{var o;const n=Li(e),r=Ir(n)?n:void 0,s=((o=r==null?void 0:r.options)==null?void 0:o.map(a=>v0(a,t)))||[];return{...$i(e,t),options:s,onChange:a=>Ni({value:a,record:e})}},Dk=(e,t)=>({...$i(e,t),onChange:n=>Ni({value:n,record:e})}),Fk=(e,t)=>{var o;const n=Li(e),r=Ir(n)?n:void 0,s=((o=r==null?void 0:r.options)==null?void 0:o.map(a=>v0(a,t)))||[];return{...C0(e,t),size:"s",options:s}};function Bk(e,t){const n=Li(e);switch(et(n)?n:n==null?void 0:n.type){case"radio":return l.jsx(zt,{...Fk(e,t)});case"select":return l.jsx(Ee,{...C0(e,t)});case"selectFont":{const s=Dk(e,t);return l.jsx(jc,{...s,labelAs:"div"})}case"number":return l.jsx(Oe,{...jk(e,t)});case"color":return l.jsx(Rr,{...$i(e,t)});default:return l.jsx(Xe,{...$i(e,t)})}}const x0="gs-cmp-global-style-field",zk=ie(function({record:t}){const n=me(),s=_e().tScoped("globalStyleManager"),[,o]=f.useState(0),a=n.editor,i=t.id,c={t:s,id:i};return f.useEffect(()=>{if(!a)return;const u=`data:path:${t.getPath("value")}`,d=()=>o(p=>++p);return a.on(u,d),()=>{a.off(u,d)}},[a]),l.jsx(I,{className:M(x0,`${x0}__${i}`),children:Bk(t,c)})}),ki="gs-cmp-global-style-manager",E0=({items:e,category:t,className:n})=>{const r=M(t?`${ki}__cat-fields--${t.id}`:`${ki}__uncat-fields`,"gs-utl-gap-2",Se.xy,n);return l.jsx(I,{className:r,nowrap:!0,col:!0,children:e.map(s=>l.jsx(zk,{record:s},s.id))})},Uk=ie(function(){const t=B_(),{recordsByCategory:n,openCategories:r}=t,o=_e().tScoped("globalStyleManager");return l.jsx(I,{col:!0,full:!0,nowrap:!0,className:M(ki,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:l.jsx(I,{col:!0,nowrap:!0,className:M(`${ki}__fields`,Ce.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:a,items:i},c)=>a?l.jsx(Qr,{sticky:!0,open:r.get(a.id)??a.open,handler:o(`categories.${a.id}.label`)||a.label||a.id,onChange:({open:u})=>t.setCategoryOpen(a.id,u),className:u=>M(`${ki}__cat-fields`,Yu.itemList({index:c,open:u,length:n.length}),c===0&&J.bt),children:l.jsx(E0,{category:a,items:i})},a.id):l.jsx(E0,{items:i,className:M(n.length!==1&&[J.bt,z.br])},c)):l.jsx(I,{className:M("gs-utl-text-center"),justify:"center",children:o("notFound")})})})}),Wk="gs-panel-global-styles",Gk=f.memo(ie(function({className:t,...n}){return l.jsx(or,{className:M(Wk,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:l.jsx(yi,{children:l.jsx(Uk,{})})})})),qk={maxWidth:`${kw}px`},Kk="gs-cmp-layer-item";function P0({component:e,draggingCmp:t,dragParent:n,...r}){const s=vi(),{Layers:o}=s,a=f.useRef(null),[i,c]=f.useState(!1),[u,d]=f.useState(o.getLayerData(e)),{open:p,selected:h,hovered:g,components:m,visible:b,locked:v,name:w}=u,y=m.map(F=>F.cid),S=t===e,C=y.join("-"),x=r.level+1,E=g||n===e;f.useEffect(()=>{x===0&&d(o.getLayerData(e)),a.current&&(a.current.__cmp=e)},[e]),f.useEffect(()=>{const F=a.current;if(!F)return;const{select:k}=s.Components.events,H=V=>V===e&&F.scrollIntoView({block:"nearest"});return s.on(k,H),()=>{s.off(k,H)}},[e,a.current]),f.useEffect(()=>{const F=H=>{H===e&&d(o.getLayerData(H))},k=o.events.component;return s.on(k,F),()=>{s.off(k,F)}},[s,o,e]);const P=f.useMemo(()=>m.map(F=>l.jsx(P0,{component:F,level:x,draggingCmp:t,dragParent:n},F.cid)),[C,t,n]),O=F=>{o.setLayerData(e,{name:F}),c(!1)},A=F=>{F.stopPropagation(),o.setLayerData(e,{open:!p})},T=F=>{F.stopPropagation(),o.setLayerData(e,{visible:!b})},_=F=>{F.stopPropagation(),o.setLayerData(e,{locked:!v})},L=F=>{F.stopPropagation(),o.setLayerData(e,{selected:!0},{event:F})},$=F=>{F.preventDefault(),s.runCommand(re.contextMenuComponent,{source:ep.layers,component:e,event:F.nativeEvent,x:F.clientX,y:F.clientY})},D=F=>{(!F||!t)&&o.setLayerData(e,{hovered:F})},N=Wg(e),B=Z("layer-item",(h||N.isSymbol)&&N.bgSoftX,(!b||S)&&"opacity-50"),q=Z(Se.xyS,J.b,E?N.border:J.bT,h&&N.bgSoft);return l.jsx("div",{className:Kk,children:l.jsxs(I,{col:!0,className:B,children:[l.jsx(j,{onClick:L,onContextMenu:$,onMouseEnter:()=>D(!0),onMouseLeave:()=>D(!1),className:Z("group max-w-full"),"data-layer-item":!0,ref:a,children:l.jsxs(I,{items:"center",space:"xs",className:q,children:[l.jsx(j,{style:{marginLeft:`${x*10}px`},className:Z("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:A,children:l.jsx(Q,{icon:W.menuDown,size:oe.sx,rotate:p?0:-90})}),l.jsx(j,{children:bm(e)}),l.jsx(j,{className:Z("truncate"),onDoubleClick:()=>c(!0),style:qk,grow:!0,children:i?l.jsx(ff,{value:w,onChange:O}):l.jsx(l.Fragment,{children:w})}),!i&&l.jsxs(l.Fragment,{children:[l.jsx(j,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-100":"opacity-0"),onClick:_,children:l.jsx(Q,{icon:v?W.lock:W.lockOpenVariant,size:oe.s3x})}),l.jsx(j,{className:Z("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-0":"opacity-100"),onClick:T,children:l.jsx(Q,{icon:b?W.eyeOutline:W.eyeOffOutline,size:oe.sx})})]})]})}),!!(p&&m.length)&&l.jsx(j,{className:Z("max-w-full",!p&&"hidden"),children:P})]})})}const Zk={touchAction:"none"},T0=5,Yk=e=>{var o,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,s=((a=(o=r==null?void 0:r.delegate)==null?void 0:o.move)==null?void 0:a.call(o,r))||r;return{el:n,cmp:s}},O0=ie(function({root:t,header:n}){const{editor:r}=me(),[s,o]=f.useState(!1),[a,i]=f.useState({}),[c,u]=f.useState(),[d,p]=f.useState(),[h,g]=f.useState(),[m,b]=f.useState(),v=f.useRef(null);if(f.useEffect(()=>{const A=window.document,T=_=>{_.key==="Escape"&&(i({...a,result:!1}),C())};return A.addEventListener("keydown",T),()=>{A.removeEventListener("keydown",T)}},[]),!r)return null;const{Components:w}=r,y=A=>{A.button===0&&o(!0)},S=A=>{if(!s)return;const{cmp:T,el:_}=Yk(A);if(!_||!T)return;const L=_.getBoundingClientRect(),$=_.offsetHeight,D=_.offsetTop,N=A.clientY,B=N<L.y+$/2,q=d||T,F=T.parent(),k=T.index()+(B?0:1);!d&&p(T),u(T);const H=w.canMove(F,q,k),V=w.canMove(T,q),U={...H,canMoveInside:V,index:k};let X=!1;V.result&&N>L.y+T0&&N<L.y+$-T0&&(X=!0,U.target=T,delete U.index),g(X?T:void 0),i(U),b({pointerInside:X,y:D+(B?0:$),h:$})},C=()=>{var A;a!=null&&a.result&&((A=a.source)==null||A.move(a.target,{at:a.index})),i({}),o(!1),p(void 0),u(void 0),g(void 0),b(void 0)},x=(c?c.parents():[]).length,E=!!(d&&m&&(a!=null&&a.result)&&!m.pointerInside),P=E?{top:m.y,left:0,marginLeft:x*10+20}:{},O=n&&(n==null?void 0:n.label)||"Layers";return l.jsxs(I,{col:!0,full:!0,nowrap:!0,className:Z("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&l.jsx(j,{children:l.jsxs(I,{space:"s",items:"center",className:Z([Se.xy,J.bb,z.br]),children:[l.jsx(j,{children:l.jsx(Q,{icon:W.layers,size:oe.s})}),l.jsx(j,{grow:!0,children:O})]})}),l.jsxs(j,{className:Z("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:Zk,onPointerDown:y,onPointerMove:S,onPointerUp:C,grow:!0,children:[!!t&&l.jsx(P0,{component:t,level:-1,draggingCmp:d,dragParent:h}),E&&l.jsx("div",{ref:v,className:Z("absolute w-full gs-utl-h-0.5",z.cmp),style:P})]})]})}),A0=f.forwardRef(function({children:t,className:n,...r},s){return l.jsx("div",{className:M(ae("gs-layer-manager-after"),n),ref:s,...r,children:t})}),_0=f.forwardRef(function({children:t,className:n,...r},s){return l.jsx("div",{className:M(ae("gs-layer-manager-before"),n),ref:s,...r,children:t})}),Xk="gs-panel-layers",M0=f.memo(ie(function({className:t,...n}){const r=me().sdkProps.children;return l.jsx(or,{className:M(Xk,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:l.jsx(Ib,{children:s=>l.jsxs(l.Fragment,{children:[In(r,_0),l.jsx(O0,{...s,header:!1}),In(r,A0)]})})})})),xo="gs-cmp-file-field";function Ii(e){var x;const{className:t,value:n,btnLabel:r,nameLabel:s,size:o,isContain:a,clear:i,inputField:c,placeholder:u,preview:d=50,disabled:p,hideButton:h,labelAs:g,onChange:m,onOpen:b}=e,v=(n||"").replace(/^"|"$/gi,""),w=((x=v.split("/").pop())==null?void 0:x.split("?")[0])||"",y={minWidth:d,minHeight:d},S=v?{...y,backgroundImage:`url("${v}")`}:y,C=M(" 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",J.b,J.rnd,z.br);return l.jsxs(I,{className:M(xo,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[l.jsx(nr,{...e,as:g}),l.jsxs(I,{className:M(`${xo}-content gs-utl-gap-1`,z.bg),items:"center",nowrap:!0,children:[l.jsx(j,{className:M(`${xo}-preview`),children:l.jsx("div",{className:C,style:S})}),l.jsxs(j,{className:M(`${xo}-fields gs-utl-overflow-hidden`),grow:!0,children:[w&&s!==!1&&l.jsx(Ts,{className:M(`${xo}-name`,"gs-utl-mb-2",Ce.txtEllips),as:"div",size:o,capitalize:!1,children:w}),l.jsxs(I,{className:M(`${xo}-buttons`),space:"s",nowrap:!0,children:[!h&&l.jsx(Ue,{onClick:()=>b==null?void 0:b(n),size:o,type:"button",block:!0,full:!0,disabled:p,children:r||"Select image"}),!!n&&i&&l.jsx(ft,{onClick:()=>m==null?void 0:m(""),title:i.tooltip,size:o,icon:{icon:W.close,size:oe.s},type:"button",block:!0})]})]})]}),c&&l.jsx(Xe,{className:M(`${xo}-input`),value:v,onChange:m,size:o,placeholder:u})]})}function Jk(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return f.useMemo(()=>r=>{t.forEach(s=>s(r))},t)}const Dc=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function fa(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function gf(e){return"nodeType"in e}function Is(e){var t,n;return e?fa(e)?e:gf(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function mf(e){const{Document:t}=Is(e);return e instanceof t}function ha(e){return fa(e)?!1:e instanceof Is(e).HTMLElement}function L0(e){return e instanceof Is(e).SVGElement}function ga(e){return e?fa(e)?e.document:gf(e)?mf(e)?e:ha(e)||L0(e)?e.ownerDocument:document:document:document}const Eo=Dc?f.useLayoutEffect:f.useEffect;function Qk(e){const t=f.useRef(e);return Eo(()=>{t.current=e}),f.useCallback(function(){for(var n=arguments.length,r=new Array(n),s=0;s<n;s++)r[s]=arguments[s];return t.current==null?void 0:t.current(...r)},[])}function Rk(){const e=f.useRef(null),t=f.useCallback((r,s)=>{e.current=setInterval(r,s)},[]),n=f.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function Vi(e,t){const n=f.useRef();return f.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function bf(e){const t=Qk(e),n=f.useRef(null),r=f.useCallback(s=>{s!==n.current&&(t==null||t(s,n.current)),n.current=s},[]);return[n,r]}let vf={};function Hi(e,t){return f.useMemo(()=>{if(t)return t;const n=vf[e]==null?0:vf[e]+1;return vf[e]=n,e+"-"+n},[e,t])}function N0(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s<n;s++)r[s-1]=arguments[s];return r.reduce((o,a)=>{const i=Object.entries(a);for(const[c,u]of i){const d=o[c];d!=null&&(o[c]=d+e*u)}return o},{...t})}}const ji=N0(1),$0=N0(-1);function e6(e){return"clientX"in e&&"clientY"in e}function t6(e){if(!e)return!1;const{KeyboardEvent:t}=Is(e.target);return t&&e instanceof t}function n6(e){if(!e)return!1;const{TouchEvent:t}=Is(e.target);return t&&e instanceof t}function yf(e){if(n6(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 e6(e)?{x:e.clientX,y:e.clientY}:null}const Di=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[Di.Translate.toString(e),Di.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),r6={display:"none"};function s6(e){let{id:t,value:n}=e;return f.createElement("div",{id:t,style:r6},n)}function o6(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const s={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 f.createElement("div",{id:t,style:s,role:"status","aria-live":r,"aria-atomic":!0},n)}function a6(){const[e,t]=f.useState("");return{announce:f.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const i6={draggable:`
|
|
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:`
|
|
334
323
|
To pick up a draggable item, press the space bar.
|
|
335
324
|
While dragging, use the arrow keys to move the item.
|
|
336
325
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
337
|
-
`},l6={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 at;(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"})(at||(at={}));function wf(...e){}class Fi 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 Fc=f.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:wf,draggableNodes:{},droppableRects:new Map,droppableContainers:new Fi,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wf},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:wf,windowRect:null,willRecomputeLayouts:!1});function c6(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new Fi}}}function u6(e,t){switch(t.type){case at.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case at.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 at.DragEnd:case at.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case at.RegisterDroppable:{const{element:n}=t,{id:r}=n,s=new Fi(e.droppable.containers);return s.set(r,n),{...e,droppable:{...e.droppable,containers:s}}}case at.SetDroppableDisabled:{const{id:n,key:r,disabled:s}=t,o=e.droppable.containers.get(n);if(!o||r!==o.key)return e;const a=new Fi(e.droppable.containers);return a.set(n,{...o,disabled:s}),{...e,droppable:{...e.droppable,containers:a}}}case at.UnregisterDroppable:{const{id:n,key:r}=t,s=e.droppable.containers.get(n);if(!s||r!==s.key)return e;const o=new Fi(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}const k0=f.createContext({type:null,event:null});function d6({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:r,onDragCancel:s}){const o=f.useContext(k0),a=f.useRef(o);f.useEffect(()=>{if(o!==a.current){const{type:i,event:c}=o;switch(i){case at.DragStart:e==null||e(c);break;case at.DragMove:t==null||t(c);break;case at.DragOver:n==null||n(c);break;case at.DragCancel:s==null||s(c);break;case at.DragEnd:r==null||r(c);break}a.current=o}},[o,e,t,n,r,s])}function p6({announcements:e=l6,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:r,announcement:s}=a6(),o=Hi("DndLiveRegion"),[a,i]=f.useState(!1);return f.useEffect(()=>{i(!0)},[]),d6(f.useMemo(()=>({onDragStart({active:c}){r(e.onDragStart(c.id))},onDragMove({active:c,over:u}){e.onDragMove&&r(e.onDragMove(c.id,u==null?void 0:u.id))},onDragOver({active:c,over:u}){r(e.onDragOver(c.id,u==null?void 0:u.id))},onDragEnd({active:c,over:u}){r(e.onDragEnd(c.id,u==null?void 0:u.id))},onDragCancel({active:c}){r(e.onDragCancel(c.id))}}),[r,e])),a?Pn.createPortal(f.createElement(f.Fragment,null,f.createElement(s6,{id:t,value:n.draggable}),f.createElement(o6,{id:o,announcement:s})),document.body):null}const es=Object.freeze({x:0,y:0});function I0(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function V0(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const f6=({collisionRect:e,droppableContainers:t})=>{const n=V0(e,e.left,e.top);let r=1/0,s=null;for(const o of t){const{rect:{current:a}}=o;if(a){const i=I0(V0(a),n);i<r&&(r=i,s=o.id)}}return s};function h6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function g6(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:es}function m6(e){return function(n,...r){return r.reduce((s,o)=>({...s,top:s.top+e*o.y,bottom:s.bottom+e*o.y,left:s.left+e*o.x,right:s.right+e*o.x,offsetLeft:s.offsetLeft+e*o.x,offsetTop:s.offsetTop+e*o.y}),{...n})}}const H0=m6(1);function b6(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function v6(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(s=>{const o=t[s];return typeof o=="string"?n.test(o):!1})!=null}function Sf(e){const t=[];function n(r){if(!r)return t;if(mf(r)&&r.scrollingElement!=null&&!t.includes(r.scrollingElement))return t.push(r.scrollingElement),t;if(!ha(r)||L0(r)||t.includes(r))return t;const s=window.getComputedStyle(r);return v6(r,s)&&t.push(r),b6(r,s)?t:n(r.parentNode)}return e?n(e.parentNode):t}function Cf(e){return!Dc||!e?null:fa(e)?e:gf(e)?mf(e)||e===ga(e).scrollingElement?window:ha(e)?e:null:null}function xf(e){return fa(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var ma;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ma||(ma={}));function j0(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},r=e.scrollTop<=t.y,s=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,a=e.scrollLeft>=n.x;return{isTop:r,isLeft:s,isBottom:o,isRight:a,maxScroll:n,minScroll:t}}function y6(e){return!Dc||!e?!1:e===document.scrollingElement}const w6={x:.2,y:.2};function S6(e,t,{top:n,left:r,right:s,bottom:o},a=10,i=w6){const{clientHeight:c,clientWidth:u}=e,d=y6(e)?{top:0,left:0,right:u,bottom:c,width:u,height:c}:t,{isTop:p,isBottom:h,isLeft:g,isRight:m}=j0(e),b={x:0,y:0},v={x:0,y:0},w={height:d.height*i.y,width:d.width*i.x};return!p&&n<=d.top+w.height?(b.y=ma.Backward,v.y=a*Math.abs((d.top+w.height-n)/w.height)):!h&&o>=d.bottom-w.height&&(b.y=ma.Forward,v.y=a*Math.abs((d.bottom-w.height-o)/w.height)),!m&&s>=d.right-w.width?(b.x=ma.Forward,v.x=a*Math.abs((d.right-w.width-s)/w.width)):!g&&r<=d.left+w.width&&(b.x=ma.Backward,v.x=a*Math.abs((d.left+w.width-r)/w.width)),{direction:b,speed:v}}function C6(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:a}=window;return{top:0,left:0,right:o,bottom:a,width:o,height:a}}const{top:t,left:n,right:r,bottom:s}=e.getBoundingClientRect();return{top:t,left:n,right:r,bottom:s,width:e.clientWidth,height:e.clientHeight}}function D0(e){return e.reduce((t,n)=>ji(t,xf(n)),es)}function F0(e,t,n=es){if(!e||!ha(e))return n;const r={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?r:F0(e.offsetParent,t,r)}function Bc(e){const{offsetWidth:t,offsetHeight:n}=e,{x:r,y:s}=F0(e,null);return{width:t,height:n,offsetTop:s,offsetLeft:r}}function zc(e){if(fa(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}=Bc(e),{width:r,height:s,top:o,bottom:a,left:i,right:c}=e.getBoundingClientRect();return{width:r,height:s,top:o,bottom:a,right:c,left:i,offsetTop:t,offsetLeft:n}}function Ef(e){const{width:t,height:n,offsetTop:r,offsetLeft:s}=Bc(e),o=Sf(e),a=D0(o),i=r-a.y,c=s-a.x;return{width:t,height:n,top:i,bottom:i+n,right:c+t,left:c,offsetTop:r,offsetLeft:s}}function B0(e){return"top"in e}function z0(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 x6=({collisionRect:e,droppableContainers:t})=>{let n=1/0,r=null;const s=z0(e,e.left,e.top);for(const o of t){const{rect:{current:a}}=o;if(a){const i=z0(a,B0(a)?a.left:void 0,B0(a)?a.top:void 0),c=s.reduce((d,p,h)=>d+I0(i[h],p),0),u=Number((c/4).toFixed(4));u<n&&(n=u,r=o.id)}}return r};function E6(e,t){const n=Math.max(t.top,e.offsetTop),r=Math.max(t.left,e.offsetLeft),s=Math.min(t.left+t.width,e.offsetLeft+e.width),o=Math.min(t.top+t.height,e.offsetTop+e.height),a=s-r,i=o-n;if(r<s&&n<o){const c=t.width*t.height,u=e.width*e.height,d=a*i,p=d/(c+u-d);return Number(p.toFixed(4))}return 0}const P6=({collisionRect:e,droppableContainers:t})=>{let n=0,r=null;for(const s of t){const{rect:{current:o}}=s;if(o){const a=E6(o,e);a>n&&(n=a,r=s.id)}}return r};var Bi;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(Bi||(Bi={}));var Uc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Uc||(Uc={}));function T6({acceleration:e,activator:t=Bi.Pointer,canScroll:n,draggingRect:r,enabled:s,interval:o=5,order:a=Uc.TreeOrder,pointerCoordinates:i,scrollableAncestors:c,scrollableAncestorRects:u,threshold:d}){const[p,h]=Rk(),g=f.useRef({x:1,y:1}),m=f.useMemo(()=>{switch(t){case Bi.Pointer:return i?{top:i.y,bottom:i.y,left:i.x,right:i.x}:null;case Bi.DraggableRect:return r}return null},[t,r,i]),b=f.useRef(es),v=f.useRef(null),w=f.useCallback(()=>{const S=v.current;if(!S)return;const C=g.current.x*b.current.x,x=g.current.y*b.current.y;S.scrollBy(C,x)},[]),y=f.useMemo(()=>a===Uc.TreeOrder?[...c].reverse():c,[a,c]);f.useEffect(()=>{if(!s||!c.length||!m){h();return}for(const S of y){if((n==null?void 0:n(S))===!1)continue;const C=c.indexOf(S),x=u[C];if(!x)continue;const{direction:E,speed:P}=S6(S,x,m,e,d);if(P.x>0||P.y>0){h(),v.current=S,p(w,o),g.current=P,b.current=E;return}}g.current={x:0,y:0},b.current={x:0,y:0},h()},[e,w,n,h,s,o,JSON.stringify(m),p,c,y,u,JSON.stringify(d)])}function O6(e,t){const n=t!==null?e[t]:void 0,r=n?n.node.current:null;return Vi(s=>{var o;return t===null?null:(o=r??s)!=null?o:null},[r,t])}function A6(e,t){return f.useMemo(()=>e.reduce((n,r)=>{const{sensor:s}=r,o=s.activators.map(a=>({eventName:a.eventName,handler:t(a.handler,r)}));return[...n,...o]},[]),[e,t])}function U0(e){const t=f.useRef(e);return Eo(()=>{t.current!==e&&(t.current=e)},[e]),t}var zi;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(zi||(zi={}));var Pf;(function(e){e.Optimized="optimized"})(Pf||(Pf={}));const W0=new Map,_6={measure:Bc,strategy:zi.WhileDragging,frequency:Pf.Optimized};function M6(e,{dragging:t,dependencies:n,config:r}){const[s,o]=f.useState(!1),{frequency:a,measure:i,strategy:c}={..._6,...r},u=f.useRef(e),d=f.useCallback(()=>o(!0),[]),p=f.useRef(null),h=m(),g=Vi(b=>{if(h&&!t)return W0;if(!b||b===W0||u.current!==e||s){for(let v of e)v&&(v.rect.current=v.node.current?i(v.node.current):null);return L6(e)}return b},[e,t,h,i,s]);return f.useEffect(()=>{u.current=e},[e]),f.useEffect(()=>{s&&o(!1)},[s]),f.useEffect(function(){h||requestAnimationFrame(d)},[t,h]),f.useEffect(function(){h||typeof a!="number"||p.current!==null||(p.current=setTimeout(()=>{d(),p.current=null},a))},[a,h,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:s};function m(){switch(c){case zi.Always:return!1;case zi.BeforeDragging:return t;default:return!t}}}function L6(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:r,rect:s}=n;s.current!=null&&t.set(r,s.current)}return t}function N6(e){const[t,n]=f.useState(null),r=f.useRef(e),s=f.useCallback(o=>{const a=Cf(o.target);a&&n(i=>i?(i.set(a,xf(a)),new Map(i)):null)},[]);return f.useEffect(()=>{const o=r.current;if(e!==o){a(o);const i=e.map(c=>{const u=Cf(c);return u?(u.addEventListener("scroll",s,{passive:!0}),[u,xf(u)]):null}).filter(c=>c!=null);n(i.length?new Map(i):null),r.current=e}return()=>{a(e),a(o)};function a(i){i.forEach(c=>{const u=Cf(c);u==null||u.removeEventListener("scroll",s)})}},[s,e]),f.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,a)=>ji(o,a),es):D0(e):es,[e,t])}const $6=[];function k6(e){const t=f.useRef(e),n=Vi(r=>e?r&&e&&t.current&&e.parentNode===t.current.parentNode?r:Sf(e):$6,[e]);return f.useEffect(()=>{t.current=e},[e]),n}function I6(e){f.useEffect(()=>{if(!Dc)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 V6(e,t){return f.useMemo(()=>e.reduce((n,{eventName:r,handler:s})=>(n[r]=o=>{s(o,t)},n),{}),[e,t])}const Tf=q0(zc),H6=j6(zc);function G0(e,t,n){const r=f.useRef(e);return Vi(s=>e?n||!s&&e||e!==r.current?ha(e)&&e.parentNode==null?null:t(e):s??null:null,[e,n,t])}function q0(e){return(t,n)=>G0(t,e,n)}function j6(e){const t=[];return function(r,s){const o=f.useRef(r);return Vi(a=>r.length?s||!a&&r.length||r!==o.current?r.map(i=>e(i)):a??t:t,[r,s])}}function D6(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return ha(t)?t:e}function F6(e){const{width:t,height:n,offsetLeft:r,offsetTop:s}=Bc(e);return{top:s,bottom:s+n,left:r,right:r+t,width:t,height:n,offsetTop:s,offsetLeft:r}}const B6=q0(F6);function z6({disabled:e,forceRecompute:t}){const[n,r]=bf(),s=B6(e?null:D6(n.current),t);return f.useMemo(()=>({nodeRef:n,rect:s,setRef:r}),[s,n,r])}function K0(e,t){return f.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function U6(...e){return f.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class Ui{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 s;(s=this.target)==null||s.addEventListener(t,n,r),this.listeners.push([t,n,r])}}function W6(e){const{EventTarget:t}=Is(e);return e instanceof t?e:ga(e)}function Of(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 Dn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(Dn||(Dn={}));function Z0(e){e.preventDefault()}function G6(e){e.stopPropagation()}var je;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(je||(je={}));const Y0={start:[je.Space,je.Enter],cancel:[je.Esc],end:[je.Space,je.Enter]},q6=(e,{currentCoordinates:t})=>{switch(e.code){case je.Right:return{...t,x:t.x+25};case je.Left:return{...t,x:t.x-25};case je.Down:return{...t,y:t.y+25};case je.Up:return{...t,y:t.y-25}}};class Af{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=es;const{event:{target:n}}=t;this.props=t,this.listeners=new Ui(ga(n)),this.windowListeners=new Ui(Is(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(Dn.Resize,this.handleCancel),this.windowListeners.add(Dn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(Dn.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=zc(t.node.current),s={x:r.left,y:r.top};this.coordinates=s,n(s)}handleKeyDown(t){if(t6(t)){const{coordinates:n}=this,{active:r,context:s,options:o}=this.props,{keyboardCodes:a=Y0,coordinateGetter:i=q6,scrollBehavior:c="smooth"}=o,{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:s.current,currentCoordinates:n});if(d){const p={x:0,y:0},{scrollableAncestors:h}=s.current;for(const g of h){const m=t.code,b=$0(d,n),{isTop:v,isRight:w,isLeft:y,isBottom:S,maxScroll:C,minScroll:x}=j0(g),E=C6(g),P={x:Math.min(m===je.Right?E.right-E.width/2:E.right,Math.max(m===je.Right?E.left:E.left+E.width/2,d.x)),y:Math.min(m===je.Down?E.bottom-E.height/2:E.bottom,Math.max(m===je.Down?E.top:E.top+E.height/2,d.y))},O=m===je.Right&&!w||m===je.Left&&!y,A=m===je.Down&&!S||m===je.Up&&!v;if(O&&P.x!==d.x){if(m===je.Right&&g.scrollLeft+b.x<=C.x||m===je.Left&&g.scrollLeft+b.x>=x.x){g.scrollBy({left:b.x,behavior:c});return}p.x=m===je.Right?g.scrollLeft-C.x:g.scrollLeft-x.x,g.scrollBy({left:-p.x,behavior:c});break}else if(A&&P.y!==d.y){if(m===je.Down&&g.scrollTop+b.y<=C.y||m===je.Up&&g.scrollTop+b.y>=x.y){g.scrollBy({top:b.y,behavior:c});return}p.y=m===je.Down?g.scrollTop-C.y:g.scrollTop-x.y,g.scrollBy({top:-p.y,behavior:c});break}}this.handleMove(t,ji(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()}}Af.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=Y0,onActivation:n})=>{const{code:r}=e.nativeEvent;return t.start.includes(r)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function X0(e){return!!(e&&"distance"in e)}function J0(e){return!!(e&&"delay"in e)}class _f{constructor(t,n,r=W6(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:s}=t,{target:o}=s;this.props=t,this.events=n,this.document=ga(o),this.documentListeners=new Ui(this.document),this.listeners=new Ui(r),this.windowListeners=new Ui(Is(o)),this.initialCoordinates=yf(s),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(Dn.Resize,this.handleCancel),this.windowListeners.add(Dn.DragStart,Z0),this.windowListeners.add(Dn.VisibilityChange,this.handleCancel),this.windowListeners.add(Dn.ContextMenu,Z0),this.documentListeners.add(Dn.Keydown,this.handleKeydown),n){if(X0(n))return;if(J0(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(Dn.Click,G6,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(Dn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:r,props:s}=this,{onMove:o,options:{activationConstraint:a}}=s;if(!r)return;const i=yf(t),c=$0(r,i);if(!n&&a){if(J0(a))return Of(c,a.tolerance)?this.handleCancel():void 0;if(X0(a))return a.tolerance!=null&&Of(c,a.tolerance)?this.handleCancel():Of(c,a.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),o(i)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===je.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const K6={move:{name:"pointermove"},end:{name:"pointerup"}};class Mf extends _f{constructor(t){const{event:n}=t,r=ga(n.target);super(t,K6,r)}}Mf.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const Z6={move:{name:"mousemove"},end:{name:"mouseup"}};var Lf;(function(e){e[e.RightClick=2]="RightClick"})(Lf||(Lf={}));class Y6 extends _f{constructor(t){super(t,Z6,ga(t.event.target))}}Y6.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===Lf.RightClick?!1:(t==null||t({event:e}),!0)}];const Nf={move:{name:"touchmove"},end:{name:"touchend"}};class X6 extends _f{constructor(t){super(t,Nf)}static setup(){return window.addEventListener(Nf.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Nf.move.name,t)};function t(){}}}X6.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function J6(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((r,s)=>s({transform:r,...n}),t):t}const Q6=[{sensor:Mf,options:{}},{sensor:Af,options:{}}],R6={current:{}},Q0=f.createContext({...es,scaleX:1,scaleY:1}),e8=f.memo(function({id:t,autoScroll:n=!0,announcements:r,children:s,sensors:o=Q6,collisionDetection:a=P6,measuring:i,modifiers:c,screenReaderInstructions:u=i6,...d}){var p,h,g,m,b;const v=f.useReducer(u6,void 0,c6),[w,y]=v,[S,C]=f.useState(()=>({type:null,event:null})),[x,E]=f.useState(!1),{draggable:{active:P,nodes:O,translate:A},droppable:{containers:T}}=w,_=P?O[P]:null,L=f.useRef({initial:null,translated:null}),$=f.useMemo(()=>{var qe;return P!=null?{id:P,data:(qe=_==null?void 0:_.data)!=null?qe:R6,rect:L}:null},[P,_]),D=f.useRef(null),[N,B]=f.useState(null),[q,F]=f.useState(null),k=f.useRef(d),H=Hi("DndDescribedBy",t),V=f.useMemo(()=>T.getEnabled(),[T]),{layoutRectMap:U,recomputeLayouts:X,willRecomputeLayouts:Y}=M6(V,{dragging:x,dependencies:[A.x,A.y],config:i==null?void 0:i.droppable}),R=O6(O,P),ee=q?yf(q):null,te=G0(R,(p=i==null||(h=i.draggable)==null?void 0:h.measure)!=null?p:Ef),K=Tf(R),ne=f.useRef(null),ce=ne.current,ge=f.useRef({active:null,activeNode:R,collisionRect:null,droppableRects:U,draggableNodes:O,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),De=T.getNodeFor((g=ge.current.over)==null?void 0:g.id),ve=Tf(R?R.ownerDocument.defaultView:null),Ze=Tf(R?R.parentElement:null),Ge=k6(P?De??R:null),bt=H6(Ge),tt=z6({disabled:P==null,forceRecompute:Y}),be=(m=tt.rect)!=null?m:te,Je=be===te?g6(te,ce):es,Qe=J6(c,{transform:{x:A.x-Je.x,y:A.y-Je.y,scaleX:1,scaleY:1},activatorEvent:q,active:$,activeNodeRect:K,containerNodeRect:Ze,draggingNodeRect:be,over:ge.current.over,overlayNodeRect:tt.rect,scrollableAncestors:Ge,scrollableAncestorRects:bt,windowRect:ve}),dt=ee?ji(ee,A):null,Te=N6(Ge),it=ji(Qe,Te),nt=be?H0(be,Qe):null,Ie=nt?H0(nt,Te):null,Wt=$&&Ie?a({active:$,collisionRect:Ie,droppableContainers:V}):null,[pe,Le]=f.useState(null),Ne=h6(Qe,(b=pe==null?void 0:pe.rect)!=null?b:null,te),Me=f.useCallback((qe,{sensor:pt,options:Gt})=>{if(!D.current)return;const Bn=O[D.current];if(!Bn)return;const Dt=new pt({active:D.current,activeNode:Bn,event:qe.nativeEvent,options:Gt,context:ge,onStart(fn){const rs=D.current;if(!rs)return;const Bs=O[rs];if(!Bs)return;const{onDragStart:zs}=k.current,Us={active:{id:rs,data:Bs.data,rect:L}};Pn.unstable_batchedUpdates(()=>{y({type:at.DragStart,initialCoordinates:fn,active:rs}),C({type:at.DragStart,event:Us})}),zs==null||zs(Us)},onMove(fn){y({type:at.DragMove,coordinates:fn})},onEnd:Ao(at.DragEnd),onCancel:Ao(at.DragCancel)});Pn.unstable_batchedUpdates(()=>{B(Dt),F(qe.nativeEvent)});function Ao(fn){return async function(){const{active:Bs,over:zs,scrollAdjustedTranslate:Us}=ge.current;let Ws=null;if(Bs&&Us){const{cancelDrop:nn}=k.current;Ws={active:Bs,delta:Us,over:zs},fn===at.DragEnd&&typeof nn=="function"&&await Promise.resolve(nn(Ws))&&(fn=at.DragCancel)}if(D.current=null,Pn.unstable_batchedUpdates(()=>{y({type:fn}),Le(null),E(!1),B(null),F(null),Ws&&C({type:fn,event:Ws})}),Ws){const{onDragCancel:nn,onDragEnd:ir}=k.current,cu=fn===at.DragEnd?ir:nn;cu==null||cu(Ws)}}}},[y,O]),St=f.useCallback((qe,pt)=>(Gt,Bn)=>{const Dt=Gt.nativeEvent;D.current!==null||Dt.dndKit||Dt.defaultPrevented||qe(Gt,pt.options)===!0&&(Dt.dndKit={capturedBy:pt.sensor},D.current=Bn,Me(Gt,pt))},[Me]),It=A6(o,St);I6(o),Eo(()=>{k.current=d},Object.values(d)),f.useEffect(()=>{P!=null&&E(!0)},[P]),f.useEffect(()=>{$||(ne.current=null),$&&te&&!ne.current&&(ne.current=te)},[te,$]),f.useEffect(()=>{const{onDragMove:qe}=k.current,{active:pt,over:Gt}=ge.current;if(!pt)return;const Bn={active:pt,delta:{x:it.x,y:it.y},over:Gt};C({type:at.DragMove,event:Bn}),qe==null||qe(Bn)},[it.x,it.y]),f.useEffect(()=>{const{active:qe,droppableContainers:pt,scrollAdjustedTranslate:Gt}=ge.current;if(!qe||!D.current||!Gt)return;const{onDragOver:Bn}=k.current,Dt=pt.get(Wt),Ao=Dt&&Dt.rect.current?{id:Dt.id,rect:Dt.rect.current,data:Dt.data,disabled:Dt.disabled}:null,fn={active:qe,delta:{x:Gt.x,y:Gt.y},over:Ao};Pn.unstable_batchedUpdates(()=>{Le(Ao),C({type:at.DragOver,event:fn}),Bn==null||Bn(fn)})},[Wt]),Eo(()=>{ge.current={active:$,activeNode:R,collisionRect:Ie,droppableRects:U,draggableNodes:O,draggingNodeRect:be,droppableContainers:T,over:pe,scrollableAncestors:Ge,scrollAdjustedTranslate:it,translatedRect:nt},L.current={initial:be,translated:nt}},[$,R,Ie,O,be,U,T,pe,Ge,it,nt]),T6({...Oo(),draggingRect:nt,pointerCoordinates:dt,scrollableAncestors:Ge,scrollableAncestorRects:bt});const ns=f.useMemo(()=>({active:$,activeNode:R,activeNodeRect:te,activeNodeClientRect:K,activatorEvent:q,activators:It,ariaDescribedById:{draggable:H},containerNodeRect:Ze,dispatch:y,dragOverlay:tt,draggableNodes:O,droppableContainers:T,droppableRects:U,over:pe,recomputeLayouts:X,scrollableAncestors:Ge,scrollableAncestorRects:bt,willRecomputeLayouts:Y,windowRect:ve}),[$,R,K,te,q,It,Ze,tt,y,O,H,T,U,pe,X,Ge,bt,Y,ve]);return f.createElement(k0.Provider,{value:S},f.createElement(Fc.Provider,{value:ns},f.createElement(Q0.Provider,{value:Ne},s)),f.createElement(p6,{announcements:r,hiddenTextDescribedById:H,screenReaderInstructions:u}));function Oo(){const qe=(N==null?void 0:N.autoScrollEnabled)===!1,pt=typeof n=="object"?n.enabled===!1:n===!1,Gt=!qe&&!pt;return typeof n=="object"?{...n,enabled:Gt}:{enabled:Gt}}}),t8=f.createContext(null),R0="button",n8="Droppable";function r8({id:e,data:t,disabled:n=!1,attributes:r}){const s=Hi(n8),{active:o,activeNodeRect:a,activatorEvent:i,ariaDescribedById:c,draggableNodes:u,droppableRects:d,activators:p,over:h}=f.useContext(Fc),{role:g=R0,roleDescription:m="draggable",tabIndex:b=0}=r??{},v=(o==null?void 0:o.id)===e,w=f.useContext(v?Q0:t8),[y,S]=bf(),C=V6(p,e),x=U0(t);f.useEffect(()=>(u[e]={id:e,key:s,node:y,data:x},()=>{const P=u[e];P&&P.key===s&&delete u[e]}),[u,e]);const E=f.useMemo(()=>({role:g,tabIndex:b,"aria-pressed":v&&g===R0?!0:void 0,"aria-roledescription":m,"aria-describedby":c.draggable}),[g,b,v,m,c.draggable]);return{active:o,activeNodeRect:a,activatorEvent:i,attributes:E,droppableRects:d,isDragging:v,listeners:n?void 0:C,node:y,over:h,setNodeRef:S,transform:w}}function s8(){return f.useContext(Fc)}const o8="Droppable";function a8({data:e,disabled:t=!1,id:n}){const r=Hi(o8),{active:s,dispatch:o,over:a}=f.useContext(Fc),i=f.useRef(null),[c,u]=bf(),d=U0(e);return Eo(()=>(o({type:at.RegisterDroppable,element:{id:n,key:r,disabled:t,node:c,rect:i,data:d}}),()=>o({type:at.UnregisterDroppable,key:r,id:n})),[n]),f.useEffect(()=>{o({type:at.SetDroppableDisabled,id:n,key:r,disabled:t})},[t]),{active:s,rect:i,isOver:(a==null?void 0:a.id)===n,node:c,over:a,setNodeRef:u}}function i8(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 l8=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const r=n[0];return!e||!r?t:i8(t,e,r)},c8=({transform:e})=>({...e,x:0});function ey(e,t,n){const r=e.slice();return r.splice(n<0?r.length+n:n,0,r.splice(t,1)[0]),r}function u8(e,t){return e.reduce((n,r,s)=>{const o=t.get(r);return o&&(n[s]=o),n},Array(e.length))}function Wc(e){return e!==null&&e>=0}const ty=({layoutRects:e,activeIndex:t,overIndex:n,index:r})=>{const s=ey(e,n,t),o=e[r],a=s[r];return!a||!o?null:{x:a.offsetLeft-o.offsetLeft,y:a.offsetTop-o.offsetTop,scaleX:a.width/o.width,scaleY:a.height/o.height}},Gc={scaleX:1,scaleY:1},d8=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:r,overIndex:s})=>{var o;const a=(o=r[e])!=null?o:t;if(!a)return null;if(n===e){const c=r[s];return c?{x:0,y:e<s?c.offsetTop+c.height-(a.offsetTop+a.height):c.offsetTop-a.offsetTop,...Gc}:null}const i=p8(r,n,e);return n>e&&n<=s?{x:0,y:-a.height-i,...Gc}:n<e&&n>=s?{x:0,y:a.height+i,...Gc}:{x:0,y:0,...Gc}};function p8(e,t,n){const r=e[t],s=e[t-1],o=e[t+1];return r?n<t?s?r.offsetTop-(s.offsetTop+s.height):o?o.offsetTop-(r.offsetTop+r.height):0:o?o.offsetTop-(r.offsetTop+r.height):s?r.offsetTop-(s.offsetTop+s.height):0:0}const ny="Sortable",ry=f.createContext({activeIndex:-1,containerId:ny,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:ty,wasDragging:{current:!1}});function f8({children:e,id:t,items:n,strategy:r=ty}){const{active:s,dragOverlay:o,droppableRects:a,over:i,recomputeLayouts:c,willRecomputeLayouts:u}=s8(),d=Hi(ny,t),p=o.rect!==null,h=f.useMemo(()=>n.map(P=>typeof P=="string"?P:P.id),[n]),g=s!=null,m=f.useRef(!1),b=s?h.indexOf(s.id):-1,v=b!==-1,w=i?h.indexOf(i.id):-1,y=f.useRef(h),S=u8(h,a),C=!h8(h,y.current),x=w!==-1&&b===-1||C;Eo(()=>{C&&v&&!u&&c()},[C,v,c,u]),f.useEffect(()=>{y.current=h},[h]),f.useEffect(()=>{const P=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(P)},[g]);const E=f.useMemo(()=>({activeIndex:b,containerId:d,disableTransforms:x,items:h,overIndex:w,useDragOverlay:p,sortedRects:S,strategy:r,wasDragging:m}),[b,d,x,h,w,S,p,r,m]);return f.createElement(ry.Provider,{value:E},e)}function h8(e,t){return e.join()===t.join()}const g8=({id:e,items:t,activeIndex:n,overIndex:r})=>ey(t,n,r).indexOf(e),m8=({containerId:e,isSorting:t,wasDragging:n,index:r,items:s,newIndex:o,previousItems:a,previousContainerId:i,transition:c})=>!c||!n||a!==s&&r===o?!1:t?!0:o!==r&&e===i,b8={duration:200,easing:"ease"},sy="transform",v8=Di.Transition.toString({property:sy,duration:0,easing:"linear"}),y8={roleDescription:"sortable"};function w8({disabled:e,index:t,node:n,rect:r}){const[s,o]=f.useState(null),a=f.useRef(t);return Eo(()=>{if(!e&&t!==a.current&&n.current){const i=r.current;if(i){const c=zc(n.current),u={x:i.offsetLeft-c.offsetLeft,y:i.offsetTop-c.offsetTop,scaleX:i.width/c.width,scaleY:i.height/c.height};(u.x||u.y)&&o(u)}}t!==a.current&&(a.current=t)},[e,t,n,r]),f.useEffect(()=>{s&&requestAnimationFrame(()=>{o(null)})},[s]),s}function S8({animateLayoutChanges:e=m8,attributes:t,disabled:n,data:r,getNewIndex:s=g8,id:o,strategy:a,transition:i=b8}){const{items:c,containerId:u,activeIndex:d,disableTransforms:p,sortedRects:h,overIndex:g,useDragOverlay:m,strategy:b,wasDragging:v}=f.useContext(ry),w=c.indexOf(o),y=f.useMemo(()=>({sortable:{containerId:u,index:w,items:c},...r}),[u,r,w,c]),{rect:S,node:C,setNodeRef:x}=a8({id:o,data:y}),{active:E,activeNodeRect:P,activatorEvent:O,attributes:A,setNodeRef:T,listeners:_,isDragging:L,over:$,transform:D}=r8({id:o,data:y,attributes:{...y8,...t},disabled:n}),N=Jk(x,T),B=!!E,q=B&&v.current&&!p&&Wc(d)&&Wc(g),F=!m&&L,k=F&&q?D:null,V=q?k??(a??b)({layoutRects:h,activeNodeRect:P,activeIndex:d,overIndex:g,index:w}):null,U=Wc(d)&&Wc(g)?s({id:o,items:c,activeIndex:d,overIndex:g}):w,X=f.useRef(c),Y=c!==X.current,R=f.useRef(U),ee=f.useRef(u),te=e({active:E,containerId:u,isDragging:L,isSorting:B,id:o,index:w,items:c,newIndex:R.current,previousItems:X.current,previousContainerId:ee.current,transition:i,wasDragging:v.current}),K=w8({disabled:!te,index:w,node:C,rect:S});return f.useEffect(()=>{B&&R.current!==U&&(R.current=U),u!==ee.current&&(ee.current=u),c!==X.current&&(X.current=c)},[B,U,u,c]),{active:E,attributes:A,activatorEvent:O,rect:S,index:w,isSorting:B,isDragging:L,listeners:_,node:C,overIndex:g,over:$,setNodeRef:N,setDroppableNodeRef:x,setDraggableNodeRef:T,transform:K??V,transition:ne()};function ne(){if(K||Y&&R.current===w)return v8;if(!(F||!i)&&(B||te))return Di.Transition.toString({...i,property:sy})}}const C8=[je.Down,je.Right,je.Up,je.Left],x8=(e,{context:{active:t,droppableContainers:n,translatedRect:r,scrollableAncestors:s}})=>{if(C8.includes(e.code)){if(e.preventDefault(),!t||!r)return;const a=[];n.getEnabled().forEach(c=>{if(!c||c!=null&&c.disabled)return;const u=c==null?void 0:c.node.current;if(!u)return;const d=Ef(u),p={...c,rect:{current:d}};switch(e.code){case je.Down:r.top+r.height<=d.top&&a.push(p);break;case je.Up:r.top>=d.top+d.height&&a.push(p);break;case je.Left:r.left>=d.left+d.width&&a.push(p);break;case je.Right:r.left+r.width<=d.left&&a.push(p);break}});const i=x6({active:t,collisionRect:r,droppableContainers:a});if(i){var o;const c=(o=n.get(i))==null?void 0:o.node.current;if(c){const d=Sf(c).some((m,b)=>s[b]!==m),p=Ef(c),h=d?{x:0,y:0}:{x:r.width-p.width,y:r.height-p.height};return{x:p.left-h.x,y:p.top-h.y}}}}};function E8(e){const{id:t,item:n,className:r,select:s,remove:o,renderItem:a,previewStyle:i,sortable:c=!0,disabled:u,confirmRemove:d}=e,{attributes:p,listeners:h,setNodeRef:g,transform:m,transition:b}=S8({id:t,disabled:u}),v={transform:Di.Transform.toString(m),transition:b},w=()=>!u&&(s==null?void 0:s(n));return l.jsx("div",{...c?{ref:g,style:v,...p}:{},children:l.jsxs(I,{space:"s",onClick:w,className:r,items:"center",nowrap:!0,children:[c&&l.jsx(j,{className:Z(!u&&Ce.hover,!u&&"cursor-grab"),...h,children:l.jsx(Q,{icon:W.dotsVertical,size:oe.sx})}),l.jsx(j,{grow:!0,className:Z("overflow-hidden"),children:l.jsxs(I,{children:[l.jsx(j,{grow:!0,className:Z("overflow-ellipsis overflow-hidden"),children:a(n)}),!!i&&l.jsx(j,{children:l.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",J.b,J.rnd),style:i(n)})})]})}),o&&d?l.jsx(Ec,{disabled:u,onConfirm:()=>{o==null||o(n)},children:l.jsx(j,{className:Z(!u&&Ce.click),children:l.jsx(Q,{icon:W.close,size:oe.sx})})}):l.jsx(j,{className:Z(!u&&Ce.click),onClick:y=>{Gs(y),!u&&(o==null||o(n))},children:l.jsx(Q,{icon:W.close,size:oe.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Mr(e){const{className:t,items:n,selected:r,renderItem:s,select:o,add:a,remove:i,move:c,previewStyle:u,getItemId:d=T=>T.id||T.name||T.title||T.label||"",label:p,labelAs:h,children:g,title:m="Select",titleAdd:b="Add",emptyState:v,disabled:w=!1,hidePopover:y,popoverPlacement:S="left",confirmRemove:C}=e,x=U6(K0(Mf),K0(Af,{coordinateGetter:x8}));function E(T){const{active:_,over:L}=T;if(_.id!==(L==null?void 0:L.id)){const $=n.find(N=>d(N)===_.id),D=n.findIndex(N=>d(N)===(L==null?void 0:L.id));$&&(c==null||c($,D))}}const P=Z(J.rnd,z.br,n.length&&J.b,n.length&&"gjs-mt-1");let O=l.jsxs("div",{className:P,children:[n.length===0&&v&&l.jsx(I,{className:M("gs-utl-p-2 gs-utl-text-center",z.txtLowEmphasis),items:"center",justify:"center",children:v}),n.map((T,_)=>{const L=d(T),$=T===r,D=Z("gjs-px-2 gjs-py-2 text-xs",z.br,_&&J.bt,!!o&&!$&&!w&&z.hBgH2,$&&z.bgH,w&&"opacity-75");return l.jsx(E8,{id:L,item:T,className:D,select:o,remove:i,renderItem:s,previewStyle:u,sortable:!!c,disabled:w,confirmRemove:C},L||_)})]});c&&(O=l.jsx(e8,{sensors:x,collisionDetection:f6,onDragEnd:E,modifiers:[c8,l8],children:l.jsx(f8,{items:n.map(d),strategy:d8,children:O})})),o&&!y&&(O=l.jsx(sr,{placement:S,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!r&&!w,onClose:()=>o==null?void 0:o(null),handler:O,children:g}));const A=a?[{type:"button",icon:W.plus,tooltip:b,variant:"outline",size:"xs",disabled:w,onClick:a}]:[];return l.jsxs("div",{className:Z(t,"w-full"),children:[!!(p||a)&&l.jsx(nr,{...e,as:h,afterLabelButtons:A}),O]})}const P8=ie(function(){const t=_e(),{editor:n}=me(),r=ii(),s=li(),o=s.sortedFonts;return n?l.jsx(Mr,{items:o,selected:null,renderItem:a=>{const i=np(a);return l.jsxs(I,{col:!0,children:[l.jsx(j,{className:"gs-utl-text-lg",style:{fontFamily:i},children:a.familyLabel}),l.jsx(j,{children:a.familyLabel})]})},remove:a=>s.removeFont(a.family),add:s.sdkAddFonts&&r.hasType("font")?()=>hf(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:a=>a.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),oy=f.forwardRef(function({size:t="m",className:n,classNameContent:r,border:s=!0,children:o,...a},i){const c=ae(z.bg,z.br,s&&`${J.b} ${J.rnd}`,t==="m"&&Se.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return l.jsx(I,{className:c,items:"center",space:"x2s",...a,ref:i,children:l.jsx(j,{grow:!0,className:r,children:o})})}),ay=f.forwardRef(({autoResize:e,style:t={},...n},r)=>{const s=f.useRef(null),o=r||s;return f.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[n.value,e,o]),l.jsx("textarea",{ref:o,style:{...t,...e?{resize:"none"}:{}},...n})});ay.displayName="TextAreaWithAutoResize";const T8="gs-field-textarea";function iy(e){const{className:t,value:n,label:r,size:s,description:o,placeholder:a,readOnly:i,disabled:c,required:u,onChange:d,onKeyDown:p,afterInput:h,minHeight:g,maxHeight:m,autoResize:b,classNameField:v,classNameFieldContent:w,classNameInput:y}=e,S=bi(e);return l.jsxs("div",{className:Z(T8,t),children:[!!r&&l.jsx(Ts,{size:s,children:r}),!!o&&l.jsx(Ts,{size:s,as:"span",className:Z(z.txtLowEmphasis),capitalize:!1,children:o}),l.jsxs(oy,{size:s,className:v,classNameContent:w,children:[l.jsx(ay,{className:Z(S,y),autoResize:b,value:n,placeholder:a,readOnly:i,disabled:c,required:u,onChange:C=>d==null?void 0:d(C.target.value),onKeyDown:p,style:{minHeight:g,maxHeight:m}}),h]})]})}const qc="gs-page-settings",O8=`${qc}-header`,A8=`${qc}-content`,_8=`${qc}-footer`,ly="",M8=ie(function({className:t,classNameHeader:n,classNameContent:r,classNameFooter:s,page:o,size:a=Cp.m}){const i=me(),{isDarkTheme:c}=Cr(),u=li(),d=_e(),[p,h]=f.useState(o),[g,m]=f.useState(()=>xm(p,i)),[b,v]=f.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:c,clean:!0};if(!S)return null;const x=$=>m(D=>({...D,...$})),E=$=>{$.preventDefault();const{name:D,...N}=g;N.customCodeHead=Aw(N.customCodeHead),N.customCodeBody=Ow(N.customCodeBody),p?(fA(p,N),p.setName(D)):i.setProjectDataCustom({globalPageSettings:N}),v(d.t("updated")),setTimeout(()=>v(d.t("update")),2e3),vm(S),S.trigger(hn.pageSettingsUpdate,{page:p,data:{name:D,...N}})},P={tooltip:d.t("clear")},O=(p==null?void 0:p.getId())??ly,A=$=>{const D=S.Pages.get($);h(D),m(xm(D,i))},T=sp(p),_=!!p&&Zl(p),L=[{id:ly,label:w("global")},...S.Pages.getAll().map($=>({icon:mm($),id:$.getId(),label:$.getName()}))];return l.jsx("form",{onSubmit:E,className:M(qc,"gs-utl-h-full",t),children:l.jsxs(I,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[l.jsx(j,{className:M(O8,n,z.br,J.bb),children:l.jsx(Ee,{value:O,onChange:A,options:L,handlerSelected:$=>l.jsxs(I,{items:"center",gap:"xs",nowrap:!0,children:[l.jsxs("b",{children:[d.t("pageManager.page"),":"]}),$.icon&&et($.icon)&&l.jsx(Q,{icon:$.icon,size:oe.s2x}),l.jsx("span",{children:$.label})]})})}),l.jsxs(I,{col:!0,className:M(A8,"gs-utl-gap-5 gs-utl-overflow-y-auto",r),nowrap:!0,children:[!!O&&l.jsxs(l.Fragment,{children:[l.jsx(Xe,{size:a,value:g.name,onChange:$=>x({name:$}),label:y("name.label"),description:y("name.description"),required:!0}),!T&&l.jsx(Xe,{size:a,value:g.slug,onChange:$=>x({slug:_?Fw($,["id"]):Yi($)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),l.jsx(Xe,{size:a,value:g.title,onChange:$=>x({title:$}),label:y("title.label"),description:y("title.description")}),l.jsx(iy,{size:a,value:g.description,onChange:$=>x({description:$}),label:y("description.label"),description:y("description.description")}),l.jsx(Ii,{size:a,clear:P,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")}),l.jsx(Xe,{size:a,value:g.keywords,onChange:$=>x({keywords:$}),label:y("keywords.label"),description:y("keywords.description")}),l.jsx(Xe,{size:a,value:g.socialTitle,onChange:$=>x({socialTitle:$}),label:y("socialTitle.label"),description:y("socialTitle.description")}),l.jsx(Ii,{size:a,clear:P,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")}),l.jsx(iy,{size:a,value:g.socialDescription,onChange:$=>x({socialDescription:$}),label:y("socialDescription.label"),description:y("socialDescription.description")}),l.jsx(Yr,{language:"html",defaultValue:g.customCodeHead,onChange:$=>x({customCodeHead:$}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...C},`head-${O}`),l.jsx(Yr,{language:"html",defaultValue:g.customCodeBody,onChange:$=>x({customCodeBody:$}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...C},`body-${O}`),u.sdkShowProjectFonts&&!O&&l.jsx(P8,{})]}),l.jsx(I,{className:M(_8,"gs-utl-mt-auto",s,z.br,J.bt),children:l.jsx(Ue,{type:"submit",variant:"pr",size:"m2",full:!0,children:b})})]})})}),L8="gs-panel-page-settings",N8=f.memo(ie(function({className:t,page:n,...r}){return l.jsx(or,{className:M(L8,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...r,children:l.jsx(yi,{children:l.jsx(M8,{className:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:Cp.s,classNameHeader:Se.s,classNameContent:Se.s,classNameFooter:Se.s})})})})),Kc="gs-page-item",cy=ie(function({page:t,rename:n,setRename:r,commandItems:s}){const o=me(),a=_e(),i=o.editor,{Pages:c}=i,u=o.sdkPagesConfig,d=u==null?void 0:u.settings,p=u==null?void 0:u.showHomeIcon,h=u==null?void 0:u.layoutBefore,g=E=>a.t(`pageManager.${E}`),m=E=>c.select(E),b=E=>c.getSelected()===E,v=E=>E===n,w=b(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 l.jsxs(I,{gap:"s",items:"center",onClick:()=>m(t),className:ae([Kc,"group cursor-default",Se.xy,w?z.bgH:z.hBgH2]),children:[p&&sp(t)&&l.jsx(j,{className:`${Kc}__icon-home`,title:g("homePage"),children:l.jsx(Q,{icon:W.home,size:oe.s3x})}),h&&Tt(h({page:t,editor:i,isSelected:w})),l.jsx(j,{className:ae(`${Kc}__name truncate`),grow:!0,children:v(t)?l.jsx(ff,{value:y(t),onChange:S}):l.jsx(l.Fragment,{children:y(t)})}),l.jsxs(I,{className:`${Kc}__actions`,gap:"xs",onClick:Gs,items:"center",children:[!n&&d!==!1&&l.jsx(ft,{className:C,size:"xs",border:!1,title:g("settings.label"),onClick:x,block:!0,children:l.jsx(Q,{icon:W.cog,size:oe.s3x})}),w&&!!s.length&&l.jsx(sr,{placement:"right-start",handler:l.jsx(Q,{icon:W.dotsVertical,size:oe.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:E})=>s.map(P=>l.jsx(ia,{icon:P.icon,label:Ke(P.label)?P.label({editor:i}):P.label,action:()=>{var O;E(),(O=P.cmd)==null||O.call(P,{page:t,editor:i})}},P.id))})]})]},t.getId())});function $8({dragging:e,dragRect:t}){const n=!!(e&&t),r=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:r}}var uy=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(uy||{});const $f="gs-cmp-sortable",dy=3;function k8({items:e,direction:t,onDrop:n,renderItem:r}){const[s,o]=f.useState(null),[a,i]=f.useState(-1),[c,u]=f.useState(),[d,p]=f.useState(!1),h=f.useRef(null),{showIndicator:g,indicatorStyle:m}=$8({dragging:!!s&&d,dragRect:c}),b=f.useMemo(()=>[],[e]);f.useEffect(()=>{const P=window.document,O=A=>A.key==="Escape"&&y(A);return P.addEventListener("keydown",O),()=>P.removeEventListener("keydown",O)},[]);const v=P=>O=>{O.button===0&&(h.current={x:O.clientX,y:O.clientY},o(P),p(!1),O.target.setPointerCapture(O.pointerId))},w=P=>{const O=h.current;if(!s||!O)return;if(!d){const $=Math.abs(P.clientX-O.x),D=Math.abs(P.clientY-O.y);(t==="vertical"?D>dy:$>dy)&&p(!0);return}const A=P.clientY;let T=-1;b.forEach(($,D)=>{const N=$.getBoundingClientRect();A>N.top+N.height/2&&(T=D)});const _=e.findIndex($=>$.id===s.id);T<_&&(T+=1),T=Math.min(T,e.length-1),i(T);const L=b[T];if(L){const{height:$,top:D}=L.getBoundingClientRect(),N=A<D+$/2;u({y:L.offsetTop+(N?0:$),h:$})}},y=P=>{o(null),p(!1),h.current=null,u(void 0);const O=P.target,{pointerId:A}=P;A&&(O==null||O.releasePointerCapture(A))},S=P=>{!s||!h.current||(c&&a!==-1&&(n==null||n(s,a)),y(P))},C=M($f,"gs-utl-relative"),x=M(`${$f}__indicator`,z.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),E=P=>M(`${$f}__item`,g&&(s==null?void 0:s.id)===P.id&&"gs-utl-opacity-50 gs-utl-select-none");return l.jsxs(l.Fragment,{children:[l.jsx(I,{col:t==="vertical",className:C,children:e.map((P,O)=>l.jsx(j,{ref:A=>{A&&(b[O]=A)},className:E(P),onPointerDown:v(P),onPointerMove:w,onPointerUp:S,children:r(P)},P.id))}),g&&l.jsx("div",{className:x,style:m})]})}const I8=({pages:e,commandItems:t,rename:n,setRename:r,editor:s})=>{if(!s.Pages.move)return e.map(c=>l.jsx(cy,{page:c,commandItems:t,rename:n,setRename:r},c.getId()));const o=(c,u)=>{s.Pages.move(c.entity,{at:u})},a=c=>l.jsx(cy,{page:c.entity,commandItems:t,rename:n,setRename:r},c.id),i=e.map(c=>({id:c.getId(),entity:c}));return l.jsx(k8,{items:i,direction:uy.vertical,onDrop:o,renderItem:a})},V8=({items:e,editor:t,sdkPageConfig:n})=>{const r=n==null?void 0:n.commandItems;return r===!1?[]:Ke(r)?r({items:e,editor:t}):r||e},kf="gs-panel-page-manager",py=ie(function({pages:t,select:n,add:r,remove:s,header:o,resizable:a={bottom:!0},height:i=200}){const c=me(),u=ra(),d=_e(),{sdkPagesConfig:p}=c,h=c.editor,[g,m]=f.useState(),b=L=>d.t(`pageManager.${L}`),v=p==null?void 0:p.add,w=p==null?void 0:p.duplicate,y=p==null?void 0:p.remove,S=L=>{Gs(L);const $=N=>{const B=t.length+1;return r({name:`${b("page")} ${B}`,component:`<div>${b("newPage")} ${B}</div>`,...N},{select:!0})};if(v)return v({event:L,editor:h,rename:m,addPage:$});const D=$();D&&m(D)},C=({page:L})=>{if(y)return y({editor:h,page:L});u.confirm({title:b("deletePage"),content:b("confirmDelete"),confirmButton:{variant:"danger",children:b("deletePage")},onConfirm:()=>{const $=t.indexOf(L),D=t[$+1]||t[0];n(D),s(L)}})},x=({page:L})=>{if(w)return w({editor:h,page:L,rename:m});const $=L.getMainComponent(),D=r({name:`${L.getName()} (${b("copy")})`,component:$.clone()},{select:!0});D&&m(D)},E=[{id:"rename",label:b("rename"),icon:W.pencil,cmd:({page:L})=>m(L)},w!==!1&&{id:"duplicate",label:b("duplicate"),icon:W.contentCopy,cmd:x},t.length>1&&y!==!1&&{id:"remove",label:b("delete"),icon:W.delete,cmd:C}].filter(Boolean),P=V8({items:E,editor:h,sdkPageConfig:p}),O=l0(o,{collapsible:!0,label:b("pages"),icon:W.textBoxMultiple}),A=a?a===!0?{top:!0,right:!0,bottom:!0,left:!0}:a:void 0,T=l.jsx(I8,{pages:t,commandItems:P,rename:g,setRename:m,editor:h}),_=A?l.jsx(Vc,{className:Z([`${kf}__content`,"text-sm overflow-auto",J.bt,z.br]),height:i,...A,children:T}):T;return l.jsx(Qr,{classNameWrap:kf,className:Z(`${kf}__header`,Se.xy,o===!1&&"gs-utl-hidden"),disabled:O&&O.collapsible===!1,handler:l.jsxs(I,{space:"s",items:"center",children:[!!O.icon&&l.jsx(j,{children:l.jsx(Q,{icon:O.icon,size:oe.s})}),l.jsx(j,{grow:!0,children:O.label}),v!==!1&&l.jsx(kt,{title:b("add"),children:l.jsx(I,{onClick:S,className:Z("cursor-pointer"),children:l.jsx(Q,{icon:W.plus,size:oe.s})})})]}),open:O?O.collapsed!==!0:!0,children:_})}),fy=f.forwardRef(function({children:t,className:n,...r},s){return l.jsx("div",{className:M(ae("gs-page-manager-after"),n),ref:s,...r,children:t})}),hy=f.forwardRef(function({children:t,className:n,...r},s){return l.jsx("div",{className:M(ae("gs-page-manager-before"),n),ref:s,...r,children:t})}),H8="gs-panel-pages",gy=f.memo(ie(function({className:t,header:n,height:r,resizable:s,...o}){const a=me().sdkProps.children;return l.jsx(cn,{className:M(H8,t),...o,children:l.jsx(Vb,{children:i=>l.jsxs(l.Fragment,{children:[In(a,hy),l.jsx(py,{header:n,height:r,resizable:s,...i}),In(a,fy)]})})})})),j8="gs-panel-pages-layers",D8=f.memo(ie(function({className:t,panelPagesProps:n,panelLayersProps:r,...s}){const{showPages:o}=me(),a=_e(),{className:i,...c}=n||{},u=l0(r==null?void 0:r.header,{icon:W.layers,collapsible:!1,label:a.t("layerManager.layers"),className:M(J.bb,z.br)});return l.jsxs(or,{className:M(j8,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...s,children:[o&&l.jsx(gy,{className:M(i,J.bb,z.br),...c}),l.jsx(M0,{...r,header:u})]})})),F8="gs-trait-custom",B8=ie(function(t){const{trait:n,editor:r,value:s,disabled:o,labelAs:a,className:i}=t,[,c]=f.useState(0),u=f.useRef(null),d=n.get("component"),p=n.get("render"),h=n.target,g=u.current;if(f.useEffect(()=>{if(h){let v=()=>{},w=()=>{};const y=()=>{w(),c(S=>++S)};if(h.on("change",y),!d&&p&&g){const S=E=>g.appendChild(E),C=E=>g.removeChild(E),x=p({editor:r,component:h,trait:n,addEl:S,removeEl:C,onUpdate:E=>{w=E}});x instanceof HTMLElement?(S(x),v=()=>C(x)):Ke(x)&&(v=()=>x())}return()=>{h.off("change",y),v()}}},[h,g,s]),!h)return null;const m=Os({...t,className:M(F8,i)}),b={trait:n,component:h,editor:r,value:s,disabled:o};return l.jsxs("div",{...m,children:[l.jsx(nr,{...t,as:a}),l.jsx("div",{className:M(o&&"gs-utl-pointer-events-none opacity-50"),children:d?l.jsx(d,{...b}):p?l.jsx("div",{ref:u}):null})]})});function my({className:e,options:t,value:n,name:r,label:s,border:o,hideCaret:a,size:i="s",autoFocus:c,open:u,allowNew:d,onChange:p,onBlur:h,placeholder:g}){const[m,b]=f.useState(null),[v,w]=f.useState(null),{styles:y,attributes:S}=Ra(m,v,Ap),[C,x]=f.useState(""),E=bi(),P=C===""?t:t.filter(D=>D.label.toLowerCase().includes(C.toLowerCase())),O=D=>x(D.target.value),A=D=>D==null?void 0:D.label,T=d&&C.length>0&&!P.some(D=>D.label===C),_=Ke(d)?d(C):d,L={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},$=()=>h==null?void 0:h();return l.jsxs("div",{className:Z("w-full",e),children:[!!s&&l.jsx(Ts,{size:i,children:s}),l.jsxs(Wo,{value:n,onChange:p,name:r,nullable:!0,children:[l.jsx(oy,{size:i,ref:b,border:o,children:l.jsxs(I,{nowrap:!0,children:[l.jsx(Wo.Input,{autoFocus:c,className:E,displayValue:A,onChange:O,onBlur:$,placeholder:g}),!a&&l.jsx(Wo.Button,{children:l.jsx(Q,{icon:W.chevronDown,size:oe.sx})})]})}),l.jsx(Wo.Options,{static:u,className:Tb,ref:w,style:y.popper,...S.popper,children:l.jsxs(kn,{className:Z("h-full"),padding:!1,style:L,children:[T&&l.jsx(Wo.Option,{value:{id:null,label:C},children:({active:D})=>l.jsx(Ob,{option:{id:null,label:_},active:D,selected:n})}),!T&&P.length===0&&l.jsx("div",{className:Z(Se.xy),children:"No items found"}),P.map(D=>l.jsx(Wo.Option,{value:D,children:({active:N})=>l.jsx(Ob,{option:D,active:N,selected:n})},D.id))]})})]})]})}const z8=(e,t)=>{const n=`${ql}${t}`,r=e.get(n,{skipResolve:!0});return r?by(r):e.get(n)||""};function by(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const U8=({page:e,component:t})=>{const{DataSources:n,I18n:r}=e.em,s=["prevItem","currentItem","nextItem"],o=Kl(e)||"",a=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return s.map(p=>{if(d!=null&&d[p]){const{collectionId:h}=d,g=r.t(`dataSources.collections.${h}`)||h,m=r.t(`dataSources.variableTypes.${p}`)||p,b={collectionId:h,path:"id",type:n.dataComponentTypes.variable,variableType:p};return{id:by(b),label:`${g} > ${m}`,dataVariable:b}}}).filter(Boolean)}).flat().filter(Boolean),i=n.get(o),c=i==null?void 0:i.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...a,...c]},vy="#",Zc="mailto:",If="subject=",Vf="tel:",yy="hrefType",wy="showIdList",Sy=(e,t)=>{const n=t==null?void 0:t.get(yy);return n||(e.startsWith(Vf)?"phone":e.startsWith(Zc)?"email":e.startsWith(ai)?"pages":e.startsWith(vy)?"elements":"url")},Cy=e=>`${e.getName()} - #${e.getId()}`,W8="gs-trait-href",G8=ie(function(t){const{trait:n,value:r,disabled:s,labelAs:o,className:a}=t,i=n.component,c=me(),{isSelectingTarget:u,editor:d}=c,[,p]=f.useState(0),[h,g]=f.useState(""),[m,b]=f.useState(""),[v,w]=f.useState(""),[y,S]=f.useState([]),C=_e(),x=d==null?void 0:d.Pages.getAll(),E=C.tScoped("traitManager.traits.labels"),P=()=>p(ee=>++ee),O=i.get(wy)??!1,A=Sy(r,i),T=A==="pages"?r==null?void 0:r.replace(ai,""):"",_=!!T&&(d==null?void 0:d.Pages.get(T)),L=_?Zl(_):!1,$=f.useMemo(()=>!L||!_||!d?[]:U8({page:_,component:i}),[d,_,L,i]),D=ee=>{n.setValue(ee)},N=ee=>{i.set({[wy]:ee}),P()},B=ee=>{g(""),b(""),w(""),D(""),i.set({[yy]:ee}),P()},q=ee=>{D(ee),P()},F=(ee,te)=>{mA(i,"id",(te==null?void 0:te.dataVariable)||ee),P()},k=ee=>{ee&&(D(ee.id),P())},H=ee=>{D(`${Vf}${ee}`),w(ee)},V=ee=>{D(`${Zc}${ee}${m?`?${If}${m}`:""}`),g(ee)},U=ee=>{D(`${Zc}${h}${ee?`?${If}${ee}`:""}`),b(ee)},X=()=>{c.setSelectingTarget(!u)},Y=ee=>{const te=ee.replace(vy,""),K=d==null?void 0:d.Components.componentsById[te];return{id:ee,label:K?Cy(K):ee}};f.useEffect(()=>{var te;const ee=[];if(O){const K=["path","br","b","u","i","strike"],ne=(te=d==null?void 0:d.Pages.getSelected())==null?void 0:te.getMainComponent();ne==null||ne.forEachChild(ce=>{!ce.is("comment")&&!ce.is("textnode")&&!K.includes(ce.get("tagName"))&&ee.push({id:`#${ce.getId()}`,label:Cy(ce)})})}S(ee)},[d,O]),f.useEffect(()=>{let ee=()=>{};const te=()=>{ee(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(ru))};return u&&(ee=xw(te),d==null||d.runCommand(ru,{onSelect:K=>D(`#${K.getId()}`)})),te},[d,u]),f.useEffect(()=>{if(!r)return;switch(Sy(r,i)){case"phone":w(r.replace(Vf,""));break;case"email":{const[te,K=""]=r.replace(Zc,"").split("?");g(te),b(K.replace(If,""));break}}},[r]);const R=Os({className:M(W8,a)});return l.jsxs("div",{...R,children:[l.jsx(nr,{...t,as:o}),l.jsx("div",{className:M(s&&"gs-utl-pointer-events-none opacity-50"),children:l.jsx(Ms,{onChange:B,classNamePanel:"gs-utl-p-1",value:A,tabs:[{id:"url",label:l.jsx(Q,{icon:W.link,size:oe.s}),content:l.jsx(Xe,{placeholder:"eg. https://google.com",value:r,label:"URL",onChange:D,size:"s",type:"url"})},{id:"pages",label:l.jsx(Q,{icon:W.textBoxMultiple,size:oe.s}),content:l.jsxs(I,{gap:"s",col:!0,children:[l.jsx(Ee,{size:"s",options:(x||[]).map(ee=>({id:`${ai}${ee.getId()}`,icon:mm(ee),label:ee.getName()})),value:r,onChange:q,label:"Page"}),L&&l.jsx(Ee,{size:"s",options:$,value:z8(i,"id"),onChange:F,label:C.t("dataSources.collectionItem")})]})},{id:"elements",label:l.jsx(Q,{icon:W.viewDayOutline,size:oe.s}),content:l.jsxs(I,{gap:"s",col:!0,children:[l.jsx(Ts,{size:"s",children:"Element ID"}),l.jsxs(I,{gap:"xs",nowrap:!0,children:[O?l.jsx(my,{options:y,onChange:k,value:Y(r),placeholder:C.t("selectList")}):l.jsx(Xe,{size:"s",placeholder:"eg. #my-element-in-page",value:r,onChange:D,className:"gs-utl-flex-1"}),l.jsx(ft,{title:C.t("selectTarget"),size:"m2",active:u,onClick:X,className:"gs-utl-h-[30px]",children:l.jsx(Q,{icon:W.target,size:oe.sx})})]}),l.jsx(Ai,{value:O,onChange:N,label:E("showList")})]})},{id:"email",label:l.jsx(Q,{icon:W.email,size:oe.s}),content:l.jsxs(I,{gap:"s",col:!0,children:[l.jsx(Xe,{placeholder:"eg. mail@gmail.com",value:h,onChange:V,size:"s",label:"Email",type:"email"}),l.jsx(Xe,{placeholder:"eg. My subject",value:m,onChange:U,label:"Subject",size:"s"})]})},{id:"phone",label:l.jsx(Q,{icon:W.phone,size:oe.s}),content:l.jsx(Xe,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:v,onChange:H})}]})})]})});function q8({trait:e,value:t,disabled:n,label:r,labelAs:s}){const[o,a]=f.useState(),i=e.get("properties"),c=e.get("addItem"),u=e.get("labelItem"),d=t||[],p=d.findIndex(h=>h.id===(o==null?void 0:o.id));return l.jsx(Mr,{items:d,selected:p>-1?o:null,select:a,disabled:n,label:r,labelAs:s,add:()=>{const h=d.length+1,g=c?c(h):{id:`opt${h}`,label:`New option ${h}`};e.setValue([...d,g])},move:(h,g)=>{const m=e.getValue().filter(b=>b.id!==h.id);m.splice(g,0,h),e.setValue(m)},remove:h=>{const g=e.getValue().filter(m=>m.id!==h.id);e.setValue(g,{removed:h})},renderItem:h=>u?u(h):h.label,children:l.jsx(I,{space:"m",col:!0,children:!!o&&i.map(h=>{const{name:g,getValue:m}=h,b=h.setValue,v=h.label||g,w=d[p];if(!w)return null;const y=w[g],S=m?m(y):y,C=E=>{const P={...w};w[g]=b?b(E,S):E,e.setValue([...d],{item:w,previous:P}),g==="id"&&a(w)};let x=l.jsx(Xe,{label:v,value:S,onChange:C});switch(h.type){case"select":x=l.jsx(Ee,{label:v,options:h.options,value:S,onChange:C})}return l.jsx(f.Fragment,{children:x},g)})})})}const K8="gs-trait-custom-type",Z8=ie(function({trait:t,editor:n}){const r=f.useRef(null),s=t.getType(),o=t.target,{Traits:a}=n,i=a.getType(s),c=!!(o&&i);return f.useEffect(()=>{const u=r.current;if(i&&u&&o){const d=new i({model:t,config:a.getConfig(),attributes:t.get("attributes")}),p=d.render().el;return u.appendChild(p),d.listenTo(o,"change",()=>d.postUpdate()),()=>{u.removeChild(p),d.removeView()}}},[o,i,t]),c&&l.jsx("div",{className:K8,ref:r})}),Y8=e=>{const{value:t={},onConfirm:n,additionalSources:r,editor:s}=e;if(!s)return;const o="DataValuePicker",a={id:o,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:i})=>{n==null||n(i),s.runCommand(re.layoutRemove,{id:o})},additionalSources:r},placer:{type:"dialog",size:"l"}};s.runCommand(re.layoutToggle,{...a})};function xy(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:r,editor:s,additionalSources:o,enableDataValue:a,hasDataResolverValue:i}=e;if(!s||!a)return[];const c={type:"button",className:i?z.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...c,title:s.I18n.t("dataSources.connectDataValue"),icon:{icon:W.databaseOutline,size:oe.s2x},onClick:()=>Y8({value:t,onConfirm:n,additionalSources:o,editor:s})}];return i&&u.push({...c,title:s.I18n.t("dataSources.clearDataValue"),icon:{icon:W.close,size:oe.s2x},onClick:r}),u}function X8(e,t){const n=e.em.getEditor(),r=e.target;let s=!1;t===!0?s=!0:Ir(t)&&Ke(t.enable)&&(s=t.enable({trait:e,component:r,editor:n}));const o=e.getValue({skipResolve:!0}),a=r.collectionsStateMap,i=$s(o);return{hasDataResolverValue:i,dataResolverValue:i?e.getValue():void 0,enableDataValue:s,initialDataValue:o,handleDataValueChange:c=>e.setValue(c),handleValueClear:()=>{const c=e.getValue();e.setValue(""),e.setValue(c)},editor:n,additionalSources:a}}const J8=({label:e,buttons:t})=>l.jsxs(I,{items:"center",nowrap:!0,full:!0,children:[l.jsx(j,{grow:!0,children:e}),l.jsx(I,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,r)=>l.jsx(ft,{...n},r))})]}),Ey=e=>cr((e||"").replace(/-/g," ")),Q8=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&Ey(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})}),ar=(e,t,n)=>{const r=X8(e,n.traitManagerDataConfig),s=xy(r),{hasDataResolverValue:o,dataResolverValue:a}=r,i=Q8(e,t);return{...i,value:a??i.value,disabled:o,labelAs:s.length?"span":void 0,label:l.jsx(J8,{label:i.label,buttons:s})}},Py=(e,t,n)=>ar(e,t,n),R8=(e,t,n)=>ar(e,t,n),e9=(e,t,n)=>{const r=$s(e.getValue({skipResolve:!0})),s=ar(e,t,n),o={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!r,units:r?[]:e.get("units"),onChange:(a,i)=>{const c=i||isNaN(parseFloat(a))?a:parseFloat(a);e.setValue(c,{partial:i})}};return{...s,...o}},Ty=(e,t,n)=>{const r=e.get("labelToTitle"),s=$s(e.getValue({skipResolve:!0})),o=ar(e,t,n),a={options:e.getOptions().map(i=>{const c=i.labelReact||i.name||i.label||i.value;return et(i)?{id:i,label:i}:{id:i.id||i.value,title:r?c:i.title,icon:i.icon,label:r?"":c}}),onChange:i=>e.setValue(i),emptyState:s&&e.getValue()||void 0,hideCaret:s};return{...o,...a}},t9=(e,t,n)=>{const{options:r,onChange:s}=Ty(e,t,n),o={options:r,onChange:s};return{...ar(e,t,n),...o}},n9=(e,t,n)=>{const r=e.get("typeProps")||{},s=$s(e.getValue({skipResolve:!0}));return{...ar(e,t,n),isContain:!0,hideButton:s,btnLabel:e.get("text"),onOpen(){if(s)return;const a=t==null?void 0:t.Assets;a==null||a.open({select(i){e.setValue(i.getSrc()),a.close()}})},...r}},r9=e=>({children:Ey(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");et(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),s9=(e,t,n)=>{const r=ar(e,t,n),o={value:!!(r.disabled?r.value:e.getValue({useType:!0})),onChange:a=>e.setValue(a)};return{...r,...o}},o9=(e,t,n)=>{const r=ar(e,t,n),s=e.get("typeProps")||{},o=$s(e.getValue({skipResolve:!0}));return{language:"css",...s,...r,formatOnMount:!o,onChange:a=>e.setValue(a)}},a9=(e,t,n)=>({...ar(e,t,n),trait:e}),i9=(e,t,n)=>({...ar(e,t,n),trait:e}),l9=(e,t,n)=>({...ar(e,t,n),trait:e,editor:t});function c9(e,t,n={}){var a;const r=e.get("visible"),s=e.getType(),o={traitManagerDataConfig:n.traitManagerDataConfig};if(Ke(r)&&r({component:e.target,trait:e})===!1)return null;switch(s){case"text":return l.jsx(Xe,{...Py(e,t,o)});case"select":return l.jsx(Ee,{...Ty(e,t,o)});case"number":return l.jsx(Oe,{...e9(e,t,o)});case"color":return l.jsx(Rr,{...R8(e,t,o)});case"checkbox":return l.jsx(Ai,{...s9(e,t,o)});case"button":return l.jsx(Ue,{...r9(e)});case"radio":return l.jsx(zt,{...t9(e,t,o)});case"code":return l.jsx(Yr,{...o9(e,t,o),...n},((a=t==null?void 0:t.getSelected())==null?void 0:a.getId())||"");case"image":case"file":return l.jsx(Ii,{...n9(e,t,o)});case"stack":return l.jsx(q8,{...a9(e,t,o)});case"href":return l.jsx(G8,{...i9(e,t,o)});case"custom":return l.jsx(B8,{...l9(e,t,o)});default:return!!t.Traits.getType(s)?l.jsx(Z8,{editor:t,trait:e}):l.jsx(Xe,{...Py(e,t,o)})}}const Hf="gs-trait-manager",Oy=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>l.jsx(j,{className:Z(`${Hf}-field gs-utl-mb-2 gs-utl-w-full`),children:c9(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function u9({traits:e,className:t}){var d,p;const n=vi(),{isDarkTheme:r}=Cr(),o=(d=me().sdkOptions.dataSources)==null?void 0:d.traitManager,a=n.Traits.getTraitsByCategory(e),i=(p=a.find(h=>!h.category))==null?void 0:p.items,c=a.filter(h=>h.category),u=Z("gs-utl-text-center");return l.jsx(I,{className:Z(Hf,t),col:!0,children:n.getSelected()?e.length?l.jsxs(l.Fragment,{children:[i==null?void 0:i.map(h=>l.jsx(Oy,{trait:h,isDarkTheme:r,traitManagerDataConfig:o},h.id)),c.map(({category:h,items:g},m)=>l.jsx(Qr,{open:!!(h!=null&&h.get("open")),onChange:({open:b})=>h==null?void 0:h.set({open:b}),handler:h==null?void 0:h.getLabel(),handlerIcon:h==null?void 0:h.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${Hf}-category -gs-utl-mx-2`,className:b=>Z(Yu.itemList({index:m+(i?1:0),open:b,length:c.length})),children:g.map(b=>l.jsx(Oy,{trait:b,isDarkTheme:r,traitManagerDataConfig:o},b.id))},h==null?void 0:h.id))]}):l.jsx(j,{className:u,children:"No properties available"}):l.jsx(j,{className:u,children:n.t("traitManager.empty")})})}const jf=ie(u9),d9="gs-panel-properties",p9=f.memo(ie(function({className:t,...n}){return l.jsx(or,{className:M(d9,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:l.jsx(_p,{children:r=>l.jsx(jf,{...r})})})})),f9=async({html:e="",css:t="",el:n})=>{const r=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,s={};if(document.body.attachShadow){const o=n.shadowRoot||n.attachShadow({mode:"open"});o.innerHTML=r}return s},h9=ie(function({rule:t,onSelect:n,onRemove:r,className:s}){const o=f.useRef(null),i=me().editor,c=_e(),u=t.getDevice(),d=t.getState(),{isDarkTheme:p}=Cr(),[h,g]=f.useState(t.toCSS({allowEmpty:!0})),[m,b]=f.useState(h),v=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 f.useEffect(()=>{if(o.current){const C=o.current;f9({el:C,html:'<div class="prv-rule">Preview</div>',css:`
|
|
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:`
|
|
338
327
|
.prv-rule {
|
|
339
328
|
background-color: #fff;
|
|
340
329
|
padding: 5px;
|
|
341
330
|
}
|
|
342
|
-
.prv-rule, ${
|
|
343
|
-
`})}},[
|
|
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} {
|
|
344
333
|
${t}
|
|
345
|
-
}`),t},Fn="gs-cmp-selector-manager",Df={},Ay=ie(function(t){var ce,ge,De;const{selectedState:n,states:r,setState:s,styleCatalog:o,stateSelector:a}=t,i=me(),[c,u]=f.useState(!1),[d,p]=f.useState([]),[h,g]=f.useState(Df),{toggleCssPanel:m,isCssPanelActive:b,editor:v,store:w}=me(),{i18nStore:y,modalStore:S}=w,C=v==null?void 0:v.getSelected(),x=v==null?void 0:v.Styles.getSelected();if(f.useEffect(()=>{if(v&&x&&i){const ve=setTimeout(()=>{let Ze=Df;const Ge=C==null?void 0:C.get("selectorManager");C&&Ke(Ge)&&(Ze=Ge({editor:v,component:C})),g(Ze||Df),p(S9(v,i))});return()=>clearTimeout(ve)}},[C,v,x,i]),!v)return null;const{Selectors:E}=v,P=h.disableClasses,O=h.disableComponent,A=P&&O,T=E.getComponentFirst()&&!O,_=E.getSelectedAll(),L=v.getSelectedAll(),$=r.map(ve=>({id:ve.getName(),label:ve.getLabel()})),D=v.getModel(),N=(ce=x==null?void 0:x.getDevice)==null?void 0:ce.call(x),B=(ge=x==null?void 0:x.getState)==null?void 0:ge.call(x),q=M("gs-utl-overflow-hidden",J.b,J.rnd,z.br),F=M(z.bA),k=M("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",J.br,z.br),H=`${z.bgA}`,V=C9(x),U=_.length>0,X=L.length>0,Y=U||X,R=T&&X||!T&&!U,ee=R?"Components":"Selectors",te=ve=>y.t(`selectorManager.${ve}`),K=y.t("modals.styleCatalog.title"),ne=()=>S.open({title:K,content:l.jsx(g9,{})});return l.jsxs(I,{className:Fn,gap:"s",col:!0,full:!0,children:[l.jsxs(I,{className:M(`${Fn}__head`),items:"center",justify:"between",gap:"m",children:[l.jsxs(I,{className:M(`${Fn}__head-start`),items:"center",gap:"s",children:[l.jsx(j,{className:M(`${Fn}__head-title`),children:te("selection")}),o!==!1&&l.jsx(j,{className:M(`${Fn}__style-catalog`),children:l.jsx(kt,{className:"gs-utl-cursor-pointer",onClick:ne,title:K,children:l.jsx(Q,{icon:W.paletteSwatch,size:oe.s})})})]}),!!x&&a!==!1&&!A&&l.jsx(j,{className:`${Fn}__head-end`,children:l.jsx(Ee,{size:"s",value:n,options:$,includeEmpty:!0,onChange:s,emptyState:`- ${te("state")} -`,className:M(n&&z.bA)})})]}),Y&&!A?l.jsxs(l.Fragment,{children:[!P&&l.jsxs(I,{className:M(`${Fn}__field-selectors`,q,!R&&F),items:"stretch",gap:"xs",children:[l.jsx(kt,{title:te(U?"applyOnSelector":"noSelectors"),className:M(k,!R&&H),onClick:()=>U&&E.setComponentFirst(!1),children:l.jsx(I,{className:"gs-utl-h-full",items:"center",children:l.jsx(Q,{icon:W.tag,size:oe.sx})})}),l.jsx(j,{grow:!0,children:l.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:c?l.jsx(my,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:te("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:ve=>{ve&&(E.addSelected(ve.id||ve.label),u(!1))}}):l.jsxs(l.Fragment,{children:[X&&l.jsx(ft,{title:te("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:l.jsx(Q,{icon:W.plus,size:oe.sx})}),_.map(ve=>l.jsx(m9,{selector:ve,removable:X,toggleable:X&&_.filter(Ze=>Ze.getActive()||Ze===ve).length>1},ve.toString()))]})})})]}),!O&&l.jsxs(I,{className:M(`${Fn}__field-components`,q,R&&F),items:"stretch",gap:"xs",children:[l.jsx(kt,{title:te(X?"applyOnComponents":"noComponents"),onClick:()=>X&&E.setComponentFirst(!0),className:M(k,R&&H),children:l.jsx(I,{className:"gs-utl-h-full",items:"center",children:l.jsx(Q,{icon:W.targetVariant,size:oe.sx})})}),l.jsx(j,{grow:!0,className:"gs-utl-py-0.5",children:l.jsx(I,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:L.map(ve=>l.jsx(_s,{s:"s",className:M("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",z.cmp),onPointerEnter:()=>D.setHovered(ve),onPointerOut:()=>D.setHovered(),label:ve.getName()},ve.getId()))})})]}),l.jsxs(I,{className:`${Fn}__actions`,gap:"s",items:"center",justify:"between",children:[l.jsx(kt,{title:l.jsxs(l.Fragment,{children:[l.jsx("div",{children:te("selected")}),l.jsx("pre",{className:M("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",J.rnd,Se.xyS),children:V}),l.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:te("currentSelection")})]}),children:l.jsx(_s,{className:M(J.b,J.rnd,z.br),s:"xs",nopad:!0,block:!0,children:l.jsx(Q,{icon:W.target,size:oe.sx})})}),l.jsx(j,{className:"gs-utl-text-sm",children:l.jsx(_s,{className:M(J.b,J.rnd,z.br),s:"xs",nopad:!0,children:l.jsxs(I,{space:"xs",items:"center",nowrap:!0,children:[!!N&&N.getWidthMedia()&&l.jsxs(l.Fragment,{children:[l.jsx(kt,{title:l.jsxs(l.Fragment,{children:[te("device"),": ",l.jsx("b",{children:N.getName()})]}),children:l.jsx(Q,{icon:W.cellphoneLink,size:oe.sx})}),l.jsx(j,{className:"gs-utl-opacity-30",children:"|"})]}),l.jsx(kt,{title:l.jsxs(l.Fragment,{children:[te("target"),": ",l.jsx("b",{children:ee}),l.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(De=x==null?void 0:x.selectorsToString)==null?void 0:De.call(x,{skipState:1})]})]}),children:l.jsx(Q,{icon:R?W.targetVariant:W.tag,size:oe.sx})}),!!B&&l.jsxs(l.Fragment,{children:[l.jsx(j,{className:"gs-utl-opacity-30",children:"|"}),l.jsx(kt,{title:l.jsxs(l.Fragment,{children:[te("state"),": ",l.jsx("b",{children:B.getLabel()})]}),children:l.jsx(Q,{icon:W.flare,size:oe.sx})})]})]})})}),l.jsx(ft,{title:y.t("toggleCss"),onClick:m,active:b,size:"s",children:l.jsx(Q,{icon:W.codeBraces,size:oe.sx})})]})]}):l.jsxs(I,{className:M(`${Fn}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[l.jsx(j,{className:`${Fn}__empty-state-title`,children:te("noSelecton")}),l.jsxs("ul",{className:M(`${Fn}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[l.jsx("li",{children:te("selectFromCanvas")}),l.jsx("li",{children:te("selectFromList")})]})]})]})}),x9="gs-panel-selectors",E9=f.memo(ie(function({className:t,styleCatalog:n,stateSelector:r,...s}){return l.jsx(or,{className:M(x9,t),...s,children:l.jsx(Hb,{children:o=>l.jsx(Ay,{...o,styleCatalog:n,stateSelector:r})})})}));function Vs({label:e,property:t,hasValue:n,empty:r,onClear:s,children:o,shallow:a,row:i,tooltip:c,skipClear:u,className:d,...p}){const h=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})),b=!m&&(t==null?void 0:t.hasValue())&&g,v=g==null?void 0:g.getDevice(),w=g==null?void 0:g.getState(),y=g==null?void 0:g.getComponent(),S=()=>s?s():t==null?void 0:t.clear(),C={className:M(d,"gs-utl-text-sm gs-utl-w-full"),col:!i,items:i?"center":void 0,...p},x=M("gs-utl-flex-1",m&&!a&&z.tAo);return t&&!t.isVisible()?null:l.jsxs(I,{gap:"xs",...C,children:[l.jsxs(I,{className:x,as:"label",items:"center",gap:"xs",nowrap:!0,children:[c&&l.jsx(j,{children:l.jsx(kt,{title:c,children:l.jsx(Q,{icon:W.information,size:oe.sx})})}),l.jsx(j,{children:r?l.jsx("span",{children:" "}):h}),!!b&&!a&&l.jsx(kt,{title:l.jsxs(l.Fragment,{children:[l.jsx("div",{className:M("gs-utl-mb-1"),children:"Value inherited from"}),!!v&&l.jsxs(I,{gap:"s",children:[l.jsx(j,{children:l.jsx(Q,{icon:W.cellphoneLink,size:oe.sx})}),l.jsx(j,{children:l.jsx("b",{children:v.getName()})})]}),l.jsxs(I,{gap:"s",children:[l.jsx(j,{children:l.jsx(Q,{icon:y?W.targetVariant:W.tag,size:oe.sx})}),l.jsxs(j,{children:[l.jsx("b",{children:y?"Components":"Selectors"}),l.jsxs("span",{className:M("gs-utl-text-xs gs-utl-opacity-75"),children:[" ",g==null?void 0:g.selectorsToString({skipState:1})]})]})]}),!!w&&l.jsxs(I,{gap:"s",children:[l.jsx(j,{children:l.jsx(Q,{icon:W.flare,size:oe.sx})}),l.jsx(j,{children:l.jsx("b",{children:w.getLabel()})})]})]}),children:l.jsx("div",{className:M("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",z.bgW)})}),m&&!a&&!u&&l.jsx(kt,{title:"Clear value",onClick:S,children:l.jsx(Q,{className:Ce.click,icon:W.close,size:oe.s2x})})]}),!!o&&l.jsx(j,{grow:!0,className:"gs-utl-max-w-full",children:o})]})}function Yc(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 P9=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,T9=/,(?![^(]*\))/,Ff=/\s(?![^(]*\))/,O9=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Bf=/^circle|ellipse/i,zf=e=>{var d;const t=[],{name:n,value:r}=Yc(e),[s,...o]=r.split(T9).map(p=>p.trim()).filter(Boolean),a=o.length>1,i=a?s:"",c={type:"none"},u=a?o:[s,...o];if(P9.test(i))c.type="angle",c.value=i;else if(/^to\s/.test(i))c.type="side-or-corner",c.value=i;else if(O9.test(i))c.type="size",c.value=i;else if(Bf.test(i)||/^at\s/.test(i)||/\sat\s/.test(i)){c.type="at",c.value=i;const p=((d=i.match(Bf))==null?void 0:d[0])||"circle";c.shape=p;const h={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,b]=i.replace(Bf,"").trim().split("at").map(v=>v.trim());if(m){const[v,w]=m.split(Ff);h.x=v,h.y=w||v}if(b){const[v,w]=b.split(Ff);g.x=v,g.y=w||v}c.size=h,c.position=g}return u.forEach(p=>{const[h,g]=p.split(Ff);t.push({color:h,hint:g?parseFloat(g):null})}),t.forEach((p,h)=>{p.hint===null&&(p.hint=h/(t.length-1)*100)}),{name:n,orientation:c,colorStops:t}},Hs=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const s=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(o=>`${o.color} ${o.hint?`${o.hint}%`:""}`.trim()).join(", ");return s?`${n}(${t}, ${s})`:"none"},A9=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),_9="gs-cmp-grad-picker";function M9({className:e,value:t,onChange:n}){var B,q,F;const r=zf(t),[s,o]=f.useState(r.colorStops),[a,i]=f.useState(null),c=f.useRef(null),u=Z(_9,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,J.rnd),d=r.name||"linear-gradient",p=d.indexOf("radial")>=0,h=d.indexOf("repeating")>=0,g=r.orientation.value,m=`${parseFloat(`${g}`)||180}`,b=`${parseFloat(`${(B=r.orientation.size)==null?void 0:B.x}`)||0}`,v=`${parseFloat(`${(q=r.orientation.position)==null?void 0:q.x}`)||0}`,w=`${parseFloat(`${(F=r.orientation.position)==null?void 0:F.y}`)||0}`,y=0,S=100,C=(k,H=!1)=>{const V=A9(k);o(V),n==null||n(Hs({name:d,orientation:g,stops:V}),H)},x=(k,H=!1)=>{n==null||n(Hs({stops:s,name:d,orientation:`${k}deg`}),H)},E=(k,H=!1)=>{n==null||n(Hs({stops:s,name:d,orientation:`${k}px at ${v}% ${w}%`}),H)},P=(k,H=!1)=>{n==null||n(Hs({stops:s,name:d,orientation:`${b}px at ${k}% ${w}%`}),H)},O=(k,H=!1)=>{n==null||n(Hs({stops:s,name:d,orientation:`${b}px at ${v}% ${k}%`}),H)},A=k=>{const H=`${k?"repeating-":""}${p?"radial":"linear"}-gradient`;n==null||n(Hs({stops:s,orientation:g,name:H}))},T=k=>{const H=`${h?"repeating-":""}${k?"radial":"linear"}-gradient`;n==null||n(Hs({stops:s,orientation:k?"100px at 50% 50%":"90deg",name:H}))};f.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(s,!0)},V=()=>{i(null),C(s)};return window.addEventListener("pointermove",H),window.addEventListener("pointerup",V),()=>{window.removeEventListener("pointermove",H),window.removeEventListener("pointerup",V),V()}},[a]);const _=(k,H)=>{const V=c.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})},L=k=>{const H=c.current,V=(H==null?void 0:H.clientWidth)||0,U=(H==null?void 0:H.clientHeight)||0,X=k.nativeEvent.offsetX-((H==null?void 0:H.clientLeft)||0),Y=k.nativeEvent.offsetY-((H==null?void 0:H.clientTop)||0),R=X/V*100,ee=document.createElement("canvas"),te=ee.getContext("2d");if(!te)return;ee.width=V,ee.height=U;const K=te.createLinearGradient(0,0,V,U);s.forEach(ve=>K.addColorStop(parseFloat(`${ve.hint}`)/100,ve.color)),te.fillStyle=K,te.fillRect(0,0,ee.width,ee.height),ee.style.background="black";const ne=te.getImageData(X,Y,1,1).data,ce=ne[3]?(100/255*ne[3]/100).toFixed(2):0,ge=`rgba(${ne[0]}, ${ne[1]}, ${ne[2]}, ${ce})`,De=ge==="rgba(0, 0, 0, 0)"?"#000":ge;C([...s,{color:De,hint:R}])},$=k=>{C(s.filter(H=>H!==k))},D=(k,H,V)=>{H&&(k.color=H),C(s,V)},N=k=>(a==null?void 0:a.stop)===k;return l.jsxs(I,{className:u,col:!0,children:[!!(a!=null&&a.stop)&&l.jsx("div",{className:Z("fixed inset-0 z-50 cursor-colr")}),l.jsxs("div",{className:Z("relative gjs-mb-6 gjs-mt-3"),children:[l.jsx("div",{className:Z("bg-checker h-8",J.rnd),children:l.jsx("div",{ref:c,className:Z("w-full h-full cursor-cross",J.b,J.rnd,z.br),style:{backgroundImage:Hs({stops:s})},onClick:L})}),s.map((k,H)=>l.jsxs("div",{className:Z("absolute top-0 h-full"),style:{left:`${k.hint}%`},children:[l.jsx("div",{className:Z("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>$(k),children:l.jsx(Q,{icon:W.close,size:oe.s3x})}),l.jsx("div",{onPointerDown:V=>_(V,k),className:Z("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",J.br,J.bl,N(k)?"gjs-bg-white":"gjs-bg-black")}),l.jsx("div",{className:Z("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:l.jsx(b0,{value:k.color,onChange:(V,U)=>D(k,V,U),className:Z("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},H))]}),l.jsxs(I,{space:"s",items:"center",children:[l.jsx(j,{grow:!0,children:l.jsx(Ai,{label:"Repeat",value:h,onChange:A})}),l.jsx(j,{grow:!0,children:l.jsx(Ai,{label:"Radial",value:p,onChange:T})})]}),p?l.jsxs(I,{space:"s",col:!0,children:[l.jsx(j,{children:l.jsx(I,{space:"s",items:"center",children:l.jsx(j,{grow:!0,children:l.jsx(Oe,{pan:"S",size:"s",value:b,onChange:E,valueUnit:"px",units:["px"]})})})}),l.jsx(j,{children:l.jsxs(I,{space:"s",children:[l.jsx(j,{grow:!0,children:l.jsx(Oe,{pan:"X",size:"s",value:v,onChange:P,valueUnit:"%",units:["%"]})}),l.jsx(j,{grow:!0,children:l.jsx(Oe,{pan:"Y",size:"s",value:w,onChange:O,valueUnit:"%",units:["%"]})})]})})]}):l.jsx(I,{space:"s",items:"center",nowrap:!0,children:l.jsx(j,{grow:!0,children:l.jsx(Oe,{pan:"A",size:"s",value:m,onChange:x,valueUnit:"deg",units:["deg"]})})})]})}const L9="gs-sm-custom-type",N9=ie(function({property:t,editor:n}){const r=f.useRef(null),s=t.getType(),o=n.StyleManager,a=o.getType(s),i=a==null?void 0:a.view;return f.useEffect(()=>{const c=r.current;if(i&&c){const u=new i({model:t,config:o.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return c.appendChild(d),()=>{c.removeChild(d),u.remove()}}},[i,t,n]),i&&l.jsx("div",{className:L9,ref:r})});function _y(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const My="gs-cmp-style-field";function Ly({property:e,sector:t,styleManagerDataConfig:n,fieldProps:r}){const s=M(My,`${My}__${e.id}`),o={sector:t,styleManagerDataConfig:n},a=t.em.getEditor(),i=e.getType();switch(i){case"selectFont":return l.jsx(jc,{className:s,...Fy(e,o),...r});case"number":case"slider":case"integer":return l.jsx(Oe,{className:s,...Re(e,o),...r});case"color":return l.jsx(Rr,{className:s,...To(e,o),...r});case"select":return l.jsx(Ee,{className:s,...wt(e,o),...r});case"radio":return l.jsx(zt,{className:s,...$r(e,o),...r});case"file":return l.jsx(Ii,{className:s,...t7(e,o),...r});case"composite":return l.jsx(dn,{className:s,property:e,corners:e.get("corners"),generic:e.get("generic"),...o});case"stack":{const c=e.getProperties();return l.jsx(Mr,{className:s,...Ds(e,o),children:l.jsx(Lr,{properties:c,sector:t})})}default:{const c=a.StyleManager.getType(i);return!!(c!=null&&c.create)&&!!(c!=null&&c.view)?l.jsx(N9,{editor:a,property:e}):l.jsx(Xe,{className:s,...Kf(e,o)})}}}const Ny="gs-cmp-style-prop-row";function Lr({properties:e,sector:t,styleManagerDataConfig:n}){const r={sector:t,styleManagerDataConfig:n};return l.jsx(l.Fragment,{children:e.map(s=>{const o=s.getId(),a=M(Ny,`${Ny}__${o}`,_y(s)&&"gs-utl-col-span-full");return s.isVisible()?l.jsx("div",{className:a,children:l.jsx(Ly,{property:s,...r})},o):null})})}function $9({sector:e,styleManagerDataConfig:t}){const n=li(),r=e.getProperties().filter(s=>s.isVisible()).map(s=>(n.sdkAddFonts&&s.getId()==="font-family"&&s.set("type","selectFont"),s));return l.jsx("div",{className:M("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:l.jsx(Lr,{properties:r,sector:e,styleManagerDataConfig:t})})}const k9="gs-cmp-sector-row";function he({className:e,children:t,bottom:n,separator:r,separatorTop:s,property:o,...a}){const i=l.jsx("div",{className:Z("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",J.bb,z.br)}),c=Z(k9,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(o)?o:[o]).filter(Boolean);return(u.length?u.some(p=>p.isVisible()):!0)?l.jsxs(l.Fragment,{children:[s&&i,l.jsx(I,{className:c,nowrap:!0,...a,children:t}),r&&i]}):null}function Wi(e,t,n={}){const r=e.getType(),{compact:s=!1,sector:o,styleManagerDataConfig:a}=n,i=e.getParent(),c={sector:o,styleManagerDataConfig:a},u=e.getDefaultValue();if(r==="select"){const p={property:i.getName()};return l.jsx(Ee,{...wt(e,c,p),...t?{value:t.same?e.getValue({noDefault:!0}):"",emptyState:t.same?e.getOptionLabel(u,p)||u:"Custom",onChange:h=>t.all.map(g=>g.upValue(h))}:{},label:void 0})}else return r==="color"?l.jsx(Rr,{...To(e,c),...t?{value:t.same?e.getValue({noDefault:!0}):"",placeholder:t.same?u:"Custom",onChange:(d,p)=>t.all.map(h=>h.upValue(d,{partial:p}))}:{},label:void 0}):l.jsx(Oe,{...Re(e,c),...s?{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(h=>h.upValue(d,{partial:p})),onChangeUnit:d=>t.all.map(p=>p.upUnit(d))}:{},label:void 0})}const Xc="gs-cmp-style-prop-composite";function dn({className:e,property:t,sector:n,styleManagerDataConfig:r,corners:s,compact:o,generic:a,children:i,options:c}){const[u,d]=f.useState(null);if(!(t!=null&&t.isVisible()))return null;const p={id:"custom",label:l.jsx(Q,{icon:W.borderStyle,size:oe.s}),title:"Custom"},h=[{id:"all",label:l.jsx(Q,{icon:W.borderAllVariant,size:oe.s}),title:"All"},p],g=t.isDetached(),m=t.getProperties(),b=m.length,[v,w,y,S]=m,C=v.getFullValue(),E=m.map(F=>F.getFullValue()).every(F=>F===C),P=u!==null?u:E||c?"all":p.id,O=c?[...c,p]:[],A=t.getFullValue(),T=O.some(F=>F.id===A),_=P===p.id||(c?!T:!1)||!!a,L={compact:o,sector:n,styleManagerDataConfig:r},$=l.jsx(Vs,{property:o?null:v,shallow:!g,children:Wi(v,null,L)}),D=l.jsx(Vs,{property:o?null:w,shallow:!g,children:Wi(w,null,L)}),N=!!y&&l.jsx(Vs,{property:o?null:y,shallow:!g,children:Wi(y,null,L)}),B=!!S&&l.jsx(Vs,{property:o?null:S,shallow:!g,children:Wi(S,null,L)}),q=o?{label:t.getLabel()}:{property:t};return l.jsxs(I,{className:Z(Xc,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[l.jsx(he,{className:`${Xc}__main`,children:l.jsx(Vs,{...q,children:!a&&l.jsx(he,{bottom:"0",children:i!==void 0?i:c?l.jsx(l.Fragment,{children:l.jsx(j,{grow:!0,children:l.jsx(zt,{size:"s",options:O,value:_?p.id:A,onChange:F=>{F===p.id?d(F):(t.upValue(F),d(""))}})})}):l.jsxs(l.Fragment,{children:[l.jsx(j,{grow:!0,children:Wi(v,{same:E,all:m},L)}),l.jsx(j,{grow:!0,children:l.jsx(zt,{size:"s",options:h,value:P,onChange:d})})]})})})}),_&&l.jsx(he,{col:!0,className:Z(`${Xc}__details`,"gjs-px-2 gjs-py-1",z.bgH2,J.rnd,J.b,z.br),children:a?l.jsx("div",{className:Z(`${Xc}__props`,"grid grid-cols-2 gap-2"),children:m.map(F=>l.jsx(Vs,{property:F,shallow:!g,className:Z(_y(F)&&"col-span-full"),children:l.jsx(Ly,{property:F,...L,fieldProps:{label:void 0}})},F.getId()))}):b===2?l.jsx(l.Fragment,{children:l.jsxs(I,{space:"s",children:[l.jsx(j,{grow:!0,children:$}),l.jsx(j,{grow:!0,children:D})]})}):b===3?l.jsxs(l.Fragment,{children:[l.jsxs(I,{space:"s",children:[l.jsx(j,{grow:!0,children:$}),l.jsx(j,{grow:!0,children:D})]}),l.jsx(I,{space:"s",children:l.jsx(j,{grow:!0,children:N})})]}):s?l.jsxs(l.Fragment,{children:[l.jsxs(I,{space:"s",children:[l.jsx(j,{grow:!0,children:$}),l.jsx(j,{grow:!0,children:D})]}),l.jsxs(I,{space:"s",children:[l.jsx(j,{grow:!0,children:B}),l.jsx(j,{grow:!0,children:N})]})]}):l.jsxs(l.Fragment,{children:[l.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:$}),l.jsxs(I,{space:"s",children:[l.jsx(j,{grow:!0,children:B}),l.jsx(j,{grow:!0,children:D})]}),l.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:N})]})})]})}var js=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(js||{});const Jc="background-image",Nr="__background-type",Gi=Jc,$y="https://placehold.co/150/777/white.png?text=IMAGE",Uf="50px",I9={[Nr]:"image","background-image":`url("${$y}")`,"background-size":`${Uf} ${Uf}`,"background-repeat":"repeat","background-position":"0px 0px"},V9=e=>(e.includes("gradient(")?zf(e).colorStops[0].color:e)||"";function H9({sector:e,styleManagerDataConfig:t}){var C;const n=vi(),r=e.getProperty("background"),s=r.getProperty(Nr),o=r.getProperty("background-image"),a=r.getProperty("background-position"),i=r.getProperty("background-size"),c=e.getProperty("background-color"),u=e.getProperty("background-clip"),d={sector:e,styleManagerDataConfig:t},p=[r,c,u].map(x=>x==null?void 0:x.id),h=e.getProperties().filter(x=>!p.includes(`${x.id}`)),g=((C=r.getSelectedLayer())==null?void 0:C.getIndex())||-1,m=s==null?void 0:s.getValue(),b=m==="image",v=o.getValue(),w=()=>{const x=n.Assets;x.open({select(E){const P=E.getSrc();o.upValue(`url("${P}")`),x.close()}})},y=x=>{let E="none",P="100%";x==="image"?(E=`url("${$y}")`,P=Uf):x==="gradient"?E="linear-gradient(90deg, black 10%, white 90%)":x==="color"&&(E="rgba(0, 0, 0, 0.5)"),o.upValue(E),s.upValue(x),a.upValue("0 0"),i.upValue(`${P} ${P}`)},S=R9(s,[{id:"image",label:l.jsx(Q,{icon:W.image,size:oe.s})},{id:"gradient",label:l.jsx(Q,{icon:W.gradientVertical,size:oe.s})},{id:"color",label:l.jsx(Q,{icon:W.checkboxBlank,size:oe.s})}]);return l.jsxs(l.Fragment,{children:[l.jsx(he,{property:r,separator:!0,children:l.jsxs(Mr,{...Ds(r,d,I9),previewStyle:x=>r.getStyleFromLayer(x,{camelCase:!0}),children:[l.jsx(he,{children:l.jsx(zt,{...$r(s,d),options:S,onChange:y,label:void 0})}),l.jsx(he,{children:l.jsxs(Vs,{children:[b&&l.jsx(Ii,{value:Yc(v).value,onOpen:w}),m==="color"&&l.jsx(Rr,{...To(o,d),value:V9(v),label:void 0}),m==="gradient"&&l.jsx(M9,{value:v,onChange:(x,E)=>o.upValue(x,{partial:E})},g)]})}),b&&l.jsxs(l.Fragment,{children:[l.jsx(he,{col:!0,children:l.jsx(dn,{property:a,...d})}),l.jsx(he,{col:!0,children:l.jsx(dn,{property:i,...d})}),l.jsxs(he,{children:[l.jsx(Ee,{...wt(r.getProperty("background-repeat"),{sector:e})}),l.jsx(Ee,{...wt(r.getProperty("background-attachment"),{sector:e})})]}),l.jsx(he,{children:l.jsx(Ee,{...wt(r.getProperty("background-origin"),{sector:e})})})]})]})}),l.jsx(he,{property:c,children:l.jsx(Rr,{...To(c,d)})}),l.jsx(he,{property:u,children:l.jsx(Ee,{...wt(u,d)})}),h.length>0&&l.jsx(Lr,{properties:h,...d})]})}function j9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),r=e.getProperty("border-width"),s=e.getProperty("border-style"),o=e.getProperty("border-color"),a={sector:e,styleManagerDataConfig:t},i=[n,r,s,o].map(u=>u==null?void 0:u.id),c=e.getProperties().filter(u=>!i.includes(`${u.id}`));return l.jsxs(l.Fragment,{children:[l.jsx(dn,{property:n,corners:!0,...a}),l.jsx(dn,{property:r,...a}),l.jsx(dn,{property:s,...a}),l.jsx(dn,{property:o,...a}),c.length>0&&l.jsx(Lr,{properties:c,...a})]})}const Po=e=>Ac({value:parseFloat(e),min:-3,max:3}),Wf=(e,t="filter",n)=>{const r=e.getProperty(`${t}-value`),s=e.getProperty(`${t}-name`).getOption()||{},o=s.units||[],a=r.getUnit(),i=S$(a,o)?a:o[0];return{...Re(r,n),units:o,valueUnit:i,onChange:(c,u)=>{r.upValue(c,{partial:u,units:o,min:s.min,max:s.max})}}},ky=(e,t,n,r)=>{const s=e.getProperty(`${t}-name`),o=e.getProperty(`${t}-value`);return{...wt(s,n,r),onChange:a=>{s.upValue(a),o.upValue("")}}},D9={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function F9({sector:e,styleManagerDataConfig:t}){const n=_e(),r=O=>n.t(`styleManager.effects.${O}`),s=e.getProperty("box-shadow"),o=e.getProperty("text-shadow"),a=e.getProperty("filter"),i=e.getProperty("backdrop-filter"),c=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),p=e.getProperty("backface-visibility"),h=e.getProperty("perspective"),g=e.getProperty("transform-style"),m=e.getProperty("opacity"),b=e.getProperty("mix-blend-mode"),v=e.getProperty("cursor"),w=e.getProperty("transform-origin"),y=e.getProperty("overflow"),S={sector:e,styleManagerDataConfig:t},C=[s,o,a,i,c,u,d,p,h,g,m,b,v,w,y].map(O=>O==null?void 0:O.id),x=e.getProperties().filter(O=>!C.includes(`${O.id}`)),E=O=>{const{boxShadowH:A,boxShadowV:T,boxShadowBlur:_,boxShadowColor:L,boxShadowSpread:$,boxShadowType:D}=O.getValues({camelCase:!0}),N=Po(A),B=Po(T),q=Po(_),F=Po($),k=`${N}px ${B}px ${q}px ${F}px ${L} ${D}`.trim();return l.jsxs(I,{space:"s",items:"center",children:[l.jsxs(j,{grow:!0,children:[A," ",T," ",_," ",$]}),l.jsx(j,{children:l.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",J.b,J.rnd),style:{boxShadow:k}})})]})},P=O=>{const{textShadowH:A,textShadowV:T,textShadowBlur:_,textShadowColor:L}=O.getValues({camelCase:!0}),$=Po(A),D=Po(T),N=Po(_),B=`${$}px ${D}px ${N}px ${L}`.trim();return l.jsxs(I,{space:"s",items:"center",children:[l.jsxs(j,{grow:!0,children:[A," ",T," ",_]}),l.jsx(j,{children:l.jsx("div",{className:Z("w-4 h-4 gjs-bg-white",J.b,J.rnd),style:{boxShadow:B}})})]})};return l.jsxs(l.Fragment,{children:[l.jsxs(he,{property:[m,b],children:[l.jsx(Oe,{...Re(m,S)}),l.jsx(Ee,{...wt(b,S)})]}),l.jsx(he,{property:v,separator:!0,children:l.jsx(Ee,{...wt(v,S)})}),l.jsx(he,{property:s,separator:!0,children:l.jsxs(Mr,{...Ds(s,S),renderItem:E,children:[l.jsx(he,{children:l.jsx(zt,{...$r(s.getProperty("box-shadow-type"),S),label:""})}),l.jsxs(he,{children:[l.jsx(Oe,{...Re(s.getProperty("box-shadow-h"),S),label:r("boxShadow.xOffset")}),l.jsx(Oe,{...Re(s.getProperty("box-shadow-v"),S),label:r("boxShadow.yOffset")})]}),l.jsxs(he,{children:[l.jsx(Oe,{...Re(s.getProperty("box-shadow-blur"),S),label:r("boxShadow.blur")}),l.jsx(Oe,{...Re(s.getProperty("box-shadow-spread"),S),label:r("boxShadow.spread")})]}),l.jsx(he,{children:l.jsx(Rr,{...To(s.getProperty("box-shadow-color"),S),label:r("boxShadow.color")})})]})}),l.jsx(he,{property:o,separator:!0,children:l.jsxs(Mr,{...Ds(o,S,D9),renderItem:P,children:[l.jsxs(he,{children:[l.jsx(Oe,{...Re(o.getProperty("text-shadow-h"),S),label:r("textShadow.xOffset")}),l.jsx(Oe,{...Re(o.getProperty("text-shadow-v"),S),label:r("textShadow.yOffset")})]}),l.jsx(he,{children:l.jsx(Oe,{...Re(o.getProperty("text-shadow-blur"),S),label:r("textShadow.blur")})}),l.jsx(he,{children:l.jsx(Rr,{...To(o.getProperty("text-shadow-color"),S),label:r("textShadow.color")})})]})}),l.jsx(he,{property:a,separator:!0,children:l.jsx(Mr,{...Ds(a,S,{"filter-name":"blur","filter-value":"3px"}),children:l.jsxs(he,{children:[l.jsx(Ee,{...ky(a,"filter",S),label:r("filter.type")}),l.jsx(Oe,{...Wf(a,void 0,S),label:r("filter.value")})]})})}),l.jsx(he,{property:i,separator:!0,children:l.jsx(Mr,{...Ds(i,S,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:l.jsxs(he,{children:[l.jsx(Ee,{...wt(i.getProperty("backdrop-filter-name"),S),label:r("backdropFilter.type")}),l.jsx(Oe,{...Wf(i,"backdrop-filter",S),label:r("backdropFilter.value")})]})})}),l.jsx(he,{property:c,separator:!0,children:l.jsxs(Mr,{...Ds(c,S),children:[l.jsx(he,{children:l.jsx(Ee,{...wt(c.getProperty("transition-property"),S),label:r("transition.type")})}),l.jsx(he,{children:l.jsx(Ee,{...wt(c.getProperty("transition-timing-function"),S),label:r("transition.easing")})}),l.jsxs(he,{children:[l.jsx(Oe,{...Re(c.getProperty("transition-duration"),S),label:r("transition.duration")}),l.jsx(Oe,{...Re(c.getProperty("transition-delay"),S),label:r("transition.delay")})]})]})}),l.jsx(he,{property:u,separator:!0,children:l.jsx(Mr,{...Ds(u,S),children:l.jsxs(he,{children:[l.jsx(Ee,{...ky(u,"transform",S),label:r("transform.type")}),l.jsx(Oe,{...Wf(u,"transform",S),label:r("transform.value")})]})})}),l.jsx(dn,{property:w,...S}),l.jsx(dn,{property:y,...S}),l.jsx(he,{property:p,children:l.jsx(zt,{...$r(p,S)})}),l.jsx(he,{property:[h,g,d],separatorTop:!0,children:r("childrenTransform")}),l.jsxs(he,{property:[h,g],children:[l.jsx(Oe,{...Re(h,S)}),l.jsx(zt,{...$r(g,S)})]}),l.jsx(dn,{property:d,...S}),x.length>0&&l.jsx(Lr,{properties:x,...S})]})}function B9(e,t){return e.indexOf(t)>=0}const ct=oe.s,Qc="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",Rc="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",eu="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",Iy="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",Vy="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",z9="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",Gf="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function U9({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),r=_e(),[s,o]=f.useState({}),[a,i]=f.useState({}),c=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),p=e.getProperty("align-items"),h=e.getProperty("flex-wrap"),g=e.getProperty("align-content"),m=e.getProperty("align-self"),b=e.getProperty("order"),v=e.getProperty("gap"),w=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},S=[c,u,d,p,h,g,m,b,v,w].map(F=>F.id),C=e.getProperties().filter(F=>!S.includes(`${F.id}`)),x=F=>r.t(`styleManager.layout.${F}`),E=c.getValue(),P=E==="flex",O=(a.display||"").indexOf("flex")>=0,A=u.getValue(),T=A.indexOf("reverse")>=0,_=!B9(["column","column-reverse"],A),L=[{id:"row",label:l.jsx(Q,{icon:W.arrowRight,size:oe.sx}),title:x("direction.title.row")},{id:"row-reverse",label:l.jsx(Q,{icon:W.arrowRight,size:ct,horizontal:!0}),title:x("direction.title.row-reverse")},{id:"column",label:l.jsx(Q,{icon:W.arrowDown,size:oe.sx}),title:x("direction.title.column")},{id:"column-reverse",label:l.jsx(Q,{icon:W.arrowDown,size:ct,vertical:!0}),title:x("direction.title.column-reverse")}],$=[{id:"flex-start",title:x("justify.title.start"),label:l.jsx(Q,{icon:Qc,size:ct,rotate:_?0:90,horizontal:_&&T,vertical:!_&&T})},{id:"center",title:x("justify.title.center"),label:l.jsx(Q,{icon:Rc,size:ct,rotate:_?0:90})},{id:"flex-end",title:x("justify.title.end"),label:l.jsx(Q,{icon:eu,size:ct,rotate:_?0:90,horizontal:_&&T,vertical:!_&&T})},{id:"space-between",title:x("justify.title.spaceBetween"),label:l.jsx(Q,{icon:Iy,size:ct,rotate:_?0:90})},{id:"space-around",title:x("justify.title.spaceAround"),label:l.jsx(Q,{icon:Vy,size:ct,rotate:_?0:90})},{id:"space-evenly",title:x("justify.title.spaceEvenly"),label:l.jsx(Q,{icon:z9,size:ct,rotate:_?0:90})}],D=[{id:"stretch",title:x("align.title.stretch"),label:l.jsx(Q,{icon:Gf,size:ct,rotate:_?0:90})},{id:"flex-start",title:x("align.title.start"),label:l.jsx(Q,{icon:Qc,size:ct,rotate:_?90:0})},{id:"center",title:x("align.title.center"),label:l.jsx(Q,{icon:Rc,size:ct,rotate:_?90:0})},{id:"flex-end",title:x("align.title.end"),label:l.jsx(Q,{icon:eu,size:ct,rotate:_?90:0})}],N=[{id:"flex-start",title:x("alignContent.title.start"),label:l.jsx(Q,{icon:Qc,size:ct,rotate:_?90:0,horizontal:_&&T,vertical:!_&&T})},{id:"center",title:x("alignContent.title.center"),label:l.jsx(Q,{icon:Rc,size:ct,rotate:_?90:0})},{id:"flex-end",title:x("alignContent.title.end"),label:l.jsx(Q,{icon:eu,size:ct,rotate:_?90:0,horizontal:_&&T,vertical:!_&&T})},{id:"space-between",title:x("alignContent.title.spaceBetween"),label:l.jsx(Q,{icon:Iy,size:ct,rotate:_?90:0})},{id:"space-around",title:x("alignContent.title.spaceAround"),label:l.jsx(Q,{icon:Vy,size:ct,rotate:_?90:0})},{id:"stretch",title:x("alignContent.title.stretch"),label:l.jsx(Q,{icon:Gf,size:ct,rotate:_?0:90})}],B=[{id:"auto",title:x("alignSelf.title.auto"),label:l.jsx(Q,{icon:W.close,size:ct})},{id:"flex-start",title:x("alignSelf.title.start"),label:l.jsx(Q,{icon:Qc,size:ct,rotate:90})},{id:"center",title:x("alignSelf.title.center"),label:l.jsx(Q,{icon:Rc,size:ct,rotate:90})},{id:"flex-end",title:x("alignSelf.title.end"),label:l.jsx(Q,{icon:eu,size:ct,rotate:90})},{id:"stretch",title:x("alignSelf.title.stretch"),label:l.jsx(Q,{icon:Gf,size:ct,rotate:0})}],q=[{id:"0 0 auto",label:l.jsx(Q,{icon:W.close,size:ct}),title:x("flex.title.auto")},{id:"1 1 0%",label:l.jsx(Q,{icon:W.unfoldMoreHorizontal,size:ct,rotate:90}),title:x("flex.title.fillContainer")},{id:"0 1 auto",label:l.jsx(Q,{icon:W.unfoldLessHorizontal,size:ct,rotate:90}),title:x("flex.title.hugContents")}];return f.useEffect(()=>{if(!n)return()=>{};const{Styles:F}=n,k=()=>{const V=n.getSelected();let U={},X={};if(V){const Y=V.getEl();if(Y){U=window.getComputedStyle(Y);const R=Y.parentElement;R&&(X=window.getComputedStyle(R))}}o(U),i(X)},H=F.events.target;return n.on(H,k),k(),()=>n.off(H,k)},[n]),l.jsxs(l.Fragment,{children:[l.jsx(he,{children:l.jsx(Ee,{...wt(c,y),...qf,tip:x(`display.tips.${E}`)})}),P&&l.jsxs(l.Fragment,{children:[l.jsx(he,{children:l.jsx(zt,{...$r(u,y),options:L})}),l.jsx(he,{children:l.jsx(zt,{...$r(d,y),options:$})}),l.jsx(he,{children:l.jsx(zt,{...$r(p,y),options:D})}),l.jsx(he,{children:l.jsx(dn,{property:v,...y})}),l.jsx(he,{children:l.jsx(Ee,{...wt(h,y),...qf})}),h.getValue()!=="nowrap"&&l.jsx(he,{children:l.jsx(zt,{...$r(g,y),options:N})})]}),O&&l.jsxs(l.Fragment,{children:[l.jsx(he,{separatorTop:!0,children:x("flexChild")}),l.jsx(he,{children:l.jsx(dn,{property:w,options:q,...y})}),l.jsx(he,{children:l.jsx(zt,{...$r(m,y),options:B})}),l.jsx(he,{children:l.jsx(Oe,{...Re(b,{sector:e,styleManagerDataConfig:t})})})]}),C.length>0&&l.jsx(Lr,{properties:C,...y})]})}const W9=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function G9({sector:e,styleManagerDataConfig:t}){var w;const n=_e(),r=e.getProperty("position"),s=r.getValue(),o=e.getProperty("top"),a=e.getProperty("right"),i=e.getProperty("bottom"),c=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},p=y=>n.t(`styleManager.position.${y}`),h=[r,o,a,i,c,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!h.includes(`${y.id}`)),m=W9.map(y=>({id:y,label:p(`presets.options.${y}`)})),b=["absolute","fixed"].includes(s),v=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}o.upValue(S),a.upValue(C),i.upValue(x),c.upValue(E)};return l.jsxs(l.Fragment,{children:[l.jsxs(he,{property:r,children:[l.jsx(Ee,{...wt(r,d),tip:p(`tips.${(w=r.getOption())==null?void 0:w.id}`),...qf}),b&&l.jsx(j,{children:l.jsx(kt,{title:p("presets.title"),children:l.jsx(Ee,{options:m,onChange:v,emptyState:"P",size:"s",caret:"",value:!0})})})]}),s!=="static"&&l.jsxs(l.Fragment,{children:[l.jsxs(he,{col:!0,children:[l.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:l.jsx(Oe,{...Re(o,d)})}),l.jsxs(I,{gap:"s",children:[l.jsx(j,{grow:!0,children:l.jsx(Oe,{...Re(c,d)})}),l.jsx(j,{grow:!0,children:l.jsx(Oe,{...Re(a,d)})})]}),l.jsx(I,{className:Z("gs-utl-w-1/2 gjs-m-auto"),children:l.jsx(Oe,{...Re(i,d)})})]}),l.jsx(he,{children:l.jsx(Oe,{...Re(u,d)})})]}),g.length>0&&l.jsx(Lr,{properties:g,...d})]})}function q9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),r=e.getProperty("min-width"),s=e.getProperty("max-width"),o=e.getProperty("height"),a=e.getProperty("min-height"),i=e.getProperty("max-height"),c={sector:e,styleManagerDataConfig:t},u=[n,r,s,o,a,i].map(p=>p==null?void 0:p.id),d=e.getProperties().filter(p=>!u.includes(`${p.id}`));return l.jsxs(l.Fragment,{children:[l.jsxs(he,{property:[n,o],children:[l.jsx(Oe,{...Re(n,c)}),l.jsx(Oe,{...Re(o,c)})]}),l.jsxs(he,{property:[r,a],children:[l.jsx(Oe,{...Re(r,c)}),l.jsx(Oe,{...Re(a,c)})]}),l.jsxs(he,{property:[s,i],children:[l.jsx(Oe,{...Re(s,c)}),l.jsx(Oe,{...Re(i,c)})]}),d.length>0&&l.jsx(Lr,{properties:d,...c})]})}function K9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),r=e.getProperty("margin"),s={sector:e,styleManagerDataConfig:t},o=[n,r].map(i=>i==null?void 0:i.id),a=e.getProperties().filter(i=>!o.includes(`${i.id}`));return l.jsxs(l.Fragment,{children:[l.jsx(dn,{property:n,...s}),l.jsx(dn,{property:r,...s}),a.length>0&&l.jsx(Lr,{properties:a,...s})]})}function Z9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),r=e.getProperty("color"),s=e.getProperty("font-size"),o=e.getProperty("font-weight"),a=e.getProperty("line-height"),i=e.getProperty("letter-spacing"),c=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),p=e.getProperty("text-transform"),h=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},b=[n,r,s,o,a,i,c,u,d,p,h,g].map(y=>y==null?void 0:y.id),v=e.getProperties().filter(y=>!b.includes(`${y.id}`)),{sdkAddFonts:w}=li();return l.jsxs(l.Fragment,{children:[!!n&&l.jsx(he,{property:n,children:w?l.jsx(jc,{...Fy(n,m)}):l.jsx(Ee,{...wt(n,m)})}),!!r&&l.jsx(he,{property:r,children:l.jsx(Rr,{...To(r,m)})}),l.jsxs(he,{property:[s,o],children:[!!s&&l.jsx(Oe,{...Re(s,m)}),!!o&&l.jsx(Ee,{...wt(o,m)})]}),l.jsxs(he,{property:[a,i],children:[!!a&&l.jsx(Oe,{...Re(a,m)}),!!i&&l.jsx(Oe,{...Re(i,m)})]}),l.jsxs(he,{property:[c,u],children:[!!c&&l.jsx(Ee,{...wt(c,m)}),!!u&&l.jsx(Ee,{...wt(u,m)})]}),l.jsxs(he,{property:[p,h],children:[!!p&&l.jsx(Ee,{...wt(p,m)}),!!h&&l.jsx(Ee,{...wt(h,m)})]}),l.jsxs(he,{property:[g,d],children:[!!g&&l.jsx(Ee,{...wt(g,m)}),!!d&&l.jsx(Ee,{...wt(d,m)})]}),v.length>0&&l.jsx(Lr,{properties:v,...m})]})}const qf={row:!0,classNameLabel:"gs-utl-w-full"},Y9=({property:e,skipClear:t,label:n,afterLabelButtons:r=[]})=>l.jsxs(I,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[l.jsx(j,{grow:!1,children:l.jsx(Vs,{property:e,skipClear:t,label:n})}),!!r.length&&l.jsx(I,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:r.map((s,o)=>l.jsx(ft,{...s},o))})]}),Hy="gs-style-manager",tu=`${Hy}-sector`,X9=`${tu}-header`,J9=`${tu}-content`,jy=(e,t=0,n=!0)=>M(X9,z.bgH2,Se.xyS,z.br,t&&J.bt,(e||n)&&J.bb),Q9=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),R9=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),qi=(e,t)=>{const n=e7(e,t),r=xy(n),{hasDataResolverValue:s}=n,{label:o}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:s,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:r.length?"span":void 0,label:l.jsx(Y9,{property:e,skipClear:s,label:o,afterLabelButtons:r})}}},Kf=(e,t)=>{const{connectDataSources:n,commonProps:r}=qi(e,t);return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(s,o)=>e.upValue(s,{partial:o})}},Dy=(e,t,n)=>{const{connectDataSources:r,commonProps:s}=qi(e,t),{hasDataResolverValue:o,initialDataValue:a}=r;return{fieldProps:{...s,value:o?a:e.getValue(),options:Q9(e,n??{}),onChange:i=>e.upValue(i)},connectDataSources:r}},$r=(e,t,n)=>Dy(e,t,n).fieldProps,wt=(e,t,n)=>{const{fieldProps:r,connectDataSources:s}=Dy(e,t,n),{hasDataResolverValue:o}=s,a=o?e.getValue()||" ":r.emptyState;return{...r,emptyState:a,hideCaret:o}},Fy=(e,t)=>{const{commonProps:n,connectDataSources:r}=qi(e,t),s=r.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:s,hideCaret:r.hasDataResolverValue,value:r.dataResolverValue??e.getValue(),onChange:o=>e.upValue(o)}},Ds=(e,t,n={})=>{const{connectDataSources:r,commonProps:s}=qi(e,t),{hasDataResolverValue:o,dataResolverValue:a}=r;return{...s,title:e.getLabel(),emptyState:o?a:void 0,titleAdd:`Add new ${e.getLabel()}`,items:o?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:i=>e.getLayerLabel(i),add:o?void 0:()=>e.addLayer(n,{at:0}),select:i=>e.selectLayer(i),remove:i=>e.removeLayer(i),move:(i,c=0)=>e.moveLayer(i,c)}},Re=(e,t)=>{const{connectDataSources:n,commonProps:r}=qi(e,t),{hasDataResolverValue:s}=n;return{...r,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,a)=>e.upValue(o,{partial:a}),valueUnit:e.getUnit(),pan:!s,units:s?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:o=>e.upUnit(o)}};function e7(e,t){const{styleManagerDataConfig:n=!1,sector:r}=t,s=e.em.getEditor(),{Styles:o}=s,a=s.getSelected(),i=o.getSelectedAll(),c=o.getSelected();let u=!1;n===!0?u=!0:a&&Ir(n)&&Ke(n.enable)&&(u=n.enable({property:e,sector:r,component:a,editor:s}));const d=e.getName(),p=(c==null?void 0:c.getStyle("",{skipResolve:!0})[d])??"",h=$s(p),g=a==null?void 0:a.collectionsStateMap;return{hasDataResolverValue:h,dataResolverValue:h?c==null?void 0:c.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:p,handleDataValueChange:m=>{i.forEach(b=>{b.addStyle({[d]:m})})},handleValueClear:()=>{i.forEach(m=>{const b=m.getStyle()[d]??"";m.addStyle({[d]:b})})},editor:s,additionalSources:g}}const To=(e,t)=>Kf(e,t),t7=(e,t)=>{const{label:n,...r}=Kf(e,t);return{...r,label:n,isContain:e.get("contain")??!0,hideButton:r.disabled,inputField:e.get("inputField"),onOpen(){const s=e.em.Assets;s.open({select(o){e.upValue(o.getSrc()),s.close()}})}}},n7=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let r=$9;switch(n){case"gs-layout":r=U9;break;case"gs-size":r=q9;break;case"gs-space":r=K9;break;case"gs-position":r=G9;break;case"gs-borders":r=j9;break;case"gs-effects":r=F9;break;case"gs-typography":r=Z9;break;case"gs-background":r=H9;break}return l.jsx(r,{sector:e,styleManagerDataConfig:t})},Zf={},By=ie(function({className:t,sectors:n}){var h;const[r,s]=f.useState(Zf),o=me(),{editor:a}=o,i=a==null?void 0:a.Styles,c=i==null?void 0:i.getSelected(),u=a==null?void 0:a.getSelected();if(f.useEffect(()=>{if(u&&a){const g=setTimeout(()=>{let m=Zf;const b=u.get("styleManager");Ke(b)&&(m=b({editor:a,component:u})),s(m||Zf)});return()=>clearTimeout(g)}},[u,a]),!i||!c)return null;const d=n.length?n:i.getSectors({visible:!0}),p=(h=o.sdkOptions.dataSources)==null?void 0:h.styleManager;return r.disabled?null:l.jsx("div",{className:M(Hy,t,"gs-utl-select-none"),children:d.map((g,m)=>l.jsx(Qr,{open:g.isOpen(),onChange:({open:b})=>g.setOpen(b),classNameWrap:M(tu,`${tu}__${g.id}`),sticky:!0,handler:()=>{const b=g.getProperties({withValue:!0}).length>0,v=g.getProperties({withParentValue:!0}).length>0;return l.jsxs(I,{gap:"xs",items:"center",children:[l.jsx(j,{className:"gs-utl-mr-2",children:g.getName()}),b&&l.jsx(j,{children:l.jsx("div",{className:M(Ce.dot,z.bgA2)})}),v&&l.jsx(j,{children:l.jsx("div",{className:M(Ce.dot,z.bgW)})})]})},className:b=>jy(b,m,m===d.length-1),children:l.jsx(I,{className:M(J9,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:n7(g,{styleManagerDataConfig:p})})},g.id))})}),r7=f.forwardRef(function({children:t,className:n,content:r,...s},o){return l.jsx("div",{className:M(ae("gs-design-manager-tab"),n),ref:o,...s,children:t})}),zy="gs-cmp-sidebar-right",Uy="gs-cmp-traits-provider",Yf=M("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function s7(){var y,S,C;const{isCssPanelActive:e,selectedDesignerTab:t,showSelectors:n,setSelectedDesignerTab:r,sdkProps:s,sdkOptions:o,isProjectTypeEmail:a}=me(),i=_e(),c=M(e&&"gs-utl-hidden"),d=(((y=In(s.children,r7))==null?void 0:y.filter(Boolean))||[]).map(({props:x},E)=>({id:x.id,label:x.label,content:l.jsx(yi,{children:x.children}),order:x.order??2+E+1})),p=(S=o.designPanel)==null?void 0:S.propsInStyles,h=(C=o.designPanel)==null?void 0:C.hideTabs,g=p===!0||a&&p!==!1,m=h===!0||a&&h!==!1,b=i.t("traitManager.panelLabel"),w=[{id:"style",label:i.t("styleManager.panelLabel"),order:1,content:l.jsxs(I,{col:!0,full:!0,children:[!!n&&l.jsx(j,{className:M("gs-cmp-selectors-provider",Se.s,J.bb,z.br),children:l.jsx(Hb,{children:x=>l.jsx(Ay,{...x})})}),g&&l.jsx(j,{className:M(Uy,Yf),children:l.jsx(Qr,{handler:b,className:jy(!1),sticky:!0,open:!0,children:l.jsx(_p,{children:x=>l.jsx(jf,{...x,className:M("gs-utl-p-2",z.br,J.bb)})})})}),l.jsx(j,{className:M("gs-cmp-styles-provider",Yf),grow:!0,children:l.jsx(jb,{children:x=>l.jsxs(l.Fragment,{children:[e&&l.jsx(Db,{}),l.jsx(By,{className:c,...x})]})})})]})},!g&&{id:"props",label:b,order:2,content:l.jsx(I,{className:Uy,col:!0,full:!0,children:l.jsx(j,{className:M(Se.s,Yf),children:l.jsx(_p,{children:x=>l.jsx(jf,{...x})})})})},...d].filter(Boolean).sort((x,E)=>x.order-E.order);return l.jsx(I,{className:zy,col:!0,full:!0,nowrap:!0,children:l.jsx(Ms,{value:t,onChange:r,tabs:w,className:M(`${zy}__tabs`,m&&"gs-utl-hidden")})})}const Wy=ie(s7),o7="gs-panel-sidebar-tabs",a7=f.memo(ie(function({className:t,...n}){return l.jsx(or,{className:M(o7,"gs-utl-h-full",t),...n,children:l.jsx(Wy,{})})})),i7="gs-panel-styles",l7=f.memo(ie(function({className:t,...n}){const{isCssPanelActive:r}=me(),s=M(r&&" gs-utl-hidden");return l.jsx(or,{className:M(i7,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:l.jsx(jb,{children:o=>l.jsxs(l.Fragment,{children:[r&&l.jsx(Db,{}),l.jsx(By,{className:s,...o})]})})})})),c7="gs-panel-templates",u7=f.memo(ie(function({className:t,templates:n,content:r,onSelect:s,...o}){const a=Nm(),{projectTypeFilter:i}=a;let c=n??a.templates;return c=c==null?void 0:c.map(u=>({...u,isTemplate:!0})),f.useEffect(()=>{n||a.loadTemplates()},[n]),l.jsx(or,{className:M(c7,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...o,children:l.jsx(I,{className:ae("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:l.jsx(I,{className:ae("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:l.jsx(Ev,{templates:c,projectType:ht[i],content:r,onSelect:s,skipProjectNamePopover:!0})})})})})),d7="gs-cmp-row",p7=f.memo(function({className:t,children:n,full:r,...s}){return l.jsx(cn,{className:M(d7,z.bg,"gs-utl-flex",r&&"gs-utl-w-full",t),...s,children:Tt(n)})}),f7="gs-cmp-select-field",h7=f.memo(ie(function({className:t,style:n,label:r,name:s,value:o,options:a,size:i,onChange:c,required:u,disabled:d,emptyState:p,editorEvents:h}){const{editor:g}=me(),[m,b]=f.useState(()=>({required:u,disabled:d,style:n,className:t,label:r,name:s,value:o,options:a,size:i,emptyState:p})),v=w=>{c({value:w,editor:g,state:m,setState:y=>b(S=>({...S,...y}))})};return Fs({editor:g,editorEvents:h,localState:m,setLocalState:b}),l.jsx(Ee,{classNameContainer:M(f7,m.className),style:m.style,label:m.label,name:m.name,value:m.value??"",options:m.options??[],size:m.size,required:m.required,disabled:m.disabled,emptyState:m.emptyState,onChange:v})})),g7="gs-cmp-select-field",m7=f.memo(ie(function({className:t,style:n,label:r,name:s,value:o,size:a,onChange:i,required:c,disabled:u,emptyState:d,editorEvents:p}){const{editor:h}=me(),[g,m]=f.useState(()=>({required:c,disabled:u,style:n,className:t,label:r,name:s,value:o,size:a,emptyState:d})),b=v=>{i({value:v,editor:h,state:g,setState:w=>m(y=>({...y,...w}))})};return Fs({editor:h,editorEvents:p,localState:g,setLocalState:m}),l.jsx(jc,{classNameContainer:M(g7,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:b})})),b7="gs-sidebar-bottom",v7=f.memo(ie(function({children:t,className:n,style:r,height:s,...o}){const{isInPreview:a,isBottomSidebarOpen:i}=me(),c=s??35,u=f.useMemo(()=>({height:c,marginBottom:a||!i?`-${c}px`:0,...r}),[a,i,r]);return l.jsx(cn,{className:M(b7,"gs-utl-flex gs-utl-transition-spacing",J.bt,z.br,n),style:u,...o,children:t?Tt(t):void 0})})),y7=ie(function(t){var S;const{leftSidebarSize:n,setLeftSidebarSize:r,editor:s,isInPreview:o,isLeftSidebarOpen:a,sdkProps:i,showPages:c}=me(),u=i.children,d=((S=t.style)==null?void 0:S.width)??t.width,p=d??n,h=t.resizable===!1,g=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",J.br,z.br),m=M("gs-utl-w-full",J.bb,z.br),b=M("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),v=f.useMemo(()=>({marginLeft:o||!a?`-${p}px`:0,...t.style}),[p,o,a,t.style]),w=()=>s==null?void 0:s.refresh(),y=(C,x,E)=>{r(E.getBoundingClientRect().width)};return l.jsx(Vc,{className:g,enable:h?!1:void 0,right:!h,style:v,height:"100%",width:p,minWidth:d??200,maxWidth:d??400,onResize:w,onResizeStop:y,children:t.children??l.jsxs(I,{full:!0,col:!0,children:[c&&l.jsx(j,{className:m,children:l.jsx(Vb,{children:C=>l.jsxs(l.Fragment,{children:[In(u,hy),l.jsx(py,{...C}),In(u,fy)]})})}),l.jsx(j,{className:b,grow:!0,children:l.jsx(Ib,{children:C=>l.jsxs(l.Fragment,{children:[In(u,_0),l.jsx(O0,{...C}),In(u,A0)]})})})]})})}),w7="gs-sidebar-left",S7=f.memo(ie(function({children:t,width:n,resizable:r,...s}){return l.jsx(y7,{className:M(w7,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",oc(s)),width:n,resizable:r,style:ac(s),children:t?Tt(t):void 0})})),C7=ie(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:r,editor:s,isInPreview:o,isRightSidebarOpen:a}=me(),i=((m=t.style)==null?void 0:m.width)??t.width,c=i??n,u=t.resizable===!1,d=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",J.bl,z.br),p=f.useMemo(()=>({marginRight:o||!a?`-${c}px`:0,...t.style}),[c,o,a,t.style]),h=()=>s==null?void 0:s.refresh(),g=(b,v,w)=>{r(w.getBoundingClientRect().width)};return l.jsx(Vc,{className:d,enable:u?!1:void 0,left:!u,style:p,height:"100%",width:c,minWidth:i??200,maxWidth:i??400,onResize:h,onResizeStop:g,children:t.children??l.jsx(Wy,{})})}),x7="gs-sidebar-right",E7=f.memo(ie(function({children:t,resizable:n,...r}){return l.jsx(C7,{className:M(x7,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",oc(r)),resizable:n,style:ac(r),children:t?Tt(t):void 0})})),P7=ie(function({className:t,variant:n,value:r,tabs:s,style:o,editorEvents:a,onChange:i}){const{editor:c}=me(),[u,d]=f.useState(()=>({tabs:s,style:o,value:r,variant:n,className:t})),p=f.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:Tt(m.children)})))||[]},[u.tabs]),h=g=>{i&&c?i({value:g,editor:c,state:u,setState:m=>d(b=>({...b,...m}))}):d(m=>({...m,value:g}))};return Fs({editor:c,editorEvents:a,localState:u,setLocalState:d}),l.jsx(Ms,{tabs:p,className:M(u.className),variant:u.variant,value:u.value,style:u.style,onChange:h})}),T7="gs-cmp-text",O7=f.memo(function({className:t,content:n,children:r,...s}){return l.jsx(cn,{className:M(T7,t),...s,children:r||n})}),A7="gs-cmp-virtual-list",_7=ie(function({id:t,items:n,itemLayout:r,itemsPerRow:s=12,className:o,style:a,htmlAttrs:i}){const[c,u]=f.useState(0),{editor:d,transitionTime:p}=me(),h=Fp(s);return f.useEffect(()=>{const g=setTimeout(()=>u(m=>++m),p);return()=>clearTimeout(g)},[p]),!!c&&l.jsx(xc,{...i,data:n,className:M(A7,"gs-utl-h-full",o),listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${h}`,style:a,itemContent:(g,m)=>l.jsx(f.Fragment,{children:r?Tt(r({item:m,editor:d})):l.jsx("pre",{children:JSON.stringify(m,void 0,2)})},m.id??g)},t)});var Xf=(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))(Xf||{});const M7={icon:Q,row:p7,column:l$,text:O7,tabs:P7,button:rc,buttonMenu:WM,buttonGroupField:qM,colorPicker:a$,menuList:R$,inputField:J$,codeField:$N,selectField:h7,selectFontField:m7,devices:Ov,panelPages:gy,panelPageSettings:N8,panelLayers:M0,panelPagesLayers:D8,panelBlocks:Mk,panelGlobalStyles:Gk,panelSelectors:E9,panelStyles:l7,panelProperties:p9,panelSidebarTabs:a7,panelAssets:Sk,panelTemplates:u7,sidebarRight:E7,sidebarLeft:S7,sidebarTop:Av,sidebarBottom:v7,canvas:Ub,canvasSidebarTop:LN,virtualList:_7,dataPathField:z$,panelDataVariablePicker:Y$,panelDataConditionPicker:F$,panelDataCollectionPicker:O$,panelDataValuePicker:G$},Tt=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=IA();return t.filter(Boolean).map((r,s)=>{const{type:o,...a}=et(r)?{type:Xf.text,content:r}:r||{},i=a.id||"",c=M7[o],u=n.layoutChildren.get(i),d=n.customLayoutComponents.get(o),p=i||s;if(u)return l.jsx(lp,{id:i,...u},p);if(d){const h=d({id:i,...a});return Tt([h])[0]}else{if(o===Xf.custom)return l.jsx(lp,{id:i,...a},p);if(c)return l.jsx(c,{id:i,...a},p)}return null})},L7=ie(({components:e})=>(Lm().customLayoutComponents,Tt(e))),Fs=e=>{const{editorEvents:t,editor:n,localState:r,setLocalState:s}=e;f.useEffect(()=>{if(!t||!n)return;const o=Object.keys(t).reduce((i,c)=>(i[c]=(u={})=>{const d=t[c];d({fromEvent:u,editor:n,state:r,setState:p=>s(h=>({...h,...p}))})},i),{}),a=Object.keys(o);return a.forEach(i=>n.on(i,o[i])),()=>{a.forEach(i=>n.off(i,o[i]))}},[n,r])},N7=e=>e.Assets.getAll().reduce((r,s)=>{const o=s.getSrc(),a=o.match(/^data:([^;]+);/);if(a){const i=o.split(",")[1],c=lA(s.get("name"));r[o]={mime:a[1],name:c,base64:i}}return r},{}),$7=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),Gy=(e,t,n={})=>{let r=e;const s=n.pathPfx||"";for(const o in t)if(r.includes(o)){const a=t[o];r=r.replace(new RegExp($7(o),"g"),`${s}${a.name}`),a.found=!0}return r},k7=(e,t,n)=>`${t||""}${e||""}${n||""}`,I7=(e,t)=>{const n=e?`<div ${Gl}>${e}</div>`:"",r=t?`<div ${Gl} data-gjs-global>${t}</div>`:"";return`${n}${r}`},V7=async(e,t={})=>{const{page:n,skipProject:r,assetsFolder:s="assets",filenameCss:o="style.css",styles:a,isMJML:i,exportConfig:c,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:p}=t,h={...c,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),b=N7(e),v=`${s}/`,w=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=Gy(w,b,{pathPfx:v}),S=a==="inline",C=a==="skip",x=a==="skipInPage",E=p==="skip",P=u?{}:na(e).globalPageSettings||{},O=[],A=(T,_)=>{var It,ns,Oo;const{pageSettingOpts:L}=_||{},$=T.getName(),D=S||(L==null?void 0:L.replaceDataSources),N=Ss(T,"title",L)||$,B=Ss(T,"favicon",L),q=Ss(T,"description",L),F=Ss(T,"keywords",L),k=Ss(T,"socialTitle",L),H=Ss(T,"socialDescription",L),V=Ss(T,"socialImage",L),U=u?"":um(Ss(T,"fonts")),X=Qt({page:T,key:"customCodeHead",opts:L})??"",Y=k7(X,P.customCodeHead,U),R=Qt({page:T,key:"customCodeBody",opts:L})??"",ee=d?"":I7(R,P.customCodeBody),te=T.getMainComponent(),K=E?"":e.getJs({component:te}),ne=K?`<script>${K}<\/script>`:"",ce=[],ge=[],De={asDocument:!1,...h},ve=te.toHTML(De).replace("</body>",()=>`${ee}${ne}</body>`),Ze=te.head;let Ge=N&&`<title>${N}</title>`,bt=B&&`<link rel="icon" href="${B}"/>`,tt=q&&`<meta name="description" content="${q}"/>`,be=F&&`<meta name="keywords" content="${F}"/>`,Je=k&&`<meta property="og:title" content="${k}"/>`,Qe=H&&`<meta property="og:description" content="${H}"/>`,dt=V&&`<meta property="og:image" content="${V}"/>`,Te='<meta charset="utf-8">',it='<meta name="viewport" content="width=device-width,initial-scale=1">',nt='<meta name="robots" content="index,follow">',Ie='<meta name="generator" content="GrapesJS Studio">';Ze.components().forEach(qe=>{const pt=qe.toHTML(h);st.title({cmp:qe})?Ge=pt:st.favicon({cmp:qe})?bt=pt:st.description({cmp:qe})?tt=pt:st.keywords({cmp:qe})?be=pt:st.socialTitle({cmp:qe})?Je=pt:st.socialDescription({cmp:qe})?Qe=pt:st.socialImage({cmp:qe})?dt=pt:st.charset({cmp:qe})?Te=pt:st.viewport({cmp:qe})?it=pt:st.robots({cmp:qe})?nt=pt:st.generator({cmp:qe})&&(Ie=pt)}),Ge&&ce.push(Ge),Te&&ce.push(Te),it&&ce.push(it),nt&&ce.push(nt),Ie&&ce.push(Ie),tt&&ce.push(tt),be&&ce.push(be),Je&&ce.push(Je),Qe&&ce.push(Qe),dt&&ce.push(dt),bt&&ce.push(bt),ge.length&&ce.push(...ge),Y&&ce.push(Y),y&&!(C||x)&&ce.push(D?`<style>${y}</style>`:`<link rel="stylesheet" href="./${o}">`);const pe=te.doctype||"<!DOCTYPE html>",Le=(ns=(It=te.docEl).__attrToString)==null?void 0:ns.call(It,h),Ne=(Oo=Ze.__attrToString)==null?void 0:Oo.call(Ze,h),Me=e.getHtml(h).trim(),St=i?e.runCommand(Ql,{mjml:Me}).html:`${pe}
|
|
346
|
-
<html${
|
|
347
|
-
<head${
|
|
348
|
-
${
|
|
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}
|
|
335
|
+
<html${De?` ${De}`:""}>
|
|
336
|
+
<head${Fe?` ${Fe}`:""}>
|
|
337
|
+
${le.join(`
|
|
349
338
|
`)}
|
|
350
339
|
</head>
|
|
351
|
-
${
|
|
340
|
+
${Ce}
|
|
352
341
|
</html>
|
|
353
|
-
`;return{filename:
|
|
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">
|
|
354
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" />
|
|
355
|
-
</svg>`,
|
|
356
|
-
${
|
|
357
|
-
${
|
|
358
|
-
${`${
|
|
359
|
-
${(
|
|
360
|
-
${
|
|
361
|
-
`},resolveCondition(
|
|
362
|
-
${
|
|
363
|
-
${u(
|
|
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=`
|
|
345
|
+
${l(E)}
|
|
346
|
+
${p.toHTML(s)??""}`}const b=a.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),w=a.getConditionalEndSyntax(u);return`
|
|
347
|
+
${`${l(b)}
|
|
348
|
+
${(f==null?void 0:f.toHTML(s))??""}${v}
|
|
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)}
|
|
351
|
+
${b}
|
|
352
|
+
${u(v)}`;if(a)return`
|
|
364
353
|
${w}
|
|
365
|
-
`;const y=this.tagName,S=this.__attrToString(
|
|
354
|
+
`;const y=this.tagName,S=this.__attrToString(s),C=S?` ${S}`:"",x=`<${y}${C}>`,E=`</${y}>`;return`
|
|
366
355
|
${x}${w}${E}
|
|
367
|
-
`}}),
|
|
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=`
|
|
368
357
|
${g.join(",")} {
|
|
369
358
|
outline: 2px dotted #8b5cf6;
|
|
370
359
|
}
|
|
@@ -377,7 +366,7 @@ ${x}${w}${E}
|
|
|
377
366
|
[data-gjs-type="data-variable"]::before,
|
|
378
367
|
[data-gjs-type="data-condition-true-content"]::before,
|
|
379
368
|
[data-gjs-type="data-condition-false-content"]::before {
|
|
380
|
-
content: var(${
|
|
369
|
+
content: var(${Bs});
|
|
381
370
|
font-style: italic;
|
|
382
371
|
color: #666;
|
|
383
372
|
white-space: nowrap;
|
|
@@ -388,12 +377,12 @@ ${x}${w}${E}
|
|
|
388
377
|
font-weight: 500;
|
|
389
378
|
font-family: sans-serif;
|
|
390
379
|
}
|
|
391
|
-
`,d.head.appendChild(
|
|
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:`
|
|
392
381
|
.gjs-typed {
|
|
393
382
|
padding: 5px;
|
|
394
383
|
}
|
|
395
|
-
`}}})}if(["tabs","tab-content","tab-contents","tab","tab-container"].indexOf(
|
|
384
|
+
`}}})}if(["tabs","tab-content","tab-contents","tab","tab-container"].indexOf(o)>=0){const i={emptyState:!0,icon:o==="tabs"?`
|
|
396
385
|
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
397
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"/>
|
|
398
387
|
</svg>
|
|
399
|
-
`:void 0};s==="tab"&&(i.traits=[{type:"button",label:!1,text:"Style Active",command:c=>{c.select(),c.runCommand(Ky),setTimeout(()=>c.Selectors.select(".tab.tab-active"))}}]),t.addType(s,{model:{defaults:i}})}};e.on("component:type:add",n)}const G7=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:r})=>r&&n.onLoad())},q7=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:r}=e;r.getConfig().uploadFile=async(...s)=>{const o=s[0],a=await n.handleUpload(o),i=s[1];a&&(i==null||i({data:a}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},K7=()=>{const{baseApiUrl:e}=Tm();return`${e}/sdk/projects`},qy=e=>`${K7()}/${e}`,Z7=async({licenseKey:e,projectId:t,...n})=>{const r=await vr.put(qy(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return r==null?void 0:r.result},Y7=async(e,t)=>await vr.put(t,{body:e,headers:{"Content-Type":"application/json"}}),X7=async(e,t,n,r)=>{const s=JSON.stringify(e),o=await Z7({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([s]).size},identityId:r,name:e.name,description:e.description});if(!o)throw new Error("Project not found");const{uploadUrl:a}=o;await Y7(s,a)},J7=(e,t,n)=>vr.get(qy(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),Q7=async e=>await vr.get(e),R7=async(e,t,n,r)=>{const s=await J7(t,n,r),o=s==null?void 0:s.result,a=s==null?void 0:s.errorData;if(!o&&(a!=null&&a.notFoundInDb))return{id:n,project:{}};if(!o)throw new Error("Project not found");const{downloadUrl:i}=o,c=await Q7(i);if(!c||c instanceof Error)throw new Error("Project download failed");return{id:n,project:c}},eI=(e,t)=>{const{appEditorStore:n,toastStore:r,i18nStore:s}=t.appStore.store,{isUsingProjectSelfHosted:o,isUsingProjectCloud:a,sdkOptions:i}=n,c=i.storage||{},{project:u,onLoad:d,onSave:p,autosaveChanges:h,autosaveIntervalMs:g}=c;let m,b,v,w;if(o)v=d,w=p,m=h,b=g;else if(a){const E=i.licenseKey,P=n.sdkProjectId,O=n.sdkIdentityId,A=10,T=1e4;w=({project:_})=>X7(_,E,P,O),v=({editor:_})=>R7(_,E,P,O),m=Math.max(A,h??A),g&&(b=Math.max(T,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 P;const E=(P=i.project)==null?void 0:P.default;!x&&E&&e.loadProjectData(E)}),e.on(C.startStore,()=>n.setIsSaving(!0)),e.on(C.endStore,()=>n.setIsSaving(!1)),(v||u)&&w){const E="remote";y.setCurrent(E),y.add(E,{async load(){return u||(await v({editor:e})).project},async store(P){await w({project:P,editor:e})}}),e.on(C.errorLoad,P=>{r.addError("storage-error-load",{header:s.t("storageManager.errorLoad"),content:P.message})}),e.on(C.errorStore,P=>{r.addError("storage-error-store",{header:s.t("storageManager.errorStore"),content:P.message})}),m&&y.setStepsBeforeSave(m),b&&e.onReady(()=>{const P=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},b);e.on("destroy",()=>clearInterval(P))})}},ru="select-target",Ky="enable-sm";function tI(e,t){var N,B,q,F;const{appStore:n}=t,{appEditorStore:r,blockManagerStore:s,toastStore:o,modalStore:a,layoutStore:i,contextMenu:c,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:p,nextProjectData:h,sdkOptions:g}=r,m=()=>s.toggleOpen(),b=()=>r.toggleLeftSidebar(),v=()=>r.toggleRightSidebar(),w=e.getConfig(),{Assets:y,Storage:S,Commands:C}=e,x=C.events,E=e.events,P=(B=(N=g.gjsOptions)==null?void 0:N.assetManager)==null?void 0:B.custom;let O=!1;if(y.all.model.prototype.idAttribute="src",Ot(P)&&(y.getConfig().custom=P),h&&(w.projectData=h,r.setNextProjectData()),p){const k=S.getConfig().options;k&&(k.local.key=p)}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=na(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:A}=e,T=Cs(()=>r.setCanvasPanning(!1),200);e.on(A.events.coords,()=>{r.setCanvasPanning(!0),T()}),e.on(A.events.frameLoad,({el:k})=>{k.tabIndex=-1});const{Parser:_}=e,L=((q=r.sdkOptions.parser)==null?void 0:q.showErrors)!==!1;(F=_.events)!=null&&F.css&&L&&e.on(_.events.css,k=>{const{error:H}=k;if(H){const V=et(H)?H:H.name&&H.reason?`${H.name}: ${H.reason}`:H.message;o.addError("css-error",{header:"CSS Parser Error",content:V})}}),[{id:"toggle-lsidebar",keys:"alt+ctrl+,",cmd:b},{id:"toggle-lsidebar2",keys:"alt+⌘+,",cmd:b},{id:"toggle-rsidebar",keys:"alt+ctrl+., alt+⌘+.",cmd:v},{id:"show-blocks",keys:"ctrl+b, ⌘+b",cmd:m},{id:"add-symbol",keys:"alt+ctrl+k, alt+⌘+k",cmd: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),s.setOpen(!1),Cb(e,!1)}),e.on(`${x.stopCommand}core:preview`,()=>{r.setPreview(!1),Cb(e,!0),setTimeout(()=>{e.refresh()},r.transitionTime)});const $="target-selection",{Components:D}=e;C.add(ru,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover(k,H){const V={id:$,type:"target",component:H};H?A.addSpot(V):A.removeSpots(V)},beforeSelect(k,H={}){H.abort=!0,H.useValid=!1,this.opts.onSelect(k),e.stopCommand(ru)},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),A.removeSpots({id:$}),r.setSelectingTarget(!1)}}),C.add(Ky,()=>{r.setSelectedDesignerTab("style")}),C.add(re.toastAdd,(k,H,V)=>{o.add(V.id,V)}),C.add(re.toastRemove,(k,H,V)=>{o.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 f.createElement(BM,{options:(H=(k=g.commands)==null?void 0:k.options)==null?void 0:H[tr.showCode]})}})}),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,...X}=V;i.remove(U,X)}),C.add(re.layoutToggle,(k,H,V)=>{const{id:U,...X}=V;U&&(i.get(U)?i.remove(U,X):i.add(U,X))}),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)=>[ls(i.get(V.id))]),C.add(re.layoutConfigGet,()=>ls(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:X}=V;U&&X&&i.addCustomLayoutComponent(U,X)}),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)=>f.createElement(L7,{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||{};Ot(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:()=>{pA(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),C.add(re.projectFiles,(k,H,V)=>{var R,ee;const U=(R=r.sdkOptions.dataSources)==null?void 0:R.exportConfig,X=((ee=V.exportConfig)==null?void 0:ee.exportPreset)??U,Y={isMJML:r.isProjectTypeEmail,exportConfig:X,...V};return V7(k,Y)}),C.add(re.validateCode,(k,H,V)=>tb({...V,appStore:n})),C.add(re.getBlocksPanel,()=>({isOpen:s.isOpen})),C.add(re.setBlocksPanel,(k,H,V)=>{const U=V||{};Ot(U.isOpen)&&s.setOpen(U.isOpen)}),C.add(re.canvasReload,()=>{const k=e.getSelected(),H=A.getCanvasView(),{frames:V}=A.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,...X}=V;c.showForComponent(U,X)}),C.add(re.getStateContextMenu,()=>c.publicState),C.add(re.setStateContextMenu,(k,H,V)=>{c.setPublicState(V)}),C.add(re.symbolAdd,(k,H,V)=>{const U=V.component||e.getSelected();if(U)return D.getSymbolInfo(U).isSymbol?o.add("skip-symbol",{header:"The selected element is already a symbol",variant:Zt.Warning}):D.addSymbol(U)}),C.add(re.symbolDetach,(k,H,V)=>{const U=V.component||e.getSelected();U&&D.getSymbolInfo(U).isRoot&&D.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:X}=e,Y=X.getComponentRules(U,{current:!0})[0];if(Y){const{state:R,mediaText:ee}=Y.attributes,te=Y.getStyle();D.getSymbolInfo(U).relatives.forEach(K=>{X.setIdRule(K.getId(),te,{state:R,mediaText:ee})})}V.deep&&U.components().forEach(R=>e.runCommand(re.symbolPropagateStyles,{...V,component:R}))}),C.add(re.assetProviderGet,()=>ls(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(X=>X.id!==V);u.setAllProviders(U)}),C.add(re.fontGet,()=>ls(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)=>{hf(k,V)}),C.add(re.menuFontLoad,(k,H,{font:V})=>np(V,!1)),C.add(re.toggleStateDataSource,()=>(O=!O,e.trigger(hn.toggleDataSourcesPreview,{showPlaceholder:O}),e.refresh({tools:!0}),{showPlaceholder:O})),C.add(re.getStateDataSource,()=>({showPlaceholder:O})),C.add(re.dataSourceSetGlobalData,(k,H,{globalData:V})=>{const U=Zv(V);return e.DataSources.get(yo.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}}),q7(e,t),eI(e,t),G7(e,t),W7(e),H7(e),gM(e),j7(e,t),U7(e,t)}const nI=/\s(?![^(]*\))/,Zy=/^-?[0-9]+[a-zA-Z%]{0,}$/;function Yy(e){const t=e.split(nI),n=t.indexOf("inset")>=0,r=t.filter(d=>d!=="inset"),s=r.filter(d=>!Zy.test(d))[0]||"currentColor",o=r.filter(d=>Zy.test(d)),[a="0",i="0",c="0",u="0"]=o;return{x:a,y:i,blur:c,spread:u,inset:n,color:s}}const su=["%"],ou=["s","ms"],Ki=["deg","rad","grad"],kr=["px","%","em","rem","vw","vh"],Xy={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},rI=e=>`linear-gradient(${e} 1%, ${e} 100%)`,au=e=>({id:e,label:e.split("-").map(cr).join(" ")}),Jy=e=>({property:t,to:n})=>{if(n.value){const r=t.getOption(),s=t.getParent().getProperty(e),o=s.getUnit(),a={units:r.units||[],min:r.min,max:r.max,unit:""};(!o||(a==null?void 0:a.units.indexOf(o))<0)&&(a.unit=(a==null?void 0:a.units[0])||""),s.up(a)}},sI=e=>{const t=`${e}-name`,n=`${e}-value`;return(r,{separatorLayers:s})=>{const o=r[e]||"";return o?o.split(s).map(a=>{const{name:i,value:c}=Yc(a);return{[t]:i,[n]:c}}):[]}},Qy=e=>{const t={[Gi]:e};if(e.indexOf("url(")>-1)t[Nr]=js.Image;else if(e.indexOf("gradient(")>-1){const n=zf(e),r=n.colorStops,s=n.name.indexOf("linear")>=0;r.length===2&&s&&r[0].color===r[1].color?t[Nr]=js.Color:t[Nr]=js.Gradient}else t[Nr]=js.Color,t[Gi]=rI(e);return t},Ry=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(r,{separatorLayers:s}){const o=r[e]||"";return o?o.split(s).map(a=>{const{name:i,value:c}=Yc(a);return{[t]:i,[n]:c}}):[]},toStyle(r,{name:s}){return{[s]:`${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:Jy(n)},{property:n,type:"integer"}]}},iu=(e,{x:t,y:n,mergable:r}={})=>{const s={property:`${e}-x`,type:"integer",units:kr,...t},o={property:`${e}-y`,type:"integer",units:kr,...n};return{property:e,type:"composite",properties:[s,o],...r&&{fromStyle(a,{name:i,separator:c,property:u}){const[d,p]=u.getProperties(),[h,g]=(a[i]||"").split(c);return{[d.getId()]:a[d.getName()]||h||"",[p.getId()]:a[p.getName()]||g||h||""}},toStyle(a,{name:i,property:c}){const[u,d]=c.getProperties(),p=a[u.getId()],h=a[d.getId()];return{[i]:p===h?p:`${p} ${h}`}}}}},oI=(e,t="")=>{const n=`${e}-name`,r=`${e}-value`;return(s,{name:o})=>({[o]:`${s[n]}(${s[r]||t})`})};["top","middle","bottom"].map(au),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(au),["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"})),iu("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(au),Mw("(?<!\\(.*[^)]),(?![^()]*\\))"),js.Image,js.Gradient,js.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:kr,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:kr,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:kr})),["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"})),iu("overflow",{x:Xy,y:Xy,mergable:!0}),Ry(),Ry("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(au),ou[0],ou[0],sI("transform"),oI("transform","0"),Jy("transform-value"),iu("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),iu("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function ew(e,t){return[n=>xM(n,t),...CM[e],n=>tI(n,t),vM(e,t)]}class aI{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,Xt(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const r=(yield lI()).filter(s=>s.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=[...ew(t,{appStore:n}),...this.projectPlugins||[]],s=n.sdkOptions.plugins||[];return Ke(s)?s({plugins:r}):[...r,...s]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,s=t.id;r.includes(s)?this.pendingUninstalled=r.filter(o=>o!==s):n.includes(s)||n.push(s)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:r}=this,s=t.id;n.includes(s)?this.pendingInstalled=n.filter(o=>o!==s):r.push(s)}setSelectedShown(t){this.selectedShown=t}}const iI={db:Q1.gjsStudio},lI=()=>new Promise(async e=>{let t=[];try{t=await I3(Bl.Settings,"plugins",iI)||[]}catch(n){lr()&&console.error(n)}e(t)}),cI=f.createContext(void 0);class uI{constructor(t){this.blockManagerStore=new DA(this),this.appEditorStore=new SA(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new W_(t==null?void 0:t.localSettingsStore),this.toastStore=new jA(this),this.modalStore=new G_(this),this.i18nStore=new NA(this),this.pluginStore=new aI(this),this.pointerBadgeStore=new VA(this),this.contextMenu=new dI(this),this.layoutStore=new kA(this),this.templatesStore=new HA(this),this.assetsStore=new MA(this),this.globalStylesStore=new F_(this),this.fontsStore=new LA(this),this.appEditorStore.init(),pu()&&(window.__gjss=this)}}const pn=()=>{const e=f.useContext(cI);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},Jf=()=>{throw new Error("Store has not been initialized")};class dI{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=to(function*(n,r={}){var w;if(!(n!=null&&n.em))return[];const s=n.em.getEditor(),{isSymbol:o,isRoot:a}=s.Components.getSymbolInfo(n),i=!!n.getSymbolOverride(),c=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),p=[u&&{id:ys.selectParent,icon:W.arrowUp,label:"Select parent",onClick:()=>{s.runCommand("core:component-exit",{force:!0})}},d&&{id:ys.duplicate,icon:W.contentCopy,label:"Duplicate",onClick:()=>{s.runCommand("tlb-clone")}},!o&&c&&{id:ys.symbolCreate,icon:W.rhombusSplit,label:"Create Symbol",onClick:()=>{s.runCommand(re.symbolAdd)}},o&&a&&{id:ys.symbolDetach,icon:W.alertRhombus,label:"Detach instance",onClick:()=>{s.runCommand(re.symbolDetach)}},o&&!i&&{id:ys.symbolOverride,icon:W.rhombusOutline,label:"Make overridable",onClick:()=>{s.runCommand(re.symbolOverride,{override:!0})}},o&&i&&{id:ys.symbolOverrideClear,icon:W.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{s.runCommand(re.symbolOverride)}},c&&{id:ys.delete,icon:W.delete,label:"Delete",onClick:()=>{s.runCommand("core:component-delete")}}].filter(Boolean),h=n.get("contextMenu"),g={...r,items:p,component:n,editor:s,type:n.get("type")||"default",source:r.source||ep.canvas},m=yield tw(h,g),b=(w=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:w.contextMenu;return yield tw(b,{...g,items:m})}),this.store=t,Xt(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 s=yield this.getItemsForComponent(t,n);s.length&&this.show({...n,items:s})}show({items:t,x:n,y:r,w:s,h:o}){this.isOpen=!0,this.coordinates={x:n,y:r,w:s,h:o},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const tw=async(e,t)=>Ke(e)?(await e(t)).filter(Boolean):t.items,pI=()=>pn().contextMenu,nw=lr()&&document.body,Qf=(e={})=>({...Ap,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??nw}},{name:"preventOverflow",options:{boundary:e.boundary??nw}}]}),fI=Qf(),lu="gs-ctx-menu-list",hI=ie(function({onItemClick:t,open:n,items:r,x:s,y:o,w:a,h:i,className:c}){const u=pI(),[d,p]=f.useState(),[h,g]=f.useState(null),m=f.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(s,o,a,i)}),[s,o,a,i,n]),{styles:b,attributes:v}=Ra(m,h,fI),w=M(`${lu}-wrp gs-utl-z-20`,c),y=M(`${lu} gs-utl-z-20`),S=M(`${lu}-body gs-utl-max-w-56`),C=M(`${lu}-item`),x="gs-utl-max-w-40",E=P=>{const{action:O,onClick:A}=P;if(O||A)return T=>{const _={editor:u.store.appEditorStore.editor,...T};Ke(O)?(O(_),u.hide()):Ke(A)&&(A(_),u.hide())}};return l.jsx("div",{className:w,ref:g,style:b.popper,...v.popper,children:l.jsx(Hd,{show:!!n,...O5,unmount:!1,children:l.jsx(kn,{padding:!1,className:y,classNameBody:S,children:r.map((P,O)=>f.createElement(ia,{onItemClick:t,...P,key:P.id??O,className:C,classNameLabel:x,action:E(P),onActive:()=>p(P),active:d===P}))})})})}),Rf="gs-cmp-tooltip";function kt({className:e,classNameWrp:t,classNameContent:n,strategy:r,placement:s="bottom",children:o,title:a,onClick:i,inline:c,size:u}){const[d,p]=f.useState(!1),[h,g]=f.useState(!1),m=Ot(u),[b,v]=f.useState(null),[w,y]=f.useState(null),S=Ra(b,w,{...Qf(),placement:s,...r?{strategy:r}:{}});f.useEffect(()=>{var E;d&&((E=S.update)==null||E.call(S))},[d,S.update]),f.useEffect(()=>{const E=setTimeout(()=>p(h),10);return()=>clearTimeout(E)},[h]);const C=M(`${Rf}-target`,!c&&"gs-utl-block",e,!i&&"gs-utl-cursor-auto"),x=M(`${Rf}-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 l.jsxs("div",{className:M(Rf,"gs-utl-relative",t),children:[l.jsx("span",{ref:v,className:C,onMouseEnter:()=>a&&g(!0),onMouseLeave:()=>g(!1),children:l.jsx("div",{className:M(c&&"gs-utl-inline-block"),onClick:()=>{g(!1),i==null||i()},children:o})}),!!h&&l.jsx("div",{className:x,ref:y,style:S.styles.popper,...S.attributes.popper,children:l.jsx(Hd,{show:!!d,unmount:!1,...Dg,children:l.jsx(kn,{className:Fg.txt,bg:Fg.bg,size:"s",border:!1,children:a})})})]})}function ft({children:e,title:t,classNameWrp:n,tooltipProps:r,...s}){return l.jsx(kt,{title:t,classNameWrp:n,...r,children:l.jsx(Ue,{...s,children:e})})}const va="gs-cmp-ai-chat-assets",gI=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},mI=e=>e.mediaType==="application/pdf",rw=({editor:e,assets:t,className:n,onRemove:r,style:s})=>{const o=`${va}__asset-item`,a=M(`${va}__asset-image`,"gs-utl-object-cover",J.rnd,wl.m),i=M(`${va}__asset-pdf`,"gs-utl-overflow-hidden",J.rnd,wl.m),c=M(`${va}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",J.rnd,wl.m,z.bgH2),u=M(`${va}__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,J.pill,z.bgRed,z.hBgRed),d="aiChat.input.assets";if(t.length<=0)return null;const p=(h,g)=>{const m={params:{num:g+1}},b=e.t(`${d}.imageAlt`,m),v=e.t(`${d}.pdfTitle`,m);return gI(h)?l.jsx("img",{src:h.src,alt:b,className:a}):mI(h)?l.jsx("iframe",{src:h.src,title:v,className:i}):l.jsx("div",{className:c,children:l.jsx(Q,{icon:l2,size:oe.l})})};return l.jsx(I,{className:M(va,n),gap:"xs",wrap:"wrap",style:s,children:t.map((h,g)=>l.jsxs("div",{className:M(o,"gs-utl-relative gs-utl-inline-block"),children:[p(h,g),r&&l.jsx(ft,{title:e.t(`${d}.remove`),icon:{icon:W.close,size:oe.s3x},onClick:()=>r(g),size:"x2s",border:!1,className:u})]},h.src))})},tn="gs-cmp-ai-chat-input",bI=e=>{const{className:t,style:n,editor:r,disabled:s,maxAssets:o,currentAssetsCount:a,acceptAssetType:i,onFilesSelected:c,onAssetSelected:u}=e,d=f.useRef(null);if(o<=0)return null;const p=`${tn}__attach-btn`,h=`${tn}__file-input`,g=a>=o,m="aiChat.input.attach",b=r.t(`${m}.upload`),v=r.t(`${m}.selectFromAssets`),w=r.t(`${m}.title`),y=r.t(`${m}.maxAssets`,{params:{count:o}}),S=x=>{const E=Array.from(x.target.files||[]);E.length>0&&c(E),d.current&&(d.current.value="")},C=x=>{if(!r||g)return;const E="btnAttachImages",P=()=>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:P,items:[{id:"upload",label:b,icon:W.trayArrowDown,onClick:()=>{var O;return(O=d.current)==null?void 0:O.click()}},{id:"assets",label:v,icon:v2,onClick:()=>{r.Assets.open({onSelect:({asset:O})=>{const A=O.getSrc();A&&u(A)}})}}]}})};return l.jsxs(l.Fragment,{children:[l.jsx("input",{ref:d,type:"file",accept:i,multiple:!0,onChange:S,className:h,style:{display:"none"}}),l.jsx(ft,{className:M(p,J.pill,t),style:n,title:g?y:w,icon:W.plus,border:!1,onClick:C,disabled:s||g,size:"s",block:!0})]})},vI=({editor:e,className:t,style:n,contextComponents:r,disabled:s})=>{const[o,a]=f.useState(()=>e.getSelectedAll()),i="aiChat.input.context";f.useEffect(()=>{const y=e.Components.events.select,S=()=>a(e.getSelectedAll());return e.on(y,S),()=>{e.off(y,S)}},[e]),f.useEffect(()=>{r.clear(),o.forEach(y=>r.add(y))},[o,r]);const c=()=>a([]);if(o.length===0)return null;const u=`${tn}__context`,d=`${tn}__context-icon`,p=`${tn}__context-badge`,h=`${tn}__context-name`,g=`${tn}__context-divider`,m=o.length===1,b=o[0],v=e.t(`${i}.multiple`,{params:{count:o.length}}),w=m?b.getName():v;return l.jsxs(I,{className:M(u,s&&Ce.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[l.jsx(Q,{icon:W.target,size:oe.sx,className:M(d,z.txtLowEmphasis)}),l.jsx(_s,{className:M(p,Wg(b).bg,Se.xyS2),s:"s",children:l.jsxs(I,{gap:"xs",items:"center",nowrap:!0,children:[m&&bm(b),l.jsx("div",{className:M(h,Ce.txtEllips,"gs-utl-max-w-36"),children:w}),!s&&l.jsxs(l.Fragment,{children:[l.jsx("div",{className:M(g,J.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),l.jsx(ft,{title:e.t(`${i}.clear`),icon:{icon:W.close,size:oe.s3x},onClick:c,size:"x2s",border:!1,block:!0})]})]})})]})};function sw(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function yI(){const[e,t]=f.useState(""),[n,r]=f.useState(!1),[s,o]=f.useState(!1),a=f.useRef();f.useEffect(()=>o(!!sw()),[]);const i=()=>{const u=sw();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>r(!0),d.onend=c,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),c()},a.current=d,d.start()},c=()=>{var u;(u=a.current)==null||u.stop(),r(!1)};return{transcript:e,isSupported:s,isListening:n,start:i,stop:c}}const wI=({editor:e,disabled:t,onTranscript:n,onListeningChange:r,className:s,style:o})=>{const a=`${tn}__dictate`,{transcript:i,isSupported:c,isListening:u,start:d,stop:p}=yI(),h="aiChat.input.dictate",g=e.t(`${h}.start`),m=e.t(`${h}.stop`),b=u?m:g;return f.useEffect(()=>{i&&n(i)},[i]),f.useEffect(()=>{r==null||r(u)},[u]),c?l.jsx(ft,{block:!0,size:"s",border:!1,className:M(a,J.pill,s),style:o,title:b,disabled:t,icon:u?M2:_2,onClick:u?p:d,variant:u?"danger":"out-clear"}):null},SI=({autoResize:e,autoFocus:t,style:n={},...r})=>{const s=f.useRef(null);return f.useEffect(()=>{!s.current||!e||(s.current.style.height="auto",s.current.style.height=s.current.scrollHeight+"px")},[r.value,e]),f.useEffect(()=>{const o=s.current;if(o&&t){const a=setTimeout(()=>o==null?void 0:o.focus(),150);return()=>clearTimeout(a)}},[s.current,t]),l.jsx("textarea",{ref:s,style:{...n,...e?{resize:"none"}:{}},...r})},ow=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},aw=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,CI=({className:e,style:t,chatContext:n,editor:r,maxAssets:s=5,acceptAssetType:o="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:a,layoutBefore:i,layoutAfter:c,onSubmit:u,contextSectionProps:d,textareaProps:p,assetsSectionProps:h,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:b,value:v})=>{const[w,y]=f.useState(v||""),[S,C]=f.useState(""),[x,E]=f.useState(!1),[P,O]=f.useState([]),[A,T]=f.useState(!1),_="aiChat.input",L=r.runCommand(ur.getChatApi),$=r.runCommand(ur.getChatState),{status:D,stop:N,sendMessage:B,setError:q}=n||L,F=D==="streaming"||D==="submitted",k=P.length>0,H=S?aw(w,S):w,V=!A&&(F||H.trim()||k),U={input:H,assets:P},X=be=>{const Je=s-P.length,Qe=be.slice(0,Je);if(Qe.length===0)return;const dt=Qe.map(Te=>({src:URL.createObjectURL(Te),file:Te,mediaType:Te.type}));O(Te=>[...Te,...dt])},Y=be=>{P.length>=s||O(Je=>[...Je,{src:be,mediaType:"image/*"}])},R=be=>{const Je=P[be];Je!=null&&Je.file&&ow([Je.src]),O(Qe=>Qe.filter((dt,Te)=>Te!==be))},ee=async be=>{if(be.preventDefault(),F||A)return;const Je=()=>te();if(u){u({event:be,submit:Je,state:U});return}Je()},te=async()=>{if(F||A)return;const be=H.trim();if(!be&&!k)return;const Je=P.filter(Te=>Te.file).map(Te=>Te.file);let dt=P.filter(Te=>!Te.file).map(Te=>({type:"file",url:Te.src,mediaType:Te.mediaType}));if(Je.length>0){T(!0);try{const it=await async function(Ie){return a?await a({files:Ie}):new Promise((Wt,pe)=>{try{const Le={dataTransfer:{files:Ie}};r.Assets.FileUploader().uploadFile(Le,({data:Ne})=>{Wt(Ne)})}catch(Le){pe(Le)}})}(Je),nt=P.filter(Ie=>Ie.file).map(Ie=>Ie.src);dt=[...dt,...it.map(Ie=>({type:"file",url:Ie.src,mediaType:Ie.mimeType}))],ow(nt)}catch(Te){const it=r.t(`${_}.uploadError`);q(Te instanceof Error?Te:new Error(it)),T(!1);return}finally{T(!1)}}B({text:be,files:dt.length>0?dt:void 0,metadata:{createdAt:Date.now()}}),y(""),O([])},K=be=>{be.key==="Enter"&&!be.shiftKey&&(be.preventDefault(),ee(be))};f.useEffect(()=>{x||y(be=>aw(be,S)),C("")},[x]);const ne=`${tn}__root`,ce=`${tn}__actions`,ge=`${tn}__actions-left`,De=`${tn}__actions-right`,ve=`${tn}__submit-btn`,Ze=M(`${tn}__textarea gs-utl-w-full`,z.bgTr,ps.inputText,Ce.noFocusOut,Ce.noResize),Ge=r.t(`${_}.placeholder`),bt=i==null?void 0:i({state:U}),tt=c==null?void 0:c({state:U});return l.jsxs("form",{onSubmit:ee,className:M(tn,Se.s,J.bt,z.br,e),style:t,children:[bt&&Yt(r,bt),l.jsxs(I,{className:M(ne,J.b,J.rndLg,z.br,z.bg,Se.s,"gs-utl-relative"),col:!0,gap:"s",children:[A&&l.jsx(ro,{abs:!0,full:!0,className:z.bgH25}),l.jsx(vI,{editor:r,disabled:F,contextComponents:$.contextComponents,...d}),l.jsx(SI,{value:H,name:"prompt",onChange:be=>y(be.target.value),onKeyDown:K,placeholder:Ge,readOnly:x,disabled:F,className:Ze,style:{minHeight:40,maxHeight:100},autoResize:!0,...p}),l.jsx(rw,{editor:r,assets:P,onRemove:R,...h}),l.jsxs(I,{className:ce,justify:"between",items:"center",gap:"s",full:!0,children:[l.jsx(I,{className:ge,gap:"s",items:"center",children:l.jsx(bI,{editor:r,disabled:F,maxAssets:s,currentAssetsCount:P.length,acceptAssetType:o,onFilesSelected:X,onAssetSelected:Y,...g})}),l.jsxs(I,{className:De,gap:"s",items:"center",children:[l.jsx(wI,{editor:r,disabled:F,onTranscript:C,onListeningChange:E,...m}),l.jsx(Ue,{className:M(ve,J.pill),size:"s",type:F?"button":"submit",onClick:F?N:void 0,icon:F?W.stop:W.arrowUp,variant:F?"out-clear":"pr",disabled:!V,disabledClassName:Ce.disabledM,...b})]})]})]}),tt&&Yt(r,tt)]})},xI="gs-cmp-ai-chat-loading-state",EI=({className:e,chatContext:t,editor:n,...r})=>l.jsx(I,{className:M(xI,e),items:"center",justify:"center",full:!0,col:!0,...r,children:l.jsx(ro,{})}),PI="file-refs",iw="gs-cmp-ai-chat-markdown",ut=`${iw}__el`,TI={ul:({children:e})=>l.jsx("ul",{className:`${ut}-ul ${At.ul}`,children:e}),ol:({children:e})=>l.jsx("ol",{className:`${ut}-ol ${At.ol}`,children:e}),li:({children:e})=>l.jsx("li",{className:`${ut}-li`,children:e}),p:({children:e})=>l.jsx("p",{className:`${ut}-p`,children:e}),h1:({children:e})=>l.jsx("h1",{className:`${ut}-h1 ${At.h1}`,children:e}),h2:({children:e})=>l.jsx("h2",{className:`${ut}-h2 ${At.h2}`,children:e}),h3:({children:e})=>l.jsx("h3",{className:`${ut}-h3 ${At.h3}`,children:e}),h4:({children:e})=>l.jsx("h4",{className:`${ut}-h4 ${At.h4}`,children:e}),h5:({children:e})=>l.jsx("h5",{className:`${ut}-h5 ${At.h5}`,children:e}),h6:({children:e})=>l.jsx("h6",{className:`${ut}-h6 ${At.h6}`,children:e}),a:({href:e,children:t})=>l.jsx("a",{href:e,className:`${ut}-a ${ps.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?l.jsx("code",{className:`${ut}-code-inline ${At.codeInline}`,children:e}):l.jsx("code",{className:`${ut}-code-block ${t||""}`,children:e}),pre:({children:e})=>l.jsx("pre",{className:`${ut}-pre ${At.pre}`,children:e}),blockquote:({children:e})=>l.jsx("blockquote",{className:`${ut}-blockquote ${At.blockquote} ${z.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>l.jsx("hr",{className:`${ut}-hr ${At.hr} ${z.br}`}),strong:({children:e})=>l.jsx("strong",{className:`${ut}-strong ${At.strong}`,children:e}),em:({children:e})=>l.jsx("em",{className:`${ut}-em ${At.em}`,children:e}),del:({children:e})=>l.jsx("del",{className:`${ut}-del gs-utl-line-through`,children:e}),table:({children:e})=>l.jsx("table",{className:`${ut}-table ${At.table}`,children:e}),thead:({children:e})=>l.jsx("thead",{className:`${ut}-thead ${At.thead}`,children:e}),tbody:({children:e})=>l.jsx("tbody",{className:`${ut}-tbody`,children:e}),tr:({children:e})=>l.jsx("tr",{className:`${ut}-tr ${At.tr}`,children:e}),th:({children:e})=>l.jsx("th",{className:`${ut}-th ${At.th}`,children:e}),td:({children:e})=>l.jsx("td",{className:`${ut}-td ${At.td}`,children:e}),input:({checked:e,disabled:t})=>l.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${ut}-checkbox gs-utl-mr-2`,readOnly:!0}),[PI]:({children:e})=>l.jsx("img-refs",{style:{display:"none"},children:e})};function OI(e){return mw.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const AI=f.memo(function({content:t}){return l.jsx(bw,{components:TI,remarkPlugins:[vw],children:t})},(e,t)=>e.content===t.content),lw=f.memo(function({content:t,id:n,className:r}){const s=f.useMemo(()=>OI(t),[t]);return l.jsx("div",{className:`${iw} ${r||""}`,children:s.map((o,a)=>l.jsx(AI,{content:o},`${n}-block_${a}`))})});function cw(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function _I(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const eh="gs-cmp-ai-chat-message",Zi="aiChat.message",MI=f.memo(function({className:t,style:n,message:r,isStreaming:s,editor:o,chatContext:a,layoutBeforeMessage:i,layoutAfterMessage:c,layoutPart:u,layoutPartToolLabel:d,layoutPartToolDetail:p,layoutPartToolResult:h}){const g=r.parts||[],m=g.filter(En.isFileUIPart),b=g.filter(O=>!En.isFileUIPart(O)),v=m.map(O=>({src:O.url,mediaType:O.mediaType??"image/*"})),w=b.length-1,y=r.role==="user",S=M(eh,`${eh}--${r.role}`,t),C=M(`${eh}__content gs-utl-break-words`,y?M(z.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Se.xyS,J.rnd):"gs-utl-w-full"),x={editor:o,chatContext:a,message:r},E=i==null?void 0:i(x),P=c==null?void 0:c(x);return l.jsxs(I,{col:!0,gap:"s",className:S,style:n,children:[E&&Yt(o,E),l.jsxs(I,{gap:"s",className:M(C,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((O,A)=>l.jsx(LI,{part:O,messageId:r.id,partIndex:A,isStreamingPart:A===w&&s,layoutPart:u,layoutPartToolLabel:d,layoutPartToolDetail:p,layoutPartToolResult:h,layoutProps:x},`${r.id}-part-${A}`)),l.jsx(rw,{editor:o,assets:v,className:"gs-utl-justify-end"})]}),P&&Yt(o,P)]})}),ts="gs-cmp-ai-chat-message-part",LI=f.memo(function({part:t,messageId:n,partIndex:r,isStreamingPart:s,layoutPart:o,layoutPartToolLabel:a,layoutPartToolDetail:i,layoutPartToolResult:c,layoutProps:u}){var d;if(o){const p=o({...u,part:t,partIndex:r});if(p)return Yt(u.editor,p)}if(En.isReasoningUIPart(t)){const{text:p,state:h}=t,g=p==null?void 0:p.trim(),m=s&&h==="streaming",b=`${ts} ${ts}__reasoning`,v=u.editor.t(`${Zi}.reasoning`);return!!g&&l.jsx(Qr,{className:M(b,z.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:l.jsxs(I,{className:M(`${b}-label`,rn.semibold),items:"center",gap:"s",children:[m?l.jsx(ro,{size:"xs",currentColor:!0}):l.jsx(Sa,{path:C2,size:oe.s2x}),l.jsx("div",{children:v})]}),children:l.jsx("div",{className:M(`${b}-text`,z.txtLowEmphasis,Mn.xs,rn.italic),children:l.jsx(lw,{id:`${n}-${r}`,content:g})})})}if(En.isTextUIPart(t)){const p=t.text;if(!p)return null;const h=`${ts} ${ts}__text`;return l.jsx(lw,{content:p,id:`${n}-${r}`,className:h})}if(En.isToolUIPart(t)){const{type:p,toolCallId:h,input:g="",output:m="",errorText:b}=t,v=p.replace("tool-","").replace("dynamic-",""),w=typeof g=="string"?g:JSON.stringify(g),y=typeof m=="string"?m:JSON.stringify(m),S=typeof t.state=="string"?t.state:void 0,C=S==="output-available",x=s&&(S==="input-streaming"||S==="input-available"),E=`${ts}__tool`,P=`${ts}__tool-result`,O=`${E}-detail`,A=M(O,"gs-utl-max-w-full"),T="gs-utl-max-w-full gs-utl-whitespace-normal",_=M(`${O}-info gs-utl-max-h-24 gs-utl-overflow-auto`,T,z.txtLowEmphasis,Mn.xs),L=M(`${ts}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,T,z.txtLowEmphasis,Mn.xs),$=`${E}-section-label`,D=w&&w!=="{}",N=y&&y!=="{}",B=!!b,q=D||N||B,F=u.editor.t(`${Zi}.tool.input`),k=u.editor.t(`${Zi}.tool.output`),H=u.editor.t(`${Zi}.tool.error`),U=u.editor.runCommand(ur.getChatManager).tools[v],X={...u,part:t,partIndex:r,toolName:v},Y=a==null?void 0:a(X),R=i==null?void 0:i(X),ee=(c==null?void 0:c(X))||((d=U==null?void 0:U.layoutToolResult)==null?void 0:d.call(U,X)),te=Y?Yt(u.editor,Y):v,K=ee?Yt(u.editor,ee):null,ne=R?Yt(u.editor,R):l.jsxs(I,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[D&&l.jsxs(I,{className:M(A,`${O}--input`),gap:"xs",col:!0,nowrap:!0,children:[l.jsx("div",{className:$,children:F}),l.jsx("pre",{className:_,children:w})]}),N&&l.jsxs(I,{className:M(A,`${O}--output`),gap:"xs",col:!0,nowrap:!0,children:[l.jsx("div",{className:$,children:k}),l.jsx("pre",{className:_,children:y})]}),B&&l.jsxs(I,{className:M(A,`${O}--error`),gap:"xs",col:!0,nowrap:!0,children:[l.jsx("div",{className:$,children:H}),l.jsx("pre",{className:_,children:b})]})]});return l.jsxs(I,{className:M(`${ts} ${E}`,z.bgH2,J.rnd,Se.xyS),gap:"xs",col:!0,nowrap:!0,children:[l.jsx(Qr,{disabled:!q&&!R,handler:l.jsxs(I,{className:M(`${E}-label`),items:"center",gap:"s",children:[l.jsx("div",{className:`${E}-status`,children:C?l.jsx(Sa,{className:`${E}-status-success`,path:wh,size:oe.s2x}):x?l.jsx(ro,{className:`${E}-status-processing`,size:"xs",currentColor:!0}):l.jsx(Sa,{className:`${E}-status-error`,path:Sh,size:oe.s2x})}),l.jsx("div",{className:M(`${E}-name`),children:te})]}),children:ne}),l.jsx(NI,{toolCallId:h,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:s,className:L}),!!K&&l.jsx("div",{className:P,children:K})]})}if(cw(t)||_I(t)){const p=`${ts}__source`,g=cw(t)?t.url:void 0,m=t.title,b=u.editor.t(`${Zi}.source.document`),v=m||g||b,w=g?new URL(g).hostname:"",y=l.jsxs(l.Fragment,{children:[l.jsxs("div",{className:M(`${p}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[l.jsx("div",{className:M(`${p}-title`,rn.semibold,Mn.sm,"gs-utl-truncate"),children:v}),w&&l.jsx("div",{className:M(`${p}-url`,z.txtLowEmphasis,Mn.xs,"gs-utl-truncate"),children:w})]}),g&&l.jsx(Sa,{className:M(`${p}-icon`,z.txtLowEmphasis),path:Ch,size:oe.s2x})]}),S=M(p,z.bgH2,J.rnd,Se.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",g&&Ce.hoverM);return g?l.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:S,children:y}):l.jsx("div",{className:S,children:y})}return null}),NI=f.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:r,className:s}){const[o,a]=f.useState(""),i=f.useRef(null);return f.useEffect(()=>{if(!r||!t){a("");return}const c=n.get(t);c!=null&&c.content&&a(c.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]),f.useEffect(()=>{i.current&&o&&(i.current.scrollTop=i.current.scrollHeight)},[o]),!o||!r?null:l.jsx("pre",{ref:i,className:s,children:o})}),$I="gs-cmp-ai-chat-messages-status",kI=({className:e,chatContext:t,style:n})=>{const{status:r}=t,s=r==="streaming"||r==="submitted",o=M(z.bgA,Ce.dot,Ce.bounce);return s?l.jsxs(I,{items:"center",gap:"xs",className:M($I,e),style:n,children:[l.jsx("div",{className:o}),l.jsx("div",{className:o,style:{animationDelay:"0.15s"}}),l.jsx("div",{className:o,style:{animationDelay:"0.3s"}})]}):null},II="gs-cmp-ai-chat-messages";function VI({editor:e,chatContext:t,messages:n,pluginOptions:r}){const s=f.useRef(null),{status:o}=t,a=o==="streaming"||o==="submitted",i=M(II,Se.s,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-y-auto gs-utl-overflow-x-hidden");return f.useEffect(()=>{var c;(c=s.current)==null||c.scrollIntoView({behavior:"smooth"})},[n]),l.jsxs(I,{className:i,gap:"s",col:!0,nowrap:!0,children:[n.length===0?Yt(e,{type:"aiChatEmptyState",chatContext:t},r):n.map((c,u)=>l.jsx(f.Fragment,{children:Yt(e,{type:"aiChatMessage",chatContext:t,message:c,isStreaming:a&&u===n.length-1},r)},c.id)),Yt(e,{type:"aiChatMessagesStatus",chatContext:t},r),l.jsx("div",{ref:s})]})}const uw=f.createContext(void 0),HI=({chatManager:e,children:t})=>{const n=e.currentChatState,r=f.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return l.jsx(uw.Provider,{value:r,children:t})},jI=()=>f.useContext(uw),DI="gs-cmp-ai-chat-panel";function FI({editor:e,pluginOptions:t,style:n,className:r}){const{chatState:s}=jI(),[,o]=f.useState(0),[a,i]=f.useState(),{toolAbortControllers:c,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:p}=s;f.useEffect(()=>s.onUpdate(()=>o(E=>++E)),[]);const h=Kt.useChat({chat:s.chat}),{messages:g,sendMessage:m,status:b,setMessages:v,error:w}=h,y=w||a,S=f.useMemo(()=>({id:h.id,messages:g,setMessages:v,sendMessage:m,status:b,stop:()=>(c.forEach(x=>x.abort()),c.clear(),h.stop()),addToolApprovalResponse:h.addToolApprovalResponse,addToolOutput:h.addToolOutput,error:y,setError:x=>i(typeof x=="string"?new Error(x):x),clearError:()=>{h.clearError(),i(void 0)},toolStatusProgress:u,contextComponents:d}),[e,b,g,y]),C=M(DI,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 l.jsx(I,{className:C,style:n,col:!0,nowrap:!0,children:p?l.jsxs(l.Fragment,{children:[Yt(e,{type:"aiChatHeader",chatContext:S},t),l.jsx(VI,{editor:e,chatContext:S,messages:g,pluginOptions:t}),S.error&&Yt(e,{type:"aiChatError",chatContext:S},t),Yt(e,{type:"aiChatInput",chatContext:S},t)]}):Yt(e,{type:"aiChatLoadingState",chatContext:S},t)})}const BI=(e,t,n)=>(e.runCommand(re.layoutComponentAdd,{type:"aiChatPanel",component:r=>({type:"custom",noWrapper:!0,component:()=>l.jsx(HI,{chatManager:n,children:l.jsx(FI,{...r,editor:e,pluginOptions:t})})})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatHeader",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:$5})}),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:EI})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatInput",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:CI})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatEmptyState",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:L5})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatMessage",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:MI})}),e.runCommand(re.layoutComponentAdd,{type:"aiChatMessagesStatus",component:r=>({type:"custom",noWrapper:!0,componentProps:r,component:kI})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(r=>{e.runCommand(re.layoutComponentRemove,{type:r})})}),zI={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",tool:{input:"Input",output:"Output",error:"Error"},source:{document:"Document"}}}},UI="aiChat",WI=Mo.startup;return Uw(function(e,t={}){t.getAccessToken&&(Ft.getAccessToken=t.getAccessToken),dh();const n=new mS(e,t),{Commands:r}=e;r.add(ur.getChatManager,()=>n),r.add(ur.getChatState,()=>n.currentChatState),r.add(ur.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:zI});const s=BI(e,t,n),o=()=>{delete r.commands[ur.getChatManager],delete r.commands[ur.getChatState],delete r.commands[ur.getChatApi],s(),qw()};Ww({editor:e,licenseKey:t.licenseKey,plan:WI,pluginName:UI,onLicenseCheckResponse:a=>{a?Ft.license=a:Ft.license=void 0},cleanup:o})})});
|
|
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})})});
|