@grapesjs/studio-sdk-plugins 1.0.33 → 1.0.35-rc.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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 +83 -148
- package/dist/aiChat/index.es.js +14470 -13788
- package/dist/aiChat/index.js +83 -148
- package/dist/aiChat/index.umd.js +83 -148
- 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.cjs.js
CHANGED
|
@@ -1,70 +1,10 @@
|
|
|
1
|
-
"use strict";const Q1=require("@ai-sdk/react"),Ar=require("ai"),c=require("react/jsx-runtime"),h=require("react"),Dn=require("react-dom"),nw=require("react-dom/client"),sw=require("marked"),rw=require("react-markdown"),ow=require("remark-gfm");function eb(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const et=eb(h),iw=eb(Dn),tb="app.grapesjs.com",nb="app-stage.grapesjs.com",aw="app2.grapesjs.com",lw="app-stage2.grapesjs.com",Ph=[tb,aw,nb,lw,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],sb="license:check:start",Id="license:check:end",Vs=()=>typeof window<"u",bo=e=>e&&e.stopPropagation(),cw=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),uw=(e,t)=>{const n=s=>s.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},dw=(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)},fw=e=>uw("Escape",e),pw=(e,t={})=>{const n=ot(e)?{id:e,src:e}:e;return new Promise((s,r)=>{var p,g;const{loadedScripts:o}=t,{id:i,src:a}=n,l=document.querySelector(`script[src="${a}"]`);if(l){if((p=t.onScript)==null||p.call(t,l),o&&!o.get(a)){l.addEventListener("load",()=>s(i)),l.addEventListener("error",()=>r(i));return}return s(i)}const u=window.define;window.define=void 0;const d=()=>{o==null||o.set(a,!0),window.define=u},f=document.createElement("script");f.src=a,f.onload=()=>{s(i),d()},f.onerror=()=>{r(i),d()},document.head.appendChild(f),(g=t.onScript)==null||g.call(t,f)})},hw=e=>{const t=e.map(n=>pw(n));return Promise.allSettled(t)};function gw(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 _h(e){const t=s=>{var r;if(s.length){const o=s.shift(),i=gw(o);i.onerror=i.onload=t.bind(null,s),(r=o.parentNode)==null||r.replaceChild(i,o)}},n=Array.from(e.querySelectorAll("script"));t(n)}const rb=e=>new DOMParser().parseFromString(e,"text/html"),mw=(e="")=>rb(`<body>${e}</body>`).body.innerHTML,bw=(e="")=>rb(`<head>${e}</head>`).head.innerHTML,vw=(e="",t)=>{const s=new DOMParser().parseFromString(e,"text/html");if(t){const o=s.querySelectorAll("svg")[0].style||{},i=jw(t)?`${t}px`:t;o.width=i,o.height=i,o.fill="currentColor"}return new XMLSerializer().serializeToString(s)},Hf=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?nb:tb}`}/${n?"platform-api":"api"}`,yw=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},ob=(e={})=>{const{width:t=300,height:n,text:s="IMAGE",bg:r="777",fg:o="white"}=e,i=n?`x${n}`:"";return`https://placehold.co/${t}${i}/${r}/${o}.png?text=${s}`},xw=ob(),Ff=()=>{const e=Vs()&&window.location.hostname;return!!e&&(Ph.includes(e)||Ph.some(t=>e.endsWith(t)))},Ts=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),ww=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),Sw=()=>{},Cw=240,Lt=e=>typeof e<"u",ot=e=>typeof e=="string",jw=e=>typeof e=="number";function Ye(e){return typeof e=="function"}function ur(e){return e&&!Array.isArray(e)&&typeof e=="object"}const Ew=e=>!e||Object.keys(e).length===0,ni=(e,t)=>{const n=(e||"").toLocaleLowerCase(),s=(t||"").toLocaleLowerCase();return n.includes(s)},Pw=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},_w=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=n.length;for(let r=0;r<e;r++)t+=n.charAt(Math.floor(Math.random()*s));return t},Tw=e=>!!e.Components.getType("mjml"),Ac=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),Ow=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(o,i)=>{const a=i.trim();return!a||!n.has(a)?"":`__var__${a}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(o,i)=>`{{ ${i} }}`)};async function Aw({path:e,baseApiUrl:t,method:n="GET",headers:s={},params:r,body:o}){const a=`${t||Hf({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...s}};o&&(l.body=JSON.stringify(o));const u=r?new URLSearchParams(r).toString():"",d=u?`?${u}`:"",f=await fetch(`${a}${d}`,l);if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}var Ko=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(Ko||{}),nn=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(nn||{}),ie=(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))(ie||{}),Tn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(Tn||{}),Nr=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(Nr||{}),yt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(yt||{});const Th={[Ko.free]:0,[Ko.startup]:10,[Ko.business]:20,[Ko.enterprise]:30};function Nw(e){const t=e;return t.init=n=>s=>e(s,n),t}const Mw=e=>Nw(e);async function Lw({editor:e,plan:t,pluginName:n,licenseKey:s,onLicenseCheckResponse:r,cleanup:o}){let i="",a=!1;const l=Ff(),u=f=>{console.warn("Cleanup plugin:",n,"Reason:",f),o()},d=(f={})=>{var v;const{error:p,sdkLicense:g}=f,m=(v=f.plan)==null?void 0:v.category;if(!(g||f.license)||p)u(p||"Invalid license");else if(m){const x=Th[t],y=Th[m];x>y&&u({pluginRequiredPlan:t,licensePlan:m})}};e.on(sb,f=>{i=f==null?void 0:f.baseApiUrl,a=!0}),e.on(Id,f=>{r==null||r(f),d(f)}),setTimeout(async()=>{if(!a){if(l)return;if(s){const f=await Rw({licenseKey:s,pluginName:n,baseApiUrl:i});r==null||r(f),f&&d(f)}else u("The `licenseKey` option not provided")}},2e3)}async function Rw(e){const{licenseKey:t,pluginName:n,baseApiUrl:s}=e;try{return(await Aw({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}const Kt={accessToken:""},$w=()=>{Kt.timeout&&(clearTimeout(Kt.timeout),Kt.timeout=void 0),Kt.accessToken="",Kt.license=void 0},ib=async()=>{var t;let e={accessToken:""};try{const n=await((t=Kt.getAccessToken)==null?void 0:t.call(Kt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Kt.getAccessToken&&console.error("Failed to get access token");return}if(Kt.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Kt.timeout||void 0),Kt.timeout=setTimeout(ib,n-Date.now()-1)}},ab=e=>{var t;return((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},kw=e=>ab(e)==="email",Yo=(e,t={})=>{var p;const{selectedComponents:n=[],withPageContent:s=!1,imageUrls:r=[]}=t,o=e.Pages.getSelected(),i=e.getSelected(),a=ab(e),l=Iw(e),u=l.length<=1&&((p=e.getWrapper())==null?void 0:p.components().length)===0,d=o?{id:o.getId(),name:o.getName(),content:s?zw(e):void 0}:void 0,f=i?{id:i.getId(),content:i.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:f,selectedComponents:n.map(g=>({id:g.getId(),content:""})),projectType:a,availablePages:l,globalStyles:Vw(e),installedPlugins:Dw(e),devices:Bw(e),isEmail:a==="email",imageUrls:r}},sn=(e,t,n)=>{const{layoutComponents:s}=n||{},r=t,o=r.type,i=o?s==null?void 0:s[o]:void 0,a=i?{...r,...i({editor:e,props:t})}:t;return e.runCommand(ie.layoutComponentRender,{components:a})};function Vw(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
|
|
2
|
-
`)}const Iw=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),Dw=e=>{const t=Fw(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},Hw=e=>e.getModel().get("customData")??{},Fw=e=>e&&Hw(e).plugins||[];function Bw(e){return e.Devices.getAll().map(t=>t.toJSON())}function Ta(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const uo=(e="",t,n={})=>{!t||!e||(t.innerHTML=Ta(e),!n.skipScroll&&(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var s;return(s=t==null?void 0:t.lastElementChild)==null?void 0:s.scrollIntoView({block:"nearest"})})))},lb=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function fo(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function po(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}const il=e=>{var o;const{error:t,abortMsg:n,msg:s}=e,r=t.name==="AbortError"||((o=t.message)==null?void 0:o.includes("abort"));return r||console.error(t),{error:r?n:s,abortedByUser:r?!0:void 0}};function zw(e){const t=e.getWrapper(),n=lb(t);return`<style>${e.getCss()||""}</style>${n}`}const cb=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],s=new Map,r=document.createElement("div");r.setAttribute("data-temp-els","true");const o=(i,a)=>{try{a.innerHTML=i.innerHTML,Array.from(i.attributes).forEach(l=>a.setAttribute(l.name,l.value))}catch{}};return{cleanup(){r==null||r.remove()},update:i=>{var p;const a=new DOMParser,l=Ta(i),u=a.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(r),d.forEach(g=>{var b,v;let m=g.id;if(m){const x=s.get(m),y=t.getById(m),w=y==null?void 0:y.getEl();w&&(o(g,w),!x&&requestAnimationFrame(()=>w==null?void 0:w.scrollIntoView({block:"nearest"}))),s.set(m,{cmp:y,cmpEl:w,newNode:g})}else if(n.includes(g.tagName)){m=[((b=g.tagName)==null?void 0:b.toLowerCase())||"",...Array.from(g.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const x=(v=s.get(m))==null?void 0:v.newNode;x?o(g,x):(r.appendChild(g),s.set(m,{newNode:g}))}}),s}}},ub=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:s,Css:r}=n,{html:o,css:i}=s.parseHtml(t,{returnArray:!0}),a=o[0];e.getId()===((u=a==null?void 0:a.attributes)==null?void 0:u.id)?(e.components().reset(a.components),e.addAttributes({...a==null?void 0:a.attributes,class:(d=a==null?void 0:a.classes)==null?void 0:d.join(" ")}),i&&r.addCollection(i,{extend:!0})):e.components(t)};var es=(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))(es||{}),Xs=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(Xs||{}),Ss=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(Ss||{});function db(e,t){var g;const{componentId:n,position:s}=t;fo(e);const r=document.createElement("div");r.style.display="contents";const{Components:o}=e;let a=o.getById(n)||e.getSelected(),l=a==null?void 0:a.parent();const u=a==null?void 0:a.index(),d=a==null?void 0:a.getEl();let f="afterend",p;switch(s){case"before":f="beforebegin",a=l,p=u;break;case"beforeInside":f="afterbegin",p=0;break;case"afterInside":f="beforeend";break;case"after":f="afterend",a=l,p=(u??0)+1;break}return a||(a=e.getWrapper(),l=a,p=void 0),d?d==null||d.insertAdjacentElement(f,r):(g=l==null?void 0:l.getEl())==null||g.appendChild(r),{target:a,at:p,domPosition:f,tempTargetEl:d,tempDOM:r,cleanUp(){r==null||r.remove(),po(e)}}}function fb(e,t,n){const{target:s,at:r}=t,o=s==null?void 0:s.append(n,{at:r})[0];return o&&e.select(o),o}function Uw(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:Xs.ADD_COMPONENT_CODE,toolSetup:db(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,uo(r.content,a.toolSetup.tempDOM,{skipScroll:!0}));return}if(i==="done"&&a&&r.content){if(a.completed)return;fb(t,a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function Ww(e){fo(e);const t=cb(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),po(e)}}}function Gw(e,t){const n=e.getWrapper();t.mapUpdates.forEach(s=>{const{cmp:r,newNode:o}=s,{outerHTML:i}=o;r?ub(r,i):n==null||n.append(i)})}function qw(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:Xs.EDIT_COMPONENT_CODE,toolSetup:Ww(t),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content));return}if(i==="done"&&a&&r.content){if(a.completed)return;a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content),Gw(t,a.toolSetup),a.completed=!0,l()}if(i==="error"){l();return}}function Kw(e,t){const{name:n}=t,{Pages:s,Components:r}=e;fo(e);const o=s.add({name:n,component:"<h1></h1>"},{select:!0}),i=o.getMainComponent();return i.once(r.events.render,()=>{const a=i.getEl();a&&uo(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
|
|
3
|
-
Generating ${n?`"${n}" `:""}page...
|
|
4
|
-
</h1>`,a,{skipScroll:!0})}),{pageId:o.getId(),cmpRoot:i,cleanUp(){po(e)}}}function Yw(e,t){const{cmpRoot:n}=e;n.components(t)}function Zw(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){if(a||(a={type:Xs.ADD_PAGE_CODE,toolSetup:Kw(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content){a.content=r.content;const u=a.toolSetup.cmpRoot.getEl();u&&uo(r.content,u,{skipScroll:!0})}return}if(i==="done"&&a&&r.content){if(a.completed)return;Yw(a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function Xw(e){fo(e);const t=e.getWrapper(),n=Yo(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){po(e)}}}function Jw(e,t,n){var r;const{Pages:s}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(r=s.getSelected())==null||r.setName(n)}const pb="mjml-code-to-html";function Qw(e){var u;const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){if(a||(a={type:Xs.ADD_PROJECT_PAGE_CODE,toolSetup:Xw(t),content:""},s.set(o,a)),i==="streaming"&&r.content){a.content=r.content;const{isEmail:d,cmpRoot:f}=a.toolSetup,p=f.getEl();let g=r.content;if(d){const m=Ta(g);try{const b=(u=t.runCommand(pb,{mjml:m}))==null?void 0:u.html;b&&(g=b)}catch{}}p&&uo(g,p,{skipScroll:!0})}return}if(i==="done"&&a&&r.content){if(a.completed)return;Jw(t,r.content,r.input.name),a.completed=!0,l()}if(i==="error"){l();return}}const hb={[Xs.ADD_COMPONENT_CODE]:Uw,[Xs.EDIT_COMPONENT_CODE]:qw,[Xs.ADD_PAGE_CODE]:Zw,[Xs.ADD_PROJECT_PAGE_CODE]:Qw},eS=({editor:e,data:t,toolStatusProgress:n})=>{var i;if(t.type!=="data-tool-status")return;const s=t,r=((i=s.data)==null?void 0:i.name)||"",o=hb[r];o?o({editor:e,toolStatus:s,toolStatusProgress:n}):tS({toolStatus:s,toolStatusProgress:n})};function tS({toolStatus:e,toolStatusProgress:t}){const{id:n,data:s}=e;if(!n||!s)return;const{status:r,content:o}=s;let i=t.get(n);i||(i={type:"generic",content:"",completed:!1},t.set(n,i)),r==="streaming"&&o&&(i.content=o),r==="done"&&(o&&(i.content=o),t.delete(n)),r==="error"&&t.delete(n)}const nS={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 al(e,t,n={}){var u;const{onContent:s,abortController:r}=n,o=await fetch(e,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t),signal:r==null?void 0:r.signal});if(!o.ok)throw new Error(`Failed to fetch: ${o.statusText}`);const i=(u=o.body)==null?void 0:u.getReader();if(!i)throw new Error("No reader available");const a=new TextDecoder;let l="";for(;;){if(r!=null&&r.signal.aborted){i.cancel();break}const{done:d,value:f}=await i.read();if(d)break;const p=a.decode(f);l+=p,s==null||s(l)}return Ta(l)}function Eu({lastUserMessage:e}){return(e==null?void 0:e.parts.filter(t=>Ar.isTextUIPart(t)).map(t=>t.text).join(""))||""}function sS(e,t={}){const n={...nS,...t},s={async execute(g,m){const{plan:b,name:v,imageUrls:x}=g,y=Eu(m);let w;try{w=db(e,g);const{tempDOM:S}=w,C=await al(n.addComponent,{userPrompt:`${y}
|
|
5
|
-
${b?`
|
|
6
|
-
Plan: ${b}`:""}
|
|
7
|
-
${v?`
|
|
8
|
-
Component Name: ${v}`:""}
|
|
9
|
-
`.trim(),id:"",imageUrls:x,messages:[],trigger:m.toolCallId,projectContext:Yo(e,{imageUrls:x,withPageContent:!0})},{onContent:E=>uo(E,S,{skipScroll:!0}),abortController:m.abortController});if(!C)throw new Error("Failed to generate component content");const j=fb(e,w,C);return{newComponentId:j==null?void 0:j.getId(),newComponentName:v}}catch(S){return il({error:S,msg:"Failed to add component",abortMsg:"Cancelled adding component"})}finally{w==null||w.cleanUp()}}},r={async execute(g,m){const{plan:b,imageUrls:v}=g,x=e.getWrapper(),y=cb(e);let w=new Map;try{if(fo(e),await al(n.editComponent,{userPrompt:b,projectContext:Yo(e,{imageUrls:v,withPageContent:!0}),imageUrls:v,id:"",messages:[],trigger:m.toolCallId},{abortController:m.abortController,onContent:S=>{w=y.update(S)}}),!w.size)throw new Error("Failed to generate component content");return w.forEach(S=>{const{cmp:C,newNode:j}=S,{outerHTML:E}=j;C?ub(C,E):x==null||x.append(E)}),{success:!0}}catch(S){return il({error:S,msg:"Failed to edit component",abortMsg:"Cancelled editing component"})}finally{y.cleanup(),po(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}'`}}},i={async execute(g){const{sourceId:m,targetId:b,targetIndex:v}=g,x=e.Components.getById(m),y=e.Components.getById(b);return x?y?(y.append(x,{at:v}),e.select(x,{scroll:!0}),{success:!0}):{success:!1,error:`Target component not found with ID '${b}'`}:{success:!1,error:`Source component not found with ID '${m}'`}}},a={async execute(g,m){const{name:b,plan:v,imageUrls:x}=g,{Pages:y,Components:w}=e;try{fo(e);const S=Eu(m),C=y.add({name:b,component:"<h1></h1>"},{select:!0}),j=C.getMainComponent(),E=T=>{const P=j.getEl();uo(T,P,{skipScroll:!0})};j.once(w.events.render,()=>{E(`<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 _=await al(n.addPage,{userPrompt:`${S}
|
|
12
|
-
${v?`
|
|
13
|
-
Plan: ${v}`:""}
|
|
14
|
-
`.trim(),id:"",imageUrls:x,messages:[],trigger:m.toolCallId,projectContext:Yo(e,{imageUrls:x,withPageContent:!0})},{onContent:E,abortController:m.abortController});if(!_)throw new Error("Failed to generate page content");return j.components(_),{success:!0,data:{pageId:C.getId(),pageName:b}}}catch(S){return il({error:S,msg:"Failed to create page",abortMsg:"Cancelled creating page"})}finally{po(e)}}},l={async execute(g){const{pageId:m}=g,b=e.Pages.get(m),v=b==null?void 0:b.getMainComponent();return v?{content:lb(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 x=await v.json();return e.Pages.add({name:b,component:x.html},{select:!0}),{success:!0,data:{pageName:b,subPages:x.subPages||[]}}}},f={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}}},p={async execute(g,m){var S;const{name:b,plan:v,imageUrls:x}=g,y=Yo(e,{imageUrls:x,withPageContent:!0}),{isEmail:w}=y;fo(e);try{const{Pages:C}=e,j=e.getWrapper(),E=Eu(m),_=P=>{var M;let A="";if(w){const R=Ta(P);try{const F=(M=e.runCommand(pb,{mjml:R}))==null?void 0:M.html;F&&(A=F)}catch{}}else A=P;uo(A,j.getEl(),{skipScroll:!0})},T=await al(n.generateProject,{userPrompt:`${E}${v?`
|
|
15
|
-
Plan: ${v}`:""}`,projectContext:y,imageUrls:x,id:"",messages:[],trigger:m.toolCallId},{abortController:m.abortController,onContent:_});return e.loadProjectData({pages:[{name:b,component:T}]}),(S=C.getSelected())==null||S.setName(b),{success:!0,data:{pageName:b}}}catch(C){return il({error:C,msg:"Failed to create a project page",abortMsg:"Cancelled creating project page"})}finally{po(e)}}};return{[es.ADD_NEW_COMPONENT]:s,[es.EDIT_COMPONENT]:r,[es.REMOVE_COMPONENT]:o,[es.MOVE_COMPONENT]:i,[es.ADD_NEW_PAGE]:a,[es.GET_PAGE_CONTENT]:l,[es.LIST_PAGES]:u,[es.FETCH_WEBSITE]:d,[es.SHOW_PANEL]:f,[es.ADD_NEW_PROJECT_PAGE]:p}}var rS={};class oS{constructor(t,n){var o;this.chatStates=new Map,this.editor=t,this.options=n;const s=sS(t);this.tools=((o=n.tools)==null?void 0:o.call(n,{defaultTools:s,editor:t}))||s;const{chat:r}=this.createChat();this.currentChatId=r.id}get currentChatState(){return this.chatStates.get(this.currentChatId)}getChat(t){return this.chatStates.get(t)}setCurrentChat(t){this.chatStates.get(t)&&(this.currentChatId=t)}removeChat(t){if(this.chatStates.delete(t),this.currentChatId===t){const n=this.chatStates.keys().next().value;if(n)this.currentChatId=n;else{const s=this.createChat();this.currentChatId=s.chat.id}}}createChat(t){const n=this.editor,s=new Map,r=new Set,o=new Set,{chatApi:i,onTool:a,body:l,defaultTransportOptions:u={},chatOptions:d={},onMessagesUpdate:f,messages:p}=this.options,{onFinish:g,onData:m,...b}=d,v=typeof p=="function",x=new Q1.Chat({id:t,messages:Array.isArray(p)?p:void 0,sendAutomaticallyWhen:Ar.lastAssistantMessageIsCompleteWithToolCalls,transport:new Ar.DefaultChatTransport({...u,async prepareSendMessagesRequest({headers:j,messages:E,body:_,id:T,trigger:P,credentials:A}){var $;const M={..._,id:T,trigger:P,messages:E.slice(-10),projectContext:Yo(n,{withPageContent:!0,selectedComponents:Array.from(o)}),userPrompt:""},R=typeof l=="function"?l({editor:n,body:M,messages:E}):l,{accessToken:F,license:L}=Kt,B=rS.NODE_ENV!=="production",q=`${Hf({isDev:B,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!L||["enterprise","business"].includes((($=L==null?void 0:L.plan)==null?void 0:$.category)??"free"))&&typeof i<"u"?typeof i=="function"?i():i:q,headers:{...j,...F?{Authorization:`Bearer ${F}`}:{}},credentials:A,body:{...M,...R}}}}),onToolCall:async({toolCall:j})=>{a==null||a({toolCall:j});const E=!!hb[j.toolName];if(j.dynamic||E)return;const{toolName:_,input:T,toolCallId:P}=j,A=this.tools[_];if(A&&A.execute){const M=new AbortController;r.add(M);try{const{messages:R}=x,F=await Promise.race([A.execute(T||{},{editor:n,messages:R,lastUserMessage:R.findLast(L=>L.role==="user"),toolCallId:P,abortController:M}),new Promise((L,B)=>{M.signal.addEventListener("abort",()=>B(new Error("Aborted")))})]);if(F&&typeof F.error=="string")throw new Error(F.error);x.addToolOutput({tool:_,toolCallId:P,output:F})}catch(R){x.addToolOutput({tool:_,toolCallId:P,state:"output-error",errorText:R instanceof Error?R.message:"Unknown error"})}finally{r.delete(M)}}},onData(j){m==null||m(j),eS({editor:n,data:j,toolStatusProgress:s})},onFinish(j){f==null||f({messages:j.messages,editor:n}),j.isAbort&&(s.forEach(E=>{"toolSetup"in E&&E.toolSetup.cleanUp()}),s.clear()),g==null||g(j)},...b}),y=new Set,w={get messages(){return x.messages},get lastMessage(){return x.lastMessage},get status(){return x.status},get error(){return x.error},sendMessage:(...j)=>x.sendMessage(...j),setMessages:j=>{x.messages=j},clearError:()=>x.clearError(),stop:()=>x.stop(),setError:j=>{const E=j instanceof Error?j:new Error(String(j));x.setStatus({status:"error",error:E})}},S={chat:x,chatApi:w,isMessagesLoaded:!v,toolStatusProgress:s,toolAbortControllers:r,contextComponents:o,onUpdate:j=>(y.add(j),()=>{y.delete(j)}),emitUpdate:()=>{y.forEach(j=>j())}};this.chatStates.set(x.id,S);const C=()=>{x["~registerMessagesCallback"](()=>{x.status==="ready"&&(f==null||f({messages:x.messages,editor:n}))})};return v?p({editor:n}).then(j=>{x.messages=j,C()}).catch(j=>w.setError(j)).finally(()=>{S.isMessagesLoaded=!0,S.emitUpdate()}):C(),S}}var iS="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",aS="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",lS="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",cS="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",uS="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",dS="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",fS="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",pS="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",hS="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",gS="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",mS="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",bS="M3,21V3H21V21H3M5,5V19H19V5H5Z",vS="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",yS="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",xS="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",wS="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",SS="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",gb="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",CS="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",jS="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",ES="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",PS="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",_S="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",TS="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",mb="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",OS="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",AS="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",NS="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",MS="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",LS="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",RS="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",$S="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",VS="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",IS="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",DS="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",HS="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",FS="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",BS="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",zS="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",US="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",WS="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",GS="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",qS="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",KS="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",YS="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",ZS="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",XS="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",JS="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",QS="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",e2="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",t2="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",n2="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",s2="M11,9H13V11H11V9M9,11H11V13H9V11M13,11H15V13H13V11M15,9H17V11H15V9M7,9H9V11H7V9M19,3H5A2,2 0 0,0 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V5A2,2 0 0,0 19,3M9,18H7V16H9V18M13,18H11V16H13V18M17,18H15V16H17V18M19,11H17V13H19V15H17V13H15V15H13V13H11V15H9V13H7V15H5V13H7V11H5V5H19V11Z",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",i2="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",l2="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",c2="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",u2="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",d2="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",f2="M11 15H6L13 1V9H18L11 23V15Z",p2="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",h2="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",g2="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",m2="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",b2="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",y2="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",x2="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",bb="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",j2="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",P2="M6.62,10.79C8.06,13.62 10.38,15.94 13.21,17.38L15.41,15.18C15.69,14.9 16.08,14.82 16.43,14.93C17.55,15.3 18.75,15.5 20,15.5A1,1 0 0,1 21,16.5V20A1,1 0 0,1 20,21A17,17 0 0,1 3,4A1,1 0 0,1 4,3H7.5A1,1 0 0,1 8.5,4C8.5,5.25 8.7,6.45 9.07,7.57C9.18,7.92 9.1,8.31 8.82,8.59L6.62,10.79Z",_2="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",T2="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",O2="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",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 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",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 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",R2="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",$2="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",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",I2="M22.08,11.04H20.08V4H13.05V2H11.04V4H4V11.04H2V13.05H4V20.08H11.04V22.08H13.05V20.08H20.08V13.05H22.08V11.04M18.07,18.07H13.05V16.06H11.04V18.07H6V13.05H8.03V11.04H6V6H11.04V8.03H13.05V6H18.07V11.04H16.06V13.05H18.07V18.07M13.05,12.05A1,1 0 0,1 12.05,13.05C11.5,13.05 11.04,12.6 11.04,12.05C11.04,11.5 11.5,11.04 12.05,11.04C12.6,11.04 13.05,11.5 13.05,12.05Z",D2="M16,15H9V13H16M19,11H9V9H19M19,7H9V5H19M21,1H7C5.89,1 5,1.89 5,3V17C5,18.11 5.9,19 7,19H21C22.11,19 23,18.11 23,17V3C23,1.89 22.1,1 21,1M3,5V21H19V23H3A2,2 0 0,1 1,21V5H3Z",H2="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",Y2="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 ue=ee;function ee(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(r=>typeof r=="string"?r.split(" ").map(o=>{if(o=o.replace(/gjs-/g,"gs-utl-"),!o.includes("gs-utl-")&&!o.startsWith("gs-")){const i=o.split(":"),a=i.pop(),l=i.join(":"),u=a==null?void 0:a.startsWith("!"),f=`gs-utl-${u?a==null?void 0:a.slice(1):a}`,p=u?`!${f}`:f;return l?`${l}:${p}`:p}return o}):r).join(" ")}const k=h.forwardRef(function({as:t,children:n,className:s,col:r,revert:o,full:i,nowrap:a,space:l,gap:u,justify:d,items:f,...p},g){const m=t||"div";return c.jsx(m,{ref:g,className:ee([s,"gs-utl-flex",r&&!o&&"gs-utl-flex-col",r&&o&&"gs-utl-flex-col-reverse",!r&&o&&"gs-utl-flex-row-reverse",i&&!r&&"gs-utl-w-full",i&&r&&"gs-utl-h-full",a?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(r?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(r?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(r?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(r?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(r?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(r?"gs-utl-space-y-8":"gs-utl-space-x-8"),u==="x2s"&&"gs-utl-gap-0.5",u==="xs"&&"gs-utl-gap-1",u==="s"&&"gs-utl-gap-2",u==="m"&&"gs-utl-gap-4",u==="l"&&"gs-utl-gap-6",u==="xl"&&"gs-utl-gap-8",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})}),D=h.forwardRef(function({children:t,className:n,grow:s,...r},o){return c.jsx("div",{ref:o,className:ee([n,s&&"flex-1"]),...r,children:t})});function Bf(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var ll={exports:{}},cl={exports:{}},Je={};/** @license React v16.13.1
|
|
16
|
-
* react-is.production.min.js
|
|
17
|
-
*
|
|
18
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
19
|
-
*
|
|
20
|
-
* This source code is licensed under the MIT license found in the
|
|
21
|
-
* LICENSE file in the root directory of this source tree.
|
|
22
|
-
*/var Oh;function Z2(){if(Oh)return Je;Oh=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,s=e?Symbol.for("react.fragment"):60107,r=e?Symbol.for("react.strict_mode"):60108,o=e?Symbol.for("react.profiler"):60114,i=e?Symbol.for("react.provider"):60109,a=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,u=e?Symbol.for("react.concurrent_mode"):60111,d=e?Symbol.for("react.forward_ref"):60112,f=e?Symbol.for("react.suspense"):60113,p=e?Symbol.for("react.suspense_list"):60120,g=e?Symbol.for("react.memo"):60115,m=e?Symbol.for("react.lazy"):60116,b=e?Symbol.for("react.block"):60121,v=e?Symbol.for("react.fundamental"):60117,x=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function w(C){if(typeof C=="object"&&C!==null){var j=C.$$typeof;switch(j){case t:switch(C=C.type,C){case l:case u:case s:case o:case r:case f:return C;default:switch(C=C&&C.$$typeof,C){case a:case d:case m:case g:case i:return C;default:return j}}case n:return j}}}function S(C){return w(C)===u}return Je.AsyncMode=l,Je.ConcurrentMode=u,Je.ContextConsumer=a,Je.ContextProvider=i,Je.Element=t,Je.ForwardRef=d,Je.Fragment=s,Je.Lazy=m,Je.Memo=g,Je.Portal=n,Je.Profiler=o,Je.StrictMode=r,Je.Suspense=f,Je.isAsyncMode=function(C){return S(C)||w(C)===l},Je.isConcurrentMode=S,Je.isContextConsumer=function(C){return w(C)===a},Je.isContextProvider=function(C){return w(C)===i},Je.isElement=function(C){return typeof C=="object"&&C!==null&&C.$$typeof===t},Je.isForwardRef=function(C){return w(C)===d},Je.isFragment=function(C){return w(C)===s},Je.isLazy=function(C){return w(C)===m},Je.isMemo=function(C){return w(C)===g},Je.isPortal=function(C){return w(C)===n},Je.isProfiler=function(C){return w(C)===o},Je.isStrictMode=function(C){return w(C)===r},Je.isSuspense=function(C){return w(C)===f},Je.isValidElementType=function(C){return typeof C=="string"||typeof C=="function"||C===s||C===u||C===o||C===r||C===f||C===p||typeof C=="object"&&C!==null&&(C.$$typeof===m||C.$$typeof===g||C.$$typeof===i||C.$$typeof===a||C.$$typeof===d||C.$$typeof===v||C.$$typeof===x||C.$$typeof===y||C.$$typeof===b)},Je.typeOf=w,Je}var Qe={},Ah;function X2(){if(Ah)return Qe;Ah=1;var e={};/** @license React v16.13.1
|
|
23
|
-
* react-is.development.js
|
|
24
|
-
*
|
|
25
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
26
|
-
*
|
|
27
|
-
* This source code is licensed under the MIT license found in the
|
|
28
|
-
* LICENSE file in the root directory of this source tree.
|
|
29
|
-
*/return e.NODE_ENV!=="production"&&function(){var t=typeof Symbol=="function"&&Symbol.for,n=t?Symbol.for("react.element"):60103,s=t?Symbol.for("react.portal"):60106,r=t?Symbol.for("react.fragment"):60107,o=t?Symbol.for("react.strict_mode"):60108,i=t?Symbol.for("react.profiler"):60114,a=t?Symbol.for("react.provider"):60109,l=t?Symbol.for("react.context"):60110,u=t?Symbol.for("react.async_mode"):60111,d=t?Symbol.for("react.concurrent_mode"):60111,f=t?Symbol.for("react.forward_ref"):60112,p=t?Symbol.for("react.suspense"):60113,g=t?Symbol.for("react.suspense_list"):60120,m=t?Symbol.for("react.memo"):60115,b=t?Symbol.for("react.lazy"):60116,v=t?Symbol.for("react.block"):60121,x=t?Symbol.for("react.fundamental"):60117,y=t?Symbol.for("react.responder"):60118,w=t?Symbol.for("react.scope"):60119;function S(ne){return typeof ne=="string"||typeof ne=="function"||ne===r||ne===d||ne===i||ne===o||ne===p||ne===g||typeof ne=="object"&&ne!==null&&(ne.$$typeof===b||ne.$$typeof===m||ne.$$typeof===a||ne.$$typeof===l||ne.$$typeof===f||ne.$$typeof===x||ne.$$typeof===y||ne.$$typeof===w||ne.$$typeof===v)}function C(ne){if(typeof ne=="object"&&ne!==null){var Te=ne.$$typeof;switch(Te){case n:var ke=ne.type;switch(ke){case u:case d:case r:case i:case o:case p:return ke;default:var it=ke&&ke.$$typeof;switch(it){case l:case f:case b:case m:case a:return it;default:return Te}}case s:return Te}}}var j=u,E=d,_=l,T=a,P=n,A=f,M=r,R=b,F=m,L=s,B=i,q=o,H=p,$=!1;function I(ne){return $||($=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),O(ne)||C(ne)===u}function O(ne){return C(ne)===d}function V(ne){return C(ne)===l}function G(ne){return C(ne)===a}function W(ne){return typeof ne=="object"&&ne!==null&&ne.$$typeof===n}function K(ne){return C(ne)===f}function J(ne){return C(ne)===r}function Y(ne){return C(ne)===b}function U(ne){return C(ne)===m}function Q(ne){return C(ne)===s}function se(ne){return C(ne)===i}function de(ne){return C(ne)===o}function Se(ne){return C(ne)===p}Qe.AsyncMode=j,Qe.ConcurrentMode=E,Qe.ContextConsumer=_,Qe.ContextProvider=T,Qe.Element=P,Qe.ForwardRef=A,Qe.Fragment=M,Qe.Lazy=R,Qe.Memo=F,Qe.Portal=L,Qe.Profiler=B,Qe.StrictMode=q,Qe.Suspense=H,Qe.isAsyncMode=I,Qe.isConcurrentMode=O,Qe.isContextConsumer=V,Qe.isContextProvider=G,Qe.isElement=W,Qe.isForwardRef=K,Qe.isFragment=J,Qe.isLazy=Y,Qe.isMemo=U,Qe.isPortal=Q,Qe.isProfiler=se,Qe.isStrictMode=de,Qe.isSuspense=Se,Qe.isValidElementType=S,Qe.typeOf=C}(),Qe}var Nh;function vb(){if(Nh)return cl.exports;Nh=1;var e={};return e.NODE_ENV==="production"?cl.exports=Z2():cl.exports=X2(),cl.exports}/*
|
|
30
|
-
object-assign
|
|
31
|
-
(c) Sindre Sorhus
|
|
32
|
-
@license MIT
|
|
33
|
-
*/var Pu,Mh;function J2(){if(Mh)return Pu;Mh=1;var e=Object.getOwnPropertySymbols,t=Object.prototype.hasOwnProperty,n=Object.prototype.propertyIsEnumerable;function s(o){if(o==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(o)}function r(){try{if(!Object.assign)return!1;var o=new String("abc");if(o[5]="de",Object.getOwnPropertyNames(o)[0]==="5")return!1;for(var i={},a=0;a<10;a++)i["_"+String.fromCharCode(a)]=a;var l=Object.getOwnPropertyNames(i).map(function(d){return i[d]});if(l.join("")!=="0123456789")return!1;var u={};return"abcdefghijklmnopqrst".split("").forEach(function(d){u[d]=d}),Object.keys(Object.assign({},u)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}return Pu=r()?Object.assign:function(o,i){for(var a,l=s(o),u,d=1;d<arguments.length;d++){a=Object(arguments[d]);for(var f in a)t.call(a,f)&&(l[f]=a[f]);if(e){u=e(a);for(var p=0;p<u.length;p++)n.call(a,u[p])&&(l[u[p]]=a[u[p]])}}return l},Pu}var _u,Lh;function zf(){if(Lh)return _u;Lh=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return _u=e,_u}var Tu,Rh;function yb(){return Rh||(Rh=1,Tu=Function.call.bind(Object.prototype.hasOwnProperty)),Tu}var Ou,$h;function Q2(){if($h)return Ou;$h=1;var e={},t=function(){};if(e.NODE_ENV!=="production"){var n=zf(),s={},r=yb();t=function(i){var a="Warning: "+i;typeof console<"u"&&console.error(a);try{throw new Error(a)}catch{}}}function o(i,a,l,u,d){if(e.NODE_ENV!=="production"){for(var f in i)if(r(i,f)){var p;try{if(typeof i[f]!="function"){var g=Error((u||"React class")+": "+l+" type `"+f+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof i[f]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw g.name="Invariant Violation",g}p=i[f](a,f,u,l,null,n)}catch(b){p=b}if(p&&!(p instanceof Error)&&t((u||"React class")+": type specification of "+l+" `"+f+"` is invalid; the type checker function must return `null` or an `Error` but returned a "+typeof p+". You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument)."),p instanceof Error&&!(p.message in s)){s[p.message]=!0;var m=d?d():"";t("Failed "+l+" type: "+p.message+(m??""))}}}}return o.resetWarningCache=function(){e.NODE_ENV!=="production"&&(s={})},Ou=o,Ou}var Au,kh;function eC(){if(kh)return Au;kh=1;var e={},t=vb(),n=J2(),s=zf(),r=yb(),o=Q2(),i=function(){};e.NODE_ENV!=="production"&&(i=function(l){var u="Warning: "+l;typeof console<"u"&&console.error(u);try{throw new Error(u)}catch{}});function a(){return null}return Au=function(l,u){var d=typeof Symbol=="function"&&Symbol.iterator,f="@@iterator";function p(O){var V=O&&(d&&O[d]||O[f]);if(typeof V=="function")return V}var g="<<anonymous>>",m={array:y("array"),bigint:y("bigint"),bool:y("boolean"),func:y("function"),number:y("number"),object:y("object"),string:y("string"),symbol:y("symbol"),any:w(),arrayOf:S,element:C(),elementType:j(),instanceOf:E,node:A(),objectOf:T,oneOf:_,oneOfType:P,shape:R,exact:F};function b(O,V){return O===V?O!==0||1/O===1/V:O!==O&&V!==V}function v(O,V){this.message=O,this.data=V&&typeof V=="object"?V:{},this.stack=""}v.prototype=Error.prototype;function x(O){if(e.NODE_ENV!=="production")var V={},G=0;function W(J,Y,U,Q,se,de,Se){if(Q=Q||g,de=de||U,Se!==s){if(u){var ne=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 ne.name="Invariant Violation",ne}else if(e.NODE_ENV!=="production"&&typeof console<"u"){var Te=Q+":"+U;!V[Te]&&G<3&&(i("You are manually calling a React.PropTypes validation function for the `"+de+"` prop on `"+Q+"`. This is deprecated and will throw in the standalone `prop-types` package. You may be seeing this warning due to a third-party PropTypes library. See https://fb.me/react-warning-dont-call-proptypes for details."),V[Te]=!0,G++)}}return Y[U]==null?J?Y[U]===null?new v("The "+se+" `"+de+"` is marked as required "+("in `"+Q+"`, but its value is `null`.")):new v("The "+se+" `"+de+"` is marked as required in "+("`"+Q+"`, but its value is `undefined`.")):null:O(Y,U,Q,se,de)}var K=W.bind(null,!1);return K.isRequired=W.bind(null,!0),K}function y(O){function V(G,W,K,J,Y,U){var Q=G[W],se=q(Q);if(se!==O){var de=H(Q);return new v("Invalid "+J+" `"+Y+"` of type "+("`"+de+"` supplied to `"+K+"`, expected ")+("`"+O+"`."),{expectedType:O})}return null}return x(V)}function w(){return x(a)}function S(O){function V(G,W,K,J,Y){if(typeof O!="function")return new v("Property `"+Y+"` of component `"+K+"` has invalid PropType notation inside arrayOf.");var U=G[W];if(!Array.isArray(U)){var Q=q(U);return new v("Invalid "+J+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+K+"`, expected an array."))}for(var se=0;se<U.length;se++){var de=O(U,se,K,J,Y+"["+se+"]",s);if(de instanceof Error)return de}return null}return x(V)}function C(){function O(V,G,W,K,J){var Y=V[G];if(!l(Y)){var U=q(Y);return new v("Invalid "+K+" `"+J+"` of type "+("`"+U+"` supplied to `"+W+"`, expected a single ReactElement."))}return null}return x(O)}function j(){function O(V,G,W,K,J){var Y=V[G];if(!t.isValidElementType(Y)){var U=q(Y);return new v("Invalid "+K+" `"+J+"` of type "+("`"+U+"` supplied to `"+W+"`, expected a single ReactElement type."))}return null}return x(O)}function E(O){function V(G,W,K,J,Y){if(!(G[W]instanceof O)){var U=O.name||g,Q=I(G[W]);return new v("Invalid "+J+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+K+"`, expected ")+("instance of `"+U+"`."))}return null}return x(V)}function _(O){if(!Array.isArray(O))return e.NODE_ENV!=="production"&&(arguments.length>1?i("Invalid arguments supplied to oneOf, expected an array, got "+arguments.length+" arguments. A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z])."):i("Invalid argument supplied to oneOf, expected an array.")),a;function V(G,W,K,J,Y){for(var U=G[W],Q=0;Q<O.length;Q++)if(b(U,O[Q]))return null;var se=JSON.stringify(O,function(Se,ne){var Te=H(ne);return Te==="symbol"?String(ne):ne});return new v("Invalid "+J+" `"+Y+"` of value `"+String(U)+"` "+("supplied to `"+K+"`, expected one of "+se+"."))}return x(V)}function T(O){function V(G,W,K,J,Y){if(typeof O!="function")return new v("Property `"+Y+"` of component `"+K+"` has invalid PropType notation inside objectOf.");var U=G[W],Q=q(U);if(Q!=="object")return new v("Invalid "+J+" `"+Y+"` of type "+("`"+Q+"` supplied to `"+K+"`, expected an object."));for(var se in U)if(r(U,se)){var de=O(U,se,K,J,Y+"."+se,s);if(de instanceof Error)return de}return null}return x(V)}function P(O){if(!Array.isArray(O))return e.NODE_ENV!=="production"&&i("Invalid argument supplied to oneOfType, expected an instance of array."),a;for(var V=0;V<O.length;V++){var G=O[V];if(typeof G!="function")return i("Invalid argument supplied to oneOfType. Expected an array of check functions, but received "+$(G)+" at index "+V+"."),a}function W(K,J,Y,U,Q){for(var se=[],de=0;de<O.length;de++){var Se=O[de],ne=Se(K,J,Y,U,Q,s);if(ne==null)return null;ne.data&&r(ne.data,"expectedType")&&se.push(ne.data.expectedType)}var Te=se.length>0?", expected one of type ["+se.join(", ")+"]":"";return new v("Invalid "+U+" `"+Q+"` supplied to "+("`"+Y+"`"+Te+"."))}return x(W)}function A(){function O(V,G,W,K,J){return L(V[G])?null:new v("Invalid "+K+" `"+J+"` supplied to "+("`"+W+"`, expected a ReactNode."))}return x(O)}function M(O,V,G,W,K){return new v((O||"React class")+": "+V+" type `"+G+"."+W+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+K+"`.")}function R(O){function V(G,W,K,J,Y){var U=G[W],Q=q(U);if(Q!=="object")return new v("Invalid "+J+" `"+Y+"` of type `"+Q+"` "+("supplied to `"+K+"`, expected `object`."));for(var se in O){var de=O[se];if(typeof de!="function")return M(K,J,Y,se,H(de));var Se=de(U,se,K,J,Y+"."+se,s);if(Se)return Se}return null}return x(V)}function F(O){function V(G,W,K,J,Y){var U=G[W],Q=q(U);if(Q!=="object")return new v("Invalid "+J+" `"+Y+"` of type `"+Q+"` "+("supplied to `"+K+"`, expected `object`."));var se=n({},G[W],O);for(var de in se){var Se=O[de];if(r(O,de)&&typeof Se!="function")return M(K,J,Y,de,H(Se));if(!Se)return new v("Invalid "+J+" `"+Y+"` key `"+de+"` supplied to `"+K+"`.\nBad object: "+JSON.stringify(G[W],null," ")+`
|
|
34
|
-
Valid keys: `+JSON.stringify(Object.keys(O),null," "));var ne=Se(U,de,K,J,Y+"."+de,s);if(ne)return ne}return null}return x(V)}function L(O){switch(typeof O){case"number":case"string":case"undefined":return!0;case"boolean":return!O;case"object":if(Array.isArray(O))return O.every(L);if(O===null||l(O))return!0;var V=p(O);if(V){var G=V.call(O),W;if(V!==O.entries){for(;!(W=G.next()).done;)if(!L(W.value))return!1}else for(;!(W=G.next()).done;){var K=W.value;if(K&&!L(K[1]))return!1}}else return!1;return!0;default:return!1}}function B(O,V){return O==="symbol"?!0:V?V["@@toStringTag"]==="Symbol"||typeof Symbol=="function"&&V instanceof Symbol:!1}function q(O){var V=typeof O;return Array.isArray(O)?"array":O instanceof RegExp?"object":B(V,O)?"symbol":V}function H(O){if(typeof O>"u"||O===null)return""+O;var V=q(O);if(V==="object"){if(O instanceof Date)return"date";if(O instanceof RegExp)return"regexp"}return V}function $(O){var V=H(O);switch(V){case"array":case"object":return"an "+V;case"boolean":case"date":case"regexp":return"a "+V;default:return V}}function I(O){return!O.constructor||!O.constructor.name?g:O.constructor.name}return m.checkPropTypes=o,m.resetWarningCache=o.resetWarningCache,m.PropTypes=m,m},Au}var Nu,Vh;function tC(){if(Vh)return Nu;Vh=1;var e=zf();function t(){}function n(){}return n.resetWarningCache=t,Nu=function(){function s(i,a,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}}s.isRequired=s;function r(){return s}var o={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:r,element:s,elementType:s,instanceOf:r,node:s,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},Nu}var Ih;function nC(){if(Ih)return ll.exports;Ih=1;var e={};if(e.NODE_ENV!=="production"){var t=vb(),n=!0;ll.exports=eC()(t.isElement,n)}else ll.exports=tC()();return ll.exports}var sC=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(s,r,o){n.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:o})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,r){if(1&r&&(s=n(s)),8&r||4&r&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&r&&typeof s!="string")for(var i in s)n.d(o,i,(function(a){return s[a]}).bind(null,i));return o},n.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(r,"a",r),r},n.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},n.p="",n(n.s=2)}([function(e,t){e.exports=nC()},function(e,t){e.exports=h},function(e,t,n){n.r(t);var s=n(1),r=n(0),o=function(){return(o=Object.assign||function(m){for(var b,v=1,x=arguments.length;v<x;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},i=function(m,b){var v={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&b.indexOf(x)<0&&(v[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)b.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(v[x[y]]=m[x[y]])}return v},a=0,l=s.forwardRef(function(m,b){var v=m.title,x=v===void 0?null:v,y=m.description,w=y===void 0?null:y,S=m.size,C=S===void 0?null:S,j=m.color,E=j===void 0?"currentColor":j,_=m.horizontal,T=_===void 0?null:_,P=m.vertical,A=P===void 0?null:P,M=m.rotate,R=M===void 0?null:M,F=m.spin,L=F===void 0?null:F,B=m.style,q=B===void 0?{}:B,H=m.children,$=i(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var I,O=L!==null&&L,V=s.Children.map(H,function(J){var Y=J;O!==!0&&(O=(L===null?Y.props.spin:L)===!0);var U=Y.props.size;typeof C=="number"&&typeof Y.props.size=="number"&&(U=Y.props.size/C);var Q={size:U,color:E===null?Y.props.color:E,horizontal:T===null?Y.props.horizontal:T,vertical:A===null?Y.props.vertical:A,rotate:R===null?Y.props.rotate:R,spin:L===null?Y.props.spin:L,inStack:!0};return s.cloneElement(Y,Q)});C!==null&&(q.width=typeof C=="string"?C:1.5*C+"rem");var G,W="stack_labelledby_"+a,K="stack_describedby_"+a;if(x)I=w?W+" "+K:W;else if(G="presentation",w)throw new Error("title attribute required when description is set");return s.createElement("svg",o({ref:b,viewBox:"0 0 24 24",style:q,role:G,"aria-labelledby":I},$),x&&s.createElement("title",{id:W},x),w&&s.createElement("desc",{id:K},w),O&&s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),V)});l.displayName="Stack",l.propTypes={size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),children:r.oneOfType([r.arrayOf(r.node),r.node]).isRequired,className:r.string,style:r.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var u=l;n.d(t,"Icon",function(){return g}),n.d(t,"Stack",function(){return u});var d=function(){return(d=Object.assign||function(m){for(var b,v=1,x=arguments.length;v<x;v++)for(var y in b=arguments[v])Object.prototype.hasOwnProperty.call(b,y)&&(m[y]=b[y]);return m}).apply(this,arguments)},f=function(m,b){var v={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&b.indexOf(x)<0&&(v[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)b.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(v[x[y]]=m[x[y]])}return v},p=0,g=s.forwardRef(function(m,b){var v=m.path,x=m.id,y=x===void 0?++p:x,w=m.title,S=w===void 0?null:w,C=m.description,j=C===void 0?null:C,E=m.size,_=E===void 0?null:E,T=m.color,P=T===void 0?"currentColor":T,A=m.horizontal,M=A!==void 0&&A,R=m.vertical,F=R!==void 0&&R,L=m.rotate,B=L===void 0?0:L,q=m.spin,H=q!==void 0&&q,$=m.style,I=$===void 0?{}:$,O=m.inStack,V=O!==void 0&&O,G=f(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),W={},K=[];_!==null&&(V?K.push("scale("+_+")"):(I.width=typeof _=="string"?_:1.5*_+"rem",I.height=I.width)),M&&K.push("scaleX(-1)"),F&&K.push("scaleY(-1)"),B!==0&&K.push("rotate("+B+"deg)"),P!==null&&(W.fill=P);var J=s.createElement("path",d({d:v,style:W},V?G:{})),Y=J;K.length>0&&(I.transform=K.join(" "),I.transformOrigin="center",V&&(Y=s.createElement("g",{style:I},J,s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var U,Q=Y,se=H===!0||typeof H!="number"?2:H,de=!V&&(M||F);if(se<0&&(de=!de),H&&(Q=s.createElement("g",{style:{animation:"spin"+(de?"-inverse":"")+" linear "+Math.abs(se)+"s infinite",transformOrigin:"center"}},Y,!(M||F||B!==0)&&s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),V)return Q;var Se,ne="icon_labelledby_"+y,Te="icon_describedby_"+y;if(S)U=j?ne+" "+Te:ne;else if(Se="presentation",j)throw new Error("title attribute required when description is set");return s.createElement("svg",d({ref:b,viewBox:"0 0 24 24",style:I,role:Se,"aria-labelledby":U},G),S&&s.createElement("title",{id:ne},S),j&&s.createElement("desc",{id:Te},j),!V&&H&&(de?s.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),Q)});g.displayName="Icon",g.propTypes={path:r.string.isRequired,size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),style:r.object,inStack:r.bool,className:r.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const Wi=Bf(sC);var xb={exports:{}};/*!
|
|
1
|
+
"use strict";const gv=require("@ai-sdk/react"),Co=require("ai"),c=require("react/jsx-runtime"),h=require("react"),Gn=require("react-dom"),Mw=require("react-dom/client"),Nw=require("marked"),$w=require("react-markdown"),kw=require("remark-gfm");function mv(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const rt=mv(h),Rw=mv(Gn),vv="app.grapesjs.com",bv="app-stage.grapesjs.com",Iw="app2.grapesjs.com",Vw="app-stage2.grapesjs.com",Zh=[vv,Iw,bv,Vw,"localhost","127.0.0.1",".local-credentialless.webcontainer.io",".local.webcontainer.io","-sandpack.codesandbox.io"],yv="license:check:start",Qd="license:check:end",Ws=()=>typeof window<"u",Po=e=>e&&e.stopPropagation(),Hw=e=>e.getAttributeNames().reduce((t,n)=>({...t,[n]:e.getAttribute(n)||""}),{}),Dw=(e,t)=>{const n=s=>s.key===e&&t();return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},Fw=(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)},Bw=e=>Dw("Escape",e),zw=(e,t={})=>{const n=dt(e)?{id:e,src:e}:e;return new Promise((s,r)=>{var p,g;const{loadedScripts:o}=t,{id:i,src:a}=n,l=document.querySelector(`script[src="${a}"]`);if(l){if((p=t.onScript)==null||p.call(t,l),o&&!o.get(a)){l.addEventListener("load",()=>s(i)),l.addEventListener("error",()=>r(i));return}return s(i)}const u=window.define;window.define=void 0;const d=()=>{o==null||o.set(a,!0),window.define=u},f=document.createElement("script");f.src=a,f.onload=()=>{s(i),d()},f.onerror=()=>{r(i),d()},document.head.appendChild(f),(g=t.onScript)==null||g.call(t,f)})},Uw=e=>{const t=e.map(n=>zw(n));return Promise.allSettled(t)};function Ww(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 Yh(e){const t=s=>{var r;if(s.length){const o=s.shift(),i=Ww(o);i.onerror=i.onload=t.bind(null,s),(r=o.parentNode)==null||r.replaceChild(i,o)}},n=Array.from(e.querySelectorAll("script"));t(n)}const xv=e=>new DOMParser().parseFromString(e,"text/html"),Gw=(e="")=>xv(`<body>${e}</body>`).body.innerHTML,qw=(e="")=>xv(`<head>${e}</head>`).head.innerHTML,Kw=(e="",t)=>{const s=new DOMParser().parseFromString(e,"text/html");if(t){const o=s.querySelectorAll("svg")[0].style||{},i=eS(t)?`${t}px`:t;o.width=i,o.height=i,o.fill="currentColor"}return new XMLSerializer().serializeToString(s)},rp=({isDev:e,isStage:t,isPlatform:n})=>`${e?"":`https://${t?bv:vv}`}/${n?"platform-api":"api"}`,Zw=(e,t)=>{try{return new RegExp(e,t)}catch{console.warn("Failed to create regexp",e);return}},wv=(e={})=>{const{width:t=300,height:n,text:s="IMAGE",bg:r="777",fg:o="white"}=e,i=n?`x${n}`:"";return`https://placehold.co/${t}${i}/${r}/${o}.png?text=${s}`},Yw=wv(),op=()=>{const e=Ws()&&window.location.hostname;return!!e&&(Zh.includes(e)||Zh.some(t=>e.endsWith(t)))},$s=e=>e&&e.charAt(0).toUpperCase()+e.substring(1),Xw=e=>e.replace(/[A-Z]+(?![a-z])|[A-Z]/g,(t,n)=>(n?"-":"")+t.toLowerCase()),Jw=()=>{},Qw=240,Dt=e=>typeof e<"u",dt=e=>typeof e=="string",eS=e=>typeof e=="number";function tt(e){return typeof e=="function"}function vr(e){return e&&!Array.isArray(e)&&typeof e=="object"}const tS=e=>!e||Object.keys(e).length===0,di=(e,t)=>{const n=(e||"").toLocaleLowerCase(),s=(t||"").toLocaleLowerCase();return n.includes(s)},nS=(e="")=>{const t=e[0]==="?"?e.substring(1):e,n=new URLSearchParams(t);return Object.fromEntries(n)},sS=(e=16)=>{let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",s=n.length;for(let r=0;r<e;r++)t+=n.charAt(Math.floor(Math.random()*s));return t},rS=e=>!!e.Components.getType("mjml"),Fc=e=>(e||"").toLowerCase().trim().replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._]+/g,"").replace(/--+/g,"-").trim(),oS=(e,t=[])=>{const n=new Set(t);return(e||"").trim().replace(/\{\{\s*([a-zA-Z0-9_]*)\s*\}\}/g,(o,i)=>{const a=i.trim();return!a||!n.has(a)?"":`__var__${a}__`}).replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-._/]+/g,"").replace(/--+/g,"-").replace(/^[-/]+|[-/]+$/g,"").replace(/__var__([a-zA-Z0-9_]+)__/g,(o,i)=>`{{ ${i} }}`)};async function iS({path:e,baseApiUrl:t,method:n="GET",headers:s={},params:r,body:o}){const a=`${t||rp({isDev:!1,isStage:!1})}${e}`,l={method:n,headers:{"Content-Type":"application/json",...s}};o&&(l.body=JSON.stringify(o));const u=r?new URLSearchParams(r).toString():"",d=u?`?${u}`:"",f=await fetch(`${a}${d}`,l);if(!f.ok)throw new Error(`HTTP error! status: ${f.status}`);return f.json()}var ri=(e=>(e.free="free",e.startup="startup",e.business="business",e.enterprise="enterprise",e))(ri||{}),cn=(e=>(e.Info="info",e.Error="error",e.Success="success",e.Warning="warning",e))(cn||{}),se=(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))(se||{}),Rn=(e=>(e.layoutToggleId="studio:layoutToggle:",e.toggleBlocksPanel="studio:toggleBlocksPanel",e.pageSettingsUpdate="studio:pageSettingsUpdate",e.toggleDataSourcesPreview="studio:toggleDataSourcesPreview",e))(Rn||{}),Ir=(e=>(e.dark="dark",e.light="light",e.auto="auto",e))(Ir||{}),jt=(e=>(e.web="web",e.email="email",e.document="document",e.react="react",e))(jt||{});const Xh={[ri.free]:0,[ri.startup]:10,[ri.business]:20,[ri.enterprise]:30};function aS(e){const t=e;return t.init=n=>s=>e(s,n),t}const lS=e=>aS(e);async function cS({editor:e,plan:t,pluginName:n,licenseKey:s,onLicenseCheckResponse:r,cleanup:o}){let i="",a=!1;const l=op(),u=f=>{console.warn("Cleanup plugin:",n,"Reason:",f),o()},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 x=Xh[t],y=Xh[m];x>y&&u({pluginRequiredPlan:t,licensePlan:m})}};e.on(yv,f=>{i=f==null?void 0:f.baseApiUrl,a=!0}),e.on(Qd,f=>{r==null||r(f),d(f)}),setTimeout(async()=>{if(!a){if(l)return;if(s){const f=await uS({licenseKey:s,pluginName:n,baseApiUrl:i});r==null||r(f),f&&d(f)}else u("The `licenseKey` option not provided")}},2e3)}async function uS(e){const{licenseKey:t,pluginName:n,baseApiUrl:s}=e;try{return(await iS({baseApiUrl:s,path:`/sdk/${t||"na"}`,method:"POST",params:{d:window.location.hostname,pn:n}})).result||{}}catch(r){return console.error("Error during SDK license check:",r),!1}}var dS="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",fS="M11 2H13V7H21V10H13V14H18V17H13V22H11V17H6V14H11V10H3V7H11V2Z",pS="M4 22H2V2H4V22M22 7H6V10H22V7M16 14H6V17H16V14Z",hS="M20 2H22V22H20V2M2 10H18V7H2V10M8 17H18V14H8V17Z",gS="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",mS="M11,4H13V16L18.5,10.5L19.92,11.92L12,19.84L4.08,11.92L5.5,10.5L11,16V4Z",vS="M9.5,13.09L10.91,14.5L6.41,19H10V21H3V14H5V17.59L9.5,13.09M10.91,9.5L9.5,10.91L5,6.41V10H3V3H10V5H6.41L10.91,9.5M14.5,13.09L19,17.59V14H21V21H14V19H17.59L13.09,14.5L14.5,13.09M13.09,9.5L17.59,5H14V3H21V10H19V6.41L14.5,10.91L13.09,9.5Z",bS="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",yS="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",xS="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",wS="M13,20H11V8L5.5,13.5L4.08,12.08L12,4.16L19.92,12.08L18.5,13.5L13,8V20Z",SS="M3,21V3H21V21H3M5,5V19H19V5H5Z",CS="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",jS="M15,21H17V19H15M19,21H21V19H19M7,21H9V19H7M11,21H13V19H11M19,17H21V15H19M19,13H21V11H19M3,3V21H5V5H21V3M19,9H21V7H19",ES="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",TS="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",PS="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",Sv="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z",OS="M9,20.42L2.79,14.21L5.62,11.38L9,14.77L18.88,4.88L21.71,7.71L9,20.42Z",_S="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",AS="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z",LS="M15.41,16.58L10.83,12L15.41,7.41L14,6L8,12L14,18L15.41,16.58Z",MS="M8.59,16.58L13.17,12L8.59,7.41L10,6L16,12L10,18L8.59,16.58Z",NS="M7.41,15.41L12,10.83L16.59,15.41L18,14L12,8L6,14L7.41,15.41Z",Cv="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",$S="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",kS="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",RS="M15,4V6H18V18H15V20H20V4M4,4V20H9V18H6V6H9V4H4Z",IS="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",VS="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",HS="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",DS="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",FS="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",BS="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",zS="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",US="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",WS="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",GS="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",qS="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z",KS="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",ZS="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",YS="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",XS="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",JS="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",QS="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",eC="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",tC="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",nC="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M18,20H6V4H13V9H18V20Z",sC="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",rC="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",oC="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",iC="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",aC="M5,5H10V7H7V10H5V5M14,5H19V10H17V7H14V5M17,14H19V19H14V17H17V14M10,17V19H5V14H7V17H10Z",lC="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",cC="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",uC="M10,20V14H14V20H19V12H22L12,3L2,12H5V20H10Z",dC="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",fC="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",pC="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",hC="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",gC="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",mC="M12,2A7,7 0 0,1 19,9C19,11.38 17.81,13.47 16,14.74V17A1,1 0 0,1 15,18H9A1,1 0 0,1 8,17V14.74C6.19,13.47 5,11.38 5,9A7,7 0 0,1 12,2M9,21V20H15V21A1,1 0 0,1 14,22H10A1,1 0 0,1 9,21M12,4A5,5 0 0,0 7,9C7,11.05 8.23,12.81 10,13.58V16H14V13.58C15.77,12.81 17,11.05 17,9A5,5 0 0,0 12,4Z",vC="M11 15H6L13 1V9H18L11 23V15Z",bC="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",yC="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z",xC="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",wC="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",SC="M7,10L12,15L17,10H7Z",CC="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",jC="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",EC="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",TC="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",PC="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",jv="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",OC="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",_C="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",AC="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",LC="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",MC="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",NC="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",$C="M16,7V3H14V7H10V3H8V7H8C7,7 6,8 6,9V14.5L9.5,18V21H14.5V18L18,14.5V9C18,8 17,7 16,7Z",kC="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",RC="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",IC="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",VC="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",HC="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",DC="M18,18H6V6H18V18Z",FC="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",BC="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",zC="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",UC="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",WC="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",GC="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",qC="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",KC="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",ZC="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",YC="M13,3V9H21V3M13,21H21V11H13M3,21H11V15H3M3,13H11V3H3V13Z",XC="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",JC="M13 3V11H21V3H13M3 21H11V13H3V21M3 3V11H11V3H3M13 16H16V13H18V16H21V18H18V21H16V18H13V16Z",QC="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",e2="M12.89,3L14.85,3.4L11.11,21L9.15,20.6L12.89,3M19.59,12L16,8.41V5.58L22.42,12L16,18.41V15.58L19.59,12M1.58,12L8,5.58V8.41L4.41,12L8,15.58V18.41L1.58,12Z";const ie=K;function K(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).flatMap(r=>typeof r=="string"?r.split(" ").map(o=>{if(o=o.replace(/gjs-/g,"gs-utl-"),!o.includes("gs-utl-")&&!o.startsWith("gs-")){const i=o.split(":"),a=i.pop(),l=i.join(":"),u=a==null?void 0:a.startsWith("!"),f=`gs-utl-${u?a==null?void 0:a.slice(1):a}`,p=u?`!${f}`:f;return l?`${l}:${p}`:p}return o}):r).join(" ")}const k=h.forwardRef(function({as:t,children:n,className:s,col:r,revert:o,full:i,nowrap:a,space:l,gap:u,justify:d,items:f,...p},g){const m=t||"div";return c.jsx(m,{ref:g,className:K([s,"gs-utl-flex",r&&!o&&"gs-utl-flex-col",r&&o&&"gs-utl-flex-col-reverse",!r&&o&&"gs-utl-flex-row-reverse",i&&!r&&"gs-utl-w-full",i&&r&&"gs-utl-h-full",a?"gs-utl-flex-nowrap":"gs-utl-flex-wrap",l==="x2s"&&(r?"gs-utl-space-y-0.5":"gs-utl-space-x-0.5"),l==="xs"&&(r?"gs-utl-space-y-1":"gs-utl-space-x-1"),l==="s"&&(r?"gs-utl-space-y-2":"gs-utl-space-x-2"),l==="m"&&(r?"gs-utl-space-y-4":"gs-utl-space-x-4"),l==="l"&&(r?"gs-utl-space-y-6":"gs-utl-space-x-6"),l==="xl"&&(r?"gs-utl-space-y-8":"gs-utl-space-x-8"),u==="x2s"&&"gs-utl-gap-0.5",u==="xs"&&"gs-utl-gap-1",u==="s"&&"gs-utl-gap-2",u==="m"&&"gs-utl-gap-4",u==="l"&&"gs-utl-gap-6",u==="xl"&&"gs-utl-gap-8",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})}),F=h.forwardRef(function({children:t,className:n,grow:s,...r},o){return c.jsx("div",{ref:o,className:K([n,s&&"flex-1"]),...r,children:t})});function ip(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var Fu={exports:{}},Bu,Jh;function t2(){if(Jh)return Bu;Jh=1;var e="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Bu=e,Bu}var zu,Qh;function n2(){if(Qh)return zu;Qh=1;var e=t2();function t(){}function n(){}return n.resetWarningCache=t,zu=function(){function s(i,a,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}}s.isRequired=s;function r(){return s}var o={array:s,bigint:s,bool:s,func:s,number:s,object:s,string:s,symbol:s,any:s,arrayOf:r,element:s,elementType:s,instanceOf:r,node:s,objectOf:r,oneOf:r,oneOfType:r,shape:r,exact:r,checkPropTypes:n,resetWarningCache:t};return o.PropTypes=o,o},zu}var eg;function s2(){return eg||(eg=1,Fu.exports=n2()()),Fu.exports}var r2=function(e){var t={};function n(s){if(t[s])return t[s].exports;var r=t[s]={i:s,l:!1,exports:{}};return e[s].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(s,r,o){n.o(s,r)||Object.defineProperty(s,r,{enumerable:!0,get:o})},n.r=function(s){typeof Symbol<"u"&&Symbol.toStringTag&&Object.defineProperty(s,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(s,"__esModule",{value:!0})},n.t=function(s,r){if(1&r&&(s=n(s)),8&r||4&r&&typeof s=="object"&&s&&s.__esModule)return s;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:s}),2&r&&typeof s!="string")for(var i in s)n.d(o,i,(function(a){return s[a]}).bind(null,i));return o},n.n=function(s){var r=s&&s.__esModule?function(){return s.default}:function(){return s};return n.d(r,"a",r),r},n.o=function(s,r){return Object.prototype.hasOwnProperty.call(s,r)},n.p="",n(n.s=2)}([function(e,t){e.exports=s2()},function(e,t){e.exports=h},function(e,t,n){n.r(t);var s=n(1),r=n(0),o=function(){return(o=Object.assign||function(m){for(var v,b=1,x=arguments.length;b<x;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},i=function(m,v){var b={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&v.indexOf(x)<0&&(b[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)v.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(b[x[y]]=m[x[y]])}return b},a=0,l=s.forwardRef(function(m,v){var b=m.title,x=b===void 0?null:b,y=m.description,w=y===void 0?null:y,S=m.size,C=S===void 0?null:S,j=m.color,E=j===void 0?"currentColor":j,O=m.horizontal,P=O===void 0?null:O,T=m.vertical,_=T===void 0?null:T,L=m.rotate,N=L===void 0?null:L,V=m.spin,A=V===void 0?null:V,H=m.style,U=H===void 0?{}:H,D=m.children,$=i(m,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var I,R=A!==null&&A,z=s.Children.map(D,function(J){var ee=J;R!==!0&&(R=(A===null?ee.props.spin:A)===!0);var W=ee.props.size;typeof C=="number"&&typeof ee.props.size=="number"&&(W=ee.props.size/C);var Q={size:W,color:E===null?ee.props.color:E,horizontal:P===null?ee.props.horizontal:P,vertical:_===null?ee.props.vertical:_,rotate:N===null?ee.props.rotate:N,spin:A===null?ee.props.spin:A,inStack:!0};return s.cloneElement(ee,Q)});C!==null&&(U.width=typeof C=="string"?C:1.5*C+"rem");var X,Z="stack_labelledby_"+a,Y="stack_describedby_"+a;if(x)I=w?Z+" "+Y:Z;else if(X="presentation",w)throw new Error("title attribute required when description is set");return s.createElement("svg",o({ref:v,viewBox:"0 0 24 24",style:U,role:X,"aria-labelledby":I},$),x&&s.createElement("title",{id:Z},x),w&&s.createElement("desc",{id:Y},w),R&&s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }","@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"),z)});l.displayName="Stack",l.propTypes={size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),children:r.oneOfType([r.arrayOf(r.node),r.node]).isRequired,className:r.string,style:r.object},l.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var u=l;n.d(t,"Icon",function(){return g}),n.d(t,"Stack",function(){return u});var d=function(){return(d=Object.assign||function(m){for(var v,b=1,x=arguments.length;b<x;b++)for(var y in v=arguments[b])Object.prototype.hasOwnProperty.call(v,y)&&(m[y]=v[y]);return m}).apply(this,arguments)},f=function(m,v){var b={};for(var x in m)Object.prototype.hasOwnProperty.call(m,x)&&v.indexOf(x)<0&&(b[x]=m[x]);if(m!=null&&typeof Object.getOwnPropertySymbols=="function"){var y=0;for(x=Object.getOwnPropertySymbols(m);y<x.length;y++)v.indexOf(x[y])<0&&Object.prototype.propertyIsEnumerable.call(m,x[y])&&(b[x[y]]=m[x[y]])}return b},p=0,g=s.forwardRef(function(m,v){var b=m.path,x=m.id,y=x===void 0?++p:x,w=m.title,S=w===void 0?null:w,C=m.description,j=C===void 0?null:C,E=m.size,O=E===void 0?null:E,P=m.color,T=P===void 0?"currentColor":P,_=m.horizontal,L=_!==void 0&&_,N=m.vertical,V=N!==void 0&&N,A=m.rotate,H=A===void 0?0:A,U=m.spin,D=U!==void 0&&U,$=m.style,I=$===void 0?{}:$,R=m.inStack,z=R!==void 0&&R,X=f(m,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),Z={},Y=[];O!==null&&(z?Y.push("scale("+O+")"):(I.width=typeof O=="string"?O:1.5*O+"rem",I.height=I.width)),L&&Y.push("scaleX(-1)"),V&&Y.push("scaleY(-1)"),H!==0&&Y.push("rotate("+H+"deg)"),T!==null&&(Z.fill=T);var J=s.createElement("path",d({d:b,style:Z},z?X:{})),ee=J;Y.length>0&&(I.transform=Y.join(" "),I.transformOrigin="center",z&&(ee=s.createElement("g",{style:I},J,s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var W,Q=ee,ae=D===!0||typeof D!="number"?2:D,ge=!z&&(L||V);if(ae<0&&(ge=!ge),D&&(Q=s.createElement("g",{style:{animation:"spin"+(ge?"-inverse":"")+" linear "+Math.abs(ae)+"s infinite",transformOrigin:"center"}},ee,!(L||V||H!==0)&&s.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),z)return Q;var Ce,Se="icon_labelledby_"+y,et="icon_describedby_"+y;if(S)W=j?Se+" "+et:Se;else if(Ce="presentation",j)throw new Error("title attribute required when description is set");return s.createElement("svg",d({ref:v,viewBox:"0 0 24 24",style:I,role:Ce,"aria-labelledby":W},X),S&&s.createElement("title",{id:Se},S),j&&s.createElement("desc",{id:et},j),!z&&D&&(ge?s.createElement("style",null,"@keyframes spin-inverse { from { transform: rotate(0deg) } to { transform: rotate(-360deg) } }"):s.createElement("style",null,"@keyframes spin { from { transform: rotate(0deg) } to { transform: rotate(360deg) } }")),Q)});g.displayName="Icon",g.propTypes={path:r.string.isRequired,size:r.oneOfType([r.number,r.string]),color:r.string,horizontal:r.bool,vertical:r.bool,rotate:r.number,spin:r.oneOfType([r.bool,r.number]),style:r.object,inStack:r.bool,className:r.string},g.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=g}]);const Ji=ip(r2);var Ev={exports:{}};/*!
|
|
35
2
|
Copyright (c) 2018 Jed Watson.
|
|
36
3
|
Licensed under the MIT License (MIT), see
|
|
37
4
|
http://jedwatson.github.io/classnames
|
|
38
|
-
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",i=0;i<arguments.length;i++){var a=arguments[i];a&&(o=r(o,s(a)))}return o}function s(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var i="";for(var a in o)t.call(o,a)&&o[a]&&(i=r(i,a));return i}function r(o,i){return i?o?o+" "+i:o+i:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(
|
|
39
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function
|
|
40
|
-
The field is already decorated with '@`+r+"'.")+`
|
|
41
|
-
Re-decorating fields is not allowed.
|
|
42
|
-
Use '@override' decorator for methods overridden by subclass.`)}}function vC(e){return Wn(e,un)||Aa(e,un,sr({},e[un])),e[un]}function Ma(e){return typeof e=="object"&&typeof e.kind=="string"}function Lc(e,t){te.NODE_ENV!=="production"&&!t.includes(e.kind)&&me("The decorator applied to '"+String(e.name)+"' cannot be used on a "+e.kind+" element")}var Ce=Symbol("mobx administration"),Br=function(){function e(n){n===void 0&&(n=te.NODE_ENV!=="production"?"Atom@"+us():"Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=qe.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.reportObserved=function(){return Ub(this)},t.reportChanged=function(){Hn(),Wb(this),Fn()},t.toString=function(){return this.name_},Si(e,[{key:"isBeingObserved",get:function(){return wn(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return wn(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return wn(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Sn(this.flags_,e.diffValueMask_,s===1)}}])}();Br.isBeingObservedMask_=1;Br.isPendingUnobservationMask_=2;Br.diffValueMask_=4;var Wf=Fr("Atom",Br);function Ob(e,t,n){t===void 0&&(t=Zo),n===void 0&&(n=Zo);var s=new Br(e);return t!==Zo&&Lj(s,t),n!==Zo&&Xb(s,n),s}function yC(e,t){return e===t}function xC(e,t){return Qf(e,t)}function wC(e,t){return Qf(e,t,1)}function SC(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var rc={identity:yC,structural:xC,default:SC,shallow:wC};function yo(e,t,n){return ci(e)?e:Array.isArray(e)?zt.array(e,{name:n}):jn(e)?zt.object(e,void 0,{name:n}):wi(e)?zt.map(e,{name:n}):Ys(e)?zt.set(e,{name:n}):typeof e=="function"&&!li(e)&&!fa(e)?jb(e)?So(e):da(n,e):e}function CC(e,t,n){if(e==null||No(e)||Va(e)||dr(e)||ns(e))return e;if(Array.isArray(e))return zt.array(e,{name:n,deep:!1});if(jn(e))return zt.object(e,void 0,{name:n,deep:!1});if(wi(e))return zt.map(e,{name:n,deep:!1});if(Ys(e))return zt.set(e,{name:n,deep:!1});te.NODE_ENV!=="production"&&me("The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets")}function Rc(e){return e}function jC(e,t){return te.NODE_ENV!=="production"&&ci(e)&&me("observable.struct should not be used with observable values"),Qf(e,t)?t:e}var EC="override";function oc(e){return e.annotationType_===EC}function La(e,t){return{annotationType_:e,options_:t,make_:PC,extend_:_C,decorate_20223_:TC}}function PC(e,t,n,s){var r;if((r=this.options_)!=null&&r.bound)return this.extend_(e,t,n,!1)===null?0:1;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(li(n.value))return 1;var o=Ab(e,this,t,n,!1);return Ms(s,t,o),2}function _C(e,t,n,s){var r=Ab(e,this,t,n);return e.defineProperty_(t,r,s)}function TC(e,t){te.NODE_ENV!=="production"&&Lc(t,["method","field"]);var n=t.kind,s=t.name,r=t.addInitializer,o=this,i=function(u){var d,f,p,g;return xo((d=(f=o.options_)==null?void 0:f.name)!=null?d:s.toString(),u,(p=(g=o.options_)==null?void 0:g.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,d=l;return li(d)||(d=i(d)),(u=o.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var a;return li(e)||(e=i(e)),(a=this.options_)!=null&&a.bound&&r(function(){var l=this,u=l[s].bind(l);u.isMobxAction=!0,l[s]=u}),e}me("Cannot apply '"+o.annotationType_+"' to '"+String(s)+"' (kind: "+n+"):"+(`
|
|
43
|
-
'`+o.annotationType_+"' can only be used on properties with a function value."))}function OC(e,t,n,s){var r=t.annotationType_,o=s.value;te.NODE_ENV!=="production"&&!Rt(o)&&me("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
44
|
-
'`+r+"' can only be used on properties with a function value."))}function Ab(e,t,n,s,r){var o,i,a,l,u,d,f;r===void 0&&(r=ce.safeDescriptors),OC(e,t,n,s);var p=s.value;if((o=t.options_)!=null&&o.bound){var g;p=p.bind((g=e.proxy_)!=null?g:e.target_)}return{value:xo((i=(a=t.options_)==null?void 0:a.name)!=null?i: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:r?e.isPlainObject_:!0,enumerable:!1,writable:!r}}function Nb(e,t){return{annotationType_:e,options_:t,make_:AC,extend_:NC,decorate_20223_:MC}}function AC(e,t,n,s){var r;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((r=this.options_)!=null&&r.bound&&(!Wn(e.target_,t)||!fa(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(fa(n.value))return 1;var o=Mb(e,this,t,n,!1,!1);return Ms(s,t,o),2}function NC(e,t,n,s){var r,o=Mb(e,this,t,n,(r=this.options_)==null?void 0:r.bound);return e.defineProperty_(t,o,s)}function MC(e,t){var n;te.NODE_ENV!=="production"&&Lc(t,["method"]);var s=t.name,r=t.addInitializer;return fa(e)||(e=So(e)),(n=this.options_)!=null&&n.bound&&r(function(){var o=this,i=o[s].bind(o);i.isMobXFlow=!0,o[s]=i}),e}function LC(e,t,n,s){var r=t.annotationType_,o=s.value;te.NODE_ENV!=="production"&&!Rt(o)&&me("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
45
|
-
'`+r+"' can only be used on properties with a generator function value."))}function Mb(e,t,n,s,r,o){o===void 0&&(o=ce.safeDescriptors),LC(e,t,n,s);var i=s.value;if(fa(i)||(i=So(i)),r){var a;i=i.bind((a=e.proxy_)!=null?a:e.target_),i.isMobXFlow=!0}return{value:i,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function Gf(e,t){return{annotationType_:e,options_:t,make_:RC,extend_:$C,decorate_20223_:kC}}function RC(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function $C(e,t,n,s){return VC(e,this,t,n),e.defineComputedProperty_(t,sr({},this.options_,{get:n.get,set:n.set}),s)}function kC(e,t){te.NODE_ENV!=="production"&&Lc(t,["getter"]);var n=this,s=t.name,r=t.addInitializer;return r(function(){var o=Ao(this)[Ce],i=sr({},n.options_,{get:e,context:this});i.name||(i.name=te.NODE_ENV!=="production"?o.name_+"."+s.toString():"ObservableObject."+s.toString()),o.values_.set(s,new Kn(i))}),function(){return this[Ce].getObservablePropValue_(s)}}function VC(e,t,n,s){var r=t.annotationType_,o=s.get;te.NODE_ENV!=="production"&&!o&&me("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
46
|
-
'`+r+"' can only be used on getter(+setter) properties."))}function $c(e,t){return{annotationType_:e,options_:t,make_:IC,extend_:DC,decorate_20223_:HC}}function IC(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function DC(e,t,n,s){var r,o;return FC(e,this,t,n),e.defineObservableProperty_(t,n.value,(r=(o=this.options_)==null?void 0:o.enhancer)!=null?r:yo,s)}function HC(e,t){if(te.NODE_ENV!=="production"){if(t.kind==="field")throw me("Please use `@observable accessor "+String(t.name)+"` instead of `@observable "+String(t.name)+"`");Lc(t,["accessor"])}var n=this,s=t.kind,r=t.name,o=new WeakSet;function i(a,l){var u,d,f=Ao(a)[Ce],p=new Mr(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:yo,te.NODE_ENV!=="production"?f.name_+"."+r.toString():"ObservableObject."+r.toString(),!1);f.values_.set(r,p),o.add(a)}if(s=="accessor")return{get:function(){return o.has(this)||i(this,e.get.call(this)),this[Ce].getObservablePropValue_(r)},set:function(l){return o.has(this)||i(this,l),this[Ce].setObservablePropValue_(r,l)},init:function(l){return o.has(this)||i(this,l),l}}}function FC(e,t,n,s){var r=t.annotationType_;te.NODE_ENV!=="production"&&!("value"in s)&&me("Cannot apply '"+r+"' to '"+e.name_+"."+n.toString()+"':"+(`
|
|
47
|
-
'`+r+"' cannot be used on getter/setter properties"))}var BC="true",zC=Lb();function Lb(e){return{annotationType_:BC,options_:e,make_:UC,extend_:WC,decorate_20223_:GC}}function UC(e,t,n,s){var r,o;if(n.get)return kc.make_(e,t,n,s);if(n.set){var i=xo(t.toString(),n.set);return s===e.target_?e.defineProperty_(t,{configurable:ce.safeDescriptors?e.isPlainObject_:!0,set:i})===null?0:2:(Ms(s,t,{configurable:!0,set:i}),2)}if(s!==e.target_&&typeof n.value=="function"){var a;if(jb(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?So.bound:So;return u.make_(e,t,n,s)}var d=(a=this.options_)!=null&&a.autoBind?da.bound:da;return d.make_(e,t,n,s)}var f=((r=this.options_)==null?void 0:r.deep)===!1?zt.ref:zt;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return f.make_(e,t,n,s)}function WC(e,t,n,s){var r,o;if(n.get)return kc.extend_(e,t,n,s);if(n.set)return e.defineProperty_(t,{configurable:ce.safeDescriptors?e.isPlainObject_:!0,set:xo(t.toString(),n.set)},s);if(typeof n.value=="function"&&(r=this.options_)!=null&&r.autoBind){var i;n.value=n.value.bind((i=e.proxy_)!=null?i:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?zt.ref:zt;return a.extend_(e,t,n,s)}function GC(e,t){me("'"+this.annotationType_+"' cannot be used as a decorator")}var qC="observable",KC="observable.ref",YC="observable.shallow",ZC="observable.struct",Rb={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Rb);function ul(e){return e||Rb}var Fd=$c(qC),XC=$c(KC,{enhancer:Rc}),JC=$c(YC,{enhancer:CC}),QC=$c(ZC,{enhancer:jC}),$b=Ls(Fd);function dl(e){return e.deep===!0?yo:e.deep===!1?Rc:tj(e.defaultDecorator)}function ej(e){var t;return e?(t=e.defaultDecorator)!=null?t:Lb(e):void 0}function tj(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:yo}function kb(e,t,n){if(Ma(t))return Fd.decorate_20223_(e,t);if(vo(t)){Na(e,t,Fd);return}return ci(e)?e:jn(e)?zt.object(e,t,n):Array.isArray(e)?zt.array(e,t):wi(e)?zt.map(e,t):Ys(e)?zt.set(e,t):typeof e=="object"&&e!==null?e:zt.box(e,t)}wb(kb,$b);var nj={box:function(t,n){var s=ul(n);return new Mr(t,dl(s),s.name,!0,s.equals)},array:function(t,n){var s=ul(n);return(ce.useProxies===!1||s.proxy===!1?oE:Yj)(t,dl(s),s.name)},map:function(t,n){var s=ul(n);return new rv(t,dl(s),s.name)},set:function(t,n){var s=ul(n);return new ov(t,dl(s),s.name)},object:function(t,n,s){return zr(function(){return Qb(ce.useProxies===!1||(s==null?void 0:s.proxy)===!1?Ao({},s):Wj({},s),t,n)})},ref:Ls(XC),shallow:Ls(JC),deep:$b,struct:Ls(QC)},zt=wb(kb,nj),Vb="computed",sj="computed.struct",Bd=Gf(Vb),rj=Gf(sj,{equals:rc.structural}),kc=function(t,n){if(Ma(n))return Bd.decorate_20223_(t,n);if(vo(n))return Na(t,n,Bd);if(jn(t))return Ls(Gf(Vb,t));te.NODE_ENV!=="production"&&(Rt(t)||me("First argument to `computed` should be an expression."),Rt(n)&&me("A setter as second argument is no longer supported, use `{ set: fn }` option instead"));var s=jn(n)?n:{};return s.get=t,s.name||(s.name=t.name||""),new Kn(s)};Object.assign(kc,Bd);kc.struct=Ls(rj);var Hh,Fh,ic=0,oj=1,ij=(Hh=(Fh=nc(function(){},"name"))==null?void 0:Fh.configurable)!=null?Hh:!1,Bh={value:"action",configurable:!0,writable:!1,enumerable:!1};function xo(e,t,n,s){n===void 0&&(n=!1),te.NODE_ENV!=="production"&&(Rt(t)||me("`action` can only be invoked on functions"),(typeof e!="string"||!e)&&me("actions should have valid names, got: '"+e+"'"));function r(){return aj(e,n,t,s||this,arguments)}return r.isMobxAction=!0,r.toString=function(){return t.toString()},ij&&(Bh.value=e,Ms(r,"name",Bh)),r}function aj(e,t,n,s,r){var o=lj(e,t,s,r);try{return n.apply(s,r)}catch(i){throw o.error_=i,i}finally{cj(o)}}function lj(e,t,n,s){var r=te.NODE_ENV!=="production"&&Ut()&&!!e,o=0;if(te.NODE_ENV!=="production"&&r){o=Date.now();var i=s?Array.from(s):sc;En({type:Zf,name:e,object:n,arguments:i})}var a=ce.trackingDerivation,l=!t||!a;Hn();var u=ce.allowStateChanges;l&&(Oo(),u=qf(!0));var d=Yf(!0),f={runAsAction_:l,prevDerivation_:a,prevAllowStateChanges_:u,prevAllowStateReads_:d,notifySpy_:r,startTime_:o,actionId_:oj++,parentActionId_:ic};return ic=f.actionId_,f}function cj(e){ic!==e.actionId_&&me(30),ic=e.parentActionId_,e.error_!==void 0&&(ce.suppressReactionErrors=!0),Kf(e.prevAllowStateChanges_),Zi(e.prevAllowStateReads_),Fn(),e.runAsAction_&&tr(e.prevDerivation_),te.NODE_ENV!=="production"&&e.notifySpy_&&Pn({time:Date.now()-e.startTime_}),ce.suppressReactionErrors=!1}function qf(e){var t=ce.allowStateChanges;return ce.allowStateChanges=e,t}function Kf(e){ce.allowStateChanges=e}var uj="create",Mr=function(e){function t(s,r,o,i,a){var l;return o===void 0&&(o=te.NODE_ENV!=="production"?"ObservableValue@"+us():"ObservableValue"),i===void 0&&(i=!0),a===void 0&&(a=rc.default),l=e.call(this,o)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=r,l.name_=o,l.equals=a,l.value_=r(s,void 0,o),te.NODE_ENV!=="production"&&i&&Ut()&&wo({type:uj,object:l,observableKind:"value",debugObjectName:l.name_,newValue:""+l.value_}),l}Tb(t,e);var n=t.prototype;return n.dehanceValue=function(r){return this.dehancer!==void 0?this.dehancer(r):r},n.set=function(r){var o=this.value_;if(r=this.prepareNewValue_(r),r!==ce.UNCHANGED){var i=Ut();te.NODE_ENV!=="production"&&i&&En({type:ss,object:this,observableKind:"value",debugObjectName:this.name_,newValue:r,oldValue:o}),this.setNewValue_(r),te.NODE_ENV!=="production"&&i&&Pn()}},n.prepareNewValue_=function(r){if(Os(this),Vn(this)){var o=In(this,{object:this,type:ss,newValue:r});if(!o)return ce.UNCHANGED;r=o.newValue}return r=this.enhancer(r,this.value_,this.name_),this.equals(this.value_,r)?ce.UNCHANGED:r},n.setNewValue_=function(r){var o=this.value_;this.value_=r,this.reportChanged(),rs(this)&&os(this,{type:ss,object:this,newValue:r,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(r){return $a(this,r)},n.observe_=function(r,o){return o&&r({observableKind:"value",debugObjectName:this.name_,object:this,type:ss,newValue:this.value_,oldValue:void 0}),ka(this,r)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return _b(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Br),dj=Fr("ObservableValue",Mr),Kn=function(){function e(n){this.dependenciesState_=qe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=qe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new ac(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=Gn.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||me(31),this.derivation=n.get,this.name_=n.name||(te.NODE_ENV!=="production"?"ComputedValue@"+us():"ComputedValue"),n.set&&(this.setter_=xo(te.NODE_ENV!=="production"?this.name_+"-setter":"ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?rc.structural:rc.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){vj(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.get=function(){if(this.isComputing&&me(32,this.name_,this.derivation),ce.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)zd(this)&&(this.warnAboutUntrackedRead_(),Hn(),this.value_=this.computeValue_(!1),Fn());else if(Ub(this),zd(this)){var s=ce.trackingContext;this.keepAlive_&&!s&&(ce.trackingContext=this),this.trackAndCompute()&&bj(this),ce.trackingContext=s}var r=this.value_;if(ql(r))throw r.cause;return r},t.set=function(s){if(this.setter_){this.isRunningSetter&&me(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,s)}finally{this.isRunningSetter=!1}}else me(34,this.name_)},t.trackAndCompute=function(){var s=this.value_,r=this.dependenciesState_===qe.NOT_TRACKING_,o=this.computeValue_(!0),i=r||ql(s)||ql(o)||!this.equals_(s,o);return i&&(this.value_=o,te.NODE_ENV!=="production"&&Ut()&&wo({observableKind:"computed",debugObjectName:this.name_,object:this.scope_,type:"update",oldValue:s,newValue:o})),i},t.computeValue_=function(s){this.isComputing=!0;var r=qf(!1),o;if(s)o=Ib(this,this.derivation,this.scope_);else if(ce.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(i){o=new ac(i)}return Kf(r),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(Ud(this),this.value_=void 0,te.NODE_ENV!=="production"&&this.isTracing_!==Gn.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' was suspended and it will recompute on the next access."))},t.observe_=function(s,r){var o=this,i=!0,a=void 0;return Tj(function(){var l=o.get();if(!i||r){var u=Oo();s({observableKind:"computed",debugObjectName:o.name_,type:ss,object:o,newValue:l,oldValue:a}),tr(u)}i=!1,a=l})},t.warnAboutUntrackedRead_=function(){te.NODE_ENV!=="production"&&(this.isTracing_!==Gn.NONE&&console.log("[mobx.trace] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."),(typeof this.requiresReaction_=="boolean"?this.requiresReaction_:ce.computedRequiresReaction)&&console.warn("[mobx] Computed value '"+this.name_+"' is being read outside a reactive context. Doing a full recompute."))},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return _b(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Si(e,[{key:"isComputing",get:function(){return wn(this.flags_,e.isComputingMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isComputingMask_,s)}},{key:"isRunningSetter",get:function(){return wn(this.flags_,e.isRunningSetterMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isRunningSetterMask_,s)}},{key:"isBeingObserved",get:function(){return wn(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return wn(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return wn(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Sn(this.flags_,e.diffValueMask_,s===1)}}])}();Kn.isComputingMask_=1;Kn.isRunningSetterMask_=2;Kn.isBeingObservedMask_=4;Kn.isPendingUnobservationMask_=8;Kn.diffValueMask_=16;var Ra=Fr("ComputedValue",Kn),qe;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(qe||(qe={}));var Gn;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(Gn||(Gn={}));var ac=function(t){this.cause=void 0,this.cause=t};function ql(e){return e instanceof ac}function zd(e){switch(e.dependenciesState_){case qe.UP_TO_DATE_:return!1;case qe.NOT_TRACKING_:case qe.STALE_:return!0;case qe.POSSIBLY_STALE_:{for(var t=Yf(!0),n=Oo(),s=e.observing_,r=s.length,o=0;o<r;o++){var i=s[o];if(Ra(i)){if(ce.disableErrorBoundaries)i.get();else try{i.get()}catch{return tr(n),Zi(t),!0}if(e.dependenciesState_===qe.STALE_)return tr(n),Zi(t),!0}}return Hb(e),tr(n),Zi(t),!1}}}function Os(e){if(te.NODE_ENV!=="production"){var t=e.observers_.size>0;!ce.allowStateChanges&&(t||ce.enforceActions==="always")&&console.warn("[MobX] "+(ce.enforceActions?"Since strict-mode is enabled, changing (observed) observable values without using an action is not allowed. Tried to modify: ":"Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, a computed value or the render function of a React component? You can wrap side effects in 'runInAction' (or decorate functions with 'action') if needed. Tried to modify: ")+e.name_)}}function fj(e){te.NODE_ENV!=="production"&&!ce.allowStateReads&&ce.observableRequiresReaction&&console.warn("[mobx] Observable '"+e.name_+"' being read outside a reactive context.")}function Ib(e,t,n){var s=Yf(!0);Hb(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++ce.runId;var r=ce.trackingDerivation;ce.trackingDerivation=e,ce.inBatch++;var o;if(ce.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(i){o=new ac(i)}return ce.inBatch--,ce.trackingDerivation=r,hj(e),pj(e),Zi(s),o}function pj(e){te.NODE_ENV!=="production"&&e.observing_.length===0&&(typeof e.requiresObservable_=="boolean"?e.requiresObservable_:ce.reactionRequiresObservable)&&console.warn("[mobx] Derivation '"+e.name_+"' is created/updated without reading any observable value.")}function hj(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,s=qe.UP_TO_DATE_,r=0,o=e.unboundDepsCount_,i=0;i<o;i++){var a=n[i];a.diffValue===0&&(a.diffValue=1,r!==i&&(n[r]=a),r++),a.dependenciesState_>s&&(s=a.dependenciesState_)}for(n.length=r,e.newObserving_=null,o=t.length;o--;){var l=t[o];l.diffValue===0&&Bb(l,e),l.diffValue=0}for(;r--;){var u=n[r];u.diffValue===1&&(u.diffValue=0,mj(u,e))}s!==qe.UP_TO_DATE_&&(e.dependenciesState_=s,e.onBecomeStale_())}function Ud(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Bb(t[n],e);e.dependenciesState_=qe.NOT_TRACKING_}function Db(e){var t=Oo();try{return e()}finally{tr(t)}}function Oo(){var e=ce.trackingDerivation;return ce.trackingDerivation=null,e}function tr(e){ce.trackingDerivation=e}function Yf(e){var t=ce.allowStateReads;return ce.allowStateReads=e,t}function Zi(e){ce.allowStateReads=e}function Hb(e){if(e.dependenciesState_!==qe.UP_TO_DATE_){e.dependenciesState_=qe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=qe.UP_TO_DATE_}}var Kl=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},Yl=!0,Fb=!1,ce=function(){var e=Nc();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(Yl=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new Kl().version&&(Yl=!1),Yl?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new Kl):(setTimeout(function(){Fb||me(35)},1),new Kl)}();function gj(){if((ce.pendingReactions.length||ce.inBatch||ce.isRunningReactions)&&me(36),Fb=!0,Yl){var e=Nc();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),ce=new Kl}}function mj(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Bb(e,t){e.observers_.delete(t),e.observers_.size===0&&zb(e)}function zb(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,ce.pendingUnobservations.push(e))}function Hn(){ce.inBatch++}function Fn(){if(--ce.inBatch===0){Kb();for(var e=ce.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_())}ce.pendingUnobservations=[]}}function Ub(e){fj(e);var t=ce.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&ce.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&ce.inBatch>0&&zb(e),!1)}function Wb(e){e.lowestObserverState_!==qe.STALE_&&(e.lowestObserverState_=qe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===qe.UP_TO_DATE_&&(te.NODE_ENV!=="production"&&t.isTracing_!==Gn.NONE&&Gb(t,e),t.onBecomeStale_()),t.dependenciesState_=qe.STALE_}))}function bj(e){e.lowestObserverState_!==qe.STALE_&&(e.lowestObserverState_=qe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===qe.POSSIBLY_STALE_?(t.dependenciesState_=qe.STALE_,te.NODE_ENV!=="production"&&t.isTracing_!==Gn.NONE&&Gb(t,e)):t.dependenciesState_===qe.UP_TO_DATE_&&(e.lowestObserverState_=qe.UP_TO_DATE_)}))}function vj(e){e.lowestObserverState_===qe.UP_TO_DATE_&&(e.lowestObserverState_=qe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===qe.UP_TO_DATE_&&(t.dependenciesState_=qe.POSSIBLY_STALE_,t.onBecomeStale_())}))}function Gb(e,t){if(console.log("[mobx.trace] '"+e.name_+"' is invalidated due to a change in: '"+t.name_+"'"),e.isTracing_===Gn.BREAK){var n=[];qb(ev(e),n,1),new Function(`debugger;
|
|
48
|
-
/*
|
|
49
|
-
Tracing '`+e.name_+`'
|
|
50
|
-
|
|
51
|
-
You are entering this break point because derivation '`+e.name_+"' is being traced and '"+t.name_+`' is now forcing it to update.
|
|
52
|
-
Just follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update
|
|
53
|
-
The stackframe you are looking for is at least ~6-8 stack-frames up.
|
|
54
|
-
|
|
55
|
-
`+(e instanceof Kn?e.derivation.toString().replace(/[*]\//g,"/"):"")+`
|
|
56
|
-
|
|
57
|
-
The dependencies for this derivation are:
|
|
58
|
-
|
|
59
|
-
`+n.join(`
|
|
60
|
-
`)+`
|
|
61
|
-
*/
|
|
62
|
-
`)()}}function qb(e,t,n){if(t.length>=1e3){t.push("(and many more)");return}t.push(""+" ".repeat(n-1)+e.name),e.dependencies&&e.dependencies.forEach(function(s){return qb(s,t,n+1)})}var rr=function(){function e(n,s,r,o){n===void 0&&(n=te.NODE_ENV!=="production"?"Reaction@"+us():"Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=qe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=Gn.NONE,this.name_=n,this.onInvalidate_=s,this.errorHandler_=r,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,ce.pendingReactions.push(this),Kb())},t.runReaction_=function(){if(!this.isDisposed){Hn(),this.isScheduled=!1;var s=ce.trackingContext;if(ce.trackingContext=this,zd(this)){this.isTrackPending=!0;try{this.onInvalidate_(),te.NODE_ENV!=="production"&&this.isTrackPending&&Ut()&&wo({name:this.name_,type:"scheduled-reaction"})}catch(r){this.reportExceptionInDerivation_(r)}}ce.trackingContext=s,Fn()}},t.track=function(s){if(!this.isDisposed){Hn();var r=Ut(),o;te.NODE_ENV!=="production"&&r&&(o=Date.now(),En({name:this.name_,type:"reaction"})),this.isRunning=!0;var i=ce.trackingContext;ce.trackingContext=this;var a=Ib(this,s,void 0);ce.trackingContext=i,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&Ud(this),ql(a)&&this.reportExceptionInDerivation_(a.cause),te.NODE_ENV!=="production"&&r&&Pn({time:Date.now()-o}),Fn()}},t.reportExceptionInDerivation_=function(s){var r=this;if(this.errorHandler_){this.errorHandler_(s,this);return}if(ce.disableErrorBoundaries)throw s;var o=te.NODE_ENV!=="production"?"[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '"+this+"'":"[mobx] uncaught error in '"+this+"'";ce.suppressReactionErrors?te.NODE_ENV!=="production"&&console.warn("[mobx] (error in reaction '"+this.name_+"' suppressed, fix error of causing action below)"):console.error(o,s),te.NODE_ENV!=="production"&&Ut()&&wo({type:"error",name:this.name_,message:o,error:""+s}),ce.globalReactionErrorHandlers.forEach(function(i){return i(s,r)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(Hn(),Ud(this),Fn()))},t.getDisposer_=function(s){var r=this,o=function i(){r.dispose(),s==null||s.removeEventListener==null||s.removeEventListener("abort",i)};return s==null||s.addEventListener==null||s.addEventListener("abort",o),o[Ce]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(s){s===void 0&&(s=!1),Bj(this,s)},Si(e,[{key:"isDisposed",get:function(){return wn(this.flags_,e.isDisposedMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isDisposedMask_,s)}},{key:"isScheduled",get:function(){return wn(this.flags_,e.isScheduledMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isScheduledMask_,s)}},{key:"isTrackPending",get:function(){return wn(this.flags_,e.isTrackPendingMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isTrackPendingMask_,s)}},{key:"isRunning",get:function(){return wn(this.flags_,e.isRunningMask_)},set:function(s){this.flags_=Sn(this.flags_,e.isRunningMask_,s)}},{key:"diffValue",get:function(){return wn(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=Sn(this.flags_,e.diffValueMask_,s===1)}}])}();rr.isDisposedMask_=1;rr.isScheduledMask_=2;rr.isTrackPendingMask_=4;rr.isRunningMask_=8;rr.diffValueMask_=16;var zh=100,Wd=function(t){return t()};function Kb(){ce.inBatch>0||ce.isRunningReactions||Wd(yj)}function yj(){ce.isRunningReactions=!0;for(var e=ce.pendingReactions,t=0;e.length>0;){++t===zh&&(console.error(te.NODE_ENV!=="production"?"Reaction doesn't converge to a stable state after "+zh+" iterations."+(" Probably there is a cycle in the reactive function: "+e[0]):"[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),s=0,r=n.length;s<r;s++)n[s].runReaction_()}ce.isRunningReactions=!1}var lc=Fr("Reaction",rr);function xj(e){var t=Wd;Wd=function(s){return e(function(){return t(s)})}}function Ut(){return te.NODE_ENV!=="production"&&!!ce.spyListeners.length}function wo(e){if(te.NODE_ENV!=="production"&&ce.spyListeners.length)for(var t=ce.spyListeners,n=0,s=t.length;n<s;n++)t[n](e)}function En(e){if(te.NODE_ENV!=="production"){var t=sr({},e,{spyReportStart:!0});wo(t)}}var wj={type:"report-end",spyReportEnd:!0};function Pn(e){te.NODE_ENV!=="production"&&wo(e?sr({},e,{type:"report-end",spyReportEnd:!0}):wj)}function Sj(e){return te.NODE_ENV==="production"?(console.warn("[mobx.spy] Is a no-op in production builds"),function(){}):(ce.spyListeners.push(e),Uf(function(){ce.spyListeners=ce.spyListeners.filter(function(t){return t!==e})}))}var Zf="action",Cj="action.bound",Yb="autoAction",jj="autoAction.bound",Ej="<unnamed action>",Gd=La(Zf),Pj=La(Cj,{bound:!0}),qd=La(Yb,{autoAction:!0}),_j=La(jj,{autoAction:!0,bound:!0});function Zb(e){var t=function(s,r){if(Rt(s))return xo(s.name||Ej,s,e);if(Rt(r))return xo(s,r,e);if(Ma(r))return(e?qd:Gd).decorate_20223_(s,r);if(vo(r))return Na(s,r,e?qd:Gd);if(vo(s))return Ls(La(e?Yb:Zf,{name:s,autoAction:e}));te.NODE_ENV!=="production"&&me("Invalid arguments for `action`")};return t}var Jo=Zb(!1);Object.assign(Jo,Gd);var da=Zb(!0);Object.assign(da,qd);Jo.bound=Ls(Pj);da.bound=Ls(_j);function li(e){return Rt(e)&&e.isMobxAction===!0}function Tj(e,t){var n,s,r,o;t===void 0&&(t=Sb),te.NODE_ENV!=="production"&&(Rt(e)||me("Autorun expects a function as first argument"),li(e)&&me("Autorun does not accept actions since actions are untrackable"));var i=(n=(s=t)==null?void 0:s.name)!=null?n:te.NODE_ENV!=="production"?e.name||"Autorun@"+us():"Autorun",a=!t.scheduler&&!t.delay,l;if(a)l=new rr(i,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=Aj(t),d=!1;l=new rr(i,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(f)}))},t.onError,t.requiresObservable)}function f(){e(l)}return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||l.schedule_(),l.getDisposer_((o=t)==null?void 0:o.signal)}var Oj=function(t){return t()};function Aj(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Oj}var Nj="onBO",Mj="onBUO";function Lj(e,t,n){return Jb(Nj,e,t,n)}function Xb(e,t,n){return Jb(Mj,e,t,n)}function Jb(e,t,n,s){var r=ui(t),o=Rt(s)?s:n,i=e+"L";return r[i]?r[i].add(o):r[i]=new Set([o]),function(){var a=r[i];a&&(a.delete(o),a.size===0&&delete r[i])}}var Rj="never",fl="always",$j="observed";function kj(e){e.isolateGlobalState===!0&&gj();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(ce.useProxies=t===fl?!0:t===Rj?!1:typeof Proxy<"u"),t==="ifavailable"&&(ce.verifyProxies=!0),n!==void 0){var s=n===fl?fl:n===$j;ce.enforceActions=s,ce.allowStateChanges=!(s===!0||s===fl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(r){r in e&&(ce[r]=!!e[r])}),ce.allowStateReads=!ce.observableRequiresReaction,te.NODE_ENV!=="production"&&ce.disableErrorBoundaries===!0&&console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."),e.reactionScheduler&&xj(e.reactionScheduler)}function Qb(e,t,n,s){te.NODE_ENV!=="production"&&(arguments.length>4&&me("'extendObservable' expected 2-4 arguments"),typeof e!="object"&&me("'extendObservable' expects an object as first argument"),dr(e)&&me("'extendObservable' should not be used on maps, use map.merge instead"),jn(t)||me("'extendObservable' only accepts plain objects as second argument"),(ci(t)||ci(n))&&me("Extending an object with another observable (object) is not supported"));var r=fC(t);return zr(function(){var o=Ao(e,s)[Ce];ai(r).forEach(function(i){o.extend_(i,r[i],n&&i in n?n[i]:!0)})}),e}function ev(e,t){return tv(ui(e,t))}function tv(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=Vj(e.observing_).map(tv)),t}function Vj(e){return Array.from(new Set(e))}var Ij=0;function nv(){this.message="FLOW_CANCELLED"}nv.prototype=Object.create(Error.prototype);var Mu=Nb("flow"),Dj=Nb("flow.bound",{bound:!0}),So=Object.assign(function(t,n){if(Ma(n))return Mu.decorate_20223_(t,n);if(vo(n))return Na(t,n,Mu);te.NODE_ENV!=="production"&&arguments.length!==1&&me("Flow expects single argument with generator function");var s=t,r=s.name||"<unnamed flow>",o=function(){var a=this,l=arguments,u=++Ij,d=Jo(r+" - runid: "+u+" - init",s).apply(a,l),f,p=void 0,g=new Promise(function(m,b){var v=0;f=b;function x(S){p=void 0;var C;try{C=Jo(r+" - runid: "+u+" - yield "+v++,d.next).call(d,S)}catch(j){return b(j)}w(C)}function y(S){p=void 0;var C;try{C=Jo(r+" - runid: "+u+" - yield "+v++,d.throw).call(d,S)}catch(j){return b(j)}w(C)}function w(S){if(Rt(S==null?void 0:S.then)){S.then(w,b);return}return S.done?m(S.value):(p=Promise.resolve(S.value),p.then(x,y))}x(void 0)});return g.cancel=Jo(r+" - runid: "+u+" - cancel",function(){try{p&&Uh(p);var m=d.return(void 0),b=Promise.resolve(m.value);b.then(Zo,Zo),Uh(b),f(new nv)}catch(v){f(v)}}),g};return o.isMobXFlow=!0,o},Mu);So.bound=Ls(Dj);function Uh(e){Rt(e.cancel)&&e.cancel()}function fa(e){return(e==null?void 0:e.isMobXFlow)===!0}function Hj(e,t){return e?No(e)||!!e[Ce]||Wf(e)||lc(e)||Ra(e):!1}function ci(e){return te.NODE_ENV!=="production"&&arguments.length!==1&&me("isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"),Hj(e)}function Fj(e){if(No(e))return e[Ce].ownKeys_();me(38)}function pl(e,t,n){return e.set(t,n),n}function qo(e,t){if(e==null||typeof e!="object"||e instanceof Date||!ci(e))return e;if(dj(e)||Ra(e))return qo(e.get(),t);if(t.has(e))return t.get(e);if(Va(e)){var n=pl(t,e,new Array(e.length));return e.forEach(function(i,a){n[a]=qo(i,t)}),n}if(ns(e)){var s=pl(t,e,new Set);return e.forEach(function(i){s.add(qo(i,t))}),s}if(dr(e)){var r=pl(t,e,new Map);return e.forEach(function(i,a){r.set(a,qo(i,t))}),r}else{var o=pl(t,e,{});return Fj(e).forEach(function(i){Oa.propertyIsEnumerable.call(e,i)&&(o[i]=qo(e[i],t))}),o}}function Er(e,t){return te.NODE_ENV!=="production"&&t&&me("toJS no longer supports options"),qo(e,new Map)}function Bj(){if(te.NODE_ENV!=="production"){for(var e=!1,t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];typeof n[n.length-1]=="boolean"&&(e=n.pop());var r=zj(n);if(!r)return me("'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly");r.isTracing_===Gn.NONE&&console.log("[mobx.trace] '"+r.name_+"' tracing enabled"),r.isTracing_=e?Gn.BREAK:Gn.LOG}}function zj(e){switch(e.length){case 0:return ce.trackingDerivation;case 1:return ui(e[0]);case 2:return ui(e[0],e[1])}}function Zs(e,t){t===void 0&&(t=void 0),Hn();try{return e.apply(t)}finally{Fn()}}function to(e){return e[Ce]}var Uj={has:function(t,n){return te.NODE_ENV!=="production"&&ce.trackingDerivation&&Mi("detect new properties using the 'in' operator. Use 'has' from 'mobx' instead."),to(t).has_(n)},get:function(t,n){return to(t).get_(n)},set:function(t,n,s){var r;return vo(n)?(te.NODE_ENV!=="production"&&!to(t).values_.has(n)&&Mi("add a new observable property through direct assignment. Use 'set' from 'mobx' instead."),(r=to(t).set_(n,s,!0))!=null?r:!0):!1},deleteProperty:function(t,n){var s;return te.NODE_ENV!=="production"&&Mi("delete properties from an observable object. Use 'remove' from 'mobx' instead."),vo(n)?(s=to(t).delete_(n,!0))!=null?s:!0:!1},defineProperty:function(t,n,s){var r;return te.NODE_ENV!=="production"&&Mi("define property on an observable object. Use 'defineProperty' from 'mobx' instead."),(r=to(t).defineProperty_(n,s))!=null?r:!0},ownKeys:function(t){return te.NODE_ENV!=="production"&&ce.trackingDerivation&&Mi("iterate keys to detect added / removed properties. Use 'keys' from 'mobx' instead."),to(t).ownKeys_()},preventExtensions:function(t){me(13)}};function Wj(e,t){var n,s;return Cb(),e=Ao(e,t),(s=(n=e[Ce]).proxy_)!=null?s:n.proxy_=new Proxy(e,Uj)}function Vn(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function $a(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),Uf(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function In(e,t){var n=Oo();try{for(var s=[].concat(e.interceptors_||[]),r=0,o=s.length;r<o&&(t=s[r](t),t&&!t.type&&me(14),!!t);r++);return t}finally{tr(n)}}function rs(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function ka(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),Uf(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function os(e,t){var n=Oo(),s=e.changeListeners_;if(s){s=s.slice();for(var r=0,o=s.length;r<o;r++)s[r](t);tr(n)}}function Gj(e,t,n){return zr(function(){var s,r=Ao(e,n)[Ce];te.NODE_ENV!=="production"&&t&&e[un]&&me("makeObservable second arg must be nullish when using decorators. Mixing @decorator syntax with annotations is not supported."),(s=t)!=null||(t=vC(e)),ai(t).forEach(function(o){return r.make_(o,t[o])})}),e}var Lu=Symbol("mobx-keys");function on(e,t,n){return te.NODE_ENV!=="production"&&(!jn(e)&&!jn(Object.getPrototypeOf(e))&&me("'makeAutoObservable' can only be used for classes that don't have a superclass"),No(e)&&me("makeAutoObservable can only be used on objects not already made observable")),jn(e)?Qb(e,e,t,n):(zr(function(){var s=Ao(e,n)[Ce];if(!e[Lu]){var r=Object.getPrototypeOf(e),o=new Set([].concat(ai(e),ai(r)));o.delete("constructor"),o.delete(Ce),Aa(r,Lu,o)}e[Lu].forEach(function(i){return s.make_(i,t&&i in t?t[i]:!0)})}),e)}var Wh="splice",ss="update",qj=1e4,Kj={get:function(t,n){var s=t[Ce];return n===Ce?s:n==="length"?s.getArrayLength_():typeof n=="string"&&!isNaN(n)?s.get_(parseInt(n)):Wn(cc,n)?cc[n]:t[n]},set:function(t,n,s){var r=t[Ce];return n==="length"&&r.setArrayLength_(s),typeof n=="symbol"||isNaN(n)?t[n]=s:r.set_(parseInt(n),s),!0},preventExtensions:function(){me(15)}},Xf=function(){function e(n,s,r,o){n===void 0&&(n=te.NODE_ENV!=="production"?"ObservableArray@"+us():"ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=r,this.legacyMode_=o,this.atom_=new Br(n),this.enhancer_=function(i,a){return s(i,a,te.NODE_ENV!=="production"?n+"[..]":"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.dehanceValues_=function(s){return this.dehancer!==void 0&&s.length>0?s.map(this.dehancer):s},t.intercept_=function(s){return $a(this,s)},t.observe_=function(s,r){return r===void 0&&(r=!1),r&&s({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),ka(this,s)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(s){(typeof s!="number"||isNaN(s)||s<0)&&me("Out of range: "+s);var r=this.values_.length;if(s!==r)if(s>r){for(var o=new Array(s-r),i=0;i<s-r;i++)o[i]=void 0;this.spliceWithArray_(r,0,o)}else this.spliceWithArray_(s,r-s)},t.updateArrayLength_=function(s,r){s!==this.lastKnownLength_&&me(16),this.lastKnownLength_+=r,this.legacyMode_&&r>0&&lv(s+r+1)},t.spliceWithArray_=function(s,r,o){var i=this;Os(this.atom_);var a=this.values_.length;if(s===void 0?s=0:s>a?s=a:s<0&&(s=Math.max(0,a+s)),arguments.length===1?r=a-s:r==null?r=0:r=Math.max(0,Math.min(r,a-s)),o===void 0&&(o=sc),Vn(this)){var l=In(this,{object:this.proxy_,type:Wh,index:s,removedCount:r,added:o});if(!l)return sc;r=l.removedCount,o=l.added}if(o=o.length===0?o:o.map(function(f){return i.enhancer_(f,void 0)}),this.legacyMode_||te.NODE_ENV!=="production"){var u=o.length-r;this.updateArrayLength_(a,u)}var d=this.spliceItemsIntoValues_(s,r,o);return(r!==0||o.length!==0)&&this.notifyArraySplice_(s,o,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(s,r,o){if(o.length<qj){var i;return(i=this.values_).splice.apply(i,[s,r].concat(o))}else{var a=this.values_.slice(s,s+r),l=this.values_.slice(s+r);this.values_.length+=o.length-r;for(var u=0;u<o.length;u++)this.values_[s+u]=o[u];for(var d=0;d<l.length;d++)this.values_[s+o.length+d]=l[d];return a}},t.notifyArrayChildUpdate_=function(s,r,o){var i=!this.owned_&&Ut(),a=rs(this),l=a||i?{observableKind:"array",object:this.proxy_,type:ss,debugObjectName:this.atom_.name_,index:s,newValue:r,oldValue:o}:null;te.NODE_ENV!=="production"&&i&&En(l),this.atom_.reportChanged(),a&&os(this,l),te.NODE_ENV!=="production"&&i&&Pn()},t.notifyArraySplice_=function(s,r,o){var i=!this.owned_&&Ut(),a=rs(this),l=a||i?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:Wh,index:s,removed:o,added:r,removedCount:o.length,addedCount:r.length}:null;te.NODE_ENV!=="production"&&i&&En(l),this.atom_.reportChanged(),a&&os(this,l),te.NODE_ENV!=="production"&&i&&Pn()},t.get_=function(s){if(this.legacyMode_&&s>=this.values_.length){console.warn(te.NODE_ENV!=="production"?"[mobx.array] Attempt to read an array index ("+s+") that is out of bounds ("+this.values_.length+"). Please check length first. Out of bound indices will not be tracked by MobX":"[mobx] Out of bounds read: "+s);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[s])},t.set_=function(s,r){var o=this.values_;if(this.legacyMode_&&s>o.length&&me(17,s,o.length),s<o.length){Os(this.atom_);var i=o[s];if(Vn(this)){var a=In(this,{type:ss,object:this.proxy_,index:s,newValue:r});if(!a)return;r=a.newValue}r=this.enhancer_(r,i);var l=r!==i;l&&(o[s]=r,this.notifyArrayChildUpdate_(s,r,i))}else{for(var u=new Array(s+1-o.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=r,this.spliceWithArray_(o.length,0,u)}},e}();function Yj(e,t,n,s){return n===void 0&&(n=te.NODE_ENV!=="production"?"ObservableArray@"+us():"ObservableArray"),s===void 0&&(s=!1),Cb(),zr(function(){var r=new Xf(n,t,s,!1);Eb(r.values_,Ce,r);var o=new Proxy(r.values_,Kj);return r.proxy_=o,e&&e.length&&r.spliceWithArray_(0,0,e),o})}var cc={clear:function(){return this.splice(0)},replace:function(t){var n=this[Ce];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var s=arguments.length,r=new Array(s>2?s-2:0),o=2;o<s;o++)r[o-2]=arguments[o];var i=this[Ce];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray_(t);case 2:return i.spliceWithArray_(t,n)}return i.spliceWithArray_(t,n,r)},spliceWithArray:function(t,n,s){return this[Ce].spliceWithArray_(t,n,s)},push:function(){for(var t=this[Ce],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(t.values_.length,0,s),t.values_.length},pop:function(){return this.splice(Math.max(this[Ce].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[Ce],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(0,0,s),t.values_.length},reverse:function(){return ce.trackingDerivation&&me(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){ce.trackingDerivation&&me(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[Ce],s=n.dehanceValues_(n.values_).indexOf(t);return s>-1?(this.splice(s,1),!0):!1}};mt("at",An);mt("concat",An);mt("flat",An);mt("includes",An);mt("indexOf",An);mt("join",An);mt("lastIndexOf",An);mt("slice",An);mt("toString",An);mt("toLocaleString",An);mt("toSorted",An);mt("toSpliced",An);mt("with",An);mt("every",ds);mt("filter",ds);mt("find",ds);mt("findIndex",ds);mt("findLast",ds);mt("findLastIndex",ds);mt("flatMap",ds);mt("forEach",ds);mt("map",ds);mt("some",ds);mt("toReversed",ds);mt("reduce",sv);mt("reduceRight",sv);function mt(e,t){typeof Array.prototype[e]=="function"&&(cc[e]=t(e))}function An(e){return function(){var t=this[Ce];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function ds(e){return function(t,n){var s=this,r=this[Ce];r.atom_.reportObserved();var o=r.dehanceValues_(r.values_);return o[e](function(i,a){return t.call(n,i,a,s)})}}function sv(e){return function(){var t=this,n=this[Ce];n.atom_.reportObserved();var s=n.dehanceValues_(n.values_),r=arguments[0];return arguments[0]=function(o,i,a){return r(o,i,a,t)},s[e].apply(s,arguments)}}var Zj=Fr("ObservableArrayAdministration",Xf);function Va(e){return Mc(e)&&Zj(e[Ce])}var Xj={},Pr="add",uc="delete",rv=function(){function e(n,s,r){var o=this;s===void 0&&(s=yo),r===void 0&&(r=te.NODE_ENV!=="production"?"ObservableMap@"+us():"ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[Ce]=Xj,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=s,this.name_=r,Rt(Map)||me(18),zr(function(){o.keysAtom_=Ob(te.NODE_ENV!=="production"?o.name_+".keys()":"ObservableMap.keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var t=e.prototype;return t.has_=function(s){return this.data_.has(s)},t.has=function(s){var r=this;if(!ce.trackingDerivation)return this.has_(s);var o=this.hasMap_.get(s);if(!o){var i=o=new Mr(this.has_(s),Rc,te.NODE_ENV!=="production"?this.name_+"."+Dd(s)+"?":"ObservableMap.key?",!1);this.hasMap_.set(s,i),Xb(i,function(){return r.hasMap_.delete(s)})}return o.get()},t.set=function(s,r){var o=this.has_(s);if(Vn(this)){var i=In(this,{type:o?ss:Pr,object:this,newValue:r,name:s});if(!i)return this;r=i.newValue}return o?this.updateValue_(s,r):this.addValue_(s,r),this},t.delete=function(s){var r=this;if(Os(this.keysAtom_),Vn(this)){var o=In(this,{type:uc,object:this,name:s});if(!o)return!1}if(this.has_(s)){var i=Ut(),a=rs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:uc,object:this,oldValue:this.data_.get(s).value_,name:s}:null;return te.NODE_ENV!=="production"&&i&&En(l),Zs(function(){var u;r.keysAtom_.reportChanged(),(u=r.hasMap_.get(s))==null||u.setNewValue_(!1);var d=r.data_.get(s);d.setNewValue_(void 0),r.data_.delete(s)}),a&&os(this,l),te.NODE_ENV!=="production"&&i&&Pn(),!0}return!1},t.updateValue_=function(s,r){var o=this.data_.get(s);if(r=o.prepareNewValue_(r),r!==ce.UNCHANGED){var i=Ut(),a=rs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:ss,object:this,oldValue:o.value_,name:s,newValue:r}:null;te.NODE_ENV!=="production"&&i&&En(l),o.setNewValue_(r),a&&os(this,l),te.NODE_ENV!=="production"&&i&&Pn()}},t.addValue_=function(s,r){var o=this;Os(this.keysAtom_),Zs(function(){var u,d=new Mr(r,o.enhancer_,te.NODE_ENV!=="production"?o.name_+"."+Dd(s):"ObservableMap.key",!1);o.data_.set(s,d),r=d.value_,(u=o.hasMap_.get(s))==null||u.setNewValue_(!0),o.keysAtom_.reportChanged()});var i=Ut(),a=rs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Pr,object:this,name:s,newValue:r}:null;te.NODE_ENV!=="production"&&i&&En(l),a&&os(this,l),te.NODE_ENV!=="production"&&i&&Pn()},t.get=function(s){return this.has(s)?this.dehanceValue_(this.data_.get(s).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var s=this,r=this.keys();return Gh({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:s.get(l)}}})},t.entries=function(){var s=this,r=this.keys();return Gh({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:[l,s.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(s,r){for(var o=Xo(this),i;!(i=o()).done;){var a=i.value,l=a[0],u=a[1];s.call(r,u,l,this)}},t.merge=function(s){var r=this;return dr(s)&&(s=new Map(s)),Zs(function(){jn(s)?dC(s).forEach(function(o){return r.set(o,s[o])}):Array.isArray(s)?s.forEach(function(o){var i=o[0],a=o[1];return r.set(i,a)}):wi(s)?(uC(s)||me(19,s),s.forEach(function(o,i){return r.set(i,o)})):s!=null&&me(20,s)}),this},t.clear=function(){var s=this;Zs(function(){Db(function(){for(var r=Xo(s.keys()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.replace=function(s){var r=this;return Zs(function(){for(var o=Jj(s),i=new Map,a=!1,l=Xo(r.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!o.has(d)){var f=r.delete(d);if(f)a=!0;else{var p=r.data_.get(d);i.set(d,p)}}}for(var g=Xo(o.entries()),m;!(m=g()).done;){var b=m.value,v=b[0],x=b[1],y=r.data_.has(v);if(r.set(v,x),r.data_.has(v)){var w=r.data_.get(v);i.set(v,w),y||(a=!0)}}if(!a)if(r.data_.size!==i.size)r.keysAtom_.reportChanged();else for(var S=r.data_.keys(),C=i.keys(),j=S.next(),E=C.next();!j.done;){if(j.value!==E.value){r.keysAtom_.reportChanged();break}j=S.next(),E=C.next()}r.data_=i}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(s,r){return te.NODE_ENV!=="production"&&r===!0&&me("`observe` doesn't support fireImmediately=true in combination with maps."),ka(this,s)},t.intercept_=function(s){return $a(this,s)},Si(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),dr=Fr("ObservableMap",rv);function Gh(e){return e[Symbol.toStringTag]="MapIterator",ep(e)}function Jj(e){if(wi(e)||dr(e))return e;if(Array.isArray(e))return new Map(e);if(jn(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return me(21,e)}var Qj={},ov=function(){function e(n,s,r){var o=this;s===void 0&&(s=yo),r===void 0&&(r=te.NODE_ENV!=="production"?"ObservableSet@"+us():"ObservableSet"),this.name_=void 0,this[Ce]=Qj,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,Rt(Set)||me(22),this.enhancer_=function(i,a){return s(i,a,r)},zr(function(){o.atom_=Ob(o.name_),n&&o.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.clear=function(){var s=this;Zs(function(){Db(function(){for(var r=Xo(s.data_.values()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.forEach=function(s,r){for(var o=Xo(this),i;!(i=o()).done;){var a=i.value;s.call(r,a,a,this)}},t.add=function(s){var r=this;if(Os(this.atom_),Vn(this)){var o=In(this,{type:Pr,object:this,newValue:s});if(!o)return this}if(!this.has(s)){Zs(function(){r.data_.add(r.enhancer_(s,void 0)),r.atom_.reportChanged()});var i=te.NODE_ENV!=="production"&&Ut(),a=rs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:Pr,object:this,newValue:s}:null;i&&te.NODE_ENV!=="production"&&En(l),a&&os(this,l),i&&te.NODE_ENV!=="production"&&Pn()}return this},t.delete=function(s){var r=this;if(Vn(this)){var o=In(this,{type:uc,object:this,oldValue:s});if(!o)return!1}if(this.has(s)){var i=te.NODE_ENV!=="production"&&Ut(),a=rs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:uc,object:this,oldValue:s}:null;return i&&te.NODE_ENV!=="production"&&En(l),Zs(function(){r.atom_.reportChanged(),r.data_.delete(s)}),a&&os(this,l),i&&te.NODE_ENV!=="production"&&Pn(),!0}return!1},t.has=function(s){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(s))},t.entries=function(){var s=0,r=Array.from(this.keys()),o=Array.from(this.values());return qh({next:function(){var a=s;return s+=1,a<o.length?{value:[r[a],o[a]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var s=this,r=0,o=Array.from(this.data_.values());return qh({next:function(){return r<o.length?{value:s.dehanceValue_(o[r++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(s){if(Ys(s)&&!ns(s))return s.intersection(this);var r=new Set(this);return r.intersection(s)},t.union=function(s){if(Ys(s)&&!ns(s))return s.union(this);var r=new Set(this);return r.union(s)},t.difference=function(s){return new Set(this).difference(s)},t.symmetricDifference=function(s){if(Ys(s)&&!ns(s))return s.symmetricDifference(this);var r=new Set(this);return r.symmetricDifference(s)},t.isSubsetOf=function(s){return new Set(this).isSubsetOf(s)},t.isSupersetOf=function(s){return new Set(this).isSupersetOf(s)},t.isDisjointFrom=function(s){if(Ys(s)&&!ns(s))return s.isDisjointFrom(this);var r=new Set(this);return r.isDisjointFrom(s)},t.replace=function(s){var r=this;return ns(s)&&(s=new Set(s)),Zs(function(){Array.isArray(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):Ys(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):s!=null&&me("Cannot initialize set from "+s)}),this},t.observe_=function(s,r){return te.NODE_ENV!=="production"&&r===!0&&me("`observe` doesn't support fireImmediately=true in combination with sets."),ka(this,s)},t.intercept_=function(s){return $a(this,s)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Si(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),ns=Fr("ObservableSet",ov);function qh(e){return e[Symbol.toStringTag]="SetIterator",ep(e)}var Kh=Object.create(null),Yh="remove",Kd=function(){function e(n,s,r,o){s===void 0&&(s=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_=s,this.name_=r,this.defaultAnnotation_=o,this.keysAtom_=new Br(te.NODE_ENV!=="production"?this.name_+".keys":"ObservableObject.keys"),this.isPlainObject_=jn(this.target_),te.NODE_ENV!=="production"&&!uv(this.defaultAnnotation_)&&me("defaultAnnotation must be valid annotation"),te.NODE_ENV!=="production"&&(this.appliedAnnotations_={})}var t=e.prototype;return t.getObservablePropValue_=function(s){return this.values_.get(s).get()},t.setObservablePropValue_=function(s,r){var o=this.values_.get(s);if(o instanceof Kn)return o.set(r),!0;if(Vn(this)){var i=In(this,{type:ss,object:this.proxy_||this.target_,name:s,newValue:r});if(!i)return null;r=i.newValue}if(r=o.prepareNewValue_(r),r!==ce.UNCHANGED){var a=rs(this),l=te.NODE_ENV!=="production"&&Ut(),u=a||l?{type:ss,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:s,newValue:r}:null;te.NODE_ENV!=="production"&&l&&En(u),o.setNewValue_(r),a&&os(this,u),te.NODE_ENV!=="production"&&l&&Pn()}return!0},t.get_=function(s){return ce.trackingDerivation&&!Wn(this.target_,s)&&this.has_(s),this.target_[s]},t.set_=function(s,r,o){return o===void 0&&(o=!1),Wn(this.target_,s)?this.values_.has(s)?this.setObservablePropValue_(s,r):o?Reflect.set(this.target_,s,r):(this.target_[s]=r,!0):this.extend_(s,{value:r,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(s){if(!ce.trackingDerivation)return s in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var r=this.pendingKeys_.get(s);return r||(r=new Mr(s in this.target_,Rc,te.NODE_ENV!=="production"?this.name_+"."+Dd(s)+"?":"ObservableObject.key?",!1),this.pendingKeys_.set(s,r)),r.get()},t.make_=function(s,r){if(r===!0&&(r=this.defaultAnnotation_),r!==!1){if(Jh(this,r,s),!(s in this.target_)){var o;if((o=this.target_[un])!=null&&o[s])return;me(1,r.annotationType_,this.name_+"."+s.toString())}for(var i=this.target_;i&&i!==Oa;){var a=nc(i,s);if(a){var l=r.make_(this,s,a,i);if(l===0)return;if(l===1)break}i=Object.getPrototypeOf(i)}Xh(this,r,s)}},t.extend_=function(s,r,o,i){if(i===void 0&&(i=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(s,r,i);Jh(this,o,s);var a=o.extend_(this,s,r,i);return a&&Xh(this,o,s),a},t.defineProperty_=function(s,r,o){o===void 0&&(o=!1),Os(this.keysAtom_);try{Hn();var i=this.delete_(s);if(!i)return i;if(Vn(this)){var a=In(this,{object:this.proxy_||this.target_,name:s,type:Pr,newValue:r.value});if(!a)return null;var l=a.newValue;r.value!==l&&(r=sr({},r,{value:l}))}if(o){if(!Reflect.defineProperty(this.target_,s,r))return!1}else Ms(this.target_,s,r);this.notifyPropertyAddition_(s,r.value)}finally{Fn()}return!0},t.defineObservableProperty_=function(s,r,o,i){i===void 0&&(i=!1),Os(this.keysAtom_);try{Hn();var a=this.delete_(s);if(!a)return a;if(Vn(this)){var l=In(this,{object:this.proxy_||this.target_,name:s,type:Pr,newValue:r});if(!l)return null;r=l.newValue}var u=Zh(s),d={configurable:ce.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,s,d))return!1}else Ms(this.target_,s,d);var f=new Mr(r,o,te.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key",!1);this.values_.set(s,f),this.notifyPropertyAddition_(s,f.value_)}finally{Fn()}return!0},t.defineComputedProperty_=function(s,r,o){o===void 0&&(o=!1),Os(this.keysAtom_);try{Hn();var i=this.delete_(s);if(!i)return i;if(Vn(this)){var a=In(this,{object:this.proxy_||this.target_,name:s,type:Pr,newValue:void 0});if(!a)return null}r.name||(r.name=te.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key"),r.context=this.proxy_||this.target_;var l=Zh(s),u={configurable:ce.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(o){if(!Reflect.defineProperty(this.target_,s,u))return!1}else Ms(this.target_,s,u);this.values_.set(s,new Kn(r)),this.notifyPropertyAddition_(s,void 0)}finally{Fn()}return!0},t.delete_=function(s,r){if(r===void 0&&(r=!1),Os(this.keysAtom_),!Wn(this.target_,s))return!0;if(Vn(this)){var o=In(this,{object:this.proxy_||this.target_,name:s,type:Yh});if(!o)return null}try{var i;Hn();var a=rs(this),l=te.NODE_ENV!=="production"&&Ut(),u=this.values_.get(s),d=void 0;if(!u&&(a||l)){var f;d=(f=nc(this.target_,s))==null?void 0:f.value}if(r){if(!Reflect.deleteProperty(this.target_,s))return!1}else delete this.target_[s];if(te.NODE_ENV!=="production"&&delete this.appliedAnnotations_[s],u&&(this.values_.delete(s),u instanceof Mr&&(d=u.value_),Wb(u)),this.keysAtom_.reportChanged(),(i=this.pendingKeys_)==null||(i=i.get(s))==null||i.set(s in this.target_),a||l){var p={type:Yh,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:s};te.NODE_ENV!=="production"&&l&&En(p),a&&os(this,p),te.NODE_ENV!=="production"&&l&&Pn()}}finally{Fn()}return!0},t.observe_=function(s,r){return te.NODE_ENV!=="production"&&r===!0&&me("`observe` doesn't support the fire immediately property for observable objects."),ka(this,s)},t.intercept_=function(s){return $a(this,s)},t.notifyPropertyAddition_=function(s,r){var o,i=rs(this),a=te.NODE_ENV!=="production"&&Ut();if(i||a){var l=i||a?{type:Pr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:s,newValue:r}:null;te.NODE_ENV!=="production"&&a&&En(l),i&&os(this,l),te.NODE_ENV!=="production"&&a&&Pn()}(o=this.pendingKeys_)==null||(o=o.get(s))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),ai(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ao(e,t){var n;if(te.NODE_ENV!=="production"&&t&&No(e)&&me("Options can't be provided for already observable objects."),Wn(e,Ce))return te.NODE_ENV!=="production"&&!(cv(e)instanceof Kd)&&me("Cannot convert '"+dc(e)+`' into observable object:
|
|
63
|
-
The target is already observable of different type.
|
|
64
|
-
Extending builtins is not supported.`),e;te.NODE_ENV!=="production"&&!Object.isExtensible(e)&&me("Cannot make the designated object observable; it is not extensible");var s=(n=t==null?void 0:t.name)!=null?n:te.NODE_ENV!=="production"?(jn(e)?"ObservableObject":e.constructor.name)+"@"+us():"ObservableObject",r=new Kd(e,new Map,String(s),ej(t));return Aa(e,Ce,r),e}var eE=Fr("ObservableObjectAdministration",Kd);function Zh(e){return Kh[e]||(Kh[e]={get:function(){return this[Ce].getObservablePropValue_(e)},set:function(n){return this[Ce].setObservablePropValue_(e,n)}})}function No(e){return Mc(e)?eE(e[Ce]):!1}function Xh(e,t,n){var s;te.NODE_ENV!=="production"&&(e.appliedAnnotations_[n]=t),(s=e.target_[un])==null||delete s[n]}function Jh(e,t,n){if(te.NODE_ENV!=="production"&&!uv(t)&&me("Cannot annotate '"+e.name_+"."+n.toString()+"': Invalid annotation."),te.NODE_ENV!=="production"&&!oc(t)&&Wn(e.appliedAnnotations_,n)){var s=e.name_+"."+n.toString(),r=e.appliedAnnotations_[n].annotationType_,o=t.annotationType_;me("Cannot apply '"+o+"' to '"+s+"':"+(`
|
|
65
|
-
The field is already annotated with '`+r+"'.")+`
|
|
66
|
-
Re-annotating fields is not allowed.
|
|
67
|
-
Use 'override' annotation for methods overridden by subclass.`)}}var tE=av(0),nE=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Ru=0,iv=function(){};function sE(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}sE(iv,Array.prototype);var Jf=function(e){function t(s,r,o,i){var a;return o===void 0&&(o=te.NODE_ENV!=="production"?"ObservableArray@"+us():"ObservableArray"),i===void 0&&(i=!1),a=e.call(this)||this,zr(function(){var l=new Xf(o,r,i,!0);l.proxy_=a,Eb(a,Ce,l),s&&s.length&&a.spliceWithArray(0,0,s),nE&&Object.defineProperty(a,"0",tE)}),a}Tb(t,e);var n=t.prototype;return n.concat=function(){this[Ce].atom_.reportObserved();for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return Va(a)?a.slice():a}))},n[Symbol.iterator]=function(){var s=this,r=0;return ep({next:function(){return r<s.length?{value:s[r++],done:!1}:{done:!0,value:void 0}}})},Si(t,[{key:"length",get:function(){return this[Ce].getArrayLength_()},set:function(r){this[Ce].setArrayLength_(r)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(iv);Object.entries(cc).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Aa(Jf.prototype,t,n)});function av(e){return{enumerable:!1,configurable:!0,get:function(){return this[Ce].get_(e)},set:function(n){this[Ce].set_(e,n)}}}function rE(e){Ms(Jf.prototype,""+e,av(e))}function lv(e){if(e>Ru){for(var t=Ru;t<e+100;t++)rE(t);Ru=e}}lv(1e3);function oE(e,t,n){return new Jf(e,t,n)}function ui(e,t){if(typeof e=="object"&&e!==null){if(Va(e))return t!==void 0&&me(23),e[Ce].atom_;if(ns(e))return e.atom_;if(dr(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||me(25,t,dc(e)),n}if(No(e)){if(!t)return me(26);var s=e[Ce].values_.get(t);return s||me(27,t,dc(e)),s}if(Wf(e)||Ra(e)||lc(e))return e}else if(Rt(e)&&lc(e[Ce]))return e[Ce];me(28)}function cv(e,t){if(e||me(29),Wf(e)||Ra(e)||lc(e)||dr(e)||ns(e))return e;if(e[Ce])return e[Ce];me(24,e)}function dc(e,t){var n;if(t!==void 0)n=ui(e,t);else{if(li(e))return e.name;No(e)||dr(e)||ns(e)?n=cv(e):n=ui(e)}return n.name_}function zr(e){var t=Oo(),n=qf(!0);Hn();try{return e()}finally{Fn(),Kf(n),tr(t)}}var Qh=Oa.toString;function Qf(e,t,n){return n===void 0&&(n=-1),Yd(e,t,n)}function Yd(e,t,n,s,r){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var i=Qh.call(e);if(i!==Qh.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=eg(e),t=eg(t);var a=i==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(Rt(l)&&l instanceof l&&Rt(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),s=s||[],r=r||[];for(var d=s.length;d--;)if(s[d]===e)return r[d]===t;if(s.push(e),r.push(t),a){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!Yd(e[d],t[d],n-1,s,r))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],!(Wn(t,p)&&Yd(e[p],t[p],n-1,s,r)))return!1}return s.pop(),r.pop(),!0}function eg(e){return Va(e)?e.slice():wi(e)||dr(e)||Ys(e)||ns(e)?Array.from(e.entries()):e}var tg,iE=((tg=Nc().Iterator)==null?void 0:tg.prototype)||{};function ep(e){return e[Symbol.iterator]=aE,Object.assign(Object.create(iE),e)}function aE(){return this}function uv(e){return e instanceof Object&&typeof e.annotationType_=="string"&&Rt(e.make_)&&Rt(e.extend_)}["Symbol","Map","Set"].forEach(function(e){var t=Nc();typeof t[e]>"u"&&me("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:Sj,extras:{getDebugName:dc},$mobx:Ce});if(!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Gj)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");var lE={};function cE(e){e()}function uE(e){e||(e=cE,lE.NODE_ENV!=="production"&&console.warn("[MobX] Failed to get unstable_batched updates from react-dom / react-native")),kj({reactionScheduler:e})}function dE(e){return ev(e)}var fE=1e4,pE=1e4,hE=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(s){s===void 0&&(s=fE),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var r=Date.now();n.registrations.forEach(function(o,i){r-o.registeredAt>=s&&(n.finalize(o.value),n.registrations.delete(i))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){this.registrations.set(s,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,pE))}}),e}(),gE=typeof FinalizationRegistry<"u"?FinalizationRegistry:hE,Zd=new gE(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),Xd={exports:{}},$u={};/**
|
|
5
|
+
*/(function(e){(function(){var t={}.hasOwnProperty;function n(){for(var o="",i=0;i<arguments.length;i++){var a=arguments[i];a&&(o=r(o,s(a)))}return o}function s(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var i="";for(var a in o)t.call(o,a)&&o[a]&&(i=r(i,a));return i}function r(o,i){return i?o?o+" "+i:o+i:o}e.exports?(n.default=n,e.exports=n):window.classNames=n})()})(Ev);var o2=Ev.exports;const M=ip(o2);var Jt={NODE_ENV:"production"};function Ge(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),s=1;s<t;s++)n[s-1]=arguments[s];throw new Error(typeof e=="number"?"[MobX] minified error nr: "+e+(n.length?" "+n.map(String).join(","):"")+". Find the full error at: https://github.com/mobxjs/mobx/blob/main/packages/mobx/src/errors.ts":"[MobX] "+e)}var i2={};function Bc(){return typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:i2}var Tv=Object.assign,gc=Object.getOwnPropertyDescriptor,Vs=Object.defineProperty,Da=Object.prototype,ef=[];Object.freeze(ef);var Pv={};Object.freeze(Pv);var a2=typeof Proxy<"u",l2=Object.toString();function Ov(){a2||Ge("Proxy not available")}function _v(e){var t=!1;return function(){if(!t)return t=!0,e.apply(this,arguments)}}var oi=function(){};function fs(e){return typeof e=="function"}function Oo(e){var t=typeof e;switch(t){case"string":case"symbol":case"number":return!0}return!1}function zc(e){return e!==null&&typeof e=="object"}function ur(e){if(!zc(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()===l2}function Av(e){var t=e==null?void 0:e.constructor;return t?t.name==="GeneratorFunction"||t.displayName==="GeneratorFunction":!1}function Fa(e,t,n){Vs(e,t,{enumerable:!1,writable:!0,configurable:!0,value:n})}function Lv(e,t,n){Vs(e,t,{enumerable:!1,writable:!1,configurable:!0,value:n})}function Zr(e,t){var n="isMobX"+e;return t.prototype[n]=!0,function(s){return zc(s)&&s[n]===!0}}function Pi(e){return e!=null&&Object.prototype.toString.call(e)==="[object Map]"}function c2(e){var t=Object.getPrototypeOf(e),n=Object.getPrototypeOf(t),s=Object.getPrototypeOf(n);return s===null}function nr(e){return e!=null&&Object.prototype.toString.call(e)==="[object Set]"}var Mv=typeof Object.getOwnPropertySymbols<"u";function u2(e){var t=Object.keys(e);if(!Mv)return t;var n=Object.getOwnPropertySymbols(e);return n.length?[].concat(t,n.filter(function(s){return Da.propertyIsEnumerable.call(e,s)})):t}var gi=typeof Reflect<"u"&&Reflect.ownKeys?Reflect.ownKeys:Mv?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:Object.getOwnPropertyNames;function Nv(e){return e===null?null:typeof e=="object"?""+e:e}function ar(e,t){return Da.hasOwnProperty.call(e,t)}var d2=Object.getOwnPropertyDescriptors||function(t){var n={};return gi(t).forEach(function(s){n[s]=gc(t,s)}),n};function _n(e,t){return!!(e&t)}function An(e,t,n){return n?e|=t:e&=~t,e}function tg(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=Array(t);n<t;n++)s[n]=e[n];return s}function f2(e,t){for(var n=0;n<t.length;n++){var s=t[n];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,h2(s.key),s)}}function Oi(e,t,n){return t&&f2(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function ii(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=g2(e))||t){n&&(e=n);var s=0;return function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
6
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function _o(){return _o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)({}).hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e},_o.apply(null,arguments)}function $v(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,tf(e,t)}function tf(e,t){return tf=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(n,s){return n.__proto__=s,n},tf(e,t)}function p2(e,t){if(typeof e!="object"||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var s=n.call(e,t);if(typeof s!="object")return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}function h2(e){var t=p2(e,"string");return typeof t=="symbol"?t:t+""}function g2(e,t){if(e){if(typeof e=="string")return tg(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)?tg(e,t):void 0}}var ls=Symbol("mobx-stored-annotations");function Hs(e){function t(n,s){if(za(s))return e.decorate_20223_(n,s);Ba(n,s,e)}return Object.assign(t,e)}function Ba(e,t,n){ar(e,ls)||Fa(e,ls,_o({},e[ls])),j2(n)||(e[ls][t]=n)}function m2(e){return ar(e,ls)||Fa(e,ls,_o({},e[ls])),e[ls]}function za(e){return typeof e=="object"&&typeof e.kind=="string"}var je=Symbol("mobx administration"),Yr=function(){function e(n){n===void 0&&(n="Atom"),this.name_=void 0,this.flags_=0,this.observers_=new Set,this.lastAccessedBy_=0,this.lowestObserverState_=Qe.NOT_TRACKING_,this.onBOL=void 0,this.onBUOL=void 0,this.name_=n}var t=e.prototype;return t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.reportObserved=function(){return Yv(this)},t.reportChanged=function(){qn(),Xv(this),Kn()},t.toString=function(){return this.name_},Oi(e,[{key:"isBeingObserved",get:function(){return _n(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=An(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return _n(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=An(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return _n(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=An(this.flags_,e.diffValueMask_,s===1)}}])}();Yr.isBeingObservedMask_=1;Yr.isPendingUnobservationMask_=2;Yr.diffValueMask_=4;var ap=Zr("Atom",Yr);function kv(e,t,n){t===void 0&&(t=oi),n===void 0&&(n=oi);var s=new Yr(e);return t!==oi&&_j(s,t),n!==oi&&nb(s,n),s}function v2(e,t){return e===t}function b2(e,t){return gp(e,t)}function y2(e,t){return gp(e,t,1)}function x2(e,t){return Object.is?Object.is(e,t):e===t?e!==0||1/e===1/t:e!==e&&t!==t}var mc={identity:v2,structural:b2,default:x2,shallow:y2};function Ao(e,t,n){return fp(e)?e:Array.isArray(e)?Kt.array(e,{name:n}):ur(e)?Kt.object(e,void 0,{name:n}):Pi(e)?Kt.map(e,{name:n}):nr(e)?Kt.set(e,{name:n}):typeof e=="function"&&!ba(e)&&!ya(e)?Av(e)?Mo(e):va(n,e):e}function w2(e,t,n){if(e==null||Za(e)||Ka(e)||Xr(e)||as(e))return e;if(Array.isArray(e))return Kt.array(e,{name:n,deep:!1});if(ur(e))return Kt.object(e,void 0,{name:n,deep:!1});if(Pi(e))return Kt.map(e,{name:n,deep:!1});if(nr(e))return Kt.set(e,{name:n,deep:!1})}function Uc(e){return e}function S2(e,t){return gp(e,t)?t:e}var C2="override";function j2(e){return e.annotationType_===C2}function Ua(e,t){return{annotationType_:e,options_:t,make_:E2,extend_:T2,decorate_20223_:P2}}function E2(e,t,n,s){var r;if((r=this.options_)!=null&&r.bound)return this.extend_(e,t,n,!1)===null?0:1;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if(ba(n.value))return 1;var o=Rv(e,this,t,n,!1);return Vs(s,t,o),2}function T2(e,t,n,s){var r=Rv(e,this,t,n);return e.defineProperty_(t,r,s)}function P2(e,t){var n=t.kind,s=t.name,r=t.addInitializer,o=this,i=function(u){var d,f,p,g;return Lo((d=(f=o.options_)==null?void 0:f.name)!=null?d:s.toString(),u,(p=(g=o.options_)==null?void 0:g.autoAction)!=null?p:!1)};if(n=="field")return function(l){var u,d=l;return ba(d)||(d=i(d)),(u=o.options_)!=null&&u.bound&&(d=d.bind(this),d.isMobxAction=!0),d};if(n=="method"){var a;return ba(e)||(e=i(e)),(a=this.options_)!=null&&a.bound&&r(function(){var l=this,u=l[s].bind(l);u.isMobxAction=!0,l[s]=u}),e}Ge("Cannot apply '"+o.annotationType_+"' to '"+String(s)+"' (kind: "+n+"):"+(`
|
|
7
|
+
'`+o.annotationType_+"' can only be used on properties with a function value."))}function O2(e,t,n,s){t.annotationType_,s.value}function Rv(e,t,n,s,r){var o,i,a,l,u,d,f;r===void 0&&(r=pe.safeDescriptors),O2(e,t,n,s);var p=s.value;if((o=t.options_)!=null&&o.bound){var g;p=p.bind((g=e.proxy_)!=null?g:e.target_)}return{value:Lo((i=(a=t.options_)==null?void 0:a.name)!=null?i: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:r?e.isPlainObject_:!0,enumerable:!1,writable:!r}}function Iv(e,t){return{annotationType_:e,options_:t,make_:_2,extend_:A2,decorate_20223_:L2}}function _2(e,t,n,s){var r;if(s===e.target_)return this.extend_(e,t,n,!1)===null?0:2;if((r=this.options_)!=null&&r.bound&&(!ar(e.target_,t)||!ya(e.target_[t]))&&this.extend_(e,t,n,!1)===null)return 0;if(ya(n.value))return 1;var o=Vv(e,this,t,n,!1,!1);return Vs(s,t,o),2}function A2(e,t,n,s){var r,o=Vv(e,this,t,n,(r=this.options_)==null?void 0:r.bound);return e.defineProperty_(t,o,s)}function L2(e,t){var n,s=t.name,r=t.addInitializer;return ya(e)||(e=Mo(e)),(n=this.options_)!=null&&n.bound&&r(function(){var o=this,i=o[s].bind(o);i.isMobXFlow=!0,o[s]=i}),e}function M2(e,t,n,s){t.annotationType_,s.value}function Vv(e,t,n,s,r,o){o===void 0&&(o=pe.safeDescriptors),M2(e,t,n,s);var i=s.value;if(ya(i)||(i=Mo(i)),r){var a;i=i.bind((a=e.proxy_)!=null?a:e.target_),i.isMobXFlow=!0}return{value:i,configurable:o?e.isPlainObject_:!0,enumerable:!1,writable:!o}}function lp(e,t){return{annotationType_:e,options_:t,make_:N2,extend_:$2,decorate_20223_:k2}}function N2(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function $2(e,t,n,s){return R2(e,this,t,n),e.defineComputedProperty_(t,_o({},this.options_,{get:n.get,set:n.set}),s)}function k2(e,t){var n=this,s=t.name,r=t.addInitializer;return r(function(){var o=Ho(this)[je],i=_o({},n.options_,{get:e,context:this});i.name||(i.name="ObservableObject."+s.toString()),o.values_.set(s,new ps(i))}),function(){return this[je].getObservablePropValue_(s)}}function R2(e,t,n,s){t.annotationType_,s.get}function Wc(e,t){return{annotationType_:e,options_:t,make_:I2,extend_:V2,decorate_20223_:H2}}function I2(e,t,n){return this.extend_(e,t,n,!1)===null?0:1}function V2(e,t,n,s){var r,o;return D2(e,this),e.defineObservableProperty_(t,n.value,(r=(o=this.options_)==null?void 0:o.enhancer)!=null?r:Ao,s)}function H2(e,t){var n=this,s=t.kind,r=t.name,o=new WeakSet;function i(a,l){var u,d,f=Ho(a)[je],p=new Vr(l,(u=(d=n.options_)==null?void 0:d.enhancer)!=null?u:Ao,"ObservableObject."+r.toString(),!1);f.values_.set(r,p),o.add(a)}if(s=="accessor")return{get:function(){return o.has(this)||i(this,e.get.call(this)),this[je].getObservablePropValue_(r)},set:function(l){return o.has(this)||i(this,l),this[je].setObservablePropValue_(r,l)},init:function(l){return o.has(this)||i(this,l),l}}}function D2(e,t,n,s){t.annotationType_}var F2="true",B2=Hv();function Hv(e){return{annotationType_:F2,options_:e,make_:z2,extend_:U2,decorate_20223_:W2}}function z2(e,t,n,s){var r,o;if(n.get)return Gc.make_(e,t,n,s);if(n.set){var i=Lo(t.toString(),n.set);return s===e.target_?e.defineProperty_(t,{configurable:pe.safeDescriptors?e.isPlainObject_:!0,set:i})===null?0:2:(Vs(s,t,{configurable:!0,set:i}),2)}if(s!==e.target_&&typeof n.value=="function"){var a;if(Av(n.value)){var l,u=(l=this.options_)!=null&&l.autoBind?Mo.bound:Mo;return u.make_(e,t,n,s)}var d=(a=this.options_)!=null&&a.autoBind?va.bound:va;return d.make_(e,t,n,s)}var f=((r=this.options_)==null?void 0:r.deep)===!1?Kt.ref:Kt;if(typeof n.value=="function"&&(o=this.options_)!=null&&o.autoBind){var p;n.value=n.value.bind((p=e.proxy_)!=null?p:e.target_)}return f.make_(e,t,n,s)}function U2(e,t,n,s){var r,o;if(n.get)return Gc.extend_(e,t,n,s);if(n.set)return e.defineProperty_(t,{configurable:pe.safeDescriptors?e.isPlainObject_:!0,set:Lo(t.toString(),n.set)},s);if(typeof n.value=="function"&&(r=this.options_)!=null&&r.autoBind){var i;n.value=n.value.bind((i=e.proxy_)!=null?i:e.target_)}var a=((o=this.options_)==null?void 0:o.deep)===!1?Kt.ref:Kt;return a.extend_(e,t,n,s)}function W2(e,t){Ge("'"+this.annotationType_+"' cannot be used as a decorator")}var G2="observable",q2="observable.ref",K2="observable.shallow",Z2="observable.struct",Dv={deep:!0,name:void 0,defaultDecorator:void 0,proxy:!0};Object.freeze(Dv);function wl(e){return e||Dv}var nf=Wc(G2),Y2=Wc(q2,{enhancer:Uc}),X2=Wc(K2,{enhancer:w2}),J2=Wc(Z2,{enhancer:S2}),Fv=Hs(nf);function Sl(e){return e.deep===!0?Ao:e.deep===!1?Uc:ej(e.defaultDecorator)}function Q2(e){var t;return e?(t=e.defaultDecorator)!=null?t:Hv(e):void 0}function ej(e){var t,n;return e&&(t=(n=e.options_)==null?void 0:n.enhancer)!=null?t:Ao}function Bv(e,t,n){if(za(t))return nf.decorate_20223_(e,t);if(Oo(t)){Ba(e,t,nf);return}return fp(e)?e:ur(e)?Kt.object(e,t,n):Array.isArray(e)?Kt.array(e,t):Pi(e)?Kt.map(e,t):nr(e)?Kt.set(e,t):typeof e=="object"&&e!==null?e:Kt.box(e,t)}Tv(Bv,Fv);var tj={box:function(t,n){var s=wl(n);return new Vr(t,Sl(s),s.name,!0,s.equals)},array:function(t,n){var s=wl(n);return(pe.useProxies===!1||s.proxy===!1?eE:Uj)(t,Sl(s),s.name)},map:function(t,n){var s=wl(n);return new lb(t,Sl(s),s.name)},set:function(t,n){var s=wl(n);return new cb(t,Sl(s),s.name)},object:function(t,n,s){return Jr(function(){return rb(pe.useProxies===!1||(s==null?void 0:s.proxy)===!1?Ho({},s):Dj({},s),t,n)})},ref:Hs(Y2),shallow:Hs(X2),deep:Fv,struct:Hs(J2)},Kt=Tv(Bv,tj),zv="computed",nj="computed.struct",sf=lp(zv),sj=lp(nj,{equals:mc.structural}),Gc=function(t,n){if(za(n))return sf.decorate_20223_(t,n);if(Oo(n))return Ba(t,n,sf);if(ur(t))return Hs(lp(zv,t));var s=ur(n)?n:{};return s.get=t,s.name||(s.name=t.name||""),new ps(s)};Object.assign(Gc,sf);Gc.struct=Hs(sj);var ng,sg,vc=0,rj=1,oj=(ng=(sg=gc(function(){},"name"))==null?void 0:sg.configurable)!=null?ng:!1,rg={value:"action",configurable:!0,writable:!1,enumerable:!1};function Lo(e,t,n,s){n===void 0&&(n=!1);function r(){return ij(e,n,t,s||this,arguments)}return r.isMobxAction=!0,r.toString=function(){return t.toString()},oj&&(rg.value=e,Vs(r,"name",rg)),r}function ij(e,t,n,s,r){var o=aj(e,t);try{return n.apply(s,r)}catch(i){throw o.error_=i,i}finally{lj(o)}}function aj(e,t,n,s){var r=Jt.NODE_ENV!=="production",o=0,i=pe.trackingDerivation,a=!t||!i;qn();var l=pe.allowStateChanges;a&&(Vo(),l=cp(!0));var u=dp(!0),d={runAsAction_:a,prevDerivation_:i,prevAllowStateChanges_:l,prevAllowStateReads_:u,notifySpy_:r,startTime_:o,actionId_:rj++,parentActionId_:vc};return vc=d.actionId_,d}function lj(e){vc!==e.actionId_&&Ge(30),vc=e.parentActionId_,e.error_!==void 0&&(pe.suppressReactionErrors=!0),up(e.prevAllowStateChanges_),sa(e.prevAllowStateReads_),Kn(),e.runAsAction_&&lr(e.prevDerivation_),pe.suppressReactionErrors=!1}function cp(e){var t=pe.allowStateChanges;return pe.allowStateChanges=e,t}function up(e){pe.allowStateChanges=e}var Vr=function(e){function t(s,r,o,i,a){var l;return o===void 0&&(o="ObservableValue"),a===void 0&&(a=mc.default),l=e.call(this,o)||this,l.enhancer=void 0,l.name_=void 0,l.equals=void 0,l.hasUnreportedChange_=!1,l.interceptors_=void 0,l.changeListeners_=void 0,l.value_=void 0,l.dehancer=void 0,l.enhancer=r,l.name_=o,l.equals=a,l.value_=r(s,void 0,o),l}$v(t,e);var n=t.prototype;return n.dehanceValue=function(r){return this.dehancer!==void 0?this.dehancer(r):r},n.set=function(r){this.value_,r=this.prepareNewValue_(r),r!==pe.UNCHANGED&&this.setNewValue_(r)},n.prepareNewValue_=function(r){if(Un(this)){var o=Wn(this,{object:this,type:Ds,newValue:r});if(!o)return pe.UNCHANGED;r=o.newValue}return r=this.enhancer(r,this.value_,this.name_),this.equals(this.value_,r)?pe.UNCHANGED:r},n.setNewValue_=function(r){var o=this.value_;this.value_=r,this.reportChanged(),cs(this)&&us(this,{type:Ds,object:this,newValue:r,oldValue:o})},n.get=function(){return this.reportObserved(),this.dehanceValue(this.value_)},n.intercept_=function(r){return Ga(this,r)},n.observe_=function(r,o){return o&&r({observableKind:"value",debugObjectName:this.name_,object:this,type:Ds,newValue:this.value_,oldValue:void 0}),qa(this,r)},n.raw=function(){return this.value_},n.toJSON=function(){return this.get()},n.toString=function(){return this.name_+"["+this.value_+"]"},n.valueOf=function(){return Nv(this.get())},n[Symbol.toPrimitive]=function(){return this.valueOf()},t}(Yr),cj=Zr("ObservableValue",Vr),ps=function(){function e(n){this.dependenciesState_=Qe.NOT_TRACKING_,this.observing_=[],this.newObserving_=null,this.observers_=new Set,this.runId_=0,this.lastAccessedBy_=0,this.lowestObserverState_=Qe.UP_TO_DATE_,this.unboundDepsCount_=0,this.value_=new yc(null),this.name_=void 0,this.triggeredBy_=void 0,this.flags_=0,this.derivation=void 0,this.setter_=void 0,this.isTracing_=bc.NONE,this.scope_=void 0,this.equals_=void 0,this.requiresReaction_=void 0,this.keepAlive_=void 0,this.onBOL=void 0,this.onBUOL=void 0,n.get||Ge(31),this.derivation=n.get,this.name_=n.name||"ComputedValue",n.set&&(this.setter_=Lo("ComputedValue-setter",n.set)),this.equals_=n.equals||(n.compareStructural||n.struct?mc.structural:mc.default),this.scope_=n.context,this.requiresReaction_=n.requiresReaction,this.keepAlive_=!!n.keepAlive}var t=e.prototype;return t.onBecomeStale_=function(){hj(this)},t.onBO=function(){this.onBOL&&this.onBOL.forEach(function(s){return s()})},t.onBUO=function(){this.onBUOL&&this.onBUOL.forEach(function(s){return s()})},t.get=function(){if(this.isComputing&&Ge(32,this.name_,this.derivation),pe.inBatch===0&&this.observers_.size===0&&!this.keepAlive_)rf(this)&&(this.warnAboutUntrackedRead_(),qn(),this.value_=this.computeValue_(!1),Kn());else if(Yv(this),rf(this)){var s=pe.trackingContext;this.keepAlive_&&!s&&(pe.trackingContext=this),this.trackAndCompute()&&pj(this),pe.trackingContext=s}var r=this.value_;if(rc(r))throw r.cause;return r},t.set=function(s){if(this.setter_){this.isRunningSetter&&Ge(33,this.name_),this.isRunningSetter=!0;try{this.setter_.call(this.scope_,s)}finally{this.isRunningSetter=!1}}else Ge(34,this.name_)},t.trackAndCompute=function(){var s=this.value_,r=this.dependenciesState_===Qe.NOT_TRACKING_,o=this.computeValue_(!0),i=r||rc(s)||rc(o)||!this.equals_(s,o);return i&&(this.value_=o),i},t.computeValue_=function(s){this.isComputing=!0;var r=cp(!1),o;if(s)o=Uv(this,this.derivation,this.scope_);else if(pe.disableErrorBoundaries===!0)o=this.derivation.call(this.scope_);else try{o=this.derivation.call(this.scope_)}catch(i){o=new yc(i)}return up(r),this.isComputing=!1,o},t.suspend_=function(){this.keepAlive_||(of(this),this.value_=void 0)},t.observe_=function(s,r){var o=this,i=!0,a=void 0;return jj(function(){var l=o.get();if(!i||r){var u=Vo();s({observableKind:"computed",debugObjectName:o.name_,type:Ds,object:o,newValue:l,oldValue:a}),lr(u)}i=!1,a=l})},t.warnAboutUntrackedRead_=function(){},t.toString=function(){return this.name_+"["+this.derivation.toString()+"]"},t.valueOf=function(){return Nv(this.get())},t[Symbol.toPrimitive]=function(){return this.valueOf()},Oi(e,[{key:"isComputing",get:function(){return _n(this.flags_,e.isComputingMask_)},set:function(s){this.flags_=An(this.flags_,e.isComputingMask_,s)}},{key:"isRunningSetter",get:function(){return _n(this.flags_,e.isRunningSetterMask_)},set:function(s){this.flags_=An(this.flags_,e.isRunningSetterMask_,s)}},{key:"isBeingObserved",get:function(){return _n(this.flags_,e.isBeingObservedMask_)},set:function(s){this.flags_=An(this.flags_,e.isBeingObservedMask_,s)}},{key:"isPendingUnobservation",get:function(){return _n(this.flags_,e.isPendingUnobservationMask_)},set:function(s){this.flags_=An(this.flags_,e.isPendingUnobservationMask_,s)}},{key:"diffValue",get:function(){return _n(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=An(this.flags_,e.diffValueMask_,s===1)}}])}();ps.isComputingMask_=1;ps.isRunningSetterMask_=2;ps.isBeingObservedMask_=4;ps.isPendingUnobservationMask_=8;ps.diffValueMask_=16;var Wa=Zr("ComputedValue",ps),Qe;(function(e){e[e.NOT_TRACKING_=-1]="NOT_TRACKING_",e[e.UP_TO_DATE_=0]="UP_TO_DATE_",e[e.POSSIBLY_STALE_=1]="POSSIBLY_STALE_",e[e.STALE_=2]="STALE_"})(Qe||(Qe={}));var bc;(function(e){e[e.NONE=0]="NONE",e[e.LOG=1]="LOG",e[e.BREAK=2]="BREAK"})(bc||(bc={}));var yc=function(t){this.cause=void 0,this.cause=t};function rc(e){return e instanceof yc}function rf(e){switch(e.dependenciesState_){case Qe.UP_TO_DATE_:return!1;case Qe.NOT_TRACKING_:case Qe.STALE_:return!0;case Qe.POSSIBLY_STALE_:{for(var t=dp(!0),n=Vo(),s=e.observing_,r=s.length,o=0;o<r;o++){var i=s[o];if(Wa(i)){if(pe.disableErrorBoundaries)i.get();else try{i.get()}catch{return lr(n),sa(t),!0}if(e.dependenciesState_===Qe.STALE_)return lr(n),sa(t),!0}}return Gv(e),lr(n),sa(t),!1}}}function Uv(e,t,n){var s=dp(!0);Gv(e),e.newObserving_=new Array(e.runId_===0?100:e.observing_.length),e.unboundDepsCount_=0,e.runId_=++pe.runId;var r=pe.trackingDerivation;pe.trackingDerivation=e,pe.inBatch++;var o;if(pe.disableErrorBoundaries===!0)o=t.call(n);else try{o=t.call(n)}catch(i){o=new yc(i)}return pe.inBatch--,pe.trackingDerivation=r,uj(e),sa(s),o}function uj(e){for(var t=e.observing_,n=e.observing_=e.newObserving_,s=Qe.UP_TO_DATE_,r=0,o=e.unboundDepsCount_,i=0;i<o;i++){var a=n[i];a.diffValue===0&&(a.diffValue=1,r!==i&&(n[r]=a),r++),a.dependenciesState_>s&&(s=a.dependenciesState_)}for(n.length=r,e.newObserving_=null,o=t.length;o--;){var l=t[o];l.diffValue===0&&Kv(l,e),l.diffValue=0}for(;r--;){var u=n[r];u.diffValue===1&&(u.diffValue=0,fj(u,e))}s!==Qe.UP_TO_DATE_&&(e.dependenciesState_=s,e.onBecomeStale_())}function of(e){var t=e.observing_;e.observing_=[];for(var n=t.length;n--;)Kv(t[n],e);e.dependenciesState_=Qe.NOT_TRACKING_}function Wv(e){var t=Vo();try{return e()}finally{lr(t)}}function Vo(){var e=pe.trackingDerivation;return pe.trackingDerivation=null,e}function lr(e){pe.trackingDerivation=e}function dp(e){var t=pe.allowStateReads;return pe.allowStateReads=e,t}function sa(e){pe.allowStateReads=e}function Gv(e){if(e.dependenciesState_!==Qe.UP_TO_DATE_){e.dependenciesState_=Qe.UP_TO_DATE_;for(var t=e.observing_,n=t.length;n--;)t[n].lowestObserverState_=Qe.UP_TO_DATE_}}var oc=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},ic=!0,qv=!1,pe=function(){var e=Bc();return e.__mobxInstanceCount>0&&!e.__mobxGlobals&&(ic=!1),e.__mobxGlobals&&e.__mobxGlobals.version!==new oc().version&&(ic=!1),ic?e.__mobxGlobals?(e.__mobxInstanceCount+=1,e.__mobxGlobals.UNCHANGED||(e.__mobxGlobals.UNCHANGED={}),e.__mobxGlobals):(e.__mobxInstanceCount=1,e.__mobxGlobals=new oc):(setTimeout(function(){qv||Ge(35)},1),new oc)}();function dj(){if((pe.pendingReactions.length||pe.inBatch||pe.isRunningReactions)&&Ge(36),qv=!0,ic){var e=Bc();--e.__mobxInstanceCount===0&&(e.__mobxGlobals=void 0),pe=new oc}}function fj(e,t){e.observers_.add(t),e.lowestObserverState_>t.dependenciesState_&&(e.lowestObserverState_=t.dependenciesState_)}function Kv(e,t){e.observers_.delete(t),e.observers_.size===0&&Zv(e)}function Zv(e){e.isPendingUnobservation===!1&&(e.isPendingUnobservation=!0,pe.pendingUnobservations.push(e))}function qn(){pe.inBatch++}function Kn(){if(--pe.inBatch===0){Jv();for(var e=pe.pendingUnobservations,t=0;t<e.length;t++){var n=e[t];n.isPendingUnobservation=!1,n.observers_.size===0&&(n.isBeingObserved&&(n.isBeingObserved=!1,n.onBUO()),n instanceof ps&&n.suspend_())}pe.pendingUnobservations=[]}}function Yv(e){var t=pe.trackingDerivation;return t!==null?(t.runId_!==e.lastAccessedBy_&&(e.lastAccessedBy_=t.runId_,t.newObserving_[t.unboundDepsCount_++]=e,!e.isBeingObserved&&pe.trackingContext&&(e.isBeingObserved=!0,e.onBO())),e.isBeingObserved):(e.observers_.size===0&&pe.inBatch>0&&Zv(e),!1)}function Xv(e){e.lowestObserverState_!==Qe.STALE_&&(e.lowestObserverState_=Qe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Qe.UP_TO_DATE_&&t.onBecomeStale_(),t.dependenciesState_=Qe.STALE_}))}function pj(e){e.lowestObserverState_!==Qe.STALE_&&(e.lowestObserverState_=Qe.STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Qe.POSSIBLY_STALE_?t.dependenciesState_=Qe.STALE_:t.dependenciesState_===Qe.UP_TO_DATE_&&(e.lowestObserverState_=Qe.UP_TO_DATE_)}))}function hj(e){e.lowestObserverState_===Qe.UP_TO_DATE_&&(e.lowestObserverState_=Qe.POSSIBLY_STALE_,e.observers_.forEach(function(t){t.dependenciesState_===Qe.UP_TO_DATE_&&(t.dependenciesState_=Qe.POSSIBLY_STALE_,t.onBecomeStale_())}))}var dr=function(){function e(n,s,r,o){n===void 0&&(n="Reaction"),this.name_=void 0,this.onInvalidate_=void 0,this.errorHandler_=void 0,this.requiresObservable_=void 0,this.observing_=[],this.newObserving_=[],this.dependenciesState_=Qe.NOT_TRACKING_,this.runId_=0,this.unboundDepsCount_=0,this.flags_=0,this.isTracing_=bc.NONE,this.name_=n,this.onInvalidate_=s,this.errorHandler_=r,this.requiresObservable_=o}var t=e.prototype;return t.onBecomeStale_=function(){this.schedule_()},t.schedule_=function(){this.isScheduled||(this.isScheduled=!0,pe.pendingReactions.push(this),Jv())},t.runReaction_=function(){if(!this.isDisposed){qn(),this.isScheduled=!1;var s=pe.trackingContext;if(pe.trackingContext=this,rf(this)){this.isTrackPending=!0;try{this.onInvalidate_(),Jt.NODE_ENV!=="production"&&this.isTrackPending&&jo()}catch(r){this.reportExceptionInDerivation_(r)}}pe.trackingContext=s,Kn()}},t.track=function(s){if(!this.isDisposed){qn(),this.isRunning=!0;var r=pe.trackingContext;pe.trackingContext=this;var o=Uv(this,s,void 0);pe.trackingContext=r,this.isRunning=!1,this.isTrackPending=!1,this.isDisposed&&of(this),rc(o)&&this.reportExceptionInDerivation_(o.cause),Kn()}},t.reportExceptionInDerivation_=function(s){var r=this;if(this.errorHandler_){this.errorHandler_(s,this);return}if(pe.disableErrorBoundaries)throw s;var o="[mobx] uncaught error in '"+this+"'";pe.suppressReactionErrors||console.error(o,s),pe.globalReactionErrorHandlers.forEach(function(i){return i(s,r)})},t.dispose=function(){this.isDisposed||(this.isDisposed=!0,this.isRunning||(qn(),of(this),Kn()))},t.getDisposer_=function(s){var r=this,o=function i(){r.dispose(),s==null||s.removeEventListener==null||s.removeEventListener("abort",i)};return s==null||s.addEventListener==null||s.addEventListener("abort",o),o[je]=this,o},t.toString=function(){return"Reaction["+this.name_+"]"},t.trace=function(s){},Oi(e,[{key:"isDisposed",get:function(){return _n(this.flags_,e.isDisposedMask_)},set:function(s){this.flags_=An(this.flags_,e.isDisposedMask_,s)}},{key:"isScheduled",get:function(){return _n(this.flags_,e.isScheduledMask_)},set:function(s){this.flags_=An(this.flags_,e.isScheduledMask_,s)}},{key:"isTrackPending",get:function(){return _n(this.flags_,e.isTrackPendingMask_)},set:function(s){this.flags_=An(this.flags_,e.isTrackPendingMask_,s)}},{key:"isRunning",get:function(){return _n(this.flags_,e.isRunningMask_)},set:function(s){this.flags_=An(this.flags_,e.isRunningMask_,s)}},{key:"diffValue",get:function(){return _n(this.flags_,e.diffValueMask_)?1:0},set:function(s){this.flags_=An(this.flags_,e.diffValueMask_,s===1)}}])}();dr.isDisposedMask_=1;dr.isScheduledMask_=2;dr.isTrackPendingMask_=4;dr.isRunningMask_=8;dr.diffValueMask_=16;var gj=100,af=function(t){return t()};function Jv(){pe.inBatch>0||pe.isRunningReactions||af(mj)}function mj(){pe.isRunningReactions=!0;for(var e=pe.pendingReactions,t=0;e.length>0;){++t===gj&&(console.error("[mobx] cycle in reaction: "+e[0]),e.splice(0));for(var n=e.splice(0),s=0,r=n.length;s<r;s++)n[s].runReaction_()}pe.isRunningReactions=!1}var xc=Zr("Reaction",dr);function vj(e){var t=af;af=function(s){return e(function(){return t(s)})}}function jo(){return Jt.NODE_ENV!=="production"}function bj(e){return console.warn("[mobx.spy] Is a no-op in production builds"),function(){}}var Qv="action",yj="action.bound",eb="autoAction",xj="autoAction.bound",wj="<unnamed action>",lf=Ua(Qv),Sj=Ua(yj,{bound:!0}),cf=Ua(eb,{autoAction:!0}),Cj=Ua(xj,{autoAction:!0,bound:!0});function tb(e){var t=function(s,r){if(fs(s))return Lo(s.name||wj,s,e);if(fs(r))return Lo(s,r,e);if(za(r))return(e?cf:lf).decorate_20223_(s,r);if(Oo(r))return Ba(s,r,e?cf:lf);if(Oo(s))return Hs(Ua(e?eb:Qv,{name:s,autoAction:e}))};return t}var ai=tb(!1);Object.assign(ai,lf);var va=tb(!0);Object.assign(va,cf);ai.bound=Hs(Sj);va.bound=Hs(Cj);function ba(e){return fs(e)&&e.isMobxAction===!0}function jj(e,t){var n,s,r,o;t===void 0&&(t=Pv);var i=(n=(s=t)==null?void 0:s.name)!=null?n:"Autorun",a=!t.scheduler&&!t.delay,l;if(a)l=new dr(i,function(){this.track(f)},t.onError,t.requiresObservable);else{var u=Tj(t),d=!1;l=new dr(i,function(){d||(d=!0,u(function(){d=!1,l.isDisposed||l.track(f)}))},t.onError,t.requiresObservable)}function f(){e(l)}return(r=t)!=null&&(r=r.signal)!=null&&r.aborted||l.schedule_(),l.getDisposer_((o=t)==null?void 0:o.signal)}var Ej=function(t){return t()};function Tj(e){return e.scheduler?e.scheduler:e.delay?function(t){return setTimeout(t,e.delay)}:Ej}var Pj="onBO",Oj="onBUO";function _j(e,t,n){return sb(Pj,e,t,n)}function nb(e,t,n){return sb(Oj,e,t,n)}function sb(e,t,n,s){var r=Cc(t),o=fs(s)?s:n,i=e+"L";return r[i]?r[i].add(o):r[i]=new Set([o]),function(){var a=r[i];a&&(a.delete(o),a.size===0&&delete r[i])}}var Aj="never",Cl="always",Lj="observed";function Mj(e){e.isolateGlobalState===!0&&dj();var t=e.useProxies,n=e.enforceActions;if(t!==void 0&&(pe.useProxies=t===Cl?!0:t===Aj?!1:typeof Proxy<"u"),t==="ifavailable"&&(pe.verifyProxies=!0),n!==void 0){var s=n===Cl?Cl:n===Lj;pe.enforceActions=s,pe.allowStateChanges=!(s===!0||s===Cl)}["computedRequiresReaction","reactionRequiresObservable","observableRequiresReaction","disableErrorBoundaries","safeDescriptors"].forEach(function(r){r in e&&(pe[r]=!!e[r])}),pe.allowStateReads=!pe.observableRequiresReaction,e.reactionScheduler&&vj(e.reactionScheduler)}function rb(e,t,n,s){var r=d2(t);return Jr(function(){var o=Ho(e,s)[je];gi(r).forEach(function(i){o.extend_(i,r[i],n&&i in n?n[i]:!0)})}),e}function Nj(e,t){return ob(Cc(e,t))}function ob(e){var t={name:e.name_};return e.observing_&&e.observing_.length>0&&(t.dependencies=$j(e.observing_).map(ob)),t}function $j(e){return Array.from(new Set(e))}var kj=0;function ib(){this.message="FLOW_CANCELLED"}ib.prototype=Object.create(Error.prototype);var Uu=Iv("flow"),Rj=Iv("flow.bound",{bound:!0}),Mo=Object.assign(function(t,n){if(za(n))return Uu.decorate_20223_(t,n);if(Oo(n))return Ba(t,n,Uu);var s=t,r=s.name||"<unnamed flow>",o=function(){var a=this,l=arguments,u=++kj,d=ai(r+" - runid: "+u+" - init",s).apply(a,l),f,p=void 0,g=new Promise(function(m,v){var b=0;f=v;function x(S){p=void 0;var C;try{C=ai(r+" - runid: "+u+" - yield "+b++,d.next).call(d,S)}catch(j){return v(j)}w(C)}function y(S){p=void 0;var C;try{C=ai(r+" - runid: "+u+" - yield "+b++,d.throw).call(d,S)}catch(j){return v(j)}w(C)}function w(S){if(fs(S==null?void 0:S.then)){S.then(w,v);return}return S.done?m(S.value):(p=Promise.resolve(S.value),p.then(x,y))}x(void 0)});return g.cancel=ai(r+" - runid: "+u+" - cancel",function(){try{p&&og(p);var m=d.return(void 0),v=Promise.resolve(m.value);v.then(oi,oi),og(v),f(new ib)}catch(b){f(b)}}),g};return o.isMobXFlow=!0,o},Uu);Mo.bound=Hs(Rj);function og(e){fs(e.cancel)&&e.cancel()}function ya(e){return(e==null?void 0:e.isMobXFlow)===!0}function Ij(e,t){return e?Za(e)||!!e[je]||ap(e)||xc(e)||Wa(e):!1}function fp(e){return Ij(e)}function Vj(e){if(Za(e))return e[je].ownKeys_();Ge(38)}function jl(e,t,n){return e.set(t,n),n}function si(e,t){if(e==null||typeof e!="object"||e instanceof Date||!fp(e))return e;if(cj(e)||Wa(e))return si(e.get(),t);if(t.has(e))return t.get(e);if(Ka(e)){var n=jl(t,e,new Array(e.length));return e.forEach(function(i,a){n[a]=si(i,t)}),n}if(as(e)){var s=jl(t,e,new Set);return e.forEach(function(i){s.add(si(i,t))}),s}if(Xr(e)){var r=jl(t,e,new Map);return e.forEach(function(i,a){r.set(a,si(i,t))}),r}else{var o=jl(t,e,{});return Vj(e).forEach(function(i){Da.propertyIsEnumerable.call(e,i)&&(o[i]=si(e[i],t))}),o}}function Lr(e,t){return si(e,new Map)}function sr(e,t){t===void 0&&(t=void 0),qn();try{return e.apply(t)}finally{Kn()}}function Ko(e){return e[je]}var Hj={has:function(t,n){return Ko(t).has_(n)},get:function(t,n){return Ko(t).get_(n)},set:function(t,n,s){var r;return Oo(n)?(r=Ko(t).set_(n,s,!0))!=null?r:!0:!1},deleteProperty:function(t,n){var s;return Oo(n)?(s=Ko(t).delete_(n,!0))!=null?s:!0:!1},defineProperty:function(t,n,s){var r;return(r=Ko(t).defineProperty_(n,s))!=null?r:!0},ownKeys:function(t){return Ko(t).ownKeys_()},preventExtensions:function(t){Ge(13)}};function Dj(e,t){var n,s;return Ov(),e=Ho(e,t),(s=(n=e[je]).proxy_)!=null?s:n.proxy_=new Proxy(e,Hj)}function Un(e){return e.interceptors_!==void 0&&e.interceptors_.length>0}function Ga(e,t){var n=e.interceptors_||(e.interceptors_=[]);return n.push(t),_v(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function Wn(e,t){var n=Vo();try{for(var s=[].concat(e.interceptors_||[]),r=0,o=s.length;r<o&&(t=s[r](t),t&&!t.type&&Ge(14),!!t);r++);return t}finally{lr(n)}}function cs(e){return e.changeListeners_!==void 0&&e.changeListeners_.length>0}function qa(e,t){var n=e.changeListeners_||(e.changeListeners_=[]);return n.push(t),_v(function(){var s=n.indexOf(t);s!==-1&&n.splice(s,1)})}function us(e,t){var n=Vo(),s=e.changeListeners_;if(s){s=s.slice();for(var r=0,o=s.length;r<o;r++)s[r](t);lr(n)}}function Fj(e,t,n){return Jr(function(){var s,r=Ho(e,n)[je];Jt.NODE_ENV!=="production"&&t&&e[ls],(s=t)!=null||(t=m2(e)),gi(t).forEach(function(o){return r.make_(o,t[o])})}),e}var Wu=Symbol("mobx-keys");function pn(e,t,n){return ur(e)?rb(e,e,t,n):(Jr(function(){var s=Ho(e,n)[je];if(!e[Wu]){var r=Object.getPrototypeOf(e),o=new Set([].concat(gi(e),gi(r)));o.delete("constructor"),o.delete(je),Fa(r,Wu,o)}e[Wu].forEach(function(i){return s.make_(i,t&&i in t?t[i]:!0)})}),e)}var ig="splice",Ds="update",Bj=1e4,zj={get:function(t,n){var s=t[je];return n===je?s:n==="length"?s.getArrayLength_():typeof n=="string"&&!isNaN(n)?s.get_(parseInt(n)):ar(wc,n)?wc[n]:t[n]},set:function(t,n,s){var r=t[je];return n==="length"&&r.setArrayLength_(s),typeof n=="symbol"||isNaN(n)?t[n]=s:r.set_(parseInt(n),s),!0},preventExtensions:function(){Ge(15)}},pp=function(){function e(n,s,r,o){n===void 0&&(n="ObservableArray"),this.owned_=void 0,this.legacyMode_=void 0,this.atom_=void 0,this.values_=[],this.interceptors_=void 0,this.changeListeners_=void 0,this.enhancer_=void 0,this.dehancer=void 0,this.proxy_=void 0,this.lastKnownLength_=0,this.owned_=r,this.legacyMode_=o,this.atom_=new Yr(n),this.enhancer_=function(i,a){return s(i,a,"ObservableArray[..]")}}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.dehanceValues_=function(s){return this.dehancer!==void 0&&s.length>0?s.map(this.dehancer):s},t.intercept_=function(s){return Ga(this,s)},t.observe_=function(s,r){return r===void 0&&(r=!1),r&&s({observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:"splice",index:0,added:this.values_.slice(),addedCount:this.values_.length,removed:[],removedCount:0}),qa(this,s)},t.getArrayLength_=function(){return this.atom_.reportObserved(),this.values_.length},t.setArrayLength_=function(s){(typeof s!="number"||isNaN(s)||s<0)&&Ge("Out of range: "+s);var r=this.values_.length;if(s!==r)if(s>r){for(var o=new Array(s-r),i=0;i<s-r;i++)o[i]=void 0;this.spliceWithArray_(r,0,o)}else this.spliceWithArray_(s,r-s)},t.updateArrayLength_=function(s,r){s!==this.lastKnownLength_&&Ge(16),this.lastKnownLength_+=r,this.legacyMode_&&r>0&&pb(s+r+1)},t.spliceWithArray_=function(s,r,o){var i=this;this.atom_;var a=this.values_.length;if(s===void 0?s=0:s>a?s=a:s<0&&(s=Math.max(0,a+s)),arguments.length===1?r=a-s:r==null?r=0:r=Math.max(0,Math.min(r,a-s)),o===void 0&&(o=ef),Un(this)){var l=Wn(this,{object:this.proxy_,type:ig,index:s,removedCount:r,added:o});if(!l)return ef;r=l.removedCount,o=l.added}if(o=o.length===0?o:o.map(function(f){return i.enhancer_(f,void 0)}),this.legacyMode_||Jt.NODE_ENV!=="production"){var u=o.length-r;this.updateArrayLength_(a,u)}var d=this.spliceItemsIntoValues_(s,r,o);return(r!==0||o.length!==0)&&this.notifyArraySplice_(s,o,d),this.dehanceValues_(d)},t.spliceItemsIntoValues_=function(s,r,o){if(o.length<Bj){var i;return(i=this.values_).splice.apply(i,[s,r].concat(o))}else{var a=this.values_.slice(s,s+r),l=this.values_.slice(s+r);this.values_.length+=o.length-r;for(var u=0;u<o.length;u++)this.values_[s+u]=o[u];for(var d=0;d<l.length;d++)this.values_[s+o.length+d]=l[d];return a}},t.notifyArrayChildUpdate_=function(s,r,o){var i=!this.owned_&&jo(),a=cs(this),l=a||i?{observableKind:"array",object:this.proxy_,type:Ds,debugObjectName:this.atom_.name_,index:s,newValue:r,oldValue:o}:null;this.atom_.reportChanged(),a&&us(this,l)},t.notifyArraySplice_=function(s,r,o){var i=!this.owned_&&jo(),a=cs(this),l=a||i?{observableKind:"array",object:this.proxy_,debugObjectName:this.atom_.name_,type:ig,index:s,removed:o,added:r,removedCount:o.length,addedCount:r.length}:null;this.atom_.reportChanged(),a&&us(this,l)},t.get_=function(s){if(this.legacyMode_&&s>=this.values_.length){console.warn("[mobx] Out of bounds read: "+s);return}return this.atom_.reportObserved(),this.dehanceValue_(this.values_[s])},t.set_=function(s,r){var o=this.values_;if(this.legacyMode_&&s>o.length&&Ge(17,s,o.length),s<o.length){this.atom_;var i=o[s];if(Un(this)){var a=Wn(this,{type:Ds,object:this.proxy_,index:s,newValue:r});if(!a)return;r=a.newValue}r=this.enhancer_(r,i);var l=r!==i;l&&(o[s]=r,this.notifyArrayChildUpdate_(s,r,i))}else{for(var u=new Array(s+1-o.length),d=0;d<u.length-1;d++)u[d]=void 0;u[u.length-1]=r,this.spliceWithArray_(o.length,0,u)}},e}();function Uj(e,t,n,s){return n===void 0&&(n="ObservableArray"),s===void 0&&(s=!1),Ov(),Jr(function(){var r=new pp(n,t,s,!1);Lv(r.values_,je,r);var o=new Proxy(r.values_,zj);return r.proxy_=o,e&&e.length&&r.spliceWithArray_(0,0,e),o})}var wc={clear:function(){return this.splice(0)},replace:function(t){var n=this[je];return n.spliceWithArray_(0,n.values_.length,t)},toJSON:function(){return this.slice()},splice:function(t,n){for(var s=arguments.length,r=new Array(s>2?s-2:0),o=2;o<s;o++)r[o-2]=arguments[o];var i=this[je];switch(arguments.length){case 0:return[];case 1:return i.spliceWithArray_(t);case 2:return i.spliceWithArray_(t,n)}return i.spliceWithArray_(t,n,r)},spliceWithArray:function(t,n,s){return this[je].spliceWithArray_(t,n,s)},push:function(){for(var t=this[je],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(t.values_.length,0,s),t.values_.length},pop:function(){return this.splice(Math.max(this[je].values_.length-1,0),1)[0]},shift:function(){return this.splice(0,1)[0]},unshift:function(){for(var t=this[je],n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.spliceWithArray_(0,0,s),t.values_.length},reverse:function(){return pe.trackingDerivation&&Ge(37,"reverse"),this.replace(this.slice().reverse()),this},sort:function(){pe.trackingDerivation&&Ge(37,"sort");var t=this.slice();return t.sort.apply(t,arguments),this.replace(t),this},remove:function(t){var n=this[je],s=n.dehanceValues_(n.values_).indexOf(t);return s>-1?(this.splice(s,1),!0):!1}};wt("at",Vn);wt("concat",Vn);wt("flat",Vn);wt("includes",Vn);wt("indexOf",Vn);wt("join",Vn);wt("lastIndexOf",Vn);wt("slice",Vn);wt("toString",Vn);wt("toLocaleString",Vn);wt("toSorted",Vn);wt("toSpliced",Vn);wt("with",Vn);wt("every",bs);wt("filter",bs);wt("find",bs);wt("findIndex",bs);wt("findLast",bs);wt("findLastIndex",bs);wt("flatMap",bs);wt("forEach",bs);wt("map",bs);wt("some",bs);wt("toReversed",bs);wt("reduce",ab);wt("reduceRight",ab);function wt(e,t){typeof Array.prototype[e]=="function"&&(wc[e]=t(e))}function Vn(e){return function(){var t=this[je];t.atom_.reportObserved();var n=t.dehanceValues_(t.values_);return n[e].apply(n,arguments)}}function bs(e){return function(t,n){var s=this,r=this[je];r.atom_.reportObserved();var o=r.dehanceValues_(r.values_);return o[e](function(i,a){return t.call(n,i,a,s)})}}function ab(e){return function(){var t=this,n=this[je];n.atom_.reportObserved();var s=n.dehanceValues_(n.values_),r=arguments[0];return arguments[0]=function(o,i,a){return r(o,i,a,t)},s[e].apply(s,arguments)}}var Wj=Zr("ObservableArrayAdministration",pp);function Ka(e){return zc(e)&&Wj(e[je])}var Gj={},Mr="add",Sc="delete",lb=function(){function e(n,s,r){var o=this;s===void 0&&(s=Ao),r===void 0&&(r="ObservableMap"),this.enhancer_=void 0,this.name_=void 0,this[je]=Gj,this.data_=void 0,this.hasMap_=void 0,this.keysAtom_=void 0,this.interceptors_=void 0,this.changeListeners_=void 0,this.dehancer=void 0,this.enhancer_=s,this.name_=r,fs(Map)||Ge(18),Jr(function(){o.keysAtom_=kv(Jt.NODE_ENV!=="production"?o.name_+".keys()":"ObservableMap.keys()"),o.data_=new Map,o.hasMap_=new Map,n&&o.merge(n)})}var t=e.prototype;return t.has_=function(s){return this.data_.has(s)},t.has=function(s){var r=this;if(!pe.trackingDerivation)return this.has_(s);var o=this.hasMap_.get(s);if(!o){var i=o=new Vr(this.has_(s),Uc,"ObservableMap.key?",!1);this.hasMap_.set(s,i),nb(i,function(){return r.hasMap_.delete(s)})}return o.get()},t.set=function(s,r){var o=this.has_(s);if(Un(this)){var i=Wn(this,{type:o?Ds:Mr,object:this,newValue:r,name:s});if(!i)return this;r=i.newValue}return o?this.updateValue_(s,r):this.addValue_(s,r),this},t.delete=function(s){var r=this;if(this.keysAtom_,Un(this)){var o=Wn(this,{type:Sc,object:this,name:s});if(!o)return!1}if(this.has_(s)){var i=jo(),a=cs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Sc,object:this,oldValue:this.data_.get(s).value_,name:s}:null;return sr(function(){var u;r.keysAtom_.reportChanged(),(u=r.hasMap_.get(s))==null||u.setNewValue_(!1);var d=r.data_.get(s);d.setNewValue_(void 0),r.data_.delete(s)}),a&&us(this,l),!0}return!1},t.updateValue_=function(s,r){var o=this.data_.get(s);if(r=o.prepareNewValue_(r),r!==pe.UNCHANGED){var i=jo(),a=cs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Ds,object:this,oldValue:o.value_,name:s,newValue:r}:null;o.setNewValue_(r),a&&us(this,l)}},t.addValue_=function(s,r){var o=this;this.keysAtom_,sr(function(){var u,d=new Vr(r,o.enhancer_,"ObservableMap.key",!1);o.data_.set(s,d),r=d.value_,(u=o.hasMap_.get(s))==null||u.setNewValue_(!0),o.keysAtom_.reportChanged()});var i=jo(),a=cs(this),l=a||i?{observableKind:"map",debugObjectName:this.name_,type:Mr,object:this,name:s,newValue:r}:null;a&&us(this,l)},t.get=function(s){return this.has(s)?this.dehanceValue_(this.data_.get(s).get()):this.dehanceValue_(void 0)},t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.keys=function(){return this.keysAtom_.reportObserved(),this.data_.keys()},t.values=function(){var s=this,r=this.keys();return ag({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:s.get(l)}}})},t.entries=function(){var s=this,r=this.keys();return ag({next:function(){var i=r.next(),a=i.done,l=i.value;return{done:a,value:a?void 0:[l,s.get(l)]}}})},t[Symbol.iterator]=function(){return this.entries()},t.forEach=function(s,r){for(var o=ii(this),i;!(i=o()).done;){var a=i.value,l=a[0],u=a[1];s.call(r,u,l,this)}},t.merge=function(s){var r=this;return Xr(s)&&(s=new Map(s)),sr(function(){ur(s)?u2(s).forEach(function(o){return r.set(o,s[o])}):Array.isArray(s)?s.forEach(function(o){var i=o[0],a=o[1];return r.set(i,a)}):Pi(s)?(c2(s)||Ge(19,s),s.forEach(function(o,i){return r.set(i,o)})):s!=null&&Ge(20,s)}),this},t.clear=function(){var s=this;sr(function(){Wv(function(){for(var r=ii(s.keys()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.replace=function(s){var r=this;return sr(function(){for(var o=qj(s),i=new Map,a=!1,l=ii(r.data_.keys()),u;!(u=l()).done;){var d=u.value;if(!o.has(d)){var f=r.delete(d);if(f)a=!0;else{var p=r.data_.get(d);i.set(d,p)}}}for(var g=ii(o.entries()),m;!(m=g()).done;){var v=m.value,b=v[0],x=v[1],y=r.data_.has(b);if(r.set(b,x),r.data_.has(b)){var w=r.data_.get(b);i.set(b,w),y||(a=!0)}}if(!a)if(r.data_.size!==i.size)r.keysAtom_.reportChanged();else for(var S=r.data_.keys(),C=i.keys(),j=S.next(),E=C.next();!j.done;){if(j.value!==E.value){r.keysAtom_.reportChanged();break}j=S.next(),E=C.next()}r.data_=i}),this},t.toString=function(){return"[object ObservableMap]"},t.toJSON=function(){return Array.from(this)},t.observe_=function(s,r){return qa(this,s)},t.intercept_=function(s){return Ga(this,s)},Oi(e,[{key:"size",get:function(){return this.keysAtom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Map"}}])}(),Xr=Zr("ObservableMap",lb);function ag(e){return e[Symbol.toStringTag]="MapIterator",mp(e)}function qj(e){if(Pi(e)||Xr(e))return e;if(Array.isArray(e))return new Map(e);if(ur(e)){var t=new Map;for(var n in e)t.set(n,e[n]);return t}else return Ge(21,e)}var Kj={},cb=function(){function e(n,s,r){var o=this;s===void 0&&(s=Ao),r===void 0&&(r="ObservableSet"),this.name_=void 0,this[je]=Kj,this.data_=new Set,this.atom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.dehancer=void 0,this.enhancer_=void 0,this.name_=r,fs(Set)||Ge(22),this.enhancer_=function(i,a){return s(i,a,r)},Jr(function(){o.atom_=kv(o.name_),n&&o.replace(n)})}var t=e.prototype;return t.dehanceValue_=function(s){return this.dehancer!==void 0?this.dehancer(s):s},t.clear=function(){var s=this;sr(function(){Wv(function(){for(var r=ii(s.data_.values()),o;!(o=r()).done;){var i=o.value;s.delete(i)}})})},t.forEach=function(s,r){for(var o=ii(this),i;!(i=o()).done;){var a=i.value;s.call(r,a,a,this)}},t.add=function(s){var r=this;if(this.atom_,Un(this)){var o=Wn(this,{type:Mr,object:this,newValue:s});if(!o)return this}if(!this.has(s)){sr(function(){r.data_.add(r.enhancer_(s,void 0)),r.atom_.reportChanged()});var i=Jt.NODE_ENV!=="production",a=cs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:Mr,object:this,newValue:s}:null;a&&us(this,l)}return this},t.delete=function(s){var r=this;if(Un(this)){var o=Wn(this,{type:Sc,object:this,oldValue:s});if(!o)return!1}if(this.has(s)){var i=Jt.NODE_ENV!=="production",a=cs(this),l=a||i?{observableKind:"set",debugObjectName:this.name_,type:Sc,object:this,oldValue:s}:null;return sr(function(){r.atom_.reportChanged(),r.data_.delete(s)}),a&&us(this,l),!0}return!1},t.has=function(s){return this.atom_.reportObserved(),this.data_.has(this.dehanceValue_(s))},t.entries=function(){var s=0,r=Array.from(this.keys()),o=Array.from(this.values());return lg({next:function(){var a=s;return s+=1,a<o.length?{value:[r[a],o[a]],done:!1}:{value:void 0,done:!0}}})},t.keys=function(){return this.values()},t.values=function(){this.atom_.reportObserved();var s=this,r=0,o=Array.from(this.data_.values());return lg({next:function(){return r<o.length?{value:s.dehanceValue_(o[r++]),done:!1}:{value:void 0,done:!0}}})},t.intersection=function(s){if(nr(s)&&!as(s))return s.intersection(this);var r=new Set(this);return r.intersection(s)},t.union=function(s){if(nr(s)&&!as(s))return s.union(this);var r=new Set(this);return r.union(s)},t.difference=function(s){return new Set(this).difference(s)},t.symmetricDifference=function(s){if(nr(s)&&!as(s))return s.symmetricDifference(this);var r=new Set(this);return r.symmetricDifference(s)},t.isSubsetOf=function(s){return new Set(this).isSubsetOf(s)},t.isSupersetOf=function(s){return new Set(this).isSupersetOf(s)},t.isDisjointFrom=function(s){if(nr(s)&&!as(s))return s.isDisjointFrom(this);var r=new Set(this);return r.isDisjointFrom(s)},t.replace=function(s){var r=this;return as(s)&&(s=new Set(s)),sr(function(){Array.isArray(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):nr(s)?(r.clear(),s.forEach(function(o){return r.add(o)})):s!=null&&Ge("Cannot initialize set from "+s)}),this},t.observe_=function(s,r){return qa(this,s)},t.intercept_=function(s){return Ga(this,s)},t.toJSON=function(){return Array.from(this)},t.toString=function(){return"[object ObservableSet]"},t[Symbol.iterator]=function(){return this.values()},Oi(e,[{key:"size",get:function(){return this.atom_.reportObserved(),this.data_.size}},{key:Symbol.toStringTag,get:function(){return"Set"}}])}(),as=Zr("ObservableSet",cb);function lg(e){return e[Symbol.toStringTag]="SetIterator",mp(e)}var cg=Object.create(null),ug="remove",ub=function(){function e(n,s,r,o){s===void 0&&(s=new Map),o===void 0&&(o=B2),this.target_=void 0,this.values_=void 0,this.name_=void 0,this.defaultAnnotation_=void 0,this.keysAtom_=void 0,this.changeListeners_=void 0,this.interceptors_=void 0,this.proxy_=void 0,this.isPlainObject_=void 0,this.appliedAnnotations_=void 0,this.pendingKeys_=void 0,this.target_=n,this.values_=s,this.name_=r,this.defaultAnnotation_=o,this.keysAtom_=new Yr("ObservableObject.keys"),this.isPlainObject_=ur(this.target_)}var t=e.prototype;return t.getObservablePropValue_=function(s){return this.values_.get(s).get()},t.setObservablePropValue_=function(s,r){var o=this.values_.get(s);if(o instanceof ps)return o.set(r),!0;if(Un(this)){var i=Wn(this,{type:Ds,object:this.proxy_||this.target_,name:s,newValue:r});if(!i)return null;r=i.newValue}if(r=o.prepareNewValue_(r),r!==pe.UNCHANGED){var a=cs(this),l=Jt.NODE_ENV!=="production",u=a||l?{type:Ds,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,oldValue:o.value_,name:s,newValue:r}:null;o.setNewValue_(r),a&&us(this,u)}return!0},t.get_=function(s){return pe.trackingDerivation&&!ar(this.target_,s)&&this.has_(s),this.target_[s]},t.set_=function(s,r,o){return o===void 0&&(o=!1),ar(this.target_,s)?this.values_.has(s)?this.setObservablePropValue_(s,r):o?Reflect.set(this.target_,s,r):(this.target_[s]=r,!0):this.extend_(s,{value:r,enumerable:!0,writable:!0,configurable:!0},this.defaultAnnotation_,o)},t.has_=function(s){if(!pe.trackingDerivation)return s in this.target_;this.pendingKeys_||(this.pendingKeys_=new Map);var r=this.pendingKeys_.get(s);return r||(r=new Vr(s in this.target_,Uc,"ObservableObject.key?",!1),this.pendingKeys_.set(s,r)),r.get()},t.make_=function(s,r){if(r===!0&&(r=this.defaultAnnotation_),r!==!1){if(!(s in this.target_)){var o;if((o=this.target_[ls])!=null&&o[s])return;Ge(1,r.annotationType_,this.name_+"."+s.toString())}for(var i=this.target_;i&&i!==Da;){var a=gc(i,s);if(a){var l=r.make_(this,s,a,i);if(l===0)return;if(l===1)break}i=Object.getPrototypeOf(i)}fg(this,r,s)}},t.extend_=function(s,r,o,i){if(i===void 0&&(i=!1),o===!0&&(o=this.defaultAnnotation_),o===!1)return this.defineProperty_(s,r,i);var a=o.extend_(this,s,r,i);return a&&fg(this,o,s),a},t.defineProperty_=function(s,r,o){o===void 0&&(o=!1),this.keysAtom_;try{qn();var i=this.delete_(s);if(!i)return i;if(Un(this)){var a=Wn(this,{object:this.proxy_||this.target_,name:s,type:Mr,newValue:r.value});if(!a)return null;var l=a.newValue;r.value!==l&&(r=_o({},r,{value:l}))}if(o){if(!Reflect.defineProperty(this.target_,s,r))return!1}else Vs(this.target_,s,r);this.notifyPropertyAddition_(s,r.value)}finally{Kn()}return!0},t.defineObservableProperty_=function(s,r,o,i){i===void 0&&(i=!1),this.keysAtom_;try{qn();var a=this.delete_(s);if(!a)return a;if(Un(this)){var l=Wn(this,{object:this.proxy_||this.target_,name:s,type:Mr,newValue:r});if(!l)return null;r=l.newValue}var u=dg(s),d={configurable:pe.safeDescriptors?this.isPlainObject_:!0,enumerable:!0,get:u.get,set:u.set};if(i){if(!Reflect.defineProperty(this.target_,s,d))return!1}else Vs(this.target_,s,d);var f=new Vr(r,o,Jt.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key",!1);this.values_.set(s,f),this.notifyPropertyAddition_(s,f.value_)}finally{Kn()}return!0},t.defineComputedProperty_=function(s,r,o){o===void 0&&(o=!1),this.keysAtom_;try{qn();var i=this.delete_(s);if(!i)return i;if(Un(this)){var a=Wn(this,{object:this.proxy_||this.target_,name:s,type:Mr,newValue:void 0});if(!a)return null}r.name||(r.name=Jt.NODE_ENV!=="production"?this.name_+"."+s.toString():"ObservableObject.key"),r.context=this.proxy_||this.target_;var l=dg(s),u={configurable:pe.safeDescriptors?this.isPlainObject_:!0,enumerable:!1,get:l.get,set:l.set};if(o){if(!Reflect.defineProperty(this.target_,s,u))return!1}else Vs(this.target_,s,u);this.values_.set(s,new ps(r)),this.notifyPropertyAddition_(s,void 0)}finally{Kn()}return!0},t.delete_=function(s,r){if(r===void 0&&(r=!1),this.keysAtom_,!ar(this.target_,s))return!0;if(Un(this)){var o=Wn(this,{object:this.proxy_||this.target_,name:s,type:ug});if(!o)return null}try{var i;qn();var a=cs(this),l=Jt.NODE_ENV!=="production"&&jo(),u=this.values_.get(s),d=void 0;if(!u&&(a||l)){var f;d=(f=gc(this.target_,s))==null?void 0:f.value}if(r){if(!Reflect.deleteProperty(this.target_,s))return!1}else delete this.target_[s];if(Jt.NODE_ENV,u&&(this.values_.delete(s),u instanceof Vr&&(d=u.value_),Xv(u)),this.keysAtom_.reportChanged(),(i=this.pendingKeys_)==null||(i=i.get(s))==null||i.set(s in this.target_),a||l){var p={type:ug,observableKind:"object",object:this.proxy_||this.target_,debugObjectName:this.name_,oldValue:d,name:s};Jt.NODE_ENV,a&&us(this,p),Jt.NODE_ENV}}finally{Kn()}return!0},t.observe_=function(s,r){return qa(this,s)},t.intercept_=function(s){return Ga(this,s)},t.notifyPropertyAddition_=function(s,r){var o,i=cs(this),a=Jt.NODE_ENV!=="production";if(i||a){var l=i||a?{type:Mr,observableKind:"object",debugObjectName:this.name_,object:this.proxy_||this.target_,name:s,newValue:r}:null;i&&us(this,l)}(o=this.pendingKeys_)==null||(o=o.get(s))==null||o.set(!0),this.keysAtom_.reportChanged()},t.ownKeys_=function(){return this.keysAtom_.reportObserved(),gi(this.target_)},t.keys_=function(){return this.keysAtom_.reportObserved(),Object.keys(this.target_)},e}();function Ho(e,t){var n;if(ar(e,je))return e;var s=(n=t==null?void 0:t.name)!=null?n:"ObservableObject",r=new ub(e,new Map,String(s),Q2(t));return Fa(e,je,r),e}var Zj=Zr("ObservableObjectAdministration",ub);function dg(e){return cg[e]||(cg[e]={get:function(){return this[je].getObservablePropValue_(e)},set:function(n){return this[je].setObservablePropValue_(e,n)}})}function Za(e){return zc(e)?Zj(e[je]):!1}function fg(e,t,n){var s;(s=e.target_[ls])==null||delete s[n]}var Yj=fb(0),Xj=function(){var e=!1,t={};return Object.defineProperty(t,"0",{set:function(){e=!0}}),Object.create(t)[0]=1,e===!1}(),Gu=0,db=function(){};function Jj(e,t){Object.setPrototypeOf?Object.setPrototypeOf(e.prototype,t):e.prototype.__proto__!==void 0?e.prototype.__proto__=t:e.prototype=t}Jj(db,Array.prototype);var hp=function(e){function t(s,r,o,i){var a;return o===void 0&&(o="ObservableArray"),i===void 0&&(i=!1),a=e.call(this)||this,Jr(function(){var l=new pp(o,r,i,!0);l.proxy_=a,Lv(a,je,l),s&&s.length&&a.spliceWithArray(0,0,s),Xj&&Object.defineProperty(a,"0",Yj)}),a}$v(t,e);var n=t.prototype;return n.concat=function(){this[je].atom_.reportObserved();for(var r=arguments.length,o=new Array(r),i=0;i<r;i++)o[i]=arguments[i];return Array.prototype.concat.apply(this.slice(),o.map(function(a){return Ka(a)?a.slice():a}))},n[Symbol.iterator]=function(){var s=this,r=0;return mp({next:function(){return r<s.length?{value:s[r++],done:!1}:{done:!0,value:void 0}}})},Oi(t,[{key:"length",get:function(){return this[je].getArrayLength_()},set:function(r){this[je].setArrayLength_(r)}},{key:Symbol.toStringTag,get:function(){return"Array"}}])}(db);Object.entries(wc).forEach(function(e){var t=e[0],n=e[1];t!=="concat"&&Fa(hp.prototype,t,n)});function fb(e){return{enumerable:!1,configurable:!0,get:function(){return this[je].get_(e)},set:function(n){this[je].set_(e,n)}}}function Qj(e){Vs(hp.prototype,""+e,fb(e))}function pb(e){if(e>Gu){for(var t=Gu;t<e+100;t++)Qj(t);Gu=e}}pb(1e3);function eE(e,t,n){return new hp(e,t,n)}function Cc(e,t){if(typeof e=="object"&&e!==null){if(Ka(e))return t!==void 0&&Ge(23),e[je].atom_;if(as(e))return e.atom_;if(Xr(e)){if(t===void 0)return e.keysAtom_;var n=e.data_.get(t)||e.hasMap_.get(t);return n||Ge(25,t,uf(e)),n}if(Za(e)){if(!t)return Ge(26);var s=e[je].values_.get(t);return s||Ge(27,t,uf(e)),s}if(ap(e)||Wa(e)||xc(e))return e}else if(fs(e)&&xc(e[je]))return e[je];Ge(28)}function tE(e,t){if(e||Ge(29),ap(e)||Wa(e)||xc(e)||Xr(e)||as(e))return e;if(e[je])return e[je];Ge(24,e)}function uf(e,t){var n;if(t!==void 0)n=Cc(e,t);else{if(ba(e))return e.name;Za(e)||Xr(e)||as(e)?n=tE(e):n=Cc(e)}return n.name_}function Jr(e){var t=Vo(),n=cp(!0);qn();try{return e()}finally{Kn(),up(n),lr(t)}}var pg=Da.toString;function gp(e,t,n){return n===void 0&&(n=-1),df(e,t,n)}function df(e,t,n,s,r){if(e===t)return e!==0||1/e===1/t;if(e==null||t==null)return!1;if(e!==e)return t!==t;var o=typeof e;if(o!=="function"&&o!=="object"&&typeof t!="object")return!1;var i=pg.call(e);if(i!==pg.call(t))return!1;switch(i){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:+e==0?1/+e===1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t;case"[object Symbol]":return typeof Symbol<"u"&&Symbol.valueOf.call(e)===Symbol.valueOf.call(t);case"[object Map]":case"[object Set]":n>=0&&n++;break}e=hg(e),t=hg(t);var a=i==="[object Array]";if(!a){if(typeof e!="object"||typeof t!="object")return!1;var l=e.constructor,u=t.constructor;if(l!==u&&!(fs(l)&&l instanceof l&&fs(u)&&u instanceof u)&&"constructor"in e&&"constructor"in t)return!1}if(n===0)return!1;n<0&&(n=-1),s=s||[],r=r||[];for(var d=s.length;d--;)if(s[d]===e)return r[d]===t;if(s.push(e),r.push(t),a){if(d=e.length,d!==t.length)return!1;for(;d--;)if(!df(e[d],t[d],n-1,s,r))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],!(ar(t,p)&&df(e[p],t[p],n-1,s,r)))return!1}return s.pop(),r.pop(),!0}function hg(e){return Ka(e)?e.slice():Pi(e)||Xr(e)||nr(e)||as(e)?Array.from(e.entries()):e}var gg,nE=((gg=Bc().Iterator)==null?void 0:gg.prototype)||{};function mp(e){return e[Symbol.iterator]=sE,Object.assign(Object.create(nE),e)}function sE(){return this}["Symbol","Map","Set"].forEach(function(e){var t=Bc();typeof t[e]>"u"&&Ge("MobX requires global '"+e+"' to be available or polyfilled")});typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__=="object"&&__MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({spy:bj,extras:{getDebugName:uf},$mobx:je});if(!h.useState)throw new Error("mobx-react-lite requires React with Hooks support");if(!Fj)throw new Error("mobx-react-lite@3 requires mobx at least version 6 to be available");function rE(e){e()}function oE(e){e||(e=rE),Mj({reactionScheduler:e})}function iE(e){return Nj(e)}var aE=1e4,lE=1e4,cE=function(){function e(t){var n=this;Object.defineProperty(this,"finalize",{enumerable:!0,configurable:!0,writable:!0,value:t}),Object.defineProperty(this,"registrations",{enumerable:!0,configurable:!0,writable:!0,value:new Map}),Object.defineProperty(this,"sweepTimeout",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sweep",{enumerable:!0,configurable:!0,writable:!0,value:function(s){s===void 0&&(s=aE),clearTimeout(n.sweepTimeout),n.sweepTimeout=void 0;var r=Date.now();n.registrations.forEach(function(o,i){r-o.registeredAt>=s&&(n.finalize(o.value),n.registrations.delete(i))}),n.registrations.size>0&&n.scheduleSweep()}}),Object.defineProperty(this,"finalizeAllImmediately",{enumerable:!0,configurable:!0,writable:!0,value:function(){n.sweep(0)}})}return Object.defineProperty(e.prototype,"register",{enumerable:!1,configurable:!0,writable:!0,value:function(t,n,s){this.registrations.set(s,{value:n,registeredAt:Date.now()}),this.scheduleSweep()}}),Object.defineProperty(e.prototype,"unregister",{enumerable:!1,configurable:!0,writable:!0,value:function(t){this.registrations.delete(t)}}),Object.defineProperty(e.prototype,"scheduleSweep",{enumerable:!1,configurable:!0,writable:!0,value:function(){this.sweepTimeout===void 0&&(this.sweepTimeout=setTimeout(this.sweep,lE))}}),e}(),uE=typeof FinalizationRegistry<"u"?FinalizationRegistry:cE,ff=new uE(function(e){var t;(t=e.reaction)===null||t===void 0||t.dispose(),e.reaction=null}),hb={exports:{}},qu={};/**
|
|
68
8
|
* @license React
|
|
69
9
|
* use-sync-external-store-shim.production.min.js
|
|
70
10
|
*
|
|
@@ -72,43 +12,38 @@ Use 'override' annotation for methods overridden by subclass.`)}}var tE=av(0),nE
|
|
|
72
12
|
*
|
|
73
13
|
* This source code is licensed under the MIT license found in the
|
|
74
14
|
* LICENSE file in the root directory of this source tree.
|
|
75
|
-
*/var ng;function mE(){if(ng)return $u;ng=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,s=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(f,p){var g=p(),m=s({inst:{value:g,getSnapshot:p}}),b=m[0].inst,v=m[1];return o(function(){b.value=g,b.getSnapshot=p,l(b)&&v({inst:b})},[f,g,p]),r(function(){return l(b)&&v({inst:b}),f(function(){l(b)&&v({inst:b})})},[f]),i(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:a;return $u.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,$u}var ku={},sg;function bE(){if(sg)return ku;sg=1;var e={};/**
|
|
76
|
-
* @license React
|
|
77
|
-
|
|
78
|
-
*
|
|
79
|
-
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
80
|
-
*
|
|
81
|
-
* This source code is licensed under the MIT license found in the
|
|
82
|
-
* LICENSE file in the root directory of this source tree.
|
|
83
|
-
*/return e.NODE_ENV!=="production"&&function(){typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStart(new Error);var t=h,n=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function s(S){{for(var C=arguments.length,j=new Array(C>1?C-1:0),E=1;E<C;E++)j[E-1]=arguments[E];r("error",S,j)}}function r(S,C,j){{var E=n.ReactDebugCurrentFrame,_=E.getStackAddendum();_!==""&&(C+="%s",j=j.concat([_]));var T=j.map(function(P){return String(P)});T.unshift("Warning: "+C),Function.prototype.apply.call(console[S],console,T)}}function o(S,C){return S===C&&(S!==0||1/S===1/C)||S!==S&&C!==C}var i=typeof Object.is=="function"?Object.is:o,a=t.useState,l=t.useEffect,u=t.useLayoutEffect,d=t.useDebugValue,f=!1,p=!1;function g(S,C,j){f||t.startTransition!==void 0&&(f=!0,s("You are using an outdated, pre-release alpha of React 18 that does not support useSyncExternalStore. The use-sync-external-store shim will not work correctly. Upgrade to a newer pre-release."));var E=C();if(!p){var _=C();i(E,_)||(s("The result of getSnapshot should be cached to avoid an infinite loop"),p=!0)}var T=a({inst:{value:E,getSnapshot:C}}),P=T[0].inst,A=T[1];return u(function(){P.value=E,P.getSnapshot=C,m(P)&&A({inst:P})},[S,E,C]),l(function(){m(P)&&A({inst:P});var M=function(){m(P)&&A({inst:P})};return S(M)},[S]),d(E),E}function m(S){var C=S.getSnapshot,j=S.value;try{var E=C();return!i(j,E)}catch{return!0}}function b(S,C,j){return C()}var v=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u",x=!v,y=x?b:g,w=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:y;ku.useSyncExternalStore=w,typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop=="function"&&__REACT_DEVTOOLS_GLOBAL_HOOK__.registerInternalModuleStop(new Error)}(),ku}var vE={};vE.NODE_ENV==="production"?Xd.exports=mE():Xd.exports=bE();var yE=Xd.exports;function rg(e){e.reaction=new rr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function xE(e,t){t===void 0&&(t="observed");var n=h.useRef(null);if(!n.current){var s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(a){return Zd.unregister(s),s.onStoreChange=a,s.reaction||(rg(s),s.stateVersion=Symbol()),function(){var l;s.onStoreChange=null,(l=s.reaction)===null||l===void 0||l.dispose(),s.reaction=null}},getSnapshot:function(){return s.stateVersion}};n.current=s}var r=n.current;r.reaction||(rg(r),Zd.register(n,r,r)),h.useDebugValue(r.reaction,dE),yE.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);var o,i;if(r.reaction.track(function(){try{o=e()}catch(a){i=a}}),i)throw i;return o}var og={},Vu,Iu,ig=!0,dv=typeof Symbol=="function"&&Symbol.for,wE=(Iu=(Vu=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Vu===void 0?void 0:Vu.configurable)!==null&&Iu!==void 0?Iu:!1,ag=dv?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,lg=dv?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function fe(e,t){var n;if(og.NODE_ENV!=="production"&&ig&&t&&(ig=!1,console.warn("[mobx-react-lite] `observer(fn, { forwardRef: true })` is deprecated, use `observer(React.forwardRef(fn))`")),lg&&e.$$typeof===lg)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var s=(n=void 0)!==null&&n!==void 0?n:!1,r=e,o=e.displayName||e.name;if(ag&&e.$$typeof===ag&&(s=!0,r=e.render,typeof r!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var i=function(a,l){return xE(function(){return r(a,l)},o)};return i.displayName=e.displayName,wE&&Object.defineProperty(i,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(i.contextTypes=e.contextTypes),s&&(i=h.forwardRef(i)),i=h.memo(i),CE(e,i),og.NODE_ENV!=="production"&&Object.defineProperty(i,"contextTypes",{set:function(){var a,l;throw new Error("[mobx-react-lite] `".concat(this.displayName||((a=this.type)===null||a===void 0?void 0:a.displayName)||((l=this.type)===null||l===void 0?void 0:l.name)||"Component",".contextTypes` must be set before applying `observer`."))}}),i}var SE={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function CE(e,t){Object.keys(e).forEach(function(n){SE[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Du;uE(Dn.unstable_batchedUpdates);Du=Zd.finalizeAllImmediately;const cg=new Map,jE=(e,t)=>`${t}-${e}`,fv=h.forwardRef(function({svg:t,iconSize:n,...s},r){const o=jE(t,n);let i=cg.get(o);return i||(i=vw(t,n),cg.set(o,i)),c.jsx("div",{...s,ref:r,dangerouslySetInnerHTML:{__html:i}})});let pv;const EE=e=>{pv=e},PE=()=>pv;var Z=(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))(Z||{});const Zl={alertRhombus:iS,alignHorizontalCenter:aS,alignHorizontalLeft:lS,alignHorizontalRight:cS,applicationBracketsOutline:uS,arrowDown:dS,arrowExpandAll:fS,arrowRight:pS,arrowULeftTop:hS,arrowURightTop:gS,borderAllVariant:bS,borderRadius:vS,borderStyle:yS,calendar:xS,cellphoneLink:wS,check:gb,checkBold:CS,checkboxBlank:jS,chevronUp:TS,chevronDown:ES,chevronLeft:PS,chevronRight:_S,close:mb,codeBraces:AS,cog:LS,contentCopy:RS,contentSave:$S,delete:BS,dotsVertical:zS,email:US,emailOutline:WS,eye:GS,eyedropperVariant:ZS,eyeOff:qS,eyeOffOutline:KS,eyeOutline:YS,fire:JS,flare:QS,floppy:e2,folder:t2,fullscreen:n2,gradientVertical:s2,helpCircle:r2,home:o2,image:i2,information:l2,informationVariant:c2,layers:u2,link:p2,lock:g2,lockOpenVariant:m2,menuDown:b2,newspaperVariantOutline:x2,openInNew:bb,paletteSwatch:C2,panVertical:j2,pencil:E2,phone:P2,plus:_2,plusBox:T2,powerPlug:O2,refresh:A2,rhombusOutline:N2,rhombusSplit:M2,rhombusSplitOutline:L2,tag:k2,target:V2,targetVariant:I2,textBoxMultiple:D2,trayArrowDown:B2,unfoldLessHorizontal:z2,unfoldMoreHorizontal:U2,viewDayOutline:G2,viewGridPlus:q2,web:K2,xml:Y2,database:VS,databaseOutline:HS,databaseOutlineOn:DS,databaseOutlineOff:IS,databaseOutlineRemove:FS,codeBrackets:NS,toggleSwitchOutline:F2,toggleSwitchOffOutline:H2,null:w2,string:MS,number:S2,cloudUpload:OS,chat:SS,creation:kS,viewDashboard:W2,rocketLaunch:R2,lightningBolt:f2,stop:$2,arrowUp:mS},_E="gs-cmp-icon",oe=fe(function({className:t,icon:n,size:s,rotate:r,horizontal:o,vertical:i}){const a=PE(),l=(a==null?void 0:a[n])||(Zl==null?void 0:Zl[n])||n,u=[o&&"scaleX(-1)",i&&"scaleY(-1)",r&&`rotate(${r}deg)`].filter(f=>!!f).join(" ");if(!l)return null;const d=N(_E,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(fv,{className:d,style:{transform:u||void 0},svg:l,iconSize:s}):c.jsx(Wi,{className:d,path:l,size:s,rotate:r,horizontal:o,vertical:i})}),tp=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"},hv={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"},TE={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},OE={leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"},AE={...TE,...OE},je={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"},np={bg:z.bg,bgH:z.bgH},ug={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"},re={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"},pa={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"},le={s3x:"13px",s2x:"14px",sx:"16px",s:"18px",m:"20px",l:"22px"},Ee={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"},$r={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"},cn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},kn={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"},Ks="gs-utl-my-2",NE="gs-utl-my-3",dg=` gs-utl-rounded ${kn.xs} ${cn.mono} ${z.bgH25}`,fg=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${Ks} gs-utl-ml-1`,Nt={h1:`${kn.xl2} ${cn.bold} ${NE}`,h2:`${kn.xl} ${cn.bold} ${Ks}`,h3:`${kn.lg} ${cn.semibold} ${Ks}`,h4:`${kn.base} ${cn.semibold} ${Ks}`,h5:`${kn.sm} ${cn.semibold} ${Ks}`,h6:`${kn.xs} ${cn.semibold} ${Ks}`,strong:cn.bold,em:cn.italic,ul:`gs-utl-list-disc ${fg}`,ol:`gs-utl-list-decimal ${fg}`,codeInline:`${dg} gs-utl-px-1 gs-utl-py-0.5`,pre:`${dg} gs-utl-p-3 gs-utl-overflow-x-auto ${Ks}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${Ks} ${cn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${Ks}`,thead:`${z.bgH2}`,tr:`gs-utl-border-b ${z.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${cn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},hl={s:"gs-utl-size-5",m:"gs-utl-size-10"},sp={itemList:({index:e=0,open:t=!1,length:n=0}={})=>ee(z.bgH2,je.xyS,z.br,e&&re.bt,(t||e===n-1)&&re.bb)},gv=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),mv=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},bv=({variant:e,size:t="m",className:n,disabledClassName:s,active:r,border:o=!0,rounded:i=!0,disabled:a=!1,withBg:l,block:u,full:d})=>{const f=e==="pr",p=e==="out",g=e==="out-clear",m=e==="warn",b=e==="danger",v=o&&(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,i&&re.rnd,l&&z.bg,v?ee(re.b,z.br,p&&z.bA,p&&z.tAo,!a&&z.hBgH):ee(re.b,re.bT),m&&ee(z.bgW,!a&&z.hBgW,"gs-utl-text-white"),b&&ee(z.bgRed,!a&&z.hBgRed,"gs-utl-text-white"),f&&ee(z.bgA2,!a&&z.hBgAct),r&&z.bgA,a&&(s??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",pa.focus]};function Ke({children:e,...t}){const{variant:n,size:s,active:r,border:o,rounded:i,block:a,full:l,className:u,icon:d,loading:f,withBg:p,disabled:g,type:m="button",disabledClassName:b,...v}=t,x=f?{icon:h2,size:"18px",className:ee("animate-spin-fast")}:ot(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:ee(bv(t)),disabled:g||f,type:m,...v,children:x?c.jsxs(k,{className:ee("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(D,{children:c.jsx(oe,{...x})}),e&&c.jsx(D,{children:e})]}):e})}const ME=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],LE=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],Do="gs-cmp-ai-chat-empty",RE=({className:e,style:t,chatContext:n,editor:s,suggestions:r})=>{const{sendMessage:o}=n,i="aiChat.emptyState",a=N(Do,e,"gs-utl-flex gs-utl-flex-col gs-utl-items-center gs-utl-justify-center gs-utl-h-full gs-utl-text-center gs-utl-p-6"),l=s.t(`${i}.title`),u=s.t(`${i}.subtitle`),d=kw(s)?LE:ME,f=r??d;return c.jsxs(k,{className:a,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(k,{className:`${Do}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:N(`${Do}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:N(`${Do}__subtitle`,z.txtLowEmphasis),children:u})]}),c.jsx(k,{col:!0,className:`${Do}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:f.map(p=>{const g=s.t(`${i}.suggestions.${p.id}`)||p.label,m=p.prompt??g;return c.jsx(Ke,{className:`${Do}__suggestion`,onClick:()=>o({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},p.id)})})]})},Li="gs-cmp-ai-chat-error",$E=({className:e,style:t,chatContext:n,editor:s})=>{var a;const r=N(Li,e,z.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),o=`${Li}__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(k,{className:r,style:t,gap:"xs",col:!0,children:[c.jsxs(k,{className:`${Li}__header`,items:"center",gap:"xs",children:[c.jsx(D,{className:`${Li}__header-title`,grow:!0,children:s.t("aiChat.error.title")}),c.jsx(Ke,{className:`${Li}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(D,{className:o,grow:!0,children:(a=n.error)==null?void 0:a.message})]})},Hu="gs-cmp-ai-chat-header",kE=({className:e,chatContext:t,editor:n,...s})=>{const{messages:r,setMessages:o}=t,i=N(Hu,e,re.bb,z.br,je.s),a="aiChat.header";return c.jsxs(k,{className:i,items:"center",gap:"xs",...s,children:[c.jsx(D,{className:`${Hu}__title`,grow:!0,children:n.t(`${a}.title`)}),r.length>0&&c.jsx(Ke,{className:N(`${Hu}__btn-clear`,Ee.hover,re.none,je.xS),onClick:()=>o([]),size:"xs",border:!1,icon:"delete",children:n.t(`${a}.clear`)})]})};function Co({full:e,abs:t,small:n,size:s,className:r,bg:o,currentColor:i}){const a=N(e&&"gs-utl-w-full gs-utl-h-full",t?Ee.coverAbs:"gs-utl-relative",r),l=N(!s&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),s==="x2s"&&"gs-utl-size-3",s==="xs"&&"gs-utl-size-4",s==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",re.pill,re.bS,i?"gs-utl-border-current":re.bA);return c.jsxs(k,{className:a,items:"center",justify:"center",children:[!!o&&c.jsx("div",{className:N(Ee.coverAbs,z.bg,Ee.disabled)}),c.jsx("div",{className:l})]})}function Ho(e,t,n){let s=n.initialDeps??[],r;return()=>{var o,i,a,l;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==s.length||d.some((g,m)=>s[m]!==g)))return r;s=d;let p;if(n.key&&((i=n.debug)!=null&&i.call(n))&&(p=Date.now()),r=t(...d),n.key&&((a=n.debug)!=null&&a.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-p)*100)/100,b=m/16,v=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x};console.info(`%c⏱ ${v(m,5)} /${v(g,5)} ms`,`
|
|
15
|
+
*/var mg;function dE(){if(mg)return qu;mg=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,s=e.useState,r=e.useEffect,o=e.useLayoutEffect,i=e.useDebugValue;function a(f,p){var g=p(),m=s({inst:{value:g,getSnapshot:p}}),v=m[0].inst,b=m[1];return o(function(){v.value=g,v.getSnapshot=p,l(v)&&b({inst:v})},[f,g,p]),r(function(){return l(v)&&b({inst:v}),f(function(){l(v)&&b({inst:v})})},[f]),i(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:a;return qu.useSyncExternalStore=e.useSyncExternalStore!==void 0?e.useSyncExternalStore:d,qu}hb.exports=dE();var fE=hb.exports;function vg(e){e.reaction=new dr("observer".concat(e.name),function(){var t;e.stateVersion=Symbol(),(t=e.onStoreChange)===null||t===void 0||t.call(e)})}function pE(e,t){t===void 0&&(t="observed");var n=h.useRef(null);if(!n.current){var s={reaction:null,onStoreChange:null,stateVersion:Symbol(),name:t,subscribe:function(a){return ff.unregister(s),s.onStoreChange=a,s.reaction||(vg(s),s.stateVersion=Symbol()),function(){var l;s.onStoreChange=null,(l=s.reaction)===null||l===void 0||l.dispose(),s.reaction=null}},getSnapshot:function(){return s.stateVersion}};n.current=s}var r=n.current;r.reaction||(vg(r),ff.register(n,r,r)),h.useDebugValue(r.reaction,iE),fE.useSyncExternalStore(r.subscribe,r.getSnapshot,r.getSnapshot);var o,i;if(r.reaction.track(function(){try{o=e()}catch(a){i=a}}),i)throw i;return o}var Ku,Zu,gb=typeof Symbol=="function"&&Symbol.for,hE=(Zu=(Ku=Object.getOwnPropertyDescriptor(function(){},"name"))===null||Ku===void 0?void 0:Ku.configurable)!==null&&Zu!==void 0?Zu:!1,bg=gb?Symbol.for("react.forward_ref"):typeof h.forwardRef=="function"&&h.forwardRef(function(e){return null}).$$typeof,yg=gb?Symbol.for("react.memo"):typeof h.memo=="function"&&h.memo(function(e){return null}).$$typeof;function ce(e,t){var n;if(yg&&e.$$typeof===yg)throw new Error("[mobx-react-lite] You are trying to use `observer` on a function component wrapped in either another `observer` or `React.memo`. The observer already applies 'React.memo' for you.");var s=(n=void 0)!==null&&n!==void 0?n:!1,r=e,o=e.displayName||e.name;if(bg&&e.$$typeof===bg&&(s=!0,r=e.render,typeof r!="function"))throw new Error("[mobx-react-lite] `render` property of ForwardRef was not a function");var i=function(a,l){return pE(function(){return r(a,l)},o)};return i.displayName=e.displayName,hE&&Object.defineProperty(i,"name",{value:e.name,writable:!0,configurable:!0}),e.contextTypes&&(i.contextTypes=e.contextTypes),s&&(i=h.forwardRef(i)),i=h.memo(i),mE(e,i),i}var gE={$$typeof:!0,render:!0,compare:!0,type:!0,displayName:!0};function mE(e,t){Object.keys(e).forEach(function(n){gE[n]||Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))})}var Yu;oE(Gn.unstable_batchedUpdates);Yu=ff.finalizeAllImmediately;const xg=new Map,vE=(e,t)=>`${t}-${e}`,mb=h.forwardRef(function({svg:t,iconSize:n,...s},r){const o=vE(t,n);let i=xg.get(o);return i||(i=Kw(t,n),xg.set(o,i)),c.jsx("div",{...s,ref:r,dangerouslySetInnerHTML:{__html:i}})});let vb;const bE=e=>{vb=e},yE=()=>vb;var G=(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))(G||{});const ac={alertRhombus:dS,alignHorizontalCenter:fS,alignHorizontalLeft:pS,alignHorizontalRight:hS,applicationBracketsOutline:gS,arrowDown:mS,arrowExpandAll:vS,arrowRight:bS,arrowULeftTop:yS,arrowURightTop:xS,borderAllVariant:SS,borderRadius:CS,borderStyle:jS,calendar:ES,cellphoneLink:TS,check:Sv,checkBold:OS,checkboxBlank:_S,chevronUp:NS,chevronDown:AS,chevronLeft:LS,chevronRight:MS,close:Cv,codeBraces:kS,cog:VS,contentCopy:HS,contentSave:DS,delete:qS,dotsVertical:KS,email:ZS,emailOutline:YS,eye:XS,eyedropperVariant:tC,eyeOff:JS,eyeOffOutline:QS,eyeOutline:eC,fire:sC,flare:rC,floppy:oC,folder:iC,fullscreen:aC,gradientVertical:lC,helpCircle:cC,home:uC,image:dC,information:pC,informationVariant:hC,layers:gC,link:bC,lock:xC,lockOpenVariant:wC,menuDown:SC,newspaperVariantOutline:EC,openInNew:jv,paletteSwatch:OC,panVertical:_C,pencil:AC,phone:LC,plus:MC,plusBox:NC,powerPlug:$C,refresh:kC,rhombusOutline:RC,rhombusSplit:IC,rhombusSplitOutline:VC,tag:FC,target:BC,targetVariant:zC,textBoxMultiple:UC,trayArrowDown:qC,unfoldLessHorizontal:KC,unfoldMoreHorizontal:ZC,viewDayOutline:XC,viewGridPlus:JC,web:QC,xml:e2,database:BS,databaseOutline:WS,databaseOutlineOn:US,databaseOutlineOff:zS,databaseOutlineRemove:GS,codeBrackets:RS,toggleSwitchOutline:GC,toggleSwitchOffOutline:WC,null:TC,string:IS,number:PC,cloudUpload:$S,chat:PS,creation:FS,viewDashboard:YC,rocketLaunch:HC,lightningBolt:vC,stop:DC,arrowUp:wS},xE="gs-cmp-icon",ne=ce(function({className:t,icon:n,size:s,rotate:r,horizontal:o,vertical:i}){const a=yE(),l=(a==null?void 0:a[n])||(ac==null?void 0:ac[n])||n,u=[o&&"scaleX(-1)",i&&"scaleY(-1)",r&&`rotate(${r}deg)`].filter(f=>!!f).join(" ");if(!l)return null;const d=M(xE,t);return l.startsWith("<svg")||l.startsWith("<?xml")?c.jsx(mb,{className:d,style:{transform:u||void 0},svg:l,iconSize:s}):c.jsx(Ji,{className:d,path:l,size:s,rotate:r,horizontal:o,vertical:i})}),vp=150,B={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"},bb={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"},wE={enter:"gs-utl-transition gs-utl-duration-100 gs-utl-ease-out",enterFrom:"gs-utl-opacity-0",enterTo:"gs-utl-opacity-100"},SE={leave:"gs-utl-transition gs-utl-ease-in gs-utl-duration-100",leaveFrom:"gs-utl-opacity-100",leaveTo:"gs-utl-opacity-0"},CE={...wE,...SE},Ee={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"},bp={bg:B.bg,bgH:B.bgH},wg={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"},xa={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"},Oe={click:"gs-utl-cursor-pointer gs-utl-transition-opacity gs-utl-opacity-75 hover:gs-utl-opacity-100",hover:"gs-utl-transition-opacity gs-utl-opacity-50 hover:gs-utl-opacity-100",hoverM:"gs-utl-transition-opacity gs-utl-opacity-80 hover:gs-utl-opacity-100",hoverGroup:"group-hover:gs-utl-opacity-100 gs-utl-opacity-0 gs-utl-transition-opacity",dot:"gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",scrollX:"gs-utl-overflow-x-auto gs-utl-overflow-y-hidden",scrollY:"gs-utl-overflow-y-auto gs-utl-overflow-x-hidden",txtEllips:"gs-utl-text-ellipsis gs-utl-overflow-hidden gs-utl-whitespace-nowrap",coverAbs:"gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-w-full gs-utl-h-full",hiddenVisually:"gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001]",disabled:"gs-utl-opacity-50 gs-utl-pointer-events-none",disabledM:"gs-utl-opacity-50 gs-utl-cursor-not-allowed",noFocusOut:"focus:gs-utl-outline-none",noResize:"gs-utl-resize-none",spin:"gs-utl-animate-spin-fast",bounce:"gs-utl-animate-bounce"},Fr={link:B.tAo,inputText:"gs-theme-elStyles-inputText focus:gs-utl-outline-none gs-utl-placeholder:text-neutral-400 placeholder:dark:gs-utl-text-neutral-500"},vn={bold:"gs-utl-font-bold",semibold:"gs-utl-font-semibold",italic:"gs-utl-italic",mono:"gs-utl-font-mono"},bn={xs:"gs-utl-text-xs",sm:"gs-utl-text-sm",base:"gs-utl-text-base",lg:"gs-utl-text-lg",xl:"gs-utl-text-xl",xl2:"gs-utl-text-2xl"},jE={all:"gs-utl-break-all"},tr="gs-utl-my-2",EE="gs-utl-my-3",Sg=` gs-utl-rounded ${bn.xs} ${vn.mono} ${B.bgH25}`,Cg=`gs-utl-list-inside gs-utl-flex gs-utl-flex-col gs-utl-gap-1 ${tr} gs-utl-ml-1`,It={h1:`${bn.xl2} ${vn.bold} ${EE}`,h2:`${bn.xl} ${vn.bold} ${tr}`,h3:`${bn.lg} ${vn.semibold} ${tr}`,h4:`${bn.base} ${vn.semibold} ${tr}`,h5:`${bn.sm} ${vn.semibold} ${tr}`,h6:`${bn.xs} ${vn.semibold} ${tr}`,strong:vn.bold,em:vn.italic,ul:`gs-utl-list-disc ${Cg}`,ol:`gs-utl-list-decimal ${Cg}`,codeInline:`${Sg} gs-utl-px-1 gs-utl-py-0.5`,pre:`${Sg} gs-utl-p-3 gs-utl-overflow-x-auto ${tr}`,blockquote:`gs-utl-border-l-4 gs-utl-pl-2 ${tr} ${vn.italic}`,hr:"gs-utl-my-4 gs-utl-border-t",table:`gs-utl-w-full gs-utl-border-collapse ${tr}`,thead:`${B.bgH2}`,tr:`gs-utl-border-b ${B.br}`,th:`gs-utl-px-3 gs-utl-py-2 gs-utl-text-left ${vn.semibold}`,td:"gs-utl-px-3 gs-utl-py-2"},El={s:"gs-utl-size-5",m:"gs-utl-size-10"},yp={itemList:({index:e=0,open:t=!1,length:n=0}={})=>K(B.bgH2,Ee.xyS,B.br,e&&te.bt,(t||e===n-1)&&te.bb)},yb=e=>({bg:e?"#18181b":"#f9f9f9",text:e?"#9ca3af":"#111827",link:e?"#a78bfa":"#5b21b6"}),xb=e=>{let t={isSymbol:!1,bg:B.cmp,bgSoft:`${B.cmpBgSoft} ${B.cmpTxtActive}`,bgSoftX:B.cmpBgSoftX,border:B.cmpBr,txt:""};if(!(e!=null&&e.em))return t;const{isSymbol:n}=e.em.Components.getSymbolInfo(e);return n&&(t={isSymbol:n,bg:B.cmpSymbol,bgSoft:`${B.cmpBgSymbolSoft} ${B.cmpTxtActive}`,bgSoftX:B.cmpBgSymbolSoftX,border:B.cmpSymbolBr,txt:""}),t},wb=({variant:e,size:t="m",className:n,disabledClassName:s,active:r,border:o=!0,rounded:i=!0,disabled:a=!1,withBg:l,block:u,full:d})=>{const f=e==="pr",p=e==="out",g=e==="out-clear",m=e==="warn",v=e==="danger",b=o&&(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,i&&te.rnd,l&&B.bg,b?K(te.b,B.br,p&&B.bA,p&&B.tAo,!a&&B.hBgH):K(te.b,te.bT),m&&K(B.bgW,!a&&B.hBgW,"gs-utl-text-white"),v&&K(B.bgRed,!a&&B.hBgRed,"gs-utl-text-white"),f&&K(B.bgA2,!a&&B.hBgAct),r&&B.bgA,a&&(s??"disabled:gs-utl-opacity-80 gs-utl-cursor-not-allowed"),d&&"gs-utl-w-full",xa.focus]};function Ke({children:e,...t}){const{variant:n,size:s,active:r,border:o,rounded:i,block:a,full:l,className:u,icon:d,loading:f,withBg:p,disabled:g,type:m="button",disabledClassName:v,...b}=t,x=f?{icon:yC,size:"18px",className:K("animate-spin-fast")}:dt(d)?{icon:d,size:"18px"}:d;return c.jsx("button",{className:K(wb(t)),disabled:g||f,type:m,...b,children:x?c.jsxs(k,{className:K("gap-2"),items:"center",justify:"center",nowrap:!0,children:[c.jsx(F,{children:c.jsx(ne,{...x})}),e&&c.jsx(F,{children:e})]}):e})}function Br({full:e,abs:t,small:n,size:s,className:r,bg:o,currentColor:i}){const a=M(e&&"gs-utl-w-full gs-utl-h-full",t?Oe.coverAbs:"gs-utl-relative",r),l=M(!s&&(n?"gs-utl-w-5 gs-utl-h-5":"gs-utl-w-10 gs-utl-h-10"),s==="x2s"&&"gs-utl-size-3",s==="xs"&&"gs-utl-size-4",s==="s"&&"gs-utl-size-6","gs-utl-animate-spin-fast","!gs-utl-border-y-transparent !gs-utl-border-r-transparent",te.pill,te.bS,i?"gs-utl-border-current":te.bA);return c.jsxs(k,{className:a,items:"center",justify:"center",children:[!!o&&c.jsx("div",{className:M(Oe.coverAbs,B.bg,Oe.disabled)}),c.jsx("div",{className:l})]})}const Qt={accessToken:""},TE=()=>{Qt.timeout&&(clearTimeout(Qt.timeout),Qt.timeout=void 0),Qt.accessToken="",Qt.license=void 0},Sb=async()=>{var t;let e={accessToken:""};try{const n=await((t=Qt.getAccessToken)==null?void 0:t.call(Qt));n&&(e=n)}catch(n){console.error(n)}if(!(e!=null&&e.accessToken)){Qt.getAccessToken&&console.error("Failed to get access token");return}if(Qt.accessToken=e.accessToken,e.expiresAt){const n=new Date(e.expiresAt).getTime();clearTimeout(Qt.timeout||void 0),Qt.timeout=setTimeout(Sb,n-Date.now()-1)}},Cb=e=>{var t;return e.Components.getType("mjml")?"email":((t=e.getModel().attributes.customData)==null?void 0:t.projectType)||"web"},_i=e=>Cb(e)==="email",PE=e=>{var r;const t=Eb(e),n=_i(e),s=e.getWrapper();return t.length>1?!1:n?((r=s==null?void 0:s.findFirstType("mj-body"))==null?void 0:r.components().length)===0:(s==null?void 0:s.components().length)===0},jb=(e,t={})=>{const{selectedComponents:n=[],withPageContent:s,imageUrls:r=[]}=t,o=e.Pages.getSelected(),i=e.getSelected(),a=Cb(e),l=Eb(e),u=PE(e),d=o?{id:o.getId(),name:o.getName(),content:s?NE(e):void 0}:void 0,f=i?{id:i.getId(),content:i.toHTML()}:void 0;return{isNewProject:u,selectedPage:d,selectedComponent:f,selectedComponents:n.map(p=>({id:p.getId(),content:""})),projectType:a,availablePages:l,globalStyles:OE(e),installedPlugins:_E(e),devices:ME(e),isEmail:a==="email",imageUrls:r}},pf=(e,t,n)=>{const{layoutComponents:s}=n||{},r=t,o=r.type,i=o?s==null?void 0:s[o]:void 0;return i?{...r,...i({editor:e,props:t})}:t},tn=(e,t,n)=>{const s=pf(e,t,n);return e.runCommand(se.layoutComponentRender,{components:s})};function OE(e){return e.Css.getAll().filter(t=>!!t.get("groups")).map(t=>t.toCSS()).join(`
|
|
16
|
+
`)}const Eb=e=>e.Pages.getAll().map(t=>({id:String(t.id),name:t.getName()})),_E=e=>{const t=LE(e);return(t==null?void 0:t.filter(n=>!!n.instructions).map(n=>({id:n.id,instructions:n.instructions})))||[]},AE=e=>e.getModel().get("customData")??{},LE=e=>e&&AE(e).plugins||[];function ME(e){return e.Devices.getAll().map(t=>t.toJSON())}function qc(e){let t=e;return["generated_mjml","generated_html","generated_code"].forEach(n=>{t=t.replaceAll(`<${n}>`,"").replaceAll(`</${n}>`,"")}),t}const Kc=(e="",t,n={})=>{!t||!e||(t.innerHTML=qc(e),!n.skipScroll&&(t.insertAdjacentHTML("beforeend","<div></div>"),requestAnimationFrame(()=>{var s;return(s=t==null?void 0:t.lastElementChild)==null?void 0:s.scrollIntoView({block:"nearest"})})))},Tb=e=>(e==null?void 0:e.toHTML({asDocument:!0,attributes:(t,n)=>(n&&(n.id=t.getId()),n)}))||"";function Zc(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!1):n.stopDefault()}function Yc(e){const{Canvas:t,em:n}=e;t.getConfig().scrollableCanvas?t.toggleFramesEvents(!0):n.runDefault()}function NE(e){const t=e.getWrapper(),n=Tb(t);return`${_i(e)?"":`<style>${e.getCss({component:t})||""}</style>`}${n}`}const $E=e=>{const{Components:t}=e,n=["STYLE","SCRIPT"],s=new Map,r=document.createElement("div");r.setAttribute("data-temp-els","true");const o=(i,a)=>{try{a.innerHTML=i.innerHTML,Array.from(i.attributes).forEach(l=>a.setAttribute(l.name,l.value))}catch{}};return{cleanup(){r==null||r.remove()},update:i=>{var p;const a=new DOMParser,l=qc(i),u=a.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(r),d.forEach(g=>{var v,b;let m=g.id;if(m){const x=s.get(m),y=t.getById(m),w=y==null?void 0:y.getEl();w&&(o(g,w),!x&&requestAnimationFrame(()=>w==null?void 0:w.scrollIntoView({block:"nearest"}))),s.set(m,{cmp:y,cmpEl:w,newNode:g})}else if(n.includes(g.tagName)){m=[((v=g.tagName)==null?void 0:v.toLowerCase())||"",...Array.from(g.attributes).map(y=>`${y.name}=${y.value}`)].join("__");const x=(b=s.get(m))==null?void 0:b.newNode;x?o(g,x):(r.appendChild(g),s.set(m,{newNode:g}))}}),s}}},kE=(e,t)=>{var u,d;const n=e.em.getEditor(),{Parser:s,Css:r}=n,{html:o,css:i}=s.parseHtml(t,{returnArray:!0}),a=o[0];e.getId()===((u=a==null?void 0:a.attributes)==null?void 0:u.id)?(e.components().reset(a.components),e.addAttributes({...a==null?void 0:a.attributes,class:(d=a==null?void 0:a.classes)==null?void 0:d.join(" ")}),i&&r.addCollection(i,{extend:!0})):e.components(t)};function RE(e){return((e==null?void 0:e.urls)||[]).filter(Boolean)||[]}const Fn="gs-cmp-ai-chat-tool-generate-image",IE=e=>{var C;const{editor:t,part:n,chatContext:s,isProcessing:r}=e,o=(j,E)=>t.t(`aiChat.message.tool.generateImage.${j}`,E),i=n.input||{},a=s.toolStatusProgress.get(n.toolCallId),l=(C=a==null?void 0:a.content)==null?void 0:C.trim(),u=l||o("generating"),d=Math.min(Math.max(i.n||1,1),4),f=RE(n.output),p=_i(t),g=j=>{const E=t.getSelected(),O=p?"mj-image":"image",P={type:O,attributes:{src:j}};let T;if(E!=null&&E.is(O)){E.addAttributes({src:j});return}if(E&&t.Components.canMove(E,P))T=E.append(P)[0];else if(!E){const _=t.getWrapper(),L=p?_==null?void 0:_.findFirstType("mj-column"):_;T=L==null?void 0:L.append(P)[0]}T&&t.select(T,{scroll:!0})},m=j=>{t.Canvas.startDrag({content:{type:p?"mj-image":"image",attributes:{src:j}}})},v=()=>{t.Canvas.endDrag()},b=M(`${Fn}__media-grid`,"gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),x=M(`${Fn}__item`,te.rnd,"gs-utl-relative gs-utl-overflow-hidden gs-utl-group"),y=M(`${Fn}__item-image`,"gs-utl-w-full gs-utl-h-24 gs-utl-object-cover gs-utl-cursor-grab"),w=M(`${Fn}__item-actions`,Oe.hoverGroup,"gs-utl-absolute gs-utl-left-1 gs-utl-right-1 gs-utl-bottom-1");let S=null;return r?S=c.jsxs(c.Fragment,{children:[!!u&&c.jsx("div",{className:M(`${Fn}__status`,bn.xs,B.txtLowEmphasis),children:u}),c.jsx("div",{className:M(`${Fn}__placeholders`,b),children:Array.from({length:d}).map((j,E)=>c.jsx(k,{className:M(`${Fn}__placeholder`,x,B.bgH50,B.txtLowEmphasis,"gs-utl-h-24"),items:"center",justify:"center",children:c.jsx(Br,{className:`${Fn}__placeholder-spinner`,size:"s",currentColor:!0})},`placeholder-${E}`))})]}):f.length?S=c.jsx("div",{className:M(`${Fn}__output`,b),children:f.map((j,E)=>c.jsxs("div",{className:x,children:[c.jsx("img",{className:y,src:j,alt:o("imageAlt",{num:E+1}),draggable:!0,onDragStart:()=>m(j),onDragEnd:v}),c.jsx(k,{className:w,children:c.jsx(Ke,{full:!0,variant:"pr",className:M(`${Fn}__btn-use`),onClick:()=>g(j),children:o("useImage")})})]},j))}):l&&(S=c.jsx("div",{className:M(`${Fn}__status`,bn.xs,B.txtLowEmphasis),children:l})),c.jsx(k,{className:Fn,col:!0,gap:"xs",children:S})};function VE(e){return{type:"custom",component:()=>c.jsx(IE,{...e})}}var mo=(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))(mo||{}),rr=(e=>(e.ADD_COMPONENT_CODE="addComponentCode",e.EDIT_COMPONENT_CODE="editComponentCode",e.ADD_PAGE_CODE="addPageCode",e.ADD_PROJECT_PAGE_CODE="addProjectPageCode",e))(rr||{}),Qi=(e=>(e.SHOW_CODE="showCode",e.IMPORT_CODE="importCode",e.PAGE_SETTINGS="pageSettings",e.PREVIEW="preview",e.PUBLISH="publish",e))(Qi||{}),is=(e=>(e.getChatManager="aiChat:getChatManager",e.getChatState="aiChat:getChatState",e.getChatApi="aiChat:getChatApi",e))(is||{});function HE(e){const t=_i(e),n=r=>e.t(`aiChat.message.tool.command.${r}`),s={[Qi.SHOW_CODE]:{label:({isExecuted:r})=>n(r?"showCode.done":"showCode.pending"),execute:()=>e.runCommand(se.dialogExportCode)},[Qi.IMPORT_CODE]:{label:({isExecuted:r})=>n(r?"importCode.done":"importCode.pending"),execute:()=>e.runCommand(se.dialogImportCode)},[Qi.PREVIEW]:{label:({isExecuted:r})=>n(r?"preview.done":"preview.pending"),execute:()=>e.runCommand("core:preview")}};return t||(s[Qi.PAGE_SETTINGS]={label:({isExecuted:r})=>n(r?"pageSettings.done":"pageSettings.pending"),execute:()=>{const r=e.Pages.getSelected();e.runCommand(se.setPageSettings,{page:r,isOpen:!0})}}),s}function Pb(e,t={}){const{skipDefault:n,commands:s={}}=t,r=new Map(Object.entries(n?{}:HE(e))),o=(i,a)=>e.t(`aiChat.message.tool.command.${i}`,a);return Object.entries(s).forEach(([i,a])=>{if(!a)return;const l=i,u=r.get(l);r.set(l,{execute:a.execute??(u==null?void 0:u.execute),label:a.label??(u==null?void 0:u.label)})}),{async execute(i,a){const l=r.get(i.commandId);if(!l)throw new Error(o("notFound",{id:i.commandId}));if(!l.execute)throw new Error(o("missingHandler",{id:i.commandId}));return await new Promise(d=>setTimeout(d,1500)),await l.execute({editor:e,input:i,context:a})??{success:!0}},layoutToolLabel:({part:i})=>{const a=i.input,l=a!=null&&a.commandId?r.get(a.commandId):void 0;if(!(l!=null&&l.label))return;const u=i.state==="output-available";return l.label({isExecuted:u})}}}function DE(e){const t={async execute(a){const{componentId:l}=a,u=e.Components.getById(l);return u?(u.remove(),{success:!0}):{success:!1,error:`Component not found with ID '${l}'`}}},n={async execute(a){const{sourceId:l,targetId:u,targetIndex:d}=a,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}'`}}},s={async execute(a){const{pageId:l}=a,u=e.Pages.get(l),d=u==null?void 0:u.getMainComponent();return d?{content:Tb(d)}:{success:!1,error:"Page not found"}}},r={async execute(){return{pages:e.Pages.getAll().map(l=>({id:l.getId(),name:l.getName()}))}}},o={layoutToolResult:a=>VE(a)},i=Pb(e);return{[mo.REMOVE_COMPONENT]:t,[mo.MOVE_COMPONENT]:n,[mo.GET_PAGE_CONTENT]:s,[mo.LIST_PAGES]:r,[mo.GENERATE_IMAGE]:o,[mo.RUN_COMMAND]:i}}function FE(e,t){var x;const{componentId:n,position:s}=t,r=_i(e),o=e.getWrapper(),i=r?o.findFirstType("mj-body"):o;Zc(e);const a=document.createElement("div");a.style.display="contents";const{Components:l}=e;let d=l.getById(n)||i;r&&d===o&&(d=i);const 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(s){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,a):(x=f==null?void 0:f.getEl())==null||x.appendChild(a),{target:d,at:v,domPosition:m,tempTargetEl:g,tempDOM:a,updatePreview:y=>{let w=y;r&&(w=WE(e,d,y,v)),Kc(w,a,{skipScroll:!0})},cleanUp(){a==null||a.remove(),Yc(e)}}}const Tl="mjml",BE="mj-head",Xu="gs-ai-chat-mjml-preview";function jg(e){var n;const t=((n=e.__attrToString)==null?void 0:n.call(e,{}))||"";return t?`<${e.tagName} ${t}>`:`<${e.tagName}>`}function zE(e,t){const s=new DOMParser().parseFromString(`<body>${e}</body>`,"text/html");return Array.from(s.body.children).forEach(r=>{const i=[r.getAttribute("css-class"),t].filter(Boolean).join(" ").trim();r.setAttribute("css-class",i)}),s.body.innerHTML}function UE(e,t,n){var p,g;const s=e.closestType(Tl),r=((p=s==null?void 0:s.findFirstType(BE))==null?void 0:p.toHTML())||"",o=e.components().map(m=>m.toHTML()),i=typeof n=="number"?Math.max(0,Math.min(n,o.length)):o.length;o.splice(i,0,t);const a=o.join(""),l=[];let u=e.parent();for(;u&&u.tagName!==Tl;)(g=u.tagName)!=null&&g.startsWith("mj-")&&l.push(u),u=u.parent();const d=l.slice().reverse().map(m=>jg(m)).join(""),f=l.map(m=>`</${m.tagName}>`).join("");return`<${Tl}>${r}${d}${jg(e)}${a}</${e.tagName}>${f}</${Tl}>`}function WE(e,t,n,s){var o;const r=qc(n);if(!(r!=null&&r.trim()))return"";try{const i=zE(r,Xu),a=UE(t,i,s),l=(o=e.runCommand(Ob,{mjml:a}))==null?void 0:o.html;if(!l)return"";const d=new DOMParser().parseFromString(l,"text/html"),f=Array.from(d.querySelectorAll(`.${Xu}`));return f.length?f.map(p=>(p.classList.remove(Xu),p.outerHTML)).join(""):""}catch{return""}}function GE(e,t,n){const{target:s,at:r}=t,o=s==null?void 0:s.append(n,{at:r})[0];return o&&setTimeout(()=>e.select(o,{scroll:!0}),50),o}function qE(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:rr.ADD_COMPONENT_CODE,toolSetup:FE(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,a.toolSetup.updatePreview(r.content));return}if(i==="done"&&a&&r.content){if(a.completed)return;GE(t,a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function KE(e){Zc(e);const t=$E(e);return{toUpdate:t,mapUpdates:new Map,cleanUp(){t.cleanup(),Yc(e)}}}function ZE(e,t){const n=e.getWrapper();t.mapUpdates.forEach(s=>{const{cmp:r,newNode:o}=s,{outerHTML:i}=o;r?kE(r,i):n==null||n.append(i)})}function YE(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){a||(a={type:rr.EDIT_COMPONENT_CODE,toolSetup:KE(t),content:""},s.set(o,a)),i==="streaming"&&r.content&&(a.content=r.content,a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content));return}if(i==="done"&&a&&r.content){if(a.completed)return;a.toolSetup.mapUpdates=a.toolSetup.toUpdate.update(r.content),ZE(t,a.toolSetup),a.completed=!0,l()}if(i==="error"){l();return}}function XE(e,t){const{name:n}=t,{Pages:s,Components:r}=e;Zc(e);const o=s.add({name:n,component:"<h1></h1>"},{select:!0}),i=o.getMainComponent();return i.once(r.events.render,()=>{const a=i.getEl();a&&Kc(`<h1 style="font-family: system-ui; font-size: 2rem; font-weight: 300; text-align: center; padding: 1rem">
|
|
17
|
+
Generating ${n?`"${n}" `:""}page...
|
|
18
|
+
</h1>`,a,{skipScroll:!0})}),{pageId:o.getId(),cmpRoot:i,cleanUp(){Yc(e)}}}function JE(e,t){const{cmpRoot:n}=e;n.components(t)}function QE(e){const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){if(a||(a={type:rr.ADD_PAGE_CODE,toolSetup:XE(t,r.input),content:""},s.set(o,a)),i==="streaming"&&r.content){a.content=r.content;const u=a.toolSetup.cmpRoot.getEl();u&&Kc(r.content,u,{skipScroll:!0})}return}if(i==="done"&&a&&r.content){if(a.completed)return;JE(a.toolSetup,r.content),a.completed=!0,l()}if(i==="error"){l();return}}function eT(e){Zc(e);const t=e.getWrapper(),n=jb(e);return{cmpRoot:t,isEmail:n.isEmail,pageName:"",cleanUp(){Yc(e)}}}function tT(e,t,n){var r;const{Pages:s}=e;e.loadProjectData({pages:[{name:n,component:t}]}),(r=s.getSelected())==null||r.setName(n)}const Ob="mjml-code-to-html";function nT(e){var u;const{editor:t,toolStatus:n,toolStatusProgress:s}=e,{data:r,id:o}=n,{status:i}=r;let a=s.get(o);const l=()=>{a==null||a.toolSetup.cleanUp(),s.delete(o)};if(i==="in-progress"||i==="streaming"){if(a||(a={type:rr.ADD_PROJECT_PAGE_CODE,toolSetup:eT(t),content:""},s.set(o,a)),i==="streaming"&&r.content){a.content=r.content;const{isEmail:d,cmpRoot:f}=a.toolSetup,p=f.getEl();let g=r.content;if(d){const m=qc(g);try{const v=(u=t.runCommand(Ob,{mjml:m}))==null?void 0:u.html;v&&(g=v)}catch{}}p&&Kc(g,p,{skipScroll:!0})}return}if(i==="done"&&a&&r.content){if(a.completed)return;tT(t,r.content,r.input.name),a.completed=!0,l()}if(i==="error"){l();return}}const _b={[rr.ADD_COMPONENT_CODE]:qE,[rr.EDIT_COMPONENT_CODE]:YE,[rr.ADD_PAGE_CODE]:QE,[rr.ADD_PROJECT_PAGE_CODE]:nT},sT=({editor:e,data:t,toolStatusProgress:n,tools:s,chatApi:r})=>{var u;if(t.type!=="data-tool-status")return;const o=t,i=((u=o.data)==null?void 0:u.name)||"",a=_b[i];a?a({editor:e,toolStatus:o,toolStatusProgress:n}):rT({toolStatus:o,toolStatusProgress:n});const l=s[i];if(!(!(l!=null&&l.onData)||!r))try{l.onData({editor:e,chatApi:r,toolStatus:o,toolStatusProgress:n})}catch(d){r.setError(d)}};function rT({toolStatus:e,toolStatusProgress:t}){const{id:n,data:s}=e;if(!n||!s)return;const{status:r,content:o}=s;let i=t.get(n);i||(i={type:"generic",content:"",completed:!1},t.set(n,i)),r==="streaming"&&o&&(i.content=o),r==="done"&&(o&&(i.content=o),t.delete(n)),r==="error"&&t.delete(n)}var oT={NODE_ENV:"production"};class iT{constructor(t,n){var o;this.chatStates=new Map,this.editor=t,this.options=n;const s=DE(t);this.tools=((o=n.tools)==null?void 0:o.call(n,{defaultTools:s,createCommandTool:i=>Pb(t,i),editor:t}))||s;const{chat:r}=this.createChat();this.currentChatId=r.id}get currentChatState(){return this.chatStates.get(this.currentChatId)}getChat(t){return this.chatStates.get(t)}setCurrentChat(t){this.chatStates.get(t)&&(this.currentChatId=t)}removeChat(t){if(this.chatStates.delete(t),this.currentChatId===t){const n=this.chatStates.keys().next().value;if(n)this.currentChatId=n;else{const s=this.createChat();this.currentChatId=s.chat.id}}}createChat(t){const n=this.editor,s=new Map,r=new Set,o=new Set,{tools:i}=this,{chatApi:a,onTool:l,body:u,defaultTransportOptions:d={},chatOptions:f={},onMessagesUpdate:p,messages:g}=this.options,{onFinish:m,onData:v,...b}=f,x=typeof g=="function",y=[],w=new gv.Chat({id:t,messages:Array.isArray(g)?g:void 0,sendAutomaticallyWhen:Co.lastAssistantMessageIsCompleteWithToolCalls,transport:new Co.DefaultChatTransport({...d,async prepareSendMessagesRequest({headers:P,messages:T,body:_,id:L,trigger:N,credentials:V}){var z;const A={..._,id:L,trigger:N,messages:T.slice(-10),projectContext:jb(n,{withPageContent:!0,selectedComponents:Array.from(o)}),userPrompt:""},H=typeof u=="function"?u({editor:n,body:A,messages:T}):u,{accessToken:U,license:D}=Qt,$=oT.NODE_ENV!=="production",I=`${rp({isDev:$,isStage:!1,isPlatform:!0})}/ai/chat`;return{api:(!D||["enterprise","business"].includes(((z=D==null?void 0:D.plan)==null?void 0:z.category)??"free"))&&typeof a<"u"?typeof a=="function"?a():a:I,headers:{...P,...U?{Authorization:`Bearer ${U}`}:{}},credentials:V,body:{...A,...H}}}}),onToolCall:async({toolCall:P})=>{l==null||l({toolCall:P});const T=!!_b[P.toolName];if(P.dynamic||T)return;const{toolName:_,input:L,toolCallId:N}=P,V=i[_];if(V&&V.execute){const A=new AbortController;r.add(A);try{const{messages:H}=w,U=await Promise.race([V.execute(L||{},{editor:n,messages:H,lastUserMessage:H.findLast(D=>D.role==="user"),toolCallId:N,abortController:A}),new Promise((D,$)=>{A.signal.addEventListener("abort",()=>$(new Error("Aborted")))})]);if(U&&typeof U.error=="string")throw new Error(U.error);w.addToolOutput({tool:_,toolCallId:N,output:U})}catch(H){w.addToolOutput({tool:_,toolCallId:N,state:"output-error",errorText:H instanceof Error?H.message:"Unknown error"})}finally{r.delete(A)}}},onData(P){v==null||v(P),sT({editor:n,data:P,toolStatusProgress:s,tools:i,chatApi:C})},onFinish(P){p==null||p({messages:P.messages,editor:n}),P.isAbort&&(s.forEach(T=>{"toolSetup"in T&&T.toolSetup.cleanUp()}),s.clear()),m==null||m(P)},...b}),S=new Set,C={get messages(){return w.messages},get lastMessage(){return w.lastMessage},get status(){return w.status},get error(){return w.error},sendMessage:(...P)=>j.isMessagesLoaded?w.sendMessage(...P):(y.push(P),Promise.resolve()),setMessages:P=>{w.messages=P},clearError:()=>w.clearError(),stop:()=>w.stop(),setError:P=>{const T=P instanceof Error?P:new Error(String(P));w.setStatus({status:"error",error:T})}},j={chat:w,chatApi:C,isMessagesLoaded:!x,toolStatusProgress:s,toolAbortControllers:r,contextComponents:o,onUpdate:P=>(S.add(P),()=>{S.delete(P)}),emitUpdate:()=>{S.forEach(P=>P())}},E=async()=>{if(!j.isMessagesLoaded||y.length===0)return;const P=y.splice(0);for(const T of P)await w.sendMessage(...T)};this.chatStates.set(w.id,j);const O=()=>{w["~registerMessagesCallback"](()=>{w.status==="ready"&&(p==null||p({messages:w.messages,editor:n}))})};return x?g({editor:n}).then(P=>{w.messages=P,O()}).catch(P=>C.setError(P)).finally(()=>{j.isMessagesLoaded=!0,E().catch(P=>C.setError(P)),j.emitUpdate()}):O(),j}}const aT=[{id:"webHero"},{id:"webFeatures"},{id:"webContact"},{id:"webTestimonials"}],lT=[{id:"emailHeader"},{id:"emailCta"},{id:"emailFooter"},{id:"emailProduct"}],Zo="gs-cmp-ai-chat-empty",cT=({className:e,style:t,chatContext:n,editor:s,suggestions:r})=>{const{sendMessage:o}=n,i="aiChat.emptyState",a=M(Zo,e,"gs-utl-flex gs-utl-flex-col gs-utl-items-center gs-utl-justify-center gs-utl-h-full gs-utl-text-center gs-utl-p-6"),l=s.t(`${i}.title`),u=s.t(`${i}.subtitle`),d=_i(s)?lT:aT,f=r??d;return c.jsxs(k,{className:a,style:t,gap:"m",col:!0,nowrap:!0,children:[c.jsxs(k,{className:`${Zo}__header`,gap:"xs",col:!0,children:[c.jsx("h3",{className:M(`${Zo}__title`,"gs-utl-font-semibold"),children:l}),c.jsx("p",{className:M(`${Zo}__subtitle`,B.txtLowEmphasis),children:u})]}),c.jsx(k,{col:!0,className:`${Zo}__suggestions gs-utl-w-full gs-utl-max-w-xs`,gap:"s",children:f.map(p=>{const g=s.t(`${i}.suggestions.${p.id}`)||p.label,m=p.prompt??g;return c.jsx(Ke,{className:`${Zo}__suggestion`,onClick:()=>o({text:m,metadata:{createdAt:Date.now()}}),variant:"out-clear",full:!0,children:g},p.id)})})]})},Di="gs-cmp-ai-chat-error",uT=({className:e,style:t,chatContext:n,editor:s})=>{var a;const r=M(Di,e,B.boxDanger,"gs-utl-p-2 gs-utl-border-t gs-utl-border-b"),o=`${Di}__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(k,{className:r,style:t,gap:"xs",col:!0,children:[c.jsxs(k,{className:`${Di}__header`,items:"center",gap:"xs",children:[c.jsx(F,{className:`${Di}__header-title`,grow:!0,children:s.t("aiChat.error.title")}),c.jsx(Ke,{className:`${Di}__close`,onClick:()=>n.clearError(),size:"xs",border:!1,icon:"close"})]}),c.jsx(F,{className:o,grow:!0,children:(a=n.error)==null?void 0:a.message})]})},Ju="gs-cmp-ai-chat-header",dT=({className:e,chatContext:t,title:n,editor:s,layoutBefore:r,layoutAfter:o,clearButtonProps:i,onClear:a,...l})=>{const[u,d]=h.useState(!1),{messages:f,setMessages:p,status:g}=t,m=M(Ju,e,te.bb,B.br,Ee.s),v=g==="streaming"||g==="submitted",b="aiChat.header",x=s.runCommand(is.getChatApi),y={isClearing:u,setIsClearing:d},w=()=>{d(!0),p([])},{className:S,children:C,...j}=i||{},E={chatApi:x,messages:f,state:y},O=r==null?void 0:r(E),P=o==null?void 0:o(E),T=async _=>{if(!u)try{a?await a({...E,clear:w,event:_}):w()}catch(L){t.setError(L instanceof Error?L:new Error(String(L)))}finally{d(!1)}};return c.jsxs(k,{className:m,items:"center",gap:"s",...l,children:[O&&tn(s,O),c.jsx(F,{className:`${Ju}__title`,grow:!0,children:n??s.t(`${b}.title`)}),f.length>0&&c.jsx(Ke,{className:M(`${Ju}__btn-clear`,S,Oe.hover,te.none),onClick:T,size:"xs",border:!1,icon:"delete",loading:u,disabled:v,...j,children:C??s.t(`${b}.clear`)}),P&&tn(s,P)]})};function Yo(e,t,n){let s=n.initialDeps??[],r;return()=>{var o,i,a,l;let u;n.key&&((o=n.debug)!=null&&o.call(n))&&(u=Date.now());const d=e();if(!(d.length!==s.length||d.some((g,m)=>s[m]!==g)))return r;s=d;let p;if(n.key&&((i=n.debug)!=null&&i.call(n))&&(p=Date.now()),r=t(...d),n.key&&((a=n.debug)!=null&&a.call(n))){const g=Math.round((Date.now()-u)*100)/100,m=Math.round((Date.now()-p)*100)/100,v=m/16,b=(x,y)=>{for(x=String(x);x.length<y;)x=" "+x;return x};console.info(`%c⏱ ${b(m,5)} /${b(g,5)} ms`,`
|
|
84
19
|
font-size: .6rem;
|
|
85
20
|
font-weight: bold;
|
|
86
|
-
color: hsl(${Math.max(0,Math.min(120-120*b,120))}deg 100% 31%);`,n==null?void 0:n.key)}return(l=n==null?void 0:n.onChange)==null||l.call(n,r),r}}function Fu(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const VE=(e,t)=>Math.abs(e-t)<1,IE=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};var Fo={};const DE=e=>e,HE=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},FE=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=i=>{const{width:a,height:l}=i;t({width:Math.round(a),height:Math.round(l)})};if(r(n.getBoundingClientRect()),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(i=>{const a=i[0];if(a!=null&&a.borderBoxSize){const l=a.borderBoxSize[0];if(l){r({width:l.inlineSize,height:l.blockSize});return}}r(n.getBoundingClientRect())});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},pg={passive:!0},BE=typeof window>"u"?!0:"onscrollend"in window,zE=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const o=BE?()=>{}:IE(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),i=u=>()=>{const{horizontal:d,isRtl:f}=e.options;r=d?n.scrollLeft*(f&&-1||1):n.scrollTop,o(),t(r,u)},a=i(!0),l=i(!1);return l(),n.addEventListener("scroll",a,pg),n.addEventListener("scrollend",l,pg),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",l)}},UE=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},WE=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;const i=e+t;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:i,behavior:n})};class GE{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{this._measureElement(o.target,o)})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:DE,rangeExtractor:HE,onChange:()=>{},measureElement:UE,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Ho(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:Fo.NODE_ENV!=="production"&&"maybeNotify",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let i=s-1;i>=0;i--){const a=n[i];if(r.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Ho(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,s,r,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=Ho(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const f=o(d),p=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=p?p.end+this.options.gap:s+r,m=a.get(f),b=typeof m=="number"?m:this.options.estimateSize(d),v=g+b,x=p?p.lane:d%this.options.lanes;u[d]={index:d,start:g,size:b,end:v,key:f,lane:x}}return this.measurementsCache=u,u},{key:Fo.NODE_ENV!=="production"&&"getMeasurements",debug:()=>this.options.debug}),this.calculateRange=Ho(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,s,r)=>this.range=n.length>0&&s>0?qE({measurements:n,outerSize:s,scrollOffset:r}):null,{key:Fo.NODE_ENV!=="production"&&"calculateRange",debug:()=>this.options.debug}),this.getIndexes=Ho(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,s,r,o)=>s===null?[]:n({startIndex:s.startIndex,endIndex:s.endIndex,overscan:r,count:o}),{key:Fo.NODE_ENV!=="production"&&"getIndexes",debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const r=this.indexFromElement(n),o=this.measurementsCache[r];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(i,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const r=this.measurementsCache[n];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,i=s-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&(Fo.NODE_ENV!=="production"&&this.options.debug&&console.info("correction",i),this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0})),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=Ho(()=>[this.getIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,i=n.length;o<i;o++){const a=n[o],l=s[a];r.push(l)}return r},{key:Fo.NODE_ENV!=="production"&&"getVirtualItems",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return Fu(s[vv(0,s.length-1,r=>Fu(s[r]).start,n)])},this.getOffsetForAlignment=(n,s)=>{const r=this.getSize(),o=this.getScrollOffset();s==="auto"&&(n<=o?s="start":n>=o+r?s="end":s="start"),s==="start"?n=n:s==="end"?n=n-r:s==="center"&&(n=n-r/2);const i=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-r;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const o=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(r.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const a=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:s="start",behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:s="auto",behavior:r}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const o=this.getOffsetForIndex(n,s);if(!o)return;const[i,a]=o;this._scrollToOffset(i,{adjustments:void 0,behavior:r}),r!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=Fu(this.getOffsetForIndex(n,a));VE(u,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:r})}else this.scrollToIndex(n,{align:a,behavior:r})}))},this.scrollBy=(n,{behavior:s}={})=>{this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;return s.length===0?r=this.options.paddingStart:r=this.options.lanes===1?((n=s[s.length-1])==null?void 0:n.end)??0:Math.max(...s.slice(-this.options.lanes).map(o=>o.end)),Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const vv=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function qE({measurements:e,outerSize:t,scrollOffset:n}){const s=e.length-1,o=vv(0,s,a=>e[a].start,n);let i=o;for(;i<s&&e[i].end<n+t;)i++;return{startIndex:o,endIndex:i}}const KE=typeof document<"u"?et.useLayoutEffect:et.useEffect;function YE(e){const t=et.useReducer(()=>({}),{})[1],n={...e,onChange:(r,o)=>{var i;o?Dn.flushSync(t):t(),(i=e.onChange)==null||i.call(e,r,o)}},[s]=et.useState(()=>new GE(n));return s.setOptions(n),et.useEffect(()=>s._didMount(),[]),KE(()=>s._willUpdate()),s}function ZE(e){return YE({observeElementRect:FE,observeElementOffset:zE,scrollToFn:WE,...e})}var XE=Object.defineProperty,JE=(e,t,n)=>t in e?XE(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Bu=(e,t,n)=>(JE(e,typeof t!="symbol"?t+"":t,n),n);let QE=class{constructor(){Bu(this,"current",this.detect()),Bu(this,"handoffState","pending"),Bu(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"}},nr=new QE,ze=(e,t)=>{nr.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function Mt(e){let t=h.useRef(e);return ze(()=>{t.current=e},[e]),t}function Ia(e,t){let[n,s]=h.useState(e),r=Mt(e);return ze(()=>s(r.current),[r,s,...t]),n}let ae=function(e){let t=Mt(e);return h.useCallback((...n)=>t.current(...n),[t])};function Vc(e,t,n){let[s,r]=h.useState(n),o=e!==void 0,i=h.useRef(o),a=h.useRef(!1),l=h.useRef(!1);return o&&!i.current&&!a.current?(a.current=!0,i.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&i.current&&!l.current&&(l.current=!0,i.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:s,ae(u=>(o||r(u),t==null?void 0:t(u)))]}function rp(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function $s(){let e=[],t={addEventListener(n,s,r,o){return n.addEventListener(s,r,o),t.add(()=>n.removeEventListener(s,r,o))},requestAnimationFrame(...n){let s=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(s))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let s=setTimeout(...n);return t.add(()=>clearTimeout(s))},microTask(...n){let s={current:!0};return rp(()=>{s.current&&n[0]()}),t.add(()=>{s.current=!1})},style(n,s,r){let o=n.style.getPropertyValue(s);return Object.assign(n.style,{[s]:r}),this.add(()=>{Object.assign(n.style,{[s]:o})})},group(n){let s=$s();return n(s),this.add(()=>s.dispose())},add(n){return e.push(n),()=>{let s=e.indexOf(n);if(s>=0)for(let r of e.splice(s,1))r()}},dispose(){for(let n of e.splice(0))n()}};return t}function as(){let[e]=h.useState($s);return h.useEffect(()=>()=>e.dispose(),[e]),e}function eP(){let e=typeof document>"u";return"useSyncExternalStore"in et?(t=>t.useSyncExternalStore)(et)(()=>()=>{},()=>!1,()=>!e):!1}function Ic(){let e=eP(),[t,n]=et.useState(nr.isHandoffComplete);return t&&nr.isHandoffComplete===!1&&n(!1),et.useEffect(()=>{t!==!0&&n(!0)},[t]),et.useEffect(()=>nr.handoff(),[]),e?!1:t}var hg;let xt=(hg=h.useId)!=null?hg:function(){let e=Ic(),[t,n]=h.useState(e?()=>nr.nextId():null);return ze(()=>{t===null&&n(nr.nextId())},[t]),t!=null?""+t:void 0};function Le(e,t,...n){if(e in t){let r=t[e];return typeof r=="function"?r(...n):r}let s=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(r=>`"${r}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,Le),s}function Ur(e){return nr.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let Jd=["[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 Ct=(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))(Ct||{}),As=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(As||{}),tP=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(tP||{});function Dc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Jd)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var Hc=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(Hc||{});function op(e,t=0){var n;return e===((n=Ur(e))==null?void 0:n.body)?!1:Le(t,{0(){return e.matches(Jd)},1(){let s=e;for(;s!==null;){if(s.matches(Jd))return!0;s=s.parentElement}return!1}})}var nP=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(nP||{});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 sP=["textarea","input"].join(",");function rP(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,sP))!=null?n:!1}function Js(e,t=n=>n){return e.slice().sort((n,s)=>{let r=t(n),o=t(s);if(r===null||o===null)return 0;let i=r.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function tn(e,t,{sorted:n=!0,relativeTo:s=null,skipElements:r=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?Js(e):e:Dc(e);r.length>0&&i.length>1&&(i=i.filter(g=>!r.includes(g))),s=s??o.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(s))-1;if(t&4)return Math.max(0,i.indexOf(s))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,f=i.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=i[g],p==null||p.focus(u),d+=a}while(p!==o.activeElement);return t&6&&rP(p)&&p.select(),2}function oP(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function iP(){return/Android/gi.test(window.navigator.userAgent)}function yv(){return oP()||iP()}function gl(e,t,n){let s=Mt(t);h.useEffect(()=>{function r(o){s.current(o)}return document.addEventListener(e,r,n),()=>document.removeEventListener(e,r,n)},[e,n])}function xv(e,t,n){let s=Mt(t);h.useEffect(()=>{function r(o){s.current(o)}return window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)},[e,n])}function ip(e,t,n=!0){let s=h.useRef(!1);h.useEffect(()=>{requestAnimationFrame(()=>{s.current=n})},[n]);function r(i,a){if(!s.current||i.defaultPrevented)return;let l=a(i);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function d(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)||i.composed&&i.composedPath().includes(f))return}return!op(l,Hc.Loose)&&l.tabIndex!==-1&&i.preventDefault(),t(i,l)}let o=h.useRef(null);gl("pointerdown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),gl("mousedown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),gl("click",i=>{yv()||o.current&&(r(i,()=>o.current),o.current=null)},!0),gl("touchend",i=>r(i,()=>i.target instanceof HTMLElement?i.target:null),!0),xv("blur",i=>r(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Mo(...e){return h.useMemo(()=>Ur(...e),[...e])}function gg(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 Ci(e,t){let[n,s]=h.useState(()=>gg(e));return ze(()=>{s(gg(e))},[e.type,e.as]),ze(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&s("button")},[n,t]),n}let wv=Symbol();function ap(e,t=!0){return Object.assign(e,{[wv]:t})}function Ue(...e){let t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]);let n=ae(s=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(s):r.current=s)});return e.every(s=>s==null||(s==null?void 0:s[wv]))?void 0:n}function mg(e){return[e.screenX,e.screenY]}function Sv(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=mg(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=mg(t)}}}function Cv({container:e,accept:t,walk:n,enabled:s=!0}){let r=h.useRef(t),o=h.useRef(n);h.useEffect(()=>{r.current=t,o.current=n},[t,n]),ze(()=>{if(!e||!s)return;let i=Ur(e);if(!i)return;let a=r.current,l=o.current,u=Object.assign(f=>a(f),{acceptNode:a}),d=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,s,r,o])}function bg(e,t){let n=h.useRef([]),s=ae(e);h.useEffect(()=>{let r=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let a=s(t,r);return n.current=t,a}},[s,...t])}function fc(...e){return Array.from(new Set(e.flatMap(t=>typeof t=="string"?t.split(" "):[]))).filter(Boolean).join(" ")}var gn=(e=>(e[e.None=0]="None",e[e.RenderStrategy=1]="RenderStrategy",e[e.Static=2]="Static",e))(gn||{}),_r=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(_r||{});function De({ourProps:e,theirProps:t,slot:n,defaultTag:s,features:r,visible:o=!0,name:i,mergeRefs:a}){a=a??aP;let l=jv(t,e);if(o)return ml(l,n,s,i,a);let u=r??0;if(u&2){let{static:d=!1,...f}=l;if(d)return ml(f,n,s,i,a)}if(u&1){let{unmount:d=!0,...f}=l;return Le(d?0:1,{0(){return null},1(){return ml({...f,hidden:!0,style:{display:"none"}},n,s,i,a)}})}return ml(l,n,s,i,a)}function ml(e,t={},n,s,r){let{as:o=n,children:i,refName:a="ref",...l}=zu(e,["unmount","static"]),u=e.ref!==void 0?{[a]:e.ref}:{},d=typeof i=="function"?i(t):i;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let f={};if(t){let p=!1,g=[];for(let[m,b]of Object.entries(t))typeof b=="boolean"&&(p=!0),b===!0&&g.push(m);p&&(f["data-headlessui-state"]=g.join(" "))}if(o===h.Fragment&&Object.keys(di(l)).length>0){if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${s} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(b=>` - ${b}`).join(`
|
|
87
|
-
`),"","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,r),r}}function Qu(e,t){if(e===void 0)throw new Error("Unexpected undefined");return e}const fT=(e,t)=>Math.abs(e-t)<1,pT=(e,t,n)=>{let s;return function(...r){e.clearTimeout(s),s=e.setTimeout(()=>t.apply(this,r),n)}};var Fi={NODE_ENV:"production"};const hT=e=>e,gT=e=>{const t=Math.max(e.startIndex-e.overscan,0),n=Math.min(e.endIndex+e.overscan,e.count-1),s=[];for(let r=t;r<=n;r++)s.push(r);return s},mT=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;const r=i=>{const{width:a,height:l}=i;t({width:Math.round(a),height:Math.round(l)})};if(r(n.getBoundingClientRect()),!s.ResizeObserver)return()=>{};const o=new s.ResizeObserver(i=>{const a=i[0];if(a!=null&&a.borderBoxSize){const l=a.borderBoxSize[0];if(l){r({width:l.inlineSize,height:l.blockSize});return}}r(n.getBoundingClientRect())});return o.observe(n,{box:"border-box"}),()=>{o.unobserve(n)}},Eg={passive:!0},vT=typeof window>"u"?!0:"onscrollend"in window,bT=(e,t)=>{const n=e.scrollElement;if(!n)return;const s=e.targetWindow;if(!s)return;let r=0;const o=vT?()=>{}:pT(s,()=>{t(r,!1)},e.options.isScrollingResetDelay),i=u=>()=>{const{horizontal:d,isRtl:f}=e.options;r=d?n.scrollLeft*(f&&-1||1):n.scrollTop,o(),t(r,u)},a=i(!0),l=i(!1);return l(),n.addEventListener("scroll",a,Eg),n.addEventListener("scrollend",l,Eg),()=>{n.removeEventListener("scroll",a),n.removeEventListener("scrollend",l)}},yT=(e,t,n)=>{if(t!=null&&t.borderBoxSize){const s=t.borderBoxSize[0];if(s)return Math.round(s[n.options.horizontal?"inlineSize":"blockSize"])}return Math.round(e.getBoundingClientRect()[n.options.horizontal?"width":"height"])},xT=(e,{adjustments:t=0,behavior:n},s)=>{var r,o;const i=e+t;(o=(r=s.scrollElement)==null?void 0:r.scrollTo)==null||o.call(r,{[s.options.horizontal?"left":"top"]:i,behavior:n})};class wT{constructor(t){this.unsubs=[],this.scrollElement=null,this.targetWindow=null,this.isScrolling=!1,this.scrollToIndexTimeoutId=null,this.measurementsCache=[],this.itemSizeCache=new Map,this.pendingMeasuredCacheIndexes=[],this.scrollRect=null,this.scrollOffset=null,this.scrollDirection=null,this.scrollAdjustments=0,this.elementsCache=new Map,this.observer=(()=>{let n=null;const s=()=>n||(!this.targetWindow||!this.targetWindow.ResizeObserver?null:n=new this.targetWindow.ResizeObserver(r=>{r.forEach(o=>{this._measureElement(o.target,o)})}));return{disconnect:()=>{var r;(r=s())==null||r.disconnect(),n=null},observe:r=>{var o;return(o=s())==null?void 0:o.observe(r,{box:"border-box"})},unobserve:r=>{var o;return(o=s())==null?void 0:o.unobserve(r)}}})(),this.range=null,this.setOptions=n=>{Object.entries(n).forEach(([s,r])=>{typeof r>"u"&&delete n[s]}),this.options={debug:!1,initialOffset:0,overscan:1,paddingStart:0,paddingEnd:0,scrollPaddingStart:0,scrollPaddingEnd:0,horizontal:!1,getItemKey:hT,rangeExtractor:gT,onChange:()=>{},measureElement:yT,initialRect:{width:0,height:0},scrollMargin:0,gap:0,indexAttribute:"data-index",initialMeasurementsCache:[],lanes:1,isScrollingResetDelay:150,enabled:!0,isRtl:!1,...n}},this.notify=n=>{var s,r;(r=(s=this.options).onChange)==null||r.call(s,this,n)},this.maybeNotify=Yo(()=>(this.calculateRange(),[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]),n=>{this.notify(n)},{key:Fi.NODE_ENV!=="production",debug:()=>this.options.debug,initialDeps:[this.isScrolling,this.range?this.range.startIndex:null,this.range?this.range.endIndex:null]}),this.cleanup=()=>{this.unsubs.filter(Boolean).forEach(n=>n()),this.unsubs=[],this.observer.disconnect(),this.scrollElement=null,this.targetWindow=null},this._didMount=()=>()=>{this.cleanup()},this._willUpdate=()=>{var n;const s=this.options.enabled?this.options.getScrollElement():null;if(this.scrollElement!==s){if(this.cleanup(),!s){this.maybeNotify();return}this.scrollElement=s,this.scrollElement&&"ownerDocument"in this.scrollElement?this.targetWindow=this.scrollElement.ownerDocument.defaultView:this.targetWindow=((n=this.scrollElement)==null?void 0:n.window)??null,this.elementsCache.forEach(r=>{this.observer.observe(r)}),this._scrollToOffset(this.getScrollOffset(),{adjustments:void 0,behavior:void 0}),this.unsubs.push(this.options.observeElementRect(this,r=>{this.scrollRect=r,this.maybeNotify()})),this.unsubs.push(this.options.observeElementOffset(this,(r,o)=>{this.scrollAdjustments=0,this.scrollDirection=o?this.getScrollOffset()<r?"forward":"backward":null,this.scrollOffset=r,this.isScrolling=o,this.maybeNotify()}))}},this.getSize=()=>this.options.enabled?(this.scrollRect=this.scrollRect??this.options.initialRect,this.scrollRect[this.options.horizontal?"width":"height"]):(this.scrollRect=null,0),this.getScrollOffset=()=>this.options.enabled?(this.scrollOffset=this.scrollOffset??(typeof this.options.initialOffset=="function"?this.options.initialOffset():this.options.initialOffset),this.scrollOffset):(this.scrollOffset=null,0),this.getFurthestMeasurement=(n,s)=>{const r=new Map,o=new Map;for(let i=s-1;i>=0;i--){const a=n[i];if(r.has(a.lane))continue;const l=o.get(a.lane);if(l==null||a.end>l.end?o.set(a.lane,a):a.end<l.end&&r.set(a.lane,!0),r.size===this.options.lanes)break}return o.size===this.options.lanes?Array.from(o.values()).sort((i,a)=>i.end===a.end?i.index-a.index:i.end-a.end)[0]:void 0},this.getMeasurementOptions=Yo(()=>[this.options.count,this.options.paddingStart,this.options.scrollMargin,this.options.getItemKey,this.options.enabled],(n,s,r,o,i)=>(this.pendingMeasuredCacheIndexes=[],{count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i}),{key:!1}),this.getMeasurements=Yo(()=>[this.getMeasurementOptions(),this.itemSizeCache],({count:n,paddingStart:s,scrollMargin:r,getItemKey:o,enabled:i},a)=>{if(!i)return this.measurementsCache=[],this.itemSizeCache.clear(),[];this.measurementsCache.length===0&&(this.measurementsCache=this.options.initialMeasurementsCache,this.measurementsCache.forEach(d=>{this.itemSizeCache.set(d.key,d.size)}));const l=this.pendingMeasuredCacheIndexes.length>0?Math.min(...this.pendingMeasuredCacheIndexes):0;this.pendingMeasuredCacheIndexes=[];const u=this.measurementsCache.slice(0,l);for(let d=l;d<n;d++){const f=o(d),p=this.options.lanes===1?u[d-1]:this.getFurthestMeasurement(u,d),g=p?p.end+this.options.gap:s+r,m=a.get(f),v=typeof m=="number"?m:this.options.estimateSize(d),b=g+v,x=p?p.lane:d%this.options.lanes;u[d]={index:d,start:g,size:v,end:b,key:f,lane:x}}return this.measurementsCache=u,u},{key:Fi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.calculateRange=Yo(()=>[this.getMeasurements(),this.getSize(),this.getScrollOffset()],(n,s,r)=>this.range=n.length>0&&s>0?ST({measurements:n,outerSize:s,scrollOffset:r}):null,{key:Fi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getIndexes=Yo(()=>[this.options.rangeExtractor,this.calculateRange(),this.options.overscan,this.options.count],(n,s,r,o)=>s===null?[]:n({startIndex:s.startIndex,endIndex:s.endIndex,overscan:r,count:o}),{key:Fi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.indexFromElement=n=>{const s=this.options.indexAttribute,r=n.getAttribute(s);return r?parseInt(r,10):(console.warn(`Missing attribute name '${s}={index}' on measured element.`),-1)},this._measureElement=(n,s)=>{const r=this.indexFromElement(n),o=this.measurementsCache[r];if(!o)return;const i=o.key,a=this.elementsCache.get(i);a!==n&&(a&&this.observer.unobserve(a),this.observer.observe(n),this.elementsCache.set(i,n)),n.isConnected&&this.resizeItem(r,this.options.measureElement(n,s,this))},this.resizeItem=(n,s)=>{const r=this.measurementsCache[n];if(!r)return;const o=this.itemSizeCache.get(r.key)??r.size,i=s-o;i!==0&&((this.shouldAdjustScrollPositionOnItemSizeChange!==void 0?this.shouldAdjustScrollPositionOnItemSizeChange(r,i,this):r.start<this.getScrollOffset()+this.scrollAdjustments)&&this._scrollToOffset(this.getScrollOffset(),{adjustments:this.scrollAdjustments+=i,behavior:void 0}),this.pendingMeasuredCacheIndexes.push(r.index),this.itemSizeCache=new Map(this.itemSizeCache.set(r.key,s)),this.notify(!1))},this.measureElement=n=>{if(!n){this.elementsCache.forEach((s,r)=>{s.isConnected||(this.observer.unobserve(s),this.elementsCache.delete(r))});return}this._measureElement(n,void 0)},this.getVirtualItems=Yo(()=>[this.getIndexes(),this.getMeasurements()],(n,s)=>{const r=[];for(let o=0,i=n.length;o<i;o++){const a=n[o],l=s[a];r.push(l)}return r},{key:Fi.NODE_ENV!=="production",debug:()=>this.options.debug}),this.getVirtualItemForOffset=n=>{const s=this.getMeasurements();if(s.length!==0)return Qu(s[Ab(0,s.length-1,r=>Qu(s[r]).start,n)])},this.getOffsetForAlignment=(n,s)=>{const r=this.getSize(),o=this.getScrollOffset();s==="auto"&&(n<=o?s="start":n>=o+r?s="end":s="start"),s==="start"?n=n:s==="end"?n=n-r:s==="center"&&(n=n-r/2);const i=this.options.horizontal?"scrollWidth":"scrollHeight",l=(this.scrollElement?"document"in this.scrollElement?this.scrollElement.document.documentElement[i]:this.scrollElement[i]:0)-r;return Math.max(Math.min(l,n),0)},this.getOffsetForIndex=(n,s="auto")=>{n=Math.max(0,Math.min(n,this.options.count-1));const r=this.measurementsCache[n];if(!r)return;const o=this.getSize(),i=this.getScrollOffset();if(s==="auto")if(r.end>=i+o-this.options.scrollPaddingEnd)s="end";else if(r.start<=i+this.options.scrollPaddingStart)s="start";else return[i,s];const a=s==="end"?r.end+this.options.scrollPaddingEnd:r.start-this.options.scrollPaddingStart;return[this.getOffsetForAlignment(a,s),s]},this.isDynamicMode=()=>this.elementsCache.size>0,this.cancelScrollToIndex=()=>{this.scrollToIndexTimeoutId!==null&&this.targetWindow&&(this.targetWindow.clearTimeout(this.scrollToIndexTimeoutId),this.scrollToIndexTimeoutId=null)},this.scrollToOffset=(n,{align:s="start",behavior:r}={})=>{this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getOffsetForAlignment(n,s),{adjustments:void 0,behavior:r})},this.scrollToIndex=(n,{align:s="auto",behavior:r}={})=>{n=Math.max(0,Math.min(n,this.options.count-1)),this.cancelScrollToIndex(),r==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size.");const o=this.getOffsetForIndex(n,s);if(!o)return;const[i,a]=o;this._scrollToOffset(i,{adjustments:void 0,behavior:r}),r!=="smooth"&&this.isDynamicMode()&&this.targetWindow&&(this.scrollToIndexTimeoutId=this.targetWindow.setTimeout(()=>{if(this.scrollToIndexTimeoutId=null,this.elementsCache.has(this.options.getItemKey(n))){const[u]=Qu(this.getOffsetForIndex(n,a));fT(u,this.getScrollOffset())||this.scrollToIndex(n,{align:a,behavior:r})}else this.scrollToIndex(n,{align:a,behavior:r})}))},this.scrollBy=(n,{behavior:s}={})=>{this.cancelScrollToIndex(),s==="smooth"&&this.isDynamicMode()&&console.warn("The `smooth` scroll behavior is not fully supported with dynamic size."),this._scrollToOffset(this.getScrollOffset()+n,{adjustments:void 0,behavior:s})},this.getTotalSize=()=>{var n;const s=this.getMeasurements();let r;return s.length===0?r=this.options.paddingStart:r=this.options.lanes===1?((n=s[s.length-1])==null?void 0:n.end)??0:Math.max(...s.slice(-this.options.lanes).map(o=>o.end)),Math.max(r-this.options.scrollMargin+this.options.paddingEnd,0)},this._scrollToOffset=(n,{adjustments:s,behavior:r})=>{this.options.scrollToFn(n,{behavior:r,adjustments:s},this)},this.measure=()=>{this.itemSizeCache=new Map,this.notify(!1)},this.setOptions(t)}}const Ab=(e,t,n,s)=>{for(;e<=t;){const r=(e+t)/2|0,o=n(r);if(o<s)e=r+1;else if(o>s)t=r-1;else return r}return e>0?e-1:0};function ST({measurements:e,outerSize:t,scrollOffset:n}){const s=e.length-1,o=Ab(0,s,a=>e[a].start,n);let i=o;for(;i<s&&e[i].end<n+t;)i++;return{startIndex:o,endIndex:i}}const CT=typeof document<"u"?rt.useLayoutEffect:rt.useEffect;function jT(e){const t=rt.useReducer(()=>({}),{})[1],n={...e,onChange:(r,o)=>{var i;o?Gn.flushSync(t):t(),(i=e.onChange)==null||i.call(e,r,o)}},[s]=rt.useState(()=>new wT(n));return s.setOptions(n),rt.useEffect(()=>s._didMount(),[]),CT(()=>s._willUpdate()),s}function ET(e){return jT({observeElementRect:mT,observeElementOffset:bT,scrollToFn:xT,...e})}var TT=Object.defineProperty,PT=(e,t,n)=>t in e?TT(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ed=(e,t,n)=>(PT(e,typeof t!="symbol"?t+"":t,n),n);let OT=class{constructor(){ed(this,"current",this.detect()),ed(this,"handoffState","pending"),ed(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"}},cr=new OT,qe=(e,t)=>{cr.isServer?h.useEffect(e,t):h.useLayoutEffect(e,t)};function Ht(e){let t=h.useRef(e);return qe(()=>{t.current=e},[e]),t}function Ya(e,t){let[n,s]=h.useState(e),r=Ht(e);return qe(()=>s(r.current),[r,s,...t]),n}let re=function(e){let t=Ht(e);return h.useCallback((...n)=>t.current(...n),[t])};function Xc(e,t,n){let[s,r]=h.useState(n),o=e!==void 0,i=h.useRef(o),a=h.useRef(!1),l=h.useRef(!1);return o&&!i.current&&!a.current?(a.current=!0,i.current=o,console.error("A component is changing from uncontrolled to controlled. This may be caused by the value changing from undefined to a defined value, which should not happen.")):!o&&i.current&&!l.current&&(l.current=!0,i.current=o,console.error("A component is changing from controlled to uncontrolled. This may be caused by the value changing from a defined value to undefined, which should not happen.")),[o?e:s,re(u=>(o||r(u),t==null?void 0:t(u)))]}function xp(e){typeof queueMicrotask=="function"?queueMicrotask(e):Promise.resolve().then(e).catch(t=>setTimeout(()=>{throw t}))}function Bs(){let e=[],t={addEventListener(n,s,r,o){return n.addEventListener(s,r,o),t.add(()=>n.removeEventListener(s,r,o))},requestAnimationFrame(...n){let s=requestAnimationFrame(...n);return t.add(()=>cancelAnimationFrame(s))},nextFrame(...n){return t.requestAnimationFrame(()=>t.requestAnimationFrame(...n))},setTimeout(...n){let s=setTimeout(...n);return t.add(()=>clearTimeout(s))},microTask(...n){let s={current:!0};return xp(()=>{s.current&&n[0]()}),t.add(()=>{s.current=!1})},style(n,s,r){let o=n.style.getPropertyValue(s);return Object.assign(n.style,{[s]:r}),this.add(()=>{Object.assign(n.style,{[s]:o})})},group(n){let s=Bs();return n(s),this.add(()=>s.dispose())},add(n){return e.push(n),()=>{let s=e.indexOf(n);if(s>=0)for(let r of e.splice(s,1))r()}},dispose(){for(let n of e.splice(0))n()}};return t}function hs(){let[e]=h.useState(Bs);return h.useEffect(()=>()=>e.dispose(),[e]),e}function _T(){let e=typeof document>"u";return"useSyncExternalStore"in rt?(t=>t.useSyncExternalStore)(rt)(()=>()=>{},()=>!1,()=>!e):!1}function Jc(){let e=_T(),[t,n]=rt.useState(cr.isHandoffComplete);return t&&cr.isHandoffComplete===!1&&n(!1),rt.useEffect(()=>{t!==!0&&n(!0)},[t]),rt.useEffect(()=>cr.handoff(),[]),e?!1:t}var Tg;let Tt=(Tg=h.useId)!=null?Tg:function(){let e=Jc(),[t,n]=h.useState(e?()=>cr.nextId():null);return qe(()=>{t===null&&n(cr.nextId())},[t]),t!=null?""+t:void 0};function Re(e,t,...n){if(e in t){let r=t[e];return typeof r=="function"?r(...n):r}let s=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(r=>`"${r}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(s,Re),s}function Qr(e){return cr.isServer?null:e instanceof Node?e.ownerDocument:e!=null&&e.hasOwnProperty("current")&&e.current instanceof Node?e.current.ownerDocument:document}let hf=["[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 At=(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))(At||{}),ks=(e=>(e[e.Error=0]="Error",e[e.Overflow=1]="Overflow",e[e.Success=2]="Success",e[e.Underflow=3]="Underflow",e))(ks||{}),AT=(e=>(e[e.Previous=-1]="Previous",e[e.Next=1]="Next",e))(AT||{});function Qc(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(hf)).sort((t,n)=>Math.sign((t.tabIndex||Number.MAX_SAFE_INTEGER)-(n.tabIndex||Number.MAX_SAFE_INTEGER)))}var eu=(e=>(e[e.Strict=0]="Strict",e[e.Loose=1]="Loose",e))(eu||{});function wp(e,t=0){var n;return e===((n=Qr(e))==null?void 0:n.body)?!1:Re(t,{0(){return e.matches(hf)},1(){let s=e;for(;s!==null;){if(s.matches(hf))return!0;s=s.parentElement}return!1}})}var LT=(e=>(e[e.Keyboard=0]="Keyboard",e[e.Mouse=1]="Mouse",e))(LT||{});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 MT=["textarea","input"].join(",");function NT(e){var t,n;return(n=(t=e==null?void 0:e.matches)==null?void 0:t.call(e,MT))!=null?n:!1}function or(e,t=n=>n){return e.slice().sort((n,s)=>{let r=t(n),o=t(s);if(r===null||o===null)return 0;let i=r.compareDocumentPosition(o);return i&Node.DOCUMENT_POSITION_FOLLOWING?-1:i&Node.DOCUMENT_POSITION_PRECEDING?1:0})}function ln(e,t,{sorted:n=!0,relativeTo:s=null,skipElements:r=[]}={}){let o=Array.isArray(e)?e.length>0?e[0].ownerDocument:document:e.ownerDocument,i=Array.isArray(e)?n?or(e):e:Qc(e);r.length>0&&i.length>1&&(i=i.filter(g=>!r.includes(g))),s=s??o.activeElement;let a=(()=>{if(t&5)return 1;if(t&10)return-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),l=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,i.indexOf(s))-1;if(t&4)return Math.max(0,i.indexOf(s))+1;if(t&8)return i.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),u=t&32?{preventScroll:!0}:{},d=0,f=i.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=i[g],p==null||p.focus(u),d+=a}while(p!==o.activeElement);return t&6&&NT(p)&&p.select(),2}function $T(){return/iPhone/gi.test(window.navigator.platform)||/Mac/gi.test(window.navigator.platform)&&window.navigator.maxTouchPoints>0}function kT(){return/Android/gi.test(window.navigator.userAgent)}function Lb(){return $T()||kT()}function Pl(e,t,n){let s=Ht(t);h.useEffect(()=>{function r(o){s.current(o)}return document.addEventListener(e,r,n),()=>document.removeEventListener(e,r,n)},[e,n])}function Mb(e,t,n){let s=Ht(t);h.useEffect(()=>{function r(o){s.current(o)}return window.addEventListener(e,r,n),()=>window.removeEventListener(e,r,n)},[e,n])}function Sp(e,t,n=!0){let s=h.useRef(!1);h.useEffect(()=>{requestAnimationFrame(()=>{s.current=n})},[n]);function r(i,a){if(!s.current||i.defaultPrevented)return;let l=a(i);if(l===null||!l.getRootNode().contains(l)||!l.isConnected)return;let u=function d(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)||i.composed&&i.composedPath().includes(f))return}return!wp(l,eu.Loose)&&l.tabIndex!==-1&&i.preventDefault(),t(i,l)}let o=h.useRef(null);Pl("pointerdown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),Pl("mousedown",i=>{var a,l;s.current&&(o.current=((l=(a=i.composedPath)==null?void 0:a.call(i))==null?void 0:l[0])||i.target)},!0),Pl("click",i=>{Lb()||o.current&&(r(i,()=>o.current),o.current=null)},!0),Pl("touchend",i=>r(i,()=>i.target instanceof HTMLElement?i.target:null),!0),Mb("blur",i=>r(i,()=>window.document.activeElement instanceof HTMLIFrameElement?window.document.activeElement:null),!0)}function Do(...e){return h.useMemo(()=>Qr(...e),[...e])}function Pg(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 Ai(e,t){let[n,s]=h.useState(()=>Pg(e));return qe(()=>{s(Pg(e))},[e.type,e.as]),qe(()=>{n||t.current&&t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&s("button")},[n,t]),n}let Nb=Symbol();function Cp(e,t=!0){return Object.assign(e,{[Nb]:t})}function Ze(...e){let t=h.useRef(e);h.useEffect(()=>{t.current=e},[e]);let n=re(s=>{for(let r of t.current)r!=null&&(typeof r=="function"?r(s):r.current=s)});return e.every(s=>s==null||(s==null?void 0:s[Nb]))?void 0:n}function Og(e){return[e.screenX,e.screenY]}function $b(){let e=h.useRef([-1,-1]);return{wasMoved(t){let n=Og(t);return e.current[0]===n[0]&&e.current[1]===n[1]?!1:(e.current=n,!0)},update(t){e.current=Og(t)}}}function kb({container:e,accept:t,walk:n,enabled:s=!0}){let r=h.useRef(t),o=h.useRef(n);h.useEffect(()=>{r.current=t,o.current=n},[t,n]),qe(()=>{if(!e||!s)return;let i=Qr(e);if(!i)return;let a=r.current,l=o.current,u=Object.assign(f=>a(f),{acceptNode:a}),d=i.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,u,!1);for(;d.nextNode();)l(d.currentNode)},[e,s,r,o])}function _g(e,t){let n=h.useRef([]),s=re(e);h.useEffect(()=>{let r=[...n.current];for(let[o,i]of t.entries())if(n.current[o]!==i){let a=s(t,r);return n.current=t,a}},[s,...t])}function jc(...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||{}),Nr=(e=>(e[e.Unmount=0]="Unmount",e[e.Hidden=1]="Hidden",e))(Nr||{});function Be({ourProps:e,theirProps:t,slot:n,defaultTag:s,features:r,visible:o=!0,name:i,mergeRefs:a}){a=a??RT;let l=Rb(t,e);if(o)return Ol(l,n,s,i,a);let u=r??0;if(u&2){let{static:d=!1,...f}=l;if(d)return Ol(f,n,s,i,a)}if(u&1){let{unmount:d=!0,...f}=l;return Re(d?0:1,{0(){return null},1(){return Ol({...f,hidden:!0,style:{display:"none"}},n,s,i,a)}})}return Ol(l,n,s,i,a)}function Ol(e,t={},n,s,r){let{as:o=n,children:i,refName:a="ref",...l}=td(e,["unmount","static"]),u=e.ref!==void 0?{[a]:e.ref}:{},d=typeof i=="function"?i(t):i;"className"in l&&l.className&&typeof l.className=="function"&&(l.className=l.className(t));let 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(o===h.Fragment&&Object.keys(mi(l)).length>0){if(!h.isValidElement(d)||Array.isArray(d)&&d.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${s} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(v=>` - ${v}`).join(`
|
|
22
|
+
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(v=>` - ${v}`).join(`
|
|
88
23
|
`)].join(`
|
|
89
|
-
`));let p=d.props,g=typeof(p==null?void 0:p.className)=="function"?(...b)=>fc(p==null?void 0:p.className(...b),l.className):fc(p==null?void 0:p.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},jv(d.props,di(zu(l,["ref"]))),f,u,{ref:r(d.ref,u.ref)},m))}return h.createElement(o,Object.assign({},zu(l,["ref"]),o!==h.Fragment&&u,o!==h.Fragment&&f),d)}function lp(){let e=h.useRef([]),t=h.useCallback(n=>{for(let s of e.current)s!=null&&(typeof s=="function"?s(n):s.current=n)},[]);return(...n)=>{if(!n.every(s=>s==null))return e.current=n,t}}function aP(...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 jv(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let r in s)r.startsWith("on")&&typeof s[r]=="function"?(n[r]!=null||(n[r]=[]),n[r].push(s[r])):t[r]=s[r];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(s=>[s,void 0])));for(let s in n)Object.assign(t,{[s](r,...o){let i=n[s];for(let a of i){if((r instanceof Event||(r==null?void 0:r.nativeEvent)instanceof Event)&&r.defaultPrevented)return;a(r,...o)}}});return t}function He(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function di(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function zu(e,t=[]){let n=Object.assign({},e);for(let s of t)s in n&&delete n[s];return n}let lP="div";var ls=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(ls||{});function cP(e,t){var n;let{features:s=1,...r}=e,o={ref:t,"aria-hidden":(s&2)===2?!0:(n=r["aria-hidden"])!=null?n:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return De({ourProps:o,theirProps:r,slot:{},defaultTag:lP,name:"Hidden"})}let cs=He(cP),cp=h.createContext(null);cp.displayName="OpenClosedContext";var dt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(dt||{});function Lo(){return h.useContext(cp)}function Da({value:e,children:t}){return h.createElement(cp.Provider,{value:e},t)}function uP(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let oo=[];uP(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&oo[0]!==t.target&&(oo.unshift(t.target),oo=oo.filter(n=>n!=null&&n.isConnected),oo.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 kr(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let s=(t==null?void 0:t.getAttribute("disabled"))==="";return s&&dP(n)?!1:s}function dP(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function fP(e){throw new Error("Unexpected object: "+e)}var Ge=(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))(Ge||{});function Qd(e,t){let n=t.resolveItems();if(n.length<=0)return null;let s=t.resolveActiveIndex(),r=s??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 1:{for(let o=r-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 2:{for(let o=r+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return s}case 5:return null;default:fP(e)}}function Fc(e={},t=null,n=[]){for(let[s,r]of Object.entries(e))Pv(n,Ev(t,s),r);return n}function Ev(e,t){return e?e+"["+t+"]":t}function Pv(e,t,n){if(Array.isArray(n))for(let[s,r]of n.entries())Pv(e,Ev(t,s.toString()),r);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):Fc(n,t,e)}function _v(e){var t,n;let s=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(s){for(let r of s.elements)if(r!==e&&(r.tagName==="INPUT"&&r.type==="submit"||r.tagName==="BUTTON"&&r.type==="submit"||r.nodeName==="INPUT"&&r.type==="image")){r.click();return}(n=s.requestSubmit)==null||n.call(s)}}var 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||{}),pP={},hP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(hP||{}),gP=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(gP||{}),mP=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(mP||{}),bP=(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))(bP||{});function Uu(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=t(e.options.slice()),r=s.length>0&&s[0].dataRef.current.order!==null?s.sort((i,a)=>i.dataRef.current.order-a.dataRef.current.order):Js(s,i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let vP={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,s,r,o,i;if((n=e.dataRef.current)!=null&&n.disabled||(s=e.dataRef.current)!=null&&s.optionsRef.current&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Ge.Specific?t.idx:Qd(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=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===f?e:{...e,activeOptionIndex:d,activationTrigger:f}}let a=Uu(e);if(a.activeOptionIndex===null){let d=a.options.findIndex(f=>!f.dataRef.current.disabled);d!==-1&&(a.activeOptionIndex=d)}let l=t.focus===Ge.Specific?t.idx:Qd(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...a,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,s,r;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,i=Uu(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(s=e.dataRef.current)!=null&&s.isSelected(t.payload.dataRef.current.value)&&(i.activeOptionIndex=i.options.indexOf(o));let a={...e,...i,activationTrigger:2};return(r=e.dataRef.current)!=null&&r.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(r=>r.id!==t.id)};let s=Uu(e,r=>{let o=r.findIndex(i=>i.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...s,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let s=e.activeOptionIndex;if(e.activeOptionIndex!==null){let r=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);r!==-1?s=r:s=null}return{...e,activeOptionIndex:s,virtual:Object.assign({},e.virtual,{options:t.options})}}},up=h.createContext(null);up.displayName="ComboboxActionsContext";function Ha(e){let t=h.useContext(up);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ha),n}return t}let Tv=h.createContext(null);function yP(e){var t;let n=Ro("VirtualProvider"),[s,r]=h.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let u=window.getComputedStyle(l);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[n.optionsRef.current]),o=ZE({scrollPaddingStart:s,scrollPaddingEnd:r,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[i,a]=h.useState(0);return ze(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),h.createElement(Tv.Provider,{value:o},h.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&pP.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&o.scrollToIndex(n.activeOptionIndex)}}},o.getVirtualItems().map(l=>{var u;return h.createElement(h.Fragment,{key:l.key},h.cloneElement((u=e.children)==null?void 0:u.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${i}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let dp=h.createContext(null);dp.displayName="ComboboxDataContext";function Ro(e){let t=h.useContext(dp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ro),n}return t}function xP(e,t){return Le(t.type,vP,e,t)}let wP=h.Fragment;function SP(e,t){let{value:n,defaultValue:s,onChange:r,form:o,name:i,by:a=null,disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:f=!1,immediate:p=!1,virtual:g=null,...m}=e,b=!1,v=null,[x=f?[]:void 0,y]=Vc(n,r,s),[w,S]=h.useReducer(xP,{dataRef:h.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),C=h.useRef(!1),j=h.useRef({static:!1,hold:!1}),E=h.useRef(null),_=h.useRef(null),T=h.useRef(null),P=h.useRef(null),A=ae(typeof a=="string"?(Q,se)=>{let de=a;return(Q==null?void 0:Q[de])===(se==null?void 0:se[de])}:a??((Q,se)=>Q===se)),M=ae(Q=>w.options.findIndex(se=>A(se.dataRef.current.value,Q))),R=h.useCallback(Q=>Le(L.mode,{1:()=>x.some(se=>A(se,Q)),0:()=>A(x,Q)}),[x]),F=ae(Q=>w.activeOptionIndex===M(Q)),L=h.useMemo(()=>({...w,immediate:b,optionsPropsRef:j,labelRef:E,inputRef:_,buttonRef:T,optionsRef:P,value:x,defaultValue:s,disabled:l,mode:f?1:0,virtual:w.virtual,get activeOptionIndex(){if(C.current&&w.activeOptionIndex===null&&w.options.length>0){let Q=w.options.findIndex(se=>!se.dataRef.current.disabled);if(Q!==-1)return Q}return w.activeOptionIndex},calculateIndex:M,compare:A,isSelected:R,isActive:F,nullable:d,__demoMode:u}),[x,s,l,f,d,u,w,v]);ze(()=>{},[v,void 0]),ze(()=>{w.dataRef.current=L},[L]),ip([L.buttonRef,L.inputRef,L.optionsRef],()=>K.closeCombobox(),L.comboboxState===0);let B=h.useMemo(()=>{var Q,se,de;return{open:L.comboboxState===0,disabled:l,activeIndex:L.activeOptionIndex,activeOption:L.activeOptionIndex===null?null:L.virtual?L.virtual.options[(Q=L.activeOptionIndex)!=null?Q:0]:(de=(se=L.options[L.activeOptionIndex])==null?void 0:se.dataRef.current.value)!=null?de:null,value:x}},[L,l,x]),q=ae(()=>{if(L.activeOptionIndex!==null){if(L.virtual)G(L.virtual.options[L.activeOptionIndex]);else{let{dataRef:Q}=L.options[L.activeOptionIndex];G(Q.current.value)}K.goToOption(Ge.Specific,L.activeOptionIndex)}}),H=ae(()=>{S({type:0}),C.current=!0}),$=ae(()=>{S({type:1}),C.current=!1}),I=ae((Q,se,de)=>(C.current=!1,Q===Ge.Specific?S({type:2,focus:Ge.Specific,idx:se,trigger:de}):S({type:2,focus:Q,trigger:de}))),O=ae((Q,se)=>(S({type:3,payload:{id:Q,dataRef:se}}),()=>{L.isActive(se.current.value)&&(C.current=!0),S({type:4,id:Q})})),V=ae(Q=>(S({type:5,id:Q}),()=>S({type:5,id:null}))),G=ae(Q=>Le(L.mode,{0(){return y==null?void 0:y(Q)},1(){let se=L.value.slice(),de=se.findIndex(Se=>A(Se,Q));return de===-1?se.push(Q):se.splice(de,1),y==null?void 0:y(se)}})),W=ae(Q=>{S({type:6,trigger:Q})}),K=h.useMemo(()=>({onChange:G,registerOption:O,registerLabel:V,goToOption:I,closeCombobox:$,openCombobox:H,setActivationTrigger:W,selectActiveOption:q}),[]),J=t===null?{}:{ref:t},Y=h.useRef(null),U=as();return h.useEffect(()=>{Y.current&&s!==void 0&&U.addEventListener(Y.current,"reset",()=>{y==null||y(s)})},[Y,y]),h.createElement(up.Provider,{value:K},h.createElement(dp.Provider,{value:L},h.createElement(Da,{value:Le(L.comboboxState,{0:dt.Open,1:dt.Closed})},i!=null&&x!=null&&Fc({[i]:x}).map(([Q,se],de)=>h.createElement(cs,{features:ls.Hidden,ref:de===0?Se=>{var ne;Y.current=(ne=Se==null?void 0:Se.closest("form"))!=null?ne:null}:void 0,...di({key:Q,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Q,value:se})})),De({ourProps:J,theirProps:m,slot:B,defaultTag:wP,name:"Combobox"}))))}let CP="input";function jP(e,t){var n,s,r,o,i;let a=xt(),{id:l=`headlessui-combobox-input-${a}`,onChange:u,displayValue:d,type:f="text",...p}=e,g=Ro("Combobox.Input"),m=Ha("Combobox.Input"),b=Ue(g.inputRef,t),v=Mo(g.inputRef),x=h.useRef(!1),y=as(),w=ae(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Ge.Nothing)}),S=function(){var L;return typeof d=="function"&&g.value!==void 0?(L=d(g.value))!=null?L:"":typeof g.value=="string"?g.value:""}();bg(([L,B],[q,H])=>{if(x.current)return;let $=g.inputRef.current;$&&((H===0&&B===1||L!==q)&&($.value=L),requestAnimationFrame(()=>{if(x.current||!$||(v==null?void 0:v.activeElement)!==$)return;let{selectionStart:I,selectionEnd:O}=$;Math.abs((O??0)-(I??0))===0&&I===0&&$.setSelectionRange($.value.length,$.value.length)}))},[S,g.comboboxState,v]),bg(([L],[B])=>{if(L===0&&B===1){if(x.current)return;let q=g.inputRef.current;if(!q)return;let H=q.value,{selectionStart:$,selectionEnd:I,selectionDirection:O}=q;q.value="",q.value=H,O!==null?q.setSelectionRange($,I,O):q.setSelectionRange($,I)}},[g.comboboxState]);let C=h.useRef(!1),j=ae(()=>{C.current=!0}),E=ae(()=>{y.nextFrame(()=>{C.current=!1})}),_=ae(L=>{switch(x.current=!0,L.key){case ve.Enter:if(x.current=!1,g.comboboxState!==0||C.current)return;if(L.preventDefault(),L.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case ve.ArrowDown:return x.current=!1,L.preventDefault(),L.stopPropagation(),Le(g.comboboxState,{0:()=>m.goToOption(Ge.Next),1:()=>m.openCombobox()});case ve.ArrowUp:return x.current=!1,L.preventDefault(),L.stopPropagation(),Le(g.comboboxState,{0:()=>m.goToOption(Ge.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Ge.Last)})}});case ve.Home:if(L.shiftKey)break;return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Ge.First);case ve.PageUp:return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Ge.First);case ve.End:if(L.shiftKey)break;return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Ge.Last);case ve.PageDown:return x.current=!1,L.preventDefault(),L.stopPropagation(),m.goToOption(Ge.Last);case ve.Escape:return x.current=!1,g.comboboxState!==0?void 0:(L.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&L.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&w(),m.closeCombobox());case ve.Tab:if(x.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),T=ae(L=>{u==null||u(L),g.nullable&&g.mode===0&&L.target.value===""&&w(),m.openCombobox()}),P=ae(L=>{var B,q,H;let $=(B=L.relatedTarget)!=null?B:oo.find(I=>I!==L.currentTarget);if(x.current=!1,!((q=g.optionsRef.current)!=null&&q.contains($))&&!((H=g.buttonRef.current)!=null&&H.contains($))&&g.comboboxState===0)return L.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?w():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),A=ae(L=>{var B,q,H;let $=(B=L.relatedTarget)!=null?B:oo.find(I=>I!==L.currentTarget);(q=g.buttonRef.current)!=null&&q.contains($)||(H=g.optionsRef.current)!=null&&H.contains($)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),M=Ia(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),R=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),F={ref:b,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?(s=g.options.find(L=>{var B;return!((B=g.virtual)!=null&&B.disabled(L.dataRef.current.value))&&g.compare(L.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:s.id:(r=g.options[g.activeOptionIndex])==null?void 0:r.id,"aria-labelledby":M,"aria-autocomplete":"list",defaultValue:(i=(o=e.defaultValue)!=null?o:g.defaultValue!==void 0?d==null?void 0:d(g.defaultValue):null)!=null?i:g.defaultValue,disabled:g.disabled,onCompositionStart:j,onCompositionEnd:E,onKeyDown:_,onChange:T,onFocus:A,onBlur:P};return De({ourProps:F,theirProps:p,slot:R,defaultTag:CP,name:"Combobox.Input"})}let EP="button";function PP(e,t){var n;let s=Ro("Combobox.Button"),r=Ha("Combobox.Button"),o=Ue(s.buttonRef,t),i=xt(),{id:a=`headlessui-combobox-button-${i}`,...l}=e,u=as(),d=ae(b=>{switch(b.key){case ve.ArrowDown:return b.preventDefault(),b.stopPropagation(),s.comboboxState===1&&r.openCombobox(),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case ve.ArrowUp:return b.preventDefault(),b.stopPropagation(),s.comboboxState===1&&(r.openCombobox(),u.nextFrame(()=>{s.value||r.goToOption(Ge.Last)})),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})});case ve.Escape:return s.comboboxState!==0?void 0:(b.preventDefault(),s.optionsRef.current&&!s.optionsPropsRef.current.static&&b.stopPropagation(),r.closeCombobox(),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})}));default:return}}),f=ae(b=>{if(kr(b.currentTarget))return b.preventDefault();s.comboboxState===0?r.closeCombobox():(b.preventDefault(),r.openCombobox()),u.nextFrame(()=>{var v;return(v=s.inputRef.current)==null?void 0:v.focus({preventScroll:!0})})}),p=Ia(()=>{if(s.labelId)return[s.labelId,a].join(" ")},[s.labelId,a]),g=h.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled,value:s.value}),[s]),m={ref:o,id:a,type:Ci(e,s.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=s.optionsRef.current)==null?void 0:n.id,"aria-expanded":s.comboboxState===0,"aria-labelledby":p,disabled:s.disabled,onClick:f,onKeyDown:d};return De({ourProps:m,theirProps:l,slot:g,defaultTag:EP,name:"Combobox.Button"})}let _P="label";function TP(e,t){let n=xt(),{id:s=`headlessui-combobox-label-${n}`,...r}=e,o=Ro("Combobox.Label"),i=Ha("Combobox.Label"),a=Ue(o.labelRef,t);ze(()=>i.registerLabel(s),[s]);let l=ae(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]);return De({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:_P,name:"Combobox.Label"})}let OP="ul",AP=gn.RenderStrategy|gn.Static;function NP(e,t){let n=xt(),{id:s=`headlessui-combobox-options-${n}`,hold:r=!1,...o}=e,i=Ro("Combobox.Options"),a=Ue(i.optionsRef,t),l=Lo(),u=l!==null?(l&dt.Open)===dt.Open:i.comboboxState===0;ze(()=>{var g;i.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[i.optionsPropsRef,e.static]),ze(()=>{i.optionsPropsRef.current.hold=r},[i.optionsPropsRef,r]),Cv({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(g){return g.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:g.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(g){g.setAttribute("role","none")}});let d=Ia(()=>{var g,m;return(m=i.labelId)!=null?m:(g=i.buttonRef.current)==null?void 0:g.id},[i.labelId,i.buttonRef.current]),f=h.useMemo(()=>({open:i.comboboxState===0,option:void 0}),[i]),p={"aria-labelledby":d,role:"listbox","aria-multiselectable":i.mode===1?!0:void 0,id:s,ref:a};return i.virtual&&i.comboboxState===0&&Object.assign(o,{children:h.createElement(yP,null,o.children)}),De({ourProps:p,theirProps:o,slot:f,defaultTag:OP,features:AP,visible:u,name:"Combobox.Options"})}let MP="li";function LP(e,t){var n;let s=xt(),{id:r=`headlessui-combobox-option-${s}`,disabled:o=!1,value:i,order:a=null,...l}=e,u=Ro("Combobox.Option"),d=Ha("Combobox.Option"),f=u.virtual?u.activeOptionIndex===u.calculateIndex(i):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===r,p=u.isSelected(i),g=h.useRef(null),m=Mt({disabled:o,value:i,domRef:g,order:a}),b=h.useContext(Tv),v=Ue(t,g,b?b.measureElement:null),x=ae(()=>d.onChange(i));ze(()=>d.registerOption(r,m),[m,r]);let y=h.useRef(!(u.virtual||u.__demoMode));ze(()=>{if(!u.virtual||!u.__demoMode)return;let P=$s();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=$s();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 w=ae(P=>{var A;if(o||(A=u.virtual)!=null&&A.disabled(i))return P.preventDefault();x(),yv()||requestAnimationFrame(()=>{var M;return(M=u.inputRef.current)==null?void 0:M.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),S=ae(()=>{var P;if(o||(P=u.virtual)!=null&&P.disabled(i))return d.goToOption(Ge.Nothing);let A=u.calculateIndex(i);d.goToOption(Ge.Specific,A)}),C=Sv(),j=ae(P=>C.update(P)),E=ae(P=>{var A;if(!C.wasMoved(P)||o||(A=u.virtual)!=null&&A.disabled(i)||f)return;let M=u.calculateIndex(i);d.goToOption(Ge.Specific,M,0)}),_=ae(P=>{var A;C.wasMoved(P)&&(o||(A=u.virtual)!=null&&A.disabled(i)||f&&(u.optionsPropsRef.current.hold||d.goToOption(Ge.Nothing)))}),T=h.useMemo(()=>({active:f,selected:p,disabled:o}),[f,p,o]);return De({ourProps:{id:r,ref:v,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:w,onFocus:S,onPointerEnter:j,onMouseEnter:j,onPointerMove:E,onMouseMove:E,onPointerLeave:_,onMouseLeave:_},theirProps:l,slot:T,defaultTag:MP,name:"Combobox.Option"})}let RP=He(SP),$P=He(PP),kP=He(jP),VP=He(TP),IP=He(NP),DP=He(LP),Bo=Object.assign(RP,{Input:kP,Button:$P,Label:VP,Options:IP,Option:DP});function HP(e,t,n,s){let r=Mt(n);h.useEffect(()=>{e=e??window;function o(i){r.current(i)}return e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)},[e,t,s])}function Bc(){let e=h.useRef(!1);return ze(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function FP(e){let t=ae(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,rp(()=>{n.current&&t()})}),[t])}var Qs=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(Qs||{});function Ov(){let e=h.useRef(0);return xv("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let BP=h.createContext(!1);function zP(){return h.useContext(BP)}function UP(e){let t=zP(),n=h.useContext(Av),s=Mo(e),[r,o]=h.useState(()=>{if(!t&&n!==null||nr.isServer)return null;let i=s==null?void 0:s.getElementById("headlessui-portal-root");if(i)return i;if(s===null)return null;let a=s.createElement("div");return a.setAttribute("id","headlessui-portal-root"),s.body.appendChild(a)});return h.useEffect(()=>{r!==null&&(s!=null&&s.body.contains(r)||s==null||s.body.appendChild(r))},[r,s]),h.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let WP=h.Fragment;function GP(e,t){let n=e,s=h.useRef(null),r=Ue(ap(d=>{s.current=d}),t),o=Mo(s),i=UP(s),[a]=h.useState(()=>{var d;return nr.isServer?null:(d=o==null?void 0:o.createElement("div"))!=null?d:null}),l=h.useContext(ef),u=Ic();return ze(()=>{!i||!a||i.contains(a)||(a.setAttribute("data-headlessui-portal",""),i.appendChild(a))},[i,a]),ze(()=>{if(a&&l)return l.register(a)},[l,a]),FP(()=>{var d;!i||!a||(a instanceof Node&&i.contains(a)&&i.removeChild(a),i.childNodes.length<=0&&((d=i.parentElement)==null||d.removeChild(i)))}),u?!i||!a?null:Dn.createPortal(De({ourProps:{ref:r},theirProps:n,defaultTag:WP,name:"Portal"}),a):null}let qP=h.Fragment,Av=h.createContext(null);function KP(e,t){let{target:n,...s}=e,r={ref:Ue(t)};return h.createElement(Av.Provider,{value:n},De({ourProps:r,theirProps:s,defaultTag:qP,name:"Popover.Group"}))}let ef=h.createContext(null);function YP(){let e=h.useContext(ef),t=h.useRef([]),n=ae(o=>(t.current.push(o),e&&e.register(o),()=>s(o))),s=ae(o=>{let i=t.current.indexOf(o);i!==-1&&t.current.splice(i,1),e&&e.unregister(o)}),r=h.useMemo(()=>({register:n,unregister:s,portals:t}),[n,s,t]);return[t,h.useMemo(()=>function({children:o}){return h.createElement(ef.Provider,{value:r},o)},[r])]}let ZP=He(GP),XP=He(KP);Object.assign(ZP,{Group:XP});function JP({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var s;let r=h.useRef((s=n==null?void 0:n.current)!=null?s:null),o=Mo(r),i=ae(()=>{var a,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(a=o==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?a:[])f!==document.body&&f!==document.head&&f instanceof HTMLElement&&f.id!=="headlessui-portal-root"&&(f.contains(r.current)||f.contains((u=(l=r.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(p=>f.contains(p))||d.push(f));return d});return{resolveContainers:i,contains:ae(a=>i().some(l=>l.contains(a))),mainTreeNodeRef:r,MainTreeNode:h.useMemo(()=>function(){return n!=null?null:h.createElement(cs,{features:ls.Hidden,ref:r})},[r,n])}}function QP(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(cs,{features:ls.Hidden,ref:e})},[e])}}let Nv=h.createContext(null);function Mv(){let e=h.useContext(Nv);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,Mv),t}return e}function fp(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let s=ae(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=h.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return h.createElement(Nv.Provider,{value:r},n.children)},[t])]}let e_="p";function t_(e,t){let n=xt(),{id:s=`headlessui-description-${n}`,...r}=e,o=Mv(),i=Ue(t);ze(()=>o.register(s),[s,o.register]);let a={ref:i,...o.props,id:s};return De({ourProps:a,theirProps:r,slot:o.slot||{},defaultTag:e_,name:o.name||"Description"})}let n_=He(t_),Lv=Object.assign(n_,{});var vg;let s_=(vg=h.startTransition)!=null?vg:function(e){e()};var r_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(r_||{}),o_=(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))(o_||{});let i_={0:e=>({...e,disclosureState:Le(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}}},pp=h.createContext(null);pp.displayName="DisclosureContext";function hp(e){let t=h.useContext(pp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,hp),n}return t}let gp=h.createContext(null);gp.displayName="DisclosureAPIContext";function Rv(e){let t=h.useContext(gp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Rv),n}return t}let mp=h.createContext(null);mp.displayName="DisclosurePanelContext";function a_(){return h.useContext(mp)}function l_(e,t){return Le(t.type,i_,e,t)}let c_=h.Fragment;function u_(e,t){let{defaultOpen:n=!1,...s}=e,r=h.useRef(null),o=Ue(t,ap(v=>{r.current=v},e.as===void 0||e.as===h.Fragment)),i=h.useRef(null),a=h.useRef(null),l=h.useReducer(l_,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:a,panelRef:i,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},f]=l,p=ae(v=>{f({type:1});let x=Ur(r);if(!x||!d)return;let y=v?v instanceof HTMLElement?v:v.current instanceof HTMLElement?v.current:x.getElementById(d):x.getElementById(d);y==null||y.focus()}),g=h.useMemo(()=>({close:p}),[p]),m=h.useMemo(()=>({open:u===0,close:p}),[u,p]),b={ref:o};return h.createElement(pp.Provider,{value:l},h.createElement(gp.Provider,{value:g},h.createElement(Da,{value:Le(u,{0:dt.Open,1:dt.Closed})},De({ourProps:b,theirProps:s,slot:m,defaultTag:c_,name:"Disclosure"}))))}let d_="button";function f_(e,t){let n=xt(),{id:s=`headlessui-disclosure-button-${n}`,...r}=e,[o,i]=hp("Disclosure.Button"),a=a_(),l=a===null?!1:a===o.panelId,u=h.useRef(null),d=Ue(u,t,l?null:o.buttonRef),f=lp();h.useEffect(()=>{if(!l)return i({type:2,buttonId:s}),()=>{i({type:2,buttonId:null})}},[s,i,l]);let p=ae(y=>{var w;if(l){if(o.disclosureState===1)return;switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),i({type:0}),(w=o.buttonRef.current)==null||w.focus();break}}else switch(y.key){case ve.Space:case ve.Enter:y.preventDefault(),y.stopPropagation(),i({type:0});break}}),g=ae(y=>{switch(y.key){case ve.Space:y.preventDefault();break}}),m=ae(y=>{var w;kr(y.currentTarget)||e.disabled||(l?(i({type:0}),(w=o.buttonRef.current)==null||w.focus()):i({type:0}))}),b=h.useMemo(()=>({open:o.disclosureState===0}),[o]),v=Ci(e,u),x=l?{ref:d,type:v,onKeyDown:p,onClick:m}:{ref:d,id:s,type:v,"aria-expanded":o.disclosureState===0,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:p,onKeyUp:g,onClick:m};return De({mergeRefs:f,ourProps:x,theirProps:r,slot:b,defaultTag:d_,name:"Disclosure.Button"})}let p_="div",h_=gn.RenderStrategy|gn.Static;function g_(e,t){let n=xt(),{id:s=`headlessui-disclosure-panel-${n}`,...r}=e,[o,i]=hp("Disclosure.Panel"),{close:a}=Rv("Disclosure.Panel"),l=lp(),u=Ue(t,o.panelRef,m=>{s_(()=>i({type:m?4:5}))});h.useEffect(()=>(i({type:3,panelId:s}),()=>{i({type:3,panelId:null})}),[s,i]);let d=Lo(),f=d!==null?(d&dt.Open)===dt.Open:o.disclosureState===0,p=h.useMemo(()=>({open:o.disclosureState===0,close:a}),[o,a]),g={ref:u,id:s};return h.createElement(mp.Provider,{value:o.panelId},De({mergeRefs:l,ourProps:g,theirProps:r,slot:p,defaultTag:p_,features:h_,visible:f,name:"Disclosure.Panel"}))}let m_=He(u_),b_=He(f_),v_=He(g_),Wu=Object.assign(m_,{Button:b_,Panel:v_}),yg=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function xg(e){var t,n;let s=(t=e.innerText)!=null?t:"",r=e.cloneNode(!0);if(!(r instanceof HTMLElement))return s;let o=!1;for(let a of r.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),o=!0;let i=o?(n=r.innerText)!=null?n:"":s;return yg.test(i)&&(i=i.replace(yg,"")),i}function y_(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let s=n.split(" ").map(r=>{let o=document.getElementById(r);if(o){let i=o.getAttribute("aria-label");return typeof i=="string"?i.trim():xg(o).trim()}return null}).filter(Boolean);if(s.length>0)return s.join(", ")}return xg(e).trim()}function x_(e){let t=h.useRef(""),n=h.useRef("");return ae(()=>{let s=e.current;if(!s)return"";let r=s.innerText;if(t.current===r)return n.current;let o=y_(s).trim().toLowerCase();return t.current=r,n.current=o,o})}var w_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(w_||{}),S_=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(S_||{}),C_=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(C_||{}),j_=(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))(j_||{});function Gu(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=Js(t(e.options.slice()),o=>o.dataRef.current.domRef.current),r=n?s.indexOf(n):null;return r===-1&&(r=null),{options:s,activeOptionIndex:r}}let E_={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,s=e.options.findIndex(r=>n(r.dataRef.current.value));return s!==-1&&(t=s),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let s=Gu(e),r=Qd(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return{...e,...s,searchQuery:"",activeOptionIndex:r,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,s=e.searchQuery+t.value.toLowerCase(),r=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var a;return!i.dataRef.current.disabled&&((a=i.dataRef.current.textValue)==null?void 0:a.startsWith(s))}),o=r?e.options.indexOf(r):-1;return o===-1||o===e.activeOptionIndex?{...e,searchQuery:s}:{...e,searchQuery:s,activeOptionIndex:o,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},s=Gu(e,r=>[...r,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(n)),{...e,...s}},6:(e,t)=>{let n=Gu(e,s=>{let r=s.findIndex(o=>o.id===t.id);return r!==-1&&s.splice(r,1),s});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},bp=h.createContext(null);bp.displayName="ListboxActionsContext";function Fa(e){let t=h.useContext(bp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Fa),n}return t}let vp=h.createContext(null);vp.displayName="ListboxDataContext";function Ba(e){let t=h.useContext(vp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ba),n}return t}function P_(e,t){return Le(t.type,E_,e,t)}let __=h.Fragment;function T_(e,t){let{value:n,defaultValue:s,form:r,name:o,onChange:i,by:a=(W,K)=>W===K,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...f}=e;const p=u?"horizontal":"vertical";let g=Ue(t),[m=d?[]:void 0,b]=Vc(n,i,s),[v,x]=h.useReducer(P_,{dataRef:h.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=h.useRef({static:!1,hold:!1}),w=h.useRef(null),S=h.useRef(null),C=h.useRef(null),j=ae(typeof a=="string"?(W,K)=>{let J=a;return(W==null?void 0:W[J])===(K==null?void 0:K[J])}:a),E=h.useCallback(W=>Le(_.mode,{1:()=>m.some(K=>j(K,W)),0:()=>j(m,W)}),[m]),_=h.useMemo(()=>({...v,value:m,disabled:l,mode:d?1:0,orientation:p,compare:j,isSelected:E,optionsPropsRef:y,labelRef:w,buttonRef:S,optionsRef:C}),[m,l,d,v]);ze(()=>{v.dataRef.current=_},[_]),ip([_.buttonRef,_.optionsRef],(W,K)=>{var J;x({type:1}),op(K,Hc.Loose)||(W.preventDefault(),(J=_.buttonRef.current)==null||J.focus())},_.listboxState===0);let T=h.useMemo(()=>({open:_.listboxState===0,disabled:l,value:m}),[_,l,m]),P=ae(W=>{let K=_.options.find(J=>J.id===W);K&&q(K.dataRef.current.value)}),A=ae(()=>{if(_.activeOptionIndex!==null){let{dataRef:W,id:K}=_.options[_.activeOptionIndex];q(W.current.value),x({type:2,focus:Ge.Specific,id:K})}}),M=ae(()=>x({type:0})),R=ae(()=>x({type:1})),F=ae((W,K,J)=>W===Ge.Specific?x({type:2,focus:Ge.Specific,id:K,trigger:J}):x({type:2,focus:W,trigger:J})),L=ae((W,K)=>(x({type:5,id:W,dataRef:K}),()=>x({type:6,id:W}))),B=ae(W=>(x({type:7,id:W}),()=>x({type:7,id:null}))),q=ae(W=>Le(_.mode,{0(){return b==null?void 0:b(W)},1(){let K=_.value.slice(),J=K.findIndex(Y=>j(Y,W));return J===-1?K.push(W):K.splice(J,1),b==null?void 0:b(K)}})),H=ae(W=>x({type:3,value:W})),$=ae(()=>x({type:4})),I=h.useMemo(()=>({onChange:q,registerOption:L,registerLabel:B,goToOption:F,closeListbox:R,openListbox:M,selectActiveOption:A,selectOption:P,search:H,clearSearch:$}),[]),O={ref:g},V=h.useRef(null),G=as();return h.useEffect(()=>{V.current&&s!==void 0&&G.addEventListener(V.current,"reset",()=>{b==null||b(s)})},[V,b]),h.createElement(bp.Provider,{value:I},h.createElement(vp.Provider,{value:_},h.createElement(Da,{value:Le(_.listboxState,{0:dt.Open,1:dt.Closed})},o!=null&&m!=null&&Fc({[o]:m}).map(([W,K],J)=>h.createElement(cs,{features:ls.Hidden,ref:J===0?Y=>{var U;V.current=(U=Y==null?void 0:Y.closest("form"))!=null?U:null}:void 0,...di({key:W,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:l,name:W,value:K})})),De({ourProps:O,theirProps:f,slot:T,defaultTag:__,name:"Listbox"}))))}let O_="button";function A_(e,t){var n;let s=xt(),{id:r=`headlessui-listbox-button-${s}`,...o}=e,i=Ba("Listbox.Button"),a=Fa("Listbox.Button"),l=Ue(i.buttonRef,t),u=as(),d=ae(v=>{switch(v.key){case ve.Space:case ve.Enter:case ve.ArrowDown:v.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(Ge.First)});break;case ve.ArrowUp:v.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(Ge.Last)});break}}),f=ae(v=>{switch(v.key){case ve.Space:v.preventDefault();break}}),p=ae(v=>{if(kr(v.currentTarget))return v.preventDefault();i.listboxState===0?(a.closeListbox(),u.nextFrame(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})})):(v.preventDefault(),a.openListbox())}),g=Ia(()=>{if(i.labelId)return[i.labelId,r].join(" ")},[i.labelId,r]),m=h.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled,value:i.value}),[i]),b={ref:l,id:r,type:Ci(e,i.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=i.optionsRef.current)==null?void 0:n.id,"aria-expanded":i.listboxState===0,"aria-labelledby":g,disabled:i.disabled,onKeyDown:d,onKeyUp:f,onClick:p};return De({ourProps:b,theirProps:o,slot:m,defaultTag:O_,name:"Listbox.Button"})}let N_="label";function M_(e,t){let n=xt(),{id:s=`headlessui-listbox-label-${n}`,...r}=e,o=Ba("Listbox.Label"),i=Fa("Listbox.Label"),a=Ue(o.labelRef,t);ze(()=>i.registerLabel(s),[s]);let l=ae(()=>{var d;return(d=o.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]);return De({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:N_,name:"Listbox.Label"})}let L_="ul",R_=gn.RenderStrategy|gn.Static;function $_(e,t){var n;let s=xt(),{id:r=`headlessui-listbox-options-${s}`,...o}=e,i=Ba("Listbox.Options"),a=Fa("Listbox.Options"),l=Ue(i.optionsRef,t),u=as(),d=as(),f=Lo(),p=f!==null?(f&dt.Open)===dt.Open:i.listboxState===0;h.useEffect(()=>{var x;let y=i.optionsRef.current;y&&i.listboxState===0&&y!==((x=Ur(y))==null?void 0:x.activeElement)&&y.focus({preventScroll:!0})},[i.listboxState,i.optionsRef]);let g=ae(x=>{switch(d.dispose(),x.key){case ve.Space:if(i.searchQuery!=="")return x.preventDefault(),x.stopPropagation(),a.search(x.key);case ve.Enter:if(x.preventDefault(),x.stopPropagation(),i.activeOptionIndex!==null){let{dataRef:y}=i.options[i.activeOptionIndex];a.onChange(y.current.value)}i.mode===0&&(a.closeListbox(),$s().nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case Le(i.orientation,{vertical:ve.ArrowDown,horizontal:ve.ArrowRight}):return x.preventDefault(),x.stopPropagation(),a.goToOption(Ge.Next);case Le(i.orientation,{vertical:ve.ArrowUp,horizontal:ve.ArrowLeft}):return x.preventDefault(),x.stopPropagation(),a.goToOption(Ge.Previous);case ve.Home:case ve.PageUp:return x.preventDefault(),x.stopPropagation(),a.goToOption(Ge.First);case ve.End:case ve.PageDown:return x.preventDefault(),x.stopPropagation(),a.goToOption(Ge.Last);case ve.Escape:return x.preventDefault(),x.stopPropagation(),a.closeListbox(),u.nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case ve.Tab:x.preventDefault(),x.stopPropagation();break;default:x.key.length===1&&(a.search(x.key),d.setTimeout(()=>a.clearSearch(),350));break}}),m=Ia(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.id},[i.buttonRef.current]),b=h.useMemo(()=>({open:i.listboxState===0}),[i]),v={"aria-activedescendant":i.activeOptionIndex===null||(n=i.options[i.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":i.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":i.orientation,id:r,onKeyDown:g,role:"listbox",tabIndex:0,ref:l};return De({ourProps:v,theirProps:o,slot:b,defaultTag:L_,features:R_,visible:p,name:"Listbox.Options"})}let k_="li";function V_(e,t){let n=xt(),{id:s=`headlessui-listbox-option-${n}`,disabled:r=!1,value:o,...i}=e,a=Ba("Listbox.Option"),l=Fa("Listbox.Option"),u=a.activeOptionIndex!==null?a.options[a.activeOptionIndex].id===s:!1,d=a.isSelected(o),f=h.useRef(null),p=x_(f),g=Mt({disabled:r,value:o,domRef:f,get textValue(){return p()}}),m=Ue(t,f);ze(()=>{if(a.listboxState!==0||!u||a.activationTrigger===0)return;let j=$s();return j.requestAnimationFrame(()=>{var E,_;(_=(E=f.current)==null?void 0:E.scrollIntoView)==null||_.call(E,{block:"nearest"})}),j.dispose},[f,u,a.listboxState,a.activationTrigger,a.activeOptionIndex]),ze(()=>l.registerOption(s,g),[g,s]);let b=ae(j=>{if(r)return j.preventDefault();l.onChange(o),a.mode===0&&(l.closeListbox(),$s().nextFrame(()=>{var E;return(E=a.buttonRef.current)==null?void 0:E.focus({preventScroll:!0})}))}),v=ae(()=>{if(r)return l.goToOption(Ge.Nothing);l.goToOption(Ge.Specific,s)}),x=Sv(),y=ae(j=>x.update(j)),w=ae(j=>{x.wasMoved(j)&&(r||u||l.goToOption(Ge.Specific,s,0))}),S=ae(j=>{x.wasMoved(j)&&(r||u&&l.goToOption(Ge.Nothing))}),C=h.useMemo(()=>({active:u,selected:d,disabled:r}),[u,d,r]);return De({ourProps:{id:s,ref:m,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:b,onFocus:v,onPointerEnter:y,onMouseEnter:y,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:C,defaultTag:k_,name:"Listbox.Option"})}let I_=He(T_),D_=He(A_),H_=He(M_),F_=He($_),B_=He(V_),Ri=Object.assign(I_,{Button:D_,Label:H_,Options:F_,Option:B_});var z_=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(z_||{}),U_=(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))(U_||{});let W_={0:e=>{let t={...e,popoverState:Le(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}}},yp=h.createContext(null);yp.displayName="PopoverContext";function zc(e){let t=h.useContext(yp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,zc),n}return t}let xp=h.createContext(null);xp.displayName="PopoverAPIContext";function wp(e){let t=h.useContext(xp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,wp),n}return t}let Sp=h.createContext(null);Sp.displayName="PopoverGroupContext";function $v(){return h.useContext(Sp)}let Uc=h.createContext(null);Uc.displayName="PopoverPanelContext";function G_(){return h.useContext(Uc)}function q_(e,t){return Le(t.type,W_,e,t)}let K_="div";function Y_(e,t){var n;let{__demoMode:s=!1,...r}=e,o=h.useRef(null),i=Ue(t,ap(B=>{o.current=B})),a=h.useRef([]),l=h.useReducer(q_,{__demoMode:s,popoverState:s?0:1,buttons:a,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:h.createRef(),afterPanelSentinel:h.createRef()}),[{popoverState:u,button:d,buttonId:f,panel:p,panelId:g,beforePanelSentinel:m,afterPanelSentinel:b},v]=l,x=Mo((n=o.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!p)return!1;for(let V of document.querySelectorAll("body > *"))if(Number(V==null?void 0:V.contains(d))^Number(V==null?void 0:V.contains(p)))return!0;let B=Dc(),q=B.indexOf(d),H=(q+B.length-1)%B.length,$=(q+1)%B.length,I=B[H],O=B[$];return!p.contains(I)&&!p.contains(O)},[d,p]),w=Mt(f),S=Mt(g),C=h.useMemo(()=>({buttonId:w,panelId:S,close:()=>v({type:1})}),[w,S,v]),j=$v(),E=j==null?void 0:j.registerPopover,_=ae(()=>{var B;return(B=j==null?void 0:j.isFocusWithinPopoverGroup())!=null?B:(x==null?void 0:x.activeElement)&&((d==null?void 0:d.contains(x.activeElement))||(p==null?void 0:p.contains(x.activeElement)))});h.useEffect(()=>E==null?void 0:E(C),[E,C]);let[T,P]=YP(),A=JP({mainTreeNodeRef:j==null?void 0:j.mainTreeNodeRef,portals:T,defaultContainers:[d,p]});HP(x==null?void 0:x.defaultView,"focus",B=>{var q,H,$,I;B.target!==window&&B.target instanceof HTMLElement&&u===0&&(_()||d&&p&&(A.contains(B.target)||(H=(q=m.current)==null?void 0:q.contains)!=null&&H.call(q,B.target)||(I=($=b.current)==null?void 0:$.contains)!=null&&I.call($,B.target)||v({type:1})))},!0),ip(A.resolveContainers,(B,q)=>{v({type:1}),op(q,Hc.Loose)||(B.preventDefault(),d==null||d.focus())},u===0);let M=ae(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()}),R=h.useMemo(()=>({close:M,isPortalled:y}),[M,y]),F=h.useMemo(()=>({open:u===0,close:M}),[u,M]),L={ref:i};return h.createElement(Uc.Provider,{value:null},h.createElement(yp.Provider,{value:l},h.createElement(xp.Provider,{value:R},h.createElement(Da,{value:Le(u,{0:dt.Open,1:dt.Closed})},h.createElement(P,null,De({ourProps:L,theirProps:r,slot:F,defaultTag:K_,name:"Popover"}),h.createElement(A.MainTreeNode,null))))))}let Z_="button";function X_(e,t){let n=xt(),{id:s=`headlessui-popover-button-${n}`,...r}=e,[o,i]=zc("Popover.Button"),{isPortalled:a}=wp("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${xt()}`,d=$v(),f=d==null?void 0:d.closeOthers,p=G_()!==null;h.useEffect(()=>{if(!p)return i({type:3,buttonId:s}),()=>{i({type:3,buttonId:null})}},[p,s,i]);let[g]=h.useState(()=>Symbol()),m=Ue(l,t,p?null:A=>{if(A)o.buttons.current.push(g);else{let M=o.buttons.current.indexOf(g);M!==-1&&o.buttons.current.splice(M,1)}o.buttons.current.length>1&&console.warn("You are already using a <Popover.Button /> but only 1 <Popover.Button /> is supported."),A&&i({type:2,button:A})}),b=Ue(l,t),v=Mo(l),x=ae(A=>{var M,R,F;if(p){if(o.popoverState===1)return;switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),(R=(M=A.target).click)==null||R.call(M),i({type:1}),(F=o.button)==null||F.focus();break}}else switch(A.key){case ve.Space:case ve.Enter:A.preventDefault(),A.stopPropagation(),o.popoverState===1&&(f==null||f(o.buttonId)),i({type:0});break;case ve.Escape:if(o.popoverState!==0)return f==null?void 0:f(o.buttonId);if(!l.current||v!=null&&v.activeElement&&!l.current.contains(v.activeElement))return;A.preventDefault(),A.stopPropagation(),i({type:1});break}}),y=ae(A=>{p||A.key===ve.Space&&A.preventDefault()}),w=ae(A=>{var M,R;kr(A.currentTarget)||e.disabled||(p?(i({type:1}),(M=o.button)==null||M.focus()):(A.preventDefault(),A.stopPropagation(),o.popoverState===1&&(f==null||f(o.buttonId)),i({type:0}),(R=o.button)==null||R.focus()))}),S=ae(A=>{A.preventDefault(),A.stopPropagation()}),C=o.popoverState===0,j=h.useMemo(()=>({open:C}),[C]),E=Ci(e,l),_=p?{ref:b,type:E,onKeyDown:x,onClick:w}:{ref:m,id:o.buttonId,type:E,"aria-expanded":o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:x,onKeyUp:y,onClick:w,onMouseDown:S},T=Ov(),P=ae(()=>{let A=o.panel;if(!A)return;function M(){Le(T.current,{[Qs.Forwards]:()=>tn(A,Ct.First),[Qs.Backwards]:()=>tn(A,Ct.Last)})===As.Error&&tn(Dc().filter(R=>R.dataset.headlessuiFocusGuard!=="true"),Le(T.current,{[Qs.Forwards]:Ct.Next,[Qs.Backwards]:Ct.Previous}),{relativeTo:o.button})}M()});return h.createElement(h.Fragment,null,De({ourProps:_,theirProps:r,slot:j,defaultTag:Z_,name:"Popover.Button"}),C&&!p&&a&&h.createElement(cs,{id:u,features:ls.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:P}))}let J_="div",Q_=gn.RenderStrategy|gn.Static;function eT(e,t){let n=xt(),{id:s=`headlessui-popover-overlay-${n}`,...r}=e,[{popoverState:o},i]=zc("Popover.Overlay"),a=Ue(t),l=Lo(),u=l!==null?(l&dt.Open)===dt.Open:o===0,d=ae(p=>{if(kr(p.currentTarget))return p.preventDefault();i({type:1})}),f=h.useMemo(()=>({open:o===0}),[o]);return De({ourProps:{ref:a,id:s,"aria-hidden":!0,onClick:d},theirProps:r,slot:f,defaultTag:J_,features:Q_,visible:u,name:"Popover.Overlay"})}let tT="div",nT=gn.RenderStrategy|gn.Static;function sT(e,t){let n=xt(),{id:s=`headlessui-popover-panel-${n}`,focus:r=!1,...o}=e,[i,a]=zc("Popover.Panel"),{close:l,isPortalled:u}=wp("Popover.Panel"),d=`headlessui-focus-sentinel-before-${xt()}`,f=`headlessui-focus-sentinel-after-${xt()}`,p=h.useRef(null),g=Ue(p,t,_=>{a({type:4,panel:_})}),m=Mo(p),b=lp();ze(()=>(a({type:5,panelId:s}),()=>{a({type:5,panelId:null})}),[s,a]);let v=Lo(),x=v!==null?(v&dt.Open)===dt.Open:i.popoverState===0,y=ae(_=>{var T;switch(_.key){case ve.Escape:if(i.popoverState!==0||!p.current||m!=null&&m.activeElement&&!p.current.contains(m.activeElement))return;_.preventDefault(),_.stopPropagation(),a({type:1}),(T=i.button)==null||T.focus();break}});h.useEffect(()=>{var _;e.static||i.popoverState===1&&((_=e.unmount)==null||_)&&a({type:4,panel:null})},[i.popoverState,e.unmount,e.static,a]),h.useEffect(()=>{if(i.__demoMode||!r||i.popoverState!==0||!p.current)return;let _=m==null?void 0:m.activeElement;p.current.contains(_)||tn(p.current,Ct.First)},[i.__demoMode,r,p,i.popoverState]);let w=h.useMemo(()=>({open:i.popoverState===0,close:l}),[i,l]),S={ref:g,id:s,onKeyDown:y,onBlur:r&&i.popoverState===0?_=>{var T,P,A,M,R;let F=_.relatedTarget;F&&p.current&&((T=p.current)!=null&&T.contains(F)||(a({type:1}),((A=(P=i.beforePanelSentinel.current)==null?void 0:P.contains)!=null&&A.call(P,F)||(R=(M=i.afterPanelSentinel.current)==null?void 0:M.contains)!=null&&R.call(M,F))&&F.focus({preventScroll:!0})))}:void 0,tabIndex:-1},C=Ov(),j=ae(()=>{let _=p.current;if(!_)return;function T(){Le(C.current,{[Qs.Forwards]:()=>{var P;tn(_,Ct.First)===As.Error&&((P=i.afterPanelSentinel.current)==null||P.focus())},[Qs.Backwards]:()=>{var P;(P=i.button)==null||P.focus({preventScroll:!0})}})}T()}),E=ae(()=>{let _=p.current;if(!_)return;function T(){Le(C.current,{[Qs.Forwards]:()=>{var P;if(!i.button)return;let A=Dc(),M=A.indexOf(i.button),R=A.slice(0,M+1),F=[...A.slice(M+1),...R];for(let L of F.slice())if(L.dataset.headlessuiFocusGuard==="true"||(P=i.panel)!=null&&P.contains(L)){let B=F.indexOf(L);B!==-1&&F.splice(B,1)}tn(F,Ct.First,{sorted:!1})},[Qs.Backwards]:()=>{var P;tn(_,Ct.Previous)===As.Error&&((P=i.button)==null||P.focus())}})}T()});return h.createElement(Uc.Provider,{value:s},x&&u&&h.createElement(cs,{id:d,ref:i.beforePanelSentinel,features:ls.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:j}),De({mergeRefs:b,ourProps:S,theirProps:o,slot:w,defaultTag:tT,features:nT,visible:x,name:"Popover.Panel"}),x&&u&&h.createElement(cs,{id:f,ref:i.afterPanelSentinel,features:ls.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}))}let rT="div";function oT(e,t){let n=h.useRef(null),s=Ue(n,t),[r,o]=h.useState([]),i=QP(),a=ae(b=>{o(v=>{let x=v.indexOf(b);if(x!==-1){let y=v.slice();return y.splice(x,1),y}return v})}),l=ae(b=>(o(v=>[...v,b]),()=>a(b))),u=ae(()=>{var b;let v=Ur(n);if(!v)return!1;let x=v.activeElement;return(b=n.current)!=null&&b.contains(x)?!0:r.some(y=>{var w,S;return((w=v.getElementById(y.buttonId.current))==null?void 0:w.contains(x))||((S=v.getElementById(y.panelId.current))==null?void 0:S.contains(x))})}),d=ae(b=>{for(let v of r)v.buttonId.current!==b&&v.close()}),f=h.useMemo(()=>({registerPopover:l,unregisterPopover:a,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:i.mainTreeNodeRef}),[l,a,u,d,i.mainTreeNodeRef]),p=h.useMemo(()=>({}),[]),g=e,m={ref:s};return h.createElement(Sp.Provider,{value:f},De({ourProps:m,theirProps:g,slot:p,defaultTag:rT,name:"Popover.Group"}),h.createElement(i.MainTreeNode,null))}let iT=He(Y_),aT=He(X_),lT=He(eT),cT=He(sT),uT=He(oT),qu=Object.assign(iT,{Button:aT,Overlay:lT,Panel:cT,Group:uT}),kv=h.createContext(null);function Vv(){let e=h.useContext(kv);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,Vv),t}return e}function Cp(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let s=ae(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=h.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return h.createElement(kv.Provider,{value:r},n.children)},[t])]}let dT="label";function fT(e,t){let n=xt(),{id:s=`headlessui-label-${n}`,passive:r=!1,...o}=e,i=Vv(),a=Ue(t);ze(()=>i.register(s),[s,i.register]);let l={ref:a,...i.props,id:s};return r&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in o&&delete o.onClick),De({ourProps:l,theirProps:o,slot:i.slot||{},defaultTag:dT,name:i.name||"Label"})}let pT=He(fT),Iv=Object.assign(pT,{});function Dv(e=0){let[t,n]=h.useState(e),s=Bc(),r=h.useCallback(l=>{s.current&&n(u=>u|l)},[t,s]),o=h.useCallback(l=>!!(t&l),[t]),i=h.useCallback(l=>{s.current&&n(u=>u&~l)},[n,s]),a=h.useCallback(l=>{s.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:r,hasFlag:o,removeFlag:i,toggleFlag:a}}var hT=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(hT||{});let gT={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:Js(n,s=>s.element.current)}},1(e,t){let n=e.options.slice(),s=e.options.findIndex(r=>r.id===t.id);return s===-1?e:(n.splice(s,1),{...e,options:n})}},jp=h.createContext(null);jp.displayName="RadioGroupDataContext";function Hv(e){let t=h.useContext(jp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Hv),n}return t}let Ep=h.createContext(null);Ep.displayName="RadioGroupActionsContext";function Fv(e){let t=h.useContext(Ep);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Fv),n}return t}function mT(e,t){return Le(t.type,gT,e,t)}let bT="div";function vT(e,t){let n=xt(),{id:s=`headlessui-radiogroup-${n}`,value:r,defaultValue:o,form:i,name:a,onChange:l,by:u=($,I)=>$===I,disabled:d=!1,...f}=e,p=ae(typeof u=="string"?($,I)=>{let O=u;return($==null?void 0:$[O])===(I==null?void 0:I[O])}:u),[g,m]=h.useReducer(mT,{options:[]}),b=g.options,[v,x]=Cp(),[y,w]=fp(),S=h.useRef(null),C=Ue(S,t),[j,E]=Vc(r,l,o),_=h.useMemo(()=>b.find($=>!$.propsRef.current.disabled),[b]),T=h.useMemo(()=>b.some($=>p($.propsRef.current.value,j)),[b,j]),P=ae($=>{var I;if(d||p($,j))return!1;let O=(I=b.find(V=>p(V.propsRef.current.value,$)))==null?void 0:I.propsRef.current;return O!=null&&O.disabled?!1:(E==null||E($),!0)});Cv({container:S.current,accept($){return $.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:$.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk($){$.setAttribute("role","none")}});let A=ae($=>{let I=S.current;if(!I)return;let O=Ur(I),V=b.filter(G=>G.propsRef.current.disabled===!1).map(G=>G.element.current);switch($.key){case ve.Enter:_v($.currentTarget);break;case ve.ArrowLeft:case ve.ArrowUp:if($.preventDefault(),$.stopPropagation(),tn(V,Ct.Previous|Ct.WrapAround)===As.Success){let G=b.find(W=>W.element.current===(O==null?void 0:O.activeElement));G&&P(G.propsRef.current.value)}break;case ve.ArrowRight:case ve.ArrowDown:if($.preventDefault(),$.stopPropagation(),tn(V,Ct.Next|Ct.WrapAround)===As.Success){let G=b.find(W=>W.element.current===(O==null?void 0:O.activeElement));G&&P(G.propsRef.current.value)}break;case ve.Space:{$.preventDefault(),$.stopPropagation();let G=b.find(W=>W.element.current===(O==null?void 0:O.activeElement));G&&P(G.propsRef.current.value)}break}}),M=ae($=>(m({type:0,...$}),()=>m({type:1,id:$.id}))),R=h.useMemo(()=>({value:j,firstOption:_,containsCheckedOption:T,disabled:d,compare:p,...g}),[j,_,T,d,p,g]),F=h.useMemo(()=>({registerOption:M,change:P}),[M,P]),L={ref:C,id:s,role:"radiogroup","aria-labelledby":v,"aria-describedby":y,onKeyDown:A},B=h.useMemo(()=>({value:j}),[j]),q=h.useRef(null),H=as();return h.useEffect(()=>{q.current&&o!==void 0&&H.addEventListener(q.current,"reset",()=>{P(o)})},[q,P]),h.createElement(w,{name:"RadioGroup.Description"},h.createElement(x,{name:"RadioGroup.Label"},h.createElement(Ep.Provider,{value:F},h.createElement(jp.Provider,{value:R},a!=null&&j!=null&&Fc({[a]:j}).map(([$,I],O)=>h.createElement(cs,{features:ls.Hidden,ref:O===0?V=>{var G;q.current=(G=V==null?void 0:V.closest("form"))!=null?G:null}:void 0,...di({key:$,as:"input",type:"radio",checked:I!=null,hidden:!0,readOnly:!0,form:i,disabled:d,name:$,value:I})})),De({ourProps:L,theirProps:f,slot:B,defaultTag:bT,name:"RadioGroup"})))))}var yT=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(yT||{});let xT="div";function wT(e,t){var n;let s=xt(),{id:r=`headlessui-radiogroup-option-${s}`,value:o,disabled:i=!1,...a}=e,l=h.useRef(null),u=Ue(l,t),[d,f]=Cp(),[p,g]=fp(),{addFlag:m,removeFlag:b,hasFlag:v}=Dv(1),x=Mt({value:o,disabled:i}),y=Hv("RadioGroup.Option"),w=Fv("RadioGroup.Option");ze(()=>w.registerOption({id:r,element:l,propsRef:x}),[r,w,l,x]);let S=ae(M=>{var R;if(kr(M.currentTarget))return M.preventDefault();w.change(o)&&(m(2),(R=l.current)==null||R.focus())}),C=ae(M=>{if(kr(M.currentTarget))return M.preventDefault();m(2)}),j=ae(()=>b(2)),E=((n=y.firstOption)==null?void 0:n.id)===r,_=y.disabled||i,T=y.compare(y.value,o),P={ref:u,id:r,role:"radio","aria-checked":T?"true":"false","aria-labelledby":d,"aria-describedby":p,"aria-disabled":_?!0:void 0,tabIndex:_?-1:T||!y.containsCheckedOption&&E?0:-1,onClick:_?void 0:S,onFocus:_?void 0:C,onBlur:_?void 0:j},A=h.useMemo(()=>({checked:T,disabled:_,active:v(2)}),[T,_,v]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(f,{name:"RadioGroup.Label"},De({ourProps:P,theirProps:a,slot:A,defaultTag:xT,name:"RadioGroup.Option"})))}let ST=He(vT),CT=He(wT),wg=Object.assign(ST,{Option:CT,Label:Iv,Description:Lv}),Pp=h.createContext(null);Pp.displayName="GroupContext";let jT=h.Fragment;function ET(e){var t;let[n,s]=h.useState(null),[r,o]=Cp(),[i,a]=fp(),l=h.useMemo(()=>({switch:n,setSwitch:s,labelledby:r,describedby:i}),[n,s,r,i]),u={},d=e;return h.createElement(a,{name:"Switch.Description"},h.createElement(o,{name:"Switch.Label",props:{htmlFor:(t=l.switch)==null?void 0:t.id,onClick(f){n&&(f.currentTarget.tagName==="LABEL"&&f.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},h.createElement(Pp.Provider,{value:l},De({ourProps:u,theirProps:d,defaultTag:jT,name:"Switch.Group"}))))}let PT="button";function _T(e,t){var n;let s=xt(),{id:r=`headlessui-switch-${s}`,checked:o,defaultChecked:i=!1,onChange:a,disabled:l=!1,name:u,value:d,form:f,...p}=e,g=h.useContext(Pp),m=h.useRef(null),b=Ue(m,t,g===null?null:g.setSwitch),[v,x]=Vc(o,a,i),y=ae(()=>x==null?void 0:x(!v)),w=ae(T=>{if(kr(T.currentTarget))return T.preventDefault();T.preventDefault(),y()}),S=ae(T=>{T.key===ve.Space?(T.preventDefault(),y()):T.key===ve.Enter&&_v(T.currentTarget)}),C=ae(T=>T.preventDefault()),j=h.useMemo(()=>({checked:v}),[v]),E={id:r,ref:b,role:"switch",type:Ci(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:l,onClick:w,onKeyUp:S,onKeyPress:C},_=as();return h.useEffect(()=>{var T;let P=(T=m.current)==null?void 0:T.closest("form");P&&i!==void 0&&_.addEventListener(P,"reset",()=>{x(i)})},[m,x]),h.createElement(h.Fragment,null,u!=null&&v&&h.createElement(cs,{features:ls.Hidden,...di({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:f,checked:v,name:u,value:d})}),De({ourProps:E,theirProps:p,slot:j,defaultTag:PT,name:"Switch"}))}let TT=He(_T),OT=ET,Ku=Object.assign(TT,{Group:OT,Label:Iv,Description:Lv});function AT({onFocus:e}){let[t,n]=h.useState(!0),s=Bc();return t?h.createElement(cs,{as:"button",type:"button",features:ls.Focusable,onFocus:r=>{r.preventDefault();let o,i=50;function a(){if(i--<=0){o&&cancelAnimationFrame(o);return}if(e()){if(cancelAnimationFrame(o),!s.current)return;n(!1);return}o=requestAnimationFrame(a)}o=requestAnimationFrame(a)}}):null}const Bv=et.createContext(null);function NT(){return{groups:new Map,get(e,t){var n;let s=this.groups.get(e);s||(s=new Map,this.groups.set(e,s));let r=(n=s.get(t))!=null?n:0;s.set(t,r+1);let o=Array.from(s.keys()).indexOf(t);function i(){let a=s.get(t);a>1?s.set(t,a-1):s.delete(t)}return[o,i]}}}function MT({children:e}){let t=et.useRef(NT());return et.createElement(Bv.Provider,{value:t},e)}function zv(e){let t=et.useContext(Bv);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=LT(),[s,r]=t.current.get(e,n);return et.useEffect(()=>r,[]),s}function LT(){var e,t,n;let s=(n=(t=(e=et.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!s)return Symbol();let r=[],o=s;for(;o;)r.push(o.index),o=o.return;return"$."+r.join(".")}var RT=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(RT||{}),$T=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))($T||{}),kT=(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))(kT||{});let VT={0(e,t){var n;let s=Js(e.tabs,d=>d.current),r=Js(e.panels,d=>d.current),o=s.filter(d=>{var f;return!((f=d.current)!=null&&f.hasAttribute("disabled"))}),i={...e,tabs:s,panels:r};if(t.index<0||t.index>s.length-1){let d=Le(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Le(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(o.length===0)return i;let f=Le(d,{0:()=>s.indexOf(o[0]),1:()=>s.indexOf(o[o.length-1])});return{...i,selectedIndex:f===-1?e.selectedIndex:f}}let a=s.slice(0,t.index),l=[...s.slice(t.index),...a].find(d=>o.includes(d));if(!l)return i;let u=(n=s.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...i,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],s=Js([...e.tabs,t.tab],o=>o.current),r=e.selectedIndex;return e.info.current.isControlled||(r=s.indexOf(n),r===-1&&(r=e.selectedIndex)),{...e,tabs:s,selectedIndex:r}},2(e,t){return{...e,tabs:e.tabs.filter(n=>n!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:Js([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},_p=h.createContext(null);_p.displayName="TabsDataContext";function fi(e){let t=h.useContext(_p);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,fi),n}return t}let Tp=h.createContext(null);Tp.displayName="TabsActionsContext";function Op(e){let t=h.useContext(Tp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Op),n}return t}function IT(e,t){return Le(t.type,VT,e,t)}let DT=h.Fragment;function HT(e,t){let{defaultIndex:n=0,vertical:s=!1,manual:r=!1,onChange:o,selectedIndex:i=null,...a}=e;const l=s?"vertical":"horizontal",u=r?"manual":"auto";let d=i!==null,f=Mt({isControlled:d}),p=Ue(t),[g,m]=h.useReducer(IT,{info:f,selectedIndex:i??n,tabs:[],panels:[]}),b=h.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),v=Mt(o||(()=>{})),x=Mt(g.tabs),y=h.useMemo(()=>({orientation:l,activation:u,...g}),[l,u,g]),w=ae(T=>(m({type:1,tab:T}),()=>m({type:2,tab:T}))),S=ae(T=>(m({type:3,panel:T}),()=>m({type:4,panel:T}))),C=ae(T=>{j.current!==T&&v.current(T),d||m({type:0,index:T})}),j=Mt(d?e.selectedIndex:g.selectedIndex),E=h.useMemo(()=>({registerTab:w,registerPanel:S,change:C}),[]);ze(()=>{m({type:0,index:i??n})},[i]),ze(()=>{if(j.current===void 0||g.tabs.length<=0)return;let T=Js(g.tabs,P=>P.current);T.some((P,A)=>g.tabs[A]!==P)&&C(T.indexOf(g.tabs[j.current]))});let _={ref:p};return h.createElement(MT,null,h.createElement(Tp.Provider,{value:E},h.createElement(_p.Provider,{value:y},y.tabs.length<=0&&h.createElement(AT,{onFocus:()=>{var T,P;for(let A of x.current)if(((T=A.current)==null?void 0:T.tabIndex)===0)return(P=A.current)==null||P.focus(),!0;return!1}}),De({ourProps:_,theirProps:a,slot:b,defaultTag:DT,name:"Tabs"}))))}let FT="div";function BT(e,t){let{orientation:n,selectedIndex:s}=fi("Tab.List"),r=Ue(t);return De({ourProps:{ref:r,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:s},defaultTag:FT,name:"Tabs.List"})}let zT="button";function UT(e,t){var n,s;let r=xt(),{id:o=`headlessui-tabs-tab-${r}`,...i}=e,{orientation:a,activation:l,selectedIndex:u,tabs:d,panels:f}=fi("Tab"),p=Op("Tab"),g=fi("Tab"),m=h.useRef(null),b=Ue(m,t);ze(()=>p.registerTab(m),[p,m]);let v=zv("tabs"),x=d.indexOf(m);x===-1&&(x=v);let y=x===u,w=ae(P=>{var A;let M=P();if(M===As.Success&&l==="auto"){let R=(A=Ur(m))==null?void 0:A.activeElement,F=g.tabs.findIndex(L=>L.current===R);F!==-1&&p.change(F)}return M}),S=ae(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(x);return}switch(P.key){case ve.Home:case ve.PageUp:return P.preventDefault(),P.stopPropagation(),w(()=>tn(A,Ct.First));case ve.End:case ve.PageDown:return P.preventDefault(),P.stopPropagation(),w(()=>tn(A,Ct.Last))}if(w(()=>Le(a,{vertical(){return P.key===ve.ArrowUp?tn(A,Ct.Previous|Ct.WrapAround):P.key===ve.ArrowDown?tn(A,Ct.Next|Ct.WrapAround):As.Error},horizontal(){return P.key===ve.ArrowLeft?tn(A,Ct.Previous|Ct.WrapAround):P.key===ve.ArrowRight?tn(A,Ct.Next|Ct.WrapAround):As.Error}}))===As.Success)return P.preventDefault()}),C=h.useRef(!1),j=ae(()=>{var P;C.current||(C.current=!0,(P=m.current)==null||P.focus({preventScroll:!0}),p.change(x),rp(()=>{C.current=!1}))}),E=ae(P=>{P.preventDefault()}),_=h.useMemo(()=>{var P;return{selected:y,disabled:(P=e.disabled)!=null?P:!1}},[y,e.disabled]),T={ref:b,onKeyDown:S,onMouseDown:E,onClick:j,id:o,role:"tab",type:Ci(e,m),"aria-controls":(s=(n=f[x])==null?void 0:n.current)==null?void 0:s.id,"aria-selected":y,tabIndex:y?0:-1};return De({ourProps:T,theirProps:i,slot:_,defaultTag:zT,name:"Tabs.Tab"})}let WT="div";function GT(e,t){let{selectedIndex:n}=fi("Tab.Panels"),s=Ue(t),r=h.useMemo(()=>({selectedIndex:n}),[n]);return De({ourProps:{ref:s},theirProps:e,slot:r,defaultTag:WT,name:"Tabs.Panels"})}let qT="div",KT=gn.RenderStrategy|gn.Static;function YT(e,t){var n,s,r,o;let i=xt(),{id:a=`headlessui-tabs-panel-${i}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:f,panels:p}=fi("Tab.Panel"),g=Op("Tab.Panel"),m=h.useRef(null),b=Ue(m,t);ze(()=>g.registerPanel(m),[g,m,a]);let v=zv("panels"),x=p.indexOf(m);x===-1&&(x=v);let y=x===d,w=h.useMemo(()=>({selected:y}),[y]),S={ref:b,id:a,role:"tabpanel","aria-labelledby":(s=(n=f[x])==null?void 0:n.current)==null?void 0:s.id,tabIndex:y?l:-1};return!y&&((r=u.unmount)==null||r)&&!((o=u.static)!=null&&o)?h.createElement(cs,{as:"span","aria-hidden":"true",...S}):De({ourProps:S,theirProps:u,slot:w,defaultTag:qT,features:KT,visible:y,name:"Tabs.Panel"})}let ZT=He(UT),XT=He(HT),JT=He(BT),QT=He(GT),e5=He(YT),$i=Object.assign(ZT,{Group:XT,List:JT,Panels:QT,Panel:e5});function t5(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function Yu(e,...t){e&&t.length>0&&e.classList.add(...t)}function Zu(e,...t){e&&t.length>0&&e.classList.remove(...t)}function n5(e,t){let n=$s();if(!e)return n.dispose;let{transitionDuration:s,transitionDelay:r}=getComputedStyle(e),[o,i]=[s,r].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,f)=>f-d);return u}),a=o+i;if(a!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},a),u.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&u.dispose()})});let l=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function s5(e,t,n,s){let r=n?"enter":"leave",o=$s(),i=s!==void 0?t5(s):()=>{};r==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=Le(r,{enter:()=>t.enter,leave:()=>t.leave}),l=Le(r,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=Le(r,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return Zu(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),Yu(e,...t.base,...a,...u),o.nextFrame(()=>{Zu(e,...t.base,...a,...u),Yu(e,...t.base,...a,...l),n5(e,()=>(Zu(e,...t.base,...a),Yu(e,...t.base,...t.entered),i()))}),o.dispose}function r5({immediate:e,container:t,direction:n,classes:s,onStart:r,onStop:o}){let i=Bc(),a=as(),l=Mt(n);ze(()=>{e&&(l.current="enter")},[e]),ze(()=>{let u=$s();a.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&i.current)return u.dispose(),r.current(l.current),u.add(s5(d,s.current,l.current==="enter",()=>{u.dispose(),o.current(l.current)})),u.dispose},[n])}function mr(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let Wc=h.createContext(null);Wc.displayName="TransitionContext";var o5=(e=>(e.Visible="visible",e.Hidden="hidden",e))(o5||{});function i5(){let e=h.useContext(Wc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function a5(){let e=h.useContext(Gc);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let Gc=h.createContext(null);Gc.displayName="NestingContext";function qc(e){return"children"in e?qc(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function Uv(e,t){let n=Mt(e),s=h.useRef([]),r=Bc(),o=as(),i=ae((g,m=_r.Hidden)=>{let b=s.current.findIndex(({el:v})=>v===g);b!==-1&&(Le(m,{[_r.Unmount](){s.current.splice(b,1)},[_r.Hidden](){s.current[b].state="hidden"}}),o.microTask(()=>{var v;!qc(s)&&r.current&&((v=n.current)==null||v.call(n))}))}),a=ae(g=>{let m=s.current.find(({el:b})=>b===g);return m?m.state!=="visible"&&(m.state="visible"):s.current.push({el:g,state:"visible"}),()=>i(g,_r.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),f=ae((g,m,b)=>{l.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=>{l.current.push(v)})]),t==null||t.chains.current[m].push([g,new Promise(v=>{Promise.all(d.current[m].map(([x,y])=>y)).then(()=>v())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>b(m)):b(m)}),p=ae((g,m,b)=>{Promise.all(d.current[m].splice(0).map(([v,x])=>x)).then(()=>{var v;(v=l.current.shift())==null||v()}).then(()=>b(m))});return h.useMemo(()=>({children:s,register:a,unregister:i,onStart:f,onStop:p,wait:u,chains:d}),[a,i,s,f,p,d,u])}function l5(){}let c5=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function Sg(e){var t;let n={};for(let s of c5)n[s]=(t=e[s])!=null?t:l5;return n}function u5(e){let t=h.useRef(Sg(e));return h.useEffect(()=>{t.current=Sg(e)},[e]),t}let d5="div",Wv=gn.RenderStrategy;function f5(e,t){var n,s;let{beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a,enter:l,enterFrom:u,enterTo:d,entered:f,leave:p,leaveFrom:g,leaveTo:m,...b}=e,v=h.useRef(null),x=Ue(v,t),y=(n=b.unmount)==null||n?_r.Unmount:_r.Hidden,{show:w,appear:S,initial:C}=i5(),[j,E]=h.useState(w?"visible":"hidden"),_=a5(),{register:T,unregister:P}=_;h.useEffect(()=>T(v),[T,v]),h.useEffect(()=>{if(y===_r.Hidden&&v.current){if(w&&j!=="visible"){E("visible");return}return Le(j,{hidden:()=>P(v),visible:()=>T(v)})}},[j,v,T,P,w,y]);let A=Mt({base:mr(b.className),enter:mr(l),enterFrom:mr(u),enterTo:mr(d),entered:mr(f),leave:mr(p),leaveFrom:mr(g),leaveTo:mr(m)}),M=u5({beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a}),R=Ic();h.useEffect(()=>{if(R&&j==="visible"&&v.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[v,j,R]);let F=C&&!S,L=S&&w&&C,B=!R||F?"idle":w?"enter":"leave",q=Dv(0),H=ae(W=>Le(W,{enter:()=>{q.addFlag(dt.Opening),M.current.beforeEnter()},leave:()=>{q.addFlag(dt.Closing),M.current.beforeLeave()},idle:()=>{}})),$=ae(W=>Le(W,{enter:()=>{q.removeFlag(dt.Opening),M.current.afterEnter()},leave:()=>{q.removeFlag(dt.Closing),M.current.afterLeave()},idle:()=>{}})),I=Uv(()=>{E("hidden"),P(v)},_),O=h.useRef(!1);r5({immediate:L,container:v,classes:A,direction:B,onStart:Mt(W=>{O.current=!0,I.onStart(v,W,H)}),onStop:Mt(W=>{O.current=!1,I.onStop(v,W,$),W==="leave"&&!qc(I)&&(E("hidden"),P(v))})});let V=b,G={ref:x};return L?V={...V,className:fc(b.className,...A.current.enter,...A.current.enterFrom)}:O.current&&(V.className=fc(b.className,(s=v.current)==null?void 0:s.className),V.className===""&&delete V.className),h.createElement(Gc.Provider,{value:I},h.createElement(Da,{value:Le(j,{visible:dt.Open,hidden:dt.Closed})|q.flags},De({ourProps:G,theirProps:V,defaultTag:d5,features:Wv,visible:j==="visible",name:"Transition.Child"})))}function p5(e,t){let{show:n,appear:s=!1,unmount:r=!0,...o}=e,i=h.useRef(null),a=Ue(i,t);Ic();let l=Lo();if(n===void 0&&l!==null&&(n=(l&dt.Open)===dt.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=Uv(()=>{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 b=h.useMemo(()=>({show:n,appear:s,initial:p}),[n,s,p]);h.useEffect(()=>{if(n)d("visible");else if(!qc(f))d("hidden");else{let w=i.current;if(!w)return;let S=w.getBoundingClientRect();S.x===0&&S.y===0&&S.width===0&&S.height===0&&d("hidden")}},[n,f]);let v={unmount:r},x=ae(()=>{var w;p&&g(!1),(w=e.beforeEnter)==null||w.call(e)}),y=ae(()=>{var w;p&&g(!1),(w=e.beforeLeave)==null||w.call(e)});return h.createElement(Gc.Provider,{value:f},h.createElement(Wc.Provider,{value:b},De({ourProps:{...v,as:h.Fragment,children:h.createElement(Gv,{ref:a,...v,...o,beforeEnter:x,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:Wv,visible:u==="visible",name:"Transition"})))}function h5(e,t){let n=h.useContext(Wc)!==null,s=Lo()!==null;return h.createElement(h.Fragment,null,!n&&s?h.createElement(tf,{ref:t,...e}):h.createElement(Gv,{ref:t,...e}))}let tf=He(p5),Gv=He(f5),g5=He(h5),Ap=Object.assign(tf,{Child:g5,Root:tf});var Cg=function(t){return t.reduce(function(n,s){var r=s[0],o=s[1];return n[r]=o,n},{})},jg=typeof window<"u"&&window.document&&window.document.createElement?et.useLayoutEffect:et.useEffect,pn="top",Yn="bottom",Zn="right",hn="left",Np="auto",za=[pn,Yn,Zn,hn],pi="start",ha="end",m5="clippingParents",qv="viewport",ki="popper",b5="reference",Eg=za.reduce(function(e,t){return e.concat([t+"-"+pi,t+"-"+ha])},[]),Kv=[].concat(za,[Np]).reduce(function(e,t){return e.concat([t,t+"-"+pi,t+"-"+ha])},[]),v5="beforeRead",y5="read",x5="afterRead",w5="beforeMain",S5="main",C5="afterMain",j5="beforeWrite",E5="write",P5="afterWrite",_5=[v5,y5,x5,w5,S5,C5,j5,E5,P5];function ks(e){return e?(e.nodeName||"").toLowerCase():null}function On(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function jo(e){var t=On(e).Element;return e instanceof t||e instanceof Element}function qn(e){var t=On(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Mp(e){if(typeof ShadowRoot>"u")return!1;var t=On(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function T5(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var s=t.styles[n]||{},r=t.attributes[n]||{},o=t.elements[n];!qn(o)||!ks(o)||(Object.assign(o.style,s),Object.keys(r).forEach(function(i){var a=r[i];a===!1?o.removeAttribute(i):o.setAttribute(i,a===!0?"":a)}))})}function O5(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(s){var r=t.elements[s],o=t.attributes[s]||{},i=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:n[s]),a=i.reduce(function(l,u){return l[u]="",l},{});!qn(r)||!ks(r)||(Object.assign(r.style,a),Object.keys(o).forEach(function(l){r.removeAttribute(l)}))})}}const A5={name:"applyStyles",enabled:!0,phase:"write",fn:T5,effect:O5,requires:["computeStyles"]};function Rs(e){return e.split("-")[0]}var ho=Math.max,pc=Math.min,hi=Math.round;function nf(){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 Yv(){return!/^((?!chrome|android).)*safari/i.test(nf())}function gi(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var s=e.getBoundingClientRect(),r=1,o=1;t&&qn(e)&&(r=e.offsetWidth>0&&hi(s.width)/e.offsetWidth||1,o=e.offsetHeight>0&&hi(s.height)/e.offsetHeight||1);var i=jo(e)?On(e):window,a=i.visualViewport,l=!Yv()&&n,u=(s.left+(l&&a?a.offsetLeft:0))/r,d=(s.top+(l&&a?a.offsetTop:0))/o,f=s.width/r,p=s.height/o;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function Lp(e){var t=gi(e),n=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:s}}function Zv(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Mp(n)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function or(e){return On(e).getComputedStyle(e)}function N5(e){return["table","td","th"].indexOf(ks(e))>=0}function Wr(e){return((jo(e)?e.ownerDocument:e.document)||window.document).documentElement}function Kc(e){return ks(e)==="html"?e:e.assignedSlot||e.parentNode||(Mp(e)?e.host:null)||Wr(e)}function Pg(e){return!qn(e)||or(e).position==="fixed"?null:e.offsetParent}function M5(e){var t=/firefox/i.test(nf()),n=/Trident/i.test(nf());if(n&&qn(e)){var s=or(e);if(s.position==="fixed")return null}var r=Kc(e);for(Mp(r)&&(r=r.host);qn(r)&&["html","body"].indexOf(ks(r))<0;){var o=or(r);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return r;r=r.parentNode}return null}function Ua(e){for(var t=On(e),n=Pg(e);n&&N5(n)&&or(n).position==="static";)n=Pg(n);return n&&(ks(n)==="html"||ks(n)==="body"&&or(n).position==="static")?t:n||M5(e)||t}function Rp(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function Xi(e,t,n){return ho(e,pc(t,n))}function L5(e,t,n){var s=Xi(e,t,n);return s>n?n:s}function Xv(){return{top:0,right:0,bottom:0,left:0}}function Jv(e){return Object.assign({},Xv(),e)}function Qv(e,t){return t.reduce(function(n,s){return n[s]=e,n},{})}var R5=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,Jv(typeof t!="number"?t:Qv(t,za))};function $5(e){var t,n=e.state,s=e.name,r=e.options,o=n.elements.arrow,i=n.modifiersData.popperOffsets,a=Rs(n.placement),l=Rp(a),u=[hn,Zn].indexOf(a)>=0,d=u?"height":"width";if(!(!o||!i)){var f=R5(r.padding,n),p=Lp(o),g=l==="y"?pn:hn,m=l==="y"?Yn:Zn,b=n.rects.reference[d]+n.rects.reference[l]-i[l]-n.rects.popper[d],v=i[l]-n.rects.reference[l],x=Ua(o),y=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,w=b/2-v/2,S=f[g],C=y-p[d]-f[m],j=y/2-p[d]/2+w,E=Xi(S,j,C),_=l;n.modifiersData[s]=(t={},t[_]=E,t.centerOffset=E-j,t)}}function k5(e){var t=e.state,n=e.options,s=n.element,r=s===void 0?"[data-popper-arrow]":s;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||Zv(t.elements.popper,r)&&(t.elements.arrow=r))}const V5={name:"arrow",enabled:!0,phase:"main",fn:$5,effect:k5,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function mi(e){return e.split("-")[1]}var I5={top:"auto",right:"auto",bottom:"auto",left:"auto"};function D5(e,t){var n=e.x,s=e.y,r=t.devicePixelRatio||1;return{x:hi(n*r)/r||0,y:hi(s*r)/r||0}}function _g(e){var t,n=e.popper,s=e.popperRect,r=e.placement,o=e.variation,i=e.offsets,a=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,f=e.isFixed,p=i.x,g=p===void 0?0:p,m=i.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 x=i.hasOwnProperty("x"),y=i.hasOwnProperty("y"),w=hn,S=pn,C=window;if(u){var j=Ua(n),E="clientHeight",_="clientWidth";if(j===On(n)&&(j=Wr(n),or(j).position!=="static"&&a==="absolute"&&(E="scrollHeight",_="scrollWidth")),j=j,r===pn||(r===hn||r===Zn)&&o===ha){S=Yn;var T=f&&j===C&&C.visualViewport?C.visualViewport.height:j[E];b-=T-s.height,b*=l?1:-1}if(r===hn||(r===pn||r===Yn)&&o===ha){w=Zn;var P=f&&j===C&&C.visualViewport?C.visualViewport.width:j[_];g-=P-s.width,g*=l?1:-1}}var A=Object.assign({position:a},u&&I5),M=d===!0?D5({x:g,y:b},On(n)):{x:g,y:b};if(g=M.x,b=M.y,l){var R;return Object.assign({},A,(R={},R[S]=y?"0":"",R[w]=x?"0":"",R.transform=(C.devicePixelRatio||1)<=1?"translate("+g+"px, "+b+"px)":"translate3d("+g+"px, "+b+"px, 0)",R))}return Object.assign({},A,(t={},t[S]=y?b+"px":"",t[w]=x?g+"px":"",t.transform="",t))}function H5(e){var t=e.state,n=e.options,s=n.gpuAcceleration,r=s===void 0?!0:s,o=n.adaptive,i=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Rs(t.placement),variation:mi(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,_g(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,_g(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 F5={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:H5,data:{}};var bl={passive:!0};function B5(e){var t=e.state,n=e.instance,s=e.options,r=s.scroll,o=r===void 0?!0:r,i=s.resize,a=i===void 0?!0:i,l=On(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(d){d.addEventListener("scroll",n.update,bl)}),a&&l.addEventListener("resize",n.update,bl),function(){o&&u.forEach(function(d){d.removeEventListener("scroll",n.update,bl)}),a&&l.removeEventListener("resize",n.update,bl)}}const z5={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:B5,data:{}};var U5={left:"right",right:"left",bottom:"top",top:"bottom"};function Xl(e){return e.replace(/left|right|bottom|top/g,function(t){return U5[t]})}var W5={start:"end",end:"start"};function Tg(e){return e.replace(/start|end/g,function(t){return W5[t]})}function $p(e){var t=On(e),n=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:n,scrollTop:s}}function kp(e){return gi(Wr(e)).left+$p(e).scrollLeft}function G5(e,t){var n=On(e),s=Wr(e),r=n.visualViewport,o=s.clientWidth,i=s.clientHeight,a=0,l=0;if(r){o=r.width,i=r.height;var u=Yv();(u||!u&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:i,x:a+kp(e),y:l}}function q5(e){var t,n=Wr(e),s=$p(e),r=(t=e.ownerDocument)==null?void 0:t.body,o=ho(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),i=ho(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-s.scrollLeft+kp(e),l=-s.scrollTop;return or(r||n).direction==="rtl"&&(a+=ho(n.clientWidth,r?r.clientWidth:0)-o),{width:o,height:i,x:a,y:l}}function Vp(e){var t=or(e),n=t.overflow,s=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+s)}function e0(e){return["html","body","#document"].indexOf(ks(e))>=0?e.ownerDocument.body:qn(e)&&Vp(e)?e:e0(Kc(e))}function Ji(e,t){var n;t===void 0&&(t=[]);var s=e0(e),r=s===((n=e.ownerDocument)==null?void 0:n.body),o=On(s),i=r?[o].concat(o.visualViewport||[],Vp(s)?s:[]):s,a=t.concat(i);return r?a:a.concat(Ji(Kc(i)))}function sf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function K5(e,t){var n=gi(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 Og(e,t,n){return t===qv?sf(G5(e,n)):jo(t)?K5(t,n):sf(q5(Wr(e)))}function Y5(e){var t=Ji(Kc(e)),n=["absolute","fixed"].indexOf(or(e).position)>=0,s=n&&qn(e)?Ua(e):e;return jo(s)?t.filter(function(r){return jo(r)&&Zv(r,s)&&ks(r)!=="body"}):[]}function Z5(e,t,n,s){var r=t==="clippingParents"?Y5(e):[].concat(t),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(l,u){var d=Og(e,u,s);return l.top=ho(d.top,l.top),l.right=pc(d.right,l.right),l.bottom=pc(d.bottom,l.bottom),l.left=ho(d.left,l.left),l},Og(e,i,s));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function t0(e){var t=e.reference,n=e.element,s=e.placement,r=s?Rs(s):null,o=s?mi(s):null,i=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(r){case pn:l={x:i,y:t.y-n.height};break;case Yn:l={x:i,y:t.y+t.height};break;case Zn:l={x:t.x+t.width,y:a};break;case hn:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var u=r?Rp(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(o){case pi:l[u]=l[u]-(t[d]/2-n[d]/2);break;case ha:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function ga(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=s===void 0?e.placement:s,o=n.strategy,i=o===void 0?e.strategy:o,a=n.boundary,l=a===void 0?m5:a,u=n.rootBoundary,d=u===void 0?qv:u,f=n.elementContext,p=f===void 0?ki:f,g=n.altBoundary,m=g===void 0?!1:g,b=n.padding,v=b===void 0?0:b,x=Jv(typeof v!="number"?v:Qv(v,za)),y=p===ki?b5:ki,w=e.rects.popper,S=e.elements[m?y:p],C=Z5(jo(S)?S:S.contextElement||Wr(e.elements.popper),l,d,i),j=gi(e.elements.reference),E=t0({reference:j,element:w,strategy:"absolute",placement:r}),_=sf(Object.assign({},w,E)),T=p===ki?_:j,P={top:C.top-T.top+x.top,bottom:T.bottom-C.bottom+x.bottom,left:C.left-T.left+x.left,right:T.right-C.right+x.right},A=e.modifiersData.offset;if(p===ki&&A){var M=A[r];Object.keys(P).forEach(function(R){var F=[Zn,Yn].indexOf(R)>=0?1:-1,L=[pn,Yn].indexOf(R)>=0?"y":"x";P[R]+=M[L]*F})}return P}function X5(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=n.boundary,o=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?Kv:l,d=mi(s),f=d?a?Eg:Eg.filter(function(m){return mi(m)===d}):za,p=f.filter(function(m){return u.indexOf(m)>=0});p.length===0&&(p=f);var g=p.reduce(function(m,b){return m[b]=ga(e,{placement:b,boundary:r,rootBoundary:o,padding:i})[Rs(b)],m},{});return Object.keys(g).sort(function(m,b){return g[m]-g[b]})}function J5(e){if(Rs(e)===Np)return[];var t=Xl(e);return[Tg(e),t,Tg(t)]}function Q5(e){var t=e.state,n=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,u=n.padding,d=n.boundary,f=n.rootBoundary,p=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,b=n.allowedAutoPlacements,v=t.options.placement,x=Rs(v),y=x===v,w=l||(y||!m?[Xl(v)]:J5(v)),S=[v].concat(w).reduce(function(W,K){return W.concat(Rs(K)===Np?X5(t,{placement:K,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:b}):K)},[]),C=t.rects.reference,j=t.rects.popper,E=new Map,_=!0,T=S[0],P=0;P<S.length;P++){var A=S[P],M=Rs(A),R=mi(A)===pi,F=[pn,Yn].indexOf(M)>=0,L=F?"width":"height",B=ga(t,{placement:A,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),q=F?R?Zn:hn:R?Yn:pn;C[L]>j[L]&&(q=Xl(q));var H=Xl(q),$=[];if(o&&$.push(B[M]<=0),a&&$.push(B[q]<=0,B[H]<=0),$.every(function(W){return W})){T=A,_=!1;break}E.set(A,$)}if(_)for(var I=m?3:1,O=function(K){var J=S.find(function(Y){var U=E.get(Y);if(U)return U.slice(0,K).every(function(Q){return Q})});if(J)return T=J,"break"},V=I;V>0;V--){var G=O(V);if(G==="break")break}t.placement!==T&&(t.modifiersData[s]._skip=!0,t.placement=T,t.reset=!0)}}const eO={name:"flip",enabled:!0,phase:"main",fn:Q5,requiresIfExists:["offset"],data:{_skip:!1}};function Ag(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 Ng(e){return[pn,Zn,Yn,hn].some(function(t){return e[t]>=0})}function tO(e){var t=e.state,n=e.name,s=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,i=ga(t,{elementContext:"reference"}),a=ga(t,{altBoundary:!0}),l=Ag(i,s),u=Ag(a,r,o),d=Ng(l),f=Ng(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 nO={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:tO};function sO(e,t,n){var s=Rs(e),r=[hn,pn].indexOf(s)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=o[0],a=o[1];return i=i||0,a=(a||0)*r,[hn,Zn].indexOf(s)>=0?{x:a,y:i}:{x:i,y:a}}function rO(e){var t=e.state,n=e.options,s=e.name,r=n.offset,o=r===void 0?[0,0]:r,i=Kv.reduce(function(d,f){return d[f]=sO(f,t.rects,o),d},{}),a=i[t.placement],l=a.x,u=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[s]=i}const oO={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:rO};function iO(e){var t=e.state,n=e.name;t.modifiersData[n]=t0({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const aO={name:"popperOffsets",enabled:!0,phase:"read",fn:iO,data:{}};function lO(e){return e==="x"?"y":"x"}function cO(e){var t=e.state,n=e.options,s=e.name,r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,f=n.padding,p=n.tether,g=p===void 0?!0:p,m=n.tetherOffset,b=m===void 0?0:m,v=ga(t,{boundary:l,rootBoundary:u,padding:f,altBoundary:d}),x=Rs(t.placement),y=mi(t.placement),w=!y,S=Rp(x),C=lO(S),j=t.modifiersData.popperOffsets,E=t.rects.reference,_=t.rects.popper,T=typeof b=="function"?b(Object.assign({},t.rects,{placement:t.placement})):b,P=typeof T=="number"?{mainAxis:T,altAxis:T}:Object.assign({mainAxis:0,altAxis:0},T),A=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,M={x:0,y:0};if(j){if(o){var R,F=S==="y"?pn:hn,L=S==="y"?Yn:Zn,B=S==="y"?"height":"width",q=j[S],H=q+v[F],$=q-v[L],I=g?-_[B]/2:0,O=y===pi?E[B]:_[B],V=y===pi?-_[B]:-E[B],G=t.elements.arrow,W=g&&G?Lp(G):{width:0,height:0},K=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:Xv(),J=K[F],Y=K[L],U=Xi(0,E[B],W[B]),Q=w?E[B]/2-I-U-J-P.mainAxis:O-U-J-P.mainAxis,se=w?-E[B]/2+I+U+Y+P.mainAxis:V+U+Y+P.mainAxis,de=t.elements.arrow&&Ua(t.elements.arrow),Se=de?S==="y"?de.clientTop||0:de.clientLeft||0:0,ne=(R=A==null?void 0:A[S])!=null?R:0,Te=q+Q-ne-Se,ke=q+se-ne,it=Xi(g?pc(H,Te):H,q,g?ho($,ke):$);j[S]=it,M[S]=it-q}if(a){var st,xe=S==="x"?pn:hn,Ze=S==="x"?Yn:Zn,Xe=j[C],ft=C==="y"?"height":"width",Ae=Xe+v[xe],at=Xe-v[Ze],rt=[pn,hn].indexOf(x)!==-1,Ie=(st=A==null?void 0:A[C])!=null?st:0,Wt=rt?Ae:Xe-E[ft]-_[ft]-Ie+P.altAxis,ge=rt?Xe+E[ft]+_[ft]-Ie-P.altAxis:at,$e=g&&rt?L5(Wt,Xe,ge):Xi(g?Wt:Ae,Xe,g?ge:at);j[C]=$e,M[C]=$e-Xe}t.modifiersData[s]=M}}const uO={name:"preventOverflow",enabled:!0,phase:"main",fn:cO,requiresIfExists:["offset"]};function dO(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function fO(e){return e===On(e)||!qn(e)?$p(e):dO(e)}function pO(e){var t=e.getBoundingClientRect(),n=hi(t.width)/e.offsetWidth||1,s=hi(t.height)/e.offsetHeight||1;return n!==1||s!==1}function hO(e,t,n){n===void 0&&(n=!1);var s=qn(t),r=qn(t)&&pO(t),o=Wr(t),i=gi(e,r,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(s||!s&&!n)&&((ks(t)!=="body"||Vp(o))&&(a=fO(t)),qn(t)?(l=gi(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=kp(o))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function gO(e){var t=new Map,n=new Set,s=[];e.forEach(function(o){t.set(o.name,o)});function r(o){n.add(o.name);var i=[].concat(o.requires||[],o.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&r(l)}}),s.push(o)}return e.forEach(function(o){n.has(o.name)||r(o)}),s}function mO(e){var t=gO(e);return _5.reduce(function(n,s){return n.concat(t.filter(function(r){return r.phase===s}))},[])}function bO(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function vO(e){var t=e.reduce(function(n,s){var r=n[s.name];return n[s.name]=r?Object.assign({},r,s,{options:Object.assign({},r.options,s.options),data:Object.assign({},r.data,s.data)}):s,n},{});return Object.keys(t).map(function(n){return t[n]})}var Mg={placement:"bottom",modifiers:[],strategy:"absolute"};function Lg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function yO(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,s=n===void 0?[]:n,r=t.defaultOptions,o=r===void 0?Mg:r;return function(a,l,u){u===void 0&&(u=o);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Mg,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],p=!1,g={state:d,setOptions:function(x){var y=typeof x=="function"?x(d.options):x;b(),d.options=Object.assign({},o,d.options,y),d.scrollParents={reference:jo(a)?Ji(a):a.contextElement?Ji(a.contextElement):[],popper:Ji(l)};var w=mO(vO([].concat(s,d.options.modifiers)));return d.orderedModifiers=w.filter(function(S){return S.enabled}),m(),g.update()},forceUpdate:function(){if(!p){var x=d.elements,y=x.reference,w=x.popper;if(Lg(y,w)){d.rects={reference:hO(y,Ua(w),d.options.strategy==="fixed"),popper:Lp(w)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(P){return d.modifiersData[P.name]=Object.assign({},P.data)});for(var S=0;S<d.orderedModifiers.length;S++){if(d.reset===!0){d.reset=!1,S=-1;continue}var C=d.orderedModifiers[S],j=C.fn,E=C.options,_=E===void 0?{}:E,T=C.name;typeof j=="function"&&(d=j({state:d,options:_,name:T,instance:g})||d)}}}},update:bO(function(){return new Promise(function(v){g.forceUpdate(),v(d)})}),destroy:function(){b(),p=!0}};if(!Lg(a,l))return g;g.setOptions(u).then(function(v){!p&&u.onFirstUpdate&&u.onFirstUpdate(v)});function m(){d.orderedModifiers.forEach(function(v){var x=v.name,y=v.options,w=y===void 0?{}:y,S=v.effect;if(typeof S=="function"){var C=S({state:d,name:x,instance:g,options:w}),j=function(){};f.push(C||j)}})}function b(){f.forEach(function(v){return v()}),f=[]}return g}}var xO=[z5,aO,F5,A5,oO,eO,uO,V5,nO],wO=yO({defaultModifiers:xO}),SO=typeof Element<"u",CO=typeof Map=="function",jO=typeof Set=="function",EO=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function Jl(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,s,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!Jl(e[s],t[s]))return!1;return!0}var o;if(CO&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;for(o=e.entries();!(s=o.next()).done;)if(!Jl(s.value[1],t.get(s.value[0])))return!1;return!0}if(jO&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(EO&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;if(SO&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((r[s]==="_owner"||r[s]==="__v"||r[s]==="__o")&&e.$$typeof)&&!Jl(e[r[s]],t[r[s]]))return!1;return!0}return e!==e&&t!==t}var PO=function(t,n){try{return Jl(t,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const _O=Bf(PO);var TO=[],Wa=function(t,n,s){s===void 0&&(s={});var r=et.useRef(null),o={onFirstUpdate:s.onFirstUpdate,placement:s.placement||"bottom",strategy:s.strategy||"absolute",modifiers:s.modifiers||TO},i=et.useState({styles:{popper:{position:o.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),a=i[0],l=i[1],u=et.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,b=Object.keys(m.elements);iw.flushSync(function(){l({styles:Cg(b.map(function(v){return[v,m.styles[v]||{}]})),attributes:Cg(b.map(function(v){return[v,m.attributes[v]]}))})})},requires:["computeStyles"]}},[]),d=et.useMemo(function(){var p={onFirstUpdate:o.onFirstUpdate,placement:o.placement,strategy:o.strategy,modifiers:[].concat(o.modifiers,[u,{name:"applyStyles",enabled:!1}])};return _O(r.current,p)?r.current||p:(r.current=p,p)},[o.onFirstUpdate,o.placement,o.strategy,o.modifiers,u]),f=et.useRef();return jg(function(){f.current&&f.current.setOptions(d)},[d]),jg(function(){if(!(t==null||n==null)){var p=s.createPopper||wO,g=p(t,n,d);return f.current=g,function(){g.destroy(),f.current=null}}},[t,n,s.createPopper]),{state:f.current?f.current.state:null,styles:a.styles,attributes:a.attributes,update:f.current?f.current.update:null,forceUpdate:f.current?f.current.forceUpdate:null}};const Xn=h.forwardRef(function({children:t,title:n,onClose:s,icon:r,skipOverflow:o,shadow:i=!0,padding:a=!0,border:l=!0,round:u=!0,className:d,classNameBody:f,size:p="m",titleClass:g=ee("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:b,...v},x){const y=ur(r)?r:{};return c.jsxs("div",{...v,ref:x,style:m,className:ee(["gs-utl-card",d,b||np.bg,re.b,u&&re.rnd,l?z.br:re.bT,!o&&"gs-utl-overflow-auto",i&&"gs-utl-shadow-md",a&&p==="l"&&"gs-utl-p-5",a&&p==="m"&&"gs-utl-px-4 gs-utl-py-2",a&&p==="s"&&"gs-utl-px-2 gs-utl-py-1",a&&p==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",a&&p==="x2s"&&"gs-utl-px-0.5"]),children:[(n||s)&&n!==!1&&c.jsxs(k,{className:ee("gs-utl-card-title",g),items:"center",children:[c.jsx(D,{className:ee("truncate"),grow:!0,children:n}),(s||r)&&c.jsx(D,{onClick:s,className:ee("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(oe,{icon:(ot(r)?r:"")||Z.close,size:"18px",...y})})]}),c.jsx("div",{className:ee("gs-utl-card-body",f),children:t})]})});var vl,OO=new Uint8Array(16);function AO(){if(!vl&&(vl=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!vl))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return vl(OO)}const NO=/^(?:[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 MO(e){return typeof e=="string"&&NO.test(e)}var Ft=[];for(var Xu=0;Xu<256;++Xu)Ft.push((Xu+256).toString(16).substr(1));function LO(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(Ft[e[t+0]]+Ft[e[t+1]]+Ft[e[t+2]]+Ft[e[t+3]]+"-"+Ft[e[t+4]]+Ft[e[t+5]]+"-"+Ft[e[t+6]]+Ft[e[t+7]]+"-"+Ft[e[t+8]]+Ft[e[t+9]]+"-"+Ft[e[t+10]]+Ft[e[t+11]]+Ft[e[t+12]]+Ft[e[t+13]]+Ft[e[t+14]]+Ft[e[t+15]]).toLowerCase();if(!MO(n))throw TypeError("Stringified UUID is invalid");return n}function n0(e,t,n){e=e||{};var s=e.random||(e.rng||AO)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,LO(s)}class RO extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Vi=async(e,{onError:t,onLoading:n,onResult:s,params:r,rawText:o,...i})=>{try{n==null||n(!0);const a=r?new URLSearchParams(r).toString():"",l=a?`?${a}`:"",u=await fetch(`${e}${l}`,i);if(!u.ok){const f=await u.json();throw new RO(f.error||"Request failed!",f.errorData)}let d;if(o)d=await u.text();else try{d=await u.json()}catch{d=void 0}return s==null||s(d),d}catch(a){const l=a instanceof Error?a:new Error(a);if(t==null||t(l),i.throwError)throw l;return l}finally{n==null||n(!1)}};class Is{static async get(t,n){return Vi(t,{...n,method:"GET"})}static async post(t,n){return Vi(t,{...n,method:"POST"})}static async put(t,n){return Vi(t,{...n,method:"PUT"})}static async patch(t,n){return Vi(t,{...n,method:"PATCH"})}static async delete(t,n){return Vi(t,{...n,method:"DELETE"})}}var Yc=(e=>(e.Projects="projects",e.Settings="settings",e))(Yc||{}),s0=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(s0||{});const Rg={},$O=1,kO=(e={})=>new Promise((t,n)=>{const s=(e==null?void 0:e.db)||"gjs",r=s==="gjs-studio"?$O:1,o=Rg[s];if(o)t(o);else{if(!Vs())return n(new Error("window context not found"));const i=window.indexedDB.open(s,r);i.onerror=n,i.onsuccess=()=>{const a=i.result;a.onerror=n,Rg[s]=a,t(a)},i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains("projects")||a.createObjectStore("projects"),a.objectStoreNames.contains("settings")||a.createObjectStore("settings")}}}),Ip=async(e,t)=>(await kO(t)).transaction([e],"readwrite").objectStore(e),VO=async(e,t)=>{const n=await Ip(e,t);return new Promise((s,r)=>{const o=[],i=n.openCursor();i.onerror=r,i.onsuccess=function(a){const u=a.target.result;if(u){const d=u.primaryKey,f=u.value;o.push({key:d,data:f}),u.continue()}else s(o)}})},IO=async(e,t,n)=>{const s=await Ip(e,n);return new Promise((r,o)=>{const i=s.get(t);i.onerror=o,i.onsuccess=()=>r(i.result)})},DO=async(e,t,n)=>{const s=await Ip(e,n);return new Promise((r,o)=>{const i=s.delete(t);i.onerror=o,i.onsuccess=()=>r()})};var ma=(e=>(e.Existing="existing",e.Templates="templates",e))(ma||{});const HO=e=>{const t=PA();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},FO=(e,t)=>Is.get(HO(e),{...t}),BO=async e=>{try{const t=await FO(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},r0=async(e=yt.web)=>typeof window>"u"?[]:(await VO(Yc.Projects)).map(({key:s,data:r})=>{var o;return{id:`${s}`,name:`${((o=r.custom)==null?void 0:o.projectName)||s}`,data:r}}).filter(s=>{var r;return((r=s.data.custom)==null?void 0:r.projectType)===e}),o0=new Set,_n=new WeakMap,si=new WeakMap,Eo=new WeakMap,rf=new WeakMap,zO=new WeakMap,bi=new WeakMap,hc=new WeakMap;let Vr;const ao="__aa_tgt",of="__aa_del",UO=e=>{const t=YO(e);t&&t.forEach(n=>ZO(n))},WO=e=>{e.forEach(t=>{t.target===Vr&&qO(),_n.has(t.target)&&$o(t.target)})};function GO(e){const t=rf.get(e);t==null||t.disconnect();let n=_n.get(e),s=0;const r=5;n||(n=vi(e),_n.set(e,n));const{offsetWidth:o,offsetHeight:i}=Vr,l=[n.top-r,o-(n.left+r+n.width),i-(n.top+r+n.height),n.left-r].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++s>1&&$o(e)},{root:Vr,threshold:1,rootMargin:l});u.observe(e),rf.set(e,u)}function $o(e){clearTimeout(hc.get(e));const t=Zc(e),n=typeof t=="function"?500:t.duration;hc.set(e,setTimeout(()=>{const s=Eo.get(e);(!s||s.finished)&&(_n.set(e,vi(e)),GO(e))},n))}function qO(){clearTimeout(hc.get(Vr)),hc.set(Vr,setTimeout(()=>{o0.forEach(e=>l0(e,t=>i0(()=>$o(t))))},100))}function KO(e){setTimeout(()=>{zO.set(e,setInterval(()=>i0($o.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function i0(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let af,Qo;typeof window<"u"&&(Vr=document.documentElement,af=new MutationObserver(UO),Qo=new ResizeObserver(WO),Qo.observe(Vr));function YO(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(Ju(n.target),!t.has(n.target)){t.add(n.target);for(let s=0;s<n.target.children.length;s++){const r=n.target.children.item(s);if(r){if(of in r)return!1;Ju(n.target,r),t.add(r)}}}if(n.removedNodes.length)for(let s=0;s<n.removedNodes.length;s++){const r=n.removedNodes[s];if(of in r)return!1;r instanceof Element&&(t.add(r),Ju(n.target,r),si.set(r,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function Ju(e,t){!t&&!(ao in e)?Object.defineProperty(e,ao,{value:e}):t&&!(ao in t)&&Object.defineProperty(t,ao,{value:e})}function ZO(e){var t;const n=Vr.contains(e),s=_n.has(e);n&&si.has(e)&&si.delete(e),Eo.has(e)&&((t=Eo.get(e))===null||t===void 0||t.cancel()),s&&n?XO(e):s&&!n?QO(e):JO(e)}function ys(e){return Number(e.replace(/[^0-9.\-]/g,""))}function vi(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function a0(e,t,n){let s=t.width,r=t.height,o=n.width,i=n.height;const a=getComputedStyle(e);if(a.getPropertyValue("box-sizing")==="content-box"){const u=ys(a.paddingTop)+ys(a.paddingBottom)+ys(a.borderTopWidth)+ys(a.borderBottomWidth),d=ys(a.paddingLeft)+ys(a.paddingRight)+ys(a.borderRightWidth)+ys(a.borderLeftWidth);s-=d,o-=d,r-=u,i-=u}return[s,o,r,i].map(Math.round)}function Zc(e){return ao in e&&bi.has(e[ao])?bi.get(e[ao]):{duration:250,easing:"ease-in-out"}}function l0(e,...t){t.forEach(n=>n(e,bi.has(e)));for(let n=0;n<e.children.length;n++){const s=e.children.item(n);s&&t.forEach(r=>r(s,bi.has(s)))}}function XO(e){const t=_n.get(e),n=vi(e);let s;if(!t)return;const r=Zc(e);if(typeof r!="function"){const o=t.left-n.left,i=t.top-n.top,[a,l,u,d]=a0(e,t,n),f={transform:`translate(${o}px, ${i}px)`},p={transform:"translate(0, 0)"};a!==l&&(f.width=`${a}px`,p.width=`${l}px`),u!==d&&(f.height=`${u}px`,p.height=`${d}px`),s=e.animate([f,p],r)}else s=new Animation(r(e,"remain",t,n)),s.play();Eo.set(e,s),_n.set(e,n),s.addEventListener("finish",$o.bind(null,e))}function JO(e){const t=vi(e);_n.set(e,t);const n=Zc(e);let s;typeof n!="function"?s=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"}):(s=new Animation(n(e,"add",t)),s.play()),Eo.set(e,s),s.addEventListener("finish",$o.bind(null,e))}function QO(e){if(!si.has(e)||!_n.has(e))return;const[t,n]=si.get(e);Object.defineProperty(e,of,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[s,r,o,i]=eA(e),a=Zc(e),l=_n.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${s}px`,left:`${r}px`,width:`${o}px`,height:`${i}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof a!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:a.duration,easing:"ease-out"}):(u=new Animation(a(e,"remove",l)),u.play()),Eo.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),_n.delete(e),si.delete(e),Eo.delete(e),(d=rf.get(e))===null||d===void 0||d.disconnect()})}function eA(e){const t=_n.get(e),[n,,s]=a0(e,t,vi(e));let r=e.parentElement;for(;r&&(getComputedStyle(r).position==="static"||r instanceof HTMLBodyElement);)r=r.parentElement;r||(r=document.body);const o=getComputedStyle(r),i=_n.get(r)||vi(r),a=Math.round(t.top-i.top)-ys(o.borderTopWidth),l=Math.round(t.left-i.left)-ys(o.borderLeftWidth);return[a,l,n,s]}function tA(e,t={}){af&&Qo&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),l0(e,$o,KO,n=>Qo==null?void 0:Qo.observe(n)),typeof t=="function"?bi.set(e,t):bi.set(e,{duration:250,easing:"ease-in-out",...t}),af.observe(e,{childList:!0}),o0.add(e))}function nA(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&tA(t.current,e)},[t]),t}const sA={[nn.Info]:z.bgA,[nn.Error]:"bg-red-500",[nn.Success]:"bg-green-500",[nn.Warning]:"bg-orange-400"},rA=h.forwardRef(function(t,n){const s={[nn.Info]:Z.informationVariant,[nn.Error]:Z.fire,[nn.Success]:Z.checkBold,[nn.Warning]:Z.alertRhombus},{children:r,className:o,content:i,id:a,buttons:l=[],variant:u=nn.Info,autoHideTimeout:d=3e3}=t,f=h.useRef(null),p=h.useRef(),g=s[u],m=sA[u];h.useImperativeHandle(n,()=>f.current,[]);const b=()=>{var w;return(w=t.onDismiss)==null?void 0:w.call(t,a)},v=()=>{d&&(p.current=setTimeout(b,d))},x=()=>p.current&&clearTimeout(p.current);h.useEffect(()=>(v(),x),[]);const y=i||r;return c.jsx(Xn,{className:ue(o,"overflow-hidden relative"),ref:f,onPointerEnter:x,onPointerLeave:v,children:c.jsxs(k,{space:"m",items:"center",className:ue(je.y),children:[c.jsx(D,{className:ue(m,re.pill,"text-white gjs-p-1"),children:c.jsx(oe,{icon:g,size:le.s})}),c.jsx(D,{grow:!0,className:ue("gjs-pr-3"),children:c.jsxs(k,{col:!0,space:"xs",children:[c.jsx(D,{className:ue("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(D,{className:ue(z.txtLowEmphasis),children:y}),!!l.length&&c.jsx(k,{space:"m",justify:"end",children:l.map(({id:w,...S})=>c.jsx(Ke,{...S},w))})]})}),c.jsx(D,{className:ue("absolute top-1 right-1"),children:c.jsx(bt,{onClick:b,border:!1,children:c.jsx(oe,{icon:Z.close,size:le.s})})})]})})});fe(h.forwardRef(function({className:t,toasts:n,onDismiss:s,...r},o){const i=nA({});return c.jsx("div",{className:ue(t,"w-80 gs-utl-z-30"),...r,ref:i,children:n.map(a=>c.jsx(rA,{...a,className:ue("gjs-mb-2"),onDismiss:s},a.uuid||a.id))})}));var lf=(e=>(e.self="self",e.cloud="cloud",e))(lf||{}),go=(e=>(e.image="image",e.video="video",e))(go||{}),ts=(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))(ts||{}),Dp=(e=>(e.canvas="canvas",e.layers="layers",e))(Dp||{}),xr=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(xr||{}),Dt=(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))(Dt||{}),cf=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(cf||{});const ba=e=>e.replaceAll('"',"").replaceAll("'",""),Po=e=>e.includes(",")?e:/\s/.test(e)?`'${ba(e)}'`:ba(e),$g=(e,t,n)=>({family:e,variant:t,...n}),Qi=(e,t)=>{e=Po(e);const{menuVariant:n,variants:s}=t;return{family:e,familyLabel:ba(e),menuVariant:n&&$g(Po(`menuFont-${ba(e)}`),"regular",n),variants:Object.assign({},...Object.entries(s).map(([r,o])=>({[r]:$g(e,r,o)})))}},Hp=(e,t)=>{var a;const n=Qi(e.family,e),s=n.menuVariant??((a=Object.values(n.variants))==null?void 0:a[0]);if(!s)return"Arial, Helvetica, sans-serif";const{source:r,descriptors:o}=s,i=ba(s.family);if(!t){const l=new FontFace(i,`url("${r}")`,o),u=Array.from(document.fonts.values()).filter(d=>d.family===i);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return Po(i)},ms=", sans-serif",kg=["Arial, Helvetica"+ms,"Arial Black, Gadget"+ms,"Brush Script MT"+ms,"Comic Sans MS, cursive"+ms,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+ms,"Impact, Charcoal"+ms,"Lucida Sans Unicode, Lucida Grande"+ms,"Tahoma, Geneva"+ms,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+ms,"Verdana, Geneva"+ms].map(e=>({id:e,label:e.split(",")[0]})),oA=String.raw,Ws=(e,t)=>{if(!t)return"";const n=e[0],s=e[1];return`${n}${t}${s}`},iA=({family:e,source:t,descriptors:n})=>{const{display:s,ascentOverride:r,descentOverride:o,featureSettings:i,lineGapOverride:a,stretch:l,style:u,unicodeRange:d,weight:f}=n??{},p=[Ws`font-ascent-override: ${r};`,Ws`font-display: ${s};`,Ws`font-descent-override: ${o};`,Ws`font-feature-settings: ${i};`,Ws`font-line-gap-override: ${a};`,Ws`font-stretch: ${l};`,Ws`font-style: ${u};`,Ws`font-unicode-range: ${d};`,Ws`font-weight: ${f};`].filter(Boolean);return oA`
|
|
24
|
+
`));let p=d.props,g=typeof(p==null?void 0:p.className)=="function"?(...v)=>jc(p==null?void 0:p.className(...v),l.className):jc(p==null?void 0:p.className,l.className),m=g?{className:g}:{};return h.cloneElement(d,Object.assign({},Rb(d.props,mi(td(l,["ref"]))),f,u,{ref:r(d.ref,u.ref)},m))}return h.createElement(o,Object.assign({},td(l,["ref"]),o!==h.Fragment&&u,o!==h.Fragment&&f),d)}function jp(){let e=h.useRef([]),t=h.useCallback(n=>{for(let s of e.current)s!=null&&(typeof s=="function"?s(n):s.current=n)},[]);return(...n)=>{if(!n.every(s=>s==null))return e.current=n,t}}function RT(...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 Rb(...e){if(e.length===0)return{};if(e.length===1)return e[0];let t={},n={};for(let s of e)for(let r in s)r.startsWith("on")&&typeof s[r]=="function"?(n[r]!=null||(n[r]=[]),n[r].push(s[r])):t[r]=s[r];if(t.disabled||t["aria-disabled"])return Object.assign(t,Object.fromEntries(Object.keys(n).map(s=>[s,void 0])));for(let s in n)Object.assign(t,{[s](r,...o){let i=n[s];for(let a of i){if((r instanceof Event||(r==null?void 0:r.nativeEvent)instanceof Event)&&r.defaultPrevented)return;a(r,...o)}}});return t}function ze(e){var t;return Object.assign(h.forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function mi(e){let t=Object.assign({},e);for(let n in t)t[n]===void 0&&delete t[n];return t}function td(e,t=[]){let n=Object.assign({},e);for(let s of t)s in n&&delete n[s];return n}let IT="div";var gs=(e=>(e[e.None=1]="None",e[e.Focusable=2]="Focusable",e[e.Hidden=4]="Hidden",e))(gs||{});function VT(e,t){var n;let{features:s=1,...r}=e,o={ref:t,"aria-hidden":(s&2)===2?!0:(n=r["aria-hidden"])!=null?n:void 0,hidden:(s&4)===4?!0:void 0,style:{position:"fixed",top:1,left:1,width:1,height:0,padding:0,margin:-1,overflow:"hidden",clip:"rect(0, 0, 0, 0)",whiteSpace:"nowrap",borderWidth:"0",...(s&4)===4&&(s&2)!==2&&{display:"none"}}};return Be({ourProps:o,theirProps:r,slot:{},defaultTag:IT,name:"Hidden"})}let ms=ze(VT),Ep=h.createContext(null);Ep.displayName="OpenClosedContext";var gt=(e=>(e[e.Open=1]="Open",e[e.Closed=2]="Closed",e[e.Closing=4]="Closing",e[e.Opening=8]="Opening",e))(gt||{});function Fo(){return h.useContext(Ep)}function Xa({value:e,children:t}){return h.createElement(Ep.Provider,{value:e},t)}function HT(e){function t(){document.readyState!=="loading"&&(e(),document.removeEventListener("DOMContentLoaded",t))}typeof window<"u"&&typeof document<"u"&&(document.addEventListener("DOMContentLoaded",t),t())}let vo=[];HT(()=>{function e(t){t.target instanceof HTMLElement&&t.target!==document.body&&vo[0]!==t.target&&(vo.unshift(t.target),vo=vo.filter(n=>n!=null&&n.isConnected),vo.splice(10))}window.addEventListener("click",e,{capture:!0}),window.addEventListener("mousedown",e,{capture:!0}),window.addEventListener("focus",e,{capture:!0}),document.body.addEventListener("click",e,{capture:!0}),document.body.addEventListener("mousedown",e,{capture:!0}),document.body.addEventListener("focus",e,{capture:!0})});function zr(e){let t=e.parentElement,n=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(n=t),t=t.parentElement;let s=(t==null?void 0:t.getAttribute("disabled"))==="";return s&&DT(n)?!1:s}function DT(e){if(!e)return!1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return!1;t=t.previousElementSibling}return!0}function FT(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 gf(e,t){let n=t.resolveItems();if(n.length<=0)return null;let s=t.resolveActiveIndex(),r=s??-1;switch(e.focus){case 0:{for(let o=0;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 1:{for(let o=r-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 2:{for(let o=r+1;o<n.length;++o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 3:{for(let o=n.length-1;o>=0;--o)if(!t.resolveDisabled(n[o],o,n))return o;return s}case 4:{for(let o=0;o<n.length;++o)if(t.resolveId(n[o],o,n)===e.id)return o;return s}case 5:return null;default:FT(e)}}function tu(e={},t=null,n=[]){for(let[s,r]of Object.entries(e))Vb(n,Ib(t,s),r);return n}function Ib(e,t){return e?e+"["+t+"]":t}function Vb(e,t,n){if(Array.isArray(n))for(let[s,r]of n.entries())Vb(e,Ib(t,s.toString()),r);else n instanceof Date?e.push([t,n.toISOString()]):typeof n=="boolean"?e.push([t,n?"1":"0"]):typeof n=="string"?e.push([t,n]):typeof n=="number"?e.push([t,`${n}`]):n==null?e.push([t,""]):tu(n,t,e)}function Hb(e){var t,n;let s=(t=e==null?void 0:e.form)!=null?t:e.closest("form");if(s){for(let r of s.elements)if(r!==e&&(r.tagName==="INPUT"&&r.type==="submit"||r.tagName==="BUTTON"&&r.type==="submit"||r.nodeName==="INPUT"&&r.type==="image")){r.click();return}(n=s.requestSubmit)==null||n.call(s)}}var be=(e=>(e.Space=" ",e.Enter="Enter",e.Escape="Escape",e.Backspace="Backspace",e.Delete="Delete",e.ArrowLeft="ArrowLeft",e.ArrowUp="ArrowUp",e.ArrowRight="ArrowRight",e.ArrowDown="ArrowDown",e.Home="Home",e.End="End",e.PageUp="PageUp",e.PageDown="PageDown",e.Tab="Tab",e))(be||{}),BT={NODE_ENV:"production"},zT=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(zT||{}),UT=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(UT||{}),WT=(e=>(e[e.Pointer=0]="Pointer",e[e.Focus=1]="Focus",e[e.Other=2]="Other",e))(WT||{}),GT=(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))(GT||{});function nd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=t(e.options.slice()),r=s.length>0&&s[0].dataRef.current.order!==null?s.sort((i,a)=>i.dataRef.current.order-a.dataRef.current.order):or(s,i=>i.dataRef.current.domRef.current),o=n?r.indexOf(n):null;return o===-1&&(o=null),{options:r,activeOptionIndex:o}}let qT={1(e){var t;return(t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},0(e){var t,n;if((t=e.dataRef.current)!=null&&t.disabled||e.comboboxState===0)return e;if((n=e.dataRef.current)!=null&&n.value){let s=e.dataRef.current.calculateIndex(e.dataRef.current.value);if(s!==-1)return{...e,activeOptionIndex:s,comboboxState:0}}return{...e,comboboxState:0}},2(e,t){var n,s,r,o,i;if((n=e.dataRef.current)!=null&&n.disabled||(s=e.dataRef.current)!=null&&s.optionsRef.current&&!((r=e.dataRef.current)!=null&&r.optionsPropsRef.current.static)&&e.comboboxState===1)return e;if(e.virtual){let d=t.focus===Je.Specific?t.idx:gf(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=(o=t.trigger)!=null?o:2;return e.activeOptionIndex===d&&e.activationTrigger===f?e:{...e,activeOptionIndex:d,activationTrigger:f}}let a=nd(e);if(a.activeOptionIndex===null){let d=a.options.findIndex(f=>!f.dataRef.current.disabled);d!==-1&&(a.activeOptionIndex=d)}let l=t.focus===Je.Specific?t.idx:gf(t,{resolveItems:()=>a.options,resolveActiveIndex:()=>a.activeOptionIndex,resolveId:d=>d.id,resolveDisabled:d=>d.dataRef.current.disabled}),u=(i=t.trigger)!=null?i:2;return e.activeOptionIndex===l&&e.activationTrigger===u?e:{...e,...a,activeOptionIndex:l,activationTrigger:u}},3:(e,t)=>{var n,s,r;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:[...e.options,t.payload]};let o=t.payload,i=nd(e,l=>(l.push(o),l));e.activeOptionIndex===null&&(s=e.dataRef.current)!=null&&s.isSelected(t.payload.dataRef.current.value)&&(i.activeOptionIndex=i.options.indexOf(o));let a={...e,...i,activationTrigger:2};return(r=e.dataRef.current)!=null&&r.__demoMode&&e.dataRef.current.value===void 0&&(a.activeOptionIndex=0),a},4:(e,t)=>{var n;if((n=e.dataRef.current)!=null&&n.virtual)return{...e,options:e.options.filter(r=>r.id!==t.id)};let s=nd(e,r=>{let o=r.findIndex(i=>i.id===t.id);return o!==-1&&r.splice(o,1),r});return{...e,...s,activationTrigger:2}},5:(e,t)=>e.labelId===t.id?e:{...e,labelId:t.id},6:(e,t)=>e.activationTrigger===t.trigger?e:{...e,activationTrigger:t.trigger},7:(e,t)=>{var n;if(((n=e.virtual)==null?void 0:n.options)===t.options)return e;let s=e.activeOptionIndex;if(e.activeOptionIndex!==null){let r=t.options.indexOf(e.virtual.options[e.activeOptionIndex]);r!==-1?s=r:s=null}return{...e,activeOptionIndex:s,virtual:Object.assign({},e.virtual,{options:t.options})}}},Tp=h.createContext(null);Tp.displayName="ComboboxActionsContext";function Ja(e){let t=h.useContext(Tp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ja),n}return t}let Db=h.createContext(null);function KT(e){var t;let n=Bo("VirtualProvider"),[s,r]=h.useMemo(()=>{let l=n.optionsRef.current;if(!l)return[0,0];let u=window.getComputedStyle(l);return[parseFloat(u.paddingBlockStart||u.paddingTop),parseFloat(u.paddingBlockEnd||u.paddingBottom)]},[n.optionsRef.current]),o=ET({scrollPaddingStart:s,scrollPaddingEnd:r,count:n.virtual.options.length,estimateSize(){return 40},getScrollElement(){var l;return(l=n.optionsRef.current)!=null?l:null},overscan:12}),[i,a]=h.useState(0);return qe(()=>{a(l=>l+1)},[(t=n.virtual)==null?void 0:t.options]),h.createElement(Db.Provider,{value:o},h.createElement("div",{style:{position:"relative",width:"100%",height:`${o.getTotalSize()}px`},ref:l=>{if(l){if(typeof process<"u"&&BT.JEST_WORKER_ID!==void 0||n.activationTrigger===0)return;n.activeOptionIndex!==null&&n.virtual.options.length>n.activeOptionIndex&&o.scrollToIndex(n.activeOptionIndex)}}},o.getVirtualItems().map(l=>{var u;return h.createElement(h.Fragment,{key:l.key},h.cloneElement((u=e.children)==null?void 0:u.call(e,{option:n.virtual.options[l.index],open:n.comboboxState===0}),{key:`${i}-${l.key}`,"data-index":l.index,"aria-setsize":n.virtual.options.length,"aria-posinset":l.index+1,style:{position:"absolute",top:0,left:0,transform:`translateY(${l.start}px)`,overflowAnchor:"none"}}))})))}let Pp=h.createContext(null);Pp.displayName="ComboboxDataContext";function Bo(e){let t=h.useContext(Pp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Bo),n}return t}function ZT(e,t){return Re(t.type,qT,e,t)}let YT=h.Fragment;function XT(e,t){let{value:n,defaultValue:s,onChange:r,form:o,name:i,by:a=null,disabled:l=!1,__demoMode:u=!1,nullable:d=!1,multiple:f=!1,immediate:p=!1,virtual:g=null,...m}=e,v=!1,b=null,[x=f?[]:void 0,y]=Xc(n,r,s),[w,S]=h.useReducer(ZT,{dataRef:h.createRef(),comboboxState:u?0:1,options:[],virtual:null,activeOptionIndex:null,activationTrigger:2,labelId:null}),C=h.useRef(!1),j=h.useRef({static:!1,hold:!1}),E=h.useRef(null),O=h.useRef(null),P=h.useRef(null),T=h.useRef(null),_=re(typeof a=="string"?(Q,ae)=>{let ge=a;return(Q==null?void 0:Q[ge])===(ae==null?void 0:ae[ge])}:a??((Q,ae)=>Q===ae)),L=re(Q=>w.options.findIndex(ae=>_(ae.dataRef.current.value,Q))),N=h.useCallback(Q=>Re(A.mode,{1:()=>x.some(ae=>_(ae,Q)),0:()=>_(x,Q)}),[x]),V=re(Q=>w.activeOptionIndex===L(Q)),A=h.useMemo(()=>({...w,immediate:v,optionsPropsRef:j,labelRef:E,inputRef:O,buttonRef:P,optionsRef:T,value:x,defaultValue:s,disabled:l,mode:f?1:0,virtual:w.virtual,get activeOptionIndex(){if(C.current&&w.activeOptionIndex===null&&w.options.length>0){let Q=w.options.findIndex(ae=>!ae.dataRef.current.disabled);if(Q!==-1)return Q}return w.activeOptionIndex},calculateIndex:L,compare:_,isSelected:N,isActive:V,nullable:d,__demoMode:u}),[x,s,l,f,d,u,w,b]);qe(()=>{},[b,void 0]),qe(()=>{w.dataRef.current=A},[A]),Sp([A.buttonRef,A.inputRef,A.optionsRef],()=>Y.closeCombobox(),A.comboboxState===0);let H=h.useMemo(()=>{var Q,ae,ge;return{open:A.comboboxState===0,disabled:l,activeIndex:A.activeOptionIndex,activeOption:A.activeOptionIndex===null?null:A.virtual?A.virtual.options[(Q=A.activeOptionIndex)!=null?Q:0]:(ge=(ae=A.options[A.activeOptionIndex])==null?void 0:ae.dataRef.current.value)!=null?ge:null,value:x}},[A,l,x]),U=re(()=>{if(A.activeOptionIndex!==null){if(A.virtual)X(A.virtual.options[A.activeOptionIndex]);else{let{dataRef:Q}=A.options[A.activeOptionIndex];X(Q.current.value)}Y.goToOption(Je.Specific,A.activeOptionIndex)}}),D=re(()=>{S({type:0}),C.current=!0}),$=re(()=>{S({type:1}),C.current=!1}),I=re((Q,ae,ge)=>(C.current=!1,Q===Je.Specific?S({type:2,focus:Je.Specific,idx:ae,trigger:ge}):S({type:2,focus:Q,trigger:ge}))),R=re((Q,ae)=>(S({type:3,payload:{id:Q,dataRef:ae}}),()=>{A.isActive(ae.current.value)&&(C.current=!0),S({type:4,id:Q})})),z=re(Q=>(S({type:5,id:Q}),()=>S({type:5,id:null}))),X=re(Q=>Re(A.mode,{0(){return y==null?void 0:y(Q)},1(){let ae=A.value.slice(),ge=ae.findIndex(Ce=>_(Ce,Q));return ge===-1?ae.push(Q):ae.splice(ge,1),y==null?void 0:y(ae)}})),Z=re(Q=>{S({type:6,trigger:Q})}),Y=h.useMemo(()=>({onChange:X,registerOption:R,registerLabel:z,goToOption:I,closeCombobox:$,openCombobox:D,setActivationTrigger:Z,selectActiveOption:U}),[]),J=t===null?{}:{ref:t},ee=h.useRef(null),W=hs();return h.useEffect(()=>{ee.current&&s!==void 0&&W.addEventListener(ee.current,"reset",()=>{y==null||y(s)})},[ee,y]),h.createElement(Tp.Provider,{value:Y},h.createElement(Pp.Provider,{value:A},h.createElement(Xa,{value:Re(A.comboboxState,{0:gt.Open,1:gt.Closed})},i!=null&&x!=null&&tu({[i]:x}).map(([Q,ae],ge)=>h.createElement(ms,{features:gs.Hidden,ref:ge===0?Ce=>{var Se;ee.current=(Se=Ce==null?void 0:Ce.closest("form"))!=null?Se:null}:void 0,...mi({key:Q,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:o,disabled:l,name:Q,value:ae})})),Be({ourProps:J,theirProps:m,slot:H,defaultTag:YT,name:"Combobox"}))))}let JT="input";function QT(e,t){var n,s,r,o,i;let a=Tt(),{id:l=`headlessui-combobox-input-${a}`,onChange:u,displayValue:d,type:f="text",...p}=e,g=Bo("Combobox.Input"),m=Ja("Combobox.Input"),v=Ze(g.inputRef,t),b=Do(g.inputRef),x=h.useRef(!1),y=hs(),w=re(()=>{m.onChange(null),g.optionsRef.current&&(g.optionsRef.current.scrollTop=0),m.goToOption(Je.Nothing)}),S=function(){var A;return typeof d=="function"&&g.value!==void 0?(A=d(g.value))!=null?A:"":typeof g.value=="string"?g.value:""}();_g(([A,H],[U,D])=>{if(x.current)return;let $=g.inputRef.current;$&&((D===0&&H===1||A!==U)&&($.value=A),requestAnimationFrame(()=>{if(x.current||!$||(b==null?void 0:b.activeElement)!==$)return;let{selectionStart:I,selectionEnd:R}=$;Math.abs((R??0)-(I??0))===0&&I===0&&$.setSelectionRange($.value.length,$.value.length)}))},[S,g.comboboxState,b]),_g(([A],[H])=>{if(A===0&&H===1){if(x.current)return;let U=g.inputRef.current;if(!U)return;let D=U.value,{selectionStart:$,selectionEnd:I,selectionDirection:R}=U;U.value="",U.value=D,R!==null?U.setSelectionRange($,I,R):U.setSelectionRange($,I)}},[g.comboboxState]);let C=h.useRef(!1),j=re(()=>{C.current=!0}),E=re(()=>{y.nextFrame(()=>{C.current=!1})}),O=re(A=>{switch(x.current=!0,A.key){case be.Enter:if(x.current=!1,g.comboboxState!==0||C.current)return;if(A.preventDefault(),A.stopPropagation(),g.activeOptionIndex===null){m.closeCombobox();return}m.selectActiveOption(),g.mode===0&&m.closeCombobox();break;case be.ArrowDown:return x.current=!1,A.preventDefault(),A.stopPropagation(),Re(g.comboboxState,{0:()=>m.goToOption(Je.Next),1:()=>m.openCombobox()});case be.ArrowUp:return x.current=!1,A.preventDefault(),A.stopPropagation(),Re(g.comboboxState,{0:()=>m.goToOption(Je.Previous),1:()=>{m.openCombobox(),y.nextFrame(()=>{g.value||m.goToOption(Je.Last)})}});case be.Home:if(A.shiftKey)break;return x.current=!1,A.preventDefault(),A.stopPropagation(),m.goToOption(Je.First);case be.PageUp:return x.current=!1,A.preventDefault(),A.stopPropagation(),m.goToOption(Je.First);case be.End:if(A.shiftKey)break;return x.current=!1,A.preventDefault(),A.stopPropagation(),m.goToOption(Je.Last);case be.PageDown:return x.current=!1,A.preventDefault(),A.stopPropagation(),m.goToOption(Je.Last);case be.Escape:return x.current=!1,g.comboboxState!==0?void 0:(A.preventDefault(),g.optionsRef.current&&!g.optionsPropsRef.current.static&&A.stopPropagation(),g.nullable&&g.mode===0&&g.value===null&&w(),m.closeCombobox());case be.Tab:if(x.current=!1,g.comboboxState!==0)return;g.mode===0&&g.activationTrigger!==1&&m.selectActiveOption(),m.closeCombobox();break}}),P=re(A=>{u==null||u(A),g.nullable&&g.mode===0&&A.target.value===""&&w(),m.openCombobox()}),T=re(A=>{var H,U,D;let $=(H=A.relatedTarget)!=null?H:vo.find(I=>I!==A.currentTarget);if(x.current=!1,!((U=g.optionsRef.current)!=null&&U.contains($))&&!((D=g.buttonRef.current)!=null&&D.contains($))&&g.comboboxState===0)return A.preventDefault(),g.mode===0&&(g.nullable&&g.value===null?w():g.activationTrigger!==1&&m.selectActiveOption()),m.closeCombobox()}),_=re(A=>{var H,U,D;let $=(H=A.relatedTarget)!=null?H:vo.find(I=>I!==A.currentTarget);(U=g.buttonRef.current)!=null&&U.contains($)||(D=g.optionsRef.current)!=null&&D.contains($)||g.disabled||g.immediate&&g.comboboxState!==0&&(m.openCombobox(),y.nextFrame(()=>{m.setActivationTrigger(1)}))}),L=Ya(()=>{if(g.labelId)return[g.labelId].join(" ")},[g.labelId]),N=h.useMemo(()=>({open:g.comboboxState===0,disabled:g.disabled}),[g]),V={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?(s=g.options.find(A=>{var H;return!((H=g.virtual)!=null&&H.disabled(A.dataRef.current.value))&&g.compare(A.dataRef.current.value,g.virtual.options[g.activeOptionIndex])}))==null?void 0:s.id:(r=g.options[g.activeOptionIndex])==null?void 0:r.id,"aria-labelledby":L,"aria-autocomplete":"list",defaultValue:(i=(o=e.defaultValue)!=null?o:g.defaultValue!==void 0?d==null?void 0:d(g.defaultValue):null)!=null?i:g.defaultValue,disabled:g.disabled,onCompositionStart:j,onCompositionEnd:E,onKeyDown:O,onChange:P,onFocus:_,onBlur:T};return Be({ourProps:V,theirProps:p,slot:N,defaultTag:JT,name:"Combobox.Input"})}let e5="button";function t5(e,t){var n;let s=Bo("Combobox.Button"),r=Ja("Combobox.Button"),o=Ze(s.buttonRef,t),i=Tt(),{id:a=`headlessui-combobox-button-${i}`,...l}=e,u=hs(),d=re(v=>{switch(v.key){case be.ArrowDown:return v.preventDefault(),v.stopPropagation(),s.comboboxState===1&&r.openCombobox(),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case be.ArrowUp:return v.preventDefault(),v.stopPropagation(),s.comboboxState===1&&(r.openCombobox(),u.nextFrame(()=>{s.value||r.goToOption(Je.Last)})),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})});case be.Escape:return s.comboboxState!==0?void 0:(v.preventDefault(),s.optionsRef.current&&!s.optionsPropsRef.current.static&&v.stopPropagation(),r.closeCombobox(),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})}));default:return}}),f=re(v=>{if(zr(v.currentTarget))return v.preventDefault();s.comboboxState===0?r.closeCombobox():(v.preventDefault(),r.openCombobox()),u.nextFrame(()=>{var b;return(b=s.inputRef.current)==null?void 0:b.focus({preventScroll:!0})})}),p=Ya(()=>{if(s.labelId)return[s.labelId,a].join(" ")},[s.labelId,a]),g=h.useMemo(()=>({open:s.comboboxState===0,disabled:s.disabled,value:s.value}),[s]),m={ref:o,id:a,type:Ai(e,s.buttonRef),tabIndex:-1,"aria-haspopup":"listbox","aria-controls":(n=s.optionsRef.current)==null?void 0:n.id,"aria-expanded":s.comboboxState===0,"aria-labelledby":p,disabled:s.disabled,onClick:f,onKeyDown:d};return Be({ourProps:m,theirProps:l,slot:g,defaultTag:e5,name:"Combobox.Button"})}let n5="label";function s5(e,t){let n=Tt(),{id:s=`headlessui-combobox-label-${n}`,...r}=e,o=Bo("Combobox.Label"),i=Ja("Combobox.Label"),a=Ze(o.labelRef,t);qe(()=>i.registerLabel(s),[s]);let l=re(()=>{var d;return(d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]);return Be({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:n5,name:"Combobox.Label"})}let r5="ul",o5=Sn.RenderStrategy|Sn.Static;function i5(e,t){let n=Tt(),{id:s=`headlessui-combobox-options-${n}`,hold:r=!1,...o}=e,i=Bo("Combobox.Options"),a=Ze(i.optionsRef,t),l=Fo(),u=l!==null?(l>.Open)===gt.Open:i.comboboxState===0;qe(()=>{var g;i.optionsPropsRef.current.static=(g=e.static)!=null?g:!1},[i.optionsPropsRef,e.static]),qe(()=>{i.optionsPropsRef.current.hold=r},[i.optionsPropsRef,r]),kb({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(g){return g.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:g.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(g){g.setAttribute("role","none")}});let d=Ya(()=>{var g,m;return(m=i.labelId)!=null?m:(g=i.buttonRef.current)==null?void 0:g.id},[i.labelId,i.buttonRef.current]),f=h.useMemo(()=>({open:i.comboboxState===0,option:void 0}),[i]),p={"aria-labelledby":d,role:"listbox","aria-multiselectable":i.mode===1?!0:void 0,id:s,ref:a};return i.virtual&&i.comboboxState===0&&Object.assign(o,{children:h.createElement(KT,null,o.children)}),Be({ourProps:p,theirProps:o,slot:f,defaultTag:r5,features:o5,visible:u,name:"Combobox.Options"})}let a5="li";function l5(e,t){var n;let s=Tt(),{id:r=`headlessui-combobox-option-${s}`,disabled:o=!1,value:i,order:a=null,...l}=e,u=Bo("Combobox.Option"),d=Ja("Combobox.Option"),f=u.virtual?u.activeOptionIndex===u.calculateIndex(i):u.activeOptionIndex===null?!1:((n=u.options[u.activeOptionIndex])==null?void 0:n.id)===r,p=u.isSelected(i),g=h.useRef(null),m=Ht({disabled:o,value:i,domRef:g,order:a}),v=h.useContext(Db),b=Ze(t,g,v?v.measureElement:null),x=re(()=>d.onChange(i));qe(()=>d.registerOption(r,m),[m,r]);let y=h.useRef(!(u.virtual||u.__demoMode));qe(()=>{if(!u.virtual||!u.__demoMode)return;let T=Bs();return T.requestAnimationFrame(()=>{y.current=!0}),T.dispose},[u.virtual,u.__demoMode]),qe(()=>{if(!y.current||u.comboboxState!==0||!f||u.activationTrigger===0)return;let T=Bs();return T.requestAnimationFrame(()=>{var _,L;(L=(_=g.current)==null?void 0:_.scrollIntoView)==null||L.call(_,{block:"nearest"})}),T.dispose},[g,f,u.comboboxState,u.activationTrigger,u.activeOptionIndex]);let w=re(T=>{var _;if(o||(_=u.virtual)!=null&&_.disabled(i))return T.preventDefault();x(),Lb()||requestAnimationFrame(()=>{var L;return(L=u.inputRef.current)==null?void 0:L.focus({preventScroll:!0})}),u.mode===0&&requestAnimationFrame(()=>d.closeCombobox())}),S=re(()=>{var T;if(o||(T=u.virtual)!=null&&T.disabled(i))return d.goToOption(Je.Nothing);let _=u.calculateIndex(i);d.goToOption(Je.Specific,_)}),C=$b(),j=re(T=>C.update(T)),E=re(T=>{var _;if(!C.wasMoved(T)||o||(_=u.virtual)!=null&&_.disabled(i)||f)return;let L=u.calculateIndex(i);d.goToOption(Je.Specific,L,0)}),O=re(T=>{var _;C.wasMoved(T)&&(o||(_=u.virtual)!=null&&_.disabled(i)||f&&(u.optionsPropsRef.current.hold||d.goToOption(Je.Nothing)))}),P=h.useMemo(()=>({active:f,selected:p,disabled:o}),[f,p,o]);return Be({ourProps:{id:r,ref:b,role:"option",tabIndex:o===!0?void 0:-1,"aria-disabled":o===!0?!0:void 0,"aria-selected":p,disabled:void 0,onClick:w,onFocus:S,onPointerEnter:j,onMouseEnter:j,onPointerMove:E,onMouseMove:E,onPointerLeave:O,onMouseLeave:O},theirProps:l,slot:P,defaultTag:a5,name:"Combobox.Option"})}let c5=ze(XT),u5=ze(t5),d5=ze(QT),f5=ze(s5),p5=ze(i5),h5=ze(l5),Xo=Object.assign(c5,{Input:d5,Button:u5,Label:f5,Options:p5,Option:h5});function g5(e,t,n,s){let r=Ht(n);h.useEffect(()=>{e=e??window;function o(i){r.current(i)}return e.addEventListener(t,o,s),()=>e.removeEventListener(t,o,s)},[e,t,s])}function nu(){let e=h.useRef(!1);return qe(()=>(e.current=!0,()=>{e.current=!1}),[]),e}function m5(e){let t=re(e),n=h.useRef(!1);h.useEffect(()=>(n.current=!1,()=>{n.current=!0,xp(()=>{n.current&&t()})}),[t])}var ir=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(ir||{});function Fb(){let e=h.useRef(0);return Mb("keydown",t=>{t.key==="Tab"&&(e.current=t.shiftKey?1:0)},!0),e}let v5=h.createContext(!1);function b5(){return h.useContext(v5)}function y5(e){let t=b5(),n=h.useContext(Bb),s=Do(e),[r,o]=h.useState(()=>{if(!t&&n!==null||cr.isServer)return null;let i=s==null?void 0:s.getElementById("headlessui-portal-root");if(i)return i;if(s===null)return null;let a=s.createElement("div");return a.setAttribute("id","headlessui-portal-root"),s.body.appendChild(a)});return h.useEffect(()=>{r!==null&&(s!=null&&s.body.contains(r)||s==null||s.body.appendChild(r))},[r,s]),h.useEffect(()=>{t||n!==null&&o(n.current)},[n,o,t]),r}let x5=h.Fragment;function w5(e,t){let n=e,s=h.useRef(null),r=Ze(Cp(d=>{s.current=d}),t),o=Do(s),i=y5(s),[a]=h.useState(()=>{var d;return cr.isServer?null:(d=o==null?void 0:o.createElement("div"))!=null?d:null}),l=h.useContext(mf),u=Jc();return qe(()=>{!i||!a||i.contains(a)||(a.setAttribute("data-headlessui-portal",""),i.appendChild(a))},[i,a]),qe(()=>{if(a&&l)return l.register(a)},[l,a]),m5(()=>{var d;!i||!a||(a instanceof Node&&i.contains(a)&&i.removeChild(a),i.childNodes.length<=0&&((d=i.parentElement)==null||d.removeChild(i)))}),u?!i||!a?null:Gn.createPortal(Be({ourProps:{ref:r},theirProps:n,defaultTag:x5,name:"Portal"}),a):null}let S5=h.Fragment,Bb=h.createContext(null);function C5(e,t){let{target:n,...s}=e,r={ref:Ze(t)};return h.createElement(Bb.Provider,{value:n},Be({ourProps:r,theirProps:s,defaultTag:S5,name:"Popover.Group"}))}let mf=h.createContext(null);function j5(){let e=h.useContext(mf),t=h.useRef([]),n=re(o=>(t.current.push(o),e&&e.register(o),()=>s(o))),s=re(o=>{let i=t.current.indexOf(o);i!==-1&&t.current.splice(i,1),e&&e.unregister(o)}),r=h.useMemo(()=>({register:n,unregister:s,portals:t}),[n,s,t]);return[t,h.useMemo(()=>function({children:o}){return h.createElement(mf.Provider,{value:r},o)},[r])]}let E5=ze(w5),T5=ze(C5);Object.assign(E5,{Group:T5});function P5({defaultContainers:e=[],portals:t,mainTreeNodeRef:n}={}){var s;let r=h.useRef((s=n==null?void 0:n.current)!=null?s:null),o=Do(r),i=re(()=>{var a,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(a=o==null?void 0:o.querySelectorAll("html > *, body > *"))!=null?a:[])f!==document.body&&f!==document.head&&f instanceof HTMLElement&&f.id!=="headlessui-portal-root"&&(f.contains(r.current)||f.contains((u=(l=r.current)==null?void 0:l.getRootNode())==null?void 0:u.host)||d.some(p=>f.contains(p))||d.push(f));return d});return{resolveContainers:i,contains:re(a=>i().some(l=>l.contains(a))),mainTreeNodeRef:r,MainTreeNode:h.useMemo(()=>function(){return n!=null?null:h.createElement(ms,{features:gs.Hidden,ref:r})},[r,n])}}function O5(){let e=h.useRef(null);return{mainTreeNodeRef:e,MainTreeNode:h.useMemo(()=>function(){return h.createElement(ms,{features:gs.Hidden,ref:e})},[e])}}let zb=h.createContext(null);function Ub(){let e=h.useContext(zb);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,Ub),t}return e}function Op(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let s=re(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=h.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return h.createElement(zb.Provider,{value:r},n.children)},[t])]}let _5="p";function A5(e,t){let n=Tt(),{id:s=`headlessui-description-${n}`,...r}=e,o=Ub(),i=Ze(t);qe(()=>o.register(s),[s,o.register]);let a={ref:i,...o.props,id:s};return Be({ourProps:a,theirProps:r,slot:o.slot||{},defaultTag:_5,name:o.name||"Description"})}let L5=ze(A5),Wb=Object.assign(L5,{});var Ag;let M5=(Ag=h.startTransition)!=null?Ag:function(e){e()};var N5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(N5||{}),$5=(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))($5||{});let k5={0:e=>({...e,disclosureState:Re(e.disclosureState,{0:1,1:0})}),1:e=>e.disclosureState===1?e:{...e,disclosureState:1},4(e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},5(e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},2(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},3(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},_p=h.createContext(null);_p.displayName="DisclosureContext";function Ap(e){let t=h.useContext(_p);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ap),n}return t}let Lp=h.createContext(null);Lp.displayName="DisclosureAPIContext";function Gb(e){let t=h.useContext(Lp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Disclosure /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Gb),n}return t}let Mp=h.createContext(null);Mp.displayName="DisclosurePanelContext";function R5(){return h.useContext(Mp)}function I5(e,t){return Re(t.type,k5,e,t)}let V5=h.Fragment;function H5(e,t){let{defaultOpen:n=!1,...s}=e,r=h.useRef(null),o=Ze(t,Cp(b=>{r.current=b},e.as===void 0||e.as===h.Fragment)),i=h.useRef(null),a=h.useRef(null),l=h.useReducer(I5,{disclosureState:n?0:1,linkedPanel:!1,buttonRef:a,panelRef:i,buttonId:null,panelId:null}),[{disclosureState:u,buttonId:d},f]=l,p=re(b=>{f({type:1});let x=Qr(r);if(!x||!d)return;let y=b?b instanceof HTMLElement?b:b.current instanceof HTMLElement?b.current:x.getElementById(d):x.getElementById(d);y==null||y.focus()}),g=h.useMemo(()=>({close:p}),[p]),m=h.useMemo(()=>({open:u===0,close:p}),[u,p]),v={ref:o};return h.createElement(_p.Provider,{value:l},h.createElement(Lp.Provider,{value:g},h.createElement(Xa,{value:Re(u,{0:gt.Open,1:gt.Closed})},Be({ourProps:v,theirProps:s,slot:m,defaultTag:V5,name:"Disclosure"}))))}let D5="button";function F5(e,t){let n=Tt(),{id:s=`headlessui-disclosure-button-${n}`,...r}=e,[o,i]=Ap("Disclosure.Button"),a=R5(),l=a===null?!1:a===o.panelId,u=h.useRef(null),d=Ze(u,t,l?null:o.buttonRef),f=jp();h.useEffect(()=>{if(!l)return i({type:2,buttonId:s}),()=>{i({type:2,buttonId:null})}},[s,i,l]);let p=re(y=>{var w;if(l){if(o.disclosureState===1)return;switch(y.key){case be.Space:case be.Enter:y.preventDefault(),y.stopPropagation(),i({type:0}),(w=o.buttonRef.current)==null||w.focus();break}}else switch(y.key){case be.Space:case be.Enter:y.preventDefault(),y.stopPropagation(),i({type:0});break}}),g=re(y=>{switch(y.key){case be.Space:y.preventDefault();break}}),m=re(y=>{var w;zr(y.currentTarget)||e.disabled||(l?(i({type:0}),(w=o.buttonRef.current)==null||w.focus()):i({type:0}))}),v=h.useMemo(()=>({open:o.disclosureState===0}),[o]),b=Ai(e,u),x=l?{ref:d,type:b,onKeyDown:p,onClick:m}:{ref:d,id:s,type:b,"aria-expanded":o.disclosureState===0,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:p,onKeyUp:g,onClick:m};return Be({mergeRefs:f,ourProps:x,theirProps:r,slot:v,defaultTag:D5,name:"Disclosure.Button"})}let B5="div",z5=Sn.RenderStrategy|Sn.Static;function U5(e,t){let n=Tt(),{id:s=`headlessui-disclosure-panel-${n}`,...r}=e,[o,i]=Ap("Disclosure.Panel"),{close:a}=Gb("Disclosure.Panel"),l=jp(),u=Ze(t,o.panelRef,m=>{M5(()=>i({type:m?4:5}))});h.useEffect(()=>(i({type:3,panelId:s}),()=>{i({type:3,panelId:null})}),[s,i]);let d=Fo(),f=d!==null?(d>.Open)===gt.Open:o.disclosureState===0,p=h.useMemo(()=>({open:o.disclosureState===0,close:a}),[o,a]),g={ref:u,id:s};return h.createElement(Mp.Provider,{value:o.panelId},Be({mergeRefs:l,ourProps:g,theirProps:r,slot:p,defaultTag:B5,features:z5,visible:f,name:"Disclosure.Panel"}))}let W5=ze(H5),G5=ze(F5),q5=ze(U5),sd=Object.assign(W5,{Button:G5,Panel:q5}),Lg=/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g;function Mg(e){var t,n;let s=(t=e.innerText)!=null?t:"",r=e.cloneNode(!0);if(!(r instanceof HTMLElement))return s;let o=!1;for(let a of r.querySelectorAll('[hidden],[aria-hidden],[role="img"]'))a.remove(),o=!0;let i=o?(n=r.innerText)!=null?n:"":s;return Lg.test(i)&&(i=i.replace(Lg,"")),i}function K5(e){let t=e.getAttribute("aria-label");if(typeof t=="string")return t.trim();let n=e.getAttribute("aria-labelledby");if(n){let s=n.split(" ").map(r=>{let o=document.getElementById(r);if(o){let i=o.getAttribute("aria-label");return typeof i=="string"?i.trim():Mg(o).trim()}return null}).filter(Boolean);if(s.length>0)return s.join(", ")}return Mg(e).trim()}function Z5(e){let t=h.useRef(""),n=h.useRef("");return re(()=>{let s=e.current;if(!s)return"";let r=s.innerText;if(t.current===r)return n.current;let o=K5(s).trim().toLowerCase();return t.current=r,n.current=o,o})}var Y5=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(Y5||{}),X5=(e=>(e[e.Single=0]="Single",e[e.Multi=1]="Multi",e))(X5||{}),J5=(e=>(e[e.Pointer=0]="Pointer",e[e.Other=1]="Other",e))(J5||{}),Q5=(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))(Q5||{});function rd(e,t=n=>n){let n=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,s=or(t(e.options.slice()),o=>o.dataRef.current.domRef.current),r=n?s.indexOf(n):null;return r===-1&&(r=null),{options:s,activeOptionIndex:r}}let eP={1(e){return e.dataRef.current.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},0(e){if(e.dataRef.current.disabled||e.listboxState===0)return e;let t=e.activeOptionIndex,{isSelected:n}=e.dataRef.current,s=e.options.findIndex(r=>n(r.dataRef.current.value));return s!==-1&&(t=s),{...e,listboxState:0,activeOptionIndex:t}},2(e,t){var n;if(e.dataRef.current.disabled||e.listboxState===1)return e;let s=rd(e),r=gf(t,{resolveItems:()=>s.options,resolveActiveIndex:()=>s.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return{...e,...s,searchQuery:"",activeOptionIndex:r,activationTrigger:(n=t.trigger)!=null?n:1}},3:(e,t)=>{if(e.dataRef.current.disabled||e.listboxState===1)return e;let n=e.searchQuery!==""?0:1,s=e.searchQuery+t.value.toLowerCase(),r=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+n).concat(e.options.slice(0,e.activeOptionIndex+n)):e.options).find(i=>{var a;return!i.dataRef.current.disabled&&((a=i.dataRef.current.textValue)==null?void 0:a.startsWith(s))}),o=r?e.options.indexOf(r):-1;return o===-1||o===e.activeOptionIndex?{...e,searchQuery:s}:{...e,searchQuery:s,activeOptionIndex:o,activationTrigger:1}},4(e){return e.dataRef.current.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},5:(e,t)=>{let n={id:t.id,dataRef:t.dataRef},s=rd(e,r=>[...r,n]);return e.activeOptionIndex===null&&e.dataRef.current.isSelected(t.dataRef.current.value)&&(s.activeOptionIndex=s.options.indexOf(n)),{...e,...s}},6:(e,t)=>{let n=rd(e,s=>{let r=s.findIndex(o=>o.id===t.id);return r!==-1&&s.splice(r,1),s});return{...e,...n,activationTrigger:1}},7:(e,t)=>({...e,labelId:t.id})},Np=h.createContext(null);Np.displayName="ListboxActionsContext";function Qa(e){let t=h.useContext(Np);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Qa),n}return t}let $p=h.createContext(null);$p.displayName="ListboxDataContext";function el(e){let t=h.useContext($p);if(t===null){let n=new Error(`<${e} /> is missing a parent <Listbox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,el),n}return t}function tP(e,t){return Re(t.type,eP,e,t)}let nP=h.Fragment;function sP(e,t){let{value:n,defaultValue:s,form:r,name:o,onChange:i,by:a=(Z,Y)=>Z===Y,disabled:l=!1,horizontal:u=!1,multiple:d=!1,...f}=e;const p=u?"horizontal":"vertical";let g=Ze(t),[m=d?[]:void 0,v]=Xc(n,i,s),[b,x]=h.useReducer(tP,{dataRef:h.createRef(),listboxState:1,options:[],searchQuery:"",labelId:null,activeOptionIndex:null,activationTrigger:1}),y=h.useRef({static:!1,hold:!1}),w=h.useRef(null),S=h.useRef(null),C=h.useRef(null),j=re(typeof a=="string"?(Z,Y)=>{let J=a;return(Z==null?void 0:Z[J])===(Y==null?void 0:Y[J])}:a),E=h.useCallback(Z=>Re(O.mode,{1:()=>m.some(Y=>j(Y,Z)),0:()=>j(m,Z)}),[m]),O=h.useMemo(()=>({...b,value:m,disabled:l,mode:d?1:0,orientation:p,compare:j,isSelected:E,optionsPropsRef:y,labelRef:w,buttonRef:S,optionsRef:C}),[m,l,d,b]);qe(()=>{b.dataRef.current=O},[O]),Sp([O.buttonRef,O.optionsRef],(Z,Y)=>{var J;x({type:1}),wp(Y,eu.Loose)||(Z.preventDefault(),(J=O.buttonRef.current)==null||J.focus())},O.listboxState===0);let P=h.useMemo(()=>({open:O.listboxState===0,disabled:l,value:m}),[O,l,m]),T=re(Z=>{let Y=O.options.find(J=>J.id===Z);Y&&U(Y.dataRef.current.value)}),_=re(()=>{if(O.activeOptionIndex!==null){let{dataRef:Z,id:Y}=O.options[O.activeOptionIndex];U(Z.current.value),x({type:2,focus:Je.Specific,id:Y})}}),L=re(()=>x({type:0})),N=re(()=>x({type:1})),V=re((Z,Y,J)=>Z===Je.Specific?x({type:2,focus:Je.Specific,id:Y,trigger:J}):x({type:2,focus:Z,trigger:J})),A=re((Z,Y)=>(x({type:5,id:Z,dataRef:Y}),()=>x({type:6,id:Z}))),H=re(Z=>(x({type:7,id:Z}),()=>x({type:7,id:null}))),U=re(Z=>Re(O.mode,{0(){return v==null?void 0:v(Z)},1(){let Y=O.value.slice(),J=Y.findIndex(ee=>j(ee,Z));return J===-1?Y.push(Z):Y.splice(J,1),v==null?void 0:v(Y)}})),D=re(Z=>x({type:3,value:Z})),$=re(()=>x({type:4})),I=h.useMemo(()=>({onChange:U,registerOption:A,registerLabel:H,goToOption:V,closeListbox:N,openListbox:L,selectActiveOption:_,selectOption:T,search:D,clearSearch:$}),[]),R={ref:g},z=h.useRef(null),X=hs();return h.useEffect(()=>{z.current&&s!==void 0&&X.addEventListener(z.current,"reset",()=>{v==null||v(s)})},[z,v]),h.createElement(Np.Provider,{value:I},h.createElement($p.Provider,{value:O},h.createElement(Xa,{value:Re(O.listboxState,{0:gt.Open,1:gt.Closed})},o!=null&&m!=null&&tu({[o]:m}).map(([Z,Y],J)=>h.createElement(ms,{features:gs.Hidden,ref:J===0?ee=>{var W;z.current=(W=ee==null?void 0:ee.closest("form"))!=null?W:null}:void 0,...mi({key:Z,as:"input",type:"hidden",hidden:!0,readOnly:!0,form:r,disabled:l,name:Z,value:Y})})),Be({ourProps:R,theirProps:f,slot:P,defaultTag:nP,name:"Listbox"}))))}let rP="button";function oP(e,t){var n;let s=Tt(),{id:r=`headlessui-listbox-button-${s}`,...o}=e,i=el("Listbox.Button"),a=Qa("Listbox.Button"),l=Ze(i.buttonRef,t),u=hs(),d=re(b=>{switch(b.key){case be.Space:case be.Enter:case be.ArrowDown:b.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(Je.First)});break;case be.ArrowUp:b.preventDefault(),a.openListbox(),u.nextFrame(()=>{i.value||a.goToOption(Je.Last)});break}}),f=re(b=>{switch(b.key){case be.Space:b.preventDefault();break}}),p=re(b=>{if(zr(b.currentTarget))return b.preventDefault();i.listboxState===0?(a.closeListbox(),u.nextFrame(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.focus({preventScroll:!0})})):(b.preventDefault(),a.openListbox())}),g=Ya(()=>{if(i.labelId)return[i.labelId,r].join(" ")},[i.labelId,r]),m=h.useMemo(()=>({open:i.listboxState===0,disabled:i.disabled,value:i.value}),[i]),v={ref:l,id:r,type:Ai(e,i.buttonRef),"aria-haspopup":"listbox","aria-controls":(n=i.optionsRef.current)==null?void 0:n.id,"aria-expanded":i.listboxState===0,"aria-labelledby":g,disabled:i.disabled,onKeyDown:d,onKeyUp:f,onClick:p};return Be({ourProps:v,theirProps:o,slot:m,defaultTag:rP,name:"Listbox.Button"})}let iP="label";function aP(e,t){let n=Tt(),{id:s=`headlessui-listbox-label-${n}`,...r}=e,o=el("Listbox.Label"),i=Qa("Listbox.Label"),a=Ze(o.labelRef,t);qe(()=>i.registerLabel(s),[s]);let l=re(()=>{var d;return(d=o.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})}),u=h.useMemo(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]);return Be({ourProps:{ref:a,id:s,onClick:l},theirProps:r,slot:u,defaultTag:iP,name:"Listbox.Label"})}let lP="ul",cP=Sn.RenderStrategy|Sn.Static;function uP(e,t){var n;let s=Tt(),{id:r=`headlessui-listbox-options-${s}`,...o}=e,i=el("Listbox.Options"),a=Qa("Listbox.Options"),l=Ze(i.optionsRef,t),u=hs(),d=hs(),f=Fo(),p=f!==null?(f>.Open)===gt.Open:i.listboxState===0;h.useEffect(()=>{var x;let y=i.optionsRef.current;y&&i.listboxState===0&&y!==((x=Qr(y))==null?void 0:x.activeElement)&&y.focus({preventScroll:!0})},[i.listboxState,i.optionsRef]);let g=re(x=>{switch(d.dispose(),x.key){case be.Space:if(i.searchQuery!=="")return x.preventDefault(),x.stopPropagation(),a.search(x.key);case be.Enter:if(x.preventDefault(),x.stopPropagation(),i.activeOptionIndex!==null){let{dataRef:y}=i.options[i.activeOptionIndex];a.onChange(y.current.value)}i.mode===0&&(a.closeListbox(),Bs().nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})}));break;case Re(i.orientation,{vertical:be.ArrowDown,horizontal:be.ArrowRight}):return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.Next);case Re(i.orientation,{vertical:be.ArrowUp,horizontal:be.ArrowLeft}):return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.Previous);case be.Home:case be.PageUp:return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.First);case be.End:case be.PageDown:return x.preventDefault(),x.stopPropagation(),a.goToOption(Je.Last);case be.Escape:return x.preventDefault(),x.stopPropagation(),a.closeListbox(),u.nextFrame(()=>{var y;return(y=i.buttonRef.current)==null?void 0:y.focus({preventScroll:!0})});case be.Tab:x.preventDefault(),x.stopPropagation();break;default:x.key.length===1&&(a.search(x.key),d.setTimeout(()=>a.clearSearch(),350));break}}),m=Ya(()=>{var x;return(x=i.buttonRef.current)==null?void 0:x.id},[i.buttonRef.current]),v=h.useMemo(()=>({open:i.listboxState===0}),[i]),b={"aria-activedescendant":i.activeOptionIndex===null||(n=i.options[i.activeOptionIndex])==null?void 0:n.id,"aria-multiselectable":i.mode===1?!0:void 0,"aria-labelledby":m,"aria-orientation":i.orientation,id:r,onKeyDown:g,role:"listbox",tabIndex:0,ref:l};return Be({ourProps:b,theirProps:o,slot:v,defaultTag:lP,features:cP,visible:p,name:"Listbox.Options"})}let dP="li";function fP(e,t){let n=Tt(),{id:s=`headlessui-listbox-option-${n}`,disabled:r=!1,value:o,...i}=e,a=el("Listbox.Option"),l=Qa("Listbox.Option"),u=a.activeOptionIndex!==null?a.options[a.activeOptionIndex].id===s:!1,d=a.isSelected(o),f=h.useRef(null),p=Z5(f),g=Ht({disabled:r,value:o,domRef:f,get textValue(){return p()}}),m=Ze(t,f);qe(()=>{if(a.listboxState!==0||!u||a.activationTrigger===0)return;let j=Bs();return j.requestAnimationFrame(()=>{var E,O;(O=(E=f.current)==null?void 0:E.scrollIntoView)==null||O.call(E,{block:"nearest"})}),j.dispose},[f,u,a.listboxState,a.activationTrigger,a.activeOptionIndex]),qe(()=>l.registerOption(s,g),[g,s]);let v=re(j=>{if(r)return j.preventDefault();l.onChange(o),a.mode===0&&(l.closeListbox(),Bs().nextFrame(()=>{var E;return(E=a.buttonRef.current)==null?void 0:E.focus({preventScroll:!0})}))}),b=re(()=>{if(r)return l.goToOption(Je.Nothing);l.goToOption(Je.Specific,s)}),x=$b(),y=re(j=>x.update(j)),w=re(j=>{x.wasMoved(j)&&(r||u||l.goToOption(Je.Specific,s,0))}),S=re(j=>{x.wasMoved(j)&&(r||u&&l.goToOption(Je.Nothing))}),C=h.useMemo(()=>({active:u,selected:d,disabled:r}),[u,d,r]);return Be({ourProps:{id:s,ref:m,role:"option",tabIndex:r===!0?void 0:-1,"aria-disabled":r===!0?!0:void 0,"aria-selected":d,disabled:void 0,onClick:v,onFocus:b,onPointerEnter:y,onMouseEnter:y,onPointerMove:w,onMouseMove:w,onPointerLeave:S,onMouseLeave:S},theirProps:i,slot:C,defaultTag:dP,name:"Listbox.Option"})}let pP=ze(sP),hP=ze(oP),gP=ze(aP),mP=ze(uP),vP=ze(fP),Bi=Object.assign(pP,{Button:hP,Label:gP,Options:mP,Option:vP});var bP=(e=>(e[e.Open=0]="Open",e[e.Closed=1]="Closed",e))(bP||{}),yP=(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))(yP||{});let xP={0:e=>{let t={...e,popoverState:Re(e.popoverState,{0:1,1:0})};return t.popoverState===0&&(t.__demoMode=!1),t},1(e){return e.popoverState===1?e:{...e,popoverState:1}},2(e,t){return e.button===t.button?e:{...e,button:t.button}},3(e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},4(e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},5(e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},kp=h.createContext(null);kp.displayName="PopoverContext";function su(e){let t=h.useContext(kp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,su),n}return t}let Rp=h.createContext(null);Rp.displayName="PopoverAPIContext";function Ip(e){let t=h.useContext(Rp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Popover /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Ip),n}return t}let Vp=h.createContext(null);Vp.displayName="PopoverGroupContext";function qb(){return h.useContext(Vp)}let ru=h.createContext(null);ru.displayName="PopoverPanelContext";function wP(){return h.useContext(ru)}function SP(e,t){return Re(t.type,xP,e,t)}let CP="div";function jP(e,t){var n;let{__demoMode:s=!1,...r}=e,o=h.useRef(null),i=Ze(t,Cp(H=>{o.current=H})),a=h.useRef([]),l=h.useReducer(SP,{__demoMode:s,popoverState:s?0:1,buttons:a,button:null,buttonId:null,panel:null,panelId:null,beforePanelSentinel:h.createRef(),afterPanelSentinel:h.createRef()}),[{popoverState:u,button:d,buttonId:f,panel:p,panelId:g,beforePanelSentinel:m,afterPanelSentinel:v},b]=l,x=Do((n=o.current)!=null?n:d),y=h.useMemo(()=>{if(!d||!p)return!1;for(let z of document.querySelectorAll("body > *"))if(Number(z==null?void 0:z.contains(d))^Number(z==null?void 0:z.contains(p)))return!0;let H=Qc(),U=H.indexOf(d),D=(U+H.length-1)%H.length,$=(U+1)%H.length,I=H[D],R=H[$];return!p.contains(I)&&!p.contains(R)},[d,p]),w=Ht(f),S=Ht(g),C=h.useMemo(()=>({buttonId:w,panelId:S,close:()=>b({type:1})}),[w,S,b]),j=qb(),E=j==null?void 0:j.registerPopover,O=re(()=>{var H;return(H=j==null?void 0:j.isFocusWithinPopoverGroup())!=null?H:(x==null?void 0:x.activeElement)&&((d==null?void 0:d.contains(x.activeElement))||(p==null?void 0:p.contains(x.activeElement)))});h.useEffect(()=>E==null?void 0:E(C),[E,C]);let[P,T]=j5(),_=P5({mainTreeNodeRef:j==null?void 0:j.mainTreeNodeRef,portals:P,defaultContainers:[d,p]});g5(x==null?void 0:x.defaultView,"focus",H=>{var U,D,$,I;H.target!==window&&H.target instanceof HTMLElement&&u===0&&(O()||d&&p&&(_.contains(H.target)||(D=(U=m.current)==null?void 0:U.contains)!=null&&D.call(U,H.target)||(I=($=v.current)==null?void 0:$.contains)!=null&&I.call($,H.target)||b({type:1})))},!0),Sp(_.resolveContainers,(H,U)=>{b({type:1}),wp(U,eu.Loose)||(H.preventDefault(),d==null||d.focus())},u===0);let L=re(H=>{b({type:1});let U=H?H instanceof HTMLElement?H:"current"in H&&H.current instanceof HTMLElement?H.current:d:d;U==null||U.focus()}),N=h.useMemo(()=>({close:L,isPortalled:y}),[L,y]),V=h.useMemo(()=>({open:u===0,close:L}),[u,L]),A={ref:i};return h.createElement(ru.Provider,{value:null},h.createElement(kp.Provider,{value:l},h.createElement(Rp.Provider,{value:N},h.createElement(Xa,{value:Re(u,{0:gt.Open,1:gt.Closed})},h.createElement(T,null,Be({ourProps:A,theirProps:r,slot:V,defaultTag:CP,name:"Popover"}),h.createElement(_.MainTreeNode,null))))))}let EP="button";function TP(e,t){let n=Tt(),{id:s=`headlessui-popover-button-${n}`,...r}=e,[o,i]=su("Popover.Button"),{isPortalled:a}=Ip("Popover.Button"),l=h.useRef(null),u=`headlessui-focus-sentinel-${Tt()}`,d=qb(),f=d==null?void 0:d.closeOthers,p=wP()!==null;h.useEffect(()=>{if(!p)return i({type:3,buttonId:s}),()=>{i({type:3,buttonId:null})}},[p,s,i]);let[g]=h.useState(()=>Symbol()),m=Ze(l,t,p?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."),_&&i({type:2,button:_})}),v=Ze(l,t),b=Do(l),x=re(_=>{var L,N,V;if(p){if(o.popoverState===1)return;switch(_.key){case be.Space:case be.Enter:_.preventDefault(),(N=(L=_.target).click)==null||N.call(L),i({type:1}),(V=o.button)==null||V.focus();break}}else switch(_.key){case be.Space:case be.Enter:_.preventDefault(),_.stopPropagation(),o.popoverState===1&&(f==null||f(o.buttonId)),i({type:0});break;case be.Escape:if(o.popoverState!==0)return f==null?void 0:f(o.buttonId);if(!l.current||b!=null&&b.activeElement&&!l.current.contains(b.activeElement))return;_.preventDefault(),_.stopPropagation(),i({type:1});break}}),y=re(_=>{p||_.key===be.Space&&_.preventDefault()}),w=re(_=>{var L,N;zr(_.currentTarget)||e.disabled||(p?(i({type:1}),(L=o.button)==null||L.focus()):(_.preventDefault(),_.stopPropagation(),o.popoverState===1&&(f==null||f(o.buttonId)),i({type:0}),(N=o.button)==null||N.focus()))}),S=re(_=>{_.preventDefault(),_.stopPropagation()}),C=o.popoverState===0,j=h.useMemo(()=>({open:C}),[C]),E=Ai(e,l),O=p?{ref:v,type:E,onKeyDown:x,onClick:w}:{ref:m,id:o.buttonId,type:E,"aria-expanded":o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:x,onKeyUp:y,onClick:w,onMouseDown:S},P=Fb(),T=re(()=>{let _=o.panel;if(!_)return;function L(){Re(P.current,{[ir.Forwards]:()=>ln(_,At.First),[ir.Backwards]:()=>ln(_,At.Last)})===ks.Error&&ln(Qc().filter(N=>N.dataset.headlessuiFocusGuard!=="true"),Re(P.current,{[ir.Forwards]:At.Next,[ir.Backwards]:At.Previous}),{relativeTo:o.button})}L()});return h.createElement(h.Fragment,null,Be({ourProps:O,theirProps:r,slot:j,defaultTag:EP,name:"Popover.Button"}),C&&!p&&a&&h.createElement(ms,{id:u,features:gs.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:T}))}let PP="div",OP=Sn.RenderStrategy|Sn.Static;function _P(e,t){let n=Tt(),{id:s=`headlessui-popover-overlay-${n}`,...r}=e,[{popoverState:o},i]=su("Popover.Overlay"),a=Ze(t),l=Fo(),u=l!==null?(l>.Open)===gt.Open:o===0,d=re(p=>{if(zr(p.currentTarget))return p.preventDefault();i({type:1})}),f=h.useMemo(()=>({open:o===0}),[o]);return Be({ourProps:{ref:a,id:s,"aria-hidden":!0,onClick:d},theirProps:r,slot:f,defaultTag:PP,features:OP,visible:u,name:"Popover.Overlay"})}let AP="div",LP=Sn.RenderStrategy|Sn.Static;function MP(e,t){let n=Tt(),{id:s=`headlessui-popover-panel-${n}`,focus:r=!1,...o}=e,[i,a]=su("Popover.Panel"),{close:l,isPortalled:u}=Ip("Popover.Panel"),d=`headlessui-focus-sentinel-before-${Tt()}`,f=`headlessui-focus-sentinel-after-${Tt()}`,p=h.useRef(null),g=Ze(p,t,O=>{a({type:4,panel:O})}),m=Do(p),v=jp();qe(()=>(a({type:5,panelId:s}),()=>{a({type:5,panelId:null})}),[s,a]);let b=Fo(),x=b!==null?(b>.Open)===gt.Open:i.popoverState===0,y=re(O=>{var P;switch(O.key){case be.Escape:if(i.popoverState!==0||!p.current||m!=null&&m.activeElement&&!p.current.contains(m.activeElement))return;O.preventDefault(),O.stopPropagation(),a({type:1}),(P=i.button)==null||P.focus();break}});h.useEffect(()=>{var O;e.static||i.popoverState===1&&((O=e.unmount)==null||O)&&a({type:4,panel:null})},[i.popoverState,e.unmount,e.static,a]),h.useEffect(()=>{if(i.__demoMode||!r||i.popoverState!==0||!p.current)return;let O=m==null?void 0:m.activeElement;p.current.contains(O)||ln(p.current,At.First)},[i.__demoMode,r,p,i.popoverState]);let w=h.useMemo(()=>({open:i.popoverState===0,close:l}),[i,l]),S={ref:g,id:s,onKeyDown:y,onBlur:r&&i.popoverState===0?O=>{var P,T,_,L,N;let V=O.relatedTarget;V&&p.current&&((P=p.current)!=null&&P.contains(V)||(a({type:1}),((_=(T=i.beforePanelSentinel.current)==null?void 0:T.contains)!=null&&_.call(T,V)||(N=(L=i.afterPanelSentinel.current)==null?void 0:L.contains)!=null&&N.call(L,V))&&V.focus({preventScroll:!0})))}:void 0,tabIndex:-1},C=Fb(),j=re(()=>{let O=p.current;if(!O)return;function P(){Re(C.current,{[ir.Forwards]:()=>{var T;ln(O,At.First)===ks.Error&&((T=i.afterPanelSentinel.current)==null||T.focus())},[ir.Backwards]:()=>{var T;(T=i.button)==null||T.focus({preventScroll:!0})}})}P()}),E=re(()=>{let O=p.current;if(!O)return;function P(){Re(C.current,{[ir.Forwards]:()=>{var T;if(!i.button)return;let _=Qc(),L=_.indexOf(i.button),N=_.slice(0,L+1),V=[..._.slice(L+1),...N];for(let A of V.slice())if(A.dataset.headlessuiFocusGuard==="true"||(T=i.panel)!=null&&T.contains(A)){let H=V.indexOf(A);H!==-1&&V.splice(H,1)}ln(V,At.First,{sorted:!1})},[ir.Backwards]:()=>{var T;ln(O,At.Previous)===ks.Error&&((T=i.button)==null||T.focus())}})}P()});return h.createElement(ru.Provider,{value:s},x&&u&&h.createElement(ms,{id:d,ref:i.beforePanelSentinel,features:gs.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:j}),Be({mergeRefs:v,ourProps:S,theirProps:o,slot:w,defaultTag:AP,features:LP,visible:x,name:"Popover.Panel"}),x&&u&&h.createElement(ms,{id:f,ref:i.afterPanelSentinel,features:gs.Focusable,"data-headlessui-focus-guard":!0,as:"button",type:"button",onFocus:E}))}let NP="div";function $P(e,t){let n=h.useRef(null),s=Ze(n,t),[r,o]=h.useState([]),i=O5(),a=re(v=>{o(b=>{let x=b.indexOf(v);if(x!==-1){let y=b.slice();return y.splice(x,1),y}return b})}),l=re(v=>(o(b=>[...b,v]),()=>a(v))),u=re(()=>{var v;let b=Qr(n);if(!b)return!1;let x=b.activeElement;return(v=n.current)!=null&&v.contains(x)?!0:r.some(y=>{var w,S;return((w=b.getElementById(y.buttonId.current))==null?void 0:w.contains(x))||((S=b.getElementById(y.panelId.current))==null?void 0:S.contains(x))})}),d=re(v=>{for(let b of r)b.buttonId.current!==v&&b.close()}),f=h.useMemo(()=>({registerPopover:l,unregisterPopover:a,isFocusWithinPopoverGroup:u,closeOthers:d,mainTreeNodeRef:i.mainTreeNodeRef}),[l,a,u,d,i.mainTreeNodeRef]),p=h.useMemo(()=>({}),[]),g=e,m={ref:s};return h.createElement(Vp.Provider,{value:f},Be({ourProps:m,theirProps:g,slot:p,defaultTag:NP,name:"Popover.Group"}),h.createElement(i.MainTreeNode,null))}let kP=ze(jP),RP=ze(TP),IP=ze(_P),VP=ze(MP),HP=ze($P),od=Object.assign(kP,{Button:RP,Overlay:IP,Panel:VP,Group:HP}),Kb=h.createContext(null);function Zb(){let e=h.useContext(Kb);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,Zb),t}return e}function Hp(){let[e,t]=h.useState([]);return[e.length>0?e.join(" "):void 0,h.useMemo(()=>function(n){let s=re(o=>(t(i=>[...i,o]),()=>t(i=>{let a=i.slice(),l=a.indexOf(o);return l!==-1&&a.splice(l,1),a}))),r=h.useMemo(()=>({register:s,slot:n.slot,name:n.name,props:n.props}),[s,n.slot,n.name,n.props]);return h.createElement(Kb.Provider,{value:r},n.children)},[t])]}let DP="label";function FP(e,t){let n=Tt(),{id:s=`headlessui-label-${n}`,passive:r=!1,...o}=e,i=Zb(),a=Ze(t);qe(()=>i.register(s),[s,i.register]);let l={ref:a,...i.props,id:s};return r&&("onClick"in l&&(delete l.htmlFor,delete l.onClick),"onClick"in o&&delete o.onClick),Be({ourProps:l,theirProps:o,slot:i.slot||{},defaultTag:DP,name:i.name||"Label"})}let BP=ze(FP),Yb=Object.assign(BP,{});function Xb(e=0){let[t,n]=h.useState(e),s=nu(),r=h.useCallback(l=>{s.current&&n(u=>u|l)},[t,s]),o=h.useCallback(l=>!!(t&l),[t]),i=h.useCallback(l=>{s.current&&n(u=>u&~l)},[n,s]),a=h.useCallback(l=>{s.current&&n(u=>u^l)},[n]);return{flags:t,addFlag:r,hasFlag:o,removeFlag:i,toggleFlag:a}}var zP=(e=>(e[e.RegisterOption=0]="RegisterOption",e[e.UnregisterOption=1]="UnregisterOption",e))(zP||{});let UP={0(e,t){let n=[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}];return{...e,options:or(n,s=>s.element.current)}},1(e,t){let n=e.options.slice(),s=e.options.findIndex(r=>r.id===t.id);return s===-1?e:(n.splice(s,1),{...e,options:n})}},Dp=h.createContext(null);Dp.displayName="RadioGroupDataContext";function Jb(e){let t=h.useContext(Dp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Jb),n}return t}let Fp=h.createContext(null);Fp.displayName="RadioGroupActionsContext";function Qb(e){let t=h.useContext(Fp);if(t===null){let n=new Error(`<${e} /> is missing a parent <RadioGroup /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Qb),n}return t}function WP(e,t){return Re(t.type,UP,e,t)}let GP="div";function qP(e,t){let n=Tt(),{id:s=`headlessui-radiogroup-${n}`,value:r,defaultValue:o,form:i,name:a,onChange:l,by:u=($,I)=>$===I,disabled:d=!1,...f}=e,p=re(typeof u=="string"?($,I)=>{let R=u;return($==null?void 0:$[R])===(I==null?void 0:I[R])}:u),[g,m]=h.useReducer(WP,{options:[]}),v=g.options,[b,x]=Hp(),[y,w]=Op(),S=h.useRef(null),C=Ze(S,t),[j,E]=Xc(r,l,o),O=h.useMemo(()=>v.find($=>!$.propsRef.current.disabled),[v]),P=h.useMemo(()=>v.some($=>p($.propsRef.current.value,j)),[v,j]),T=re($=>{var I;if(d||p($,j))return!1;let R=(I=v.find(z=>p(z.propsRef.current.value,$)))==null?void 0:I.propsRef.current;return R!=null&&R.disabled?!1:(E==null||E($),!0)});kb({container:S.current,accept($){return $.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:$.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk($){$.setAttribute("role","none")}});let _=re($=>{let I=S.current;if(!I)return;let R=Qr(I),z=v.filter(X=>X.propsRef.current.disabled===!1).map(X=>X.element.current);switch($.key){case be.Enter:Hb($.currentTarget);break;case be.ArrowLeft:case be.ArrowUp:if($.preventDefault(),$.stopPropagation(),ln(z,At.Previous|At.WrapAround)===ks.Success){let X=v.find(Z=>Z.element.current===(R==null?void 0:R.activeElement));X&&T(X.propsRef.current.value)}break;case be.ArrowRight:case be.ArrowDown:if($.preventDefault(),$.stopPropagation(),ln(z,At.Next|At.WrapAround)===ks.Success){let X=v.find(Z=>Z.element.current===(R==null?void 0:R.activeElement));X&&T(X.propsRef.current.value)}break;case be.Space:{$.preventDefault(),$.stopPropagation();let X=v.find(Z=>Z.element.current===(R==null?void 0:R.activeElement));X&&T(X.propsRef.current.value)}break}}),L=re($=>(m({type:0,...$}),()=>m({type:1,id:$.id}))),N=h.useMemo(()=>({value:j,firstOption:O,containsCheckedOption:P,disabled:d,compare:p,...g}),[j,O,P,d,p,g]),V=h.useMemo(()=>({registerOption:L,change:T}),[L,T]),A={ref:C,id:s,role:"radiogroup","aria-labelledby":b,"aria-describedby":y,onKeyDown:_},H=h.useMemo(()=>({value:j}),[j]),U=h.useRef(null),D=hs();return h.useEffect(()=>{U.current&&o!==void 0&&D.addEventListener(U.current,"reset",()=>{T(o)})},[U,T]),h.createElement(w,{name:"RadioGroup.Description"},h.createElement(x,{name:"RadioGroup.Label"},h.createElement(Fp.Provider,{value:V},h.createElement(Dp.Provider,{value:N},a!=null&&j!=null&&tu({[a]:j}).map(([$,I],R)=>h.createElement(ms,{features:gs.Hidden,ref:R===0?z=>{var X;U.current=(X=z==null?void 0:z.closest("form"))!=null?X:null}:void 0,...mi({key:$,as:"input",type:"radio",checked:I!=null,hidden:!0,readOnly:!0,form:i,disabled:d,name:$,value:I})})),Be({ourProps:A,theirProps:f,slot:H,defaultTag:GP,name:"RadioGroup"})))))}var KP=(e=>(e[e.Empty=1]="Empty",e[e.Active=2]="Active",e))(KP||{});let ZP="div";function YP(e,t){var n;let s=Tt(),{id:r=`headlessui-radiogroup-option-${s}`,value:o,disabled:i=!1,...a}=e,l=h.useRef(null),u=Ze(l,t),[d,f]=Hp(),[p,g]=Op(),{addFlag:m,removeFlag:v,hasFlag:b}=Xb(1),x=Ht({value:o,disabled:i}),y=Jb("RadioGroup.Option"),w=Qb("RadioGroup.Option");qe(()=>w.registerOption({id:r,element:l,propsRef:x}),[r,w,l,x]);let S=re(L=>{var N;if(zr(L.currentTarget))return L.preventDefault();w.change(o)&&(m(2),(N=l.current)==null||N.focus())}),C=re(L=>{if(zr(L.currentTarget))return L.preventDefault();m(2)}),j=re(()=>v(2)),E=((n=y.firstOption)==null?void 0:n.id)===r,O=y.disabled||i,P=y.compare(y.value,o),T={ref:u,id:r,role:"radio","aria-checked":P?"true":"false","aria-labelledby":d,"aria-describedby":p,"aria-disabled":O?!0:void 0,tabIndex:O?-1:P||!y.containsCheckedOption&&E?0:-1,onClick:O?void 0:S,onFocus:O?void 0:C,onBlur:O?void 0:j},_=h.useMemo(()=>({checked:P,disabled:O,active:b(2)}),[P,O,b]);return h.createElement(g,{name:"RadioGroup.Description"},h.createElement(f,{name:"RadioGroup.Label"},Be({ourProps:T,theirProps:a,slot:_,defaultTag:ZP,name:"RadioGroup.Option"})))}let XP=ze(qP),JP=ze(YP),Ng=Object.assign(XP,{Option:JP,Label:Yb,Description:Wb}),Bp=h.createContext(null);Bp.displayName="GroupContext";let QP=h.Fragment;function eO(e){var t;let[n,s]=h.useState(null),[r,o]=Hp(),[i,a]=Op(),l=h.useMemo(()=>({switch:n,setSwitch:s,labelledby:r,describedby:i}),[n,s,r,i]),u={},d=e;return h.createElement(a,{name:"Switch.Description"},h.createElement(o,{name:"Switch.Label",props:{htmlFor:(t=l.switch)==null?void 0:t.id,onClick(f){n&&(f.currentTarget.tagName==="LABEL"&&f.preventDefault(),n.click(),n.focus({preventScroll:!0}))}}},h.createElement(Bp.Provider,{value:l},Be({ourProps:u,theirProps:d,defaultTag:QP,name:"Switch.Group"}))))}let tO="button";function nO(e,t){var n;let s=Tt(),{id:r=`headlessui-switch-${s}`,checked:o,defaultChecked:i=!1,onChange:a,disabled:l=!1,name:u,value:d,form:f,...p}=e,g=h.useContext(Bp),m=h.useRef(null),v=Ze(m,t,g===null?null:g.setSwitch),[b,x]=Xc(o,a,i),y=re(()=>x==null?void 0:x(!b)),w=re(P=>{if(zr(P.currentTarget))return P.preventDefault();P.preventDefault(),y()}),S=re(P=>{P.key===be.Space?(P.preventDefault(),y()):P.key===be.Enter&&Hb(P.currentTarget)}),C=re(P=>P.preventDefault()),j=h.useMemo(()=>({checked:b}),[b]),E={id:r,ref:v,role:"switch",type:Ai(e,m),tabIndex:e.tabIndex===-1?0:(n=e.tabIndex)!=null?n:0,"aria-checked":b,"aria-labelledby":g==null?void 0:g.labelledby,"aria-describedby":g==null?void 0:g.describedby,disabled:l,onClick:w,onKeyUp:S,onKeyPress:C},O=hs();return h.useEffect(()=>{var P;let T=(P=m.current)==null?void 0:P.closest("form");T&&i!==void 0&&O.addEventListener(T,"reset",()=>{x(i)})},[m,x]),h.createElement(h.Fragment,null,u!=null&&b&&h.createElement(ms,{features:gs.Hidden,...mi({as:"input",type:"checkbox",hidden:!0,readOnly:!0,disabled:l,form:f,checked:b,name:u,value:d})}),Be({ourProps:E,theirProps:p,slot:j,defaultTag:tO,name:"Switch"}))}let sO=ze(nO),rO=eO,id=Object.assign(sO,{Group:rO,Label:Yb,Description:Wb});function oO({onFocus:e}){let[t,n]=h.useState(!0),s=nu();return t?h.createElement(ms,{as:"button",type:"button",features:gs.Focusable,onFocus:r=>{r.preventDefault();let o,i=50;function a(){if(i--<=0){o&&cancelAnimationFrame(o);return}if(e()){if(cancelAnimationFrame(o),!s.current)return;n(!1);return}o=requestAnimationFrame(a)}o=requestAnimationFrame(a)}}):null}const e0=rt.createContext(null);function iO(){return{groups:new Map,get(e,t){var n;let s=this.groups.get(e);s||(s=new Map,this.groups.set(e,s));let r=(n=s.get(t))!=null?n:0;s.set(t,r+1);let o=Array.from(s.keys()).indexOf(t);function i(){let a=s.get(t);a>1?s.set(t,a-1):s.delete(t)}return[o,i]}}}function aO({children:e}){let t=rt.useRef(iO());return rt.createElement(e0.Provider,{value:t},e)}function t0(e){let t=rt.useContext(e0);if(!t)throw new Error("You must wrap your component in a <StableCollection>");let n=lO(),[s,r]=t.current.get(e,n);return rt.useEffect(()=>r,[]),s}function lO(){var e,t,n;let s=(n=(t=(e=rt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED)==null?void 0:e.ReactCurrentOwner)==null?void 0:t.current)!=null?n:null;if(!s)return Symbol();let r=[],o=s;for(;o;)r.push(o.index),o=o.return;return"$."+r.join(".")}var cO=(e=>(e[e.Forwards=0]="Forwards",e[e.Backwards=1]="Backwards",e))(cO||{}),uO=(e=>(e[e.Less=-1]="Less",e[e.Equal=0]="Equal",e[e.Greater=1]="Greater",e))(uO||{}),dO=(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))(dO||{});let fO={0(e,t){var n;let s=or(e.tabs,d=>d.current),r=or(e.panels,d=>d.current),o=s.filter(d=>{var f;return!((f=d.current)!=null&&f.hasAttribute("disabled"))}),i={...e,tabs:s,panels:r};if(t.index<0||t.index>s.length-1){let d=Re(Math.sign(t.index-e.selectedIndex),{[-1]:()=>1,0:()=>Re(Math.sign(t.index),{[-1]:()=>0,0:()=>0,1:()=>1}),1:()=>0});if(o.length===0)return i;let f=Re(d,{0:()=>s.indexOf(o[0]),1:()=>s.indexOf(o[o.length-1])});return{...i,selectedIndex:f===-1?e.selectedIndex:f}}let a=s.slice(0,t.index),l=[...s.slice(t.index),...a].find(d=>o.includes(d));if(!l)return i;let u=(n=s.indexOf(l))!=null?n:e.selectedIndex;return u===-1&&(u=e.selectedIndex),{...i,selectedIndex:u}},1(e,t){if(e.tabs.includes(t.tab))return e;let n=e.tabs[e.selectedIndex],s=or([...e.tabs,t.tab],o=>o.current),r=e.selectedIndex;return e.info.current.isControlled||(r=s.indexOf(n),r===-1&&(r=e.selectedIndex)),{...e,tabs:s,selectedIndex:r}},2(e,t){return{...e,tabs:e.tabs.filter(n=>n!==t.tab)}},3(e,t){return e.panels.includes(t.panel)?e:{...e,panels:or([...e.panels,t.panel],n=>n.current)}},4(e,t){return{...e,panels:e.panels.filter(n=>n!==t.panel)}}},zp=h.createContext(null);zp.displayName="TabsDataContext";function vi(e){let t=h.useContext(zp);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,vi),n}return t}let Up=h.createContext(null);Up.displayName="TabsActionsContext";function Wp(e){let t=h.useContext(Up);if(t===null){let n=new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(n,Wp),n}return t}function pO(e,t){return Re(t.type,fO,e,t)}let hO=h.Fragment;function gO(e,t){let{defaultIndex:n=0,vertical:s=!1,manual:r=!1,onChange:o,selectedIndex:i=null,...a}=e;const l=s?"vertical":"horizontal",u=r?"manual":"auto";let d=i!==null,f=Ht({isControlled:d}),p=Ze(t),[g,m]=h.useReducer(pO,{info:f,selectedIndex:i??n,tabs:[],panels:[]}),v=h.useMemo(()=>({selectedIndex:g.selectedIndex}),[g.selectedIndex]),b=Ht(o||(()=>{})),x=Ht(g.tabs),y=h.useMemo(()=>({orientation:l,activation:u,...g}),[l,u,g]),w=re(P=>(m({type:1,tab:P}),()=>m({type:2,tab:P}))),S=re(P=>(m({type:3,panel:P}),()=>m({type:4,panel:P}))),C=re(P=>{j.current!==P&&b.current(P),d||m({type:0,index:P})}),j=Ht(d?e.selectedIndex:g.selectedIndex),E=h.useMemo(()=>({registerTab:w,registerPanel:S,change:C}),[]);qe(()=>{m({type:0,index:i??n})},[i]),qe(()=>{if(j.current===void 0||g.tabs.length<=0)return;let P=or(g.tabs,T=>T.current);P.some((T,_)=>g.tabs[_]!==T)&&C(P.indexOf(g.tabs[j.current]))});let O={ref:p};return h.createElement(aO,null,h.createElement(Up.Provider,{value:E},h.createElement(zp.Provider,{value:y},y.tabs.length<=0&&h.createElement(oO,{onFocus:()=>{var P,T;for(let _ of x.current)if(((P=_.current)==null?void 0:P.tabIndex)===0)return(T=_.current)==null||T.focus(),!0;return!1}}),Be({ourProps:O,theirProps:a,slot:v,defaultTag:hO,name:"Tabs"}))))}let mO="div";function vO(e,t){let{orientation:n,selectedIndex:s}=vi("Tab.List"),r=Ze(t);return Be({ourProps:{ref:r,role:"tablist","aria-orientation":n},theirProps:e,slot:{selectedIndex:s},defaultTag:mO,name:"Tabs.List"})}let bO="button";function yO(e,t){var n,s;let r=Tt(),{id:o=`headlessui-tabs-tab-${r}`,...i}=e,{orientation:a,activation:l,selectedIndex:u,tabs:d,panels:f}=vi("Tab"),p=Wp("Tab"),g=vi("Tab"),m=h.useRef(null),v=Ze(m,t);qe(()=>p.registerTab(m),[p,m]);let b=t0("tabs"),x=d.indexOf(m);x===-1&&(x=b);let y=x===u,w=re(T=>{var _;let L=T();if(L===ks.Success&&l==="auto"){let N=(_=Qr(m))==null?void 0:_.activeElement,V=g.tabs.findIndex(A=>A.current===N);V!==-1&&p.change(V)}return L}),S=re(T=>{let _=d.map(L=>L.current).filter(Boolean);if(T.key===be.Space||T.key===be.Enter){T.preventDefault(),T.stopPropagation(),p.change(x);return}switch(T.key){case be.Home:case be.PageUp:return T.preventDefault(),T.stopPropagation(),w(()=>ln(_,At.First));case be.End:case be.PageDown:return T.preventDefault(),T.stopPropagation(),w(()=>ln(_,At.Last))}if(w(()=>Re(a,{vertical(){return T.key===be.ArrowUp?ln(_,At.Previous|At.WrapAround):T.key===be.ArrowDown?ln(_,At.Next|At.WrapAround):ks.Error},horizontal(){return T.key===be.ArrowLeft?ln(_,At.Previous|At.WrapAround):T.key===be.ArrowRight?ln(_,At.Next|At.WrapAround):ks.Error}}))===ks.Success)return T.preventDefault()}),C=h.useRef(!1),j=re(()=>{var T;C.current||(C.current=!0,(T=m.current)==null||T.focus({preventScroll:!0}),p.change(x),xp(()=>{C.current=!1}))}),E=re(T=>{T.preventDefault()}),O=h.useMemo(()=>{var T;return{selected:y,disabled:(T=e.disabled)!=null?T:!1}},[y,e.disabled]),P={ref:v,onKeyDown:S,onMouseDown:E,onClick:j,id:o,role:"tab",type:Ai(e,m),"aria-controls":(s=(n=f[x])==null?void 0:n.current)==null?void 0:s.id,"aria-selected":y,tabIndex:y?0:-1};return Be({ourProps:P,theirProps:i,slot:O,defaultTag:bO,name:"Tabs.Tab"})}let xO="div";function wO(e,t){let{selectedIndex:n}=vi("Tab.Panels"),s=Ze(t),r=h.useMemo(()=>({selectedIndex:n}),[n]);return Be({ourProps:{ref:s},theirProps:e,slot:r,defaultTag:xO,name:"Tabs.Panels"})}let SO="div",CO=Sn.RenderStrategy|Sn.Static;function jO(e,t){var n,s,r,o;let i=Tt(),{id:a=`headlessui-tabs-panel-${i}`,tabIndex:l=0,...u}=e,{selectedIndex:d,tabs:f,panels:p}=vi("Tab.Panel"),g=Wp("Tab.Panel"),m=h.useRef(null),v=Ze(m,t);qe(()=>g.registerPanel(m),[g,m,a]);let b=t0("panels"),x=p.indexOf(m);x===-1&&(x=b);let y=x===d,w=h.useMemo(()=>({selected:y}),[y]),S={ref:v,id:a,role:"tabpanel","aria-labelledby":(s=(n=f[x])==null?void 0:n.current)==null?void 0:s.id,tabIndex:y?l:-1};return!y&&((r=u.unmount)==null||r)&&!((o=u.static)!=null&&o)?h.createElement(ms,{as:"span","aria-hidden":"true",...S}):Be({ourProps:S,theirProps:u,slot:w,defaultTag:SO,features:CO,visible:y,name:"Tabs.Panel"})}let EO=ze(yO),TO=ze(gO),PO=ze(vO),OO=ze(wO),_O=ze(jO),zi=Object.assign(EO,{Group:TO,List:PO,Panels:OO,Panel:_O});function AO(e){let t={called:!1};return(...n)=>{if(!t.called)return t.called=!0,e(...n)}}function ad(e,...t){e&&t.length>0&&e.classList.add(...t)}function ld(e,...t){e&&t.length>0&&e.classList.remove(...t)}function LO(e,t){let n=Bs();if(!e)return n.dispose;let{transitionDuration:s,transitionDelay:r}=getComputedStyle(e),[o,i]=[s,r].map(l=>{let[u=0]=l.split(",").filter(Boolean).map(d=>d.includes("ms")?parseFloat(d):parseFloat(d)*1e3).sort((d,f)=>f-d);return u}),a=o+i;if(a!==0){n.group(u=>{u.setTimeout(()=>{t(),u.dispose()},a),u.addEventListener(e,"transitionrun",d=>{d.target===d.currentTarget&&u.dispose()})});let l=n.addEventListener(e,"transitionend",u=>{u.target===u.currentTarget&&(t(),l())})}else t();return n.add(()=>t()),n.dispose}function MO(e,t,n,s){let r=n?"enter":"leave",o=Bs(),i=s!==void 0?AO(s):()=>{};r==="enter"&&(e.removeAttribute("hidden"),e.style.display="");let a=Re(r,{enter:()=>t.enter,leave:()=>t.leave}),l=Re(r,{enter:()=>t.enterTo,leave:()=>t.leaveTo}),u=Re(r,{enter:()=>t.enterFrom,leave:()=>t.leaveFrom});return ld(e,...t.base,...t.enter,...t.enterTo,...t.enterFrom,...t.leave,...t.leaveFrom,...t.leaveTo,...t.entered),ad(e,...t.base,...a,...u),o.nextFrame(()=>{ld(e,...t.base,...a,...u),ad(e,...t.base,...a,...l),LO(e,()=>(ld(e,...t.base,...a),ad(e,...t.base,...t.entered),i()))}),o.dispose}function NO({immediate:e,container:t,direction:n,classes:s,onStart:r,onStop:o}){let i=nu(),a=hs(),l=Ht(n);qe(()=>{e&&(l.current="enter")},[e]),qe(()=>{let u=Bs();a.add(u.dispose);let d=t.current;if(d&&l.current!=="idle"&&i.current)return u.dispose(),r.current(l.current),u.add(MO(d,s.current,l.current==="enter",()=>{u.dispose(),o.current(l.current)})),u.dispose},[n])}function Cr(e=""){return e.split(/\s+/).filter(t=>t.length>1)}let ou=h.createContext(null);ou.displayName="TransitionContext";var $O=(e=>(e.Visible="visible",e.Hidden="hidden",e))($O||{});function kO(){let e=h.useContext(ou);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}function RO(){let e=h.useContext(iu);if(e===null)throw new Error("A <Transition.Child /> is used but it is missing a parent <Transition /> or <Transition.Root />.");return e}let iu=h.createContext(null);iu.displayName="NestingContext";function au(e){return"children"in e?au(e.children):e.current.filter(({el:t})=>t.current!==null).filter(({state:t})=>t==="visible").length>0}function n0(e,t){let n=Ht(e),s=h.useRef([]),r=nu(),o=hs(),i=re((g,m=Nr.Hidden)=>{let v=s.current.findIndex(({el:b})=>b===g);v!==-1&&(Re(m,{[Nr.Unmount](){s.current.splice(v,1)},[Nr.Hidden](){s.current[v].state="hidden"}}),o.microTask(()=>{var b;!au(s)&&r.current&&((b=n.current)==null||b.call(n))}))}),a=re(g=>{let m=s.current.find(({el:v})=>v===g);return m?m.state!=="visible"&&(m.state="visible"):s.current.push({el:g,state:"visible"}),()=>i(g,Nr.Unmount)}),l=h.useRef([]),u=h.useRef(Promise.resolve()),d=h.useRef({enter:[],leave:[],idle:[]}),f=re((g,m,v)=>{l.current.splice(0),t&&(t.chains.current[m]=t.chains.current[m].filter(([b])=>b!==g)),t==null||t.chains.current[m].push([g,new Promise(b=>{l.current.push(b)})]),t==null||t.chains.current[m].push([g,new Promise(b=>{Promise.all(d.current[m].map(([x,y])=>y)).then(()=>b())})]),m==="enter"?u.current=u.current.then(()=>t==null?void 0:t.wait.current).then(()=>v(m)):v(m)}),p=re((g,m,v)=>{Promise.all(d.current[m].splice(0).map(([b,x])=>x)).then(()=>{var b;(b=l.current.shift())==null||b()}).then(()=>v(m))});return h.useMemo(()=>({children:s,register:a,unregister:i,onStart:f,onStop:p,wait:u,chains:d}),[a,i,s,f,p,d,u])}function IO(){}let VO=["beforeEnter","afterEnter","beforeLeave","afterLeave"];function $g(e){var t;let n={};for(let s of VO)n[s]=(t=e[s])!=null?t:IO;return n}function HO(e){let t=h.useRef($g(e));return h.useEffect(()=>{t.current=$g(e)},[e]),t}let DO="div",s0=Sn.RenderStrategy;function FO(e,t){var n,s;let{beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a,enter:l,enterFrom:u,enterTo:d,entered:f,leave:p,leaveFrom:g,leaveTo:m,...v}=e,b=h.useRef(null),x=Ze(b,t),y=(n=v.unmount)==null||n?Nr.Unmount:Nr.Hidden,{show:w,appear:S,initial:C}=kO(),[j,E]=h.useState(w?"visible":"hidden"),O=RO(),{register:P,unregister:T}=O;h.useEffect(()=>P(b),[P,b]),h.useEffect(()=>{if(y===Nr.Hidden&&b.current){if(w&&j!=="visible"){E("visible");return}return Re(j,{hidden:()=>T(b),visible:()=>P(b)})}},[j,b,P,T,w,y]);let _=Ht({base:Cr(v.className),enter:Cr(l),enterFrom:Cr(u),enterTo:Cr(d),entered:Cr(f),leave:Cr(p),leaveFrom:Cr(g),leaveTo:Cr(m)}),L=HO({beforeEnter:r,afterEnter:o,beforeLeave:i,afterLeave:a}),N=Jc();h.useEffect(()=>{if(N&&j==="visible"&&b.current===null)throw new Error("Did you forget to passthrough the `ref` to the actual DOM node?")},[b,j,N]);let V=C&&!S,A=S&&w&&C,H=!N||V?"idle":w?"enter":"leave",U=Xb(0),D=re(Z=>Re(Z,{enter:()=>{U.addFlag(gt.Opening),L.current.beforeEnter()},leave:()=>{U.addFlag(gt.Closing),L.current.beforeLeave()},idle:()=>{}})),$=re(Z=>Re(Z,{enter:()=>{U.removeFlag(gt.Opening),L.current.afterEnter()},leave:()=>{U.removeFlag(gt.Closing),L.current.afterLeave()},idle:()=>{}})),I=n0(()=>{E("hidden"),T(b)},O),R=h.useRef(!1);NO({immediate:A,container:b,classes:_,direction:H,onStart:Ht(Z=>{R.current=!0,I.onStart(b,Z,D)}),onStop:Ht(Z=>{R.current=!1,I.onStop(b,Z,$),Z==="leave"&&!au(I)&&(E("hidden"),T(b))})});let z=v,X={ref:x};return A?z={...z,className:jc(v.className,..._.current.enter,..._.current.enterFrom)}:R.current&&(z.className=jc(v.className,(s=b.current)==null?void 0:s.className),z.className===""&&delete z.className),h.createElement(iu.Provider,{value:I},h.createElement(Xa,{value:Re(j,{visible:gt.Open,hidden:gt.Closed})|U.flags},Be({ourProps:X,theirProps:z,defaultTag:DO,features:s0,visible:j==="visible",name:"Transition.Child"})))}function BO(e,t){let{show:n,appear:s=!1,unmount:r=!0,...o}=e,i=h.useRef(null),a=Ze(i,t);Jc();let l=Fo();if(n===void 0&&l!==null&&(n=(l>.Open)===gt.Open),![!0,!1].includes(n))throw new Error("A <Transition /> is used but it is missing a `show={true | false}` prop.");let[u,d]=h.useState(n?"visible":"hidden"),f=n0(()=>{d("hidden")}),[p,g]=h.useState(!0),m=h.useRef([n]);qe(()=>{p!==!1&&m.current[m.current.length-1]!==n&&(m.current.push(n),g(!1))},[m,n]);let v=h.useMemo(()=>({show:n,appear:s,initial:p}),[n,s,p]);h.useEffect(()=>{if(n)d("visible");else if(!au(f))d("hidden");else{let w=i.current;if(!w)return;let S=w.getBoundingClientRect();S.x===0&&S.y===0&&S.width===0&&S.height===0&&d("hidden")}},[n,f]);let b={unmount:r},x=re(()=>{var w;p&&g(!1),(w=e.beforeEnter)==null||w.call(e)}),y=re(()=>{var w;p&&g(!1),(w=e.beforeLeave)==null||w.call(e)});return h.createElement(iu.Provider,{value:f},h.createElement(ou.Provider,{value:v},Be({ourProps:{...b,as:h.Fragment,children:h.createElement(r0,{ref:a,...b,...o,beforeEnter:x,beforeLeave:y})},theirProps:{},defaultTag:h.Fragment,features:s0,visible:u==="visible",name:"Transition"})))}function zO(e,t){let n=h.useContext(ou)!==null,s=Fo()!==null;return h.createElement(h.Fragment,null,!n&&s?h.createElement(vf,{ref:t,...e}):h.createElement(r0,{ref:t,...e}))}let vf=ze(BO),r0=ze(FO),UO=ze(zO),Gp=Object.assign(vf,{Child:UO,Root:vf});var kg=function(t){return t.reduce(function(n,s){var r=s[0],o=s[1];return n[r]=o,n},{})},Rg=typeof window<"u"&&window.document&&window.document.createElement?rt.useLayoutEffect:rt.useEffect,xn="top",es="bottom",ts="right",wn="left",qp="auto",tl=[xn,es,ts,wn],bi="start",wa="end",WO="clippingParents",o0="viewport",Ui="popper",GO="reference",Ig=tl.reduce(function(e,t){return e.concat([t+"-"+bi,t+"-"+wa])},[]),i0=[].concat(tl,[qp]).reduce(function(e,t){return e.concat([t,t+"-"+bi,t+"-"+wa])},[]),qO="beforeRead",KO="read",ZO="afterRead",YO="beforeMain",XO="main",JO="afterMain",QO="beforeWrite",e_="write",t_="afterWrite",n_=[qO,KO,ZO,YO,XO,JO,QO,e_,t_];function zs(e){return e?(e.nodeName||"").toLowerCase():null}function In(e){if(e==null)return window;if(e.toString()!=="[object Window]"){var t=e.ownerDocument;return t&&t.defaultView||window}return e}function No(e){var t=In(e).Element;return e instanceof t||e instanceof Element}function Qn(e){var t=In(e).HTMLElement;return e instanceof t||e instanceof HTMLElement}function Kp(e){if(typeof ShadowRoot>"u")return!1;var t=In(e).ShadowRoot;return e instanceof t||e instanceof ShadowRoot}function s_(e){var t=e.state;Object.keys(t.elements).forEach(function(n){var s=t.styles[n]||{},r=t.attributes[n]||{},o=t.elements[n];!Qn(o)||!zs(o)||(Object.assign(o.style,s),Object.keys(r).forEach(function(i){var a=r[i];a===!1?o.removeAttribute(i):o.setAttribute(i,a===!0?"":a)}))})}function r_(e){var t=e.state,n={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(t.elements.popper.style,n.popper),t.styles=n,t.elements.arrow&&Object.assign(t.elements.arrow.style,n.arrow),function(){Object.keys(t.elements).forEach(function(s){var r=t.elements[s],o=t.attributes[s]||{},i=Object.keys(t.styles.hasOwnProperty(s)?t.styles[s]:n[s]),a=i.reduce(function(l,u){return l[u]="",l},{});!Qn(r)||!zs(r)||(Object.assign(r.style,a),Object.keys(o).forEach(function(l){r.removeAttribute(l)}))})}}const o_={name:"applyStyles",enabled:!0,phase:"write",fn:s_,effect:r_,requires:["computeStyles"]};function Fs(e){return e.split("-")[0]}var Eo=Math.max,Ec=Math.min,yi=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 a0(){return!/^((?!chrome|android).)*safari/i.test(bf())}function xi(e,t,n){t===void 0&&(t=!1),n===void 0&&(n=!1);var s=e.getBoundingClientRect(),r=1,o=1;t&&Qn(e)&&(r=e.offsetWidth>0&&yi(s.width)/e.offsetWidth||1,o=e.offsetHeight>0&&yi(s.height)/e.offsetHeight||1);var i=No(e)?In(e):window,a=i.visualViewport,l=!a0()&&n,u=(s.left+(l&&a?a.offsetLeft:0))/r,d=(s.top+(l&&a?a.offsetTop:0))/o,f=s.width/r,p=s.height/o;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function Zp(e){var t=xi(e),n=e.offsetWidth,s=e.offsetHeight;return Math.abs(t.width-n)<=1&&(n=t.width),Math.abs(t.height-s)<=1&&(s=t.height),{x:e.offsetLeft,y:e.offsetTop,width:n,height:s}}function l0(e,t){var n=t.getRootNode&&t.getRootNode();if(e.contains(t))return!0;if(n&&Kp(n)){var s=t;do{if(s&&e.isSameNode(s))return!0;s=s.parentNode||s.host}while(s)}return!1}function fr(e){return In(e).getComputedStyle(e)}function i_(e){return["table","td","th"].indexOf(zs(e))>=0}function eo(e){return((No(e)?e.ownerDocument:e.document)||window.document).documentElement}function lu(e){return zs(e)==="html"?e:e.assignedSlot||e.parentNode||(Kp(e)?e.host:null)||eo(e)}function Vg(e){return!Qn(e)||fr(e).position==="fixed"?null:e.offsetParent}function a_(e){var t=/firefox/i.test(bf()),n=/Trident/i.test(bf());if(n&&Qn(e)){var s=fr(e);if(s.position==="fixed")return null}var r=lu(e);for(Kp(r)&&(r=r.host);Qn(r)&&["html","body"].indexOf(zs(r))<0;){var o=fr(r);if(o.transform!=="none"||o.perspective!=="none"||o.contain==="paint"||["transform","perspective"].indexOf(o.willChange)!==-1||t&&o.willChange==="filter"||t&&o.filter&&o.filter!=="none")return r;r=r.parentNode}return null}function nl(e){for(var t=In(e),n=Vg(e);n&&i_(n)&&fr(n).position==="static";)n=Vg(n);return n&&(zs(n)==="html"||zs(n)==="body"&&fr(n).position==="static")?t:n||a_(e)||t}function Yp(e){return["top","bottom"].indexOf(e)>=0?"x":"y"}function ra(e,t,n){return Eo(e,Ec(t,n))}function l_(e,t,n){var s=ra(e,t,n);return s>n?n:s}function c0(){return{top:0,right:0,bottom:0,left:0}}function u0(e){return Object.assign({},c0(),e)}function d0(e,t){return t.reduce(function(n,s){return n[s]=e,n},{})}var c_=function(t,n){return t=typeof t=="function"?t(Object.assign({},n.rects,{placement:n.placement})):t,u0(typeof t!="number"?t:d0(t,tl))};function u_(e){var t,n=e.state,s=e.name,r=e.options,o=n.elements.arrow,i=n.modifiersData.popperOffsets,a=Fs(n.placement),l=Yp(a),u=[wn,ts].indexOf(a)>=0,d=u?"height":"width";if(!(!o||!i)){var f=c_(r.padding,n),p=Zp(o),g=l==="y"?xn:wn,m=l==="y"?es:ts,v=n.rects.reference[d]+n.rects.reference[l]-i[l]-n.rects.popper[d],b=i[l]-n.rects.reference[l],x=nl(o),y=x?l==="y"?x.clientHeight||0:x.clientWidth||0:0,w=v/2-b/2,S=f[g],C=y-p[d]-f[m],j=y/2-p[d]/2+w,E=ra(S,j,C),O=l;n.modifiersData[s]=(t={},t[O]=E,t.centerOffset=E-j,t)}}function d_(e){var t=e.state,n=e.options,s=n.element,r=s===void 0?"[data-popper-arrow]":s;r!=null&&(typeof r=="string"&&(r=t.elements.popper.querySelector(r),!r)||l0(t.elements.popper,r)&&(t.elements.arrow=r))}const f_={name:"arrow",enabled:!0,phase:"main",fn:u_,effect:d_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function wi(e){return e.split("-")[1]}var p_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function h_(e,t){var n=e.x,s=e.y,r=t.devicePixelRatio||1;return{x:yi(n*r)/r||0,y:yi(s*r)/r||0}}function Hg(e){var t,n=e.popper,s=e.popperRect,r=e.placement,o=e.variation,i=e.offsets,a=e.position,l=e.gpuAcceleration,u=e.adaptive,d=e.roundOffsets,f=e.isFixed,p=i.x,g=p===void 0?0:p,m=i.y,v=m===void 0?0:m,b=typeof d=="function"?d({x:g,y:v}):{x:g,y:v};g=b.x,v=b.y;var x=i.hasOwnProperty("x"),y=i.hasOwnProperty("y"),w=wn,S=xn,C=window;if(u){var j=nl(n),E="clientHeight",O="clientWidth";if(j===In(n)&&(j=eo(n),fr(j).position!=="static"&&a==="absolute"&&(E="scrollHeight",O="scrollWidth")),j=j,r===xn||(r===wn||r===ts)&&o===wa){S=es;var P=f&&j===C&&C.visualViewport?C.visualViewport.height:j[E];v-=P-s.height,v*=l?1:-1}if(r===wn||(r===xn||r===es)&&o===wa){w=ts;var T=f&&j===C&&C.visualViewport?C.visualViewport.width:j[O];g-=T-s.width,g*=l?1:-1}}var _=Object.assign({position:a},u&&p_),L=d===!0?h_({x:g,y:v},In(n)):{x:g,y:v};if(g=L.x,v=L.y,l){var N;return Object.assign({},_,(N={},N[S]=y?"0":"",N[w]=x?"0":"",N.transform=(C.devicePixelRatio||1)<=1?"translate("+g+"px, "+v+"px)":"translate3d("+g+"px, "+v+"px, 0)",N))}return Object.assign({},_,(t={},t[S]=y?v+"px":"",t[w]=x?g+"px":"",t.transform="",t))}function g_(e){var t=e.state,n=e.options,s=n.gpuAcceleration,r=s===void 0?!0:s,o=n.adaptive,i=o===void 0?!0:o,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Fs(t.placement),variation:wi(t.placement),popper:t.elements.popper,popperRect:t.rects.popper,gpuAcceleration:r,isFixed:t.options.strategy==="fixed"};t.modifiersData.popperOffsets!=null&&(t.styles.popper=Object.assign({},t.styles.popper,Hg(Object.assign({},u,{offsets:t.modifiersData.popperOffsets,position:t.options.strategy,adaptive:i,roundOffsets:l})))),t.modifiersData.arrow!=null&&(t.styles.arrow=Object.assign({},t.styles.arrow,Hg(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 m_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:g_,data:{}};var _l={passive:!0};function v_(e){var t=e.state,n=e.instance,s=e.options,r=s.scroll,o=r===void 0?!0:r,i=s.resize,a=i===void 0?!0:i,l=In(t.elements.popper),u=[].concat(t.scrollParents.reference,t.scrollParents.popper);return o&&u.forEach(function(d){d.addEventListener("scroll",n.update,_l)}),a&&l.addEventListener("resize",n.update,_l),function(){o&&u.forEach(function(d){d.removeEventListener("scroll",n.update,_l)}),a&&l.removeEventListener("resize",n.update,_l)}}const b_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:v_,data:{}};var y_={left:"right",right:"left",bottom:"top",top:"bottom"};function lc(e){return e.replace(/left|right|bottom|top/g,function(t){return y_[t]})}var x_={start:"end",end:"start"};function Dg(e){return e.replace(/start|end/g,function(t){return x_[t]})}function Xp(e){var t=In(e),n=t.pageXOffset,s=t.pageYOffset;return{scrollLeft:n,scrollTop:s}}function Jp(e){return xi(eo(e)).left+Xp(e).scrollLeft}function w_(e,t){var n=In(e),s=eo(e),r=n.visualViewport,o=s.clientWidth,i=s.clientHeight,a=0,l=0;if(r){o=r.width,i=r.height;var u=a0();(u||!u&&t==="fixed")&&(a=r.offsetLeft,l=r.offsetTop)}return{width:o,height:i,x:a+Jp(e),y:l}}function S_(e){var t,n=eo(e),s=Xp(e),r=(t=e.ownerDocument)==null?void 0:t.body,o=Eo(n.scrollWidth,n.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),i=Eo(n.scrollHeight,n.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),a=-s.scrollLeft+Jp(e),l=-s.scrollTop;return fr(r||n).direction==="rtl"&&(a+=Eo(n.clientWidth,r?r.clientWidth:0)-o),{width:o,height:i,x:a,y:l}}function Qp(e){var t=fr(e),n=t.overflow,s=t.overflowX,r=t.overflowY;return/auto|scroll|overlay|hidden/.test(n+r+s)}function f0(e){return["html","body","#document"].indexOf(zs(e))>=0?e.ownerDocument.body:Qn(e)&&Qp(e)?e:f0(lu(e))}function oa(e,t){var n;t===void 0&&(t=[]);var s=f0(e),r=s===((n=e.ownerDocument)==null?void 0:n.body),o=In(s),i=r?[o].concat(o.visualViewport||[],Qp(s)?s:[]):s,a=t.concat(i);return r?a:a.concat(oa(lu(i)))}function yf(e){return Object.assign({},e,{left:e.x,top:e.y,right:e.x+e.width,bottom:e.y+e.height})}function C_(e,t){var n=xi(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 Fg(e,t,n){return t===o0?yf(w_(e,n)):No(t)?C_(t,n):yf(S_(eo(e)))}function j_(e){var t=oa(lu(e)),n=["absolute","fixed"].indexOf(fr(e).position)>=0,s=n&&Qn(e)?nl(e):e;return No(s)?t.filter(function(r){return No(r)&&l0(r,s)&&zs(r)!=="body"}):[]}function E_(e,t,n,s){var r=t==="clippingParents"?j_(e):[].concat(t),o=[].concat(r,[n]),i=o[0],a=o.reduce(function(l,u){var d=Fg(e,u,s);return l.top=Eo(d.top,l.top),l.right=Ec(d.right,l.right),l.bottom=Ec(d.bottom,l.bottom),l.left=Eo(d.left,l.left),l},Fg(e,i,s));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function p0(e){var t=e.reference,n=e.element,s=e.placement,r=s?Fs(s):null,o=s?wi(s):null,i=t.x+t.width/2-n.width/2,a=t.y+t.height/2-n.height/2,l;switch(r){case xn:l={x:i,y:t.y-n.height};break;case es:l={x:i,y:t.y+t.height};break;case ts:l={x:t.x+t.width,y:a};break;case wn:l={x:t.x-n.width,y:a};break;default:l={x:t.x,y:t.y}}var u=r?Yp(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(o){case bi:l[u]=l[u]-(t[d]/2-n[d]/2);break;case wa:l[u]=l[u]+(t[d]/2-n[d]/2);break}}return l}function Sa(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=s===void 0?e.placement:s,o=n.strategy,i=o===void 0?e.strategy:o,a=n.boundary,l=a===void 0?WO:a,u=n.rootBoundary,d=u===void 0?o0:u,f=n.elementContext,p=f===void 0?Ui:f,g=n.altBoundary,m=g===void 0?!1:g,v=n.padding,b=v===void 0?0:v,x=u0(typeof b!="number"?b:d0(b,tl)),y=p===Ui?GO:Ui,w=e.rects.popper,S=e.elements[m?y:p],C=E_(No(S)?S:S.contextElement||eo(e.elements.popper),l,d,i),j=xi(e.elements.reference),E=p0({reference:j,element:w,strategy:"absolute",placement:r}),O=yf(Object.assign({},w,E)),P=p===Ui?O:j,T={top:C.top-P.top+x.top,bottom:P.bottom-C.bottom+x.bottom,left:C.left-P.left+x.left,right:P.right-C.right+x.right},_=e.modifiersData.offset;if(p===Ui&&_){var L=_[r];Object.keys(T).forEach(function(N){var V=[ts,es].indexOf(N)>=0?1:-1,A=[xn,es].indexOf(N)>=0?"y":"x";T[N]+=L[A]*V})}return T}function T_(e,t){t===void 0&&(t={});var n=t,s=n.placement,r=n.boundary,o=n.rootBoundary,i=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?i0:l,d=wi(s),f=d?a?Ig:Ig.filter(function(m){return wi(m)===d}):tl,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]=Sa(e,{placement:v,boundary:r,rootBoundary:o,padding:i})[Fs(v)],m},{});return Object.keys(g).sort(function(m,v){return g[m]-g[v]})}function P_(e){if(Fs(e)===qp)return[];var t=lc(e);return[Dg(e),t,Dg(t)]}function O_(e){var t=e.state,n=e.options,s=e.name;if(!t.modifiersData[s]._skip){for(var r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!0:i,l=n.fallbackPlacements,u=n.padding,d=n.boundary,f=n.rootBoundary,p=n.altBoundary,g=n.flipVariations,m=g===void 0?!0:g,v=n.allowedAutoPlacements,b=t.options.placement,x=Fs(b),y=x===b,w=l||(y||!m?[lc(b)]:P_(b)),S=[b].concat(w).reduce(function(Z,Y){return Z.concat(Fs(Y)===qp?T_(t,{placement:Y,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:v}):Y)},[]),C=t.rects.reference,j=t.rects.popper,E=new Map,O=!0,P=S[0],T=0;T<S.length;T++){var _=S[T],L=Fs(_),N=wi(_)===bi,V=[xn,es].indexOf(L)>=0,A=V?"width":"height",H=Sa(t,{placement:_,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),U=V?N?ts:wn:N?es:xn;C[A]>j[A]&&(U=lc(U));var D=lc(U),$=[];if(o&&$.push(H[L]<=0),a&&$.push(H[U]<=0,H[D]<=0),$.every(function(Z){return Z})){P=_,O=!1;break}E.set(_,$)}if(O)for(var I=m?3:1,R=function(Y){var J=S.find(function(ee){var W=E.get(ee);if(W)return W.slice(0,Y).every(function(Q){return Q})});if(J)return P=J,"break"},z=I;z>0;z--){var X=R(z);if(X==="break")break}t.placement!==P&&(t.modifiersData[s]._skip=!0,t.placement=P,t.reset=!0)}}const __={name:"flip",enabled:!0,phase:"main",fn:O_,requiresIfExists:["offset"],data:{_skip:!1}};function Bg(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 zg(e){return[xn,ts,es,wn].some(function(t){return e[t]>=0})}function A_(e){var t=e.state,n=e.name,s=t.rects.reference,r=t.rects.popper,o=t.modifiersData.preventOverflow,i=Sa(t,{elementContext:"reference"}),a=Sa(t,{altBoundary:!0}),l=Bg(i,s),u=Bg(a,r,o),d=zg(l),f=zg(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 L_={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:A_};function M_(e,t,n){var s=Fs(e),r=[wn,xn].indexOf(s)>=0?-1:1,o=typeof n=="function"?n(Object.assign({},t,{placement:e})):n,i=o[0],a=o[1];return i=i||0,a=(a||0)*r,[wn,ts].indexOf(s)>=0?{x:a,y:i}:{x:i,y:a}}function N_(e){var t=e.state,n=e.options,s=e.name,r=n.offset,o=r===void 0?[0,0]:r,i=i0.reduce(function(d,f){return d[f]=M_(f,t.rects,o),d},{}),a=i[t.placement],l=a.x,u=a.y;t.modifiersData.popperOffsets!=null&&(t.modifiersData.popperOffsets.x+=l,t.modifiersData.popperOffsets.y+=u),t.modifiersData[s]=i}const $_={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:N_};function k_(e){var t=e.state,n=e.name;t.modifiersData[n]=p0({reference:t.rects.reference,element:t.rects.popper,strategy:"absolute",placement:t.placement})}const R_={name:"popperOffsets",enabled:!0,phase:"read",fn:k_,data:{}};function I_(e){return e==="x"?"y":"x"}function V_(e){var t=e.state,n=e.options,s=e.name,r=n.mainAxis,o=r===void 0?!0:r,i=n.altAxis,a=i===void 0?!1:i,l=n.boundary,u=n.rootBoundary,d=n.altBoundary,f=n.padding,p=n.tether,g=p===void 0?!0:p,m=n.tetherOffset,v=m===void 0?0:m,b=Sa(t,{boundary:l,rootBoundary:u,padding:f,altBoundary:d}),x=Fs(t.placement),y=wi(t.placement),w=!y,S=Yp(x),C=I_(S),j=t.modifiersData.popperOffsets,E=t.rects.reference,O=t.rects.popper,P=typeof v=="function"?v(Object.assign({},t.rects,{placement:t.placement})):v,T=typeof P=="number"?{mainAxis:P,altAxis:P}:Object.assign({mainAxis:0,altAxis:0},P),_=t.modifiersData.offset?t.modifiersData.offset[t.placement]:null,L={x:0,y:0};if(j){if(o){var N,V=S==="y"?xn:wn,A=S==="y"?es:ts,H=S==="y"?"height":"width",U=j[S],D=U+b[V],$=U-b[A],I=g?-O[H]/2:0,R=y===bi?E[H]:O[H],z=y===bi?-O[H]:-E[H],X=t.elements.arrow,Z=g&&X?Zp(X):{width:0,height:0},Y=t.modifiersData["arrow#persistent"]?t.modifiersData["arrow#persistent"].padding:c0(),J=Y[V],ee=Y[A],W=ra(0,E[H],Z[H]),Q=w?E[H]/2-I-W-J-T.mainAxis:R-W-J-T.mainAxis,ae=w?-E[H]/2+I+W+ee+T.mainAxis:z+W+ee+T.mainAxis,ge=t.elements.arrow&&nl(t.elements.arrow),Ce=ge?S==="y"?ge.clientTop||0:ge.clientLeft||0:0,Se=(N=_==null?void 0:_[S])!=null?N:0,et=U+Q-Se-Ce,Ye=U+ae-Se,Ct=ra(g?Ec(D,et):D,U,g?Eo($,Ye):$);j[S]=Ct,L[S]=Ct-U}if(a){var ct,we=S==="x"?xn:wn,nt=S==="x"?es:ts,st=j[C],vt=C==="y"?"height":"width",Me=st+b[we],ft=st-b[nt],ut=[xn,wn].indexOf(x)!==-1,Fe=(ct=_==null?void 0:_[C])!=null?ct:0,Zt=ut?Me:st-E[vt]-O[vt]-Fe+T.altAxis,he=ut?st+E[vt]+O[vt]-Fe-T.altAxis:ft,Ve=g&&ut?l_(Zt,st,he):ra(g?Zt:Me,st,g?he:ft);j[C]=Ve,L[C]=Ve-st}t.modifiersData[s]=L}}const H_={name:"preventOverflow",enabled:!0,phase:"main",fn:V_,requiresIfExists:["offset"]};function D_(e){return{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}}function F_(e){return e===In(e)||!Qn(e)?Xp(e):D_(e)}function B_(e){var t=e.getBoundingClientRect(),n=yi(t.width)/e.offsetWidth||1,s=yi(t.height)/e.offsetHeight||1;return n!==1||s!==1}function z_(e,t,n){n===void 0&&(n=!1);var s=Qn(t),r=Qn(t)&&B_(t),o=eo(t),i=xi(e,r,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(s||!s&&!n)&&((zs(t)!=="body"||Qp(o))&&(a=F_(t)),Qn(t)?(l=xi(t,!0),l.x+=t.clientLeft,l.y+=t.clientTop):o&&(l.x=Jp(o))),{x:i.left+a.scrollLeft-l.x,y:i.top+a.scrollTop-l.y,width:i.width,height:i.height}}function U_(e){var t=new Map,n=new Set,s=[];e.forEach(function(o){t.set(o.name,o)});function r(o){n.add(o.name);var i=[].concat(o.requires||[],o.requiresIfExists||[]);i.forEach(function(a){if(!n.has(a)){var l=t.get(a);l&&r(l)}}),s.push(o)}return e.forEach(function(o){n.has(o.name)||r(o)}),s}function W_(e){var t=U_(e);return n_.reduce(function(n,s){return n.concat(t.filter(function(r){return r.phase===s}))},[])}function G_(e){var t;return function(){return t||(t=new Promise(function(n){Promise.resolve().then(function(){t=void 0,n(e())})})),t}}function q_(e){var t=e.reduce(function(n,s){var r=n[s.name];return n[s.name]=r?Object.assign({},r,s,{options:Object.assign({},r.options,s.options),data:Object.assign({},r.data,s.data)}):s,n},{});return Object.keys(t).map(function(n){return t[n]})}var Ug={placement:"bottom",modifiers:[],strategy:"absolute"};function Wg(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return!t.some(function(s){return!(s&&typeof s.getBoundingClientRect=="function")})}function K_(e){e===void 0&&(e={});var t=e,n=t.defaultModifiers,s=n===void 0?[]:n,r=t.defaultOptions,o=r===void 0?Ug:r;return function(a,l,u){u===void 0&&(u=o);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ug,o),modifiersData:{},elements:{reference:a,popper:l},attributes:{},styles:{}},f=[],p=!1,g={state:d,setOptions:function(x){var y=typeof x=="function"?x(d.options):x;v(),d.options=Object.assign({},o,d.options,y),d.scrollParents={reference:No(a)?oa(a):a.contextElement?oa(a.contextElement):[],popper:oa(l)};var w=W_(q_([].concat(s,d.options.modifiers)));return d.orderedModifiers=w.filter(function(S){return S.enabled}),m(),g.update()},forceUpdate:function(){if(!p){var x=d.elements,y=x.reference,w=x.popper;if(Wg(y,w)){d.rects={reference:z_(y,nl(w),d.options.strategy==="fixed"),popper:Zp(w)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(T){return d.modifiersData[T.name]=Object.assign({},T.data)});for(var S=0;S<d.orderedModifiers.length;S++){if(d.reset===!0){d.reset=!1,S=-1;continue}var C=d.orderedModifiers[S],j=C.fn,E=C.options,O=E===void 0?{}:E,P=C.name;typeof j=="function"&&(d=j({state:d,options:O,name:P,instance:g})||d)}}}},update:G_(function(){return new Promise(function(b){g.forceUpdate(),b(d)})}),destroy:function(){v(),p=!0}};if(!Wg(a,l))return g;g.setOptions(u).then(function(b){!p&&u.onFirstUpdate&&u.onFirstUpdate(b)});function m(){d.orderedModifiers.forEach(function(b){var x=b.name,y=b.options,w=y===void 0?{}:y,S=b.effect;if(typeof S=="function"){var C=S({state:d,name:x,instance:g,options:w}),j=function(){};f.push(C||j)}})}function v(){f.forEach(function(b){return b()}),f=[]}return g}}var Z_=[b_,R_,m_,o_,$_,__,H_,f_,L_],Y_=K_({defaultModifiers:Z_}),X_=typeof Element<"u",J_=typeof Map=="function",Q_=typeof Set=="function",eA=typeof ArrayBuffer=="function"&&!!ArrayBuffer.isView;function cc(e,t){if(e===t)return!0;if(e&&t&&typeof e=="object"&&typeof t=="object"){if(e.constructor!==t.constructor)return!1;var n,s,r;if(Array.isArray(e)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(!cc(e[s],t[s]))return!1;return!0}var o;if(J_&&e instanceof Map&&t instanceof Map){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;for(o=e.entries();!(s=o.next()).done;)if(!cc(s.value[1],t.get(s.value[0])))return!1;return!0}if(Q_&&e instanceof Set&&t instanceof Set){if(e.size!==t.size)return!1;for(o=e.entries();!(s=o.next()).done;)if(!t.has(s.value[0]))return!1;return!0}if(eA&&ArrayBuffer.isView(e)&&ArrayBuffer.isView(t)){if(n=e.length,n!=t.length)return!1;for(s=n;s--!==0;)if(e[s]!==t[s])return!1;return!0}if(e.constructor===RegExp)return e.source===t.source&&e.flags===t.flags;if(e.valueOf!==Object.prototype.valueOf&&typeof e.valueOf=="function"&&typeof t.valueOf=="function")return e.valueOf()===t.valueOf();if(e.toString!==Object.prototype.toString&&typeof e.toString=="function"&&typeof t.toString=="function")return e.toString()===t.toString();if(r=Object.keys(e),n=r.length,n!==Object.keys(t).length)return!1;for(s=n;s--!==0;)if(!Object.prototype.hasOwnProperty.call(t,r[s]))return!1;if(X_&&e instanceof Element)return!1;for(s=n;s--!==0;)if(!((r[s]==="_owner"||r[s]==="__v"||r[s]==="__o")&&e.$$typeof)&&!cc(e[r[s]],t[r[s]]))return!1;return!0}return e!==e&&t!==t}var tA=function(t,n){try{return cc(t,n)}catch(s){if((s.message||"").match(/stack|recursion/i))return console.warn("react-fast-compare cannot handle circular refs"),!1;throw s}};const nA=ip(tA);var sA=[],sl=function(t,n,s){s===void 0&&(s={});var r=rt.useRef(null),o={onFirstUpdate:s.onFirstUpdate,placement:s.placement||"bottom",strategy:s.strategy||"absolute",modifiers:s.modifiers||sA},i=rt.useState({styles:{popper:{position:o.strategy,left:"0",top:"0"},arrow:{position:"absolute"}},attributes:{}}),a=i[0],l=i[1],u=rt.useMemo(function(){return{name:"updateState",enabled:!0,phase:"write",fn:function(g){var m=g.state,v=Object.keys(m.elements);Rw.flushSync(function(){l({styles:kg(v.map(function(b){return[b,m.styles[b]||{}]})),attributes:kg(v.map(function(b){return[b,m.attributes[b]]}))})})},requires:["computeStyles"]}},[]),d=rt.useMemo(function(){var p={onFirstUpdate:o.onFirstUpdate,placement:o.placement,strategy:o.strategy,modifiers:[].concat(o.modifiers,[u,{name:"applyStyles",enabled:!1}])};return nA(r.current,p)?r.current||p:(r.current=p,p)},[o.onFirstUpdate,o.placement,o.strategy,o.modifiers,u]),f=rt.useRef();return Rg(function(){f.current&&f.current.setOptions(d)},[d]),Rg(function(){if(!(t==null||n==null)){var p=s.createPopper||Y_,g=p(t,n,d);return f.current=g,function(){g.destroy(),f.current=null}}},[t,n,s.createPopper]),{state:f.current?f.current.state:null,styles:a.styles,attributes:a.attributes,update:f.current?f.current.update:null,forceUpdate:f.current?f.current.forceUpdate:null}};const ns=h.forwardRef(function({children:t,title:n,onClose:s,icon:r,skipOverflow:o,shadow:i=!0,padding:a=!0,border:l=!0,round:u=!0,className:d,classNameBody:f,size:p="m",titleClass:g=K("gs-utl-mb-2 gs-utl-mt-0.5"),style:m,bg:v,...b},x){const y=vr(r)?r:{};return c.jsxs("div",{...b,ref:x,style:m,className:K(["gs-utl-card",d,v||bp.bg,te.b,u&&te.rnd,l?B.br:te.bT,!o&&"gs-utl-overflow-auto",i&&"gs-utl-shadow-md",a&&p==="l"&&"gs-utl-p-5",a&&p==="m"&&"gs-utl-px-4 gs-utl-py-2",a&&p==="s"&&"gs-utl-px-2 gs-utl-py-1",a&&p==="xs"&&"gs-utl-px-2 gs-utl-py-0.5",a&&p==="x2s"&&"gs-utl-px-0.5"]),children:[(n||s)&&n!==!1&&c.jsxs(k,{className:K("gs-utl-card-title",g),items:"center",children:[c.jsx(F,{className:K("truncate"),grow:!0,children:n}),(s||r)&&c.jsx(F,{onClick:s,className:K("cursor-pointer transition-opacity opacity-50 hover:gs-utl-opacity-100"),children:c.jsx(ne,{icon:(dt(r)?r:"")||G.close,size:"18px",...y})})]}),c.jsx("div",{className:K("gs-utl-card-body",f),children:t})]})});var Al,rA=new Uint8Array(16);function oA(){if(!Al&&(Al=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||typeof msCrypto<"u"&&typeof msCrypto.getRandomValues=="function"&&msCrypto.getRandomValues.bind(msCrypto),!Al))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Al(rA)}const iA=/^(?:[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 aA(e){return typeof e=="string"&&iA.test(e)}var qt=[];for(var cd=0;cd<256;++cd)qt.push((cd+256).toString(16).substr(1));function lA(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:0,n=(qt[e[t+0]]+qt[e[t+1]]+qt[e[t+2]]+qt[e[t+3]]+"-"+qt[e[t+4]]+qt[e[t+5]]+"-"+qt[e[t+6]]+qt[e[t+7]]+"-"+qt[e[t+8]]+qt[e[t+9]]+"-"+qt[e[t+10]]+qt[e[t+11]]+qt[e[t+12]]+qt[e[t+13]]+qt[e[t+14]]+qt[e[t+15]]).toLowerCase();if(!aA(n))throw TypeError("Stringified UUID is invalid");return n}function h0(e,t,n){e=e||{};var s=e.random||(e.rng||oA)();return s[6]=s[6]&15|64,s[8]=s[8]&63|128,lA(s)}class cA extends Error{constructor(t,n){super(t),this.error=t,this.errorData=n}}const Wi=async(e,{onError:t,onLoading:n,onResult:s,params:r,rawText:o,...i})=>{try{n==null||n(!0);const a=r?new URLSearchParams(r).toString():"",l=a?`?${a}`:"",u=await fetch(`${e}${l}`,i);if(!u.ok){const f=await u.json();throw new cA(f.error||"Request failed!",f.errorData)}let d;if(o)d=await u.text();else try{d=await u.json()}catch{d=void 0}return s==null||s(d),d}catch(a){const l=a instanceof Error?a:new Error(a);if(t==null||t(l),i.throwError)throw l;return l}finally{n==null||n(!1)}};class Gs{static async get(t,n){return Wi(t,{...n,method:"GET"})}static async post(t,n){return Wi(t,{...n,method:"POST"})}static async put(t,n){return Wi(t,{...n,method:"PUT"})}static async patch(t,n){return Wi(t,{...n,method:"PATCH"})}static async delete(t,n){return Wi(t,{...n,method:"DELETE"})}}var cu=(e=>(e.Projects="projects",e.Settings="settings",e))(cu||{}),g0=(e=>(e.gjs="gjs",e.gjsStudio="gjs-studio",e))(g0||{});const Gg={},uA=1,dA=(e={})=>new Promise((t,n)=>{const s=(e==null?void 0:e.db)||"gjs",r=s==="gjs-studio"?uA:1,o=Gg[s];if(o)t(o);else{if(!Ws())return n(new Error("window context not found"));const i=window.indexedDB.open(s,r);i.onerror=n,i.onsuccess=()=>{const a=i.result;a.onerror=n,Gg[s]=a,t(a)},i.onupgradeneeded=()=>{const a=i.result;a.objectStoreNames.contains("projects")||a.createObjectStore("projects"),a.objectStoreNames.contains("settings")||a.createObjectStore("settings")}}}),eh=async(e,t)=>(await dA(t)).transaction([e],"readwrite").objectStore(e),fA=async(e,t)=>{const n=await eh(e,t);return new Promise((s,r)=>{const o=[],i=n.openCursor();i.onerror=r,i.onsuccess=function(a){const u=a.target.result;if(u){const d=u.primaryKey,f=u.value;o.push({key:d,data:f}),u.continue()}else s(o)}})},pA=async(e,t,n)=>{const s=await eh(e,n);return new Promise((r,o)=>{const i=s.get(t);i.onerror=o,i.onsuccess=()=>r(i.result)})},hA=async(e,t,n)=>{const s=await eh(e,n);return new Promise((r,o)=>{const i=s.delete(t);i.onerror=o,i.onsuccess=()=>r()})};var Ca=(e=>(e.Existing="existing",e.Templates="templates",e))(Ca||{});const gA=e=>{const t=t3();return`${(t==null?void 0:t.baseApiUrl)||"/api"}/templates/${e}`},mA=(e,t)=>Gs.get(gA(e),{...t}),vA=async e=>{try{const t=await mA(e);return(t==null?void 0:t.result)??[]}catch(t){return console.error(`Failed to load templates for type ${e}:`,t),[]}},m0=async(e=jt.web)=>typeof window>"u"?[]:(await fA(cu.Projects)).map(({key:s,data:r})=>{var o;return{id:`${s}`,name:`${((o=r.custom)==null?void 0:o.projectName)||s}`,data:r}}).filter(s=>{var r;return((r=s.data.custom)==null?void 0:r.projectType)===e}),v0=new Set,Nn=new WeakMap,fi=new WeakMap,$o=new WeakMap,xf=new WeakMap,bA=new WeakMap,Si=new WeakMap,Tc=new WeakMap;let Ur;const yo="__aa_tgt",wf="__aa_del",yA=e=>{const t=jA(e);t&&t.forEach(n=>EA(n))},xA=e=>{e.forEach(t=>{t.target===Ur&&SA(),Nn.has(t.target)&&zo(t.target)})};function wA(e){const t=xf.get(e);t==null||t.disconnect();let n=Nn.get(e),s=0;const r=5;n||(n=Ci(e),Nn.set(e,n));const{offsetWidth:o,offsetHeight:i}=Ur,l=[n.top-r,o-(n.left+r+n.width),i-(n.top+r+n.height),n.left-r].map(d=>`${-1*Math.floor(d)}px`).join(" "),u=new IntersectionObserver(()=>{++s>1&&zo(e)},{root:Ur,threshold:1,rootMargin:l});u.observe(e),xf.set(e,u)}function zo(e){clearTimeout(Tc.get(e));const t=uu(e),n=typeof t=="function"?500:t.duration;Tc.set(e,setTimeout(()=>{const s=$o.get(e);(!s||s.finished)&&(Nn.set(e,Ci(e)),wA(e))},n))}function SA(){clearTimeout(Tc.get(Ur)),Tc.set(Ur,setTimeout(()=>{v0.forEach(e=>x0(e,t=>b0(()=>zo(t))))},100))}function CA(e){setTimeout(()=>{bA.set(e,setInterval(()=>b0(zo.bind(null,e)),2e3))},Math.round(2e3*Math.random()))}function b0(e){typeof requestIdleCallback=="function"?requestIdleCallback(()=>e()):requestAnimationFrame(()=>e())}let Sf,li;typeof window<"u"&&(Ur=document.documentElement,Sf=new MutationObserver(yA),li=new ResizeObserver(xA),li.observe(Ur));function jA(e){return e.reduce((t,n)=>{if(t===!1)return!1;if(n.target instanceof Element){if(ud(n.target),!t.has(n.target)){t.add(n.target);for(let s=0;s<n.target.children.length;s++){const r=n.target.children.item(s);if(r){if(wf in r)return!1;ud(n.target,r),t.add(r)}}}if(n.removedNodes.length)for(let s=0;s<n.removedNodes.length;s++){const r=n.removedNodes[s];if(wf in r)return!1;r instanceof Element&&(t.add(r),ud(n.target,r),fi.set(r,[n.previousSibling,n.nextSibling]))}}return t},new Set)}function ud(e,t){!t&&!(yo in e)?Object.defineProperty(e,yo,{value:e}):t&&!(yo in t)&&Object.defineProperty(t,yo,{value:e})}function EA(e){var t;const n=Ur.contains(e),s=Nn.has(e);n&&fi.has(e)&&fi.delete(e),$o.has(e)&&((t=$o.get(e))===null||t===void 0||t.cancel()),s&&n?TA(e):s&&!n?OA(e):PA(e)}function Ts(e){return Number(e.replace(/[^0-9.\-]/g,""))}function Ci(e){const t=e.getBoundingClientRect();return{top:t.top+window.scrollY,left:t.left+window.scrollX,width:t.width,height:t.height}}function y0(e,t,n){let s=t.width,r=t.height,o=n.width,i=n.height;const a=getComputedStyle(e);if(a.getPropertyValue("box-sizing")==="content-box"){const u=Ts(a.paddingTop)+Ts(a.paddingBottom)+Ts(a.borderTopWidth)+Ts(a.borderBottomWidth),d=Ts(a.paddingLeft)+Ts(a.paddingRight)+Ts(a.borderRightWidth)+Ts(a.borderLeftWidth);s-=d,o-=d,r-=u,i-=u}return[s,o,r,i].map(Math.round)}function uu(e){return yo in e&&Si.has(e[yo])?Si.get(e[yo]):{duration:250,easing:"ease-in-out"}}function x0(e,...t){t.forEach(n=>n(e,Si.has(e)));for(let n=0;n<e.children.length;n++){const s=e.children.item(n);s&&t.forEach(r=>r(s,Si.has(s)))}}function TA(e){const t=Nn.get(e),n=Ci(e);let s;if(!t)return;const r=uu(e);if(typeof r!="function"){const o=t.left-n.left,i=t.top-n.top,[a,l,u,d]=y0(e,t,n),f={transform:`translate(${o}px, ${i}px)`},p={transform:"translate(0, 0)"};a!==l&&(f.width=`${a}px`,p.width=`${l}px`),u!==d&&(f.height=`${u}px`,p.height=`${d}px`),s=e.animate([f,p],r)}else s=new Animation(r(e,"remain",t,n)),s.play();$o.set(e,s),Nn.set(e,n),s.addEventListener("finish",zo.bind(null,e))}function PA(e){const t=Ci(e);Nn.set(e,t);const n=uu(e);let s;typeof n!="function"?s=e.animate([{transform:"scale(.98)",opacity:0},{transform:"scale(0.98)",opacity:0,offset:.5},{transform:"scale(1)",opacity:1}],{duration:n.duration*1.5,easing:"ease-in"}):(s=new Animation(n(e,"add",t)),s.play()),$o.set(e,s),s.addEventListener("finish",zo.bind(null,e))}function OA(e){if(!fi.has(e)||!Nn.has(e))return;const[t,n]=fi.get(e);Object.defineProperty(e,wf,{value:!0}),n&&n.parentNode&&n.parentNode instanceof Element?n.parentNode.insertBefore(e,n):t&&t.parentNode&&t.parentNode.appendChild(e);const[s,r,o,i]=_A(e),a=uu(e),l=Nn.get(e);let u;Object.assign(e.style,{position:"absolute",top:`${s}px`,left:`${r}px`,width:`${o}px`,height:`${i}px`,margin:0,pointerEvents:"none",transformOrigin:"center",zIndex:100}),typeof a!="function"?u=e.animate([{transform:"scale(1)",opacity:1},{transform:"scale(.98)",opacity:0}],{duration:a.duration,easing:"ease-out"}):(u=new Animation(a(e,"remove",l)),u.play()),$o.set(e,u),u.addEventListener("finish",()=>{var d;e.remove(),Nn.delete(e),fi.delete(e),$o.delete(e),(d=xf.get(e))===null||d===void 0||d.disconnect()})}function _A(e){const t=Nn.get(e),[n,,s]=y0(e,t,Ci(e));let r=e.parentElement;for(;r&&(getComputedStyle(r).position==="static"||r instanceof HTMLBodyElement);)r=r.parentElement;r||(r=document.body);const o=getComputedStyle(r),i=Nn.get(r)||Ci(r),a=Math.round(t.top-i.top)-Ts(o.borderTopWidth),l=Math.round(t.left-i.left)-Ts(o.borderLeftWidth);return[a,l,n,s]}function AA(e,t={}){Sf&&li&&(getComputedStyle(e).position==="static"&&Object.assign(e.style,{position:"relative"}),x0(e,zo,CA,n=>li==null?void 0:li.observe(n)),typeof t=="function"?Si.set(e,t):Si.set(e,{duration:250,easing:"ease-in-out",...t}),Sf.observe(e,{childList:!0}),v0.add(e))}function LA(e){const t=h.useRef(null);return h.useEffect(()=>{t.current instanceof HTMLElement&&AA(t.current,e)},[t]),t}const MA={[cn.Info]:B.bgA,[cn.Error]:"bg-red-500",[cn.Success]:"bg-green-500",[cn.Warning]:"bg-orange-400"},NA=h.forwardRef(function(t,n){const s={[cn.Info]:G.informationVariant,[cn.Error]:G.fire,[cn.Success]:G.checkBold,[cn.Warning]:G.alertRhombus},{children:r,className:o,content:i,id:a,buttons:l=[],variant:u=cn.Info,autoHideTimeout:d=3e3}=t,f=h.useRef(null),p=h.useRef(),g=s[u],m=MA[u];h.useImperativeHandle(n,()=>f.current,[]);const v=()=>{var w;return(w=t.onDismiss)==null?void 0:w.call(t,a)},b=()=>{d&&(p.current=setTimeout(v,d))},x=()=>p.current&&clearTimeout(p.current);h.useEffect(()=>(b(),x),[]);const y=i||r;return c.jsx(ns,{className:ie(o,"overflow-hidden relative"),ref:f,onPointerEnter:x,onPointerLeave:b,children:c.jsxs(k,{space:"m",items:"center",className:ie(Ee.y),children:[c.jsx(F,{className:ie(m,te.pill,"text-white gjs-p-1"),children:c.jsx(ne,{icon:g,size:oe.s})}),c.jsx(F,{grow:!0,className:ie("gjs-pr-3"),children:c.jsxs(k,{col:!0,space:"xs",children:[c.jsx(F,{className:ie("text-lg font-medium leading-6"),children:t.header}),y&&c.jsx(F,{className:ie(B.txtLowEmphasis),children:y}),!!l.length&&c.jsx(k,{space:"m",justify:"end",children:l.map(({id:w,...S})=>c.jsx(Ke,{...S},w))})]})}),c.jsx(F,{className:ie("absolute top-1 right-1"),children:c.jsx(St,{onClick:v,border:!1,children:c.jsx(ne,{icon:G.close,size:oe.s})})})]})})});ce(h.forwardRef(function({className:t,toasts:n,onDismiss:s,...r},o){const i=LA({});return c.jsx("div",{className:ie(t,"w-80 gs-utl-z-30"),...r,ref:i,children:n.map(a=>c.jsx(NA,{...a,className:ie("gjs-mb-2"),onDismiss:s},a.uuid||a.id))})}));var Cf=(e=>(e.self="self",e.cloud="cloud",e))(Cf||{}),To=(e=>(e.image="image",e.video="video",e))(To||{}),os=(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))(os||{}),th=(e=>(e.canvas="canvas",e.layers="layers",e))(th||{}),Pr=(e=>(e.selectParent="selectParent",e.duplicate="duplicate",e.delete="delete",e.symbolCreate="symbolCreate",e.symbolDetach="symbolDetach",e.symbolOverride="symbolOverride",e.symbolOverrideClear="symbolOverrideClear",e))(Pr||{}),Ut=(e=>(e.variable="data-variable",e.condition="data-condition",e.conditionTrue="data-condition-true-content",e.conditionFalse="data-condition-false-content",e.collection="data-collection",e.collectionItem="data-collection-item",e))(Ut||{}),jf=(e=>(e.browser="browser",e.self="self",e.cloud="cloud",e))(jf||{});const ja=e=>e.replaceAll('"',"").replaceAll("'",""),ko=e=>e.includes(",")?e:/\s/.test(e)?`'${ja(e)}'`:ja(e),qg=(e,t,n)=>({family:e,variant:t,...n}),ia=(e,t)=>{e=ko(e);const{menuVariant:n,variants:s}=t;return{family:e,familyLabel:ja(e),menuVariant:n&&qg(ko(`menuFont-${ja(e)}`),"regular",n),variants:Object.assign({},...Object.entries(s).map(([r,o])=>({[r]:qg(e,r,o)})))}},nh=(e,t)=>{var a;const n=ia(e.family,e),s=n.menuVariant??((a=Object.values(n.variants))==null?void 0:a[0]);if(!s)return"Arial, Helvetica, sans-serif";const{source:r,descriptors:o}=s,i=ja(s.family);if(!t){const l=new FontFace(i,`url("${r}")`,o),u=Array.from(document.fonts.values()).filter(d=>d.family===i);for(const d of u)document.fonts.delete(d);document.fonts.add(l),l.load().catch(()=>{})}return ko(i)},Cs=", sans-serif",Kg=["Arial, Helvetica"+Cs,"Arial Black, Gadget"+Cs,"Brush Script MT"+Cs,"Comic Sans MS, cursive"+Cs,"Courier New, Courier, monospace","Georgia, serif","Helvetica"+Cs,"Impact, Charcoal"+Cs,"Lucida Sans Unicode, Lucida Grande"+Cs,"Tahoma, Geneva"+Cs,"Times New Roman, Times, serif","Trebuchet MS, Helvetica"+Cs,"Verdana, Geneva"+Cs].map(e=>({id:e,label:e.split(",")[0]})),$A=String.raw,Js=(e,t)=>{if(!t)return"";const n=e[0],s=e[1];return`${n}${t}${s}`},kA=({family:e,source:t,descriptors:n})=>{const{display:s,ascentOverride:r,descentOverride:o,featureSettings:i,lineGapOverride:a,stretch:l,style:u,unicodeRange:d,weight:f}=n??{},p=[Js`font-ascent-override: ${r};`,Js`font-display: ${s};`,Js`font-descent-override: ${o};`,Js`font-feature-settings: ${i};`,Js`font-line-gap-override: ${a};`,Js`font-stretch: ${l};`,Js`font-style: ${u};`,Js`font-unicode-range: ${d};`,Js`font-weight: ${f};`].filter(Boolean);return $A`
|
|
90
25
|
@font-face {
|
|
91
26
|
font-family: ${e};
|
|
92
27
|
src: url('${t}');
|
|
93
28
|
${p.join(`
|
|
94
29
|
`)}
|
|
95
30
|
}
|
|
96
|
-
`},
|
|
97
|
-
`;return n.trim()},
|
|
31
|
+
`},w0=(e={})=>{const t=Object.entries(e).map(([s,r])=>ia(s,r));let n="";for(const s of t)for(const r of Object.values(s.variants))n+=kA(r)+`
|
|
32
|
+
`;return n.trim()},S0="data-project-fonts",C0="true",RA=`${S0}="${C0}"`,j0=(e={})=>{const t=w0(e);return t?`<style ${RA}>
|
|
98
33
|
${t}
|
|
99
|
-
</style>`:""},
|
|
100
|
-
`);i.innerHTML=u,
|
|
101
|
-
`))}if(n.customCodeBody=b0(e,n.customCodeBody).html,t.replaceDataSources&&Jc(e)){const{currentItem:i}=((o=s.getCollectionsState)==null?void 0:o.call(s))||{};i&&Object.keys(n).forEach(a=>{const l=a,u=n[l];ot(u)&&(n[l]=v0(u,i))})}return n},v0=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,s)=>{const r=t[s.trim()];return r!==void 0?String(r):""}),y0=(e,t={})=>{const{currentItem:n}=t,s=t.ext??"html",r=Qt({page:e,key:"slug"})??"",o=n?v0(r,n):r,i=o.lastIndexOf("/"),a=i>=0,l=a?o.substring(i+1):o,u=a?o.substring(0,i):void 0,d=`${Ac(l)}${s?`.${s}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},vA=(e,t)=>e.get(`${Xc}${t}`)||"",yA=(e,t,n)=>{e.set({[`${Xc}${t}`]:n})},xA=(e,t)=>{Object.entries(t).forEach(([n,s])=>{e[`${hA}${n}`]=s})},wA=(e,t)=>{e.getModel().set("customData",{...yi(e),...t})},yi=e=>e.getModel().get("customData")??{},df=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},Qt=e=>{const{page:t,key:n,appEditorStore:s,def:r,defPage:o,opts:i}=e;return t?bA(t,i)[n]??o:df(s)[n]??r},br=(e,t,n)=>{const s=e.em.getEditor(),o=yi(s).globalPageSettings||{};return Qt({page:e,key:t,opts:n})||o[t]},Bg=(e,t)=>{const n=(e==null?void 0:e.getName())??"",s={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:Qt({...s,key:"slug",defPage:Ac(n)}),title:Qt({...s,key:"title",defPage:n}),description:Qt({...s,key:"description"}),favicon:Qt({...s,key:"favicon"}),keywords:Qt({...s,key:"keywords"}),socialTitle:Qt({...s,key:"socialTitle",defPage:n}),socialImage:Qt({...s,key:"socialImage"}),socialDescription:Qt({...s,key:"socialDescription"}),customCodeHead:Qt({...s,key:"customCodeHead"}),customCodeBody:Qt({...s,key:"customCodeBody"})}},yl=({icon:e,layout:t,tooltip:n,className:s,forceRemove:r,removeLayouts:o})=>({type:"button",icon:e,tooltip:n,className:s,size:"s",editorEvents:{[`${Tn.layoutToggleId}${t.id}`]:({fromEvent:i,setState:a})=>{a({active:i.isOpen})}},onClick:({editor:i})=>{o==null||o.forEach(a=>i.runCommand(ie.layoutRemove,{id:a,force:r})),i.runCommand(ie.layoutToggle,{...t})}}),zg={type:"static",layoutId:"leftPanelsContainer"},Ug={width:240,overflow:"hidden"};yl({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:Ug,placer:zg}}),yl({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:Ug,placer:zg}}),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:()=>c.jsx("div",{children:"Custom Reat component"})},header:{label:"Custom"},style:{marginLeft:40}}});const SA={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var CA={};class jA{constructor(t,n){var o,i;this.projectType=yt.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=CA.STUDIO_NPM_PACKAGE_VERSION,this.projectDataCustom={},this.displayMode="browser",this.projectPlugins=[],this.queryParams={},this.isCanvasPanning=!1,this.selectedDesignerTab="style",this.customAssets=void 0,this.nextProjectData=void 0,this.isDraggingAbsolute=!1,this.isSaving=!1,this.isReady=!1,this.sdkPagesConfigUpdates=0,this.panelPageSettings={isOpen:!1,width:300,page:void 0},this.rootElWidth=0,this._projectId="",this.store=t,n&&Object.keys(n).forEach(a=>{const l=a,u=n[l];u!==void 0&&(this[l]=u)});const s=Vs()?window.location.search:"";this.queryParams=Pw(s),on(this,{sdkProps:!1},{autoBind:!0});const r=(i=(o=this.sdkProps.options)==null?void 0:o.customTheme)==null?void 0:i.icons;r&&EE(r)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return Hf({isDev:t,isStage:n})}get projectId(){var s,r;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((r=(s=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:s.custom)==null?void 0:r.id)||""}get projectIdToLoad(){return this.store.localSettingsStore.lastProjectId||this.projectId}get currentProjectId(){return this.projectDataCustom.id||this.projectId}get isBrowserMode(){return this.displayMode==="browser"}get sdkOptions(){return this.sdkProps.options}get sdkProjectId(){var t,n;return(n=(t=this.sdkOptions.project)==null?void 0:t.id)==null?void 0:n.toString()}get sdkIdentityId(){var t,n;return(n=(t=this.sdkOptions.identity)==null?void 0:t.id)==null?void 0:n.toString()}get sdkPagesConfig(){return this.sdkPagesConfigUpdates,this.sdkOptions.pages}get sdkLayoutConfig(){return this.sdkOptions.layout}get sdkComponentsConfig(){return this.sdkOptions.components}get sdkCanvasConfig(){return this.sdkOptions.canvas}get sdkGlobalStylesConfig(){return this.sdkOptions.globalStyles}get currentLayout(){const{sdkLayoutConfig:t,rootElWidth:n,store:s}=this,{customConfig:r}=s.layoutStore,o=(r==null?void 0:r.responsive)||(t==null?void 0:t.responsive);let i=(r==null?void 0:r.default)||(t==null?void 0:t.default)||SA;if(n&&o){const l=Object.keys(o).map(Number).sort((u,d)=>u-d).find(u=>n<=u);i=l?o[l]:i}return i}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===yt.email}get showPages(){return this.isReady&&this.sdkPagesConfig!==!1&&!this.isProjectTypeEmail}get showSelectors(){return!this.isProjectTypeEmail}get sdkMisconfigurationError(){if(this.store.assetsStore.isUsingAssetCloud||this.isUsingProjectCloud){const n=this.sdkProjectId,s=this.sdkIdentityId;if(!n||!s)return'SDK Misconfiguration Error: When using assets.storageType == "cloud" or storage.type === "cloud", project.id and identity.id are required.'}return""}get isUsingProjectSelfHosted(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===cf.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===cf.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:s,lastProjectType:r}=t.localSettingsStore,o=(f=n.project)==null?void 0:f.default,{project:i}=n.storage||{};let a,l;r&&(this.store.templatesStore._projectTypeFilter=r),s&&(a=(p=(yield r0(r)).find(m=>m.id===s))==null?void 0:p.data),a?l=a:i?l=i:o&&(l=o);const u=(l==null?void 0:l.custom)||{},d=u.projectType;d&&(this.projectType=d),u.projectType=this.projectType,this.setProjectDataCustom({...u,id:this.projectIdToLoad}),yield t.pluginStore.initProjectPlugins(this.projectType),this.editorKey++}setInstallEvent(t){this.installEvent=t}setAppInstalled(t){this.appInstalled=t}setDisplayMode(t){this.displayMode=t}setProject(t){const n=this.editor,{id:s,data:r,isTemplate:o}=t,i=n.Storage.getConfig().options.local,a=o?`${s}__${_w()}`:s;this._projectId=a,i.key=a,Ew(r)||this.loadProjectData({...r,custom:{...r.custom,id:a,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||yt.web,this.editor&&wA(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(EA(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const s=this.editor;s.loadProjectData(t),s.UndoManager.clear(),this.setProjectDataCustom(n)}}setNextProjectData(t){this.nextProjectData=t}setLeftSidebarSize(t){this.leftSidebarSize=t}setRightSidebarSize(t){this.rightSidebarSize=t}setEditor(t){this.editor=t}setPreview(t){this.isInPreview=t}toggleCssPanel(){this.isCssPanelActive=!this.isCssPanelActive}toggleLeftSidebar(){this.isLeftSidebarOpen=!this.isLeftSidebarOpen,this.refreshEditorPostTransition()}setLeftSidebarOpen(t){this.isLeftSidebarOpen=t,this.refreshEditorPostTransition()}toggleRightSidebar(){this.isRightSidebarOpen=!this.isRightSidebarOpen,this.refreshEditorPostTransition()}setRightSidebarOpen(t){this.isRightSidebarOpen=t,this.refreshEditorPostTransition()}setTopSidebarOpen(t){this.isTopSidebarOpen=t,this.refreshEditorPostTransition()}setBottomSidebarOpen(t){this.isBottomSidebarOpen=t,this.refreshEditorPostTransition()}refreshEditorPostTransition(){setTimeout(()=>{var t;return(t=this.editor)==null?void 0:t.refresh()},this.transitionTime)}setCanvasPanning(t){this.isCanvasPanning=t}setSelectingTarget(t){this.isSelectingTarget=t}setSelectedDesignerTab(t){this.selectedDesignerTab=t}setCustomAssets(t){this.customAssets=t}setIsDraggingAbsolute(t){this.isDraggingAbsolute=t}setIsSaving(t){this.isSaving=t}setIsReady(t){this.isReady=t}setPanelPageSettings(t){this.panelPageSettings={...this.panelPageSettings,...t}}setSdkPagesConfig(t){this.sdkProps.options.pages=t&&{...this.sdkPagesConfig,...t},++this.sdkPagesConfigUpdates}setRootElWidth(t){this.rootElWidth=t,this.refreshEditorCanvas()}*loadLicense(){const{editor:t}=this;try{this.licenseCheckStarted=!0;const{licenseKey:n,baseApiUrl:s,studioSdkVersion:r}=this;t==null||t.trigger(sb,{baseApiUrl:s});const o=yield Is.post(`${s}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:r}});if(o instanceof Error)throw o;const i=o.result||{},{license:a,error:l,plan:u}=i;l?this.sdkLicenseError=l:(this.sdkLicense=a,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Id,i)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Id,{}))}}*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 EA=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||yt.web},ye=()=>bn().appEditorStore,x0=()=>wh().appEditorStore,PA=()=>{try{return wh().appEditorStore}catch{}},Bp=()=>{const[e,t]=h.useState(0),n=bn().appEditorStore,{transitionTime:s}=n;return h.useEffect(()=>{setTimeout(()=>t(r=>++r),s)},[s]),[e]},zp=()=>{const{baseApiUrl:e}=x0();return`${e}/assets/sdk`},_A=e=>`${zp()}/${e}`,TA=async(e,t,n)=>{const s=await Is.get(zp(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((s==null?void 0:s.result)??[]).map(({asset:r,cdnUrl:o})=>({...r,size:parseInt(r.size),src:o}))},OA=async(e,t,n,s)=>{const r=await Is.post(zp(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},AA=async(e,t)=>await Is.put(t,{body:e,rawText:!0}),NA=async(e,t,n,s)=>Promise.all(e.map(r=>OA({name:r.name,size:r.size,type:r.type},t,n,s).then(async o=>{if(!o)throw new Error("No asset");const{asset:i,cdnUrl:a,uploadUrl:l}=o,u=await AA(r,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...i,size:parseInt(i.size),src:a,type:go.image}}))),MA=async(e,t,n,s)=>{const r=await Is.delete(_A(e),{body:JSON.stringify({projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},Wg=async(e,t,n,s)=>Promise.all(e.map(r=>MA(r.id||r.src,t,n,s)));function Tr(e,t,n){let s,r,o,i,a;const l=t===void 0?100:t;function u(){const f=Date.now()-i;f<l&&f>=0?s=setTimeout(u,l-f):(s=null,a=e.apply(o,r),o=r=null)}const d=function(){return o=this,r=arguments,i=Date.now(),s||(s=setTimeout(u,l)),a};return d.clear=function(){s&&(clearTimeout(s),s=null)},d.flush=function(){s&&(a=e.apply(o,r),o=r=null,clearTimeout(s),s=null)},d}class Gg{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,on(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=Tr(this.loadAssets,this.searchDebounceMs)}get typeFilterOptions(){return this.customTypes??[]}get providers(){return this.assetsStore.allProviders.map(t=>({...t,types:Array.isArray(t.types)?t.types:[t.types]}))}get providerFilterOptions(){return this.providers.filter(t=>(!this.typeFilter||t.types.includes(this.typeFilter))&&(!this.customProviders||this.customProviders.includes(t.id)))}get provider(){return this.providers.find(t=>t.id===this.providerFilter)}get assetPropsFromPages(){if(!this.customPages)return;const t=[];for(const n of this.customPages)t.push(...n.items);return t}get assetProps(){if(!!!this.assetPropsFromPages&&this.isLoadingAssets)return[];const n=this.customAssetProps??this.assetPropsFromPages??this.assetsStore.projectAssetProps??[];return this.typeFilter?n.filter(s=>s.type===this.typeFilter):n}get onProviderOrProjectDelete(){const{provider:t,assetsStore:n}=this;return t?t.onDelete:n.onProjectDelete}get t(){return this.assetsStore.t}get isLoading(){return this.assetsStore.isLoadingAssets||this.isLoadingAssets}get handleDelete(){return this.onProviderOrProjectDelete&&this.handleDeleteCallback}get shouldLoadNextPage(){var n;const t=(n=this.customPages)==null?void 0:n.at(-1);return t?!t.isLastPage:!1}get reloadOnInput(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.reloadOnInput)??!1}get searchDebounceMs(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.debounceMs)??1e3}initOptionalType(){this.setOptionalType(!1)}initOptionalProvider(){var t;this.setOptionalProvider(!!(((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.projectAssetsOption)??!0))}initTypeFilter(){this.setTypeFilter(go.image)}initProviderFilter(){var t;this.setProviderFilter((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.providerId)}setOptionalType(t){this.optionalType=t}setOptionalProvider(t){this.optionalProvider=t}setTypeFilter(t){this.typeFilter=t}setProviderFilter(t){this.providerFilter=t}setSearchValue(t){this.searchValue=t,this.reloadOnInput&&this.loadAssetsDebounced()}setCustomTypes(t){this.customTypes=t}setCustomProviders(t){this.customProviders=t}setCustomAssetProps(t){this.customAssetProps=t}setCustomPages(t){this.customPages=t}setItemLayout(t){this.itemLayout=t}setIsLoadingAssets(t){this.isLoadingAssets=t}selectProjectAssets(){this.setCustomAssetProps(void 0),this.setCustomPages(void 0),this.setItemLayout(void 0)}async loadProviderAssets(t){var a,l,u,d;const{assetsStore:n}=this,{editor:s}=n;if(!s||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const r=((a=this.customPages)==null?void 0:a.length)??0,o=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,i=await this.provider.onLoad({editor:s,assetTypeFilter:this.typeFilter,pageIndex:r,searchValue:this.searchValue,pageCustomData:o})??[];if(Array.isArray(i)){const f=i.map(n.toAssetProps);this.setCustomAssetProps(f)}else{const f={...i,items:i.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:s}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(r){console.error(r),s.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:s}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&s&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:s}=this,{appEditorStore:r}=n.store,{editor:o}=r;if(!(!o||!s))try{n.setIsLoadingAssets(!0),await s({assets:[n.toAsset(t)],assetProps:[t],editor:o,loadAssets:i=>this.reloadAssets(i)})}catch(i){console.error(i),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:i==null?void 0:i.message})}finally{n.setIsLoadingAssets(!1)}}}const w0=e=>bn().assetsStore.assetPanelStores[e];class LA{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${n0()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new Gg(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),on(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===lf.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===lf.self}get editor(){return this.store.appEditorStore.editor}get customOnLoad(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onLoad}get customOnDelete(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onDelete}get customOnUpload(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onUpload}get onCloudOrCustomUpload(){const{appEditorStore:t}=this.store,{sdkProps:n}=t,r=n.options.licenseKey,o=t.sdkProjectId,i=t.sdkIdentityId,a=({files:l})=>NA(l,r,o,i);return this.isUsingAssetCloud?a:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:s}=this;return n?t?async r=>{await t(r),this.deleteFromProjectAssets(r)}:void 0:s?async r=>{var l,u;const{sdkOptions:o}=this.store.appEditorStore,i=(l=o.project)==null?void 0:l.id,a=(u=o.identity)==null?void 0:u.id;await Wg(r.assetProps,o.licenseKey,i,a),this.deleteFromProjectAssets(r)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var a,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,s=(a=n.project)==null?void 0:a.id,r=(l=n.identity)==null?void 0:l.id,o=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:go.image,onLoad:()=>TA(o,s,r),onDelete:async u=>{const{assetProps:d,loadAssets:f}=u;await Wg(d,o,s,r),this.deleteFromProjectAssets(u),await f({clearExisting:!1})}}}onEditor(){const t=Tr(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const s=n.Assets.events.all;n.on(s,t),this.loadProjectAssets()}addSdkProviders(){var s;const t=((s=this.sdkAssetConfig)==null?void 0:s.providers)??[],n=Ye(t)?t({providers:Er(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const s=[...this.allProviders];let r=this.allProviders.findIndex(i=>i.id===t.id);const o=r!==-1;s.splice(n,0,t),o&&(r>=n&&(r+=1),s.splice(r,1)),this.setAllProviders(s)}hasType(t){return!!this.allProviders.find(n=>ot(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new Gg(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:s,customOnLoad:r}=this,{toastStore:o}=this.store;let i;if(t){try{if(this.setIsLoadingAssets(!0),n&&r)if(s)i=s;else{const a=await r({editor:t});this.cachedOnLoadAssetProps=a.map(this.toAssetProps),i=this.cachedOnLoadAssetProps}else i=t.Assets.getAll().map(this.toAssetProps)}catch(a){console.error(a),o.addError("assets-error-load",{header:this.t("errorLoad"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}i&&this.setProjectAssetProps(i)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:s}){const{cachedOnLoadAssetProps:r,customOnLoad:o}=this;if(o){if(r){const i=s.map(a=>a.id);this.cachedOnLoadAssetProps=r.filter(({id:a})=>!i.includes(a)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(i=>n.Assets.remove(i)),Fg(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:s,customOnLoad:r}=this;r?s&&(this.cachedOnLoadAssetProps=[...t,...s],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),Fg(n))}async handleUpload(t){var o,i;const{editor:n,onCloudOrCustomUpload:s}=this,{toastStore:r}=this.store;if(!(!n||!s))try{this.setIsLoadingAssets(!0);const a=((o=t.dataTransfer)==null?void 0:o.files)||((i=t.target)==null?void 0:i.files)||[],l=Array.from(a),u=await s({files:l,editor:n});if(u!=null&&u.length){const d=u.map(this.toAssetProps);return this.addToProjectAssets(d),d}else console.warn("No assets returned from the upload handler. Ensure to return an array of assets.")}catch(a){console.error(a),r.addError("assets-error-upload",{header:this.t("errorUpload"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}}uploadFile(t){var n;return(n=this.editor)==null?void 0:n.Assets.FileUploader().uploadFile(t)}isAsset(t){return!!t.getSrc}toAssetProps(t){if(this.isAsset(t)){const s=t;return{...s.attributes,id:s.attributes.id||s.getSrc(),src:s.getSrc(),name:s.attributes.name??s.getFilename(),type:s.attributes.type??s.getType()??go.image,asset:s}}return{...t,type:t.type||go.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 Ka=()=>bn().assetsStore;class RA{constructor(t){var s;this.store=t,this.fonts={},on(this,{},{autoBind:!0});const n=(s=this.sdkFontOptions)==null?void 0:s.default;this.sdkDefaultFonts=Ye(n)?n({baseDefault:kg}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>ot(t)?{id:t,label:t}:Vg(t)?t:null).filter(t=>!!t):kg}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!ot(n)&&!Vg(n)).map(n=>Qi(n.family,n)):[]}get sortedFonts(){return lA(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return cA([...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 Lt(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Lt(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=yi(t)??{},{fonts:s}=n??{};if(s)for(const[r,o]of Object.entries(s)){const i=Qi(r,o);this.addFont(i,{skipUpdate:!0})}}loadDefaultFonts(){const{editor:t}=this.store.appEditorStore;if(t)for(const n of this.defaultWebFonts)this.addFont(n,{overwrite:!1,skipUpdate:!0})}getFont(t){return t=Po(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:s=!0}={}){const r=Qi(t.family,t),{editor:o}=this.store.appEditorStore;if(!o)return;const{family:i}=r;!s&&this.fonts[i]||(this.fonts[i]=r,n||this.updateProjectFonts(o))}removeFont(t){t=Po(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const s={...yi(t).globalPageSettings,fonts:Er(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:s}),g0(t),t.trigger(Tn.pageSettingsUpdate,{data:s})}}const Ya=()=>bn().fontsStore;class $A{constructor(t){this.store=t,on(this,{},{autoBind:!0})}t(t,n={}){var r;const{editor:s}=this.store.appEditorStore;return((r=s==null?void 0:s.I18n)==null?void 0:r.t(t,n))||""}tScoped(t){return(n,s)=>this.t(`${t}.${n}`,s)}}const Re=()=>bn().i18nStore,Bn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),qg="gs-custom-layout",kA=h.forwardRef(function({className:t,component:n,noWrapper:s,id:r,render:o,componentProps:i,...a},l){const{editor:u}=ye(),d=h.useRef(null),f=n,p=f&&u?c.jsx(f,{...i,editor:u}):null,g=N(qg,r&&`${qg}__${r}`,t),m=s&&!o;return h.useImperativeHandle(l,()=>d.current,[]),h.useEffect(()=>{const b=d.current;if(!o||!b)return;const v=w=>b.appendChild(w),x=w=>b.removeChild(w),y=o({editor:u,addEl:v,removeEl:x});if(ot(y))b.innerHTML=y;else{if(y instanceof HTMLElement)return v(y),()=>{x(y)};if(Ye(y))return()=>{y()}}},[o,u,d.current]),m?p:c.jsx("div",{className:g,ref:d,...a,children:p})}),ff=fe(kA);class VA{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,on(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}add(t,n){var s;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(s=this.editor)==null||s.trigger(`${Tn.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var r;const s=n==null?void 0:n.layout;s&&this.layouts.forEach(o=>{o.id===t&&Object.assign(o,s)}),this.layouts=n!=null&&n.force?this.layouts.filter(o=>o.id!==t):this.layouts.map(o=>o.id===t?{...o,toRemove:!0}:o),(r=this.editor)==null||r.trigger(`${Tn.layoutToggleId}${t}`,{isOpen:!1})}get(t){return this.layouts.find(n=>n.id===t)}clear(){this.layouts=[]}addCustomLayoutComponent(t,n){this.customLayoutComponents.set(t,n)}getCustomLayoutComponent(t){return this.customLayoutComponents.get(t)}removeCustomLayoutComponent(t){this.customLayoutComponents.delete(t)}get layoutChildren(){var s;const{children:t}=this.store.appEditorStore.sdkProps,n=((s=Bn(t,ff))==null?void 0:s.filter(Boolean))||[];return new Map(n.map(({props:r})=>[r.id,r]))}}const S0=()=>bn().layoutStore,IA=()=>wh().layoutStore;class DA{constructor(t){this.isActive=!1,this.content="",this.store=t,on(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=ma.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,on(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===ma.Existing?this.projects:this.templates}async loadProjects(){const t=await r0(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var r;const t=(r=this.store.appEditorStore.sdkOptions.templates)==null?void 0:r.onLoad,n=async()=>await BO(this.projectTypeFilter);let s;if(t){const o=this.store.appEditorStore.editor;s=await t({editor:o,fetchCommunityTemplates:n})}else s=await n();this.setTemplates(s)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){DO(Yc.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 C0=()=>bn().templatesStore;class FA{constructor(t){this.toasts=[],this.store=t,on(this,{},{autoBind:!0})}add(t,n){this.toasts.find(s=>s.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...ot(n)?{header:n}:n,variant:nn.Error})}addWarning(t,n){this.add(t,{...ot(n)?{header:n}:n,variant:nn.Warning})}addSuccess(t,n){this.add(t,{...ot(n)?{header:n}:n,variant:nn.Success})}addInfo(t,n){this.add(t,{...ot(n)?{header:n}:n,variant:nn.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class BA{constructor(t){this.isOpen=!1,this.store=t,on(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(Tn.toggleBlocksPanel,{isOpen:this.isOpen})}}const zA=()=>bn().blockManagerStore,j0=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",UA=j0+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",WA="["+j0+"]["+UA+"]*",GA=new RegExp("^"+WA+"$");function E0(e,t){const n=[];let s=t.exec(e);for(;s;){const r=[];r.startIndex=t.lastIndex-s[0].length;const o=s.length;for(let i=0;i<o;i++)r.push(s[i]);n.push(r),s=t.exec(e)}return n}const eu=function(e){const t=GA.exec(e);return!(t===null||typeof t>"u")};function qA(e){return typeof e<"u"}const KA={allowBooleanAttributes:!1,unpairedTags:[]};function YA(e,t){t=Object.assign({},KA,t);const n=[];let s=!1,r=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=Yg(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=Zg(e,o);continue}else{let a=!1;e[o]==="/"&&(a=!0,o++);let l="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
|
|
102
|
-
`&&e[o]!=="\r";o++)l+=e[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!
|
|
103
|
-
`||e==="\r"}function Yg(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const s=e.substr(n,t-n);if(t>5&&s==="xml")return Pt("InvalidXml","XML declaration allowed only at the start of the document.",Jt(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function Zg(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 ZA='"',XA="'";function JA(e,t){let n="",s="",r=!1;for(;t<e.length;t++){if(e[t]===ZA||e[t]===XA)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){r=!0;break}n+=e[t]}return s!==""?!1:{value:n,index:t,tagClosed:r}}const QA=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function Xg(e,t){const n=E0(e,QA),s={};for(let r=0;r<n.length;r++){if(n[r][1].length===0)return Pt("InvalidAttr","Attribute '"+n[r][2]+"' has no space in starting.",Ii(n[r]));if(n[r][3]!==void 0&&n[r][4]===void 0)return Pt("InvalidAttr","Attribute '"+n[r][2]+"' is without value.",Ii(n[r]));if(n[r][3]===void 0&&!t.allowBooleanAttributes)return Pt("InvalidAttr","boolean attribute '"+n[r][2]+"' is not allowed.",Ii(n[r]));const o=n[r][2];if(!nN(o))return Pt("InvalidAttr","Attribute '"+o+"' is an invalid name.",Ii(n[r]));if(!s.hasOwnProperty(o))s[o]=1;else return Pt("InvalidAttr","Attribute '"+o+"' is repeated.",Ii(n[r]))}return!0}function eN(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 tN(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,eN(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 Pt(e,t,n){return{err:{code:e,msg:t,line:n.line||n,col:n.col}}}function nN(e){return eu(e)}function sN(e){return eu(e)}function Jt(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Ii(e){return e.startIndex+e[1].length}const rN={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},oN=function(e){return Object.assign({},rN,e)};let bc;typeof Symbol!="function"?bc="@@xmlMetadata":bc=Symbol("XML Node Metadata");class io{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][bc]={startIndex:n})}static getMetaDataSymbol(){return bc}}class iN{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const s={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let r=1,o=!1,i=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!i){if(o&&no(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(s[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(o&&no(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(o&&no(t,"!ATTLIST",n))n+=8;else if(o&&no(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(no(t,"!--",n))i=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[n]===">"){if(i?t[n-1]==="-"&&t[n-2]==="-"&&(i=!1,r--):r--,r===0)break}else t[n]==="["?o=!0:a+=t[n];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:s,i:n}}readEntityExp(t,n){n=ln(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)s+=t[n],n++;if(Di(s),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 r="";return[n,r]=this.readIdentifierVal(t,n,"entity"),n--,[s,r,n]}readNotationExp(t,n){n=ln(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;!this.suppressValidationErr&&Di(s),n=ln(t,n);const r=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&r!=="SYSTEM"&&r!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);n+=r.length,n=ln(t,n);let o=null,i=null;if(r==="PUBLIC")[n,o]=this.readIdentifierVal(t,n,"publicIdentifier"),n=ln(t,n),(t[n]==='"'||t[n]==="'")&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(r==="SYSTEM"&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:o,systemIdentifier:i,index:--n}}readIdentifierVal(t,n,s){let r="";const o=t[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(n++;n<t.length&&t[n]!==o;)r+=t[n],n++;if(t[n]!==o)throw new Error(`Unterminated ${s} value`);return n++,[n,r]}readElementExp(t,n){n=ln(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;if(!this.suppressValidationErr&&!eu(s))throw new Error(`Invalid element name: "${s}"`);n=ln(t,n);let r="";if(t[n]==="E"&&no(t,"MPTY",n))n+=4;else if(t[n]==="A"&&no(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)r+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:s,contentModel:r.trim(),index:n}}readAttlistExp(t,n){n=ln(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;Di(s),n=ln(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!Di(r))throw new Error(`Invalid attribute name: "${r}"`);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 a=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!Di(l))throw new Error(`Invalid notation name: "${l}"`);a.push(l),t[n]==="|"&&(n++,n=ln(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,o+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=ln(t,n);let i="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",n+=7):[n,i]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:s,attributeName:r,attributeType:o,defaultValue:i,index:n}}}const ln=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function no(e,t,n){for(let s=0;s<t.length;s++)if(t[s]!==e[n+s+1])return!1;return!0}function Di(e){if(eu(e))return e;throw new Error(`Invalid entity name ${e}`)}const aN=/^[-+]?0x[a-fA-F0-9]+$/,lN=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,cN={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function uN(e,t={}){if(t=Object.assign({},cN,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&&aN.test(n))return hN(n,16);if(n.search(/.+[eE].+/)!==-1)return fN(e,n,t);{const s=lN.exec(n);if(s){const r=s[1]||"",o=s[2];let i=pN(s[3]);const a=r?e[o.length+1]===".":e[o.length]===".";if(!t.leadingZeros&&(o.length>1||o.length===1&&!a))return e;{const l=Number(n),u=String(l);if(l===0)return l;if(u.search(/[eE]/)!==-1)return t.eNotation?l:e;if(n.indexOf(".")!==-1)return u==="0"||u===i||u===`${r}${i}`?l:e;let d=o?i:n;return o?d===u||r+d===u?l:e:d===u||d===r+u?l:e}}else return e}}const dN=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function fN(e,t,n){if(!n.eNotation)return e;const s=t.match(dN);if(s){let r=s[1]||"";const o=s[3].indexOf("e")===-1?"E":"e",i=s[2],a=r?e[i.length+1]===o:e[i.length]===o;return i.length>1&&a?e:i.length===1&&(s[3].startsWith(`.${o}`)||s[3][0]===o)?Number(t):n.leadingZeros&&!a?(t=(s[1]||"")+s[3],Number(t)):e}else return e}function pN(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 hN(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 P0(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 gN{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=mN,this.parseXml=wN,this.parseTextData=bN,this.resolveNameSpace=vN,this.buildAttributesMap=xN,this.isItStopNode=EN,this.replaceEntitiesValue=CN,this.readStopNodeData=_N,this.saveTextToParentTag=jN,this.addChild=SN,this.ignoreAttributesFn=P0(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const s=this.options.stopNodes[n];typeof s=="string"&&(s.startsWith("*.")?this.stopNodesWildcard.add(s.substring(2)):this.stopNodesExact.add(s))}}}}function mN(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function bN(e,t,n,s,r,o,i){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,r,o);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?hf(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?hf(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function vN(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 yN=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function xN(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const s=E0(e,yN),r=s.length,o={};for(let i=0;i<r;i++){const a=this.resolveNameSpace(s[i][1]);if(this.ignoreAttributesFn(a,t))continue;let l=s[i][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const d=this.options.attributeValueProcessor(a,l,t);d==null?o[u]=l:typeof d!=typeof l||d!==l?o[u]=d:o[u]=hf(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const wN=function(e){e=e.replace(/\r\n?/g,`
|
|
104
|
-
`);const t=new
|
|
105
|
-
`;function
|
|
34
|
+
</style>`:""},IA=e=>e.sort((t,n)=>t.familyLabel<n.familyLabel?-1:t.familyLabel>n.familyLabel?1:0),VA=e=>e.sort((t,n)=>t.id<n.id?-1:t.id>n.id?1:0),Zg=e=>!!e.id,Jo=e=>t=>(t.tagName||"").toLowerCase()===e,_s=(...e)=>e.map(t=>`[data-gjs-type="${t}"]`).join(","),HA=(e,...t)=>{var n;return t.indexOf((n=e==null?void 0:e.tagName)==null?void 0:n.toUpperCase())>=0},pi=(e,...t)=>{var n;return!!e&&t.indexOf((n=e.tagName)==null?void 0:n.toLowerCase())>=0},Wr=(e,t)=>{var n;return(n=e==null?void 0:e.classList)==null?void 0:n.contains(t)},rl=(e,t)=>{var n;return!!((n=e==null?void 0:e.hasAttribute)!=null&&n.call(e,t))},ol=(e,t)=>{const n=e.Blocks.get(t);return n?n.collection.indexOf(n):-1},DA=e=>e.replace(/[^a-z0-9.]/gi,"_").toLowerCase(),Ef=(e,t,n="html")=>{const{Pages:s}=e,r=on({page:t,key:"slug"})??"";return`${s.getMain()===t?"index":Fc(r||t.getName())}.${n}`},FA=(e,t)=>{const{toolbar:n}=e;n.some(r=>r.id===t.id)||(n.unshift(t),e.set("toolbar",[...n]))},Pc="custom-html-body",Oc="data-custom-html-body",Yg="data-global-custom-html-head",Xg="data-global-custom-html-body",Jg="global",BA=function(e,t){const n=r=>{if(!r)return e.em.logError("loadGlobalHead: document not found");const o=Tf(t.appStore);let i=r.querySelector(`[${Yg}]`);i||(i=r.createElement("div"),i.setAttribute(Yg,"true"),r.head.insertBefore(i,r.head.firstChild));const a=j0(o.fonts),l=o.customCodeHead,u=[a,l].filter(d=>!!d).join(`
|
|
35
|
+
`);i.innerHTML=u,Yh(i)},s=r=>{if(!r)return e.em.logError("loadGlobalBody: document not found");const o=Tf(t.appStore);let i=r.querySelector(`[${Xg}]`);if(!i){i=r.createElement("div"),i.setAttribute(Xg,"true");const a=r.querySelector('[data-gjs-type="wrapper"]');a==null||a.appendChild(i)}i.innerHTML=o.customCodeBody||"",Yh(i)};e.on(e.Canvas.events.frameLoad,r=>{var o;return n((o=r.el.contentWindow)==null?void 0:o.document)}),e.on(e.Canvas.events.frameLoadBody,r=>{var o;return s((o=r.el.contentWindow)==null?void 0:o.document)}),e.on(Rn.pageSettingsUpdate,r=>{var i,a;if(r.page)return;const o=(a=(i=e.Canvas.getFrames()[0])==null?void 0:i.view)==null?void 0:a.getDoc();n(o),s(o)}),e.Components.addType(Pc,{isComponent:r=>rl(r,Oc),model:{defaults:{attributes:{[Oc]:!0},locked:!0,layerable:!1},toHTML:()=>""}}),e.on(e.events.projectLoad,()=>{const{appStore:r}=t,{globalPageSettings:o}=r.projectDataCustom;let i=(o==null?void 0:o.customCodeHead)||"",a=(o==null?void 0:o.customCodeBody)||"";e.Pages.getAll().forEach(l=>{const u=l.getMainComponent(),d=u.head.components(),f=[];d.forEach(m=>{m.has(Jg)&&f.push(m)}),f.forEach(m=>{const v=m.toHTML();i.includes(v)||(i+=v),m.remove()});const p=[];u.findType(Pc).forEach(m=>{m.has(Jg)&&p.push(m)}),p.forEach(m=>{const v=m.getInnerHTML();a.includes(v)||(a+=v),m.remove()})}),(i||a)&&r.setProjectDataCustom({globalPageSettings:{...o,customCodeHead:i,customCodeBody:a}})})},Ea="page://",du="href-params__",zA=`data-gjs-${du}`,fu=e=>{var t,n;return(n=(t=e==null?void 0:e.getMainComponent())==null?void 0:t.dataResolverProps)==null?void 0:n.path},pu=e=>!!fu(e),Qg=e=>{const t=e.getDirtyCount()||0;e.em.set({changesCount:t+1},{})},UA=e=>!!(e!=null&&e.Components.getType("mjml")),E0=e=>pu(e)?G.database:sh(e)?G.home:"",T0=e=>!!e.getSymbolOverride()?c.jsx(ne,{icon:G.rhombusOutline,size:oe.s3x}):c.jsx(mb,{className:M("gs-cmp-svg-icon gs-utl-w-[16px] gs-utl-fill-current"),svg:e.getIcon()}),P0=e=>{e.getModel().set({changesCount:e.getDirtyCount()+1})},sh=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"}},O0=e=>{for(const t in pt){const n=t;if(pt[n]({cmp:e}))return n}},_0=(e,t,n)=>{const s=[];let r=n;return e.getMainComponent().findType(Pc).forEach(o=>{s.push(o),r=(r||"")+o.getInnerHTML()}),{components:s,html:r,changed:r!==t}},WA=(e,t)=>{const n={...t},s=e.getMainComponent(),{head:r}=s;if(r){const i=[],a=r.components();a.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):O0(u)||i.push(u)});const l=e.em.Parser.parseHtml(`<!DOCTYPE html><html><head>${t.customCodeHead}</head></html>`);l.head&&(a.remove(i),l.head.components&&a.add(l.head.components),delete n.customCodeHead)}const o=_0(e,n.customCodeBody);if(o.changed){const[i,...a]=o.components;(i||s.append({type:Pc})[0]).components(n.customCodeBody),a.forEach(u=>u.remove()),delete n.customCodeBody}return e.set("settings",n)},GA=(e,t={})=>{var o;const n={...e.get("settings")??{}},s=e.getMainComponent(),{head:r}=s;if(r){const i=[];r.components().forEach(a=>{const{content:l,href:u}=a.getAttributes({noClass:!0,noStyle:!0});pt.title({cmp:a})?n.title=a.getInnerHTML():pt.favicon({cmp:a})?n.favicon=u:pt.description({cmp:a})?n.description=l:pt.keywords({cmp:a})?n.keywords=l:pt.socialTitle({cmp:a})?n.socialTitle=l:pt.socialDescription({cmp:a})?n.socialDescription=l:pt.socialImage({cmp:a})?n.socialImage=l:O0(a)||i.push(a.toHTML())}),i.length&&(n.customCodeHead=i.join(`
|
|
36
|
+
`))}if(n.customCodeBody=_0(e,n.customCodeBody).html,t.replaceDataSources&&fu(e)){const{currentItem:i}=((o=s.getCollectionsState)==null?void 0:o.call(s))||{};i&&Object.keys(n).forEach(a=>{const l=a,u=n[l];dt(u)&&(n[l]=A0(u,i))})}return n},A0=(e,t)=>e.replace(/\{\{\s*([a-zA-Z0-9_]+)\s*\}\}/g,(n,s)=>{const r=t[s.trim()];return r!==void 0?String(r):""}),L0=(e,t={})=>{const{currentItem:n}=t,s=t.ext??"html",r=on({page:e,key:"slug"})??"",o=n?A0(r,n):r,i=o.lastIndexOf("/"),a=i>=0,l=a?o.substring(i+1):o,u=a?o.substring(0,i):void 0,d=`${Fc(l)}${s?`.${s}`:""}`;return{path:u,filename:d,fullPath:u?`${u}/${d}`:d}},qA=(e,t)=>e.get(`${du}${t}`)||"",KA=(e,t,n)=>{e.set({[`${du}${t}`]:n})},ZA=(e,t)=>{Object.entries(t).forEach(([n,s])=>{e[`${zA}${n}`]=s})},YA=(e,t)=>{e.getModel().set("customData",{...ji(e),...t})},ji=e=>e.getModel().get("customData")??{},Tf=e=>(e==null?void 0:e.projectDataCustom.globalPageSettings)??{},on=e=>{const{page:t,key:n,appEditorStore:s,def:r,defPage:o,opts:i}=e;return t?GA(t,i)[n]??o:Tf(s)[n]??r},jr=(e,t,n)=>{const s=e.em.getEditor(),o=ji(s).globalPageSettings||{};return on({page:e,key:t,opts:n})||o[t]},em=(e,t)=>{const n=(e==null?void 0:e.getName())??"",s={page:e,appEditorStore:t,def:"",pageDef:""};return{name:n,slug:on({...s,key:"slug",defPage:Fc(n)}),title:on({...s,key:"title",defPage:n}),description:on({...s,key:"description"}),favicon:on({...s,key:"favicon"}),keywords:on({...s,key:"keywords"}),socialTitle:on({...s,key:"socialTitle",defPage:n}),socialImage:on({...s,key:"socialImage"}),socialDescription:on({...s,key:"socialDescription"}),customCodeHead:on({...s,key:"customCodeHead"}),customCodeBody:on({...s,key:"customCodeBody"})}},Ll=({icon:e,layout:t,tooltip:n,className:s,forceRemove:r,removeLayouts:o})=>({type:"button",icon:e,tooltip:n,className:s,size:"s",editorEvents:{[`${Rn.layoutToggleId}${t.id}`]:({fromEvent:i,setState:a})=>{a({active:i.isOpen})}},onClick:({editor:i})=>{o==null||o.forEach(a=>i.runCommand(se.layoutRemove,{id:a,force:r})),i.runCommand(se.layoutToggle,{...t})}}),tm={type:"static",layoutId:"leftPanelsContainer"},nm={width:240,overflow:"hidden"};Ll({tooltip:"Blocks",removeLayouts:["pagesLayers","ps"],layout:{id:"blocks",layout:"panelBlocks",header:{label:"Blocks"},style:nm,placer:tm}}),Ll({tooltip:"Pages & Layers",removeLayouts:["blocks","ps"],layout:{id:"pagesLayers",layout:"panelPagesLayers",header:!1,style:nm,placer:tm}}),Ll({tooltip:"Page Settings",removeLayouts:["pagesLayers","blocks"],layout:{id:"ps",layout:"panelPageSettings",header:{label:"Page Settings"},style:{marginLeft:40}}}),Ll({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 XA={type:"row",style:{height:"100%"},children:[{type:"sidebarLeft"},{type:"canvasSidebarTop"},{type:"sidebarRight"}]};var JA={NODE_ENV:"production"};class QA{constructor(t,n){var o,i;this.projectType=jt.web,this.editor=void 0,this.sdkProps={},this.sdkLicenseError="",this.licenseCheckRetry=0,this.showPoweredBy=!1,this.isInPreview=!1,this.isCssPanelActive=!1,this.isLeftSidebarOpen=!0,this.isRightSidebarOpen=!0,this.isTopSidebarOpen=!0,this.isBottomSidebarOpen=!0,this.isSelectingTarget=!1,this.leftSidebarSize=240,this.rightSidebarSize=240,this.transitionTime=152,this.topBarSize=36,this.isDev=!1,this.isStage=!1,this.editorKey=0,this.appInstalled=!1,this.licenseKey="",this.licenseCheckStarted=!1,this.studioSdkVersion=JA.STUDIO_NPM_PACKAGE_VERSION,this.projectDataCustom={},this.displayMode="browser",this.projectPlugins=[],this.queryParams={},this.isCanvasPanning=!1,this.selectedDesignerTab="style",this.customAssets=void 0,this.nextProjectData=void 0,this.isDraggingAbsolute=!1,this.isSaving=!1,this.isReady=!1,this.sdkPagesConfigUpdates=0,this.panelPageSettings={isOpen:!1,width:300,page:void 0},this.rootElWidth=0,this._projectId="",this.store=t,n&&Object.keys(n).forEach(a=>{const l=a,u=n[l];u!==void 0&&(this[l]=u)});const s=Ws()?window.location.search:"";this.queryParams=nS(s),pn(this,{sdkProps:!1},{autoBind:!0});const r=(i=(o=this.sdkProps.options)==null?void 0:o.customTheme)==null?void 0:i.icons;r&&bE(r)}get baseApiUrl(){const{isDev:t,isStage:n}=this;return rp({isDev:t,isStage:n})}get projectId(){var s,r;const{project:t,storage:n}=this.sdkOptions;return this._projectId||((r=(s=(n==null?void 0:n.project)||(t==null?void 0:t.default))==null?void 0:s.custom)==null?void 0:r.id)||""}get projectIdToLoad(){return this.store.localSettingsStore.lastProjectId||this.projectId}get currentProjectId(){return this.projectDataCustom.id||this.projectId}get isBrowserMode(){return this.displayMode==="browser"}get sdkOptions(){return this.sdkProps.options}get sdkProjectId(){var t,n;return(n=(t=this.sdkOptions.project)==null?void 0:t.id)==null?void 0:n.toString()}get sdkIdentityId(){var t,n;return(n=(t=this.sdkOptions.identity)==null?void 0:t.id)==null?void 0:n.toString()}get sdkPagesConfig(){return this.sdkPagesConfigUpdates,this.sdkOptions.pages}get sdkLayoutConfig(){return this.sdkOptions.layout}get sdkComponentsConfig(){return this.sdkOptions.components}get sdkCanvasConfig(){return this.sdkOptions.canvas}get sdkGlobalStylesConfig(){return this.sdkOptions.globalStyles}get currentLayout(){const{sdkLayoutConfig:t,rootElWidth:n,store:s}=this,{customConfig:r}=s.layoutStore,o=(r==null?void 0:r.responsive)||(t==null?void 0:t.responsive);let i=(r==null?void 0:r.default)||(t==null?void 0:t.default)||XA;if(n&&o){const l=Object.keys(o).map(Number).sort((u,d)=>u-d).find(u=>n<=u);i=l?o[l]:i}return i}get sdkCustomIcons(){var t;return(t=this.sdkOptions.customTheme)==null?void 0:t.icons}get isProjectTypeEmail(){return this.projectType===jt.email}get showPages(){return this.isReady&&this.sdkPagesConfig!==!1&&!this.isProjectTypeEmail}get showSelectors(){return!this.isProjectTypeEmail}get sdkMisconfigurationError(){if(this.store.assetsStore.isUsingAssetCloud||this.isUsingProjectCloud){const n=this.sdkProjectId,s=this.sdkIdentityId;if(!n||!s)return'SDK Misconfiguration Error: When using assets.storageType == "cloud" or storage.type === "cloud", project.id and identity.id are required.'}return""}get isUsingProjectSelfHosted(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===jf.self}get isUsingProjectCloud(){var t;return((t=this.sdkOptions.storage)==null?void 0:t.type)===jf.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:s,lastProjectType:r}=t.localSettingsStore,o=(f=n.project)==null?void 0:f.default,{project:i}=n.storage||{};let a,l;r&&(this.store.templatesStore._projectTypeFilter=r),s&&(a=(p=(yield m0(r)).find(m=>m.id===s))==null?void 0:p.data),a?l=a:i?l=i:o&&(l=o);const u=(l==null?void 0:l.custom)||{},d=u.projectType;d&&(this.projectType=d),u.projectType=this.projectType,this.setProjectDataCustom({...u,id:this.projectIdToLoad}),yield t.pluginStore.initProjectPlugins(this.projectType),this.editorKey++}setInstallEvent(t){this.installEvent=t}setAppInstalled(t){this.appInstalled=t}setDisplayMode(t){this.displayMode=t}setProject(t){const n=this.editor,{id:s,data:r,isTemplate:o}=t,i=n.Storage.getConfig().options.local,a=o?`${s}__${sS()}`:s;this._projectId=a,i.key=a,tS(r)||this.loadProjectData({...r,custom:{...r.custom,id:a,projectType:this.store.templatesStore.projectTypeFilter}})}setProjectDataCustom(t){const n={...this.projectDataCustom,...t};this.projectDataCustom=n,this.projectType=n.projectType||jt.web,this.editor&&YA(this.editor,n),n.id&&this.store.localSettingsStore.setLocalState({lastProjectId:n.id,lastProjectType:this.projectType})}loadProjectData(t){const n=t.custom||{};if(e3(t)!==this.projectType)this.setNextProjectData(t),this.setProjectDataCustom(n),this.updateStudio();else{const s=this.editor;s.loadProjectData(t),s.UndoManager.clear(),this.setProjectDataCustom(n)}}setNextProjectData(t){this.nextProjectData=t}setLeftSidebarSize(t){this.leftSidebarSize=t}setRightSidebarSize(t){this.rightSidebarSize=t}setEditor(t){this.editor=t}setPreview(t){this.isInPreview=t}toggleCssPanel(){this.isCssPanelActive=!this.isCssPanelActive}toggleLeftSidebar(){this.isLeftSidebarOpen=!this.isLeftSidebarOpen,this.refreshEditorPostTransition()}setLeftSidebarOpen(t){this.isLeftSidebarOpen=t,this.refreshEditorPostTransition()}toggleRightSidebar(){this.isRightSidebarOpen=!this.isRightSidebarOpen,this.refreshEditorPostTransition()}setRightSidebarOpen(t){this.isRightSidebarOpen=t,this.refreshEditorPostTransition()}setTopSidebarOpen(t){this.isTopSidebarOpen=t,this.refreshEditorPostTransition()}setBottomSidebarOpen(t){this.isBottomSidebarOpen=t,this.refreshEditorPostTransition()}refreshEditorPostTransition(){setTimeout(()=>{var t;return(t=this.editor)==null?void 0:t.refresh()},this.transitionTime)}setCanvasPanning(t){this.isCanvasPanning=t}setSelectingTarget(t){this.isSelectingTarget=t}setSelectedDesignerTab(t){this.selectedDesignerTab=t}setCustomAssets(t){this.customAssets=t}setIsDraggingAbsolute(t){this.isDraggingAbsolute=t}setIsSaving(t){this.isSaving=t}setIsReady(t){this.isReady=t}setPanelPageSettings(t){this.panelPageSettings={...this.panelPageSettings,...t}}setSdkPagesConfig(t){this.sdkProps.options.pages=t&&{...this.sdkPagesConfig,...t},++this.sdkPagesConfigUpdates}setRootElWidth(t){this.rootElWidth=t,this.refreshEditorCanvas()}*loadLicense(){const{editor:t}=this;try{this.licenseCheckStarted=!0;const{licenseKey:n,baseApiUrl:s,studioSdkVersion:r}=this;t==null||t.trigger(yv,{baseApiUrl:s});const o=yield Gs.post(`${s}/sdk/${n||"na"}`,{params:{d:window.location.hostname,v:r}});if(o instanceof Error)throw o;const i=o.result||{},{license:a,error:l,plan:u}=i;l?this.sdkLicenseError=l:(this.sdkLicense=a,u!=null&&u.poweredBy&&(this.showPoweredBy=!0)),t==null||t.trigger(Qd,i)}catch(n){this.licenseCheckRetry<3?(this.licenseCheckRetry++,setTimeout(()=>this.loadLicense(),3e3)):(console.error(n),this.showPoweredBy=!0,t==null||t.trigger(Qd,{}))}}*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 e3=e=>{var t;return((t=e.custom)==null?void 0:t.projectType)||jt.web},xe=()=>jn().appEditorStore,M0=()=>Uh().appEditorStore,t3=()=>{try{return Uh().appEditorStore}catch{}},rh=()=>{const[e,t]=h.useState(0),n=jn().appEditorStore,{transitionTime:s}=n;return h.useEffect(()=>{setTimeout(()=>t(r=>++r),s)},[s]),[e]},oh=()=>{const{baseApiUrl:e}=M0();return`${e}/assets/sdk`},n3=e=>`${oh()}/${e}`,s3=async(e,t,n)=>{const s=await Gs.get(oh(),{params:{projectId:t,identityId:n,d:window.location.hostname,licenseKey:e}});return((s==null?void 0:s.result)??[]).map(({asset:r,cdnUrl:o})=>({...r,size:parseInt(r.size),src:o}))},r3=async(e,t,n,s)=>{const r=await Gs.post(oh(),{body:JSON.stringify({fileMetadata:e,projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},o3=async(e,t)=>await Gs.put(t,{body:e,rawText:!0}),i3=async(e,t,n,s)=>Promise.all(e.map(r=>r3({name:r.name,size:r.size,type:r.type},t,n,s).then(async o=>{if(!o)throw new Error("No asset");const{asset:i,cdnUrl:a,uploadUrl:l}=o,u=await o3(r,l);if(u instanceof Error)throw console.error(u),new Error("Upload failed");return{...i,size:parseInt(i.size),src:a,type:To.image}}))),a3=async(e,t,n,s)=>{const r=await Gs.delete(n3(e),{body:JSON.stringify({projectId:n,identityId:s}),params:{d:window.location.hostname,licenseKey:t}});return r==null?void 0:r.result},sm=async(e,t,n,s)=>Promise.all(e.map(r=>a3(r.id||r.src,t,n,s)));function $r(e,t,n){let s,r,o,i,a;const l=t===void 0?100:t;function u(){const f=Date.now()-i;f<l&&f>=0?s=setTimeout(u,l-f):(s=null,a=e.apply(o,r),o=r=null)}const d=function(){return o=this,r=arguments,i=Date.now(),s||(s=setTimeout(u,l)),a};return d.clear=function(){s&&(clearTimeout(s),s=null)},d.flush=function(){s&&(a=e.apply(o,r),o=r=null,clearTimeout(s),s=null)},d}class rm{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,pn(this,{},{autoBind:!0}),this.initTypeFilter(),this.initProviderFilter(),this.initOptionalType(),this.loadAssetsDebounced=$r(this.loadAssets,this.searchDebounceMs)}get typeFilterOptions(){return this.customTypes??[]}get providers(){return this.assetsStore.allProviders.map(t=>({...t,types:Array.isArray(t.types)?t.types:[t.types]}))}get providerFilterOptions(){return this.providers.filter(t=>(!this.typeFilter||t.types.includes(this.typeFilter))&&(!this.customProviders||this.customProviders.includes(t.id)))}get provider(){return this.providers.find(t=>t.id===this.providerFilter)}get assetPropsFromPages(){if(!this.customPages)return;const t=[];for(const n of this.customPages)t.push(...n.items);return t}get assetProps(){if(!!!this.assetPropsFromPages&&this.isLoadingAssets)return[];const n=this.customAssetProps??this.assetPropsFromPages??this.assetsStore.projectAssetProps??[];return this.typeFilter?n.filter(s=>s.type===this.typeFilter):n}get onProviderOrProjectDelete(){const{provider:t,assetsStore:n}=this;return t?t.onDelete:n.onProjectDelete}get t(){return this.assetsStore.t}get isLoading(){return this.assetsStore.isLoadingAssets||this.isLoadingAssets}get handleDelete(){return this.onProviderOrProjectDelete&&this.handleDeleteCallback}get shouldLoadNextPage(){var n;const t=(n=this.customPages)==null?void 0:n.at(-1);return t?!t.isLastPage:!1}get reloadOnInput(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.reloadOnInput)??!1}get searchDebounceMs(){var t,n;return((n=(t=this.provider)==null?void 0:t.search)==null?void 0:n.debounceMs)??1e3}initOptionalType(){this.setOptionalType(!1)}initOptionalProvider(){var t;this.setOptionalProvider(!!(((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.projectAssetsOption)??!0))}initTypeFilter(){this.setTypeFilter(To.image)}initProviderFilter(){var t;this.setProviderFilter((t=this.assetsStore.sdkAssetConfig)==null?void 0:t.providerId)}setOptionalType(t){this.optionalType=t}setOptionalProvider(t){this.optionalProvider=t}setTypeFilter(t){this.typeFilter=t}setProviderFilter(t){this.providerFilter=t}setSearchValue(t){this.searchValue=t,this.reloadOnInput&&this.loadAssetsDebounced()}setCustomTypes(t){this.customTypes=t}setCustomProviders(t){this.customProviders=t}setCustomAssetProps(t){this.customAssetProps=t}setCustomPages(t){this.customPages=t}setItemLayout(t){this.itemLayout=t}setIsLoadingAssets(t){this.isLoadingAssets=t}selectProjectAssets(){this.setCustomAssetProps(void 0),this.setCustomPages(void 0),this.setItemLayout(void 0)}async loadProviderAssets(t){var a,l,u,d;const{assetsStore:n}=this,{editor:s}=n;if(!s||!this.provider)return;t&&(this.setCustomAssetProps(void 0),this.setCustomPages(void 0));const r=((a=this.customPages)==null?void 0:a.length)??0,o=(u=(l=this.customPages)==null?void 0:l.at(-1))==null?void 0:u.nextPageCustomData,i=await this.provider.onLoad({editor:s,assetTypeFilter:this.typeFilter,pageIndex:r,searchValue:this.searchValue,pageCustomData:o})??[];if(Array.isArray(i)){const f=i.map(n.toAssetProps);this.setCustomAssetProps(f)}else{const f={...i,items:i.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:s}=n.store;try{this.provider?(this.setIsLoadingAssets(!0),await this.loadProviderAssets(t)):this.selectProjectAssets()}catch(r){console.error(r),s.addError("assets-error-get",this.t("errorLoad"))}finally{this.setIsLoadingAssets(!1)}}async reloadAssets(t){const{assetsStore:n}=this,{cachedOnLoadAssetProps:s}=n;await this.loadAssets(t==null?void 0:t.clearExisting),!this.provider&&s&&(n.cachedOnLoadAssetProps=void 0,await n.loadProjectAssets())}async handleDeleteCallback(t){const{assetsStore:n,onProviderOrProjectDelete:s}=this,{appEditorStore:r}=n.store,{editor:o}=r;if(!(!o||!s))try{n.setIsLoadingAssets(!0),await s({assets:[n.toAsset(t)],assetProps:[t],editor:o,loadAssets:i=>this.reloadAssets(i)})}catch(i){console.error(i),n.store.toastStore.addError("assets-error-delete",{header:this.t("errorDelete"),content:i==null?void 0:i.message})}finally{n.setIsLoadingAssets(!1)}}}const N0=e=>jn().assetsStore.assetPanelStores[e];class l3{constructor(t){this.store=t,this.isLoadingAssets=!1,this.mainPanelId=`main-${h0()}`,this.assetPanelStores={},this.cachedOnLoadAssetProps=void 0,this.projectAssetProps=void 0,this.allProviders=[],this.assetPanelStores[this.mainPanelId]=new rm(this,this.mainPanelId),this.setAllProviders(this.isUsingAssetCloud?[this.userProvider]:[]),pn(this,{},{autoBind:!0})}get sdkAssetConfig(){return this.store.appEditorStore.sdkOptions.assets}get isUsingAssetCloud(){var t;return((t=this.sdkAssetConfig)==null?void 0:t.storageType)===Cf.cloud}get storageType(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.storageType}get isSelfStorage(){return this.storageType===Cf.self}get editor(){return this.store.appEditorStore.editor}get customOnLoad(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onLoad}get customOnDelete(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onDelete}get customOnUpload(){var t;return(t=this.sdkAssetConfig)==null?void 0:t.onUpload}get onCloudOrCustomUpload(){const{appEditorStore:t}=this.store,{sdkProps:n}=t,r=n.options.licenseKey,o=t.sdkProjectId,i=t.sdkIdentityId,a=({files:l})=>i3(l,r,o,i);return this.isUsingAssetCloud?a:this.customOnUpload}get onProjectDelete(){const{customOnDelete:t,isSelfStorage:n,isUsingAssetCloud:s}=this;return n?t?async r=>{await t(r),this.deleteFromProjectAssets(r)}:void 0:s?async r=>{var l,u;const{sdkOptions:o}=this.store.appEditorStore,i=(l=o.project)==null?void 0:l.id,a=(u=o.identity)==null?void 0:u.id;await sm(r.assetProps,o.licenseKey,i,a),this.deleteFromProjectAssets(r)}:this.deleteFromProjectAssets}get t(){return this.store.i18nStore.tScoped("assetManager")}get userProvider(){var a,l;const{appEditorStore:t}=this.store,{sdkOptions:n}=t,s=(a=n.project)==null?void 0:a.id,r=(l=n.identity)==null?void 0:l.id,o=n.licenseKey;return{id:"grapesjs-user-provider",label:()=>this.t("userAssets"),types:To.image,onLoad:()=>s3(o,s,r),onDelete:async u=>{const{assetProps:d,loadAssets:f}=u;await sm(d,o,s,r),this.deleteFromProjectAssets(u),await f({clearExisting:!1})}}}onEditor(){const t=$r(()=>!this.loadProjectAssets()),n=this.store.appEditorStore.editor;this.addSdkProviders();const s=n.Assets.events.all;n.on(s,t),this.loadProjectAssets()}addSdkProviders(){var s;const t=((s=this.sdkAssetConfig)==null?void 0:s.providers)??[],n=tt(t)?t({providers:Lr(this.allProviders)}):[...this.allProviders,...t];this.setAllProviders(n)}addProvider(t,n=this.allProviders.length){const s=[...this.allProviders];let r=this.allProviders.findIndex(i=>i.id===t.id);const o=r!==-1;s.splice(n,0,t),o&&(r>=n&&(r+=1),s.splice(r,1)),this.setAllProviders(s)}hasType(t){return!!this.allProviders.find(n=>dt(n.types)?n.types===t:n.types.includes(t))}createAssetManager(t){const n=new rm(this,t);this.assetPanelStores[t]=n}removeAssetManager(t){delete this.assetPanelStores[t]}async loadProjectAssets(){const{editor:t,isSelfStorage:n,cachedOnLoadAssetProps:s,customOnLoad:r}=this,{toastStore:o}=this.store;let i;if(t){try{if(this.setIsLoadingAssets(!0),n&&r)if(s)i=s;else{const a=await r({editor:t});this.cachedOnLoadAssetProps=a.map(this.toAssetProps),i=this.cachedOnLoadAssetProps}else i=t.Assets.getAll().map(this.toAssetProps)}catch(a){console.error(a),o.addError("assets-error-load",{header:this.t("errorLoad"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}i&&this.setProjectAssetProps(i)}}deleteFromProjectAssets({assets:t,editor:n,assetProps:s}){const{cachedOnLoadAssetProps:r,customOnLoad:o}=this;if(o){if(r){const i=s.map(a=>a.id);this.cachedOnLoadAssetProps=r.filter(({id:a})=>!i.includes(a)),this.setProjectAssetProps(this.cachedOnLoadAssetProps)}}else t.forEach(i=>n.Assets.remove(i)),Qg(n)}addToProjectAssets(t){const n=this.store.appEditorStore.editor,{cachedOnLoadAssetProps:s,customOnLoad:r}=this;r?s&&(this.cachedOnLoadAssetProps=[...t,...s],this.setProjectAssetProps(this.cachedOnLoadAssetProps)):(n.Assets.add(t),Qg(n))}async handleUpload(t){var o,i;const{editor:n,onCloudOrCustomUpload:s}=this,{toastStore:r}=this.store;if(!(!n||!s))try{this.setIsLoadingAssets(!0);const a=((o=t.dataTransfer)==null?void 0:o.files)||((i=t.target)==null?void 0:i.files)||[],l=Array.from(a),u=await s({files:l,editor:n});if(u!=null&&u.length){const d=u.map(this.toAssetProps);return this.addToProjectAssets(d),d}else console.warn("No assets returned from the upload handler. Ensure to return an array of assets.")}catch(a){console.error(a),r.addError("assets-error-upload",{header:this.t("errorUpload"),content:a==null?void 0:a.message})}finally{this.setIsLoadingAssets(!1)}}uploadFile(t){var n;return(n=this.editor)==null?void 0:n.Assets.FileUploader().uploadFile(t)}isAsset(t){return!!t.getSrc}toAssetProps(t){if(this.isAsset(t)){const s=t;return{...s.attributes,id:s.attributes.id||s.getSrc(),src:s.getSrc(),name:s.attributes.name??s.getFilename(),type:s.attributes.type??s.getType()??To.image,asset:s}}return{...t,type:t.type||To.image,id:t.id||t.src}}toAsset(t){const{editor:n}=this.store.appEditorStore;if(n)return t.asset??new n.AssetManager.Asset(t)}setProjectAssetProps(t){this.projectAssetProps=t}setIsLoadingAssets(t){this.isLoadingAssets=t}setAllProviders(t){this.allProviders=t}}const il=()=>jn().assetsStore;class c3{constructor(t){var s;this.store=t,this.fonts={},pn(this,{},{autoBind:!0});const n=(s=this.sdkFontOptions)==null?void 0:s.default;this.sdkDefaultFonts=tt(n)?n({baseDefault:Kg}):n}get staticFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.map(t=>dt(t)?{id:t,label:t}:Zg(t)?t:null).filter(t=>!!t):Kg}get defaultWebFonts(){return this.sdkDefaultFonts?this.sdkDefaultFonts.filter(n=>!dt(n)&&!Zg(n)).map(n=>ia(n.family,n)):[]}get sortedFonts(){return IA(Object.values(this.fonts))}get fontFamilyOptions(){const t=n=>({id:n.family,label:n.familyLabel});return VA([...this.staticFonts,...Object.values(this.fonts).map(t)])}get sdkFontOptions(){return this.store.appEditorStore.sdkOptions.fonts}get enableFontManager(){var t;return(t=this.sdkFontOptions)==null?void 0:t.enableFontManager}get sdkShowProjectFonts(){const{showProjectFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Dt(t)?t:n}get sdkAddFonts(){const{addFonts:t,enableFontManager:n}=this.sdkFontOptions||{};return Dt(t)?t:n}loadFonts(){this.loadProjectFonts(),this.loadDefaultFonts()}loadProjectFonts(){const{editor:t}=this.store.appEditorStore;if(!t)return;const{globalPageSettings:n}=ji(t)??{},{fonts:s}=n??{};if(s)for(const[r,o]of Object.entries(s)){const i=ia(r,o);this.addFont(i,{skipUpdate:!0})}}loadDefaultFonts(){const{editor:t}=this.store.appEditorStore;if(t)for(const n of this.defaultWebFonts)this.addFont(n,{overwrite:!1,skipUpdate:!0})}getFont(t){return t=ko(t),this.fonts[t]}addFont(t,{skipUpdate:n,overwrite:s=!0}={}){const r=ia(t.family,t),{editor:o}=this.store.appEditorStore;if(!o)return;const{family:i}=r;!s&&this.fonts[i]||(this.fonts[i]=r,n||this.updateProjectFonts(o))}removeFont(t){t=ko(t);const{editor:n}=this.store.appEditorStore;n&&(delete this.fonts[t],this.updateProjectFonts(n))}updateProjectFonts(t){const s={...ji(t).globalPageSettings,fonts:Lr(this.fonts)};this.store.appEditorStore.setProjectDataCustom({globalPageSettings:s}),P0(t),t.trigger(Rn.pageSettingsUpdate,{data:s})}}const al=()=>jn().fontsStore;class u3{constructor(t){this.store=t,pn(this,{},{autoBind:!0})}t(t,n={}){var r;const{editor:s}=this.store.appEditorStore;return((r=s==null?void 0:s.I18n)==null?void 0:r.t(t,n))||""}tScoped(t){return(n,s)=>this.t(`${t}.${n}`,s)}}const Ie=()=>jn().i18nStore,Zn=(e,t)=>h.Children.map(e,n=>n&&n.type===t?n:null),om="gs-custom-layout",d3=h.forwardRef(function({className:t,component:n,noWrapper:s,id:r,render:o,componentProps:i,...a},l){const{editor:u}=xe(),d=h.useRef(null),f=n,p=f&&u?c.jsx(f,{...i,editor:u}):null,g=M(om,r&&`${om}__${r}`,t),m=s&&!o;return h.useImperativeHandle(l,()=>d.current,[]),h.useEffect(()=>{const v=d.current;if(!o||!v)return;const b=w=>v.appendChild(w),x=w=>v.removeChild(w),y=o({editor:u,addEl:b,removeEl:x});if(dt(y))v.innerHTML=y;else{if(y instanceof HTMLElement)return b(y),()=>{x(y)};if(tt(y))return()=>{y()}}},[o,u,d.current]),m?p:c.jsx("div",{className:g,ref:d,...a,children:p})}),Pf=ce(d3);class f3{constructor(t){this.customConfig=void 0,this.layouts=[],this.layoutsById=new Map,this.customLayoutComponents=new Map,this.store=t,pn(this,{},{autoBind:!0,deep:!1})}get editor(){return this.store.appEditorStore.editor}setCustomConfig(t){this.customConfig=t}add(t,n){var s;this.get(t)||(this.layouts=[...this.layouts,{id:t,...n}],(s=this.editor)==null||s.trigger(`${Rn.layoutToggleId}${t}`,{isOpen:!0}))}remove(t,n){var r;const s=n==null?void 0:n.layout;s&&this.layouts.forEach(o=>{o.id===t&&Object.assign(o,s)}),this.layouts=n!=null&&n.force?this.layouts.filter(o=>o.id!==t):this.layouts.map(o=>o.id===t?{...o,toRemove:!0}:o),(r=this.editor)==null||r.trigger(`${Rn.layoutToggleId}${t}`,{isOpen:!1})}get(t){return this.layouts.find(n=>n.id===t)}clear(){this.layouts=[]}addCustomLayoutComponent(t,n){this.customLayoutComponents.set(t,n)}getCustomLayoutComponent(t){return this.customLayoutComponents.get(t)}removeCustomLayoutComponent(t){this.customLayoutComponents.delete(t)}get layoutChildren(){var s;const{children:t}=this.store.appEditorStore.sdkProps,n=((s=Zn(t,Pf))==null?void 0:s.filter(Boolean))||[];return new Map(n.map(({props:r})=>[r.id,r]))}}const $0=()=>jn().layoutStore,p3=()=>Uh().layoutStore;class h3{constructor(t){this.isActive=!1,this.content="",this.store=t,pn(this,{},{autoBind:!0})}show(t){this.isActive=!0,this.content=t}hide(){this.isActive=!1,setTimeout(this.clear,101)}clear(){this.content=""}}class g3{constructor(t){this.store=t,this._projectSourceFilter=Ca.Existing,this._loadedProjects=void 0,this._loadedTemplates=void 0,this._projectTypeFilter=t.appEditorStore.projectType,pn(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===Ca.Existing?this.projects:this.templates}async loadProjects(){const t=await m0(this.projectTypeFilter);this.setProjects(t)}async loadTemplates(){var r;const t=(r=this.store.appEditorStore.sdkOptions.templates)==null?void 0:r.onLoad,n=async()=>await vA(this.projectTypeFilter);let s;if(t){const o=this.store.appEditorStore.editor;s=await t({editor:o,fetchCommunityTemplates:n})}else s=await n();this.setTemplates(s)}async loadAllTemplates(){await Promise.all([this.loadProjects(),this.loadTemplates()])}async removeProject(t){hA(cu.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 k0=()=>jn().templatesStore;class m3{constructor(t){this.toasts=[],this.store=t,pn(this,{},{autoBind:!0})}add(t,n){this.toasts.find(s=>s.id===t)||this.toasts.push({id:t,...n})}addError(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:cn.Error})}addWarning(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:cn.Warning})}addSuccess(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:cn.Success})}addInfo(t,n){this.add(t,{...dt(n)?{header:n}:n,variant:cn.Info})}remove(t){this.toasts=this.toasts.filter(n=>n.id!==t)}}class v3{constructor(t){this.isOpen=!1,this.store=t,pn(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(Rn.toggleBlocksPanel,{isOpen:this.isOpen})}}const b3=()=>jn().blockManagerStore,R0=":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",y3=R0+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",x3="["+R0+"]["+y3+"]*",w3=new RegExp("^"+x3+"$");function I0(e,t){const n=[];let s=t.exec(e);for(;s;){const r=[];r.startIndex=t.lastIndex-s[0].length;const o=s.length;for(let i=0;i<o;i++)r.push(s[i]);n.push(r),s=t.exec(e)}return n}const hu=function(e){const t=w3.exec(e);return!(t===null||typeof t>"u")};function S3(e){return typeof e<"u"}const C3={allowBooleanAttributes:!1,unpairedTags:[]};function j3(e,t){t=Object.assign({},C3,t);const n=[];let s=!1,r=!1;e[0]==="\uFEFF"&&(e=e.substr(1));for(let o=0;o<e.length;o++)if(e[o]==="<"&&e[o+1]==="?"){if(o+=2,o=am(e,o),o.err)return o}else if(e[o]==="<"){let i=o;if(o++,e[o]==="!"){o=lm(e,o);continue}else{let a=!1;e[o]==="/"&&(a=!0,o++);let l="";for(;o<e.length&&e[o]!==">"&&e[o]!==" "&&e[o]!==" "&&e[o]!==`
|
|
37
|
+
`&&e[o]!=="\r";o++)l+=e[o];if(l=l.trim(),l[l.length-1]==="/"&&(l=l.substring(0,l.length-1),o--),!M3(l)){let f;return l.trim().length===0?f="Invalid space after '<'.":f="Tag '"+l+"' is an invalid name.",Nt("InvalidTag",f,rn(e,o))}const u=P3(e,o);if(u===!1)return Nt("InvalidAttr","Attributes for '"+l+"' have open quote.",rn(e,o));let d=u.value;if(o=u.index,d[d.length-1]==="/"){const f=o-d.length;d=d.substring(0,d.length-1);const p=cm(d,t);if(p===!0)s=!0;else return Nt(p.err.code,p.err.msg,rn(e,f+p.err.line))}else if(a)if(u.tagClosed){if(d.trim().length>0)return Nt("InvalidTag","Closing tag '"+l+"' can't have attributes or invalid starting.",rn(e,i));if(n.length===0)return Nt("InvalidTag","Closing tag '"+l+"' has not been opened.",rn(e,i));{const f=n.pop();if(l!==f.tagName){let p=rn(e,f.tagStartPos);return Nt("InvalidTag","Expected closing tag '"+f.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+l+"'.",rn(e,i))}n.length==0&&(r=!0)}}else return Nt("InvalidTag","Closing tag '"+l+"' doesn't have proper closing.",rn(e,o));else{const f=cm(d,t);if(f!==!0)return Nt(f.err.code,f.err.msg,rn(e,o-d.length+f.err.line));if(r===!0)return Nt("InvalidXml","Multiple possible root nodes found.",rn(e,o));t.unpairedTags.indexOf(l)!==-1||n.push({tagName:l,tagStartPos:i}),s=!0}for(o++;o<e.length;o++)if(e[o]==="<")if(e[o+1]==="!"){o++,o=lm(e,o);continue}else if(e[o+1]==="?"){if(o=am(e,++o),o.err)return o}else break;else if(e[o]==="&"){const f=A3(e,o);if(f==-1)return Nt("InvalidChar","char '&' is not expected.",rn(e,o));o=f}else if(r===!0&&!im(e[o]))return Nt("InvalidXml","Extra text at the end",rn(e,o));e[o]==="<"&&o--}}else{if(im(e[o]))continue;return Nt("InvalidChar","char '"+e[o]+"' is not expected.",rn(e,o))}if(s){if(n.length==1)return Nt("InvalidTag","Unclosed tag '"+n[0].tagName+"'.",rn(e,n[0].tagStartPos));if(n.length>0)return Nt("InvalidXml","Invalid '"+JSON.stringify(n.map(o=>o.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Nt("InvalidXml","Start tag expected.",1);return!0}function im(e){return e===" "||e===" "||e===`
|
|
38
|
+
`||e==="\r"}function am(e,t){const n=t;for(;t<e.length;t++)if(e[t]=="?"||e[t]==" "){const s=e.substr(n,t-n);if(t>5&&s==="xml")return Nt("InvalidXml","XML declaration allowed only at the start of the document.",rn(e,t));if(e[t]=="?"&&e[t+1]==">"){t++;break}else continue}return t}function lm(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 E3='"',T3="'";function P3(e,t){let n="",s="",r=!1;for(;t<e.length;t++){if(e[t]===E3||e[t]===T3)s===""?s=e[t]:s!==e[t]||(s="");else if(e[t]===">"&&s===""){r=!0;break}n+=e[t]}return s!==""?!1:{value:n,index:t,tagClosed:r}}const O3=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function cm(e,t){const n=I0(e,O3),s={};for(let r=0;r<n.length;r++){if(n[r][1].length===0)return Nt("InvalidAttr","Attribute '"+n[r][2]+"' has no space in starting.",Gi(n[r]));if(n[r][3]!==void 0&&n[r][4]===void 0)return Nt("InvalidAttr","Attribute '"+n[r][2]+"' is without value.",Gi(n[r]));if(n[r][3]===void 0&&!t.allowBooleanAttributes)return Nt("InvalidAttr","boolean attribute '"+n[r][2]+"' is not allowed.",Gi(n[r]));const o=n[r][2];if(!L3(o))return Nt("InvalidAttr","Attribute '"+o+"' is an invalid name.",Gi(n[r]));if(!s.hasOwnProperty(o))s[o]=1;else return Nt("InvalidAttr","Attribute '"+o+"' is repeated.",Gi(n[r]))}return!0}function _3(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 A3(e,t){if(t++,e[t]===";")return-1;if(e[t]==="#")return t++,_3(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 L3(e){return hu(e)}function M3(e){return hu(e)}function rn(e,t){const n=e.substring(0,t).split(/\r?\n/);return{line:n.length,col:n[n.length-1].length+1}}function Gi(e){return e.startIndex+e[1].length}const N3={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},$3=function(e){return Object.assign({},N3,e)};let _c;typeof Symbol!="function"?_c="@@xmlMetadata":_c=Symbol("XML Node Metadata");class bo{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][_c]={startIndex:n})}static getMetaDataSymbol(){return _c}}class k3{constructor(t){this.suppressValidationErr=!t}readDocType(t,n){const s={};if(t[n+3]==="O"&&t[n+4]==="C"&&t[n+5]==="T"&&t[n+6]==="Y"&&t[n+7]==="P"&&t[n+8]==="E"){n=n+9;let r=1,o=!1,i=!1,a="";for(;n<t.length;n++)if(t[n]==="<"&&!i){if(o&&po(t,"!ENTITY",n)){n+=7;let l,u;[l,u,n]=this.readEntityExp(t,n+1,this.suppressValidationErr),u.indexOf("&")===-1&&(s[l]={regx:RegExp(`&${l};`,"g"),val:u})}else if(o&&po(t,"!ELEMENT",n)){n+=8;const{index:l}=this.readElementExp(t,n+1);n=l}else if(o&&po(t,"!ATTLIST",n))n+=8;else if(o&&po(t,"!NOTATION",n)){n+=9;const{index:l}=this.readNotationExp(t,n+1,this.suppressValidationErr);n=l}else if(po(t,"!--",n))i=!0;else throw new Error("Invalid DOCTYPE");r++,a=""}else if(t[n]===">"){if(i?t[n-1]==="-"&&t[n-2]==="-"&&(i=!1,r--):r--,r===0)break}else t[n]==="["?o=!0:a+=t[n];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:s,i:n}}readEntityExp(t,n){n=mn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n])&&t[n]!=='"'&&t[n]!=="'";)s+=t[n],n++;if(qi(s),n=mn(t,n),!this.suppressValidationErr){if(t.substring(n,n+6).toUpperCase()==="SYSTEM")throw new Error("External entities are not supported");if(t[n]==="%")throw new Error("Parameter entities are not supported")}let r="";return[n,r]=this.readIdentifierVal(t,n,"entity"),n--,[s,r,n]}readNotationExp(t,n){n=mn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;!this.suppressValidationErr&&qi(s),n=mn(t,n);const r=t.substring(n,n+6).toUpperCase();if(!this.suppressValidationErr&&r!=="SYSTEM"&&r!=="PUBLIC")throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);n+=r.length,n=mn(t,n);let o=null,i=null;if(r==="PUBLIC")[n,o]=this.readIdentifierVal(t,n,"publicIdentifier"),n=mn(t,n),(t[n]==='"'||t[n]==="'")&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"));else if(r==="SYSTEM"&&([n,i]=this.readIdentifierVal(t,n,"systemIdentifier"),!this.suppressValidationErr&&!i))throw new Error("Missing mandatory system identifier for SYSTEM notation");return{notationName:s,publicIdentifier:o,systemIdentifier:i,index:--n}}readIdentifierVal(t,n,s){let r="";const o=t[n];if(o!=='"'&&o!=="'")throw new Error(`Expected quoted string, found "${o}"`);for(n++;n<t.length&&t[n]!==o;)r+=t[n],n++;if(t[n]!==o)throw new Error(`Unterminated ${s} value`);return n++,[n,r]}readElementExp(t,n){n=mn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;if(!this.suppressValidationErr&&!hu(s))throw new Error(`Invalid element name: "${s}"`);n=mn(t,n);let r="";if(t[n]==="E"&&po(t,"MPTY",n))n+=4;else if(t[n]==="A"&&po(t,"NY",n))n+=2;else if(t[n]==="("){for(n++;n<t.length&&t[n]!==")";)r+=t[n],n++;if(t[n]!==")")throw new Error("Unterminated content model")}else if(!this.suppressValidationErr)throw new Error(`Invalid Element Expression, found "${t[n]}"`);return{elementName:s,contentModel:r.trim(),index:n}}readAttlistExp(t,n){n=mn(t,n);let s="";for(;n<t.length&&!/\s/.test(t[n]);)s+=t[n],n++;qi(s),n=mn(t,n);let r="";for(;n<t.length&&!/\s/.test(t[n]);)r+=t[n],n++;if(!qi(r))throw new Error(`Invalid attribute name: "${r}"`);n=mn(t,n);let o="";if(t.substring(n,n+8).toUpperCase()==="NOTATION"){if(o="NOTATION",n+=8,n=mn(t,n),t[n]!=="(")throw new Error(`Expected '(', found "${t[n]}"`);n++;let a=[];for(;n<t.length&&t[n]!==")";){let l="";for(;n<t.length&&t[n]!=="|"&&t[n]!==")";)l+=t[n],n++;if(l=l.trim(),!qi(l))throw new Error(`Invalid notation name: "${l}"`);a.push(l),t[n]==="|"&&(n++,n=mn(t,n))}if(t[n]!==")")throw new Error("Unterminated list of notations");n++,o+=" ("+a.join("|")+")"}else{for(;n<t.length&&!/\s/.test(t[n]);)o+=t[n],n++;const a=["CDATA","ID","IDREF","IDREFS","ENTITY","ENTITIES","NMTOKEN","NMTOKENS"];if(!this.suppressValidationErr&&!a.includes(o.toUpperCase()))throw new Error(`Invalid attribute type: "${o}"`)}n=mn(t,n);let i="";return t.substring(n,n+8).toUpperCase()==="#REQUIRED"?(i="#REQUIRED",n+=8):t.substring(n,n+7).toUpperCase()==="#IMPLIED"?(i="#IMPLIED",n+=7):[n,i]=this.readIdentifierVal(t,n,"ATTLIST"),{elementName:s,attributeName:r,attributeType:o,defaultValue:i,index:n}}}const mn=(e,t)=>{for(;t<e.length&&/\s/.test(e[t]);)t++;return t};function po(e,t,n){for(let s=0;s<t.length;s++)if(t[s]!==e[n+s+1])return!1;return!0}function qi(e){if(hu(e))return e;throw new Error(`Invalid entity name ${e}`)}const R3=/^[-+]?0x[a-fA-F0-9]+$/,I3=/^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/,V3={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function H3(e,t={}){if(t=Object.assign({},V3,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&&R3.test(n))return z3(n,16);if(n.search(/.+[eE].+/)!==-1)return F3(e,n,t);{const s=I3.exec(n);if(s){const r=s[1]||"",o=s[2];let i=B3(s[3]);const a=r?e[o.length+1]===".":e[o.length]===".";if(!t.leadingZeros&&(o.length>1||o.length===1&&!a))return e;{const l=Number(n),u=String(l);if(l===0)return l;if(u.search(/[eE]/)!==-1)return t.eNotation?l:e;if(n.indexOf(".")!==-1)return u==="0"||u===i||u===`${r}${i}`?l:e;let d=o?i:n;return o?d===u||r+d===u?l:e:d===u||d===r+u?l:e}}else return e}}const D3=/^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;function F3(e,t,n){if(!n.eNotation)return e;const s=t.match(D3);if(s){let r=s[1]||"";const o=s[3].indexOf("e")===-1?"E":"e",i=s[2],a=r?e[i.length+1]===o:e[i.length]===o;return i.length>1&&a?e:i.length===1&&(s[3].startsWith(`.${o}`)||s[3][0]===o)?Number(t):n.leadingZeros&&!a?(t=(s[1]||"")+s[3],Number(t)):e}else return e}function B3(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 z3(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 V0(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 U3{constructor(t){if(this.options=t,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"¢"},pound:{regex:/&(pound|#163);/g,val:"£"},yen:{regex:/&(yen|#165);/g,val:"¥"},euro:{regex:/&(euro|#8364);/g,val:"€"},copyright:{regex:/&(copy|#169);/g,val:"©"},reg:{regex:/&(reg|#174);/g,val:"®"},inr:{regex:/&(inr|#8377);/g,val:"₹"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(n,s)=>String.fromCodePoint(Number.parseInt(s,16))}},this.addExternalEntities=W3,this.parseXml=Y3,this.parseTextData=G3,this.resolveNameSpace=q3,this.buildAttributesMap=Z3,this.isItStopNode=e4,this.replaceEntitiesValue=J3,this.readStopNodeData=n4,this.saveTextToParentTag=Q3,this.addChild=X3,this.ignoreAttributesFn=V0(this.options.ignoreAttributes),this.options.stopNodes&&this.options.stopNodes.length>0){this.stopNodesExact=new Set,this.stopNodesWildcard=new Set;for(let n=0;n<this.options.stopNodes.length;n++){const s=this.options.stopNodes[n];typeof s=="string"&&(s.startsWith("*.")?this.stopNodesWildcard.add(s.substring(2)):this.stopNodesExact.add(s))}}}}function W3(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];this.lastEntities[s]={regex:new RegExp("&"+s+";","g"),val:e[s]}}}function G3(e,t,n,s,r,o,i){if(e!==void 0&&(this.options.trimValues&&!s&&(e=e.trim()),e.length>0)){i||(e=this.replaceEntitiesValue(e));const a=this.options.tagValueProcessor(t,e,n,r,o);return a==null?e:typeof a!=typeof e||a!==e?a:this.options.trimValues?_f(e,this.options.parseTagValue,this.options.numberParseOptions):e.trim()===e?_f(e,this.options.parseTagValue,this.options.numberParseOptions):e}}function q3(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 K3=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Z3(e,t,n){if(this.options.ignoreAttributes!==!0&&typeof e=="string"){const s=I0(e,K3),r=s.length,o={};for(let i=0;i<r;i++){const a=this.resolveNameSpace(s[i][1]);if(this.ignoreAttributesFn(a,t))continue;let l=s[i][4],u=this.options.attributeNamePrefix+a;if(a.length)if(this.options.transformAttributeName&&(u=this.options.transformAttributeName(u)),u==="__proto__"&&(u="#__proto__"),l!==void 0){this.options.trimValues&&(l=l.trim()),l=this.replaceEntitiesValue(l);const d=this.options.attributeValueProcessor(a,l,t);d==null?o[u]=l:typeof d!=typeof l||d!==l?o[u]=d:o[u]=_f(l,this.options.parseAttributeValue,this.options.numberParseOptions)}else this.options.allowBooleanAttributes&&(o[u]=!0)}if(!Object.keys(o).length)return;if(this.options.attributesGroupName){const i={};return i[this.options.attributesGroupName]=o,i}return o}}const Y3=function(e){e=e.replace(/\r\n?/g,`
|
|
39
|
+
`);const t=new bo("!xml");let n=t,s="",r="";const o=new k3(this.options.processEntities);for(let i=0;i<e.length;i++)if(e[i]==="<")if(e[i+1]==="/"){const l=xo(e,">",i,"Closing Tag is not closed.");let u=e.substring(i+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&&(s=this.saveTextToParentTag(s,n,r));const d=r.substring(r.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: </${u}>`);let f=0;d&&this.options.unpairedTags.indexOf(d)!==-1?(f=r.lastIndexOf(".",r.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=r.lastIndexOf("."),r=r.substring(0,f),n=this.tagsNodeStack.pop(),s="",i=l}else if(e[i+1]==="?"){let l=Of(e,i,!1,"?>");if(!l)throw new Error("Pi Tag is not closed.");if(s=this.saveTextToParentTag(s,n,r),!(this.options.ignoreDeclaration&&l.tagName==="?xml"||this.options.ignorePiTags)){const u=new bo(l.tagName);u.add(this.options.textNodeName,""),l.tagName!==l.tagExp&&l.attrExpPresent&&(u[":@"]=this.buildAttributesMap(l.tagExp,r,l.tagName)),this.addChild(n,u,r,i)}i=l.closeIndex+1}else if(e.substr(i+1,3)==="!--"){const l=xo(e,"-->",i+4,"Comment is not closed.");if(this.options.commentPropName){const u=e.substring(i+4,l-2);s=this.saveTextToParentTag(s,n,r),n.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}i=l}else if(e.substr(i+1,2)==="!D"){const l=o.readDocType(e,i);this.docTypeEntities=l.entities,i=l.i}else if(e.substr(i+1,2)==="!["){const l=xo(e,"]]>",i,"CDATA is not closed.")-2,u=e.substring(i+9,l);s=this.saveTextToParentTag(s,n,r);let d=this.parseTextData(u,n.tagname,r,!0,!1,!0,!0);d==null&&(d=""),this.options.cdataPropName?n.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):n.add(this.options.textNodeName,d),i=l+2}else{let l=Of(e,i,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&&s&&n.tagname!=="!xml"&&(s=this.saveTextToParentTag(s,n,r,!1));const m=n;m&&this.options.unpairedTags.indexOf(m.tagname)!==-1&&(n=this.tagsNodeStack.pop(),r=r.substring(0,r.lastIndexOf("."))),u!==t.tagname&&(r+=r?"."+u:u);const v=i;if(this.isItStopNode(this.stopNodesExact,this.stopNodesWildcard,r,u)){let b="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),r=r.substr(0,r.length-1),f=u):f=f.substr(0,f.length-1),i=l.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)i=l.closeIndex;else{const y=this.readStopNodeData(e,d,g+1);if(!y)throw new Error(`Unexpected end of ${d}`);i=y.i,b=y.tagContent}const x=new bo(u);u!==f&&p&&(x[":@"]=this.buildAttributesMap(f,r,u)),b&&(b=this.parseTextData(b,u,r,!0,p,!0,!0)),r=r.substr(0,r.lastIndexOf(".")),x.add(this.options.textNodeName,b),this.addChild(n,x,r,v)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),r=r.substr(0,r.length-1),f=u):f=f.substr(0,f.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));const b=new bo(u);u!==f&&p&&(b[":@"]=this.buildAttributesMap(f,r,u)),this.addChild(n,b,r,v),r=r.substr(0,r.lastIndexOf("."))}else{const b=new bo(u);this.tagsNodeStack.push(n),u!==f&&p&&(b[":@"]=this.buildAttributesMap(f,r,u)),this.addChild(n,b,r,v),n=b}s="",i=g}}else s+=e[i];return t.child};function X3(e,t,n,s){this.options.captureMetaData||(s=void 0);const r=this.options.updateTag(t.tagname,n,t[":@"]);r===!1||(typeof r=="string"&&(t.tagname=r),e.addChild(t,s))}const J3=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 Q3(e,t,n,s){return e&&(s===void 0&&(s=t.child.length===0),e=this.parseTextData(e,t.tagname,n,!1,t[":@"]?Object.keys(t[":@"]).length!==0:!1,s),e!==void 0&&e!==""&&t.add(this.options.textNodeName,e),e=""),e}function e4(e,t,n,s){return!!(t&&t.has(s)||e&&e.has(n))}function t4(e,t,n=">"){let s,r="";for(let o=t;o<e.length;o++){let i=e[o];if(s)i===s&&(s="");else if(i==='"'||i==="'")s=i;else if(i===n[0])if(n[1]){if(e[o+1]===n[1])return{data:r,index:o}}else return{data:r,index:o};else i===" "&&(i=" ");r+=i}}function xo(e,t,n,s){const r=e.indexOf(t,n);if(r===-1)throw new Error(s);return r+t.length-1}function Of(e,t,n,s=">"){const r=t4(e,t+1,s);if(!r)return;let o=r.data;const i=r.index,a=o.search(/\s/);let l=o,u=!0;a!==-1&&(l=o.substring(0,a),o=o.substring(a+1).trimStart());const d=l;if(n){const f=l.indexOf(":");f!==-1&&(l=l.substr(f+1),u=l!==r.data.substr(f+1))}return{tagName:l,tagExp:o,closeIndex:i,attrExpPresent:u,rawTagName:d}}function n4(e,t,n){const s=n;let r=1;for(;n<e.length;n++)if(e[n]==="<")if(e[n+1]==="/"){const o=xo(e,">",n,`${t} is not closed`);if(e.substring(n+2,o).trim()===t&&(r--,r===0))return{tagContent:e.substring(s,n),i:o};n=o}else if(e[n+1]==="?")n=xo(e,"?>",n+1,"StopNode is not closed.");else if(e.substr(n+1,3)==="!--")n=xo(e,"-->",n+3,"StopNode is not closed.");else if(e.substr(n+1,2)==="![")n=xo(e,"]]>",n,"StopNode is not closed.")-2;else{const o=Of(e,n,">");o&&((o&&o.tagName)===t&&o.tagExp[o.tagExp.length-1]!=="/"&&r++,n=o.closeIndex)}}function _f(e,t,n){if(t&&typeof e=="string"){const s=e.trim();return s==="true"?!0:s==="false"?!1:H3(e,n)}else return S3(e)?e:""}const dd=bo.getMetaDataSymbol();function s4(e,t){return H0(e,t)}function H0(e,t,n){let s;const r={};for(let o=0;o<e.length;o++){const i=e[o],a=r4(i);let l="";if(n===void 0?l=a:l=n+"."+a,a===t.textNodeName)s===void 0?s=i[a]:s+=""+i[a];else{if(a===void 0)continue;if(i[a]){let u=H0(i[a],t,l);const d=i4(u,t);i[dd]!==void 0&&(u[dd]=i[dd]),i[":@"]?o4(u,i[":@"],l,t):Object.keys(u).length===1&&u[t.textNodeName]!==void 0&&!t.alwaysCreateTextNode?u=u[t.textNodeName]:Object.keys(u).length===0&&(t.alwaysCreateTextNode?u[t.textNodeName]="":u=""),r[a]!==void 0&&r.hasOwnProperty(a)?(Array.isArray(r[a])||(r[a]=[r[a]]),r[a].push(u)):t.isArray(a,l,d)?r[a]=[u]:r[a]=u}}}return typeof s=="string"?s.length>0&&(r[t.textNodeName]=s):s!==void 0&&(r[t.textNodeName]=s),r}function r4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(s!==":@")return s}}function o4(e,t,n,s){if(t){const r=Object.keys(t),o=r.length;for(let i=0;i<o;i++){const a=r[i];s.isArray(a,n+"."+a,!0,!0)?e[a]=[t[a]]:e[a]=t[a]}}}function i4(e,t){const{textNodeName:n}=t,s=Object.keys(e).length;return!!(s===0||s===1&&(e[n]||typeof e[n]=="boolean"||e[n]===0))}class a4{constructor(t){this.externalEntities={},this.options=$3(t)}parse(t,n){if(typeof t!="string"&&t.toString)t=t.toString();else if(typeof t!="string")throw new Error("XML data is accepted in String or Bytes[] form.");if(n){n===!0&&(n={});const o=j3(t,n);if(o!==!0)throw Error(`${o.err.msg}:${o.err.line}:${o.err.col}`)}const s=new U3(this.options);s.addExternalEntities(this.externalEntities);const r=s.parseXml(t);return this.options.preserveOrder||r===void 0?r:s4(r,this.options)}addEntity(t,n){if(n.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(t.indexOf("&")!==-1||t.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");if(n==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[t]=n}static getMetaDataSymbol(){return bo.getMetaDataSymbol()}}const l4=`
|
|
40
|
+
`;function c4(e,t){let n="";return t.format&&t.indentBy.length>0&&(n=l4),D0(e,t,"",n)}function D0(e,t,n,s){let r="",o=!1;for(let i=0;i<e.length;i++){const a=e[i],l=u4(a);if(l===void 0)continue;let u="";if(n.length===0?u=l:u=`${n}.${l}`,l===t.textNodeName){let m=a[l];d4(u,t)||(m=t.tagValueProcessor(l,m),m=F0(m,t)),o&&(r+=s),r+=m,o=!1;continue}else if(l===t.cdataPropName){o&&(r+=s),r+=`<![CDATA[${a[l][0][t.textNodeName]}]]>`,o=!1;continue}else if(l===t.commentPropName){r+=s+`<!--${a[l][0][t.textNodeName]}-->`,o=!0;continue}else if(l[0]==="?"){const m=um(a[":@"],t),v=l==="?xml"?"":s;let b=a[l][0][t.textNodeName];b=b.length!==0?" "+b:"",r+=v+`<${l}${b}${m}?>`,o=!0;continue}let d=s;d!==""&&(d+=t.indentBy);const f=um(a[":@"],t),p=s+`<${l}${f}`,g=D0(a[l],t,u,d);t.unpairedTags.indexOf(l)!==-1?t.suppressUnpairedNode?r+=p+">":r+=p+"/>":(!g||g.length===0)&&t.suppressEmptyNode?r+=p+"/>":g&&g.endsWith(">")?r+=p+`>${g}${s}</${l}>`:(r+=p+">",g&&s!==""&&(g.includes("/>")||g.includes("</"))?r+=s+t.indentBy+g+s:r+=g,r+=`</${l}>`),o=!0}return r}function u4(e){const t=Object.keys(e);for(let n=0;n<t.length;n++){const s=t[n];if(e.hasOwnProperty(s)&&s!==":@")return s}}function um(e,t){let n="";if(e&&!t.ignoreAttributes)for(let s in e){if(!e.hasOwnProperty(s))continue;let r=t.attributeValueProcessor(s,e[s]);r=F0(r,t),r===!0&&t.suppressBooleanAttributes?n+=` ${s.substr(t.attributeNamePrefix.length)}`:n+=` ${s.substr(t.attributeNamePrefix.length)}="${r}"`}return n}function d4(e,t){e=e.substr(0,e.length-t.textNodeName.length-1);let n=e.substr(e.lastIndexOf(".")+1);for(let s in t.stopNodes)if(t.stopNodes[s]===e||t.stopNodes[s]==="*."+n)return!0;return!1}function F0(e,t){if(e&&e.length>0&&t.processEntities)for(let n=0;n<t.entities.length;n++){const s=t.entities[n];e=e.replace(s.regex,s.val)}return e}const f4={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 to(e){this.options=Object.assign({},f4,e),this.options.ignoreAttributes===!0||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.ignoreAttributesFn=V0(this.options.ignoreAttributes),this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=g4),this.processTextOrObjNode=p4,this.options.format?(this.indentate=h4,this.tagEndChar=`>
|
|
106
41
|
`,this.newLine=`
|
|
107
|
-
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}Gr.prototype.build=function(e){return this.options.preserveOrder?RN(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};Gr.prototype.j2x=function(e,t,n){let s="",r="";const o=n.join(".");for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(r+="");else if(e[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?r+="":i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)r+=this.buildTextValNode(e[i],i,"",t);else if(typeof e[i]!="object"){const a=this.isAttribute(i);if(a&&!this.ignoreAttributesFn(a,o))s+=this.buildAttrPairStr(a,""+e[i]);else if(!a)if(i===this.options.textNodeName){let l=this.options.tagValueProcessor(i,""+e[i]);r+=this.replaceEntitiesValue(l)}else r+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const a=e[i].length;let l="",u="";for(let d=0;d<a;d++){const f=e[i][d];if(!(typeof f>"u"))if(f===null)i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const p=this.j2x(f,t+1,n.concat(i));l+=p.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else l+=this.processTextOrObjNode(f,i,t,n);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(i,f);p=this.replaceEntitiesValue(p),l+=p}else l+=this.buildTextValNode(f,i,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,i,u,t)),r+=l}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const a=Object.keys(e[i]),l=a.length;for(let u=0;u<l;u++)s+=this.buildAttrPairStr(a[u],""+e[i][a[u]])}else r+=this.processTextOrObjNode(e[i],i,t,n);return{attrStr:s,val:r}};Gr.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 IN(e,t,n,s){const r=this.j2x(e,n+1,s.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}Gr.prototype.buildObjectNode=function(e,t,n,s){if(e==="")return t[0]==="?"?this.indentate(s)+"<"+t+n+"?"+this.tagEndChar:this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let r="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",r=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(s)+"<"+t+n+o+">"+e+r:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(s)+`<!--${e}-->`+this.newLine:this.indentate(s)+"<"+t+n+o+this.tagEndChar+e+this.indentate(s)+r}};Gr.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};Gr.prototype.buildTextValNode=function(e,t,n,s){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+n+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(t,e);return r=this.replaceEntitiesValue(r),r===""?this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+n+">"+r+"</"+t+this.tagEndChar}};Gr.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 DN(e){return this.options.indentBy.repeat(e)}function HN(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const tu="mjml-code-to-html";function A0(e,t){const n=t==null?void 0:t.sanitizer;if(Ye(n))return n(e);if(n==="xml-sanitizer"){const f=e.replace(/(<[a-zA-Z!/])|</g,(j,E)=>E??"<").replace(/&(?!#?\w+;)/g,"&"),p=["br","hr"],g=new Set(p),m=j=>{const E=[];for(const _ of j){const T=Object.keys(_).find(P=>P!==":@");if(T&&g.has(T)){const P=_[T];Array.isArray(P)&&P.length>0?(E.push({..._,[T]:[]}),E.push(...m(P))):E.push(_)}else T&&Array.isArray(_[T])?E.push({..._,[T]:m(_[T])}):E.push(_)}return E},b={commentPropName:"#comment",unpairedTags:p,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},v=new MN({...b,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),x=new Gr({...b}),w=v.parse(`<root>${f}</root>`)[0].root,S=m(w);return x.build(S)}function s(f){const p=document.createElement("textarea");return p.innerHTML=f,p.value}const r=s(e||""),o=["checked","disabled","readonly","required","autofocus","multiple","selected","hidden","async","defer","formnovalidate","novalidate","ismap","allowfullscreen","autoplay","controls","loop","muted","open","reversed","scoped","seamless","typemustmatch","default","full-width","crossorigin"],i={crossorigin:"anonymous","full-width":"true"},a=new RegExp(`\\s+(${o.join("|")})(?=\\s|\\/?>)`,"gi");return r.replace(/<[^>]+>/g,f=>f.replace(a,(p,g)=>{const m=i[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 ya=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(ya||{}),Up=(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))(Up||{}),wr=(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))(wr||{}),ko=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(ko||{});function FN(e){const t=new Map,n={items:[]};return e.forEach(r=>{const{category:o,item:i}=r;if(o){const a=t.get(o.id);a?(a.items.push(i),a.category={...a.category,...o}):t.set(o.id,{category:o,items:[i]})}else n.items.push(i)}),[...Array.from(t).map(([,r])=>r),n].filter(r=>r.items.length)}const N0=e=>(e==null?void 0:e.get("groups"))||[],M0=(e,t)=>N0(e).includes(t),BN=(e,t)=>{M0(e,t)||e.set("groups",[...N0(e),t])};class zN{constructor(t){this.dataSourceKeyid=ko.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,on(this,{openCategories:!1},{autoBind:!0})}get sdkOptionStyles(){var t;return((t=this.store.appEditorStore.sdkOptions.globalStyles)==null?void 0:t.default)||[]}get editor(){return this.store.appEditorStore.editor}get DataSources(){var t;return(t=this.editor)==null?void 0:t.DataSources}get recordsByCategory(){const{records:t,sdkOptionStyles:n}=this,s=[],r=t.reduce((o,i)=>(o.set(i.get("id"),i),o),new Map);return n.forEach(({id:o})=>{const i=r.get(o);i&&(s.push(i),r.delete(o))}),Array.from(r).map(([,o])=>{o.get("_internal")||s.push(o)}),FN(s.map(o=>({category:o.get("category"),item:o})))}setCategoryOpen(t,n){this.openCategories.set(t,n)}getDataSource(){var t;return(t=this.DataSources)==null?void 0:t.get(this.dataSourceKeyid)}getRuleByGroup(t){var n;return(n=this.editor)==null?void 0:n.CssComposer.getAll().find(s=>M0(s,t))}addStyleRule(t,n={}){var f,p;const{editor:s}=this,r=t.get("id"),o=t.get("selector")||"",i=t.get("property"),a=t.getPath("value"),l=`${this.dataSourceKeyid}:${r}`,u={[i]:{type:"data-variable",path:a,defaultValue:t.get("defaultValue")}};if(s&&Tw(s)&&o.startsWith("mj-")){const g=s.Components.getWrapper(),{head:m}=ya,{attributes:b}=Up,v=g.findFirstType(ya.root),x=v.findFirstType(m)||v.append({type:m},{at:0})[0],y=x.findFirstType(b)||x.append({type:b})[0],w=y.findType(o).pop()||y.append({type:o})[0],S=(w.get("attributes")||{})[i];Lt(S)&&S!==""&&t.set("value",S),w.addAttributes(u,{silent:!0});return}let d=((p=(f=n.selectorToRuleMap)==null?void 0:f.get(o))==null?void 0:p.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=s==null?void 0:s.CssComposer.addCollection([{selectors:[],selectorsAdd:o,style:u}],{extend:!0,at:t.index})[0],d&&BN(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var o,i;const{sdkOptionStyles:t}=this,n=new Map,s=(o=this.editor)==null?void 0:o.Css;if(!t.length){this.records=[];return}const r=this.getDataSource()||this.createDataSource();t.forEach(a=>{const{id:l,selector:u,label:d,field:f,property:p,category:g}=a,m=r.getRecord(l);if(m){const b={label:d,field:f,category:g};m.set({...b,_undo:!0})}else{const b=n.get(u),v=(b==null?void 0:b.rule)||(s==null?void 0:s.getRule(u)),x=(b==null?void 0:b.styles)||(v==null?void 0:v.getStyle())||{},y=x[p]||a.defaultValue;n.set(u,{rule:v,styles:x}),r.addRecord({value:void 0,...a,defaultValue:y,_internal:!0,_undo:!0})}}),r.getRecords().forEach(a=>{this.addStyleRule(a,{selectorToRuleMap:n})}),r.listenTo(r.records,"add",a=>{this.addStyleRule(a)}),(i=this.editor)==null||i.UndoManager.add(r.records),this.records=r.getRecords()}}const UN=()=>bn().globalStylesStore,WN=(e,t)=>{let n;try{const s=Vs()&&e&&localStorage.getItem(e);s&&(n=JSON.parse(s))}catch(s){console.error(s)}return{lastProjectId:"",...t,...n}},Qg=(e,t)=>{const s={...WN(e),...t};try{Vs()&&e&&localStorage.setItem(e,JSON.stringify(s))}catch(r){console.error(r)}return s},em="gs-utl-dark",GN=()=>Vs()&&window.matchMedia("(prefers-color-scheme: dark)").matches,L0=e=>e==="dark"||e==="auto"&&GN(),tm=(e,t)=>{if(e&&Vs()&&t.rootEl){const{classList:n}=t.rootEl;let s=!1;if(L0(e)?(n.add(em),s=!0):n.remove(em),t.updateAppShell){const r=document.head.querySelector('meta[name="theme-color"]');r&&(r.content=s?"#18181b":"#ffffff")}t.resolvedTheme=s?Nr.dark:Nr.light}};class qN{constructor(t){this.key="",this.theme=Nr.auto,this.resolvedTheme=Nr.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),this.resolvedTheme=this.theme,on(this,{},{autoBind:!0}),this.init()}init(){tm(this.theme,this)}changeTheme(t){tm(t,this),Qg(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),Qg(this.key,t)}get isDarkTheme(){return L0(this.theme)}}const Ds=()=>bn().localSettingsStore;class KN{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,on(this,{},{autoBind:!0})}setModalProps(t){this.modalProps={title:"",size:"l",fullH:!1,buttons:[],...t}}open({content:t,...n}){this.isOpen=!0,this.content=t,this.setModalProps(n)}close(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.content="",this.setModalProps({size:this.modalProps.size})}confirm({content:t,size:n="m",onConfirm:s,confirmButton:r,...o}){this.isOpen=!0,this.content=t;const i=()=>{s==null||s(),this.close()};this.setModalProps({...o,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:i,size:"m2",variant:"pr",...r}]})}}const ji=()=>bn().modalStore,nm="column1",sm="column2",rm="column3",gf="column3-7",YN=function(e,t={}){const{Components:n,Blocks:s}=e,r="gridRow",o="gridColumn",i="gjs-grid-row",a="gjs-grid-column",l={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,f=1,p=1;n.addType(r,{isComponent:v=>Ir(v,i),model:{defaults:{emptyState:!0,droppable:Cs(o),highlightable:!1,attributes:{class:i},resizable:{...l,keyHeight:"min-height"},icon:`
|
|
42
|
+
`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}to.prototype.build=function(e){return this.options.preserveOrder?c4(e,this.options):(Array.isArray(e)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(e={[this.options.arrayNodeName]:e}),this.j2x(e,0,[]).val)};to.prototype.j2x=function(e,t,n){let s="",r="";const o=n.join(".");for(let i in e)if(Object.prototype.hasOwnProperty.call(e,i))if(typeof e[i]>"u")this.isAttribute(i)&&(r+="");else if(e[i]===null)this.isAttribute(i)||i===this.options.cdataPropName?r+="":i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(e[i]instanceof Date)r+=this.buildTextValNode(e[i],i,"",t);else if(typeof e[i]!="object"){const a=this.isAttribute(i);if(a&&!this.ignoreAttributesFn(a,o))s+=this.buildAttrPairStr(a,""+e[i]);else if(!a)if(i===this.options.textNodeName){let l=this.options.tagValueProcessor(i,""+e[i]);r+=this.replaceEntitiesValue(l)}else r+=this.buildTextValNode(e[i],i,"",t)}else if(Array.isArray(e[i])){const a=e[i].length;let l="",u="";for(let d=0;d<a;d++){const f=e[i][d];if(!(typeof f>"u"))if(f===null)i[0]==="?"?r+=this.indentate(t)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(t)+"<"+i+"/"+this.tagEndChar;else if(typeof f=="object")if(this.options.oneListGroup){const p=this.j2x(f,t+1,n.concat(i));l+=p.val,this.options.attributesGroupName&&f.hasOwnProperty(this.options.attributesGroupName)&&(u+=p.attrStr)}else l+=this.processTextOrObjNode(f,i,t,n);else if(this.options.oneListGroup){let p=this.options.tagValueProcessor(i,f);p=this.replaceEntitiesValue(p),l+=p}else l+=this.buildTextValNode(f,i,"",t)}this.options.oneListGroup&&(l=this.buildObjectNode(l,i,u,t)),r+=l}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){const a=Object.keys(e[i]),l=a.length;for(let u=0;u<l;u++)s+=this.buildAttrPairStr(a[u],""+e[i][a[u]])}else r+=this.processTextOrObjNode(e[i],i,t,n);return{attrStr:s,val:r}};to.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 p4(e,t,n,s){const r=this.j2x(e,n+1,s.concat(t));return e[this.options.textNodeName]!==void 0&&Object.keys(e).length===1?this.buildTextValNode(e[this.options.textNodeName],t,r.attrStr,n):this.buildObjectNode(r.val,t,r.attrStr,n)}to.prototype.buildObjectNode=function(e,t,n,s){if(e==="")return t[0]==="?"?this.indentate(s)+"<"+t+n+"?"+this.tagEndChar:this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar;{let r="</"+t+this.tagEndChar,o="";return t[0]==="?"&&(o="?",r=""),(n||n==="")&&e.indexOf("<")===-1?this.indentate(s)+"<"+t+n+o+">"+e+r:this.options.commentPropName!==!1&&t===this.options.commentPropName&&o.length===0?this.indentate(s)+`<!--${e}-->`+this.newLine:this.indentate(s)+"<"+t+n+o+this.tagEndChar+e+this.indentate(s)+r}};to.prototype.closeTag=function(e){let t="";return this.options.unpairedTags.indexOf(e)!==-1?this.options.suppressUnpairedNode||(t="/"):this.options.suppressEmptyNode?t="/":t=`></${e}`,t};to.prototype.buildTextValNode=function(e,t,n,s){if(this.options.cdataPropName!==!1&&t===this.options.cdataPropName)return this.indentate(s)+`<![CDATA[${e}]]>`+this.newLine;if(this.options.commentPropName!==!1&&t===this.options.commentPropName)return this.indentate(s)+`<!--${e}-->`+this.newLine;if(t[0]==="?")return this.indentate(s)+"<"+t+n+"?"+this.tagEndChar;{let r=this.options.tagValueProcessor(t,e);return r=this.replaceEntitiesValue(r),r===""?this.indentate(s)+"<"+t+n+this.closeTag(t)+this.tagEndChar:this.indentate(s)+"<"+t+n+">"+r+"</"+t+this.tagEndChar}};to.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 h4(e){return this.options.indentBy.repeat(e)}function g4(e){return e.startsWith(this.options.attributeNamePrefix)&&e!==this.options.textNodeName?e.substr(this.attrPrefixLen):!1}const gu="mjml-code-to-html";function B0(e,t){const n=t==null?void 0:t.sanitizer;if(tt(n))return n(e);if(n==="xml-sanitizer"){const f=e.replace(/(<[a-zA-Z!/])|</g,(j,E)=>E??"<").replace(/&(?!#?\w+;)/g,"&"),p=["br","hr"],g=new Set(p),m=j=>{const E=[];for(const O of j){const P=Object.keys(O).find(T=>T!==":@");if(P&&g.has(P)){const T=O[P];Array.isArray(T)&&T.length>0?(E.push({...O,[P]:[]}),E.push(...m(T))):E.push(O)}else P&&Array.isArray(O[P])?E.push({...O,[P]:m(O[P])}):E.push(O)}return E},v={commentPropName:"#comment",unpairedTags:p,suppressUnpairedNode:!1,ignoreAttributes:!1,preserveOrder:!0},b=new a4({...v,htmlEntities:!0,trimValues:!1,alwaysCreateTextNode:!0,allowBooleanAttributes:!0}),x=new to({...v}),w=b.parse(`<root>${f}</root>`)[0].root,S=m(w);return x.build(S)}function s(f){const p=document.createElement("textarea");return p.innerHTML=f,p.value}const r=s(e||""),o=["checked","disabled","readonly","required","autofocus","multiple","selected","hidden","async","defer","formnovalidate","novalidate","ismap","allowfullscreen","autoplay","controls","loop","muted","open","reversed","scoped","seamless","typemustmatch","default","full-width","crossorigin"],i={crossorigin:"anonymous","full-width":"true"},a=new RegExp(`\\s+(${o.join("|")})(?=\\s|\\/?>)`,"gi");return r.replace(/<[^>]+>/g,f=>f.replace(a,(p,g)=>{const m=i[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 Ta=(e=>(e.root="mjml",e.head="mj-head",e.body="mj-body",e.include="mj-include",e))(Ta||{}),ih=(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))(ih||{}),Or=(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))(Or||{}),Uo=(e=>(e.globalStyles="globalStyles",e.globalData="globalData",e))(Uo||{});function m4(e){const t=new Map,n={items:[]};return e.forEach(r=>{const{category:o,item:i}=r;if(o){const a=t.get(o.id);a?(a.items.push(i),a.category={...a.category,...o}):t.set(o.id,{category:o,items:[i]})}else n.items.push(i)}),[...Array.from(t).map(([,r])=>r),n].filter(r=>r.items.length)}const z0=e=>(e==null?void 0:e.get("groups"))||[],U0=(e,t)=>z0(e).includes(t),v4=(e,t)=>{U0(e,t)||e.set("groups",[...z0(e),t])};class b4{constructor(t){this.dataSourceKeyid=Uo.globalStyles,this.records=[],this.openCategories=new Map,this.store=t,pn(this,{openCategories:!1},{autoBind:!0})}get sdkOptionStyles(){var t;return((t=this.store.appEditorStore.sdkOptions.globalStyles)==null?void 0:t.default)||[]}get editor(){return this.store.appEditorStore.editor}get DataSources(){var t;return(t=this.editor)==null?void 0:t.DataSources}get recordsByCategory(){const{records:t,sdkOptionStyles:n}=this,s=[],r=t.reduce((o,i)=>(o.set(i.get("id"),i),o),new Map);return n.forEach(({id:o})=>{const i=r.get(o);i&&(s.push(i),r.delete(o))}),Array.from(r).map(([,o])=>{o.get("_internal")||s.push(o)}),m4(s.map(o=>({category:o.get("category"),item:o})))}setCategoryOpen(t,n){this.openCategories.set(t,n)}getDataSource(){var t;return(t=this.DataSources)==null?void 0:t.get(this.dataSourceKeyid)}getRuleByGroup(t){var n;return(n=this.editor)==null?void 0:n.CssComposer.getAll().find(s=>U0(s,t))}addStyleRule(t,n={}){var f,p;const{editor:s}=this,r=t.get("id"),o=t.get("selector")||"",i=t.get("property"),a=t.getPath("value"),l=`${this.dataSourceKeyid}:${r}`,u={[i]:{type:"data-variable",path:a,defaultValue:t.get("defaultValue")}};if(s&&rS(s)&&o.startsWith("mj-")){const g=s.Components.getWrapper(),{head:m}=Ta,{attributes:v}=ih,b=g.findFirstType(Ta.root);if(!b)return;const x=b.findFirstType(m)||b.append({type:m},{at:0})[0],y=x.findFirstType(v)||x.append({type:v})[0],w=y.findType(o).pop()||y.append({type:o})[0],S=(w.get("attributes")||{})[i];Dt(S)&&S!==""&&t.set("value",S),w.addAttributes(u,{silent:!0});return}let d=((p=(f=n.selectorToRuleMap)==null?void 0:f.get(o))==null?void 0:p.rule)||this.getRuleByGroup(l);d?d.addStyle(u):d=s==null?void 0:s.CssComposer.addCollection([{selectors:[],selectorsAdd:o,style:u}],{extend:!0,at:t.index})[0],d&&v4(d,l)}createDataSource(){return this.DataSources.add({id:this.dataSourceKeyid,records:[]})}onLoad(){var o,i;const{sdkOptionStyles:t}=this,n=new Map,s=(o=this.editor)==null?void 0:o.Css;if(!t.length){this.records=[];return}const r=this.getDataSource()||this.createDataSource();t.forEach(a=>{const{id:l,selector:u,label:d,field:f,property:p,category:g}=a,m=r.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)||(s==null?void 0:s.getRule(u)),x=(v==null?void 0:v.styles)||(b==null?void 0:b.getStyle())||{},y=x[p]||a.defaultValue;n.set(u,{rule:b,styles:x}),r.addRecord({value:void 0,...a,defaultValue:y,_internal:!0,_undo:!0})}}),r.getRecords().forEach(a=>{this.addStyleRule(a,{selectorToRuleMap:n})}),r.listenTo(r.records,"add",a=>{this.addStyleRule(a)}),(i=this.editor)==null||i.UndoManager.add(r.records),this.records=r.getRecords()}}const y4=()=>jn().globalStylesStore,x4=(e,t)=>{let n;try{const s=Ws()&&e&&localStorage.getItem(e);s&&(n=JSON.parse(s))}catch(s){console.error(s)}return{lastProjectId:"",...t,...n}},dm=(e,t)=>{const s={...x4(e),...t};try{Ws()&&e&&localStorage.setItem(e,JSON.stringify(s))}catch(r){console.error(r)}return s},fm="gs-utl-dark",w4=()=>Ws()&&window.matchMedia("(prefers-color-scheme: dark)").matches,W0=e=>e==="dark"||e==="auto"&&w4(),pm=(e,t)=>{if(e&&Ws()&&t.rootEl){const{classList:n}=t.rootEl;let s=!1;if(W0(e)?(n.add(fm),s=!0):n.remove(fm),t.updateAppShell){const r=document.head.querySelector('meta[name="theme-color"]');r&&(r.content=s?"#18181b":"#ffffff")}t.resolvedTheme=s?Ir.dark:Ir.light}};class S4{constructor(t){this.key="",this.theme=Ir.auto,this.resolvedTheme=Ir.light,this.lastProjectId="",this.updateAppShell=!1,this.rootEl=void 0,t&&Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),this.resolvedTheme=this.theme,pn(this,{},{autoBind:!0}),this.init()}init(){pm(this.theme,this)}changeTheme(t){pm(t,this),dm(this.key,{theme:t})}setTheme(t){this.theme=t}setRootEl(t){this.rootEl=t}setLocalState(t){Object.keys(t).forEach(n=>{const s=n,r=t[s];r!==void 0&&(this[s]=r)}),dm(this.key,t)}get isDarkTheme(){return W0(this.theme)}}const qs=()=>jn().localSettingsStore;class C4{constructor(t){this.isOpen=!1,this.title="",this.content="",this.size="l",this.fullH=!1,this.modalProps={},this.buttons=[],this.store=t,pn(this,{},{autoBind:!0})}setModalProps(t){this.modalProps={title:"",size:"l",fullH:!1,buttons:[],...t}}open({content:t,...n}){this.isOpen=!0,this.content=t,this.setModalProps(n)}close(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.content="",this.setModalProps({size:this.modalProps.size})}confirm({content:t,size:n="m",onConfirm:s,confirmButton:r,...o}){this.isOpen=!0,this.content=t;const i=()=>{s==null||s(),this.close()};this.setModalProps({...o,size:n,buttons:[{children:"Cancel",onClick:this.close,size:"m2"},{children:"Confirm",onClick:i,size:"m2",variant:"pr",...r}]})}}const Li=()=>jn().modalStore,hm="column1",gm="column2",mm="column3",Af="column3-7",j4=function(e,t={}){const{Components:n,Blocks:s}=e,r="gridRow",o="gridColumn",i="gjs-grid-row",a="gjs-grid-column",l={tl:0,tc:0,tr:0,cl:0,bl:0,br:0},u="flex-basis",d=1,f=1,p=1;n.addType(r,{isComponent:b=>Wr(b,i),model:{defaults:{emptyState:!0,droppable:_s(o),highlightable:!1,attributes:{class:i},resizable:{...l,keyHeight:"min-height"},icon:`
|
|
108
43
|
<svg viewBox="0 0 24 24">
|
|
109
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>
|
|
110
45
|
</svg>
|
|
111
|
-
`,"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:o})}}],styles:`
|
|
112
47
|
.${i} {
|
|
113
48
|
display: flex;
|
|
114
49
|
justify-content: flex-start;
|
|
@@ -122,7 +57,7 @@ ${t}
|
|
|
122
57
|
flex-direction: column;
|
|
123
58
|
}
|
|
124
59
|
}
|
|
125
|
-
`}}}),n.addType(o,{isComponent:
|
|
60
|
+
`}}}),n.addType(o,{isComponent:b=>Wr(b,a),model:{defaults:{emptyState:!0,attributes:{class:a},draggable:_s(r),resizable:{...l,bc:0,keyWidth:u,currentUnit:p,minDim:d,step:f},icon:`
|
|
126
61
|
<svg viewBox="0 0 24 24">
|
|
127
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>
|
|
128
63
|
</svg>
|
|
@@ -131,50 +66,50 @@ ${t}
|
|
|
131
66
|
flex: 1 1 0%;
|
|
132
67
|
padding: 5px 0;
|
|
133
68
|
}
|
|
134
|
-
`},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:r,content:{type:r,components:[{type:o},{type:o},{type:o}]},...t.block},m={merge:!0},v=b=>{var x;return((x=s.get(b))==null?void 0:x.category)||g.category};s.add(hm,{...g,category:v(hm),content:{type:r,components:[{type:o}]}},m),s.add(gm,{...g,category:v(gm),content:{type:r,components:[{type:o},{type:o}]}},m),s.add(mm,{...g,category:v(mm),content:{type:r,components:[{type:o},{type:o},{type:o}]}},m),s.add(Af,{...g,category:v(Af),content:{type:r,components:[{type:o,style:{"flex-basis":"30%","flex-grow":0}},{type:o}]}},m)},ea="section",fd="container",pd="gjs-section",hd="gjs-container",E4=function(e,t={}){const{Components:n,Blocks:s}=e;s.add(ea,{label:ea,media:`
|
|
135
70
|
<svg viewBox="0 0 24 24">
|
|
136
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" />
|
|
137
72
|
</svg>
|
|
138
|
-
`,content:{type:
|
|
139
|
-
.${
|
|
73
|
+
`,content:{type:ea},...t.block},{at:ol(e,Af)+1}),n.addType(ea,{isComponent:r=>Wr(r,pd),model:{defaults:{tagName:"section",emptyState:!0,draggable:_s("wrapper"),droppable:_s(fd),attributes:{class:pd},components:{type:fd},styles:`
|
|
74
|
+
.${pd} {
|
|
140
75
|
display: flex;
|
|
141
76
|
padding: 50px 0;
|
|
142
77
|
}
|
|
143
|
-
`}}}),n.addType(
|
|
144
|
-
.${
|
|
78
|
+
`}}}),n.addType(fd,{isComponent:r=>Wr(r,hd),model:{defaults:{emptyState:!0,copyable:!1,removable:!1,draggable:!1,attributes:{class:hd},styles:`
|
|
79
|
+
.${hd} {
|
|
145
80
|
width: 90%;
|
|
146
81
|
margin: 0 auto;
|
|
147
82
|
max-width: 1200px;
|
|
148
83
|
}
|
|
149
|
-
`}}})},
|
|
84
|
+
`}}})},T4=function(e,t={}){const{Components:n,Blocks:s}=e,r="divider",o="gjs-divider";s.add(r,{label:r,media:`
|
|
150
85
|
<svg viewBox="0 0 24 24">
|
|
151
86
|
<path d="M8,18H11V15H2V13H22V15H13V18H16L12,22L8,18M12,2L8,6H11V9H2V11H22V9H13V6H16L12,2Z" />
|
|
152
87
|
</svg>
|
|
153
|
-
`,content:{type:r},...t.block},{at:
|
|
88
|
+
`,content:{type:r},...t.block},{at:ol(e,ea)+1}),n.addType(r,{isComponent:i=>Wr(i,o),model:{defaults:{droppable:!1,highlightable:!1,attributes:{class:o},stylable:["height","width","background-color","margin","margin-top","margin-right","margin-bottom","margin-left"],styles:`
|
|
154
89
|
.${o} {
|
|
155
90
|
height: 3px;
|
|
156
91
|
width: 100%;
|
|
157
92
|
margin: 10px;
|
|
158
93
|
background-color: rgba(0, 0, 0, 0.05);
|
|
159
94
|
}
|
|
160
|
-
`}}})},
|
|
95
|
+
`}}})},P4=function(e){const{Components:t,Blocks:n}=e,r=t.getType("wrapper").model.getDefaults(),o=t.getType("head").model;t.addType("wrapper",{model:{defaults:{emptyState:{styleIn:"height: 100vh",styleOut:"padding: 0;"},stylable:[...r.stylable,"padding","font-family","color","font-size","font-weight","line-height","letter-spacing","text-align","vertical-align","text-decoration","text-transform","direction","white-space"]}}}),t.addType("head",{model:{components(u,d){return o.prototype.components.call(this,u,{...d,skipDomReset:!0})}},view:{updateContent(){}}}),t.addType("text",{model:{defaults:{highlightable:!1,emptyState:{styleIn:"min-height: auto; font-size: inherit;"}}}}),t.addType("image",{model:{defaults:{traits:[{type:"image",name:"src",label:"Image",changeProp:!0,typeProps:{inputField:!0}},"alt",{type:"checkbox",name:"loading",valueTrue:"lazy"}]}}});const a=t.getType("link").model;a.typeExtends.add("text"),t.addType("link",{model:{defaults:{emptyState:!0,traits:["title",{type:"checkbox",name:"target",valueTrue:"_blank"},{type:"href",name:"href"}]},getAttrToHTML(){const u=a.prototype.getAttrToHTML.apply(this),{href:d}=u;if(d&&d.startsWith(Ea)){const f=d.replace(Ea,""),p=e.Pages.get(f);if(u.href=p?`./${Ef(e,p)}`:"##",p&&pu(p)){const g={id:qA(this,"id")},m=L0(p,{currentItem:g});u.href=m.fullPath,ZA(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)}}})},O4=function(e,t={}){const{Components:n,Blocks:s}=e,r="heading";s.add(r,{label:r,media:`
|
|
161
96
|
<svg viewBox="0 0 24 24">
|
|
162
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>
|
|
163
98
|
</svg>
|
|
164
|
-
`,content:{type:r,components:"Insert your text here"},...t.block},{at:
|
|
99
|
+
`,content:{type:r,components:"Insert your text here"},...t.block},{at:ol(e,"text")}),n.addType(r,{extend:"text",isComponent:o=>HA(o,"H1","H2","H3","H4","H5","H6"),model:{defaults:{emptyState:!0,tagName:"h1",traits:[{type:"select",options:[{value:"h1",name:"One (largest)"},{value:"h2",name:"Two"},{value:"h3",name:"Three"},{value:"h4",name:"Four"},{value:"h5",name:"Five"},{value:"h6",name:"Six (smallest)"}],label:"Size",name:"tagName",changeProp:!0}]}}})},_4=function(e,t={}){const{Components:n,Blocks:s}=e,r=e.Components.getType("default").model,o="imageBox",i="gjs-image-box";s.add(o,{label:o,media:`
|
|
165
100
|
<svg viewBox="0 0 24 24">
|
|
166
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" />
|
|
167
102
|
</svg>
|
|
168
|
-
`,content:{type:o},...t.block},{at:
|
|
103
|
+
`,content:{type:o},...t.block},{at:ol(e,"image")+1}),n.addType(o,{extend:"image",isComponent:a=>Wr(a,i),model:{defaults:{tagName:"div",void:!1,droppable:!0,emptyState:!1,resizable:{tl:0,tc:0,tr:0,cl:0,cr:0,bl:0,br:0},traits:["title"],attributes:{class:i},styles:`
|
|
169
104
|
.${i} {
|
|
170
105
|
height: 200px;
|
|
171
106
|
width: 100%;
|
|
172
107
|
}
|
|
173
|
-
`},getAttrToHTML(...a){return r.prototype.getAttrToHTML.apply(this,a)}},view:{tagName:"div",updateSrc(){const{model:a,em:l}=this,u=a.getSrcResult(),d=a.isDefaultSrc(),f=a.getStyle(),p=`url('${u}')`;u&&a.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()}}})},
|
|
108
|
+
`},getAttrToHTML(...a){return r.prototype.getAttrToHTML.apply(this,a)}},view:{tagName:"div",updateSrc(){const{model:a,em:l}=this,u=a.getSrcResult(),d=a.isDefaultSrc(),f=a.getStyle(),p=`url('${u}')`;u&&a.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()}}})},A4=function(e,t={}){const{Components:n,Blocks:s}=e,r="linkBox",o="gjs-link-box";s.add(r,{label:r,media:`
|
|
174
109
|
<svg viewBox="0 0 24 24">
|
|
175
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" />
|
|
176
111
|
</svg>
|
|
177
|
-
`,content:{type:r},...t.block},{at:
|
|
112
|
+
`,content:{type:r},...t.block},{at:ol(e,"link")+1}),n.addType(r,{isComponent:i=>Wr(i,o),extend:"link",model:{defaults:{editable:!1,droppable:!0,attributes:{class:o},styles:`
|
|
178
113
|
.${o} {
|
|
179
114
|
color: inherit;
|
|
180
115
|
display: inline-block;
|
|
@@ -183,9 +118,9 @@ ${t}
|
|
|
183
118
|
max-width: 100%;
|
|
184
119
|
text-decoration: none;
|
|
185
120
|
}
|
|
186
|
-
`}}})};function
|
|
121
|
+
`}}})};function L4(e){const t={};if(e.padding){const n=e.padding.split(" ");let s=n[0],r=n[0],o=n[0],i=n[0];n.length===4?(s=n[0],r=n[1],o=n[2],i=n[3]):n.length===3?(s=n[0],r=n[1],i=n[1],o=n[2]):n.length===2&&(s=n[0],r=n[1],i=n[1],o=n[0]),t["padding-top"]=e["padding-top"]||s,t["padding-right"]=e["padding-right"]||r,t["padding-bottom"]=e["padding-bottom"]||o,t["padding-left"]=e["padding-left"]||i,delete e.padding}return{...e,...t}}const M4={ratioDefault:!0,tc:!1,cl:!1,cr:!1,bc:!1},vm=`<svg viewBox="0 0 24 24">
|
|
187
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>
|
|
188
|
-
</svg>`,
|
|
123
|
+
</svg>`,N4=function(e,t={}){const{Components:n,Blocks:s}=e,r="icon",o="gjs-icon",i="data-type-icon";s.add(r,{label:"Icon",media:vm,content:{type:r},...t.block}),n.addType(r,{isComponent:a=>Wr(a,o)||rl(a,i),model:{defaults:{droppable:!1,attributes:{class:o,[i]:!0},resizable:M4,components:vm,traits:["id","title",{type:"code",label:"Content",typeProps:{language:"html",clean:!0,padding:5},getValue({component:a}){return a.getInnerHTML()},setValue:$r(({editor:a,component:l,value:u})=>{const d=a.Parser.parseHtml(u).html,f=Array.isArray(d)?d[0]:d;f&&f.tagName==="svg"&&l.components(f)},500)}],styles:`
|
|
189
124
|
.${o} {
|
|
190
125
|
display: inline-block;
|
|
191
126
|
text-decoration: none;
|
|
@@ -195,9 +130,9 @@ ${t}
|
|
|
195
130
|
width: 50px;
|
|
196
131
|
height: 50px;
|
|
197
132
|
}
|
|
198
|
-
`},init(){this.listenTo(this.components(),"change add",this.disableLayers),this.disableLayers()},disableLayers(){this.components().forEach(a=>a.set("layerable",!1))}},view:{init(){const{model:a}=this;this.listenTo(a.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(a=>{var u;const l=(u=a.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},
|
|
199
|
-
`).trim();
|
|
200
|
-
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(a=>a.set("layerable",!1))}},view:{init(){const{model:a}=this;this.listenTo(a.components(),"change",this.disableChildren)},onRender(){this.disableChildren()},disableChildren(){this.model.components().forEach(a=>{var u;const l=(u=a.view)==null?void 0:u.el;l&&(l.style.pointerEvents="none")})}}})},gd="__nc",$4=e=>{const t=e.getAttributes({noClass:!0,noStyle:!0});return e.traits.forEach(n=>{const s=n.getName();n.get("changeProp")||delete t[s]}),delete t.id,delete t.__p,t};function k4(e){const{Components:t}=e,n=s=>{const{model:r,id:o}=s,i=r.getDefaults();t.addType(o,{model:{defaults:{traits:[...i.traits,{name:"customAttributes",type:"stack",getValue({component:a}){const l=$4(a);return Object.keys(l).map(d=>({id:d,value:l[d]}))},setValue:({component:a,value:l,options:u,emitUpdate:d})=>{const f=u.removed,p=u.previous,g=u.item;if(f)a.removeAttributes(f.id);else{p&&g&&p.id!==g.id&&a.removeAttributes(p.id);const m=l.reduce((v,b)=>(v[b.id]=b.value||"",v),{});a.addAttributes(m)}d()},addItem:()=>({id:gd,value:!1}),labelItem:a=>a.id===gd||!a.id&&!a.value?"- Empty -":`${a.id||""}="${a.value||""}"`,properties:[{name:"id",label:"Name",getValue:a=>a===gd?"":a,setValue:(a,l)=>a.trim().toLowerCase().replace(/^[^a-z]{1}/gi,"_").replace(/\s+/g,"-")||l},{name:"value",label:"Value",getValue:a=>typeof a=="boolean"?"":a}]}]}}})};t.getTypes().forEach(n)}const R4="Basic";function md(e,t){const{appStore:n}=t;e.Css.getConfig().onBeforeStyle=L4;const s=e.Parser.getConfig().optionsHtml;s.htmlType="text/html";const r=n.sdkOptions.pages||{};(Dt(r.allowDocuments)?r.allowDocuments:!0)&&(s.detectDocument=!0,s.allowScripts=!0),e.Components.addType("trait-check",{model:{defaults:{traits:["id","title",{type:"select",name:"select-type",options:[{id:"value1",label:"Value 1"},{id:"value2",label:"Value 2"},{id:"value3",label:"Value 3"}]},{type:"number",name:"number-type",units:["px","rem","%"]},{type:"checkbox",name:"checkbox-type"},{type:"color",name:"color-type"},{type:"button",name:"button-type",label:"Delete",command:"core:component-delete"}]}}});const i={category:R4,select:!0,activate:!0};BA(e,t),P4(e),j4(e,{block:i}),O4(e,{block:i}),E4(e,{block:i}),T4(e,{block:i}),_4(e,{block:i}),A4(e,{block:i}),N4(e,{block:i}),k4(e)}function G0(e){const{code:t,appStore:n,showToastError:s}=e,{appEditorStore:r,toastStore:o,i18nStore:i}=n.store,{isProjectTypeEmail:a,editor:l}=r,u=(t||"").trim(),d=new DOMParser,f={input:t,output:"",error:""};let p="";try{if(a){const g=(l==null?void 0:l.Parser.config.optionsHtml)||{},m=g.codeSanitizer,v=B0(u,{sanitizer:m});if(g.htmlType==="text/xml"){const x=d.parseFromString(`<div>${v}</div>`,"text/xml").querySelector("parsererror div");f.error=(x==null?void 0:x.textContent)||""}m&&(l==null||l.runCommand(gu,{mjml:v})),p=v}else{const g=d.parseFromString(u,"text/html");q0(g.documentElement);const m=g.querySelectorAll("style"),v=[];m.forEach(x=>v.push(x.innerHTML));const b=v.filter(Boolean).join(`
|
|
134
|
+
`).trim();b&&(l==null||l.Parser.parserCss.parse(b,{throwOnError:!0}))}}catch(g){f.error=g.message}return f.error?s&&o.addError("error-parser",{header:i.t("actions.importCode.parseError"),content:f.error}):f.output=p||u,f}function q0(e){if(!e||e.nodeType!==Node.ELEMENT_NODE)return;const t=Array.from(e.attributes),n=Array.from(e.children);for(const s of t)e.setAttribute(s.name,s.value);for(const s of n)q0(s)}function I4(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function bm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function ym(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?bm(Object(n),!0).forEach(function(s){I4(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):bm(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function V4(e,t){if(e==null)return{};var n={},s=Object.keys(e),r,o;for(o=0;o<s.length;o++)r=s[o],!(t.indexOf(r)>=0)&&(n[r]=e[r]);return n}function H4(e,t){if(e==null)return{};var n=V4(e,t),s,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++)s=o[r],!(t.indexOf(s)>=0)&&Object.prototype.propertyIsEnumerable.call(e,s)&&(n[s]=e[s])}return n}function D4(e,t){return F4(e)||B4(e,t)||z4(e,t)||U4()}function F4(e){if(Array.isArray(e))return e}function B4(e,t){if(!(typeof Symbol>"u"||!(Symbol.iterator in Object(e)))){var n=[],s=!0,r=!1,o=void 0;try{for(var i=e[Symbol.iterator](),a;!(s=(a=i.next()).done)&&(n.push(a.value),!(t&&n.length===t));s=!0);}catch(l){r=!0,o=l}finally{try{!s&&i.return!=null&&i.return()}finally{if(r)throw o}}return n}}function z4(e,t){if(e){if(typeof e=="string")return xm(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 xm(e,t)}}function xm(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,s=new Array(t);n<t;n++)s[n]=e[n];return s}function U4(){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 W4(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function wm(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(e);t&&(s=s.filter(function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable})),n.push.apply(n,s)}return n}function Sm(e){for(var t=1;t<arguments.length;t++){var n=arguments[t]!=null?arguments[t]:{};t%2?wm(Object(n),!0).forEach(function(s){W4(e,s,n[s])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):wm(Object(n)).forEach(function(s){Object.defineProperty(e,s,Object.getOwnPropertyDescriptor(n,s))})}return e}function G4(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(s){return t.reduceRight(function(r,o){return o(r)},s)}}function ta(e){return function t(){for(var n=this,s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return r.length>=e.length?e.apply(this,r):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(r,a))}}}function Ac(e){return{}.toString.call(e).includes("Object")}function q4(e){return!Object.keys(e).length}function Pa(e){return typeof e=="function"}function K4(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function Z4(e,t){return Ac(t)||Hr("changeType"),Object.keys(t).some(function(n){return!K4(e,n)})&&Hr("changeField"),t}function Y4(e){Pa(e)||Hr("selectorType")}function X4(e){Pa(e)||Ac(e)||Hr("handlerType"),Ac(e)&&Object.values(e).some(function(t){return!Pa(t)})&&Hr("handlersType")}function J4(e){e||Hr("initialIsRequired"),Ac(e)||Hr("initialType"),q4(e)&&Hr("initialContent")}function Q4(e,t){throw new Error(e[t]||e.default)}var eL={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"},Hr=ta(Q4)(eL),Ml={changes:Z4,selector:Y4,handler:X4,initial:J4};function tL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};Ml.initial(e),Ml.handler(t);var n={current:e},s=ta(rL)(n,t),r=ta(sL)(n),o=ta(Ml.changes)(e),i=ta(nL)(n);function a(){var u=arguments.length>0&&arguments[0]!==void 0?arguments[0]:function(d){return d};return Ml.selector(u),u(n.current)}function l(u){G4(s,r,o,i)(u)}return[a,l]}function nL(e,t){return Pa(t)?t(e.current):t}function sL(e,t){return e.current=Sm(Sm({},e.current),t),t}function rL(e,t,n){return Pa(t)?t(e.current):Object.keys(n).forEach(function(s){var r;return(r=t[s])===null||r===void 0?void 0:r.call(t,e.current[s])}),n}var oL={create:tL},iL={paths:{vs:"https://cdn.jsdelivr.net/npm/monaco-editor@0.43.0/min/vs"}};function aL(e){return function t(){for(var n=this,s=arguments.length,r=new Array(s),o=0;o<s;o++)r[o]=arguments[o];return r.length>=e.length?e.apply(this,r):function(){for(var i=arguments.length,a=new Array(i),l=0;l<i;l++)a[l]=arguments[l];return t.apply(n,[].concat(r,a))}}}function lL(e){return{}.toString.call(e).includes("Object")}function cL(e){return e||Cm("configIsRequired"),lL(e)||Cm("configType"),e.urls?(uL(),{paths:{vs:e.urls.monacoBase}}):e}function uL(){console.warn(K0.deprecation)}function dL(e,t){throw new Error(e[t]||e.default)}var K0={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!
|
|
201
136
|
You are using deprecated way of configuration.
|
|
202
137
|
|
|
203
138
|
Instead of using
|
|
@@ -206,7 +141,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
206
141
|
monaco.config({ paths: { vs: '...' } })
|
|
207
142
|
|
|
208
143
|
For more please check the link https://github.com/suren-atoyan/monaco-loader#config
|
|
209
|
-
`},dm=M3(k3)(k0),V3={config:R3},I3=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return function(r){return n.reduceRight(function(o,i){return i(o)},r)}};function V0(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],V0(e[n],t[n]))}),am(am({},e),t)}var D3={type:"cancelation",msg:"operation is manually canceled"};function od(e){var t=!1,n=new Promise(function(s,r){e.then(function(o){return t?r(D3):s(o)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var H3=A3.create({config:N3,isInitialized:!1,resolve:null,reject:null,monaco:null}),I0=d3(H3,2),Za=I0[0],nu=I0[1];function F3(e){var t=V3.config(e),n=t.monaco,s=u3(t,["monaco"]);nu(function(r){return{config:V0(r.config,s),monaco:n}})}function B3(){var e=Za(function(t){var n=t.monaco,s=t.isInitialized,r=t.resolve;return{monaco:n,isInitialized:s,resolve:r}});if(!e.isInitialized){if(nu({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),od(id);if(window.monaco&&window.monaco.editor)return D0(window.monaco),e.resolve(window.monaco),od(id);I3(z3,W3)(G3)}return od(id)}function z3(e){return document.body.appendChild(e)}function U3(e){var t=document.createElement("script");return e&&(t.src=e),t}function W3(e){var t=Za(function(s){var r=s.config,o=s.reject;return{config:r,reject:o}}),n=U3("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function G3(){var e=Za(function(n){var s=n.config,r=n.resolve,o=n.reject;return{config:s,resolve:r,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){D0(n),e.resolve(n)},function(n){e.reject(n)})}function D0(e){Za().monaco||nu({monaco:e})}function q3(){return Za(function(e){var t=e.monaco;return t})}var id=new Promise(function(e,t){return nu({resolve:e,reject:t})}),H0={config:F3,init:B3,__getMonacoInstance:q3},K3={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},ad=K3,Y3={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},Z3=Y3;function X3({children:e}){return h.createElement("div",{style:Z3.container},e)}var J3=X3,Q3=J3;function e4({width:e,height:t,isEditorReady:n,loading:s,_ref:r,className:o,wrapperProps:i}){return h.createElement("section",{style:{...ad.wrapper,width:e,height:t},...i},!n&&h.createElement(Q3,null,s),h.createElement("div",{ref:r,style:{...ad.fullWidth,...!n&&ad.hide},className:o}))}var t4=e4,F0=h.memo(t4);function n4(e){h.useEffect(e,[])}var B0=n4;function s4(e,t,n=!0){let s=h.useRef(!0);h.useEffect(s.current||!n?()=>{s.current=!1}:e,t)}var xn=s4;function ea(){}function ei(e,t,n,s){return r4(e,s)||o4(e,t,n,s)}function r4(e,t){return e.editor.getModel(z0(e,t))}function o4(e,t,n,s){return e.editor.createModel(t,n,s?z0(e,s):void 0)}function z0(e,t){return e.Uri.parse(t)}function i4({original:e,modified:t,language:n,originalLanguage:s,modifiedLanguage:r,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:f={},height:p="100%",width:g="100%",className:m,wrapperProps:b={},beforeMount:v=ea,onMount:x=ea}){let[y,w]=h.useState(!1),[S,C]=h.useState(!0),j=h.useRef(null),E=h.useRef(null),_=h.useRef(null),T=h.useRef(x),P=h.useRef(v),A=h.useRef(!1);B0(()=>{let L=H0.init();return L.then(B=>(E.current=B)&&C(!1)).catch(B=>(B==null?void 0:B.type)!=="cancelation"&&console.error("Monaco initialization: error:",B)),()=>j.current?F():L.cancel()}),xn(()=>{if(j.current&&E.current){let L=j.current.getOriginalEditor(),B=ei(E.current,e||"",s||n||"text",o||"");B!==L.getModel()&&L.setModel(B)}},[o],y),xn(()=>{if(j.current&&E.current){let L=j.current.getModifiedEditor(),B=ei(E.current,t||"",r||n||"text",i||"");B!==L.getModel()&&L.setModel(B)}},[i],y),xn(()=>{let L=j.current.getModifiedEditor();L.getOption(E.current.editor.EditorOption.readOnly)?L.setValue(t||""):t!==L.getValue()&&(L.executeEdits("",[{range:L.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),L.pushUndoStop())},[t],y),xn(()=>{var L,B;(B=(L=j.current)==null?void 0:L.getModel())==null||B.original.setValue(e||"")},[e],y),xn(()=>{let{original:L,modified:B}=j.current.getModel();E.current.editor.setModelLanguage(L,s||n||"text"),E.current.editor.setModelLanguage(B,r||n||"text")},[n,s,r],y),xn(()=>{var L;(L=E.current)==null||L.editor.setTheme(u)},[u],y),xn(()=>{var L;(L=j.current)==null||L.updateOptions(f)},[f],y);let M=h.useCallback(()=>{var q;if(!E.current)return;P.current(E.current);let L=ei(E.current,e||"",s||n||"text",o||""),B=ei(E.current,t||"",r||n||"text",i||"");(q=j.current)==null||q.setModel({original:L,modified:B})},[n,t,r,e,s,o,i]),R=h.useCallback(()=>{var L;!A.current&&_.current&&(j.current=E.current.editor.createDiffEditor(_.current,{automaticLayout:!0,...f}),M(),(L=E.current)==null||L.editor.setTheme(u),w(!0),A.current=!0)},[f,u,M]);h.useEffect(()=>{y&&T.current(j.current,E.current)},[y]),h.useEffect(()=>{!S&&!y&&R()},[S,y,R]);function F(){var B,q,H,$;let L=(B=j.current)==null?void 0:B.getModel();a||((q=L==null?void 0:L.original)==null||q.dispose()),l||((H=L==null?void 0:L.modified)==null||H.dispose()),($=j.current)==null||$.dispose()}return h.createElement(F0,{width:g,height:p,isEditorReady:y,loading:d,_ref:_,className:m,wrapperProps:b})}var a4=i4;h.memo(a4);function l4(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var c4=l4,wl=new Map;function u4({defaultValue:e,defaultLanguage:t,defaultPath:n,value:s,language:r,path:o,theme:i="light",line:a,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:p=!1,width:g="100%",height:m="100%",className:b,wrapperProps:v={},beforeMount:x=ea,onMount:y=ea,onChange:w,onValidate:S=ea}){let[C,j]=h.useState(!1),[E,_]=h.useState(!0),T=h.useRef(null),P=h.useRef(null),A=h.useRef(null),M=h.useRef(y),R=h.useRef(x),F=h.useRef(),L=h.useRef(s),B=c4(o),q=h.useRef(!1),H=h.useRef(!1);B0(()=>{let O=H0.init();return O.then(V=>(T.current=V)&&_(!1)).catch(V=>(V==null?void 0:V.type)!=="cancelation"&&console.error("Monaco initialization: error:",V)),()=>P.current?I():O.cancel()}),xn(()=>{var V,G,W,K;let O=ei(T.current,e||s||"",t||r||"",o||n||"");O!==((V=P.current)==null?void 0:V.getModel())&&(f&&wl.set(B,(G=P.current)==null?void 0:G.saveViewState()),(W=P.current)==null||W.setModel(O),f&&((K=P.current)==null||K.restoreViewState(wl.get(o))))},[o],C),xn(()=>{var O;(O=P.current)==null||O.updateOptions(u)},[u],C),xn(()=>{!P.current||s===void 0||(P.current.getOption(T.current.editor.EditorOption.readOnly)?P.current.setValue(s):s!==P.current.getValue()&&(H.current=!0,P.current.executeEdits("",[{range:P.current.getModel().getFullModelRange(),text:s,forceMoveMarkers:!0}]),P.current.pushUndoStop(),H.current=!1))},[s],C),xn(()=>{var V,G;let O=(V=P.current)==null?void 0:V.getModel();O&&r&&((G=T.current)==null||G.editor.setModelLanguage(O,r))},[r],C),xn(()=>{var O;a!==void 0&&((O=P.current)==null||O.revealLine(a))},[a],C),xn(()=>{var O;(O=T.current)==null||O.editor.setTheme(i)},[i],C);let $=h.useCallback(()=>{var O;if(!(!A.current||!T.current)&&!q.current){R.current(T.current);let V=o||n,G=ei(T.current,s||e||"",t||r||"",V||"");P.current=(O=T.current)==null?void 0:O.editor.create(A.current,{model:G,automaticLayout:!0,...u},d),f&&P.current.restoreViewState(wl.get(V)),T.current.editor.setTheme(i),a!==void 0&&P.current.revealLine(a),j(!0),q.current=!0}},[e,t,n,s,r,o,u,d,f,i,a]);h.useEffect(()=>{C&&M.current(P.current,T.current)},[C]),h.useEffect(()=>{!E&&!C&&$()},[E,C,$]),L.current=s,h.useEffect(()=>{var O,V;C&&w&&((O=F.current)==null||O.dispose(),F.current=(V=P.current)==null?void 0:V.onDidChangeModelContent(G=>{H.current||w(P.current.getValue(),G)}))},[C,w]),h.useEffect(()=>{if(C){let O=T.current.editor.onDidChangeMarkers(V=>{var W;let G=(W=P.current.getModel())==null?void 0:W.uri;if(G&&V.find(K=>K.path===G.path)){let K=T.current.editor.getModelMarkers({resource:G});S==null||S(K)}});return()=>{O==null||O.dispose()}}return()=>{}},[C,S]);function I(){var O,V;(O=F.current)==null||O.dispose(),p?f&&wl.set(o,P.current.saveViewState()):(V=P.current.getModel())==null||V.dispose(),P.current.dispose()}return h.createElement(F0,{width:g,height:m,isEditorReady:C,loading:l,_ref:A,className:b,wrapperProps:v})}var d4=u4,f4=h.memo(d4),p4=f4;function Dr({className:e,as:t="label",bold:n,m:s="gjs-mb-1",size:r="m",capitalize:o=!0,children:i,tip:a,onClear:l,...u}){const d=t,f=!!l;return c.jsxs(d,{className:N(e,s,f&&z.tAo,o&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",r==="s"&&"gs-utl-text-sm",a||f?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...f&&{htmlFor:""},...u,children:[!!a&&c.jsx(It,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:a,children:c.jsx(oe,{icon:Z.information,size:le.s2x})}),i,f&&c.jsx(bt,{title:"Clear value",onClick:l,icon:{icon:Z.close,size:le.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var U0=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e))(U0||{}),W0=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(W0||{});const h4="gs-cmp-button",su=h.memo(fe(function({classNameBtn:t,className:n,children:s,tooltip:r,variant:o,onClick:i,editorEvents:a,label:l,size:u,icon:d,active:f,buttonType:p,disabled:g,...m}){const{editor:b}=ye(),[v,x]=h.useState(()=>({disabled:g,variant:o,active:f,className:n,classNameBtn:t,tooltip:r,icon:d,size:u,label:l})),y=v.variant,w=y==="outline",S=y==="secondary",C=y==="primary"?"pr":w||S?"out-clear":void 0,j=v.label,E=T=>{b&&(i==null||i({event:T,editor:b,state:v,setState:P=>x(A=>({...A,...P}))}))};h.useEffect(()=>{if(!a||!b)return;const T=Object.keys(a).reduce((A,M)=>(A[M]=(R={})=>{a[M]({fromEvent:R,editor:b,state:v,setState:F=>x(L=>({...L,...F}))})},A),{}),P=Object.keys(T);return P.forEach(A=>b.on(A,T[A])),()=>{P.forEach(A=>b.off(A,T[A]))}},[b,v]);const _=v.tooltip;return c.jsx(bt,{className:N(h4,v.classNameBtn),classNameWrp:v.className,variant:C,icon:v.icon,active:v.active,size:v.size,disabled:v.disabled,onClick:E,border:w||S,type:p,withBg:S,block:!0,...ot(_)?{title:_}:{tooltipProps:_},...m,children:j?Ye(j)?j({editor:b}):j:s})}));var Wp=(e=>(e.m="m",e.s="s",e))(Wp||{});const G0="gs-input-field",yc=e=>Lt(e)?e:"",Xa=(e={})=>N("gs-utl-w-full",z.bgTr,$r.inputText,e.disabled&&z.txtLowEmphasis),Gp=({size:e="m"}={})=>N("gs-input-container gs-utl-w-full",z.bg,re.b,re.rnd,z.br,e==="m"&&je.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),qr=({className:e,style:t,row:n})=>({className:N(e,"gs-utl-w-full gs-utl-flex",n?`${G0}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),fs=e=>{const{as:t,size:n="m",label:s,description:r,hasClear:o,onChange:i,tip:a,row:l,afterLabel:u,afterLabelButtons:d}=e,f=!!s,p=!!r,g=o!=null&&o(e)?()=>i==null?void 0:i(""):void 0;if(!f&&!(d!=null&&d.length)&&!p)return null;const m=c.jsx(c.Fragment,{children:f&&c.jsx(Dr,{as:t,className:"gs-utl-w-full",size:n,tip:p?void 0:a,onClear:g,m:"",children:s})}),b=u||d!=null&&d.length?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((v,x)=>c.jsx(su,{...v},v.id??x))]}):null;return c.jsxs(k,{className:N("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[b?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[m,b]}):m,p&&c.jsx(Dr,{size:n,tip:a,as:"span",className:N(z.txtLowEmphasis),capitalize:!1,children:r})]})},tt=h.forwardRef(function(t,n){const{className:s,value:r,type:o,placeholder:i,required:a,disabled:l,readOnly:u,name:d,autoFocus:f,onInput:p,onChange:g,onBlur:m,onKeyDown:b,labelAs:v}=t,[x,y]=h.useState(yc(r)),w=Xa(t),S=h.useRef(null);h.useImperativeHandle(n,()=>S.current,[]),h.useEffect(()=>{y(yc(r))},[r]),h.useEffect(()=>{const P=S.current;if(P&&f){const A=P.querySelector("input"),M=setTimeout(()=>A==null?void 0:A.focus(),tp);return()=>clearTimeout(M)}},[S.current,f]);const C=(P,A)=>{g==null||g(P,A)},j=P=>{const{key:A}=P;switch(b==null||b(P),A){case"Escape":return y(r);case"Enter":return C(x)}},E=()=>{C(x),m==null||m()},_=P=>{const A=P.target.value;y(A),p==null||p(A)},T=qr({...t,className:N(G0,s)});return c.jsxs("div",{...T,ref:S,children:[c.jsx(fs,{...t,as:v}),c.jsxs(k,{className:Gp(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(D,{grow:!0,children:c.jsx("input",{className:w,name:d,value:x,onChange:_,placeholder:i,required:a,onBlur:E,onKeyDown:j,readOnly:u,disabled:l,type:o,maxLength:t.maxLength})}),t.afterInput]})]})}),q0=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},g4="gs-field-code",m4={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 ir(e){const{defaultValue:t,value:n,language:s,onChange:r,clean:o,padding:i,isDarkTheme:a,className:l,containerClassName:u,minHeight:d="170px",onMount:f,readOnly:p,name:g,required:m,disabled:b,formatOnMount:v=!0,monacoOptions:x,labelAs:y}=e,w=n!==void 0,S=s,C=w?n:t,j=typeof C=="string"?C:JSON.stringify(C??"",null,2),E=qr({...e,className:N(g4,"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",{...E,children:[c.jsx(fs,{...e,as:y}),c.jsxs("div",{className:_,style:{minHeight:d},children:[g&&c.jsx("input",{className:Ee.hiddenVisually,name:g,value:j,disabled:b,required:m,onChange:()=>{}}),c.jsx("div",{className:N("gs-utl-absolute gs-utl-inset-0",b&&Ee.disabled),children:c.jsx(p4,{...w?{language:S,value:j}:{defaultLanguage:S,defaultValue:j},theme:a?"vs-dark":"light",className:N(re.b,re.rnd,z.br,l),options:{...m4,readOnly:p,...o&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Lt(i)&&{lineDecorationsWidth:i*2,padding:{top:i,bottom:i}},...x},onChange:r,onMount:(T,P)=>{if(v){let A=!1;const M=()=>q0(T);T.onDidChangeModelLanguageConfiguration(M),T.onDidScrollChange(()=>{A||(A=!0,M())}),setTimeout(M,10)}f==null||f(T,P)}})})]})]})}const K0=fe(function({buttonProps:t,content:n,code:s,onAction:r}){const o=ji(),i=Re(),a=ye(),{isProjectTypeEmail:l}=a,u=a.editor,{isDarkTheme:d}=Ds(),[f,p]=h.useState(),g=()=>{let b=(f||"").trim();const v=R0({code:b,appStore:a,showToastError:!0});if(!v.error)b=v.output;else return;r?r(b):l?u.loadProjectData({pages:[{component:b}]}):u.setComponents(b),o.close()};h.useEffect(()=>{s?p(s):(async()=>{var S,C;const v=await u.runCommand(ie.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),x=(S=v.find(j=>j.mimeType==="text/html"))==null?void 0:S.content,y=(C=v.find(j=>j.mimeType==="text/mjml"))==null?void 0:C.content,w=l?y:x;w&&p(w)})()},[]);const m=(t==null?void 0:t.children)||i.t("actions.importCode.button");return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(D,{children:n??i.t("actions.importCode.content")}),c.jsx(D,{className:ee("h-96"),children:f!==void 0&&c.jsx(ir,{defaultValue:f,onChange:b=>p(b||""),isDarkTheme:d,language:"html"})}),c.jsx(k,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),mf="data-type-empty",fm=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:s}=n,r=Array.from(s.getDoc().querySelectorAll(`style[${mf}]`));for(const o of r)o.disabled=!t})},b4=(e,t,n="Empty",s={})=>{const r=`[${mf}="${t}"]`;if(!e.frameView.getDoc())return;const o=e.frameView.getHead(),{midSelector:i="",styleOut:a="",styleIn:l=""}=s;if(!o.querySelector(`style${r}`)){const u=document.createElement("style");u.setAttribute(mf,t),u.innerHTML=`
|
|
144
|
+
`},Cm=aL(dL)(K0),fL={config:cL},pL=function(){for(var t=arguments.length,n=new Array(t),s=0;s<t;s++)n[s]=arguments[s];return function(r){return n.reduceRight(function(o,i){return i(o)},r)}};function Z0(e,t){return Object.keys(t).forEach(function(n){t[n]instanceof Object&&e[n]&&Object.assign(t[n],Z0(e[n],t[n]))}),ym(ym({},e),t)}var hL={type:"cancelation",msg:"operation is manually canceled"};function vd(e){var t=!1,n=new Promise(function(s,r){e.then(function(o){return t?r(hL):s(o)}),e.catch(r)});return n.cancel=function(){return t=!0},n}var gL=oL.create({config:iL,isInitialized:!1,resolve:null,reject:null,monaco:null}),Y0=D4(gL,2),ll=Y0[0],mu=Y0[1];function mL(e){var t=fL.config(e),n=t.monaco,s=H4(t,["monaco"]);mu(function(r){return{config:Z0(r.config,s),monaco:n}})}function vL(){var e=ll(function(t){var n=t.monaco,s=t.isInitialized,r=t.resolve;return{monaco:n,isInitialized:s,resolve:r}});if(!e.isInitialized){if(mu({isInitialized:!0}),e.monaco)return e.resolve(e.monaco),vd(bd);if(window.monaco&&window.monaco.editor)return X0(window.monaco),e.resolve(window.monaco),vd(bd);pL(bL,xL)(wL)}return vd(bd)}function bL(e){return document.body.appendChild(e)}function yL(e){var t=document.createElement("script");return e&&(t.src=e),t}function xL(e){var t=ll(function(s){var r=s.config,o=s.reject;return{config:r,reject:o}}),n=yL("".concat(t.config.paths.vs,"/loader.js"));return n.onload=function(){return e()},n.onerror=t.reject,n}function wL(){var e=ll(function(n){var s=n.config,r=n.resolve,o=n.reject;return{config:s,resolve:r,reject:o}}),t=window.require;t.config(e.config),t(["vs/editor/editor.main"],function(n){X0(n),e.resolve(n)},function(n){e.reject(n)})}function X0(e){ll().monaco||mu({monaco:e})}function SL(){return ll(function(e){var t=e.monaco;return t})}var bd=new Promise(function(e,t){return mu({resolve:e,reject:t})}),J0={config:mL,init:vL,__getMonacoInstance:SL},CL={wrapper:{display:"flex",position:"relative",textAlign:"initial"},fullWidth:{width:"100%"},hide:{display:"none"}},yd=CL,jL={container:{display:"flex",height:"100%",width:"100%",justifyContent:"center",alignItems:"center"}},EL=jL;function TL({children:e}){return h.createElement("div",{style:EL.container},e)}var PL=TL,OL=PL;function _L({width:e,height:t,isEditorReady:n,loading:s,_ref:r,className:o,wrapperProps:i}){return h.createElement("section",{style:{...yd.wrapper,width:e,height:t},...i},!n&&h.createElement(OL,null,s),h.createElement("div",{ref:r,style:{...yd.fullWidth,...!n&&yd.hide},className:o}))}var AL=_L,Q0=h.memo(AL);function LL(e){h.useEffect(e,[])}var ey=LL;function ML(e,t,n=!0){let s=h.useRef(!0);h.useEffect(s.current||!n?()=>{s.current=!1}:e,t)}var On=ML;function aa(){}function ci(e,t,n,s){return NL(e,s)||$L(e,t,n,s)}function NL(e,t){return e.editor.getModel(ty(e,t))}function $L(e,t,n,s){return e.editor.createModel(t,n,s?ty(e,s):void 0)}function ty(e,t){return e.Uri.parse(t)}function kL({original:e,modified:t,language:n,originalLanguage:s,modifiedLanguage:r,originalModelPath:o,modifiedModelPath:i,keepCurrentOriginalModel:a=!1,keepCurrentModifiedModel:l=!1,theme:u="light",loading:d="Loading...",options:f={},height:p="100%",width:g="100%",className:m,wrapperProps:v={},beforeMount:b=aa,onMount:x=aa}){let[y,w]=h.useState(!1),[S,C]=h.useState(!0),j=h.useRef(null),E=h.useRef(null),O=h.useRef(null),P=h.useRef(x),T=h.useRef(b),_=h.useRef(!1);ey(()=>{let A=J0.init();return A.then(H=>(E.current=H)&&C(!1)).catch(H=>(H==null?void 0:H.type)!=="cancelation"&&console.error("Monaco initialization: error:",H)),()=>j.current?V():A.cancel()}),On(()=>{if(j.current&&E.current){let A=j.current.getOriginalEditor(),H=ci(E.current,e||"",s||n||"text",o||"");H!==A.getModel()&&A.setModel(H)}},[o],y),On(()=>{if(j.current&&E.current){let A=j.current.getModifiedEditor(),H=ci(E.current,t||"",r||n||"text",i||"");H!==A.getModel()&&A.setModel(H)}},[i],y),On(()=>{let A=j.current.getModifiedEditor();A.getOption(E.current.editor.EditorOption.readOnly)?A.setValue(t||""):t!==A.getValue()&&(A.executeEdits("",[{range:A.getModel().getFullModelRange(),text:t||"",forceMoveMarkers:!0}]),A.pushUndoStop())},[t],y),On(()=>{var A,H;(H=(A=j.current)==null?void 0:A.getModel())==null||H.original.setValue(e||"")},[e],y),On(()=>{let{original:A,modified:H}=j.current.getModel();E.current.editor.setModelLanguage(A,s||n||"text"),E.current.editor.setModelLanguage(H,r||n||"text")},[n,s,r],y),On(()=>{var A;(A=E.current)==null||A.editor.setTheme(u)},[u],y),On(()=>{var A;(A=j.current)==null||A.updateOptions(f)},[f],y);let L=h.useCallback(()=>{var U;if(!E.current)return;T.current(E.current);let A=ci(E.current,e||"",s||n||"text",o||""),H=ci(E.current,t||"",r||n||"text",i||"");(U=j.current)==null||U.setModel({original:A,modified:H})},[n,t,r,e,s,o,i]),N=h.useCallback(()=>{var A;!_.current&&O.current&&(j.current=E.current.editor.createDiffEditor(O.current,{automaticLayout:!0,...f}),L(),(A=E.current)==null||A.editor.setTheme(u),w(!0),_.current=!0)},[f,u,L]);h.useEffect(()=>{y&&P.current(j.current,E.current)},[y]),h.useEffect(()=>{!S&&!y&&N()},[S,y,N]);function V(){var H,U,D,$;let A=(H=j.current)==null?void 0:H.getModel();a||((U=A==null?void 0:A.original)==null||U.dispose()),l||((D=A==null?void 0:A.modified)==null||D.dispose()),($=j.current)==null||$.dispose()}return h.createElement(Q0,{width:g,height:p,isEditorReady:y,loading:d,_ref:O,className:m,wrapperProps:v})}var RL=kL;h.memo(RL);function IL(e){let t=h.useRef();return h.useEffect(()=>{t.current=e},[e]),t.current}var VL=IL,Nl=new Map;function HL({defaultValue:e,defaultLanguage:t,defaultPath:n,value:s,language:r,path:o,theme:i="light",line:a,loading:l="Loading...",options:u={},overrideServices:d={},saveViewState:f=!0,keepCurrentModel:p=!1,width:g="100%",height:m="100%",className:v,wrapperProps:b={},beforeMount:x=aa,onMount:y=aa,onChange:w,onValidate:S=aa}){let[C,j]=h.useState(!1),[E,O]=h.useState(!0),P=h.useRef(null),T=h.useRef(null),_=h.useRef(null),L=h.useRef(y),N=h.useRef(x),V=h.useRef(),A=h.useRef(s),H=VL(o),U=h.useRef(!1),D=h.useRef(!1);ey(()=>{let R=J0.init();return R.then(z=>(P.current=z)&&O(!1)).catch(z=>(z==null?void 0:z.type)!=="cancelation"&&console.error("Monaco initialization: error:",z)),()=>T.current?I():R.cancel()}),On(()=>{var z,X,Z,Y;let R=ci(P.current,e||s||"",t||r||"",o||n||"");R!==((z=T.current)==null?void 0:z.getModel())&&(f&&Nl.set(H,(X=T.current)==null?void 0:X.saveViewState()),(Z=T.current)==null||Z.setModel(R),f&&((Y=T.current)==null||Y.restoreViewState(Nl.get(o))))},[o],C),On(()=>{var R;(R=T.current)==null||R.updateOptions(u)},[u],C),On(()=>{!T.current||s===void 0||(T.current.getOption(P.current.editor.EditorOption.readOnly)?T.current.setValue(s):s!==T.current.getValue()&&(D.current=!0,T.current.executeEdits("",[{range:T.current.getModel().getFullModelRange(),text:s,forceMoveMarkers:!0}]),T.current.pushUndoStop(),D.current=!1))},[s],C),On(()=>{var z,X;let R=(z=T.current)==null?void 0:z.getModel();R&&r&&((X=P.current)==null||X.editor.setModelLanguage(R,r))},[r],C),On(()=>{var R;a!==void 0&&((R=T.current)==null||R.revealLine(a))},[a],C),On(()=>{var R;(R=P.current)==null||R.editor.setTheme(i)},[i],C);let $=h.useCallback(()=>{var R;if(!(!_.current||!P.current)&&!U.current){N.current(P.current);let z=o||n,X=ci(P.current,s||e||"",t||r||"",z||"");T.current=(R=P.current)==null?void 0:R.editor.create(_.current,{model:X,automaticLayout:!0,...u},d),f&&T.current.restoreViewState(Nl.get(z)),P.current.editor.setTheme(i),a!==void 0&&T.current.revealLine(a),j(!0),U.current=!0}},[e,t,n,s,r,o,u,d,f,i,a]);h.useEffect(()=>{C&&L.current(T.current,P.current)},[C]),h.useEffect(()=>{!E&&!C&&$()},[E,C,$]),A.current=s,h.useEffect(()=>{var R,z;C&&w&&((R=V.current)==null||R.dispose(),V.current=(z=T.current)==null?void 0:z.onDidChangeModelContent(X=>{D.current||w(T.current.getValue(),X)}))},[C,w]),h.useEffect(()=>{if(C){let R=P.current.editor.onDidChangeMarkers(z=>{var Z;let X=(Z=T.current.getModel())==null?void 0:Z.uri;if(X&&z.find(Y=>Y.path===X.path)){let Y=P.current.editor.getModelMarkers({resource:X});S==null||S(Y)}});return()=>{R==null||R.dispose()}}return()=>{}},[C,S]);function I(){var R,z;(R=V.current)==null||R.dispose(),p?f&&Nl.set(o,T.current.saveViewState()):(z=T.current.getModel())==null||z.dispose(),T.current.dispose()}return h.createElement(Q0,{width:g,height:m,isEditorReady:C,loading:l,_ref:_,className:v,wrapperProps:b})}var DL=HL,FL=h.memo(DL),BL=FL;function Gr({className:e,as:t="label",bold:n,m:s="gjs-mb-1",size:r="m",capitalize:o=!0,children:i,tip:a,onClear:l,...u}){const d=t,f=!!l;return c.jsxs(d,{className:M(e,s,f&&B.tAo,o&&"gs-utl-capitalize",n&&"gs-utl-font-semibold",r==="s"&&"gs-utl-text-sm",a||f?"gs-utl-flex gs-utl-gap-2 gs-utl-items-center":"gs-utl-block"),...f&&{htmlFor:""},...u,children:[!!a&&c.jsx(zt,{classNameWrp:"gs-utl-normal-case gs-utl-whitespace-normal",classNameContent:"gs-utl-max-w-60",title:a,children:c.jsx(ne,{icon:G.information,size:oe.s2x})}),i,f&&c.jsx(St,{title:"Clear value",onClick:l,icon:{icon:G.close,size:oe.s2x},variant:"out-clear",border:!1,size:"",block:!0})]})}var ny=(e=>(e.primary="primary",e.secondary="secondary",e.outline="outline",e.shallow="shallow",e.danger="danger",e))(ny||{}),sy=(e=>(e.none="",e.x2s="x2s",e.xs="xs",e.s="s",e.m="m",e.lg="lg",e))(sy||{});const zL="gs-cmp-button",vu=h.memo(ce(function({classNameBtn:t,className:n,children:s,tooltip:r,variant:o,onClick:i,editorEvents:a,label:l,size:u,icon:d,active:f,buttonType:p,disabled:g,...m}){const{editor:v}=xe(),[b,x]=h.useState(()=>({disabled:g,variant:o,active:f,className:n,classNameBtn:t,tooltip:r,icon:d,size:u,label:l})),y=b.variant,w=y==="outline",S=y==="secondary",j=y==="primary"?"pr":y==="danger"?"danger":w||S?"out-clear":void 0,E=b.label,O=T=>{v&&(i==null||i({event:T,editor:v,state:b,setState:_=>x(L=>({...L,..._}))}))};h.useEffect(()=>{if(!a||!v)return;const T=Object.keys(a).reduce((L,N)=>(L[N]=(V={})=>{a[N]({fromEvent:V,editor:v,state:b,setState:A=>x(H=>({...H,...A}))})},L),{}),_=Object.keys(T);return _.forEach(L=>v.on(L,T[L])),()=>{_.forEach(L=>v.off(L,T[L]))}},[v,b]);const P=b.tooltip;return c.jsx(St,{className:M(zL,b.classNameBtn),classNameWrp:b.className,variant:j,icon:b.icon,active:b.active,size:b.size,disabled:b.disabled,onClick:O,border:w||S,type:p,withBg:S,block:!0,...dt(P)?{title:P}:{tooltipProps:P},...m,children:E?tt(E)?E({editor:v}):E:s})}));var ah=(e=>(e.m="m",e.s="s",e))(ah||{});const ry="gs-input-field",Lc=e=>Dt(e)?e:"",cl=(e={})=>M("gs-utl-w-full",B.bgTr,Fr.inputText,e.disabled&&B.txtLowEmphasis),lh=({size:e="m"}={})=>M("gs-input-container gs-utl-w-full",B.bg,te.b,te.rnd,B.br,e==="m"&&Ee.xy,e==="s"&&"gs-utl-px-3 gs-utl-py-1"),no=({className:e,style:t,row:n})=>({className:M(e,"gs-utl-w-full gs-utl-flex",n?`${ry}--row gs-utl-gap-2 gs-utl-items-center`:"gs-utl-flex-col gs-utl-gap-1"),style:t}),ys=e=>{const{as:t,size:n="m",label:s,description:r,hasClear:o,onChange:i,tip:a,row:l,afterLabel:u,afterLabelButtons:d}=e,f=!!s,p=!!r,g=o!=null&&o(e)?()=>i==null?void 0:i(""):void 0;if(!f&&!(d!=null&&d.length)&&!p)return null;const m=c.jsx(c.Fragment,{children:f&&c.jsx(Gr,{as:t,className:"gs-utl-w-full",size:n,tip:p?void 0:a,onClear:g,m:"",children:s})}),v=u||d!=null&&d.length?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[u,d==null?void 0:d.map((b,x)=>c.jsx(vu,{...b},b.id??x))]}):null;return c.jsxs(k,{className:M("gs-label-field-container",l&&"gs-utl-whitespace-nowrap"),col:!0,children:[v?c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[m,v]}):m,p&&c.jsx(Gr,{size:n,tip:a,as:"span",className:M(B.txtLowEmphasis),capitalize:!1,children:r})]})},ot=h.forwardRef(function(t,n){const{className:s,value:r,type:o,placeholder:i,required:a,disabled:l,readOnly:u,name:d,autoFocus:f,onInput:p,onChange:g,onBlur:m,onKeyDown:v,labelAs:b}=t,[x,y]=h.useState(Lc(r)),w=cl(t),S=h.useRef(null);h.useImperativeHandle(n,()=>S.current,[]),h.useEffect(()=>{y(Lc(r))},[r]),h.useEffect(()=>{const T=S.current;if(T&&f){const _=T.querySelector("input"),L=setTimeout(()=>_==null?void 0:_.focus(),vp);return()=>clearTimeout(L)}},[S.current,f]);const C=(T,_)=>{g==null||g(T,_)},j=T=>{const{key:_}=T;switch(v==null||v(T),_){case"Escape":return y(r);case"Enter":return C(x)}},E=()=>{C(x),m==null||m()},O=T=>{const _=T.target.value;y(_),p==null||p(_)},P=no({...t,className:M(ry,s)});return c.jsxs("div",{...P,ref:S,children:[c.jsx(ys,{...t,as:b}),c.jsxs(k,{className:lh(t),items:"center",gap:"x2s",children:[t.beforeInput,c.jsx(F,{grow:!0,children:c.jsx("input",{className:w,name:d,value:x,onChange:O,placeholder:i,required:a,onBlur:E,onKeyDown:j,readOnly:u,disabled:l,type:o,maxLength:t.maxLength})}),t.afterInput]})]})}),oy=e=>{var t;(t=e.getAction("editor.action.formatDocument"))==null||t.run()},UL="gs-field-code",WL={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 pr(e){const{defaultValue:t,value:n,language:s,onChange:r,clean:o,padding:i,isDarkTheme:a,className:l,containerClassName:u,minHeight:d="170px",onMount:f,readOnly:p,name:g,required:m,disabled:v,formatOnMount:b=!0,monacoOptions:x,labelAs:y}=e,w=n!==void 0,S=s,C=w?n:t,j=typeof C=="string"?C:JSON.stringify(C??"",null,2),E=no({...e,className:M(UL,"gs-utl-flex gs-utl-h-full",u,!e.row&&"gs-utl-flex gs-utl-flex-col")}),O=M("gs-utl-relative gs-utl-flex-grow");return c.jsxs("div",{...E,children:[c.jsx(ys,{...e,as:y}),c.jsxs("div",{className:O,style:{minHeight:d},children:[g&&c.jsx("input",{className:Oe.hiddenVisually,name:g,value:j,disabled:v,required:m,onChange:()=>{}}),c.jsx("div",{className:M("gs-utl-absolute gs-utl-inset-0",v&&Oe.disabled),children:c.jsx(BL,{...w?{language:S,value:j}:{defaultLanguage:S,defaultValue:j},theme:a?"vs-dark":"light",className:M(te.b,te.rnd,B.br,l),options:{...WL,readOnly:p,...o&&{domReadOnly:!0,overviewRulerLanes:0,selectOnLineNumbers:!1,folding:!1,matchBrackets:"never",guides:{indentation:!1}},...Dt(i)&&{lineDecorationsWidth:i*2,padding:{top:i,bottom:i}},...x},onChange:r,onMount:(P,T)=>{if(b){let _=!1;const L=()=>oy(P);P.onDidChangeModelLanguageConfiguration(L),P.onDidScrollChange(()=>{_||(_=!0,L())}),setTimeout(L,10)}f==null||f(P,T)}})})]})]})}const iy=ce(function({buttonProps:t,content:n,code:s,onAction:r}){const o=Li(),i=Ie(),a=xe(),{isProjectTypeEmail:l}=a,u=a.editor,{isDarkTheme:d}=qs(),[f,p]=h.useState(),g=()=>{let v=(f||"").trim();const b=G0({code:v,appStore:a,showToastError:!0});if(!b.error)v=b.output;else return;r?r(v):l?u.loadProjectData({pages:[{component:v}]}):u.setComponents(v),o.close()};h.useEffect(()=>{s?p(s):(async()=>{var S,C;const b=await u.runCommand(se.projectFiles,{page:u.Pages.getSelected(),skipProject:!0,styles:"inline"}),x=(S=b.find(j=>j.mimeType==="text/html"))==null?void 0:S.content,y=(C=b.find(j=>j.mimeType==="text/mjml"))==null?void 0:C.content,w=l?y:x;w&&p(w)})()},[]);const m=(t==null?void 0:t.children)||i.t("actions.importCode.button");return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(F,{children:n??i.t("actions.importCode.content")}),c.jsx(F,{className:K("h-96"),children:f!==void 0&&c.jsx(pr,{defaultValue:f,onChange:v=>p(v||""),isDarkTheme:d,language:"html"})}),c.jsx(k,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:g,...t,children:m})})]})}),Lf="data-type-empty",jm=(e,t)=>{e.Canvas.getFrames().forEach(n=>{const{view:s}=n,r=Array.from(s.getDoc().querySelectorAll(`style[${Lf}]`));for(const o of r)o.disabled=!t})},GL=(e,t,n="Empty",s={})=>{const r=`[${Lf}="${t}"]`;if(!e.frameView.getDoc())return;const o=e.frameView.getHead(),{midSelector:i="",styleOut:a="",styleIn:l=""}=s;if(!o.querySelector(`style${r}`)){const u=document.createElement("style");u.setAttribute(Lf,t),u.innerHTML=`
|
|
210
145
|
[data-gjs-type="${t}"]${i}:empty {
|
|
211
146
|
text-decoration: none;
|
|
212
147
|
padding: 5px;
|
|
@@ -234,18 +169,18 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
234
169
|
${s.limitH?"height: auto;":""}
|
|
235
170
|
${s.smallH?"min-height: 30px;":""}
|
|
236
171
|
${l}
|
|
237
|
-
}`,o.appendChild(u)}},
|
|
172
|
+
}`,o.appendChild(u)}},ay=(e,t)=>{const{model:n}=t,s=n.constructor.getDefaults(),r=s.emptyState,o=n.get("type");if(!r||s.void===!0||o!==e)return;const i=r===!0?{}:r;GL(t,o,n.getName({noCustom:!0}),i)},qL=function(t){const{Components:n}=t,s=r=>{const{id:o}=r;n.addType(o,{extendFnView:["onRender"],view:{onRender(){ay(o,this)}}})};n.getTypes().forEach(s),t.on("component:type:add",s)};function KL(e,t){const{Components:n}=e,s=n.events,{modalStore:r,i18nStore:o,fontsStore:i}=t.appStore.store,{root:a,head:l,body:u}=Ta,{attributes:d,class:f,font:p,all:g,preview:m,title:v,style:b,breakpoint:x}=ih,{wrapper:y,section:w,column:S,text:C,button:j,image:E,divider:O,group:P,social:T,socialElement:_,spacer:L,navbar:N,navbarLink:V,table:A,raw:H}=Or,{model:U}=n.getType("default"),{model:D}=n.getType(a),{model:$}=n.getType(u),{model:I}=n.getType(p),{model:R,view:z}=n.getType(l),{model:X,view:Z}=n.getType(N),{model:Y,view:J}=n.getType(V),{model:ee,view:W}=n.getType(y),{model:Q,view:ae}=n.getType(w),{model:ge,view:Ce}=n.getType(S),{model:Se,view:et}=n.getType(C),{model:Ye,view:Ct}=n.getType(j),{model:ct}=n.getType(E),{model:we,view:nt}=n.getType(O),{model:st,view:vt}=n.getType(L),{view:Me,model:ft}=n.getType(T),{view:ut,model:Fe}=n.getType(_),{view:Zt,model:he}=n.getType(P),Ve=Uo.globalStyles,De="css-class",$e={id:"link",name:"href",label:"Link",placeholder:"Link to redirect on click"},Ot={name:"src",type:"image",typeProps:{inputField:!0},label:"Image"},Ft={type:"checkbox",label:"Full width",name:"full-width",valueTrue:"full-width",valueFalse:""},Xs={type:"select",label:"Direction",name:"direction",default:"ltr",options:[{id:"ltr",name:"Left To Right"},{id:"rtl",name:"Right To Left"}]},uo={label:"Content",getValue:({component:q})=>q.getInnerHTML(),setValue:({component:q,value:de})=>q.components(de)},Xe=q=>{r.open({title:q.getName({noCustom:!0}),content:()=>c.jsx(iy,{content:"",code:q.getInnerHTML(),onAction:de=>q.components(de),buttonProps:{children:o.t("save")}})})},bt=q=>{var ue;const de=q.getChildrenContainer();((ue=de==null?void 0:de.innerHTML)==null?void 0:ue.trim())===""&&(de.innerHTML="")},Yt=q=>q.set({void:!1},{silent:!0});function En(q={}){return U.prototype.toHTML.call(this,q)}function Gt(q){const de=q.closestType(a),ue=de==null?void 0:de.findType(l)[0];return(ue==null?void 0:ue.toHTML())||""}function fo(q){const de=q.toHTML(),ue=e.runCommand(gu,{mjml:de}),kt=new DOMParser().parseFromString(ue.html,"text/html");return{mjml:de,mjmlToHtml:ue,document:kt}}const gn=function(q){const de=q.model,ue=$r(()=>{var _e;return(_e=de.closestType(a))==null?void 0:_e.trigger("rerender")});q.listenTo(de.components(),"add remove reset change",ue)},br=(q,de)=>q.replace(`<${a}>`,`<${a}>${Gt(de)}`),yr=q=>`cls-${q.tagName}-${q.getId()}`,xr=(q,de)=>{const ue={...q.get("attributes")||{}};return delete ue.style,{...ue,[De]:`${ue[De]||""} ${yr(q)}`.trim()}},wr=(q,de)=>{const ue=q.closestType(a),_e=(ue==null?void 0:ue.findFirstType(l))||(ue==null?void 0:ue.append({type:l})[0]);_e==null||_e.trigger(de?"rerenderHeadImmediate":"rerenderHead")},Sr=q=>function(){return xr(this)},sn=(q,de)=>function(ue){const _e=ue.querySelector(`.${yr(this.model)}`);return(de?_e:_e==null?void 0:_e.outerHTML)||q.prototype.getTemplateFromEl.call(this,ue)},rs=q=>function(...de){const ue=q.prototype.toJSON.apply(this,de),_e=ue.attributes||{};return delete ue.style,delete _e.style,delete _e.__p,ue},xl=q=>function(...de){const ue=q.prototype.getAttrToHTML.apply(this,de);delete ue.__p;for(const _e in ue)ue[_e]===""&&delete ue[_e];return ue};function qo(){return{start:`<mjml>${Gt(this.model)}<mj-body><mj-column>`,end:"</mj-column></mj-body></mjml>"}}function Hu(){var ue;const q=(ue=this.model.parent())==null?void 0:ue.is(d),de=Gh(this.model,{withSiblings:!q,withHead:!q,beforeRootEnd:q?`<${u}><${w}><${S}/></${w}></${u}>`:""});return{start:de.start,end:de.end}}function Ow(){this.stopListening(this.model,"change:style"),this.listenTo(this.model,"change:attributes change:src",this.rerender)}const Gh=(q,de={})=>{var Dn;const ue=q.parents().filter(Tn=>Tn.tagName.startsWith("mj-")),_e=ue.map(Tn=>`<${Tn.tagName}>`).reverse().join(""),kt=ue.map(Tn=>`</${Tn.tagName}>`).join(""),Mt=de.withHead?Gt(q):"",Hn=de.withSiblings?(Dn=q.parent())==null?void 0:Dn.components().filter(Tn=>Tn!==q).map(({tagName:Tn})=>`<${Tn}></${Tn}>`).join(""):"";return{start:`<${a}>${Mt}${_e}`,end:`${Hn||""}${kt}${de.beforeRootEnd||""}</${a}>`}},Xt=({model:q,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&&Yt(this)},handleStyleChange(ue,_e,kt){if(kt.fromAttr||kt.fromSync)return;const Mt=this.getStylesToAttributes();this.set("attributes",Mt,{...kt,fromStyle:!0,fromSync:!0})},handleAttributeChange(ue,_e,kt){if(kt.fromStyle||kt.fromSync)return;const Mt=this.getAttributes({skipResolve:!0,noStyle:!0,noClass:!0});this.setStyle(Mt,{...kt,fromAttr:!0,fromSync:!0})},getStylesToAttributes(){const ue=this.getStyle({skipResolve:!0})||{};return delete ue.__p,ue},toHTML:En,getAttrToHTML:xl(q),getMjmlAttributes:Sr(),toJSON:rs(q)});n.addType("wrapper",{extendFn:["init"],model:{defaults:{droppable:!1,stylable:!1,delegate:{layer:q=>q.findType(a)[0]}},init(){this.on(`${s.update}:components`,this.__updateLayersRoot)},__updateLayersRoot(){this.findFirstType(a)&&e.Layers.setRoot(this)}}}),n.addType(a,{model:{...Xt({model:D}),defaults:{tagName:a,name:"Root",toolbar:[]},toHTML:En},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:rs(R)},view:{init(){this.renderHeadDebounced=$r(this.renderHead,30);const{em:q,el:de,model:ue}=this,_e=ue.components(),kt="core:preview",Mt=q.Commands.events;this.listenTo(q,`${Mt.runCommand}${kt}`,()=>{de.style.display="none"}),this.listenTo(q,`${Mt.stopCommand}${kt}`,()=>{de.style.display=""}),this.listenTo(_e,"change",this.onComponentsChange),this.listenTo(_e,"add remove reset",this.renderHead),this.listenTo(ue,"rerenderHead",this.renderHeadDebounced),this.listenTo(ue,"rerenderHeadImmediate",this.renderHead)},onComponentsChange(q){const de=Object.keys(q.changedAttributes());de.length===1&&de[0]==="status"||this.renderHead()},renderHead(){var Dn;const{model:q,el:de}=this,ue=de.ownerDocument;if(!(ue&&ue!==document))return;const kt=q.closestType(a),Mt=kt&&fo(kt),Hn=(Dn=Mt==null?void 0:Mt.document)==null?void 0:Dn.head;if(Hn){const Tn="mjml-head-result",Du=ue.querySelector(Tn)||ue.createElement(Tn);Du.innerHTML=Hn.innerHTML,!ue.head.contains(Du)&&ue.head.prepend(Du)}},render(...q){const de=z.prototype.render.apply(this,q);return this.renderHeadDebounced(),de}}}),n.addType(d,{isComponent:Jo(d),model:{defaults:{tagName:d,name:"Attributes",copyable:!1,layerable:!1,stylable:!1,draggable:_s(l),traits:[]},toJSON:rs(U)},view:{onRender(){this.el.style.display="none"},init(){gn(this)}}}),n.addType(f,{isComponent:Jo(f),model:{defaults:{tagName:f,name:"Class",stylable:!1,draggable:_s(d),traits:[]},toJSON:rs(U)}}),n.addType(p,{model:{...Xt({model:I}),defaults:{tagName:p,name:"Font",stylable:!1,draggable:_s(l),icon:'<svg viewBox="0 0 24 24"><path d="M17 8h3v12h1v1h-4v-1h1v-3h-4l-1.5 3H14v1h-4v-1h1l6-12m1 1-3.5 7H18V9M5 3h5a2 2 0 0 1 2 2v11H9v-5H6v5H3V5a2 2 0 0 1 2-2m1 2v4h3V5H6Z"/></svg>',traits:[{name:"name",placeholder:"Name of the font"},{name:"href",placeholder:"URL of a hosted CSS file"}]}},view:{tagName:()=>"div",render(){return this.el.style.cssText="",this}}}),n.addType(x,{extend:a,isComponent:Jo(x),model:{defaults:{tagName:x,name:"Breakpoint",stylable:["width"],removable:!0,droppable:!1,draggable:_s(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:Jo(g),model:{defaults:{tagName:g,name:"All",stylable:!1,void:!0,draggable:_s(d),traits:[]},toHTML(...q){return D.prototype.toHTML.apply(this,q)},toJSON:rs(U)}}),n.addType(m,{isComponent:Jo(m),model:{defaults:{tagName:m,name:"Preview",copyable:!1,droppable:!1,stylable:!1,draggable:_s(l),traits:[uo],icon:`<svg viewBox="0 0 24 24">
|
|
238
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" />
|
|
239
|
-
</svg>`},toJSON:
|
|
174
|
+
</svg>`},toJSON:rs(U)},view:{tagName:()=>"div",init(){const q=this.model.components();this.onRender=$r(this.onRender,1),this.listenTo(q,"add remove reset change",this.onRender)},onRender(){const{model:q,el:de}=this,ue=q.getName({noCustom:!0}),_e=q.getInnerHTML();de.innerHTML=`<b>${ue}</b>: ${_e}`,de.style.padding="5px 10px",de.style.fontFamily="system-ui"}}}),n.addType(v,{isComponent:Jo(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:rs(U)},view:{render(){return this}}}),n.addType(u,{model:{...Xt({model:$,noVoid:!0}),defaults:{tagName:u,icon:'<svg viewBox="0 0 24 24"><path d="M6,2H18A2,2 0 0,1 20,4V20A2,2 0 0,1 18,22H6A2,2 0 0,1 4,20V4A2,2 0 0,1 6,2M6,8V16H18V8H6Z" /></svg>',traits:[],emptyState:{midSelector:">div",styleOut:"height: 100vh;"}}}}),n.addType(y,{model:{...Xt({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:[Ft]}},view:{attributes:{},getMjmlTemplate:Hu,getTemplateFromEl:sn(W),init:Ow}}),n.addType(w,{model:{...Xt({model:Q,noVoid:!0}),defaults:{tagName:w,"style-default":{padding:"20px 0px",direction:"ltr","text-align":"center"},icon:'<svg viewBox="0 0 24 24"><path d="M4 4.8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3A1.8 1.8 0 0 0 20 4.7zm0 8a1.8 1.8 0 0 0-1.8 1.7v3c0 1 .8 1.8 1.8 1.8h16a1.8 1.8 0 0 0 1.8-1.8v-3a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[Xs,Ft],emptyState:{midSelector:">div>table>tbody>tr>td"}}},extendFnView:["render"],view:{getTemplateFromEl:sn(ae),getMjmlTemplate:Hu,getChildrenSelector(){return this.model.getAttributes()["full-width"]==="full-width"?"table > tbody > tr > td > div table > tbody > tr > td":"table > tbody > tr > td"},render(){return bt(this),this},attributes:{}}}),n.addType(P,{model:{...Xt({model:he,noVoid:!0}),defaults:{tagName:P,"style-default":{direction:"ltr"},icon:'<svg viewBox="0 0 24 24"><path d="M16,5V18H21V5M4,18H9V5H4M10,18H15V5H10V18Z" /></svg>',traits:[Xs]}},extendFnView:["init"],view:{init(){this.listenTo(this.model.components(),"add remove reset",this.render)},getTemplateFromEl:sn(Zt,!0),getChildrenContainer(){return this.el},getMjmlTemplate:Hu,render(){const q=this.getTemplateFromMjml(),de=Hw(q);return this.renderAttributes(),this.$el.attr(de),this.el.innerHTML=q.innerHTML,this.renderChildren(),this.childNodes=this.getChildrenContainer().childNodes,this.updateStatus(),this.postRender(),this}}});const _w=[C,E,j,O,L,T,_,H,A,P,N,V,Or.carousel,Or.carouselImage,Or.accordion,Or.accordionElement,Or.accordionTitle,Or.accordionText];n.addType(S,{model:{...Xt({model:ge,noVoid:!0}),defaults:{tagName:S,icon:'<svg viewBox="0 0 24 24"><path d="M14.5 2.3A1.8 1.8 0 0 0 12.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8zm-8 0A1.8 1.8 0 0 0 4.7 4v16c0 1 .8 1.8 1.8 1.8h3a1.8 1.8 0 0 0 1.8-1.8V4a1.8 1.8 0 0 0-1.8-1.8z"/></svg>',traits:[],stylable:[...ge.getDefaults().stylable,"inner-background-color"],droppable:q=>_w.includes(q.getType()),emptyState:{midSelector:">table>tbody",styleIn:"margin: 0 10px;"}}},view:{getMjmlTemplate(){var ue;const q=(ue=this.model.parent())==null?void 0:ue.is(d),de=Gh(this.model,{withSiblings:!q,withHead:!q,beforeRootEnd:q?`<${u}><${w}><${S}/></${w}></${u}>`:""});return{start:de.start,end:de.end}},getTemplateFromEl:sn(Ce,!0),getChildrenContainer(){const{el:q}=this;return q.querySelector("td > table tbody")||q.querySelector("table tbody")||q},render(){this.renderAttributes();const q=this.getTemplateFromMjml();return this.el.innerHTML=q.content,this.$el.attr(q.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.updateStatus(),this.postRender(),wr(this.model,!0),this}}}),n.addType(C,{model:{...Xt({model:Se}),defaults:{tagName:C,emptyState:{midSelector:' [contenteditable="false"]:not([data-type-data-variable])',styleIn:"min-height: 20px;",styleOut:"padding: 0 5px;"},traits:[],"style-default":{padding:"10px 25px"}}},view:{getMjmlTemplate:qo,getTemplateFromEl:sn(et),attributes:{style:"display: table; width: 100%"}}}),n.addType(j,{model:{...Xt({model:Ye,noVoid:!0}),defaults:{tagName:j,traits:[$e],stylable:[...Ye.getDefaults().stylable,"inner-padding"],"style-default":{}}},view:{getMjmlTemplate:qo,getTemplateFromEl:sn(Ct)}}),n.addType(E,{model:{...Xt({model:ct}),defaults:{tagName:E,"style-default":{align:"center"},traits:[Ot,{id:"altText",name:"alt",placeholder:"Image description"},"title",$e,{type:"checkbox",label:"Full width on mobile",name:"fluid-on-mobile",valueTrue:"true"}]},getAttrToHTML(){const q=ct.prototype.getAttrToHTML.call(this);return this.isDefaultSrc()&&delete q.src,q},getMjmlAttributes(){const q=xr(this);return this.isDefaultSrc()&&delete q.src,q}},view:{updateSrc(){const{model:q}=this,de=q.get("src",{skipResolve:!0})||q.getSrcResult();q.addAttributes({src:de}),this.updateClasses()},getMjmlTemplate(){return{start:`<mjml>${Gt(this.model)}<mj-body><mj-section><mj-column>`,end:"</mj-column></mj-section></mj-body></mjml>"}},getTemplateFromEl(q){var de,ue,_e;return(_e=(ue=(de=q.querySelector("img"))==null?void 0:de.closest("table"))==null?void 0:ue.closest("tr"))==null?void 0:_e.innerHTML},attributes:{style:"display: table; width: 100%; user-select: none;"}}}),n.addType(O,{model:{...Xt({model:we}),defaults:{tagName:O,"style-default":{width:"100%",align:"center"},traits:[{name:"align",type:"radio",options:[{id:"left",title:"Left",labelReact:c.jsx(ne,{icon:G.alignHorizontalLeft,size:oe.sx})},{id:"center",title:"Center",labelReact:c.jsx(ne,{icon:G.alignHorizontalCenter,size:oe.sx})},{id:"right",title:"Right",labelReact:c.jsx(ne,{icon:G.alignHorizontalRight,size:oe.sx})}]}]}},view:{getMjmlTemplate:qo,getTemplateFromEl:sn(nt)}}),n.addType(T,{model:{...Xt({model:ft}),defaults:{tagName:T,name:"Social",traits:[],emptyState:{midSelector:">td"},"style-default":{align:"center"},stylable:[...ft.getDefaults().stylable,"inner-padding"]}},view:{getMjmlTemplate:qo,getTemplateFromEl:sn(Me)}}),n.addType(_,{model:{...Xt({model:Fe,noVoid:!0}),defaults:{tagName:_,"style-default":{align:"center"},traits:[{type:"select",label:"Icon",name:"name",options:[{id:"custom",name:"Custom"},{id:"facebook",name:"Facebook"},{id:"twitter",name:"Twitter/X"},{id:"google",name:"Google"},{id:"instagram",name:"Instagram"},{id:"web",name:"Web"},{id:"youtube",name:"YouTube"},{id:"pinterest",name:"Pinterest"},{id:"linkedin",name:"Linkedin"},{id:"snapchat",name:"Snapchat"},{id:"vimeo",name:"Vimeo"},{id:"tumblr",name:"Tumblr"},{id:"github",name:"Github"},{id:"soundcloud",name:"SoundCloud"},{id:"medium",name:"Medium"},{id:"dribbble",name:"Dribbble"},{id:"xing",name:"Xing"}]},Ot,$e,uo]},getMjmlAttributes(){const q=xr(this);return{...this.getDefaultIconProps()[q.name],...q}},getAttrToHTML(){const q=Fe.prototype.getAttrToHTML.call(this);return{...this.getDefaultIconProps()[q.name],...q}},getDefaultIconProps(){return{twitter:{src:"https://upload.wikimedia.org/wikipedia/commons/5/57/X_logo_2023_%28white%29.png","background-color":"black"}}}},extendFnView:["init"],view:{init(){this.listenTo(this.model,"component:update:components",this.rerender)},getMjmlTemplate(){const{start:q,end:de}=ut.prototype.getMjmlTemplate.call(this);return{start:br(q,this.model),end:de}},getInnerMjmlTemplate(){var _e;const{start:q,end:de}=ut.prototype.getInnerMjmlTemplate.call(this),ue=((_e=this.model.getInnerHTML())==null?void 0:_e.trim())||"";return{start:`${q}${ue}`,end:de}},getChildrenContainer(){var _e;const{el:q}=this,de=(_e=q.querySelector("tbody > tr > td"))==null?void 0:_e.nextElementSibling;return(de==null?void 0:de.firstElementChild)||q.querySelector("img")||q}}}),n.addType(L,{model:{...Xt({model:st}),defaults:{tagName:L,traits:[]}},view:{getMjmlTemplate:qo,getTemplateFromEl:sn(vt)}}),n.addType(N,{model:{...Xt({model:X}),defaults:{tagName:N,emptyState:{midSelector:">td>div"}}},view:{getMjmlTemplate:qo,getTemplateFromEl:sn(Z,!0),render(){this.renderAttributes();const q=this.getTemplateFromMjml();return this.el.innerHTML=q.content,this.$el.attr(q.attributes),this.getChildrenContainer().innerHTML=this.model.get("content"),this.renderChildren(),this.renderStyle(),this.postRender(),wr(this.model),this}}}),n.addType(V,{model:{...Xt({model:Y}),defaults:{tagName:V,icon:'<svg viewBox="0 0 24 24"><path fill="currentColor" d="M21,15.61L19.59,17L14.58,12L19.59,7L21,8.39L17.44,12L21,15.61M3,6H16V8H3V6M3,13V11H13V13H3M3,18V16H16V18H3Z" /></svg>',emptyState:{midSelector:">td>div"},"style-default":{}}},view:{getMjmlTemplate(){const{start:q,end:de}=J.prototype.getMjmlTemplate.call(this);return{start:br(q,this.model),end:de}},getTemplateFromEl(q){return q.querySelector(".mj-inline-links").innerHTML}}}),n.addType(H,{extendFn:["initToolbar"],model:{defaults:{tagName:H,name:"HTML block",emptyState:{midSelector:">div"}},initToolbar(){FA(this,{id:"edit",command:()=>Xe(this),label:`<svg viewBox="0 0 24 24">
|
|
240
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>
|
|
241
|
-
</svg>`})},toJSON:
|
|
242
|
-
`))},
|
|
176
|
+
</svg>`})},toJSON:rs(U)},view:{events:{dblclick:"onActive"},onActive(){Xe(this.model)},attributes:{}}}),n.addType("skip-global-style",{isComponent:q=>{var de,ue;if(((de=q.tagName)==null?void 0:de.toLowerCase())===b&&((ue=q.getAttribute)==null?void 0:ue.call(q,"css-class"))===Ve)return{type:"textnode",components:[],content:""}}});const Aw=q=>{const{id:de,view:ue}=q,_e=ue.prototype;n.addType(de,{view:{render(){return _e.render.apply(this,arguments),ay(de,this),this}}})};[u,w,S,C,N,T,H].forEach(q=>Aw(n.getType(q))),n.getTypes().forEach(({id:q,view:de})=>{de.prototype.disableEditing&&n.addType(q,{view:{onDisable(ue={}){this.disableEditing({...ue,parserOptions:{htmlType:"text/html"}})}}})});const qh=()=>{const q="projectFonts",ue=e.Components.getWrapper().findFirstType(a);if(!ue)return;const _e=ue.findFirstType(l)||ue.append({type:l})[0];_e.findType(b).filter(Dn=>Dn.getAttributes()[De]===q||Dn.attributes[S0]===C0).forEach(Dn=>Dn.remove());const Mt=w0(i.fonts);if(!Mt)return;const Hn=_e.append({type:b,content:Mt})[0];Hn==null||Hn.addAttributes({[De]:q})},Kh=()=>{const q=e.Css.rules.filter(Mt=>{const Hn=Mt.attributes.groups;return!!(Hn!=null&&Hn.some(Dn=>Dn.startsWith(`${Ve}:`)))}).map(Mt=>Mt.toCSS());if(!q.length)return;const ue=e.Components.getWrapper().findFirstType(Ta.root),_e=ue.findFirstType(l)||ue.append({type:l})[0];(_e.findType(b).find(Mt=>Mt.getAttributes()[De]===Ve)||_e.append({type:b,attributes:{[De]:Ve}})[0]).set("content",q.join(`
|
|
177
|
+
`))},Lw=$r(Kh,100);e.on(Rn.pageSettingsUpdate,q=>{q.page||qh()}),e.on(e.events.projectLoad,({loaded:q})=>{q&&(Kh(),qh())}),e.on(e.Parser.events.htmlBefore,q=>{var ue;const de=(ue=e.Parser.config.optionsHtml)==null?void 0:ue.codeSanitizer;q.input=B0(q.input,{sanitizer:de})}),e.onReady(()=>{e.on(`${e.DataSources.events.pathSource}:${Ve}`,Lw)})}function ZL(e){const{Blocks:t}=e,n="Content",s="Layout",r={className:"h-7",full:!0,space:"s",nowrap:!0},o={category:s,full:!0},i="gjs-border-2 gjs-border-current gjs-rounded-sm",a=(l,u)=>{t.add(l,{select:!0,category:n,...u})};a("mj-text",{label:"Text",media:`<svg viewBox="0 0 24 24">
|
|
243
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" />
|
|
244
179
|
</svg>`,content:"<mj-text>Insert text here</mj-text>",activate:!0}),a("mj-button",{label:"Button",media:`<svg viewBox="0 0 24 24">
|
|
245
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" />
|
|
246
181
|
</svg>`,content:"<mj-button>Button</mj-button>"}),a("mj-image",{label:"Image",media:`<svg viewBox="0 0 24 24">
|
|
247
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" />
|
|
248
|
-
</svg>`,content:`<mj-image src="${
|
|
183
|
+
</svg>`,content:`<mj-image src="${Yw}"/>`,activate:!0}),a("mj-divider",{label:"Divider",media:`<svg viewBox="0 0 24 24">
|
|
249
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" />
|
|
250
185
|
</svg>`,content:"<mj-divider/>"}),a("mj-social",{label:"Social",media:`<svg viewBox="0 0 24 24">
|
|
251
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" />
|
|
@@ -266,7 +201,7 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
266
201
|
<mj-navbar-link>BLOG</mj-navbar-link>
|
|
267
202
|
</mj-navbar>`}),a("mj-hero",{label:"Hero",media:`<svg viewBox="0 0 24 24">
|
|
268
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" />
|
|
269
|
-
</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="${wv({width:600,height:300,text:"Hero Image",fg:"555"})}" background-color="#2a3448" padding="100px 0px">
|
|
270
205
|
<mj-text padding="20px" color="#ffffff" font-family="Helvetica" align="center" font-size="45px" line-height="45px" font-weight="900">
|
|
271
206
|
Heading title
|
|
272
207
|
</mj-text>
|
|
@@ -280,49 +215,49 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
|
|
|
280
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" />
|
|
281
216
|
</svg>`,content:`<mj-raw>
|
|
282
217
|
<span>Insert here you custom HTML</span>
|
|
283
|
-
</mj-raw>`}),a("mj-1-column",{...o,label:"1 Column",mediaReact:c.jsx(k,{...r,children:c.jsx(
|
|
218
|
+
</mj-raw>`}),a("mj-1-column",{...o,label:"1 Column",mediaReact:c.jsx(k,{...r,children:c.jsx(F,{className:i,grow:!0})}),content:`<mj-section>
|
|
284
219
|
<mj-column></mj-column>
|
|
285
|
-
</mj-section>`}),a("mj-2-columns-50-50",{...o,label:"2 Columns 50/50",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
220
|
+
</mj-section>`}),a("mj-2-columns-50-50",{...o,label:"2 Columns 50/50",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0})]}),content:`<mj-section>
|
|
286
221
|
<mj-column></mj-column>
|
|
287
222
|
<mj-column></mj-column>
|
|
288
|
-
</mj-section>`}),a("mj-2-columns-25-75",{...o,label:"2 Columns 25/75",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
223
|
+
</mj-section>`}),a("mj-2-columns-25-75",{...o,label:"2 Columns 25/75",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-3/4")})]}),content:`<mj-section>
|
|
289
224
|
<mj-column width="25%"></mj-column>
|
|
290
225
|
<mj-column width="75%"></mj-column>
|
|
291
|
-
</mj-section>`}),a("mj-2-columns-33-67",{...o,label:"2 Columns 33/67",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
226
|
+
</mj-section>`}),a("mj-2-columns-33-67",{...o,label:"2 Columns 33/67",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/3")}),c.jsx(F,{className:ie(i,"gs-utl-basis-2/3")})]}),content:`<mj-section>
|
|
292
227
|
<mj-column width="33%"></mj-column>
|
|
293
228
|
<mj-column width="67%"></mj-column>
|
|
294
|
-
</mj-section>`}),a("mj-2-columns-67-33",{...o,label:"2 Columns 67/33",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
229
|
+
</mj-section>`}),a("mj-2-columns-67-33",{...o,label:"2 Columns 67/33",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-2/3")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/3")})]}),content:`<mj-section>
|
|
295
230
|
<mj-column width="67%"></mj-column>
|
|
296
231
|
<mj-column width="33%"></mj-column>
|
|
297
|
-
</mj-section>`}),a("mj-2-columns-75-25",{...o,label:"2 Columns 75/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
232
|
+
</mj-section>`}),a("mj-2-columns-75-25",{...o,label:"2 Columns 75/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-3/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
298
233
|
<mj-column width="75%"></mj-column>
|
|
299
234
|
<mj-column width="25%"></mj-column>
|
|
300
|
-
</mj-section>`}),a("mj-3-columns",{...o,label:"3 Columns",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
235
|
+
</mj-section>`}),a("mj-3-columns",{...o,label:"3 Columns",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0})]}),content:`<mj-section>
|
|
301
236
|
<mj-column></mj-column>
|
|
302
237
|
<mj-column></mj-column>
|
|
303
238
|
<mj-column></mj-column>
|
|
304
|
-
</mj-section>`}),a("mj-3-columns-25-25-50",{...o,label:"3 Columns 25/25/50",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
239
|
+
</mj-section>`}),a("mj-3-columns-25-25-50",{...o,label:"3 Columns 25/25/50",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-2/4")})]}),content:`<mj-section>
|
|
305
240
|
<mj-column width="25%"></mj-column>
|
|
306
241
|
<mj-column width="25%"></mj-column>
|
|
307
242
|
<mj-column width="50%"></mj-column>
|
|
308
|
-
</mj-section>`}),a("mj-3-columns-25-50-25",{...o,label:"3 Columns 25/50/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
243
|
+
</mj-section>`}),a("mj-3-columns-25-50-25",{...o,label:"3 Columns 25/50/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-2/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
309
244
|
<mj-column width="25%"></mj-column>
|
|
310
245
|
<mj-column width="50%"></mj-column>
|
|
311
246
|
<mj-column width="25%"></mj-column>
|
|
312
|
-
</mj-section>`}),a("mj-3-columns-50-25-25",{...o,label:"3 Columns 50/25/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
247
|
+
</mj-section>`}),a("mj-3-columns-50-25-25",{...o,label:"3 Columns 50/25/25",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:ie(i,"gs-utl-basis-2/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")}),c.jsx(F,{className:ie(i,"gs-utl-basis-1/4")})]}),content:`<mj-section>
|
|
313
248
|
<mj-column width="50%"></mj-column>
|
|
314
249
|
<mj-column width="25%"></mj-column>
|
|
315
250
|
<mj-column width="25%"></mj-column>
|
|
316
|
-
</mj-section>`}),a("mj-4-columns",{...o,label:"4 Columns",mediaReact:c.jsxs(k,{...r,children:[c.jsx(
|
|
251
|
+
</mj-section>`}),a("mj-4-columns",{...o,label:"4 Columns",mediaReact:c.jsxs(k,{...r,children:[c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0}),c.jsx(F,{className:i,grow:!0})]}),content:`<mj-section>
|
|
317
252
|
<mj-column></mj-column>
|
|
318
253
|
<mj-column></mj-column>
|
|
319
254
|
<mj-column></mj-column>
|
|
320
255
|
<mj-column></mj-column>
|
|
321
|
-
</mj-section>`})}const w4=(e,t)=>({[yt.web]:s=>rd(s,t),[yt.document]:s=>rd(s,t),[yt.react]:s=>rd(s,t),[yt.email]:s=>y4(s,t)})[e],Ei="https://cdn.jsdelivr.net/npm/",ld={id:"gjs-blocks-basic",src:`${Ei}grapesjs-blocks-basic@1.0.1/dist/index.js`},S4={id:"grapesjs-plugin-forms",src:`${Ei}grapesjs-plugin-forms@2.0.5/dist/index.js`},cd={id:"grapesjs-parser-postcss",src:`${Ei}grapesjs-parser-postcss@1.0.1/dist/index.js`},C4={id:"grapesjs-navbar",src:`${Ei}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},ud={id:"grapesjs-plugin-export",src:`${Ei}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)}}},j4={id:"grapesjs-mjml",src:`${Ei}grapesjs-mjml@1.0.7/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},E4={[yt.email]:[x4,j4],[yt.web]:[ld,S4,ud,cd,C4],[yt.document]:[ld,ud,cd],[yt.react]:[ld,ud,cd]};function P4(e,t){const{blocks:n}=t.appStore.sdkOptions;Array.isArray(n==null?void 0:n.default)&&e.BlockManager.blocks.add(n.default),e.on("rteToolbarPosUpdate",s=>{const r=-s.canvasOffset.left;s.left<r&&(s.left=r)})}function Z0({onCopy:e,getValue:t,value:n,title:s="Copy",...r}){const[o,i]=h.useState(!1),a=()=>{dw((t==null?void 0:t())??n),i(!0),e==null||e()};return h.useEffect(()=>{if(!o)return;const l=setTimeout(()=>i(!1),3e3);return()=>clearTimeout(l)},[o]),c.jsx(bt,{onClick:a,title:s,type:"button",size:"lg",withBg:!0,...r,children:c.jsx(oe,{className:ue(o&&z.tA),icon:o?Z.check:Z.contentCopy,size:le.s})})}const _4=(e,t)=>e.filter(n=>n.id===t)[0]||null,X0=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),T4=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,J0=ee("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),qp={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]};function pm(e){var o;const{option:t,active:n,selected:s}=e,r=((o=e.isSelected)==null?void 0:o.call(e))||!0;return c.jsxs(k,{items:"center",className:ee([je.xy,n&&np.bgH]),children:[c.jsx(D,{className:ee("truncate"),grow:!0,children:t.label}),c.jsx(D,{className:ee("gjs-pl-2"),children:X0(t,s)&&r&&c.jsx(oe,{className:ee(z.tA),icon:Z.check,size:le.s})})]})}const O4="gs-select-field";function hm({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(oe,{...ot(e.icon)?{icon:e.icon,size:le.s2x}:e.icon}),c.jsx(D,{className:ee("truncate"),grow:!0,children:e.content||e.label})]})}function _e(e){const{value:t,onChange:n,onBlur:s,onFocus:r,handlerSelected:o,label:i,options:a,includeEmpty:l,className:u,search:d,open:f,caret:p=Z.chevronDown,size:g="m",border:m,emptyState:b="- Select an option -",name:v,required:x,disabled:y,classNameContainer:w,autoFocus:S,labelAs:C,hideCaret:j}=e,[E,_]=h.useState(null),[T,P]=h.useState(null),[A,M]=h.useState(""),{styles:R,attributes:F}=Wa(E,T,qp),L=typeof d=="object"?d.onChange:void 0,B=[...a].filter(Y=>d?L||T4(Y,A):Y),q=d&&(typeof d=="object"&&d.value||A),H=q&&B.length?B[0]:_4(B,t),$=Y=>n(Y.id,Y),I={id:null,label:b},O=(H==null?void 0:H.content)||(H==null?void 0:H.label),V=H?o?o(H):H.icon?c.jsx(k,{items:"center",gap:"s",children:c.jsx(hm,{option:H})}):O:o?o(I):b;l&&B.unshift(I);const G=Y=>{const{value:U}=Y.target,Q=U.trim();switch(Y.key){case"Escape":n(null);break;case"Enter":n((B.length?B[0].id:Q)||null,B[0]);break;case" ":bo(Y);break}},W=N("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",re.rnd,pa.focus),K=()=>{s==null||s()},J=qr({...e,className:N(O4,w,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(Ri,{value:H,onChange:$,disabled:y,children:({open:Y})=>c.jsxs("div",{...J,children:[i&&c.jsx(Ri.Label,{as:C,className:e.classNameLabel,children:c.jsx(fs,{as:"span",...e})}),v&&c.jsx("input",{type:"input",name:v,value:(H==null?void 0:H.id)??"",onChange:()=>{},className:ee("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:x,disabled:y}),c.jsx(Ri.Button,{ref:_,className:W,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:S,value:typeof d=="object"&&d.value||A,className:N([u,"gs-utl-w-full",re.rnd,pa.focus,je.xyS]),onChange:U=>{M(U.target.value),L==null||L(U.target.value)},onKeyDown:G,onClick:bo,onBlur:K,onFocus:r}):c.jsx(Xn,{border:m,size:g,title:V,icon:j?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:p,shadow:!1,className:ee(u),titleClass:"",disabled:y})}),c.jsx(Ri.Options,{static:f,className:J0,ref:P,style:R.popper,...F.popper,children:c.jsxs(Xn,{padding:!1,className:ee("h-full"),style:{minWidth:`${E==null?void 0:E.offsetWidth}px`,maxHeight:200},children:[!B.length&&d&&d!==!0&&c.jsx("div",{className:ee(je.xy),children:d.empty}),B.map((U,Q)=>c.jsx(Ri.Option,{value:U,children:({active:se})=>c.jsxs(k,{items:"center",gap:"s",className:ee([U.className,je.xy,se&&np.bgH]),nowrap:!0,children:[c.jsx(hm,{option:U}),c.jsx(D,{className:ee("gjs-pl-2"),children:X0(U,H)&&!q&&c.jsx(oe,{className:ee(z.tA),icon:Z.check,size:le.s})})]})},Q))]})})]})})}const Q0=h.createContext(null),A4=({children:e})=>{const[t,n]=h.useState({setEditor:s=>{n(r=>({...r,editor:s}))}});return c.jsx(Q0.Provider,{value:t,children:e})},Jn=()=>{const e=h.useContext(Q0);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},Ja=()=>{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},N4=()=>Jn().editor,ey=h.createContext(null),M4=({children:e})=>{const[t,n]=h.useState(()=>({setRefCanvas(s){n(r=>({...r,refCanvas:s}))},setCustomModal(s){n(r=>({...r,customModal:s}))},setCustomAssets(s){n(r=>({...r,customAssets:s}))},setCustomBlocks(s){n(r=>({...r,customBlocks:s}))},setCustomRte(s){n(r=>({...r,customRte:s}))},setCustomStyles(s){n(r=>({...r,customStyles:s}))},setCustomLayers(s){n(r=>({...r,customLayers:s}))},setCustomSelectors(s){n(r=>({...r,customSelectors:s}))},setCustomTraits(s){n(r=>({...r,customTraits:s}))},setReady(s){n(r=>({...r,ready:s}))}}));return c.jsx(ey.Provider,{value:t,children:e})},Hs=()=>{const e=h.useContext(ey);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function L4(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function Kr(e){return typeof e=="function"}function is(){}const ty=e=>typeof e=="string",R4=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},ny=e=>{const t=ty(e)?{id:e,src:e}:e;return new Promise((n,s)=>{const r=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);r.src=t.src,r.onload=()=>n(t.id),r.onerror=()=>s(t.id),document.head.appendChild(r)})},$4=e=>{const t=e.map(n=>ny(n));return Promise.allSettled(t)},gm=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(ty(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},mm=new WeakMap;function Pi(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=mm.get(e);if(t)return t;const n=function({children:s}){return Dn.createPortal(h.createElement("div",null,s),e)};return mm.set(e,n),n}h.memo(function({children:e}){const{editor:t}=Jn(),n=Hs(),[s,r]=h.useState(!1),[o,i]=h.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return h.useEffect(()=>{if(!t)return;const a=t.Assets.events.custom,l=({open:u,assets:d,types:f,select:p,close:g,container:m})=>{u&&i({assets:d,types:f,select:p,close:g,Container:Pi(m)}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?Kr(e)?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=Jn(),n=Hs(),[s,r]=h.useState(()=>({blocks:[],dragStart:is,dragStop:is,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const o=t.Blocks.events.custom,i=({blocks:a,container:l,dragStart:u,dragStop:d})=>{const f=a.reduce((p,g)=>{const m=g.getCategoryLabel(),b=p.get(m);return b?b.push(g):p.set(m,[g]),p},new Map);r({blocks:a,dragStart:u,dragStop:d,mapCategoryBlocks:f,Container:Pi(l)})};return t.on(o,i),t.Blocks.__trgCustom(),()=>{t.off(o,i)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?Kr(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function k4({children:e,...t}){const n=Hs(),s=h.useRef(null);return h.useEffect(()=>{s.current&&n.setRefCanvas(s.current)},[s.current]),c.jsx("div",{...t,ref:s,children:e})}const V4=h.memo(function({children:e}){const{editor:t}=Jn(),[n,s]=h.useState(()=>({devices:[],selected:"",select:is}));return h.useEffect(()=>{if(!t)return;const{Devices:r}=t,o=r.events.all,i=()=>{var a;s({devices:r.getDevices(),selected:(a=r.getSelected())==null?void 0:a.id,select:l=>r.select(l)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?Kr(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),I4=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function D4(e){const t=e.map(({id:o,src:i})=>({id:o,src:i})),n=e.reduce((o,i)=>(o[i.id]=i,o),{}),s=[],r=[];return(await $4(t)).forEach(o=>{o.status==="fulfilled"?s.push(n[o.value]):r.push(n[o.reason])}),{loaded:s,failed:r}}const H4=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{I4(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await D4(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},F4=h.memo(function({children:e,className:t,style:n,options:s={},plugins:r=[],grapesjs:o,grapesjsCss:i,onEditor:a=is,onReady:l,onUpdate:u,waitReady:d,...f}){const{setEditor:p}=Jn(),g=Hs(),[m,b]=h.useState(!1),v=h.useRef(null);h.useEffect(()=>{if(!g.ready||!v.current)return;const E=v.current,_=g.refCanvas;let T,P={},A=[];const M=R=>{const F={height:"100%",...s,plugins:[...A,...s.plugins||[]],pluginsOpts:{...s.pluginsOpts,...P},modal:{custom:!!g.customModal,...s.modal},assetManager:{custom:!!g.customAssets,...s.assetManager},styleManager:{custom:!!g.customStyles,...s.styleManager},blockManager:{custom:!!g.customBlocks,...s.blockManager},richTextEditor:{custom:!!g.customRte,...s.richTextEditor},layerManager:{custom:!!g.customLayers,...s.layerManager},traitManager:{custom:!!g.customTraits,...s.traitManager},selectorManager:{custom:!!g.customSelectors,...s.selectorManager},container:_||E,customUI:!!_,..._?{panels:{defaults:[]}}:{}};T=R.init(F),p(T),a(T),u&&T.on("update",()=>{u(T.getProjectData(),T)}),T.onReady(()=>{b(!0),l==null||l(T)})};return(async()=>{i&&await R4(i);const R=await H4(r);A=R.plugins,P=R.pluginOptions,typeof o=="string"?(await ny(o),M(window.grapesjs)):M(o)})(),()=>T==null?void 0:T.destroy()},[g.ready]);const x=s.height??"100%",y=s.width??"100%",w=L4("gjs-editor-wrapper",t),S=d&&!m,C=h.useMemo(()=>({...n,height:x,width:y}),[x,y,n]),j=h.useMemo(()=>({...C,...S?{opacity:0,width:0,height:0}:{}}),[C,S]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:w,style:C,children:d}):null,c.jsx("div",{...f,ref:v,className:w,style:j,children:e})]})}),B4=h.memo(function(){const e=Hs();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(A4,{children:c.jsx(M4,{children:c.jsxs(F4,{...t,children:[e,c.jsx(B4,{})]})})})});const sy=h.memo(function({children:e}){const{editor:t}=Jn(),n=Hs(),[s,r]=h.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Layers:o}=t,i=o.events.custom,a=({container:l})=>{r({root:o.getRoot(),Container:Pi(l)})};return t.on(i,a),o.__trgCustom({}),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomLayers(!0),[]),t?Kr(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=Jn(),n=Hs(),[s,r]=h.useState(!1),[o,i]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:is});return h.useEffect(()=>{if(!t)return;const a="modal",l=({open:u,title:d,content:f,close:p,attributes:g})=>{u&&i({title:h.createElement(gm(d)),content:h.createElement(gm(f)),attributes:g,close:p}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),h.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const ry=h.memo(function({children:e}){const{editor:t}=Jn(),[n,s]=h.useState(()=>({pages:[],selected:void 0,select:is,add:is,remove:is}));return h.useEffect(()=>{if(!t)return;const{Pages:r}=t,o=r.events.all,i=()=>{s({pages:r.getAll(),selected:r.getSelected(),select:(...a)=>r.select(...a),add:(...a)=>r.add(...a),remove:(...a)=>r.remove(...a)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?Kr(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),oy=h.memo(function({children:e}){const{editor:t}=Jn(),n=Hs(),[s,r]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:is,removeSelector:is,setState:is,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Selectors:o}=t,i=o.events.custom,a=({container:l})=>{r({selectors:o.getSelected(),states:o.getStates(),selectedState:o.getState(),targets:o.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>o.addSelected(...u),removeSelector:(...u)=>o.removeSelected(...u),setState:(...u)=>o.setState(...u),Container:Pi(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomSelectors(!0),[]),t?Kr(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),iy=h.memo(function({children:e}){const{editor:t}=Jn(),n=Hs(),[s,r]=h.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Styles:o}=t,i=o.events.custom,a=({container:l})=>{r({sectors:o.getSectors({visible:!0}),Container:Pi(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomStyles(!0),[]),t?Kr(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),bf=h.memo(function({children:e}){const{editor:t}=Jn(),n=Hs(),[s,r]=h.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Traits:o}=t,i=o.events.custom,a=({container:l})=>{r({traits:o.getCurrent(),Container:Pi(l)})};return t.on(i,a),o.__trgCustom(),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomTraits(!0),[]),t?Kr(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Qa=({children:e})=>N4()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function Kp(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 YL=(e,t)=>({[jt.web]:s=>md(s,t),[jt.document]:s=>md(s,t),[jt.react]:s=>md(s,t),[jt.email]:s=>KL(s,t)})[e],Mi="https://cdn.jsdelivr.net/npm/",xd={id:"gjs-blocks-basic",src:`${Mi}grapesjs-blocks-basic@1.0.1/dist/index.js`},XL={id:"grapesjs-plugin-forms",src:`${Mi}grapesjs-plugin-forms@2.0.5/dist/index.js`},wd={id:"grapesjs-parser-postcss",src:`${Mi}grapesjs-parser-postcss@1.0.1/dist/index.js`},JL={id:"grapesjs-navbar",src:`${Mi}grapesjs-navbar@1.0.1/dist/index.js`,options:{block:{category:"Extra"}}},Sd={id:"grapesjs-plugin-export",src:`${Mi}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)}}},QL={id:"grapesjs-mjml",src:`${Mi}grapesjs-mjml@1.0.7/dist/index.js`,options:{columnsPadding:"",useCustomTheme:!1,resetDevices:!1,resetBlocks:!1,blocks:[],useXmlParser:!0,resetStyleManager:!1}},eM={[jt.email]:[ZL,QL],[jt.web]:[xd,XL,Sd,wd,JL],[jt.document]:[xd,Sd,wd],[jt.react]:[xd,Sd,wd]};function tM(e,t){const{blocks:n}=t.appStore.sdkOptions;Array.isArray(n==null?void 0:n.default)&&e.BlockManager.blocks.add(n.default),e.on("rteToolbarPosUpdate",s=>{const r=-s.canvasOffset.left;s.left<r&&(s.left=r)})}function ly({onCopy:e,getValue:t,value:n,title:s="Copy",...r}){const[o,i]=h.useState(!1),a=()=>{Fw((t==null?void 0:t())??n),i(!0),e==null||e()};return h.useEffect(()=>{if(!o)return;const l=setTimeout(()=>i(!1),3e3);return()=>clearTimeout(l)},[o]),c.jsx(St,{onClick:a,title:s,type:"button",size:"lg",withBg:!0,...r,children:c.jsx(ne,{className:ie(o&&B.tA),icon:o?G.check:G.contentCopy,size:oe.s})})}const nM=(e,t)=>e.filter(n=>n.id===t)[0]||null,cy=(e,t)=>(e==null?void 0:e.id)===(t==null?void 0:t.id),sM=(e,t)=>e.label.toLowerCase().indexOf(t.toLowerCase())>=0,uy=K("cursor-default select-none focus:gs-utl-outline-none","z-20 max-h-full"),ch={strategy:"fixed",placement:"bottom",modifiers:[{name:"offset",options:{offset:[0,5]}},{name:"flip",options:{fallbackPlacements:["top"]}}]};function Em(e){var o;const{option:t,active:n,selected:s}=e,r=((o=e.isSelected)==null?void 0:o.call(e))||!0;return c.jsxs(k,{items:"center",className:K([Ee.xy,n&&bp.bgH]),children:[c.jsx(F,{className:K("truncate"),grow:!0,children:t.label}),c.jsx(F,{className:K("gjs-pl-2"),children:cy(t,s)&&r&&c.jsx(ne,{className:K(B.tA),icon:G.check,size:oe.s})})]})}const rM="gs-select-field";function Tm({option:e}){return c.jsxs(c.Fragment,{children:[e.icon&&c.jsx(ne,{...dt(e.icon)?{icon:e.icon,size:oe.s2x}:e.icon}),c.jsx(F,{className:K("truncate"),grow:!0,children:e.content||e.label})]})}function Le(e){const{value:t,onChange:n,onBlur:s,onFocus:r,handlerSelected:o,label:i,options:a,includeEmpty:l,className:u,search:d,open:f,caret:p=G.chevronDown,size:g="m",border:m,emptyState:v="- Select an option -",name:b,required:x,disabled:y,classNameContainer:w,autoFocus:S,labelAs:C,hideCaret:j}=e,[E,O]=h.useState(null),[P,T]=h.useState(null),[_,L]=h.useState(""),{styles:N,attributes:V}=sl(E,P,ch),A=typeof d=="object"?d.onChange:void 0,H=[...a].filter(ee=>d?A||sM(ee,_):ee),U=d&&(typeof d=="object"&&d.value||_),D=U&&H.length?H[0]:nM(H,t),$=ee=>n(ee.id,ee),I={id:null,label:v},R=(D==null?void 0:D.content)||(D==null?void 0:D.label),z=D?o?o(D):D.icon?c.jsx(k,{items:"center",gap:"s",children:c.jsx(Tm,{option:D})}):R:o?o(I):v;l&&H.unshift(I);const X=ee=>{const{value:W}=ee.target,Q=W.trim();switch(ee.key){case"Escape":n(null);break;case"Enter":n((H.length?H[0].id:Q)||null,H[0]);break;case" ":Po(ee);break}},Z=M("gs-utl-w-full gs-utl-text-left gs-utl-cursor-pointer gs-utl-block",te.rnd,xa.focus),Y=()=>{s==null||s()},J=no({...e,className:M(rM,w,"gs-utl-relative",g.includes("s")&&"gs-utl-text-xs")});return c.jsx(Bi,{value:D,onChange:$,disabled:y,children:({open:ee})=>c.jsxs("div",{...J,children:[i&&c.jsx(Bi.Label,{as:C,className:e.classNameLabel,children:c.jsx(ys,{as:"span",...e})}),b&&c.jsx("input",{type:"input",name:b,value:(D==null?void 0:D.id)??"",onChange:()=>{},className:K("gs-utl-w-[1px] gs-utl-h-[1px] gs-utl-opacity-[0.001] gs-utl-absolute"),required:x,disabled:y}),c.jsx(Bi.Button,{ref:O,className:Z,tabIndex:d?-1:void 0,children:d?c.jsx("input",{autoFocus:S,value:typeof d=="object"&&d.value||_,className:M([u,"gs-utl-w-full",te.rnd,xa.focus,Ee.xyS]),onChange:W=>{L(W.target.value),A==null||A(W.target.value)},onKeyDown:X,onClick:Po,onBlur:Y,onFocus:r}):c.jsx(ns,{border:m,size:g,title:z,icon:j?{className:"gs-utl-opacity-0 gs-utl-pointer-events-none"}:p,shadow:!1,className:K(u),titleClass:"",disabled:y})}),c.jsx(Bi.Options,{static:f,className:uy,ref:T,style:N.popper,...V.popper,children:c.jsxs(ns,{padding:!1,className:K("h-full"),style:{minWidth:`${E==null?void 0:E.offsetWidth}px`,maxHeight:200},children:[!H.length&&d&&d!==!0&&c.jsx("div",{className:K(Ee.xy),children:d.empty}),H.map((W,Q)=>c.jsx(Bi.Option,{value:W,children:({active:ae})=>c.jsxs(k,{items:"center",gap:"s",className:K([W.className,Ee.xy,ae&&bp.bgH]),nowrap:!0,children:[c.jsx(Tm,{option:W}),c.jsx(F,{className:K("gjs-pl-2"),children:cy(W,D)&&!U&&c.jsx(ne,{className:K(B.tA),icon:G.check,size:oe.s})})]})},Q))]})})]})})}const dy=h.createContext(null),oM=({children:e})=>{const[t,n]=h.useState({setEditor:s=>{n(r=>({...r,editor:s}))}});return c.jsx(dy.Provider,{value:t,children:e})},ss=()=>{const e=h.useContext(dy);if(!e)throw new Error("useEditorInstance must be used within EditorInstanceProvider");return e},ul=()=>{const{editor:e}=ss();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},iM=()=>ss().editor,fy=h.createContext(null),aM=({children:e})=>{const[t,n]=h.useState(()=>({setRefCanvas(s){n(r=>({...r,refCanvas:s}))},setCustomModal(s){n(r=>({...r,customModal:s}))},setCustomAssets(s){n(r=>({...r,customAssets:s}))},setCustomBlocks(s){n(r=>({...r,customBlocks:s}))},setCustomRte(s){n(r=>({...r,customRte:s}))},setCustomStyles(s){n(r=>({...r,customStyles:s}))},setCustomLayers(s){n(r=>({...r,customLayers:s}))},setCustomSelectors(s){n(r=>({...r,customSelectors:s}))},setCustomTraits(s){n(r=>({...r,customTraits:s}))},setReady(s){n(r=>({...r,ready:s}))}}));return c.jsx(fy.Provider,{value:t,children:e})},Ks=()=>{const e=h.useContext(fy);if(!e)throw new Error("useEditorOptions must be used within EditorOptionsProvider");return e};function lM(...e){return(Array.isArray(e[0])?e[0]:[...e]).filter(Boolean).join(" ")}function so(e){return typeof e=="function"}function ds(){}const py=e=>typeof e=="string",cM=async e=>{const t=document.createElement("link");t.href=e,t.rel="stylesheet",document.head.appendChild(t)},hy=e=>{const t=py(e)?{id:e,src:e}:e;return new Promise((n,s)=>{const r=document.createElement("script");if(document.querySelector(`script[src="${t.src}"]`))return n(t.id);r.src=t.src,r.onload=()=>n(t.id),r.onerror=()=>s(t.id),document.head.appendChild(r)})},uM=e=>{const t=e.map(n=>hy(n));return Promise.allSettled(t)},Pm=e=>function(){const t=h.useRef(null);return h.useEffect(()=>{const{current:n}=t;n&&(py(e)?n.innerHTML=e:n.appendChild(e))},[t.current]),c.jsx("div",{ref:t})},Om=new WeakMap;function Ni(e){if(!e)return()=>c.jsx(c.Fragment,{});const t=Om.get(e);if(t)return t;const n=function({children:s}){return Gn.createPortal(h.createElement("div",null,s),e)};return Om.set(e,n),n}h.memo(function({children:e}){const{editor:t}=ss(),n=Ks(),[s,r]=h.useState(!1),[o,i]=h.useState({assets:[],types:[],close:()=>{},select:()=>{},Container:()=>c.jsx(c.Fragment,{})});return h.useEffect(()=>{if(!t)return;const a=t.Assets.events.custom,l=({open:u,assets:d,types:f,select:p,close:g,container:m})=>{u&&i({assets:d,types:f,select:p,close:g,Container:Ni(m)}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),h.useEffect(()=>n.setCustomAssets(!0),[]),t?so(e)?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=ss(),n=Ks(),[s,r]=h.useState(()=>({blocks:[],dragStart:ds,dragStop:ds,mapCategoryBlocks:new Map,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const o=t.Blocks.events.custom,i=({blocks:a,container:l,dragStart:u,dragStop:d})=>{const f=a.reduce((p,g)=>{const m=g.getCategoryLabel(),v=p.get(m);return v?v.push(g):p.set(m,[g]),p},new Map);r({blocks:a,dragStart:u,dragStop:d,mapCategoryBlocks:f,Container:Ni(l)})};return t.on(o,i),t.Blocks.__trgCustom(),()=>{t.off(o,i)}},[t]),h.useEffect(()=>n.setCustomBlocks(!0),[]),t?so(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});function dM({children:e,...t}){const n=Ks(),s=h.useRef(null);return h.useEffect(()=>{s.current&&n.setRefCanvas(s.current)},[s.current]),c.jsx("div",{...t,ref:s,children:e})}const fM=h.memo(function({children:e}){const{editor:t}=ss(),[n,s]=h.useState(()=>({devices:[],selected:"",select:ds}));return h.useEffect(()=>{if(!t)return;const{Devices:r}=t,o=r.events.all,i=()=>{var a;s({devices:r.getDevices(),selected:(a=r.getSelected())==null?void 0:a.id,select:l=>r.select(l)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?so(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),pM=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function hM(e){const t=e.map(({id:o,src:i})=>({id:o,src:i})),n=e.reduce((o,i)=>(o[i.id]=i,o),{}),s=[],r=[];return(await uM(t)).forEach(o=>{o.status==="fulfilled"?s.push(n[o.value]):r.push(n[o.reason])}),{loaded:s,failed:r}}const gM=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{pM(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await hM(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},mM=h.memo(function({children:e,className:t,style:n,options:s={},plugins:r=[],grapesjs:o,grapesjsCss:i,onEditor:a=ds,onReady:l,onUpdate:u,waitReady:d,...f}){const{setEditor:p}=ss(),g=Ks(),[m,v]=h.useState(!1),b=h.useRef(null);h.useEffect(()=>{if(!g.ready||!b.current)return;const E=b.current,O=g.refCanvas;let P,T={},_=[];const L=N=>{const V={height:"100%",...s,plugins:[..._,...s.plugins||[]],pluginsOpts:{...s.pluginsOpts,...T},modal:{custom:!!g.customModal,...s.modal},assetManager:{custom:!!g.customAssets,...s.assetManager},styleManager:{custom:!!g.customStyles,...s.styleManager},blockManager:{custom:!!g.customBlocks,...s.blockManager},richTextEditor:{custom:!!g.customRte,...s.richTextEditor},layerManager:{custom:!!g.customLayers,...s.layerManager},traitManager:{custom:!!g.customTraits,...s.traitManager},selectorManager:{custom:!!g.customSelectors,...s.selectorManager},container:O||E,customUI:!!O,...O?{panels:{defaults:[]}}:{}};P=N.init(V),p(P),a(P),u&&P.on("update",()=>{u(P.getProjectData(),P)}),P.onReady(()=>{v(!0),l==null||l(P)})};return(async()=>{i&&await cM(i);const N=await gM(r);_=N.plugins,T=N.pluginOptions,typeof o=="string"?(await hy(o),L(window.grapesjs)):L(o)})(),()=>P==null?void 0:P.destroy()},[g.ready]);const x=s.height??"100%",y=s.width??"100%",w=lM("gjs-editor-wrapper",t),S=d&&!m,C=h.useMemo(()=>({...n,height:x,width:y}),[x,y,n]),j=h.useMemo(()=>({...C,...S?{opacity:0,width:0,height:0}:{}}),[C,S]);return c.jsxs(c.Fragment,{children:[d&&!m?c.jsx("div",{className:w,style:C,children:d}):null,c.jsx("div",{...f,ref:b,className:w,style:j,children:e})]})}),vM=h.memo(function(){const e=Ks();return h.useEffect(()=>e.setReady(!0),[]),c.jsx(c.Fragment,{})});h.memo(function({children:e,...t}){return c.jsx(oM,{children:c.jsx(aM,{children:c.jsxs(mM,{...t,children:[e,c.jsx(vM,{})]})})})});const gy=h.memo(function({children:e}){const{editor:t}=ss(),n=Ks(),[s,r]=h.useState(()=>({root:void 0,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Layers:o}=t,i=o.events.custom,a=({container:l})=>{r({root:o.getRoot(),Container:Ni(l)})};return t.on(i,a),o.__trgCustom({}),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomLayers(!0),[]),t?so(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});h.memo(function({children:e}){const{editor:t}=ss(),n=Ks(),[s,r]=h.useState(!1),[o,i]=h.useState({title:c.jsx(c.Fragment,{}),content:c.jsx(c.Fragment,{}),attributes:{},close:ds});return h.useEffect(()=>{if(!t)return;const a="modal",l=({open:u,title:d,content:f,close:p,attributes:g})=>{u&&i({title:h.createElement(Pm(d)),content:h.createElement(Pm(f)),attributes:g,close:p}),r(u)};return t.on(a,l),()=>{t.off(a,l)}},[t]),h.useEffect(()=>n.setCustomModal(!0),[]),t?typeof e=="function"?e({open:s,...o}):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})});const my=h.memo(function({children:e}){const{editor:t}=ss(),[n,s]=h.useState(()=>({pages:[],selected:void 0,select:ds,add:ds,remove:ds}));return h.useEffect(()=>{if(!t)return;const{Pages:r}=t,o=r.events.all,i=()=>{s({pages:r.getAll(),selected:r.getSelected(),select:(...a)=>r.select(...a),add:(...a)=>r.add(...a),remove:(...a)=>r.remove(...a)})};return t.on(o,i),i(),()=>{t.off(o,i)}},[t]),t?so(e)?e(n):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),vy=h.memo(function({children:e}){const{editor:t}=ss(),n=Ks(),[s,r]=h.useState(()=>({selectors:[],states:[],selectedState:"",targets:[],addSelector:ds,removeSelector:ds,setState:ds,Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Selectors:o}=t,i=o.events.custom,a=({container:l})=>{r({selectors:o.getSelected(),states:o.getStates(),selectedState:o.getState(),targets:o.getSelectedTargets().map(u=>u.getSelectorsString()),addSelector:(...u)=>o.addSelected(...u),removeSelector:(...u)=>o.removeSelected(...u),setState:(...u)=>o.setState(...u),Container:Ni(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomSelectors(!0),[]),t?so(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),by=h.memo(function({children:e}){const{editor:t}=ss(),n=Ks(),[s,r]=h.useState(()=>({sectors:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Styles:o}=t,i=o.events.custom,a=({container:l})=>{r({sectors:o.getSectors({visible:!0}),Container:Ni(l)})};return t.on(i,a),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomStyles(!0),[]),t?so(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),Mf=h.memo(function({children:e}){const{editor:t}=ss(),n=Ks(),[s,r]=h.useState(()=>({traits:[],Container:()=>c.jsx(c.Fragment,{})}));return h.useEffect(()=>{if(!t)return;const{Traits:o}=t,i=o.events.custom,a=({container:l})=>{r({traits:o.getCurrent(),Container:Ni(l)})};return t.on(i,a),o.__trgCustom(),()=>{t.off(i,a)}},[t]),h.useEffect(()=>n.setCustomTraits(!0),[]),t?so(e)?e(s):c.jsx(c.Fragment,{}):c.jsx(c.Fragment,{})}),dl=({children:e})=>iM()?c.jsx(c.Fragment,{children:e}):c.jsx(c.Fragment,{});function uh(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 {
|
|
322
257
|
$2`),e=e.replace(/([^\s])\}([^\n]*)/g,`$1
|
|
323
258
|
}
|
|
324
259
|
$2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
325
|
-
$2`),e}const ay=fe(function(){const t=Ja(),n=Re(),{Styles:s}=t,{isDarkTheme:r}=Ds(),o=s.getSelected(),[i,a]=h.useState(0),l=o?Kp(o==null?void 0:o.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const p=()=>a(m=>++m),g=s.events.custom;return t.on(g,p),()=>{t.off(g,p)}},[s,t]);const f=()=>{if(u){const p=t.Parser.parseCss(u)[0];p&&(o==null||o.setStyle(p.style))}};return c.jsxs(k,{className:ee("relative"),col:!0,full:!0,children:[c.jsx(D,{grow:!0,children:o?c.jsx(ir,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:r,clean:!0},i):n.t("noCode")}),c.jsx(Ke,{className:ee("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:f,children:n.t("update")})]})}),bm=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],z4=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(ie.projectFiles),s={};for(const r in n){const o=n[r],{filename:i,content:a}=o;if(o.path){const l=o.path.split("/").filter(Boolean);let u=s;for(const d of l)u[d]=u[d]||{},u=u[d];u[i]=a}else s[i]=a}return s}})},U4=fe(function(t){const n=Re(),s=ye(),{isProjectTypeEmail:r}=s,o=s.editor,[i,a]=h.useState(bm[0].id),[l,u]=h.useState(),{isDarkTheme:d}=Ds(),[f]=h.useState(()=>Kp(o.getCss())),[p,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),b={...t.options,...r?{export:!1}:{}},v=()=>z4(o);h.useEffect(()=>{(async()=>{var E,_;const w=await o.runCommand(ie.projectFiles,{page:o.Pages.getSelected(),skipProject:!0,styles:"skip"}),S=((E=w.find(T=>T.mimeType==="text/html"))==null?void 0:E.content)??"",C=((_=w.find(T=>T.mimeType==="text/mjml"))==null?void 0:_.content)??"";u(i==="mjml"?C:S)})()},[i]),h.useEffect(()=>{var y;p&&((y=p.getModel())==null||y.setValue(l),q0(p))},[p,l]);const x={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(k,{col:!0,space:"m",children:[c.jsxs(k,{className:ee("h-96"),space:"m",children:[c.jsxs(D,{className:ee("relative"),grow:!0,children:[r&&c.jsxs(k,{className:ee("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(_e,{value:i,onChange:a,options:bm,className:ee("min-w-24")}),c.jsx(Z0,{getValue:()=>p.getModel().getValue()})]}),l!==void 0&&c.jsx(ir,{defaultValue:l,language:"html",onMount:g,...x})]}),!r&&c.jsx(D,{grow:!0,children:c.jsx(ir,{defaultValue:f,language:"css",...x})})]}),b.export!==!1&&c.jsx(k,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:v,children:m("exportButton")})})]})});function W4(e,t){h.useEffect(()=>{const n="pointerdown",{current:s}=e;if(!s||!t.enabled)return;function r(o){const i=o.target;s&&i&&!s.contains(i)&&t.onTrigger(i)}return document.addEventListener(n,r),()=>{document.removeEventListener(n,r)}},[e.current,t.enabled])}const ly=e=>{const{ref:t,show:n,node:s,styles:r,update:o,reload:i}=e,a={all:"initial",zIndex:"10",fontFamily:"inherit",...r};h.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const f=l.attachShadow({mode:"closed"});l.__sh=nw.createRoot(f)}l.__sh.render(s),Object.keys(a).forEach(f=>{l.style.setProperty(ww(f),a[f],"important")});const u=new MutationObserver(i);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(f=>{Array.from(f[0].removedNodes).includes(l)&&i()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,o])},G4="gs-cmp-popover";function ps({children:e,handler:t,title:n,size:s,padding:r=!0,border:o=!0,overlay:i,clickAway:a,topIcon:l,placement:u="auto",offset:d,open:f,onClose:p,buttonAs:g,className:m,classNameBody:b,buttonProps:v={},disabled:x,hideCloseButton:y}){const[w,S]=h.useState(!!f),[C,j]=h.useState(w),[E,_]=h.useState(null),[T,P]=h.useState(null),A=Wa(E,T,{...Sh({offset:d}),placement:u}),M=()=>{j(!1),p==null||p()};W4({current:T},{onTrigger:M,enabled:a&&w}),h.useEffect(()=>{j(!!f)},[f]),h.useEffect(()=>{var L;w&&((L=A.update)==null||L.call(A))},[w,A.update]),h.useEffect(()=>{const L=setTimeout(()=>S(C),10);return()=>clearTimeout(L)},[C]);const R=ee("w-full transition-colors",x&&"pointer-events-none",...bv({border:!1,size:"",...v})),F=ee(["fixed z-20",l&&"gjs-mt-5",s==="s"&&"w-full max-w-64",s==="sm"&&"w-full max-w-sm",s==="md"&&"w-full max-w-md"]);return c.jsxs(qu,{className:ee(G4,"relative flex",m),children:[c.jsx(qu.Button,{ref:_,as:g,className:R,children:c.jsx("div",{onClick:L=>{bo(L),!(Lt(f)||x)&&j(!w)},children:t})}),w&&i&&c.jsx("div",{onClick:M,className:ee("z-10 fixed inset-0")}),C&&c.jsx(qu.Panel,{static:!0,className:F,ref:P,style:A.styles.popper,...A.attributes.popper,children:c.jsx(Ap,{as:h.Fragment,show:w,unmount:!1,...hv,children:c.jsx(Xn,{classNameBody:b,title:n,onClose:y?void 0:M,padding:r,border:o,children:typeof e=="function"?e({close:M,open:w}):e})})})]})}function _i(e){const{action:t,icon:n,label:s,className:r,items:o,onItemClick:i,selected:a,...l}=e,u=h.useRef(null),[d,f]=h.useState(),p=u.current,g=N([r,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",z.br,je.xy,re.bb,l.disabled&&Ee.disabled,...t?[z.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=v=>{Ye(t)&&(t({event:v}),i==null||i({event:v,item:e}))};h.useEffect(()=>{if(!p)return;const v=setTimeout(()=>f(p.getBoundingClientRect()),l.active?0:tp);return()=>clearTimeout(v)},[p,l.active]);const b=()=>{var v;return(v=l.onActive)==null?void 0:v.call(l)};return c.jsxs(k,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:b,children:[n&&c.jsx(D,{children:c.jsx(oe,{icon:n,size:le.sx})}),!!s&&c.jsx(D,{className:N(l.classNameLabel,Ee.txtEllips),grow:!0,children:s}),!!a&&c.jsx(D,{children:c.jsx(oe,{className:z.tA,icon:Z.check,size:le.s})}),!!(o!=null&&o.length)&&c.jsxs(c.Fragment,{children:[c.jsx(D,{children:c.jsx(oe,{icon:Z.chevronRight,size:le.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(x7,{items:o,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:i,open:!0})]})]})}const ru=({className:e,grow:t,alignItems:n,justifyContent:s})=>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",s==="start"&&"gs-utl-justify-start",s==="end"&&"gs-utl-justify-end",s==="center"&&"gs-utl-justify-center",s==="between"&&"gs-utl-justify-between",s==="around"&&"gs-utl-justify-around",s==="evenly"&&"gs-utl-justify-evenly"),ou=({style:e,width:t,height:n,gap:s})=>({height:n,gap:s,width:t,...e}),mn=h.memo(fe(function({id:t,children:n,className:s,style:r,width:o,gap:i,height:a,grow:l,alignItems:u,justifyContent:d,htmlAttrs:f,...p}){const{layoutsById:g}=S0(),[m,b]=h.useState({}),{className:v,style:x,...y}=f||{},w=s??v,S=r??x,C=h.useMemo(()=>ou({height:a,gap:i,width:o,style:S}),[S,o,a,i]),j=ru({className:w,grow:l,alignItems:u,justifyContent:d});h.useEffect(()=>{if(t)return g.set(t,{state:m,setState:b}),()=>{g.delete(t)}},[g,m]);const E=p.as??"div";return c.jsx(E,{style:C,className:j,...p,...y,children:m.children??n})})),Sl="gs-cmp-button-menu",q4=h.memo(fe(function({className:t,style:n,icon:s,label:r,size:o,tooltip:i,value:a,disabled:l,options:u,children:d,editorEvents:f,classNameBtn:p,iconMenu:g="chevronDown",onClick:m,onClickMenu:b,onOptionSelect:v}){const{editor:x}=ye(),[y,w]=h.useState(!1),[S,C]=h.useState(()=>({isOpen:y,className:t,style:n,tooltip:i,label:r,icon:s,iconMenu:g,size:o,disabled:l,value:a,options:u})),E={editor:x,state:S,setState:H=>C($=>({...$,...H}))};Jr({editor:x,editorEvents:f,localState:S,setLocalState:C});const _=H=>{m==null||m({...E,event:H})},T=H=>{v==null||v({...E,option:H}),w(!1)},P=S.tooltip,A=ot(P)?{title:P}:{tooltipProps:P},R=(()=>{var V,G;if(S.label)return Ye(S.label)?S.label(E):S.label;const H=(V=S.options)==null?void 0:V.find(W=>W.id===S.value),$=(G=S.options)==null?void 0:G[0],I=H||$,O=N((H==null?void 0:H.id)===S.value&&z.tA);if(I!=null&&I.icon)return{type:"icon",className:O,icon:I.icon,size:18};if(I!=null&&I.label)return{type:"text",className:O,content:I.label}})(),F=Ot(R),L=()=>{if(d){const H=Ye(d)?d(E):d;return Ot(H)}return S.options&&S.options.length>0?c.jsx("div",{className:`${Sl}-options`,children:S.options.map(H=>c.jsx(_i,{label:H.label,icon:H.icon,selected:H.id===S.value,action:()=>T(H)},H.id))}):null},B=H=>{H.stopPropagation(),b?b({...E,event:H}):w(!y)},q=c.jsx(k,{items:"center",onClick:B,className:N(`${Sl}__icon-menu`,z.hBgH2,z.txtHighEmphasisH),children:c.jsx(oe,{icon:S.iconMenu,size:"14px"})});return c.jsx(mn,{className:N(Sl,"gs-utl-flex",S.className),style:S.style,children:c.jsx(ps,{handler:c.jsx(bt,{className:N(`${Sl}__btn`,p),icon:S.icon,size:S.size,disabled:S.disabled,onClick:_,block:!0,...A,children:R?c.jsxs(k,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(k,{items:"center",children:F}),q]}):q}),buttonAs:"div",open:y,onClose:()=>w(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:L()})})}));function Yt(e){const{className:t,options:n,name:s,value:r,size:o="m",required:i,disabled:a,onChange:l,labelAs:u}=e,d=g=>{const m=n.filter(b=>b.id===g)[0];return n.indexOf(m)===n.length-1},f=(g,m)=>N("gs-utl-cursor-pointer",o==="m"&&je.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)&&re.br),p=qr({...e,className:"gs-field-buttons"});return c.jsxs(wg,{value:r,onChange:l,disabled:a,...p,children:[c.jsx(fs,{...e,as:u}),s&&c.jsx("input",{type:"hidden",name:s,value:r,required:i}),c.jsx(k,{className:N(t,re.b,re.rnd,z.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:g,label:m,title:b,icon:v})=>c.jsx(It,{title:b,className:N("gs-utl-w-full"),classNameWrp:N("gs-utl-flex-1"),children:c.jsx(wg.Option,{value:g,className:({checked:x})=>f(x,g),children:c.jsxs(k,{justify:"center",gap:"s",full:!0,children:[!!v&&c.jsx(oe,{...ot(v)?{icon:v,size:le.s}:v}),m&&c.jsx(D,{children:m})]})})},g))})]})}const K4="gs-cmp-button-group-field",Y4=h.memo(fe(function({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l,onChange:u,editorEvents:d}){const{editor:f}=ye(),[p,g]=h.useState(()=>({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l})),m=b=>{u({value:b,editor:f,state:p,setState:v=>g(x=>({...x,...v}))})};return Jr({editor:f,editorEvents:d,localState:p,setLocalState:g}),c.jsx(Yt,{className:N(K4,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 iu({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 Z4=h.memo(fe(function(){const{isStage:e,updateStudio:t}=ye(),{isDarkTheme:n}=Ds(),s=h.useRef(null),{bg:r,text:o}=gv(n);return ly({ref:s,show:e,update:n,reload:t,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",right:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
|
|
260
|
+
$2`),e}const yy=ce(function(){const t=ul(),n=Ie(),{Styles:s}=t,{isDarkTheme:r}=qs(),o=s.getSelected(),[i,a]=h.useState(0),l=o?uh(o==null?void 0:o.toCSS({allowEmpty:!0})):"",[u,d]=h.useState(l);h.useEffect(()=>{const p=()=>a(m=>++m),g=s.events.custom;return t.on(g,p),()=>{t.off(g,p)}},[s,t]);const f=()=>{if(u){const p=t.Parser.parseCss(u)[0];p&&(o==null||o.setStyle(p.style))}};return c.jsxs(k,{className:K("relative"),col:!0,full:!0,children:[c.jsx(F,{grow:!0,children:o?c.jsx(pr,{padding:5,language:"css",defaultValue:l,onChange:d,isDarkTheme:r,clean:!0},i):n.t("noCode")}),c.jsx(Ke,{className:K("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:f,children:n.t("update")})]})}),_m=[{id:"html",label:"HTML"},{id:"mjml",label:"MJML"}],bM=e=>{e.runCommand("gjs-export-zip",{filenamePfx:"gjs-export",root:async t=>{const n=await t.runCommand(se.projectFiles),s={};for(const r in n){const o=n[r],{filename:i,content:a}=o;if(o.path){const l=o.path.split("/").filter(Boolean);let u=s;for(const d of l)u[d]=u[d]||{},u=u[d];u[i]=a}else s[i]=a}return s}})},yM=ce(function(t){const n=Ie(),s=xe(),{isProjectTypeEmail:r}=s,o=s.editor,[i,a]=h.useState(_m[0].id),[l,u]=h.useState(),{isDarkTheme:d}=qs(),[f]=h.useState(()=>uh(o.getCss())),[p,g]=h.useState(),m=y=>n.t(`actions.showCode.${y}`),v={...t.options,...r?{export:!1}:{}},b=()=>bM(o);h.useEffect(()=>{(async()=>{var E,O;const w=await o.runCommand(se.projectFiles,{page:o.Pages.getSelected(),skipProject:!0,styles:"skip"}),S=((E=w.find(P=>P.mimeType==="text/html"))==null?void 0:E.content)??"",C=((O=w.find(P=>P.mimeType==="text/mjml"))==null?void 0:O.content)??"";u(i==="mjml"?C:S)})()},[i]),h.useEffect(()=>{var y;p&&((y=p.getModel())==null||y.setValue(l),oy(p))},[p,l]);const x={padding:5,isDarkTheme:d,clean:!0};return c.jsxs(k,{col:!0,space:"m",children:[c.jsxs(k,{className:K("h-96"),space:"m",children:[c.jsxs(F,{className:K("relative"),grow:!0,children:[r&&c.jsxs(k,{className:K("absolute top-3 right-3 z-10"),space:"s",nowrap:!0,children:[c.jsx(Le,{value:i,onChange:a,options:_m,className:K("min-w-24")}),c.jsx(ly,{getValue:()=>p.getModel().getValue()})]}),l!==void 0&&c.jsx(pr,{defaultValue:l,language:"html",onMount:g,...x})]}),!r&&c.jsx(F,{grow:!0,children:c.jsx(pr,{defaultValue:f,language:"css",...x})})]}),v.export!==!1&&c.jsx(k,{justify:"end",children:c.jsx(Ke,{size:"m2",variant:"pr",onClick:b,children:m("exportButton")})})]})});function xM(e,t){h.useEffect(()=>{const n="pointerdown",{current:s}=e;if(!s||!t.enabled)return;function r(o){const i=o.target;s&&i&&!s.contains(i)&&t.onTrigger(i)}return document.addEventListener(n,r),()=>{document.removeEventListener(n,r)}},[e.current,t.enabled])}const xy=e=>{const{ref:t,show:n,node:s,styles:r,update:o,reload:i}=e,a={all:"initial",zIndex:"10",fontFamily:"inherit",...r};h.useEffect(()=>{const l=t.current;if(l&&n){if(!l.__sh){const f=l.attachShadow({mode:"closed"});l.__sh=Mw.createRoot(f)}l.__sh.render(s),Object.keys(a).forEach(f=>{l.style.setProperty(Xw(f),a[f],"important")});const u=new MutationObserver(i);u.observe(l,{attributeFilter:["style"]});const d=new MutationObserver(f=>{Array.from(f[0].removedNodes).includes(l)&&i()});return d.observe(l.parentNode,{childList:!0}),()=>{u.disconnect(),d.disconnect()}}},[t.current,n,o])},wM="gs-cmp-popover";function xs({children:e,handler:t,title:n,size:s,padding:r=!0,border:o=!0,overlay:i,clickAway:a,topIcon:l,placement:u="auto",offset:d,open:f,onClose:p,buttonAs:g,className:m,classNameBody:v,buttonProps:b={},disabled:x,hideCloseButton:y}){const[w,S]=h.useState(!!f),[C,j]=h.useState(w),[E,O]=h.useState(null),[P,T]=h.useState(null),_=sl(E,P,{...Wh({offset:d}),placement:u}),L=()=>{j(!1),p==null||p()};xM({current:P},{onTrigger:L,enabled:a&&w}),h.useEffect(()=>{j(!!f)},[f]),h.useEffect(()=>{var A;w&&((A=_.update)==null||A.call(_))},[w,_.update]),h.useEffect(()=>{const A=setTimeout(()=>S(C),10);return()=>clearTimeout(A)},[C]);const N=K("w-full transition-colors",x&&"pointer-events-none",...wb({border:!1,size:"",...b})),V=K(["fixed z-20",l&&"gjs-mt-5",s==="s"&&"w-full max-w-64",s==="sm"&&"w-full max-w-sm",s==="md"&&"w-full max-w-md"]);return c.jsxs(od,{className:K(wM,"relative flex",m),children:[c.jsx(od.Button,{ref:O,as:g,className:N,children:c.jsx("div",{onClick:A=>{Po(A),!(Dt(f)||x)&&j(!w)},children:t})}),w&&i&&c.jsx("div",{onClick:L,className:K("z-10 fixed inset-0")}),C&&c.jsx(od.Panel,{static:!0,className:V,ref:T,style:_.styles.popper,..._.attributes.popper,children:c.jsx(Gp,{as:h.Fragment,show:w,unmount:!1,...bb,children:c.jsx(ns,{classNameBody:v,title:n,onClose:y?void 0:L,padding:r,border:o,children:typeof e=="function"?e({close:L,open:w}):e})})})]})}function $i(e){const{action:t,icon:n,label:s,className:r,items:o,onItemClick:i,selected:a,...l}=e,u=h.useRef(null),[d,f]=h.useState(),p=u.current,g=M([r,"gs-utl-last:border-b-0 gs-utl-gap-2 gs-utl-select-none",B.br,Ee.xy,te.bb,l.disabled&&Oe.disabled,...t?[B.hBgH,"gs-utl-cursor-pointer"]:["gs-utl-cursor-default"]]),m=b=>{tt(t)&&(t({event:b}),i==null||i({event:b,item:e}))};h.useEffect(()=>{if(!p)return;const b=setTimeout(()=>f(p.getBoundingClientRect()),l.active?0:vp);return()=>clearTimeout(b)},[p,l.active]);const v=()=>{var b;return(b=l.onActive)==null?void 0:b.call(l)};return c.jsxs(k,{ref:u,items:"center",nowrap:!0,className:g,onClick:m,onPointerEnter:v,children:[n&&c.jsx(F,{children:c.jsx(ne,{icon:n,size:oe.sx})}),!!s&&c.jsx(F,{className:M(l.classNameLabel,Oe.txtEllips),grow:!0,children:s}),!!a&&c.jsx(F,{children:c.jsx(ne,{className:B.tA,icon:G.check,size:oe.s})}),!!(o!=null&&o.length)&&c.jsxs(c.Fragment,{children:[c.jsx(F,{children:c.jsx(ne,{icon:G.chevronRight,size:oe.s,className:"-gs-utl-mr-2"})}),d&&l.active&&c.jsx(_7,{items:o,x:d.left,y:d.top,w:d.width,h:d.height,onItemClick:i,open:!0})]})]})}const bu=({className:e,grow:t,alignItems:n,justifyContent:s})=>M(e,B.br,t&&"gs-utl-flex-grow",n==="start"&&"gs-utl-items-start",n==="end"&&"gs-utl-items-end",n==="center"&&"gs-utl-items-center",n==="baseline"&&"gs-utl-items-baseline",n==="stretch"&&"gs-utl-items-stretch",s==="start"&&"gs-utl-justify-start",s==="end"&&"gs-utl-justify-end",s==="center"&&"gs-utl-justify-center",s==="between"&&"gs-utl-justify-between",s==="around"&&"gs-utl-justify-around",s==="evenly"&&"gs-utl-justify-evenly"),yu=({style:e,width:t,height:n,gap:s})=>({height:n,gap:s,width:t,...e}),Cn=h.memo(ce(function({id:t,children:n,className:s,style:r,width:o,gap:i,height:a,grow:l,alignItems:u,justifyContent:d,htmlAttrs:f,...p}){const{layoutsById:g}=$0(),[m,v]=h.useState({}),{className:b,style:x,...y}=f||{},w=s??b,S=r??x,C=h.useMemo(()=>yu({height:a,gap:i,width:o,style:S}),[S,o,a,i]),j=bu({className:w,grow:l,alignItems:u,justifyContent:d});h.useEffect(()=>{if(t)return g.set(t,{state:m,setState:v}),()=>{g.delete(t)}},[g,m]);const E=p.as??"div";return c.jsx(E,{style:C,className:j,...p,...y,children:m.children??n})})),$l="gs-cmp-button-menu",SM=h.memo(ce(function({className:t,style:n,icon:s,label:r,size:o,tooltip:i,value:a,disabled:l,options:u,children:d,editorEvents:f,classNameBtn:p,iconMenu:g="chevronDown",onClick:m,onClickMenu:v,onOptionSelect:b}){const{editor:x}=xe(),[y,w]=h.useState(!1),[S,C]=h.useState(()=>({isOpen:y,className:t,style:n,tooltip:i,label:r,icon:s,iconMenu:g,size:o,disabled:l,value:a,options:u})),E={editor:x,state:S,setState:D=>C($=>({...$,...D}))};co({editor:x,editorEvents:f,localState:S,setLocalState:C});const O=D=>{m==null||m({...E,event:D})},P=D=>{b==null||b({...E,option:D}),w(!1)},T=S.tooltip,_=dt(T)?{title:T}:{tooltipProps:T},N=(()=>{var z,X;if(S.label)return tt(S.label)?S.label(E):S.label;const D=(z=S.options)==null?void 0:z.find(Z=>Z.id===S.value),$=(X=S.options)==null?void 0:X[0],I=D||$,R=M((D==null?void 0:D.id)===S.value&&B.tA);if(I!=null&&I.icon)return{type:"icon",className:R,icon:I.icon,size:18};if(I!=null&&I.label)return{type:"text",className:R,content:I.label}})(),V=$t(N),A=()=>{if(d){const D=tt(d)?d(E):d;return $t(D)}return S.options&&S.options.length>0?c.jsx("div",{className:`${$l}-options`,children:S.options.map(D=>c.jsx($i,{label:D.label,icon:D.icon,selected:D.id===S.value,action:()=>P(D)},D.id))}):null},H=D=>{D.stopPropagation(),v?v({...E,event:D}):w(!y)},U=c.jsx(k,{items:"center",onClick:H,className:M(`${$l}__icon-menu`,B.hBgH2,B.txtHighEmphasisH),children:c.jsx(ne,{icon:S.iconMenu,size:"14px"})});return c.jsx(Cn,{className:M($l,"gs-utl-flex",S.className),style:S.style,children:c.jsx(xs,{handler:c.jsx(St,{className:M(`${$l}__btn`,p),icon:S.icon,size:S.size,disabled:S.disabled,onClick:O,block:!0,..._,children:N?c.jsxs(k,{items:"center",gap:"s",nowrap:!0,children:[c.jsx(k,{items:"center",children:V}),U]}):U}),buttonAs:"div",open:y,onClose:()=>w(!1),clickAway:!0,padding:!1,hideCloseButton:!0,children:A()})})}));function en(e){const{className:t,options:n,name:s,value:r,size:o="m",required:i,disabled:a,onChange:l,labelAs:u}=e,d=g=>{const m=n.filter(v=>v.id===g)[0];return n.indexOf(m)===n.length-1},f=(g,m)=>M("gs-utl-cursor-pointer",o==="m"&&Ee.xy,o==="s"&&"gs-utl-px-2 gs-utl-py-1 text-sm",o==="xs"&&"gs-utl-p-1 text-sm",B.br,g&&B.bgO,!d(m)&&te.br),p=no({...e,className:"gs-field-buttons"});return c.jsxs(Ng,{value:r,onChange:l,disabled:a,...p,children:[c.jsx(ys,{...e,as:u}),s&&c.jsx("input",{type:"hidden",name:s,value:r,required:i}),c.jsx(k,{className:M(t,te.b,te.rnd,B.br,"gs-utl-cursor-pointer"),items:"center",full:!0,nowrap:!0,children:n.map(({id:g,label:m,title:v,icon:b})=>c.jsx(zt,{title:v,className:M("gs-utl-w-full"),classNameWrp:M("gs-utl-flex-1"),children:c.jsx(Ng.Option,{value:g,className:({checked:x})=>f(x,g),children:c.jsxs(k,{justify:"center",gap:"s",full:!0,children:[!!b&&c.jsx(ne,{...dt(b)?{icon:b,size:oe.s}:b}),m&&c.jsx(F,{children:m})]})})},g))})]})}const CM="gs-cmp-button-group-field",jM=h.memo(ce(function({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l,onChange:u,editorEvents:d}){const{editor:f}=xe(),[p,g]=h.useState(()=>({className:t,label:n,name:s,value:r,options:o,size:i,required:a,disabled:l})),m=v=>{u({value:v,editor:f,state:p,setState:b=>g(x=>({...x,...b}))})};return co({editor:f,editorEvents:d,localState:p,setLocalState:g}),c.jsx(en,{className:M(CM,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 xu({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 EM=h.memo(ce(function(){const{isStage:e,updateStudio:t}=xe(),{isDarkTheme:n}=qs(),s=h.useRef(null),{bg:r,text:o}=yb(n);return xy({ref:s,show:e,update:n,reload:t,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",right:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
|
|
326
261
|
.gs-banner {
|
|
327
262
|
box-shadow: 0 0 5px #1c1b1b21;
|
|
328
263
|
padding: 30px 10px;
|
|
@@ -342,7 +277,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
342
277
|
.gs-gs-logo {
|
|
343
278
|
width: 35px;
|
|
344
279
|
}
|
|
345
|
-
`}),c.jsx(
|
|
280
|
+
`}),c.jsx(ns,{className:"gs-banner",children:c.jsxs(k,{className:"gs-banner-row",children:[c.jsx(xu,{className:"gs-gs-logo",colors:!0}),c.jsx("div",{children:"GrapesJS Studio Demo!"})]})})]})}),c.jsx("div",{ref:s})})),TM=()=>`https://grapesjs.com?ref=${window.location.host}`,PM=h.memo(ce(function(){const{updateStudio:e,showPoweredBy:t}=xe(),{isDarkTheme:n}=qs(),s=h.useRef(null),{bg:r,text:o,link:i}=yb(n);return xy({ref:s,show:t,update:n,reload:e,styles:{display:"flex",justifyContent:"center",position:"absolute",bottom:"0",left:"0"},node:c.jsxs(c.Fragment,{children:[c.jsx("style",{children:`
|
|
346
281
|
.gs-banner {
|
|
347
282
|
box-shadow: 0 0 5px #1c1b1b21;
|
|
348
283
|
padding: 5px 10px;
|
|
@@ -365,7 +300,7 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
365
300
|
.gs-logo {
|
|
366
301
|
width: 20px;
|
|
367
302
|
}
|
|
368
|
-
`}),c.jsx(Xn,{className:"gs-banner",children:c.jsxs(k,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:X4(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(iu,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:s})})),vm="gs-canvas-content",Q4=h.memo(fe(function({children:t}){const{isReady:n}=ye(),s=N(`${vm}__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:vm,children:[c.jsx("div",{className:s}),!n&&c.jsx(Co,{className:N("gs-utl-z-10"),abs:!0,full:!0}),n&&Ot(t)]}),c.jsx(Z4,{}),c.jsx(J4,{})]})})),eM="gs-canvas",cy=h.memo(function({className:t,style:n,grow:s,children:r}){return c.jsx(k4,{style:n,className:N(eM,"gs-utl-relative",s&&"gs-utl-flex-grow",t),children:c.jsx(Qa,{children:c.jsx(Q4,{children:r})})})}),Yp=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),tM=Yp?Promise.resolve().then(function(){return aM}):Promise.resolve().then(function(){return pM});async function nM(...e){return(await tM).default(...e)}Yp?Promise.resolve().then(function(){return cM}):Promise.resolve().then(function(){return gM});const sM=Yp?Promise.resolve().then(function(){return dM}):Promise.resolve().then(function(){return bM});async function rM(...e){return(await sM).default(...e)}const oM=async e=>{const t=await e.getFile();return t.handle=e,t};var iM=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((r,o)=>{t[o]={description:r.description||"Files",accept:{}},r.mimeTypes?r.mimeTypes.map(i=>{t[o].accept[i]=r.extensions||[]}):t[o].accept["*/*"]=r.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),s=await Promise.all(n.map(oM));return e[0].multiple?s:s[0]},aM={__proto__:null,default:iM};function Ql(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var s=n.done;return Promise.resolve(n.value).then(function(r){return{value:r,done:s}})}return Ql=function(n){this.s=n,this.n=n.next},Ql.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var s=this.s.return;return s===void 0?Promise.resolve({value:n,done:!0}):t(s.apply(this.s,arguments))},throw:function(n){var s=this.s.return;return s===void 0?Promise.reject(n):t(s.apply(this.s,arguments))}},new Ql(e)}const uy=async(e,t,n=e.name,s)=>{const r=[],o=[];var i,a=!1,l=!1;try{for(var u,d=function(f){var p,g,m,b=2;for(typeof Symbol<"u"&&(g=Symbol.asyncIterator,m=Symbol.iterator);b--;){if(g&&(p=f[g])!=null)return p.call(f);if(m&&(p=f[m])!=null)return new Ql(p.call(f));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());a=!(u=await d.next()).done;a=!1){const f=u.value,p=`${n}/${f.name}`;f.kind==="file"?o.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||s&&s(f)||r.push(uy(f,t,p,s))}}catch(f){l=!0,i=f}finally{try{a&&d.return!=null&&await d.return()}finally{if(l)throw i}}return[...(await Promise.all(r)).flat(),...await Promise.all(o)]};var lM=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]:uy(t,e.recursive,void 0,e.skipDirectory)},cM={__proto__:null,default:lM},uM=async(e,t=[{}],n=null,s=!1,r=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const o=[];let i=null;if(e instanceof Blob&&e.type?i=e.type:e.headers&&e.headers.get("content-type")&&(i=e.headers.get("content-type")),t.forEach((u,d)=>{o[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&i&&u.mimeTypes.push(i),u.mimeTypes.map(f=>{o[d].accept[f]=u.extensions||[]})):i?o[d].accept[i]=u.extensions||[]:o[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,s)throw u}const a=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:o,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&r&&r(a);const l=await a.createWritable();return"stream"in e?(await e.stream().pipeTo(l),a):"body"in e?(await e.body.pipeTo(l),a):(await l.write(await e),await l.close(),a)},dM={__proto__:null,default:uM},fM=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const s=document.createElement("input");s.type="file";const r=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();s.multiple=e[0].multiple||!1,s.accept=r||"",s.style.display="none",document.body.append(s);const o=l=>{typeof i=="function"&&i(),t(l)},i=e[0].legacySetup&&e[0].legacySetup(o,()=>i(n),s),a=()=>{window.removeEventListener("focus",a),s.remove()};s.addEventListener("click",()=>{window.addEventListener("focus",a)}),s.addEventListener("change",()=>{window.removeEventListener("focus",a),s.remove(),o(s.multiple?Array.from(s.files):s.files[0])}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),pM={__proto__:null,default:fM},hM=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const s=document.createElement("input");s.type="file",s.webkitdirectory=!0;const r=i=>{typeof o=="function"&&o(),t(i)},o=e[0].legacySetup&&e[0].legacySetup(r,()=>o(n),s);s.addEventListener("change",()=>{let i=Array.from(s.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(i=i.filter(a=>a.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):i=i.filter(a=>a.webkitRelativePath.split("/").length===2),r(i)}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),gM={__proto__:null,default:hM},mM=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let s=e;"body"in e&&(s=await async function(i,a){const l=i.getReader(),u=new ReadableStream({start:p=>async function g(){return l.read().then(({done:m,value:b})=>{if(!m)return p.enqueue(b),g();p.close()})}()}),d=new Response(u),f=await d.blob();return l.releaseLock(),new Blob([f],{type:a})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await s);const r=()=>{typeof o=="function"&&o()},o=t.legacySetup&&t.legacySetup(r,()=>o(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),r()}),n.click(),null},bM={__proto__:null,default:mM};function Rr({children:e,label:t,s:n="m",pill:s,border:r,nopad:o,className:i,block:a,...l}){return c.jsx("div",{className:N(!a&&"gs-utl-inline-block",i,!o&&je.xyS2,s?re.pill:re.rnd,r&&`${re.b} ${z.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var ym={};const vM=ym.REACT_APP_VERSION??ym.NPM_PACKAGE_VERSION,yM=fe(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsxs(D,{className:ue("relative"),children:[c.jsx(iu,{className:ue("w-24 opacity-50")}),t&&c.jsx(Rr,{className:ue(z.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(D,{children:[c.jsxs("p",{children:[c.jsx("b",{children:"GrapesJS Studio"})," is an innovative experimental editor, initially created to improve and extend the customization capability of the"," ",c.jsx("a",{className:ue($r.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:ue($r.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(D,{className:ue(z.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",vM]})]})}),xM=fe(function(){return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsx(D,{className:ee("relative"),children:c.jsx(iu,{className:ee("w-24 opacity-50")})})}),c.jsx(D,{children:c.jsxs("p",{children:["We're excited to introduce the GrapesJS Studio SDK, an embeddable version of the Studio editor.",c.jsx("br",{}),c.jsx("br",{}),"The Studio SDK offers a powerful and flexible web editing experience that can be seamlessly integrated into your platform as a white-label editor. This enables your users to effortlessly create and manage content with advanced tools.",c.jsx("br",{}),c.jsx("br",{}),"You can try the initial release of the Studio SDK by creating a license and following the instructions on the"," ",c.jsx("a",{className:ee($r.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:ee($r.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),wM=()=>[{id:yt.web,label:Ts(yt.web),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(oe,{icon:Z.web,size:le.s}),c.jsx("span",{children:Ts(yt.web)})]})},{id:yt.email,label:Ts(yt.email),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(oe,{icon:Z.emailOutline,size:le.s}),c.jsx("span",{children:Ts(yt.email)})]})}],Cl="gs-cmp-tabs";function Yr({tabs:e,className:t,classNamePanel:n,classNameTab:s,variant:r,style:o,onChange:i=Sw,value:a}){const l=r==="pills",u=l?N("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",z.bgH):"",d=b=>l?N("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",b?z.bg:""):N("gs-utl-border-b-2",je.xy),f=b=>{b&&(b.tabIndex=-1)},p=b=>{const v=b.currentTarget;setTimeout(()=>v.blur(),10)},g=Lt(a)?e.findIndex(b=>b.id===a):void 0,m=!e.some(b=>!!b.content);return c.jsxs($i.Group,{onChange:b=>i(e[b].id),defaultIndex:e.findIndex(b=>b.id===a),selectedIndex:g,children:[c.jsx($i.List,{as:k,className:N(Cl,t,u),style:o,full:!0,nowrap:!0,children:e.map(b=>c.jsx($i,{disabled:b.disabled,className:({selected:v})=>N(`${Cl}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",b.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",pa.focus,d(v),v?`${z.tAo} ${z.bA}`:z.br,s),children:b.label},b.id))}),c.jsx($i.Panels,{className:N(`${Cl}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(b=>c.jsx($i.Panel,{tabIndex:-1,className:N(`${Cl}__panel`,"gs-utl-h-full"),ref:f,onFocus:p,children:b.content},b.id))})]})}const au=0,Zr=1,Ti=2,dy=4;function SM(e,t){return n=>e(t(n))}function CM(e,t){return t(e)}function fy(e,t){return n=>e(t,n)}function xm(e,t){return()=>e(t)}function Zp(e,t){return t(e),e}function Vo(...e){return e}function jM(e){e()}function wm(e){return()=>e}function EM(...e){return()=>{e.map(jM)}}function lu(){}function Zt(e,t){return e(Zr,t)}function kt(e,t){e(au,t)}function Xp(e){e(Ti)}function oi(e){return e(dy)}function ct(e,t){return Zt(e,fy(t,au))}function Sm(e,t){const n=e(Zr,s=>{n(),t(s)});return n}function _t(){const e=[];return(t,n)=>{switch(t){case Ti:e.splice(0,e.length);return;case Zr:return e.push(n),()=>{const s=e.indexOf(n);s>-1&&e.splice(s,1)};case au:e.slice().forEach(s=>{s(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function we(e){let t=e;const n=_t();return(s,r)=>{switch(s){case Zr:r(t);break;case au:t=r;break;case dy:return t}return n(s,r)}}function PM(e){let t,n;const s=()=>t&&t();return function(r,o){switch(r){case Zr:return o?n===o?void 0:(s(),n=o,t=Zt(e,o),t):(s(),lu);case Ti:s(),n=null;return;default:throw new Error(`unrecognized action ${r}`)}}}function ta(e){return Zp(_t(),t=>ct(e,t))}function ii(e,t){return Zp(we(t),n=>ct(e,n))}function _M(...e){return t=>e.reduceRight(CM,t)}function Pe(e,...t){const n=_M(...t);return(s,r)=>{switch(s){case Zr:return Zt(e,n(r));case Ti:Xp(e);return}}}function py(e,t){return e===t}function dn(e=py){let t;return n=>s=>{e(t,s)||(t=s,n(s))}}function Bt(e){return t=>n=>{e(n)&&t(n)}}function vt(e){return t=>SM(t,e)}function Sr(e){return t=>()=>t(e)}function jl(e,t){return n=>s=>n(t=e(t,s))}function vf(e){return t=>n=>{e>0?e--:t(n)}}function Ki(e){let t=null,n;return s=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,s(t)},e))}}function Cm(e){let t,n;return s=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{s(t)},e)}}function js(...e){const t=new Array(e.length);let n=0,s=null;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);Zt(o,l=>{const u=n;n=n|a,t[i]=l,u!==r&&n===r&&s&&(s(),s=null)})}),o=>i=>{const a=()=>o([i].concat(t));n===r?a():s=a}}function jm(...e){return function(t,n){switch(t){case Zr:return EM(...e.map(s=>Zt(s,n)));case Ti:return;default:throw new Error(`unrecognized action ${t}`)}}}function Fe(e,t=py){return Pe(e,dn(t))}function er(...e){const t=_t(),n=new Array(e.length);let s=0;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);Zt(o,l=>{n[i]=l,s=s|a,s===r&&kt(t,n)})}),function(o,i){switch(o){case Zr:return s===r&&i(n),Zt(t,i);case Ti:return Xp(t);default:throw new Error(`unrecognized action ${o}`)}}}function Fs(e,t=[],{singleton:n}={singleton:!0}){return{id:TM(),constructor:e,dependencies:t,singleton:n}}const TM=()=>Symbol();function OM(e){const t=new Map,n=({id:s,constructor:r,dependencies:o,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function AM(e,t){const n={},s={};let r=0;const o=e.length;for(;r<o;)s[e[r]]=1,r+=1;for(const i in t)s.hasOwnProperty(i)||(n[i]=t[i]);return n}const El=typeof document<"u"?h.useLayoutEffect:h.useEffect;function NM(e,t,n){const s=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=h.createContext({});function l(x,y){x.propsReady&&kt(x.propsReady,!1);for(const w of s){const S=x[t.required[w]];kt(S,y[w])}for(const w of r)if(w in y){const S=x[t.optional[w]];kt(S,y[w])}x.propsReady&&kt(x.propsReady,!0)}function u(x){return o.reduce((y,w)=>(y[w]=S=>{const C=x[t.methods[w]];kt(C,S)},y),{})}function d(x){return i.reduce((y,w)=>(y[w]=PM(x[t.events[w]]),y),{})}const f=h.forwardRef((x,y)=>{const{children:w,...S}=x,[C]=h.useState(()=>Zp(OM(e),_=>l(_,S))),[j]=h.useState(xm(d,C));El(()=>{for(const _ of i)_ in S&&Zt(j[_],S[_]);return()=>{Object.values(j).map(Xp)}},[S,j,C]),El(()=>{l(C,S)}),h.useImperativeHandle(y,wm(u(C)));const E=n;return c.jsx(a.Provider,{value:C,children:n?c.jsx(E,{...AM([...s,...r,...i],S),children:w}):w})}),p=x=>h.useCallback(fy(kt,h.useContext(a)[x]),[x]),g=x=>{const w=h.useContext(a)[x],S=h.useCallback(C=>Zt(w,C),[w]);return h.useSyncExternalStore(S,()=>oi(w),()=>oi(w))},m=x=>{const w=h.useContext(a)[x],[S,C]=h.useState(xm(oi,w));return El(()=>Zt(w,j=>{j!==S&&C(wm(j))}),[w,S]),S},b=h.version.startsWith("18")?g:m;return{Component:f,usePublisher:p,useEmitterValue:b,useEmitter:(x,y)=>{const S=h.useContext(a)[x];El(()=>Zt(S,y),[y,S])}}}const hy=typeof document<"u"?h.useLayoutEffect:h.useEffect;var Jp=(e=>(e[e.DEBUG=0]="DEBUG",e[e.INFO=1]="INFO",e[e.WARN=2]="WARN",e[e.ERROR=3]="ERROR",e))(Jp||{});const MM={0:"debug",1:"log",2:"warn",3:"error"},LM=()=>typeof globalThis>"u"?window:globalThis,gy=Fs(()=>{const e=we(3);return{log:we((n,s,r=1)=>{var o;const i=(o=LM().VIRTUOSO_LOG_LEVEL)!=null?o:oi(e);r>=i&&console[MM[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,s)}),logLevel:e}},[],{singleton:!0});function my(e,t,n){const s=h.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=h.useMemo(()=>new ResizeObserver(i=>{requestAnimationFrame(()=>{const l=i[0].target;l.offsetParent!==null&&e(l)})}),[e]);r=i=>{i&&t?(o.observe(i),s.current=i):(s.current&&o.unobserve(s.current),s.current=null)}}return{ref:s,callbackRef:r}}function cu(e,t,n){return my(e,t).callbackRef}function xc(e,t){return Math.round(e.getBoundingClientRect()[t])}function by(e,t){return Math.abs(e-t)<1.01}function vy(e,t,n,s=lu,r,o){const i=h.useRef(null),a=h.useRef(null),l=h.useRef(null),u=h.useCallback(p=>{const g=p.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,x=o?m?window.innerWidth:g.offsetWidth:m?window.innerHeight:g.offsetHeight,y=()=>{e({scrollTop:Math.max(b,0),scrollHeight:v,viewportHeight:x})};p.suppressFlushSync?y():Dn.flushSync(y),a.current!==null&&(b===a.current||b<=0||b===v-x)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);h.useEffect(()=>{const p=r||i.current;return s(r||i.current),u({target:p,suppressFlushSync:!0}),p.addEventListener("scroll",u,{passive:!0}),()=>{s(null),p.removeEventListener("scroll",u)}},[i,u,n,s,r]);function d(p){const g=i.current;if(!g||(o?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=p.behavior==="smooth";let b,v,x;g===window?(v=Math.max(xc(document.documentElement,o?"width":"height"),o?document.documentElement.scrollWidth:document.documentElement.scrollHeight),b=o?window.innerWidth:window.innerHeight,x=o?document.documentElement.scrollLeft:document.documentElement.scrollTop):(v=g[o?"scrollWidth":"scrollHeight"],b=xc(g,o?"width":"height"),x=g[o?"scrollLeft":"scrollTop"]);const y=v-b;if(p.top=Math.ceil(Math.max(Math.min(y,p.top),0)),by(b,v)||p.top===x){e({scrollTop:x,scrollHeight:v,viewportHeight:b}),m&&t(!0);return}m?(a.current=p.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,o&&(p={left:p.top,behavior:p.behavior}),g.scrollTo(p)}function f(p){o&&(p={left:p.top,behavior:p.behavior}),i.current.scrollBy(p)}return{scrollerRef:i,scrollByCallback:f,scrollToCallback:d}}const uu=Fs(()=>{const e=_t(),t=_t(),n=we(0),s=_t(),r=we(0),o=_t(),i=_t(),a=we(0),l=we(0),u=we(0),d=we(0),f=_t(),p=_t(),g=we(!1),m=we(!1),b=we(!1);return ct(Pe(e,vt(({scrollTop:v})=>v)),t),ct(Pe(e,vt(({scrollHeight:v})=>v)),i),ct(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:a,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:i,smoothScrollTargetReached:s,horizontalDirection:m,skipAnimationFrameInResizeObserver:b,scrollTo:f,scrollBy:p,statefulScrollTop:r,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),RM=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function $M(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!RM)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const wc="up",na="down",kM="none",VM={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},IM=0,yy=Fs(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:s,footerHeight:r,scrollBy:o}])=>{const i=we(!1),a=we(!0),l=_t(),u=_t(),d=we(4),f=we(IM),p=ii(Pe(jm(Pe(Fe(t),vf(1),Sr(!0)),Pe(Fe(t),vf(1),Sr(!1),Cm(100))),dn()),!1),g=ii(Pe(jm(Pe(o,Sr(!0)),Pe(o,Sr(!1),Cm(200))),dn()),!1);ct(Pe(er(Fe(t),Fe(f)),vt(([y,w])=>y<=w),dn()),a),ct(Pe(a,Ki(50)),u);const m=ta(Pe(er(e,Fe(n),Fe(s),Fe(r),Fe(d)),jl((y,[{scrollTop:w,scrollHeight:S},C,j,E,_])=>{const T=w+C-S>-_,P={viewportHeight:C,scrollTop:w,scrollHeight:S};if(T){let M,R;return w>y.state.scrollTop?(M="SCROLLED_DOWN",R=y.state.scrollTop-w):(M="SIZE_DECREASED",R=y.state.scrollTop-w||y.scrollTopDelta),{atBottom:!0,state:P,atBottomBecause:M,scrollTopDelta:R}}let A;return P.scrollHeight>y.state.scrollHeight?A="SIZE_INCREASED":C<y.state.viewportHeight?A="VIEWPORT_HEIGHT_DECREASING":w<y.state.scrollTop?A="SCROLLING_UPWARDS":A="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:A,state:P}},VM),dn((y,w)=>y&&y.atBottom===w.atBottom))),b=ii(Pe(e,jl((y,{scrollTop:w,scrollHeight:S,viewportHeight:C})=>{if(by(y.scrollHeight,S))return{scrollTop:w,scrollHeight:S,jump:0,changed:!1};{const j=S-(w+C)<1;return y.scrollTop!==w&&j?{scrollHeight:S,scrollTop:w,jump:y.scrollTop-w,changed:!0}:{scrollHeight:S,scrollTop:w,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Bt(y=>y.changed),vt(y=>y.jump)),0);ct(Pe(m,vt(y=>y.atBottom)),i),ct(Pe(i,Ki(50)),l);const v=we(na);ct(Pe(e,vt(({scrollTop:y})=>y),dn(),jl((y,w)=>oi(g)?{direction:y.direction,prevScrollTop:w}:{direction:w<y.prevScrollTop?wc:na,prevScrollTop:w},{direction:na,prevScrollTop:0}),vt(y=>y.direction)),v),ct(Pe(e,Ki(50),Sr(kM)),v);const x=we(0);return ct(Pe(p,Bt(y=>!y),Sr(0)),x),ct(Pe(t,Ki(100),js(p),Bt(([y,w])=>!!w),jl(([y,w],[S])=>[w,S],[0,0]),vt(([y,w])=>w-y)),x),{isScrolling:p,isAtTop:a,isAtBottom:i,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:v,atBottomThreshold:d,atTopThreshold:f,scrollVelocity:x,lastJumpDueToItemResize:b}},Vo(uu)),DM=Fs(([{log:e}])=>{const t=we(!1),n=ta(Pe(t,Bt(s=>s),dn()));return Zt(t,s=>{s&&oi(e)("props updated",{},Jp.DEBUG)}),{propsReady:t,didMount:n}},Vo(gy),{singleton:!0});function xy(e,t){e==0?t():requestAnimationFrame(()=>xy(e-1,t))}function HM(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}function yf(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function FM(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Sc="top",Cc="bottom",Em="none";function Pm(e,t,n){return typeof e=="number"?n===wc&&t===Sc||n===na&&t===Cc?e:0:n===wc?t===Sc?e.main:e.reverse:t===Cc?e.main:e.reverse}function _m(e,t){return typeof e=="number"?e:e[t]||0}const BM=Fs(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:s,fixedHeaderHeight:r}])=>{const o=_t(),i=we(0),a=we(0),l=we(0),u=ii(Pe(er(Fe(e),Fe(t),Fe(s),Fe(o,yf),Fe(l),Fe(i),Fe(r),Fe(n),Fe(a)),vt(([d,f,p,[g,m],b,v,x,y,w])=>{const S=d-y,C=v+x,j=Math.max(p-S,0);let E=Em;const _=_m(w,Sc),T=_m(w,Cc);return g-=y,g+=p+x,m+=p+x,m-=y,g>d+C-_&&(E=wc),m<d-j+f+T&&(E=na),E!==Em?[Math.max(S-p-Pm(b,Sc,E)-_,0),S-j-x+f+Pm(b,Cc,E)+T]:null}),Bt(d=>d!=null),dn(yf)),[0,0]);return{listBoundary:o,overscan:l,topListHeight:i,increaseViewportBy:a,visibleRange:u}},Vo(uu),{singleton:!0}),zM=Fs(([{scrollVelocity:e}])=>{const t=we(!1),n=_t(),s=we(!1);return ct(Pe(e,js(s,t,n),Bt(([r,o])=>!!o),vt(([r,o,i,a])=>{const{exit:l,enter:u}=o;if(i){if(l(r,a))return!1}else if(u(r,a))return!0;return i}),dn()),t),Zt(Pe(er(t,e,n),js(s)),([[r,o,i],a])=>r&&a&&a.change&&a.change(o,i)),{isSeeking:t,scrollSeekConfiguration:s,scrollVelocity:e,scrollSeekRangeChanged:n}},Vo(yy),{singleton:!0});function UM(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const WM=Fs(([{scrollTo:e,scrollContainerState:t}])=>{const n=_t(),s=_t(),r=_t(),o=we(!1),i=we(void 0);return ct(Pe(er(n,s),vt(([{viewportHeight:a,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:a}))),t),ct(Pe(e,js(s),vt(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),r),{useWindowScroll:o,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:s,windowScrollTo:r}},Vo(uu)),dd="-webkit-sticky",Tm="sticky",wy=UM(()=>{if(typeof document>"u")return Tm;const e=document.createElement("div");return e.style.position=dd,e.style.position===dd?dd:Tm});function GM(e,t,n){const s=h.useRef(null),r=h.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),d=u.width;let 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;s.current={offsetTop:p,visibleHeight:f,visibleWidth:d},e(s.current)},[e,t]),{callbackRef:o,ref:i}=my(r,!0),a=h.useCallback(()=>{r(i.current)},[r,i]);return h.useEffect(()=>{if(t){t.addEventListener("scroll",a);const l=new ResizeObserver(()=>{requestAnimationFrame(a)});return l.observe(t),()=>{t.removeEventListener("scroll",a),l.unobserve(t)}}else return window.addEventListener("scroll",a),window.addEventListener("resize",a),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,t]),o}h.createContext(void 0);const Sy=h.createContext(void 0);function qM(e){return e}wy();const KM={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},YM={outline:"none",overflowX:"auto",position:"relative"},Cy=e=>({width:"100%",height:"100%",position:"absolute",top:0});wy();function mo(e,t){if(typeof e!="string")return{context:t}}function ZM({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:o,children:i,...a}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=n("scrollerRef"),p=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:b,scrollToCallback:v}=vy(l,d,u,f,void 0,g);t("scrollTo",v),t("scrollBy",b);const x=g?YM:KM;return c.jsx(u,{ref:m,style:{...x,...o},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...a,...mo(u,p),children:i})})}function XM({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:o,children:i,...a}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=n("totalListHeight"),p=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:b,scrollByCallback:v,scrollToCallback:x}=vy(l,d,u,lu,g);return hy(()=>(b.current=g||window,()=>{b.current=null}),[b,g]),t("windowScrollTo",x),t("scrollBy",v),c.jsx(u,{style:{position:"relative",...o,...f!==0?{height:f+p}:{}},"data-virtuoso-scroller":!0,...a,...mo(u,m),children:i})})}const Om={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},JM={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:Am,ceil:Nm,floor:jc,min:fd,max:sa}=Math;function QM(e){return{...JM,items:e}}function Mm(e,t,n){return Array.from({length:t-e+1}).map((s,r)=>{const o=n===null?null:n[r+e];return{index:r+e,data:o}})}function eL(e,t){return e&&e.column===t.column&&e.row===t.row}function Pl(e,t){return e&&e.width===t.width&&e.height===t.height}const tL=Fs(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:s},{scrollTop:r,viewportHeight:o,scrollBy:i,scrollTo:a,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:f},p,g,{propsReady:m,didMount:b},{windowViewportRect:v,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,windowScrollTo:S},C])=>{const j=we(0),E=we(0),_=we(Om),T=we({height:0,width:0}),P=we({height:0,width:0}),A=_t(),M=_t(),R=we(0),F=we(null),L=we({row:0,column:0}),B=_t(),q=_t(),H=we(!1),$=we(0),I=we(!0),O=we(!1),V=we(!1);Zt(Pe(b,js($),Bt(([U,Q])=>!!Q)),()=>{kt(I,!1)}),Zt(Pe(er(b,I,P,T,$,O),Bt(([U,Q,se,de,,Se])=>U&&!Q&&se.height!==0&&de.height!==0&&!Se)),([,,,,U])=>{kt(O,!0),xy(1,()=>{kt(A,U)}),Sm(Pe(r),()=>{kt(n,[0,0]),kt(I,!0)})}),ct(Pe(q,Bt(U=>U!=null&&U.scrollTop>0),Sr(0)),E),Zt(Pe(b,js(q),Bt(([,U])=>U!=null)),([,U])=>{U&&(kt(T,U.viewport),kt(P,U==null?void 0:U.item),kt(L,U.gap),U.scrollTop>0&&(kt(H,!0),Sm(Pe(r,vf(1)),Q=>{kt(H,!1)}),kt(a,{top:U.scrollTop})))}),ct(Pe(T,vt(({height:U})=>U)),o),ct(Pe(er(Fe(T,Pl),Fe(P,Pl),Fe(L,(U,Q)=>U&&U.column===Q.column&&U.row===Q.row),Fe(r)),vt(([U,Q,se,de])=>({viewport:U,item:Q,gap:se,scrollTop:de}))),B),ct(Pe(er(Fe(j),t,Fe(L,eL),Fe(P,Pl),Fe(T,Pl),Fe(F),Fe(E),Fe(H),Fe(I),Fe($)),Bt(([,,,,,,,U])=>!U),vt(([U,[Q,se],de,Se,ne,Te,ke,,it,st])=>{const{row:xe,column:Ze}=de,{height:Xe,width:ft}=Se,{width:Ae}=ne;if(ke===0&&(U===0||Ae===0))return Om;if(ft===0){const $t=HM(st,U),zs=Math.max($t+ke-1,0);return QM(Mm($t,zs,Te))}const at=jy(Ae,ft,Ze);let rt,Ie;it?Q===0&&se===0&&ke>0?(rt=0,Ie=ke-1):(rt=at*jc((Q+xe)/(Xe+xe)),Ie=at*Nm((se+xe)/(Xe+xe))-1,Ie=fd(U-1,sa(Ie,at-1)),rt=fd(Ie,sa(0,rt))):(rt=0,Ie=-1);const Wt=Mm(rt,Ie,Te),{top:ge,bottom:$e}=Lm(ne,de,Se,Wt),Ve=Nm(U/at),wt=Ve*Xe+(Ve-1)*xe-$e;return{items:Wt,offsetTop:ge,offsetBottom:wt,top:ge,bottom:$e,itemHeight:Xe,itemWidth:ft}})),_),ct(Pe(F,Bt(U=>U!==null),vt(U=>U.length)),j),ct(Pe(er(T,P,_,L),Bt(([U,Q,{items:se}])=>se.length>0&&Q.height!==0&&U.height!==0),vt(([U,Q,{items:se},de])=>{const{top:Se,bottom:ne}=Lm(U,de,Q,se);return[Se,ne]}),dn(yf)),n);const G=we(!1);ct(Pe(r,js(G),vt(([U,Q])=>Q||U!==0)),G);const W=ta(Pe(Fe(_),Bt(({items:U})=>U.length>0),js(j,G),Bt(([{items:U},Q,se])=>se&&U[U.length-1].index===Q-1),vt(([,U])=>U-1),dn())),K=ta(Pe(Fe(_),Bt(({items:U})=>U.length>0&&U[0].index===0),Sr(0),dn())),J=ta(Pe(Fe(_),js(H),Bt(([{items:U},Q])=>U.length>0&&!Q),vt(([{items:U}])=>({startIndex:U[0].index,endIndex:U[U.length-1].index})),dn(FM),Ki(0)));ct(J,g.scrollSeekRangeChanged),ct(Pe(A,js(T,P,j,L),vt(([U,Q,se,de,Se])=>{const ne=$M(U),{align:Te,behavior:ke,offset:it}=ne;let st=ne.index;st==="LAST"&&(st=de-1),st=sa(0,st,fd(de-1,st));let xe=xf(Q,Se,se,st);return Te==="end"?xe=Am(xe-Q.height+se.height):Te==="center"&&(xe=Am(xe-Q.height/2+se.height/2)),it&&(xe+=it),{top:xe,behavior:ke}})),a);const Y=ii(Pe(_,vt(U=>U.offsetBottom+U.bottom)),0);return ct(Pe(v,vt(U=>({width:U.visibleWidth,height:U.visibleHeight}))),T),{data:F,totalCount:j,viewportDimensions:T,itemDimensions:P,scrollTop:r,scrollHeight:M,overscan:e,increaseViewportBy:s,scrollBy:i,scrollTo:a,scrollToIndex:A,smoothScrollTargetReached:l,windowViewportRect:v,windowScrollTo:S,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,deviation:R,scrollContainerState:u,footerHeight:d,headerHeight:f,initialItemCount:E,gap:L,restoreStateFrom:q,...g,initialTopMostItemIndex:$,horizontalDirection:V,gridState:_,totalListHeight:Y,...p,startReached:K,endReached:W,rangeChanged:J,stateChanged:B,propsReady:m,stateRestoreInProgress:H,...C}},Vo(BM,uu,yy,zM,DM,WM,gy));function Lm(e,t,n,s){const{height:r}=n;if(r===void 0||s.length===0)return{top:0,bottom:0};const o=xf(e,t,n,s[0].index),i=xf(e,t,n,s[s.length-1].index)+r;return{top:o,bottom:i}}function xf(e,t,n,s){const r=jy(e.width,n.width,t.column),o=jc(s/r),i=o*n.height+sa(0,o-1)*t.row;return i>0?i+t.row:i}function jy(e,t,n){return sa(1,jc((e+n)/(jc(t)+n)))}const nL=Fs(()=>{const e=we(f=>`Item ${f}`),t=we({}),n=we(null),s=we("virtuoso-grid-item"),r=we("virtuoso-grid-list"),o=we(qM),i=we("div"),a=we(lu),l=(f,p=null)=>ii(Pe(t,vt(g=>g[f]),dn()),p),u=we(!1),d=we(!1);return ct(Fe(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:o,itemClassName:s,listClassName:r,headerFooterTag:i,scrollerRef:a,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),sL=Fs(([e,t])=>({...e,...t}),Vo(tL,nL)),rL=h.memo(function(){const t=St("gridState"),n=St("listClassName"),s=St("itemClassName"),r=St("itemContent"),o=St("computeItemKey"),i=St("isSeeking"),a=zn("scrollHeight"),l=St("ItemComponent"),u=St("ListComponent"),d=St("ScrollSeekPlaceholder"),f=St("context"),p=zn("itemDimensions"),g=zn("gap"),m=St("log"),b=St("stateRestoreInProgress"),v=zn("reportReadyState"),x=cu(h.useMemo(()=>y=>{const w=y.parentElement.parentElement.scrollHeight;a(w);const S=y.firstChild;if(S){const{width:C,height:j}=S.getBoundingClientRect();p({width:C,height:j})}g({row:Rm("row-gap",getComputedStyle(y).rowGap,m),column:Rm("column-gap",getComputedStyle(y).columnGap,m)})},[a,p,g,m]),!0);return hy(()=>{t.itemHeight>0&&t.itemWidth>0&&v(!0)},[t]),b?null:c.jsx(u,{ref:x,className:n,...mo(u,f),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const w=o(y.index,y.data,f);return i?c.jsx(d,{...mo(d,f),index:y.index,height:t.itemHeight,width:t.itemWidth},w):h.createElement(l,{...mo(l,f),className:s,"data-index":y.index,key:w},r(y.index,y.data,f))})})}),oL=h.memo(function(){const t=St("HeaderComponent"),n=zn("headerHeight"),s=St("headerFooterTag"),r=cu(h.useMemo(()=>i=>n(xc(i,"height")),[n]),!0),o=St("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...mo(t,o)})}):null}),iL=h.memo(function(){const t=St("FooterComponent"),n=zn("footerHeight"),s=St("headerFooterTag"),r=cu(h.useMemo(()=>i=>n(xc(i,"height")),[n]),!0),o=St("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...mo(t,o)})}):null}),aL=({children:e})=>{const t=h.useContext(Sy),n=zn("itemDimensions"),s=zn("viewportDimensions"),r=cu(h.useMemo(()=>o=>{s(o.getBoundingClientRect())},[s]),!0);return h.useEffect(()=>{t&&(s({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,s,n]),c.jsx("div",{style:Cy(),ref:r,children:e})},lL=({children:e})=>{const t=h.useContext(Sy),n=zn("windowViewportRect"),s=zn("itemDimensions"),r=St("customScrollParent"),o=GM(n,r);return h.useEffect(()=>{t&&(s({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,s]),c.jsx("div",{ref:o,style:Cy(),children:e})},cL=h.memo(function({...t}){const n=St("useWindowScroll"),s=St("customScrollParent"),r=s||n?fL:dL,o=s||n?lL:aL;return c.jsx(r,{...t,children:c.jsxs(o,{children:[c.jsx(oL,{}),c.jsx(rL,{}),c.jsx(iL,{})]})})}),{Component:uL,usePublisher:zn,useEmitterValue:St,useEmitter:Ey}=NM(sL,{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"}},cL),dL=ZM({usePublisher:zn,useEmitterValue:St,useEmitter:Ey}),fL=XM({usePublisher:zn,useEmitterValue:St,useEmitter:Ey});function Rm(e,t,n){return t!=="normal"&&!(t!=null&&t.endsWith("px"))&&n(`${e} was not resolved to pixel value correctly`,t,Jp.WARN),t==="normal"?0:parseInt(t??"0",10)}const du=uL,Qp=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},pL=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function hL(e){const t=e.map(({id:i,src:a})=>({id:i,src:a})),n=e.reduce((i,a)=>(i[a.id]=a,i),{}),s=[],r=[];return(await hw(t)).forEach(i=>{i.status==="fulfilled"?s.push(n[i.value]):r.push(n[i.reason])}),{loaded:s,failed:r}}const gL=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{pL(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await hL(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},mL=(e,t,n,s={})=>{const{skipReplace:r}=s;e.loadData(t);const o=e.getCss()||"",i=r?o:o.replace(/:root\s*{/gi,"[data-body]{");let a=`${e.getHtml()}<style>${i}</style>`;if(n===yt.email)try{a=e.runCommand(tu).html}catch(l){console.error(l)}return s.removeScripts&&(a=a.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),r?a:a.replace("<body","<div data-body").replace("</body>","</div>")},bL=async(e,t,n)=>{const s=qx(t,{appStore:n}),r=await gL(s);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...r.plugins,o=>{o.Storage.setCurrent("")}],pluginsOpts:r.pluginOptions,protectedCss:`
|
|
303
|
+
`}),c.jsx(ns,{className:"gs-banner",children:c.jsxs(k,{className:"gs-banner-row",children:[c.jsx("a",{className:"gs-link",href:TM(),target:"_blank",children:"GrapesJS Studio"}),c.jsx(xu,{className:"gs-logo",colors:!0})]})})]})}),c.jsx("div",{ref:s})})),Am="gs-canvas-content",OM=h.memo(ce(function({children:t}){const{isReady:n}=xe(),s=M(`${Am}__overlay gs-utl-pointer-events-none gs-utl-absolute gs-utl-inset-0`,B.bgH2);return c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:Am,children:[c.jsx("div",{className:s}),!n&&c.jsx(Br,{className:M("gs-utl-z-10"),abs:!0,full:!0}),n&&$t(t)]}),c.jsx(EM,{}),c.jsx(PM,{})]})})),_M="gs-canvas",wy=h.memo(function({className:t,style:n,grow:s,children:r}){return c.jsx(dM,{style:n,className:M(_M,"gs-utl-relative",s&&"gs-utl-flex-grow",t),children:c.jsx(dl,{children:c.jsx(OM,{children:r})})})}),dh=(()=>{if(typeof self>"u")return!1;if("top"in self&&self!==top)try{top.window.document._=0}catch{return!1}return"showOpenFilePicker"in self})(),AM=dh?Promise.resolve().then(function(){return RM}):Promise.resolve().then(function(){return BM});async function LM(...e){return(await AM).default(...e)}dh?Promise.resolve().then(function(){return VM}):Promise.resolve().then(function(){return UM});const MM=dh?Promise.resolve().then(function(){return DM}):Promise.resolve().then(function(){return GM});async function NM(...e){return(await MM).default(...e)}const $M=async e=>{const t=await e.getFile();return t.handle=e,t};var kM=async(e=[{}])=>{Array.isArray(e)||(e=[e]);const t=[];e.forEach((r,o)=>{t[o]={description:r.description||"Files",accept:{}},r.mimeTypes?r.mimeTypes.map(i=>{t[o].accept[i]=r.extensions||[]}):t[o].accept["*/*"]=r.extensions||[]});const n=await window.showOpenFilePicker({id:e[0].id,startIn:e[0].startIn,types:t,multiple:e[0].multiple||!1,excludeAcceptAllOption:e[0].excludeAcceptAllOption||!1}),s=await Promise.all(n.map($M));return e[0].multiple?s:s[0]},RM={__proto__:null,default:kM};function uc(e){function t(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var s=n.done;return Promise.resolve(n.value).then(function(r){return{value:r,done:s}})}return uc=function(n){this.s=n,this.n=n.next},uc.prototype={s:null,n:null,next:function(){return t(this.n.apply(this.s,arguments))},return:function(n){var s=this.s.return;return s===void 0?Promise.resolve({value:n,done:!0}):t(s.apply(this.s,arguments))},throw:function(n){var s=this.s.return;return s===void 0?Promise.reject(n):t(s.apply(this.s,arguments))}},new uc(e)}const Sy=async(e,t,n=e.name,s)=>{const r=[],o=[];var i,a=!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 uc(p.call(f));g="@@asyncIterator",m="@@iterator"}throw new TypeError("Object is not async iterable")}(e.values());a=!(u=await d.next()).done;a=!1){const f=u.value,p=`${n}/${f.name}`;f.kind==="file"?o.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||s&&s(f)||r.push(Sy(f,t,p,s))}}catch(f){l=!0,i=f}finally{try{a&&d.return!=null&&await d.return()}finally{if(l)throw i}}return[...(await Promise.all(r)).flat(),...await Promise.all(o)]};var IM=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]:Sy(t,e.recursive,void 0,e.skipDirectory)},VM={__proto__:null,default:IM},HM=async(e,t=[{}],n=null,s=!1,r=null)=>{Array.isArray(t)||(t=[t]),t[0].fileName=t[0].fileName||"Untitled";const o=[];let i=null;if(e instanceof Blob&&e.type?i=e.type:e.headers&&e.headers.get("content-type")&&(i=e.headers.get("content-type")),t.forEach((u,d)=>{o[d]={description:u.description||"Files",accept:{}},u.mimeTypes?(d===0&&i&&u.mimeTypes.push(i),u.mimeTypes.map(f=>{o[d].accept[f]=u.extensions||[]})):i?o[d].accept[i]=u.extensions||[]:o[d].accept["*/*"]=u.extensions||[]}),n)try{await n.getFile()}catch(u){if(n=null,s)throw u}const a=n||await window.showSaveFilePicker({suggestedName:t[0].fileName,id:t[0].id,startIn:t[0].startIn,types:o,excludeAcceptAllOption:t[0].excludeAcceptAllOption||!1});!n&&r&&r(a);const l=await a.createWritable();return"stream"in e?(await e.stream().pipeTo(l),a):"body"in e?(await e.body.pipeTo(l),a):(await l.write(await e),await l.close(),a)},DM={__proto__:null,default:HM},FM=async(e=[{}])=>(Array.isArray(e)||(e=[e]),new Promise((t,n)=>{const s=document.createElement("input");s.type="file";const r=[...e.map(l=>l.mimeTypes||[]),...e.map(l=>l.extensions||[])].join();s.multiple=e[0].multiple||!1,s.accept=r||"",s.style.display="none",document.body.append(s);const o=l=>{typeof i=="function"&&i(),t(l)},i=e[0].legacySetup&&e[0].legacySetup(o,()=>i(n),s),a=()=>{window.removeEventListener("focus",a),s.remove()};s.addEventListener("click",()=>{window.addEventListener("focus",a)}),s.addEventListener("change",()=>{window.removeEventListener("focus",a),s.remove(),o(s.multiple?Array.from(s.files):s.files[0])}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),BM={__proto__:null,default:FM},zM=async(e=[{}])=>(Array.isArray(e)||(e=[e]),e[0].recursive=e[0].recursive||!1,new Promise((t,n)=>{const s=document.createElement("input");s.type="file",s.webkitdirectory=!0;const r=i=>{typeof o=="function"&&o(),t(i)},o=e[0].legacySetup&&e[0].legacySetup(r,()=>o(n),s);s.addEventListener("change",()=>{let i=Array.from(s.files);e[0].recursive?e[0].recursive&&e[0].skipDirectory&&(i=i.filter(a=>a.webkitRelativePath.split("/").every(l=>!e[0].skipDirectory({name:l,kind:"directory"})))):i=i.filter(a=>a.webkitRelativePath.split("/").length===2),r(i)}),"showPicker"in HTMLInputElement.prototype?s.showPicker():s.click()})),UM={__proto__:null,default:zM},WM=async(e,t={})=>{Array.isArray(t)&&(t=t[0]);const n=document.createElement("a");let s=e;"body"in e&&(s=await async function(i,a){const l=i.getReader(),u=new ReadableStream({start: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:a})}(e.body,e.headers.get("content-type"))),n.download=t.fileName||"Untitled",n.href=URL.createObjectURL(await s);const r=()=>{typeof o=="function"&&o()},o=t.legacySetup&&t.legacySetup(r,()=>o(),n);return n.addEventListener("click",()=>{setTimeout(()=>URL.revokeObjectURL(n.href),3e4),r()}),n.click(),null},GM={__proto__:null,default:WM};function Dr({children:e,label:t,s:n="m",pill:s,border:r,nopad:o,className:i,block:a,...l}){return c.jsx("div",{className:M(!a&&"gs-utl-inline-block",i,!o&&Ee.xyS2,s?te.pill:te.rnd,r&&`${te.b} ${B.br}`,n==="s"&&"gs-utl-text-sm",n==="xs"&&"gs-utl-p-1"),...l,children:t||e})}var Lm={NODE_ENV:"production"};const qM=Lm.REACT_APP_VERSION??Lm.NPM_PACKAGE_VERSION,KM=ce(function(){var n;const t=(n=window.grapesjs)==null?void 0:n.version;return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsxs(F,{className:ie("relative"),children:[c.jsx(xu,{className:ie("w-24 opacity-50")}),t&&c.jsx(Dr,{className:ie(B.bgA,"absolute gs-utl-right-[-20px] bottom-0"),label:`v${t}`,s:"s",pill:!0})]})}),c.jsxs(F,{children:[c.jsxs("p",{children:[c.jsx("b",{children:"GrapesJS Studio"})," is an innovative experimental editor, initially created to improve and extend the customization capability of the"," ",c.jsx("a",{className:ie(Fr.link),href:"https://grapesjs.com",children:"GrapesJS"})," ","library. Beyond pushing the evolution of the core library itself, this application aspires to empower individuals in creating and managing their web projects autonomously, free from subscriptions or dependency on the internet connection."]}),c.jsx("br",{}),c.jsxs("p",{children:["If you like the vision of this project and you're eager to play a role in its continued development, consider becoming a backer or sponsor through"," ",c.jsx("a",{className:ie(Fr.link),href:"https://opencollective.com/grapesjs",children:"Open Collective"}),"."]})]}),c.jsxs(F,{className:ie(B.txtLowEmphasis,"text-right"),children:["GrapesJS Studio: v",qM]})]})}),ZM=ce(function(){return c.jsxs(k,{col:!0,space:"m",children:[c.jsx(k,{justify:"center",children:c.jsx(F,{className:K("relative"),children:c.jsx(xu,{className:K("w-24 opacity-50")})})}),c.jsx(F,{children:c.jsxs("p",{children:["We're excited to introduce the GrapesJS Studio SDK, an embeddable version of the Studio editor.",c.jsx("br",{}),c.jsx("br",{}),"The Studio SDK offers a powerful and flexible web editing experience that can be seamlessly integrated into your platform as a white-label editor. This enables your users to effortlessly create and manage content with advanced tools.",c.jsx("br",{}),c.jsx("br",{}),"You can try the initial release of the Studio SDK by creating a license and following the instructions on the"," ",c.jsx("a",{className:K(Fr.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:K(Fr.link),href:"https://forms.gle/VUycp3rc8iCpbh9k8",target:"_blank",rel:"noreferrer",children:"form"})," ","and we'll get back to you as soon as possible."]})})]})}),YM=()=>[{id:jt.web,label:$s(jt.web),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:G.web,size:oe.s}),c.jsx("span",{children:$s(jt.web)})]})},{id:jt.email,label:$s(jt.email),content:c.jsxs(k,{gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:G.emailOutline,size:oe.s}),c.jsx("span",{children:$s(jt.email)})]})}],kl="gs-cmp-tabs";function ro({tabs:e,className:t,classNamePanel:n,classNameTab:s,variant:r,style:o,onChange:i=Jw,value:a}){const l=r==="pills",u=l?M("gs-utl-rounded-full gs-utl-text-sm gs-utl-px-[2px] gs-utl-py-[2px]",B.bgH):"",d=v=>l?M("gs-utl-rounded-full gs-utl-px-3 gs-utl-py-1",v?B.bg:""):M("gs-utl-border-b-2",Ee.xy),f=v=>{v&&(v.tabIndex=-1)},p=v=>{const b=v.currentTarget;setTimeout(()=>b.blur(),10)},g=Dt(a)?e.findIndex(v=>v.id===a):void 0,m=!e.some(v=>!!v.content);return c.jsxs(zi.Group,{onChange:v=>i(e[v].id),defaultIndex:e.findIndex(v=>v.id===a),selectedIndex:g,children:[c.jsx(zi.List,{as:k,className:M(kl,t,u),style:o,full:!0,nowrap:!0,children:e.map(v=>c.jsx(zi,{disabled:v.disabled,className:({selected:b})=>M(`${kl}__tab`,"gs-utl-flex-1 focus:gs-utl-outline-none",v.disabled&&"gs-utl-cursor-not-allowed gs-utl-opacity-50",xa.focus,d(b),b?`${B.tAo} ${B.bA}`:B.br,s),children:v.label},v.id))}),c.jsx(zi.Panels,{className:M(`${kl}__panels`,"gs-utl-overflow-hidden gs-utl-flex-1",m&&"gs-utl-hidden",n),children:e.map(v=>c.jsx(zi.Panel,{tabIndex:-1,className:M(`${kl}__panel`,"gs-utl-h-full"),ref:f,onFocus:p,children:v.content},v.id))})]})}const wu=0,oo=1,ki=2,Cy=4;function jy(e,t){return n=>e(t(n))}function XM(e,t){return t(e)}function Ey(e,t){return n=>e(t,n)}function Mm(e,t){return()=>e(t)}function Su(e,t){return t(e),e}function Pt(...e){return e}function JM(e){e()}function Nm(e){return()=>e}function QM(...e){return()=>{e.map(JM)}}function fh(e){return e!==void 0}function Ri(){}function at(e,t){return e(oo,t)}function ke(e,t){e(wu,t)}function ph(e){e(ki)}function nn(e){return e(Cy)}function ye(e,t){return at(e,Ey(t,wu))}function Us(e,t){const n=e(oo,s=>{n(),t(s)});return n}function We(){const e=[];return(t,n)=>{switch(t){case ki:e.splice(0,e.length);return;case oo:return e.push(n),()=>{const s=e.indexOf(n);s>-1&&e.splice(s,1)};case wu:e.slice().forEach(s=>{s(n)});return;default:throw new Error(`unrecognized action ${t}`)}}}function fe(e){let t=e;const n=We();return(s,r)=>{switch(s){case oo:r(t);break;case wu:t=r;break;case Cy:return t}return n(s,r)}}function eN(e){let t,n;const s=()=>t&&t();return function(r,o){switch(r){case oo:return o?n===o?void 0:(s(),n=o,t=at(e,o),t):(s(),Ri);case ki:s(),n=null;return;default:throw new Error(`unrecognized action ${r}`)}}}function $n(e){return Su(We(),t=>ye(e,t))}function dn(e,t){return Su(fe(t),n=>ye(e,n))}function tN(...e){return t=>e.reduceRight(XM,t)}function le(e,...t){const n=tN(...t);return(s,r)=>{switch(s){case oo:return at(e,n(r));case ki:ph(e);return}}}function Ty(e,t){return e===t}function Et(e=Ty){let t;return n=>s=>{e(t,s)||(t=s,n(s))}}function Pe(e){return t=>n=>{e(n)&&t(n)}}function me(e){return t=>jy(t,e)}function As(e){return t=>()=>t(e)}function Rs(e,t){return n=>s=>n(t=e(t,s))}function Ei(e){return t=>n=>{e>0?e--:t(n)}}function kr(e){let t=null,n;return s=>r=>{t=r,!n&&(n=setTimeout(()=>{n=void 0,s(t)},e))}}function $m(e){let t,n;return s=>r=>{t=r,n&&clearTimeout(n),n=setTimeout(()=>{s(t)},e)}}function He(...e){const t=new Array(e.length);let n=0,s=null;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);at(o,l=>{const u=n;n=n|a,t[i]=l,u!==r&&n===r&&s&&(s(),s=null)})}),o=>i=>{const a=()=>o([i].concat(t));n===r?a():s=a}}function km(...e){return function(t,n){switch(t){case oo:return QM(...e.map(s=>at(s,n)));case ki:return;default:throw new Error(`unrecognized action ${t}`)}}}function Te(e,t=Ty){return le(e,Et(t))}function Wt(...e){const t=We(),n=new Array(e.length);let s=0;const r=Math.pow(2,e.length)-1;return e.forEach((o,i)=>{const a=Math.pow(2,i);at(o,l=>{n[i]=l,s=s|a,s===r&&ke(t,n)})}),function(o,i){switch(o){case oo:return s===r&&i(n),at(t,i);case ki:return ph(t);default:throw new Error(`unrecognized action ${o}`)}}}function lt(e,t=[],{singleton:n}={singleton:!0}){return{id:nN(),constructor:e,dependencies:t,singleton:n}}const nN=()=>Symbol();function sN(e){const t=new Map,n=({id:s,constructor:r,dependencies:o,singleton:i})=>{if(i&&t.has(s))return t.get(s);const a=r(o.map(l=>n(l)));return i&&t.set(s,a),a};return n(e)}function rN(e,t){const n={},s={};let r=0;const o=e.length;for(;r<o;)s[e[r]]=1,r+=1;for(const i in t)s.hasOwnProperty(i)||(n[i]=t[i]);return n}const Rl=typeof document<"u"?h.useLayoutEffect:h.useEffect;function Py(e,t,n){const s=Object.keys(t.required||{}),r=Object.keys(t.optional||{}),o=Object.keys(t.methods||{}),i=Object.keys(t.events||{}),a=h.createContext({});function l(x,y){x.propsReady&&ke(x.propsReady,!1);for(const w of s){const S=x[t.required[w]];ke(S,y[w])}for(const w of r)if(w in y){const S=x[t.optional[w]];ke(S,y[w])}x.propsReady&&ke(x.propsReady,!0)}function u(x){return o.reduce((y,w)=>(y[w]=S=>{const C=x[t.methods[w]];ke(C,S)},y),{})}function d(x){return i.reduce((y,w)=>(y[w]=eN(x[t.events[w]]),y),{})}const f=h.forwardRef((x,y)=>{const{children:w,...S}=x,[C]=h.useState(()=>Su(sN(e),O=>l(O,S))),[j]=h.useState(Mm(d,C));Rl(()=>{for(const O of i)O in S&&at(j[O],S[O]);return()=>{Object.values(j).map(ph)}},[S,j,C]),Rl(()=>{l(C,S)}),h.useImperativeHandle(y,Nm(u(C)));const E=n;return c.jsx(a.Provider,{value:C,children:n?c.jsx(E,{...rN([...s,...r,...i],S),children:w}):w})}),p=x=>h.useCallback(Ey(ke,h.useContext(a)[x]),[x]),g=x=>{const w=h.useContext(a)[x],S=h.useCallback(C=>at(w,C),[w]);return h.useSyncExternalStore(S,()=>nn(w),()=>nn(w))},m=x=>{const w=h.useContext(a)[x],[S,C]=h.useState(Mm(nn,w));return Rl(()=>at(w,j=>{j!==S&&C(Nm(j))}),[w,S]),S},v=h.version.startsWith("18")?g:m;return{Component:f,usePublisher:p,useEmitterValue:v,useEmitter:(x,y)=>{const S=h.useContext(a)[x];Rl(()=>at(S,y),[y,S])}}}const Oy=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 oN={0:"debug",1:"log",2:"warn",3:"error"},iN=()=>typeof globalThis>"u"?window:globalThis,io=lt(()=>{const e=fe(3);return{log:fe((n,s,r=1)=>{var o;const i=(o=iN().VIRTUOSO_LOG_LEVEL)!=null?o:nn(e);r>=i&&console[oN[r]]("%creact-virtuoso: %c%s %o","color: #0253b3; font-weight: bold","color: initial",n,s)}),logLevel:e}},[],{singleton:!0});function hh(e,t,n){const s=h.useRef(null);let r=o=>{};if(typeof ResizeObserver<"u"){const o=h.useMemo(()=>new ResizeObserver(i=>{const a=()=>{const l=i[0].target;l.offsetParent!==null&&e(l)};n?a():requestAnimationFrame(a)}),[e]);r=i=>{i&&t?(o.observe(i),s.current=i):(s.current&&o.unobserve(s.current),s.current=null)}}return{ref:s,callbackRef:r}}function Wo(e,t,n){return hh(e,t,n).callbackRef}function aN(e,t,n,s,r,o,i,a,l){const u=h.useCallback(d=>{const f=lN(d.children,t,a?"offsetWidth":"offsetHeight",r);let p=d.parentElement;for(;!p.dataset.virtuosoScroller;)p=p.parentElement;const g=p.lastElementChild.dataset.viewportType==="window",m=i?a?i.scrollLeft:i.scrollTop:g?a?window.pageXOffset||document.documentElement.scrollLeft:window.pageYOffset||document.documentElement.scrollTop:a?p.scrollLeft:p.scrollTop,v=i?a?i.scrollWidth:i.scrollHeight:g?a?document.documentElement.scrollWidth:document.documentElement.scrollHeight:a?p.scrollWidth:p.scrollHeight,b=i?a?i.offsetWidth:i.offsetHeight:g?a?window.innerWidth:window.innerHeight:a?p.offsetWidth:p.offsetHeight;s({scrollTop:Math.max(m,0),scrollHeight:v,viewportHeight:b}),o==null||o(a?Rm("column-gap",getComputedStyle(d).columnGap,r):Rm("row-gap",getComputedStyle(d).rowGap,r)),f!==null&&e(f)},[e,t,r,o,i,s]);return hh(u,n,l)}function lN(e,t,n,s){const r=e.length;if(r===0)return null;const o=[];for(let i=0;i<r;i++){const a=e.item(i);if(!a||a.dataset.index===void 0)continue;const l=parseInt(a.dataset.index),u=parseFloat(a.dataset.knownSize),d=t(a,n);if(d===0&&s("Zero-sized element, this should not happen",{child:a},kn.ERROR),d===u)continue;const f=o[o.length-1];o.length===0||f.size!==d||f.endIndex!==l-1?o.push({startIndex:l,endIndex:l,size:d}):o[o.length-1].endIndex++}return o}function Rm(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 qr(e,t){return Math.round(e.getBoundingClientRect()[t])}function _y(e,t){return Math.abs(e-t)<1.01}function Ay(e,t,n,s=Ri,r,o){const i=h.useRef(null),a=h.useRef(null),l=h.useRef(null),u=h.useCallback(p=>{const g=p.target,m=g===window||g===document,v=o?m?window.pageXOffset||document.documentElement.scrollLeft:g.scrollLeft:m?window.pageYOffset||document.documentElement.scrollTop:g.scrollTop,b=o?m?document.documentElement.scrollWidth:g.scrollWidth:m?document.documentElement.scrollHeight:g.scrollHeight,x=o?m?window.innerWidth:g.offsetWidth:m?window.innerHeight:g.offsetHeight,y=()=>{e({scrollTop:Math.max(v,0),scrollHeight:b,viewportHeight:x})};p.suppressFlushSync?y():Gn.flushSync(y),a.current!==null&&(v===a.current||v<=0||v===b-x)&&(a.current=null,t(!0),l.current&&(clearTimeout(l.current),l.current=null))},[e,t]);h.useEffect(()=>{const p=r||i.current;return s(r||i.current),u({target:p,suppressFlushSync:!0}),p.addEventListener("scroll",u,{passive:!0}),()=>{s(null),p.removeEventListener("scroll",u)}},[i,u,n,s,r]);function d(p){const g=i.current;if(!g||(o?"offsetWidth"in g&&g.offsetWidth===0:"offsetHeight"in g&&g.offsetHeight===0))return;const m=p.behavior==="smooth";let v,b,x;g===window?(b=Math.max(qr(document.documentElement,o?"width":"height"),o?document.documentElement.scrollWidth:document.documentElement.scrollHeight),v=o?window.innerWidth:window.innerHeight,x=o?document.documentElement.scrollLeft:document.documentElement.scrollTop):(b=g[o?"scrollWidth":"scrollHeight"],v=qr(g,o?"width":"height"),x=g[o?"scrollLeft":"scrollTop"]);const y=b-v;if(p.top=Math.ceil(Math.max(Math.min(y,p.top),0)),_y(v,b)||p.top===x){e({scrollTop:x,scrollHeight:b,viewportHeight:v}),m&&t(!0);return}m?(a.current=p.top,l.current&&clearTimeout(l.current),l.current=setTimeout(()=>{l.current=null,a.current=null,t(!0)},1e3)):a.current=null,o&&(p={left:p.top,behavior:p.behavior}),g.scrollTo(p)}function f(p){o&&(p={left:p.top,behavior:p.behavior}),i.current.scrollBy(p)}return{scrollerRef:i,scrollByCallback:f,scrollToCallback:d}}const hn=lt(()=>{const e=We(),t=We(),n=fe(0),s=We(),r=fe(0),o=We(),i=We(),a=fe(0),l=fe(0),u=fe(0),d=fe(0),f=We(),p=We(),g=fe(!1),m=fe(!1),v=fe(!1);return ye(le(e,me(({scrollTop:b})=>b)),t),ye(le(e,me(({scrollHeight:b})=>b)),i),ye(t,r),{scrollContainerState:e,scrollTop:t,viewportHeight:o,headerHeight:a,fixedHeaderHeight:l,fixedFooterHeight:u,footerHeight:d,scrollHeight:i,smoothScrollTargetReached:s,horizontalDirection:m,skipAnimationFrameInResizeObserver:v,scrollTo:f,scrollBy:p,statefulScrollTop:r,deviation:n,scrollingInProgress:g}},[],{singleton:!0}),Oa={lvl:0};function Ly(e,t,n,s=Oa,r=Oa){return{k:e,v:t,lvl:n,l:s,r}}function mt(e){return e===Oa}function hi(){return Oa}function Nf(e,t){if(mt(e))return Oa;const{k:n,l:s,r}=e;if(t===n){if(mt(s))return r;if(mt(r))return s;{const[o,i]=My(s);return dc(Vt(e,{k:o,v:i,l:Ny(s)}))}}else return t<n?dc(Vt(e,{l:Nf(s,t)})):dc(Vt(e,{r:Nf(r,t)}))}function _a(e,t){if(!mt(e))return t===e.k?e.v:t<e.k?_a(e.l,t):_a(e.r,t)}function vs(e,t,n="k"){if(mt(e))return[-1/0,void 0];if(Number(e[n])===t)return[e.k,e.v];if(Number(e[n])<t){const s=vs(e.r,t,n);return s[0]===-1/0?[e.k,e.v]:s}return vs(e.l,t,n)}function Ln(e,t,n){return mt(e)?Ly(t,n,1):t===e.k?Vt(e,{k:t,v:n}):t<e.k?Im(Vt(e,{l:Ln(e.l,t,n)})):Im(Vt(e,{r:Ln(e.r,t,n)}))}function $f(e,t,n){if(mt(e))return[];const{k:s,v:r,l:o,r:i}=e;let a=[];return s>t&&(a=a.concat($f(o,t,n))),s>=t&&s<=n&&a.push({k:s,v:r}),s<=n&&(a=a.concat($f(i,t,n))),a}function wo(e){return mt(e)?[]:[...wo(e.l),{k:e.k,v:e.v},...wo(e.r)]}function My(e){return mt(e.r)?[e.k,e.v]:My(e.r)}function Ny(e){return mt(e.r)?e.l:dc(Vt(e,{r:Ny(e.r)}))}function Vt(e,t){return Ly(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 Cd(e){return mt(e)||e.lvl>e.r.lvl}function Im(e){return kf(ky(e))}function dc(e){const{l:t,r:n,lvl:s}=e;if(n.lvl>=s-1&&t.lvl>=s-1)return e;if(s>n.lvl+1){if(Cd(t))return ky(Vt(e,{lvl:s-1}));if(!mt(t)&&!mt(t.r))return Vt(t.r,{l:Vt(t,{r:t.r.l}),r:Vt(e,{l:t.r.r,lvl:s-1}),lvl:s});throw new Error("Unexpected empty nodes")}else{if(Cd(e))return kf(Vt(e,{lvl:s-1}));if(!mt(n)&&!mt(n.l)){const r=n.l,o=Cd(r)?n.lvl-1:n.lvl;return Vt(r,{l:Vt(e,{r:r.l,lvl:s-1}),r:kf(Vt(n,{l:r.r,lvl:o})),lvl:r.lvl+1})}else throw new Error("Unexpected empty nodes")}}function Cu(e,t,n){if(mt(e))return[];const s=vs(e,t)[0];return cN($f(e,s,n))}function $y(e,t){const n=e.length;if(n===0)return[];let{index:s,value:r}=t(e[0]);const o=[];for(let i=1;i<n;i++){const{index:a,value:l}=t(e[i]);o.push({start:s,end:a-1,value:r}),s=a,r=l}return o.push({start:s,end:1/0,value:r}),o}function cN(e){return $y(e,({k:t,v:n})=>({index:t,value:n}))}function kf(e){const{r:t,lvl:n}=e;return!mt(t)&&!mt(t.r)&&t.lvl===n&&t.r.lvl===n?Vt(t,{l:Vt(e,{r:t.l}),lvl:n+1}):e}function ky(e){const{l:t}=e;return!mt(t)&&t.lvl===e.lvl?Vt(t,{r:Vt(e,{l:t.r})}):e}function Mc(e,t,n,s=0){let r=e.length-1;for(;s<=r;){const o=Math.floor((s+r)/2),i=e[o],a=n(i,t);if(a===0)return o;if(a===-1){if(r-s<2)return o-1;r=o-1}else{if(r===s)return o;s=o+1}}throw new Error(`Failed binary finding record in array - ${e.join(",")}, searched for ${t}`)}function Ry(e,t,n){return e[Mc(e,t,n)]}function uN(e,t,n,s){const r=Mc(e,t,s),o=Mc(e,n,s,r);return e.slice(r,o+1)}const gh=lt(()=>({recalcInProgress:fe(!1)}),[],{singleton:!0});function dN(e){const{size:t,startIndex:n,endIndex:s}=e;return r=>r.start===n&&(r.end===s||r.end===1/0)&&r.value===t}function Vm(e,t){let n=0,s=0;for(;n<e;)n+=t[s+1]-t[s]-1,s++;return s-(n===e?0:1)}function fN(e,t){let n=mt(e)?0:1/0;for(const s of t){const{size:r,startIndex:o,endIndex:i}=s;if(n=Math.min(n,o),mt(e)){e=Ln(e,0,r);continue}const a=Cu(e,o-1,i+1);if(a.some(dN(s)))continue;let l=!1,u=!1;for(const{start:d,end:f,value:p}of a)l?(i>=d||r===p)&&(e=Nf(e,d)):(u=p!==r,l=!0),f>i&&i>=d&&p!==r&&(e=Ln(e,i+1,p));u&&(e=Ln(e,o,r))}return[e,n]}function pN(){return{offsetTree:[],sizeTree:hi(),groupOffsetTree:hi(),lastIndex:0,lastOffset:0,lastSize:0,groupIndices:[]}}function mh({index:e},t){return t===e?0:t<e?-1:1}function hN({offset:e},t){return t===e?0:t<e?-1:1}function gN(e){return{index:e.index,value:e}}function mN(e,t,n,s=0){return s>0&&(t=Math.max(t,Ry(e,s,mh).offset)),$y(uN(e,t,n,hN),gN)}function Rf(e,t,n,s){let r=e,o=0,i=0,a=0,l=0;if(t!==0){l=Mc(r,t-1,mh),a=r[l].offset;const d=vs(n,t-1);o=d[0],i=d[1],r.length&&r[l].size===vs(n,t)[1]&&(l-=1),r=r.slice(0,l+1)}else r=[];for(const{start:u,value:d}of Cu(n,t,1/0)){const f=u-o,p=f*i+a+f*s;r.push({offset:p,size:d,index:u}),o=u,a=p,i=d}return{offsetTree:r,lastIndex:o,lastOffset:a,lastSize:i}}function vN(e,[t,n,s,r]){t.length>0&&s("received item sizes",t,kn.DEBUG);const o=e.sizeTree;let i=o,a=0;if(n.length>0&&mt(o)&&t.length===2){const p=t[0].size,g=t[1].size;i=n.reduce((m,v)=>Ln(Ln(m,v,p),v+1,g),i)}else[i,a]=fN(i,t);if(i===o)return e;const{offsetTree:l,lastIndex:u,lastSize:d,lastOffset:f}=Rf(e.offsetTree,a,i,r);return{sizeTree:i,offsetTree:l,lastIndex:u,lastOffset:f,lastSize:d,groupOffsetTree:n.reduce((p,g)=>Ln(p,g,Aa(g,l,r)),hi()),groupIndices:n}}function Aa(e,t,n){if(t.length===0)return 0;const{offset:s,index:r,size:o}=Ry(t,e,mh),i=e-r,a=o*i+(i-1)*n+s;return a>0?a+n:a}function bN(e){return typeof e.groupIndex<"u"}function Iy(e,t,n){if(bN(e))return t.groupIndices[e.groupIndex]+1;{const s=e.index==="LAST"?n:e.index;let r=Vy(s,t);return r=Math.max(0,r,Math.min(n,r)),r}}function Vy(e,t){if(!ju(t))return e;let n=0;for(;t.groupIndices[n]<=e+n;)n++;return e+n}function ju(e){return!mt(e.groupOffsetTree)}function yN(e){return wo(e).map(({k:t,v:n},s,r)=>{const o=r[s+1],i=o?o.k-1:1/0;return{startIndex:t,endIndex:i,size:n}})}const xN={offsetHeight:"height",offsetWidth:"width"},Zs=lt(([{log:e},{recalcInProgress:t}])=>{const n=We(),s=We(),r=dn(s,0),o=We(),i=We(),a=fe(0),l=fe([]),u=fe(void 0),d=fe(void 0),f=fe((C,j)=>qr(C,xN[j])),p=fe(void 0),g=fe(0),m=pN(),v=dn(le(n,He(l,e,g),Rs(vN,m),Et()),m),b=dn(le(l,Et(),Rs((C,j)=>({prev:C.current,current:j}),{prev:[],current:[]}),me(({prev:C})=>C)),[]);ye(le(l,Pe(C=>C.length>0),He(v,g),me(([C,j,E])=>{const O=C.reduce((P,T,_)=>Ln(P,T,Aa(T,j.offsetTree,E)||_),hi());return{...j,groupIndices:C,groupOffsetTree:O}})),v),ye(le(s,He(v),Pe(([C,{lastIndex:j}])=>C<j),me(([C,{lastIndex:j,lastSize:E}])=>[{startIndex:C,endIndex:j,size:E}])),n),ye(u,d);const x=dn(le(u,me(C=>C===void 0)),!0);ye(le(d,Pe(C=>C!==void 0&&mt(nn(v).sizeTree)),me(C=>[{startIndex:0,endIndex:0,size:C}])),n);const y=$n(le(n,He(v),Rs(({sizes:C},[j,E])=>({changed:E!==C,sizes:E}),{changed:!1,sizes:m}),me(C=>C.changed)));at(le(a,Rs((C,j)=>({diff:C.prev-j,prev:j}),{diff:0,prev:0}),me(C=>C.diff)),C=>{const{groupIndices:j}=nn(v);if(C>0)ke(t,!0),ke(o,C+Vm(C,j));else if(C<0){const E=nn(b);E.length>0&&(C-=Vm(-C,E)),ke(i,C)}}),at(le(a,He(e)),([C,j])=>{C<0&&j("`firstItemIndex` prop should not be set to less than zero. If you don't know the total count, just use a very high value",{firstItemIndex:a},kn.ERROR)});const w=$n(o);ye(le(o,He(v),me(([C,j])=>{const E=j.groupIndices.length>0,O=[],P=j.lastSize;if(E){const T=_a(j.sizeTree,0);let _=0,L=0;for(;_<C;){const A=j.groupIndices[L],H=j.groupIndices.length===L+1?1/0:j.groupIndices[L+1]-A-1;O.push({startIndex:A,endIndex:A,size:T}),O.push({startIndex:A+1,endIndex:A+1+H-1,size:P}),L++,_+=H+1}const N=wo(j.sizeTree);return _!==C&&N.shift(),N.reduce((A,{k:H,v:U})=>{let D=A.ranges;return A.prevSize!==0&&(D=[...A.ranges,{startIndex:A.prevIndex,endIndex:H+C-1,size:A.prevSize}]),{ranges:D,prevIndex:H+C,prevSize:U}},{ranges:O,prevIndex:C,prevSize:0}).ranges}return wo(j.sizeTree).reduce((T,{k:_,v:L})=>({ranges:[...T.ranges,{startIndex:T.prevIndex,endIndex:_+C-1,size:T.prevSize}],prevIndex:_+C,prevSize:L}),{ranges:[],prevIndex:0,prevSize:P}).ranges})),n);const S=$n(le(i,He(v,g),me(([C,{offsetTree:j},E])=>{const O=-C;return Aa(O,j,E)})));return ye(le(i,He(v,g),me(([C,j,E])=>{if(j.groupIndices.length>0){if(mt(j.sizeTree))return j;let P=hi();const T=nn(b);let _=0,L=0,N=0;for(;_<-C;){N=T[L];const A=T[L+1]-N-1;L++,_+=A+1}if(P=wo(j.sizeTree).reduce((A,{k:H,v:U})=>Ln(A,Math.max(0,H+C),U),P),_!==-C){const A=_a(j.sizeTree,N);P=Ln(P,0,A);const H=vs(j.sizeTree,-C+1)[1];P=Ln(P,1,H)}return{...j,sizeTree:P,...Rf(j.offsetTree,0,P,E)}}else{const P=wo(j.sizeTree).reduce((T,{k:_,v:L})=>Ln(T,Math.max(0,_+C),L),hi());return{...j,sizeTree:P,...Rf(j.offsetTree,0,P,E)}}})),v),{data:p,totalCount:s,sizeRanges:n,groupIndices:l,defaultItemSize:d,fixedItemSize:u,unshiftWith:o,shiftWith:i,shiftWithOffset:S,beforeUnshiftWith:w,firstItemIndex:a,gap:g,sizes:v,listRefresh:y,statefulTotalCount:r,trackItemSizes:x,itemSize:f}},Pt(io,gh),{singleton:!0}),wN=typeof document<"u"&&"scrollBehavior"in document.documentElement.style;function Hy(e){const t=typeof e=="number"?{index:e}:e;return t.align||(t.align="start"),(!t.behavior||!wN)&&(t.behavior="auto"),t.offset||(t.offset=0),t}const fl=lt(([{sizes:e,totalCount:t,listRefresh:n,gap:s},{scrollingInProgress:r,viewportHeight:o,scrollTo:i,smoothScrollTargetReached:a,headerHeight:l,footerHeight:u,fixedHeaderHeight:d,fixedFooterHeight:f},{log:p}])=>{const g=We(),m=We(),v=fe(0);let b=null,x=null,y=null;function w(){b&&(b(),b=null),y&&(y(),y=null),x&&(clearTimeout(x),x=null),ke(r,!1)}return ye(le(g,He(e,o,t,v,l,u,p),He(s,d,f),me(([[S,C,j,E,O,P,T,_],L,N,V])=>{const A=Hy(S),{align:H,behavior:U,offset:D}=A,$=E-1,I=Iy(A,C,$);let R=Aa(I,C.offsetTree,L)+P;H==="end"?(R+=N+vs(C.sizeTree,I)[1]-j+V,I===$&&(R+=T)):H==="center"?R+=(N+vs(C.sizeTree,I)[1]-j+V)/2:R-=O,D&&(R+=D);const z=X=>{w(),X?(_("retrying to scroll to",{location:S},kn.DEBUG),ke(g,S)):(ke(m,!0),_("list did not change, scroll successful",{},kn.DEBUG))};if(w(),U==="smooth"){let X=!1;y=at(n,Z=>{X=X||Z}),b=Us(a,()=>{z(X)})}else b=Us(le(n,SN(150)),z);return x=setTimeout(()=>{w()},1200),ke(r,!0),_("scrolling from index to",{index:I,top:R,behavior:U},kn.DEBUG),{top:R,behavior:U}})),i),{scrollToIndex:g,scrollTargetReached:m,topListHeight:v}},Pt(Zs,hn,io),{singleton:!0});function SN(e){return t=>{const n=setTimeout(()=>{t(!1)},e);return s=>{s&&(t(!0),clearTimeout(n))}}}const La="up",la="down",CN="none",jN={atBottom:!1,notAtBottomBecause:"NOT_SHOWING_LAST_ITEM",state:{offsetBottom:0,scrollTop:0,viewportHeight:0,scrollHeight:0}},EN=0,pl=lt(([{scrollContainerState:e,scrollTop:t,viewportHeight:n,headerHeight:s,footerHeight:r,scrollBy:o}])=>{const i=fe(!1),a=fe(!0),l=We(),u=We(),d=fe(4),f=fe(EN),p=dn(le(km(le(Te(t),Ei(1),As(!0)),le(Te(t),Ei(1),As(!1),$m(100))),Et()),!1),g=dn(le(km(le(o,As(!0)),le(o,As(!1),$m(200))),Et()),!1);ye(le(Wt(Te(t),Te(f)),me(([y,w])=>y<=w),Et()),a),ye(le(a,kr(50)),u);const m=$n(le(Wt(e,Te(n),Te(s),Te(r),Te(d)),Rs((y,[{scrollTop:w,scrollHeight:S},C,j,E,O])=>{const P=w+C-S>-O,T={viewportHeight:C,scrollTop:w,scrollHeight:S};if(P){let L,N;return w>y.state.scrollTop?(L="SCROLLED_DOWN",N=y.state.scrollTop-w):(L="SIZE_DECREASED",N=y.state.scrollTop-w||y.scrollTopDelta),{atBottom:!0,state:T,atBottomBecause:L,scrollTopDelta:N}}let _;return T.scrollHeight>y.state.scrollHeight?_="SIZE_INCREASED":C<y.state.viewportHeight?_="VIEWPORT_HEIGHT_DECREASING":w<y.state.scrollTop?_="SCROLLING_UPWARDS":_="NOT_FULLY_SCROLLED_TO_LAST_ITEM_BOTTOM",{atBottom:!1,notAtBottomBecause:_,state:T}},jN),Et((y,w)=>y&&y.atBottom===w.atBottom))),v=dn(le(e,Rs((y,{scrollTop:w,scrollHeight:S,viewportHeight:C})=>{if(_y(y.scrollHeight,S))return{scrollTop:w,scrollHeight:S,jump:0,changed:!1};{const j=S-(w+C)<1;return y.scrollTop!==w&&j?{scrollHeight:S,scrollTop:w,jump:y.scrollTop-w,changed:!0}:{scrollHeight:S,scrollTop:w,jump:0,changed:!0}}},{scrollHeight:0,jump:0,scrollTop:0,changed:!1}),Pe(y=>y.changed),me(y=>y.jump)),0);ye(le(m,me(y=>y.atBottom)),i),ye(le(i,kr(50)),l);const b=fe(la);ye(le(e,me(({scrollTop:y})=>y),Et(),Rs((y,w)=>nn(g)?{direction:y.direction,prevScrollTop:w}:{direction:w<y.prevScrollTop?La:la,prevScrollTop:w},{direction:la,prevScrollTop:0}),me(y=>y.direction)),b),ye(le(e,kr(50),As(CN)),b);const x=fe(0);return ye(le(p,Pe(y=>!y),As(0)),x),ye(le(t,kr(100),He(p),Pe(([y,w])=>!!w),Rs(([y,w],[S])=>[w,S],[0,0]),me(([y,w])=>w-y)),x),{isScrolling:p,isAtTop:a,isAtBottom:i,atBottomState:m,atTopStateChange:u,atBottomStateChange:l,scrollDirection:b,atBottomThreshold:d,atTopThreshold:f,scrollVelocity:x,lastJumpDueToItemResize:v}},Pt(hn)),ao=lt(([{log:e}])=>{const t=fe(!1),n=$n(le(t,Pe(s=>s),Et()));return at(t,s=>{s&&nn(e)("props updated",{},kn.DEBUG)}),{propsReady:t,didMount:n}},Pt(io),{singleton:!0});function vh(e,t){e==0?t():requestAnimationFrame(()=>vh(e-1,t))}function bh(e,t){const n=t-1;return typeof e=="number"?e:e.index==="LAST"?n:e.index}const hl=lt(([{sizes:e,listRefresh:t,defaultItemSize:n},{scrollTop:s},{scrollToIndex:r,scrollTargetReached:o},{didMount:i}])=>{const a=fe(!0),l=fe(0),u=fe(!0);return ye(le(i,He(l),Pe(([d,f])=>!!f),As(!1)),a),ye(le(i,He(l),Pe(([d,f])=>!!f),As(!1)),u),at(le(Wt(t,i),He(a,e,n,u),Pe(([[,d],f,{sizeTree:p},g,m])=>d&&(!mt(p)||fh(g))&&!f&&!m),He(l)),([,d])=>{Us(o,()=>{ke(u,!0)}),vh(4,()=>{Us(s,()=>{ke(a,!0)}),ke(r,d)})}),{scrolledToInitialItem:a,initialTopMostItemIndex:l,initialItemFinalLocationReached:u}},Pt(Zs,hn,fl,ao),{singleton:!0});function Hm(e){return e?e==="smooth"?"smooth":"auto":!1}const TN=(e,t)=>typeof e=="function"?Hm(e(t)):t&&Hm(e),PN=lt(([{totalCount:e,listRefresh:t},{isAtBottom:n,atBottomState:s},{scrollToIndex:r},{scrolledToInitialItem:o},{propsReady:i,didMount:a},{log:l},{scrollingInProgress:u}])=>{const d=fe(!1),f=We();let p=null;function g(v){ke(r,{index:"LAST",align:"end",behavior:v})}at(le(Wt(le(Te(e),Ei(1)),a),He(Te(d),n,o,u),me(([[v,b],x,y,w,S])=>{let C=b&&w,j="auto";return C&&(j=TN(x,y||S),C=C&&!!j),{totalCount:v,shouldFollow:C,followOutputBehavior:j}}),Pe(({shouldFollow:v})=>v)),({totalCount:v,followOutputBehavior:b})=>{p&&(p(),p=null),p=Us(t,()=>{nn(l)("following output to ",{totalCount:v},kn.DEBUG),g(b),p=null})});function m(v){const b=Us(s,x=>{v&&!x.atBottom&&x.notAtBottomBecause==="SIZE_INCREASED"&&!p&&(nn(l)("scrolling to bottom due to increased size",{},kn.DEBUG),g("auto"))});setTimeout(b,100)}return at(le(Wt(Te(d),e,i),Pe(([v,,b])=>v&&b),Rs(({value:v},[,b])=>({refreshed:v===b,value:b}),{refreshed:!1,value:0}),Pe(({refreshed:v})=>v),He(d,e)),([,v])=>{nn(o)&&m(v!==!1)}),at(f,()=>{m(nn(d)!==!1)}),at(Wt(Te(d),s),([v,b])=>{v&&!b.atBottom&&b.notAtBottomBecause==="VIEWPORT_HEIGHT_DECREASING"&&g("auto")}),{followOutput:d,autoscrollToBottom:f}},Pt(Zs,pl,fl,hl,ao,io,hn));function ON(e){return e.reduce((t,n)=>(t.groupIndices.push(t.totalCount),t.totalCount+=n+1,t),{totalCount:0,groupIndices:[]})}const Dy=lt(([{totalCount:e,groupIndices:t,sizes:n},{scrollTop:s,headerHeight:r}])=>{const o=We(),i=We(),a=$n(le(o,me(ON)));return ye(le(a,me(l=>l.totalCount)),e),ye(le(a,me(l=>l.groupIndices)),t),ye(le(Wt(s,n,r),Pe(([l,u])=>ju(u)),me(([l,u,d])=>vs(u.groupOffsetTree,Math.max(l-d,0),"v")[0]),Et(),me(l=>[l])),i),{groupCounts:o,topItemsIndexes:i}},Pt(Zs,hn));function Ma(e,t){return!!(e&&e[0]===t[0]&&e[1]===t[1])}function Fy(e,t){return!!(e&&e.startIndex===t.startIndex&&e.endIndex===t.endIndex)}const Nc="top",$c="bottom",Dm="none";function Fm(e,t,n){return typeof e=="number"?n===La&&t===Nc||n===la&&t===$c?e:0:n===La?t===Nc?e.main:e.reverse:t===$c?e.main:e.reverse}function Bm(e,t){return typeof e=="number"?e:e[t]||0}const yh=lt(([{scrollTop:e,viewportHeight:t,deviation:n,headerHeight:s,fixedHeaderHeight:r}])=>{const o=We(),i=fe(0),a=fe(0),l=fe(0),u=dn(le(Wt(Te(e),Te(t),Te(s),Te(o,Ma),Te(l),Te(i),Te(r),Te(n),Te(a)),me(([d,f,p,[g,m],v,b,x,y,w])=>{const S=d-y,C=b+x,j=Math.max(p-S,0);let E=Dm;const O=Bm(w,Nc),P=Bm(w,$c);return g-=y,g+=p+x,m+=p+x,m-=y,g>d+C-O&&(E=La),m<d-j+f+P&&(E=la),E!==Dm?[Math.max(S-p-Fm(v,Nc,E)-O,0),S-j-x+f+Fm(v,$c,E)+P]:null}),Pe(d=>d!=null),Et(Ma)),[0,0]);return{listBoundary:o,overscan:l,topListHeight:i,increaseViewportBy:a,visibleRange:u}},Pt(hn),{singleton:!0});function _N(e,t,n){if(ju(t)){const s=Vy(e,t);return[{index:vs(t.groupOffsetTree,s)[0],size:0,offset:0},{index:s,size:0,offset:0,data:n&&n[0]}]}return[{index:e,size:0,offset:0,data:n&&n[0]}]}const jd={items:[],topItems:[],offsetTop:0,offsetBottom:0,top:0,bottom:0,topListHeight:0,totalCount:0,firstItemIndex:0};function zm(e,t,n){if(e.length===0)return[];if(!ju(t))return e.map(u=>({...u,index:u.index+n,originalIndex:u.index}));const s=e[0].index,r=e[e.length-1].index,o=[],i=Cu(t.groupOffsetTree,s,r);let a,l=0;for(const u of e){(!a||a.end<u.index)&&(a=i.shift(),l=t.groupIndices.indexOf(a.start));let d;u.index===a.start?d={type:"group",index:l}:d={index:u.index-(l+1)+n,groupIndex:l},o.push({...d,size:u.size,offset:u.offset,originalIndex:u.index,data:u.data})}return o}function fc(e,t,n,s,r,o){const{lastSize:i,lastOffset:a,lastIndex:l}=r;let u=0,d=0;if(e.length>0){u=e[0].offset;const v=e[e.length-1];d=v.offset+v.size}const f=n-l,p=a+f*i+(f-1)*s,g=u,m=p-d;return{items:zm(e,r,o),topItems:zm(t,r,o),topListHeight:t.reduce((v,b)=>b.size+v,0),offsetTop:u,offsetBottom:m,top:g,bottom:d,totalCount:n,firstItemIndex:o}}function By(e,t,n,s,r,o){let i=0;if(n.groupIndices.length>0)for(const d of n.groupIndices){if(d-i>=e)break;i++}const a=e+i,l=bh(t,a),u=Array.from({length:a}).map((d,f)=>({index:f+l,size:0,offset:0,data:o[f+l]}));return fc(u,[],a,r,n,s)}const Go=lt(([{sizes:e,totalCount:t,data:n,firstItemIndex:s,gap:r},o,{visibleRange:i,listBoundary:a,topListHeight:l},{scrolledToInitialItem:u,initialTopMostItemIndex:d},{topListHeight:f},p,{didMount:g},{recalcInProgress:m}])=>{const v=fe([]),b=fe(0),x=We();ye(o.topItemsIndexes,v);const y=dn(le(Wt(g,m,Te(i,Ma),Te(t),Te(e),Te(d),u,Te(v),Te(s),Te(r),n),Pe(([j,E,,O,,,,,,,P])=>{const T=P&&P.length!==O;return j&&!E&&!T}),me(([,,[j,E],O,P,T,_,L,N,V,A])=>{const H=P,{sizeTree:U,offsetTree:D}=H,$=nn(b);if(O===0)return{...jd,totalCount:O};if(j===0&&E===0)return $===0?{...jd,totalCount:O}:By($,T,P,N,V,A||[]);if(mt(U))return $>0?null:fc(_N(bh(T,O),H,A),[],O,V,H,N);const I=[];if(L.length>0){const Y=L[0],J=L[L.length-1];let ee=0;for(const W of Cu(U,Y,J)){const Q=W.value,ae=Math.max(W.start,Y),ge=Math.min(W.end,J);for(let Ce=ae;Ce<=ge;Ce++)I.push({index:Ce,size:Q,offset:ee,data:A&&A[Ce]}),ee+=Q}}if(!_)return fc([],I,O,V,H,N);const R=L.length>0?L[L.length-1]+1:0,z=mN(D,j,E,R);if(z.length===0)return null;const X=O-1,Z=Su([],Y=>{for(const J of z){const ee=J.value;let W=ee.offset,Q=J.start;const ae=ee.size;if(ee.offset<j){Q+=Math.floor((j-ee.offset+V)/(ae+V));const Ce=Q-J.start;W+=Ce*ae+Ce*V}Q<R&&(W+=(R-Q)*ae,Q=R);const ge=Math.min(J.end,X);for(let Ce=Q;Ce<=ge&&!(W>=E);Ce++)Y.push({index:Ce,size:ae,offset:W,data:A&&A[Ce]}),W+=ae+V}});return fc(Z,I,O,V,H,N)}),Pe(j=>j!==null),Et()),jd);ye(le(n,Pe(fh),me(j=>j==null?void 0:j.length)),t),ye(le(y,me(j=>j.topListHeight)),f),ye(f,l),ye(le(y,me(j=>[j.top,j.bottom])),a),ye(le(y,me(j=>j.items)),x);const w=$n(le(y,Pe(({items:j})=>j.length>0),He(t,n),Pe(([{items:j},E])=>j[j.length-1].originalIndex===E-1),me(([,j,E])=>[j-1,E]),Et(Ma),me(([j])=>j))),S=$n(le(y,kr(200),Pe(({items:j,topItems:E})=>j.length>0&&j[0].originalIndex===E.length),me(({items:j})=>j[0].index),Et())),C=$n(le(y,Pe(({items:j})=>j.length>0),me(({items:j})=>{let E=0,O=j.length-1;for(;j[E].type==="group"&&E<O;)E++;for(;j[O].type==="group"&&O>E;)O--;return{startIndex:j[E].index,endIndex:j[O].index}}),Et(Fy)));return{listState:y,topItemsIndexes:v,endReached:w,startReached:S,rangeChanged:C,itemsRendered:x,initialItemCount:b,...p}},Pt(Zs,Dy,yh,hl,fl,pl,ao,gh),{singleton:!0}),AN=lt(([{sizes:e,firstItemIndex:t,data:n,gap:s},{initialTopMostItemIndex:r},{initialItemCount:o,listState:i},{didMount:a}])=>(ye(le(a,He(o),Pe(([,l])=>l!==0),He(r,e,t,s,n),me(([[,l],u,d,f,p,g=[]])=>By(l,u,d,f,p,g))),i),{}),Pt(Zs,hl,Go,ao),{singleton:!0}),zy=lt(([{scrollVelocity:e}])=>{const t=fe(!1),n=We(),s=fe(!1);return ye(le(e,He(s,t,n),Pe(([r,o])=>!!o),me(([r,o,i,a])=>{const{exit:l,enter:u}=o;if(i){if(l(r,a))return!1}else if(u(r,a))return!0;return i}),Et()),t),at(le(Wt(t,e,n),He(s)),([[r,o,i],a])=>r&&a&&a.change&&a.change(o,i)),{isSeeking:t,scrollSeekConfiguration:s,scrollVelocity:e,scrollSeekRangeChanged:n}},Pt(pl),{singleton:!0}),LN=lt(([{topItemsIndexes:e}])=>{const t=fe(0);return ye(le(t,Pe(n=>n>0),me(n=>Array.from({length:n}).map((s,r)=>r))),e),{topItemCount:t}},Pt(Go)),Uy=lt(([{footerHeight:e,headerHeight:t,fixedHeaderHeight:n,fixedFooterHeight:s},{listState:r}])=>{const o=We(),i=dn(le(Wt(e,s,t,n,r),me(([a,l,u,d,f])=>a+l+u+d+f.offsetBottom+f.bottom)),0);return ye(Te(i),o),{totalListHeight:i,totalListHeightChanged:o}},Pt(hn,Go),{singleton:!0});function Wy(e){let t=!1,n;return()=>(t||(t=!0,n=e()),n)}const MN=Wy(()=>/iP(ad|od|hone)/i.test(navigator.userAgent)&&/WebKit/i.test(navigator.userAgent)),NN=lt(([{scrollBy:e,scrollTop:t,deviation:n,scrollingInProgress:s},{isScrolling:r,isAtBottom:o,scrollDirection:i,lastJumpDueToItemResize:a},{listState:l},{beforeUnshiftWith:u,shiftWithOffset:d,sizes:f,gap:p},{log:g},{recalcInProgress:m}])=>{const v=$n(le(l,He(a),Rs(([,x,y,w],[{items:S,totalCount:C,bottom:j,offsetBottom:E},O])=>{const P=j+E;let T=0;return y===C&&x.length>0&&S.length>0&&(S[0].originalIndex===0&&x[0].originalIndex===0||(T=P-w,T!==0&&(T+=O))),[T,S,C,P]},[0,[],0,0]),Pe(([x])=>x!==0),He(t,i,s,o,g,m),Pe(([,x,y,w,,,S])=>!S&&!w&&x!==0&&y===La),me(([[x],,,,,y])=>(y("Upward scrolling compensation",{amount:x},kn.DEBUG),x))));function b(x){x>0?(ke(e,{top:-x,behavior:"auto"}),ke(n,0)):(ke(n,0),ke(e,{top:-x,behavior:"auto"}))}return at(le(v,He(n,r)),([x,y,w])=>{w&&MN()?ke(n,y-x):b(-x)}),at(le(Wt(dn(r,!1),n,m),Pe(([x,y,w])=>!x&&!w&&y!==0),me(([x,y])=>y),kr(1)),b),ye(le(d,me(x=>({top:-x}))),e),at(le(u,He(f,p),me(([x,{lastSize:y,groupIndices:w,sizeTree:S},C])=>{function j(E){return E*(y+C)}if(w.length===0)return j(x);{let E=0;const O=_a(S,0);let P=0,T=0;for(;P<x;){P++,E+=O;let _=w.length===T+1?1/0:w[T+1]-w[T]-1;P+_>x&&(E-=O,_=x-P+1),P+=_,E+=j(_),T++}return E}})),x=>{ke(n,x),requestAnimationFrame(()=>{ke(e,{top:x}),requestAnimationFrame(()=>{ke(n,0),ke(m,!1)})})}),{deviation:n}},Pt(hn,pl,Go,Zs,io,gh)),$N=lt(([{didMount:e},{scrollTo:t},{listState:n}])=>{const s=fe(0);return at(le(e,He(s),Pe(([,r])=>r!==0),me(([,r])=>({top:r}))),r=>{Us(le(n,Ei(1),Pe(o=>o.items.length>1)),()=>{requestAnimationFrame(()=>{ke(t,r)})})}),{initialScrollTop:s}},Pt(ao,hn,Go),{singleton:!0}),kN=lt(([{viewportHeight:e},{totalListHeight:t}])=>{const n=fe(!1),s=dn(le(Wt(n,e,t),Pe(([r])=>r),me(([,r,o])=>Math.max(0,r-o)),kr(0),Et()),0);return{alignToBottom:n,paddingTopAddition:s}},Pt(hn,Uy),{singleton:!0}),xh=lt(([{scrollTo:e,scrollContainerState:t}])=>{const n=We(),s=We(),r=We(),o=fe(!1),i=fe(void 0);return ye(le(Wt(n,s),me(([{viewportHeight:a,scrollTop:l,scrollHeight:u},{offsetTop:d}])=>({scrollTop:Math.max(0,l-d),scrollHeight:u,viewportHeight:a}))),t),ye(le(e,He(s),me(([a,{offsetTop:l}])=>({...a,top:a.top+l}))),r),{useWindowScroll:o,customScrollParent:i,windowScrollContainerState:n,windowViewportRect:s,windowScrollTo:r}},Pt(hn)),RN=({itemTop:e,itemBottom:t,viewportTop:n,viewportBottom:s,locationParams:{behavior:r,align:o,...i}})=>e<n?{...i,behavior:r,align:o??"start"}:t>s?{...i,behavior:r,align:o??"end"}:null,IN=lt(([{sizes:e,totalCount:t,gap:n},{scrollTop:s,viewportHeight:r,headerHeight:o,fixedHeaderHeight:i,fixedFooterHeight:a,scrollingInProgress:l},{scrollToIndex:u}])=>{const d=We();return ye(le(d,He(e,r,t,o,i,a,s),He(n),me(([[f,p,g,m,v,b,x,y],w])=>{const{done:S,behavior:C,align:j,calculateViewLocation:E=RN,...O}=f,P=Iy(f,p,m-1),T=Aa(P,p.offsetTree,w)+v+b,_=T+vs(p.sizeTree,P)[1],L=y+b,N=y+g-x,V=E({itemTop:T,itemBottom:_,viewportTop:L,viewportBottom:N,locationParams:{behavior:C,align:j,...O}});return V?S&&Us(le(l,Pe(A=>A===!1),Ei(nn(l)?1:2)),S):S&&S(),V}),Pe(f=>f!==null)),u),{scrollIntoView:d}},Pt(Zs,hn,fl,Go,io),{singleton:!0}),VN=lt(([{sizes:e,sizeRanges:t},{scrollTop:n,headerHeight:s},{initialTopMostItemIndex:r},{didMount:o},{useWindowScroll:i,windowScrollContainerState:a,windowViewportRect:l}])=>{const u=We(),d=fe(void 0),f=fe(null),p=fe(null);return ye(a,f),ye(l,p),at(le(u,He(e,n,i,f,p,s)),([g,m,v,b,x,y,w])=>{const S=yN(m.sizeTree);b&&x!==null&&y!==null&&(v=x.scrollTop-y.offsetTop),v-=w,g({ranges:S,scrollTop:v})}),ye(le(d,Pe(fh),me(HN)),r),ye(le(o,He(d),Pe(([,g])=>g!==void 0),Et(),me(([,g])=>g.ranges)),t),{getState:u,restoreStateFrom:d}},Pt(Zs,hn,hl,ao,xh));function HN(e){return{offset:e.scrollTop,index:0,align:"start"}}const DN=lt(([e,t,n,s,r,o,i,a,l,u])=>({...e,...t,...n,...s,...r,...o,...i,...a,...l,...u}),Pt(yh,AN,ao,zy,Uy,$N,kN,xh,IN,io)),FN=lt(([{totalCount:e,sizeRanges:t,fixedItemSize:n,defaultItemSize:s,trackItemSizes:r,itemSize:o,data:i,firstItemIndex:a,groupIndices:l,statefulTotalCount:u,gap:d,sizes:f},{initialTopMostItemIndex:p,scrolledToInitialItem:g,initialItemFinalLocationReached:m},v,b,x,{listState:y,topItemsIndexes:w,...S},{scrollToIndex:C},j,{topItemCount:E},{groupCounts:O},P])=>(ye(S.rangeChanged,P.scrollSeekRangeChanged),ye(le(P.windowViewportRect,me(T=>T.visibleHeight)),v.viewportHeight),{totalCount:e,data:i,firstItemIndex:a,sizeRanges:t,initialTopMostItemIndex:p,scrolledToInitialItem:g,initialItemFinalLocationReached:m,topItemsIndexes:w,topItemCount:E,groupCounts:O,fixedItemHeight:n,defaultItemHeight:s,gap:d,...x,statefulTotalCount:u,listState:y,scrollToIndex:C,trackItemSizes:r,itemSize:o,groupIndices:l,...S,...P,...v,sizes:f,...b}),Pt(Zs,hl,hn,VN,PN,Go,fl,NN,LN,Dy,DN)),Ed="-webkit-sticky",Um="sticky",Gy=Wy(()=>{if(typeof document>"u")return Um;const e=document.createElement("div");return e.style.position=Ed,e.style.position===Ed?Ed:Um});function qy(e,t,n){const s=h.useRef(null),r=h.useCallback(l=>{if(l===null||!l.offsetParent)return;const u=l.getBoundingClientRect(),d=u.width;let 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;s.current={offsetTop:p,visibleHeight:f,visibleWidth:d},e(s.current)},[e,t]),{callbackRef:o,ref:i}=hh(r,!0,n),a=h.useCallback(()=>{r(i.current)},[r,i]);return h.useEffect(()=>{if(t){t.addEventListener("scroll",a);const l=new ResizeObserver(()=>{requestAnimationFrame(a)});return l.observe(t),()=>{t.removeEventListener("scroll",a),l.unobserve(t)}}else return window.addEventListener("scroll",a),window.addEventListener("resize",a),()=>{window.removeEventListener("scroll",a),window.removeEventListener("resize",a)}},[a,t]),o}const Ky=h.createContext(void 0),Zy=h.createContext(void 0);function Yy(e){return e}const BN=lt(()=>{const e=fe(l=>`Item ${l}`),t=fe(null),n=fe(l=>`Group ${l}`),s=fe({}),r=fe(Yy),o=fe("div"),i=fe(Ri),a=(l,u=null)=>dn(le(s,me(d=>d[l]),Et()),u);return{context:t,itemContent:e,groupContent:n,components:s,computeItemKey:r,HeaderFooterTag:o,scrollerRef:i,FooterComponent:a("Footer"),HeaderComponent:a("Header"),TopItemListComponent:a("TopItemList"),ListComponent:a("List","div"),ItemComponent:a("Item","div"),GroupComponent:a("Group","div"),ScrollerComponent:a("Scroller","div"),EmptyPlaceholder:a("EmptyPlaceholder"),ScrollSeekPlaceholder:a("ScrollSeekPlaceholder")}}),zN=lt(([e,t])=>({...e,...t}),Pt(FN,BN)),UN=({height:e})=>c.jsx("div",{style:{height:e}}),WN={position:Gy(),zIndex:1,overflowAnchor:"none"},Xy={overflowAnchor:"none"},GN={...Xy,display:"inline-block",height:"100%"},Wm=h.memo(function({showTopList:t=!1}){const n=Ae("listState"),s=Yn("sizeRanges"),r=Ae("useWindowScroll"),o=Ae("customScrollParent"),i=Yn("windowScrollContainerState"),a=Yn("scrollContainerState"),l=o||r?i:a,u=Ae("itemContent"),d=Ae("context"),f=Ae("groupContent"),p=Ae("trackItemSizes"),g=Ae("itemSize"),m=Ae("log"),v=Yn("gap"),b=Ae("horizontalDirection"),{callbackRef:x}=aN(s,g,p,t?Ri:l,m,v,o,b,Ae("skipAnimationFrameInResizeObserver")),[y,w]=h.useState(0);wh("deviation",A=>{y!==A&&w(A)});const S=Ae("EmptyPlaceholder"),C=Ae("ScrollSeekPlaceholder")||UN,j=Ae("ListComponent"),E=Ae("ItemComponent"),O=Ae("GroupComponent"),P=Ae("computeItemKey"),T=Ae("isSeeking"),_=Ae("groupIndices").length>0,L=Ae("alignToBottom"),N=Ae("initialItemFinalLocationReached"),V=t?{}:{boxSizing:"border-box",...b?{whiteSpace:"nowrap",display:"inline-block",height:"100%",paddingLeft:n.offsetTop,paddingRight:n.offsetBottom,marginLeft:y!==0?y:L?"auto":0}:{marginTop:y!==0?y:L?"auto":0,paddingTop:n.offsetTop,paddingBottom:n.offsetBottom},...N?{}:{visibility:"hidden"}};return!t&&n.totalCount===0&&S?c.jsx(S,{...un(S,d)}):c.jsx(j,{...un(j,d),ref:x,style:V,"data-testid":t?"virtuoso-top-item-list":"virtuoso-item-list",children:(t?n.topItems:n.items).map(A=>{const H=A.originalIndex,U=P(H+n.firstItemIndex,A.data,d);return T?h.createElement(C,{...un(C,d),key:U,index:A.index,height:A.size,type:A.type||"item",...A.type==="group"?{}:{groupIndex:A.groupIndex}}):A.type==="group"?h.createElement(O,{...un(O,d),key:U,"data-index":H,"data-known-size":A.size,"data-item-index":A.index,style:WN},f(A.index,d)):h.createElement(E,{...un(E,d),...YN(E,A.data),key:U,"data-index":H,"data-known-size":A.size,"data-item-index":A.index,"data-item-group-index":A.groupIndex,style:b?GN:Xy},_?u(A.index,A.groupIndex,A.data,d):u(A.index,A.data,d))})})}),qN={height:"100%",outline:"none",overflowY:"auto",position:"relative",WebkitOverflowScrolling:"touch"},KN={outline:"none",overflowX:"auto",position:"relative"},Eu=e=>({width:"100%",height:"100%",position:"absolute",top:0,...e?{display:"flex",flexDirection:"column"}:{}}),ZN={width:"100%",position:Gy(),top:0,zIndex:1};function un(e,t){if(typeof e!="string")return{context:t}}function YN(e,t){return{item:typeof e=="string"?void 0:t}}const XN=h.memo(function(){const t=Ae("HeaderComponent"),n=Yn("headerHeight"),s=Ae("HeaderFooterTag"),r=Wo(h.useMemo(()=>i=>n(qr(i,"height")),[n]),!0,Ae("skipAnimationFrameInResizeObserver")),o=Ae("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...un(t,o)})}):null}),JN=h.memo(function(){const t=Ae("FooterComponent"),n=Yn("footerHeight"),s=Ae("HeaderFooterTag"),r=Wo(h.useMemo(()=>i=>n(qr(i,"height")),[n]),!0,Ae("skipAnimationFrameInResizeObserver")),o=Ae("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...un(t,o)})}):null});function Jy({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:o,children:i,...a}){const l=e("scrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=n("scrollerRef"),p=n("context"),g=n("horizontalDirection")||!1,{scrollerRef:m,scrollByCallback:v,scrollToCallback:b}=Ay(l,d,u,f,void 0,g);t("scrollTo",b),t("scrollBy",v);const x=g?KN:qN;return c.jsx(u,{ref:m,style:{...x,...o},"data-testid":"virtuoso-scroller","data-virtuoso-scroller":!0,tabIndex:0,...a,...un(u,p),children:i})})}function Qy({usePublisher:e,useEmitter:t,useEmitterValue:n}){return h.memo(function({style:o,children:i,...a}){const l=e("windowScrollContainerState"),u=n("ScrollerComponent"),d=e("smoothScrollTargetReached"),f=n("totalListHeight"),p=n("deviation"),g=n("customScrollParent"),m=n("context"),{scrollerRef:v,scrollByCallback:b,scrollToCallback:x}=Ay(l,d,u,Ri,g);return Oy(()=>(v.current=g||window,()=>{v.current=null}),[v,g]),t("windowScrollTo",x),t("scrollBy",b),c.jsx(u,{style:{position:"relative",...o,...f!==0?{height:f+p}:{}},"data-virtuoso-scroller":!0,...a,...un(u,m),children:i})})}const QN=({children:e})=>{const t=h.useContext(Ky),n=Yn("viewportHeight"),s=Yn("fixedItemHeight"),r=Ae("alignToBottom"),o=Ae("horizontalDirection"),i=h.useMemo(()=>jy(n,l=>qr(l,o?"width":"height")),[n,o]),a=Wo(i,!0,Ae("skipAnimationFrameInResizeObserver"));return h.useEffect(()=>{t&&(n(t.viewportHeight),s(t.itemHeight))},[t,n,s]),c.jsx("div",{style:Eu(r),ref:a,"data-viewport-type":"element",children:e})},e$=({children:e})=>{const t=h.useContext(Ky),n=Yn("windowViewportRect"),s=Yn("fixedItemHeight"),r=Ae("customScrollParent"),o=qy(n,r,Ae("skipAnimationFrameInResizeObserver")),i=Ae("alignToBottom");return h.useEffect(()=>{t&&(s(t.itemHeight),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:100}))},[t,n,s]),c.jsx("div",{ref:o,style:Eu(i),"data-viewport-type":"window",children:e})},t$=({children:e})=>{const t=Ae("TopItemListComponent")||"div",n=Ae("headerHeight"),s={...ZN,marginTop:`${n}px`},r=Ae("context");return c.jsx(t,{style:s,...un(t,r),children:e})},n$=h.memo(function(t){const n=Ae("useWindowScroll"),s=Ae("topItemsIndexes").length>0,r=Ae("customScrollParent"),o=r||n?o$:r$,i=r||n?e$:QN;return c.jsxs(o,{...t,children:[s&&c.jsx(t$,{children:c.jsx(Wm,{showTopList:!0})}),c.jsxs(i,{children:[c.jsx(XN,{}),c.jsx(Wm,{}),c.jsx(JN,{})]})]})}),{Component:s$,usePublisher:Yn,useEmitterValue:Ae,useEmitter:wh}=Py(zN,{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"}},n$),r$=Jy({usePublisher:Yn,useEmitterValue:Ae,useEmitter:wh}),o$=Qy({usePublisher:Yn,useEmitterValue:Ae,useEmitter:wh}),i$=s$,Gm={items:[],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},a$={items:[{index:0}],offsetBottom:0,offsetTop:0,top:0,bottom:0,itemHeight:0,itemWidth:0},{round:qm,ceil:Km,floor:kc,min:Td,max:ca}=Math;function l$(e){return{...a$,items:e}}function Zm(e,t,n){return Array.from({length:t-e+1}).map((s,r)=>{const o=n===null?null:n[r+e];return{index:r+e,data:o}})}function c$(e,t){return e&&e.column===t.column&&e.row===t.row}function Il(e,t){return e&&e.width===t.width&&e.height===t.height}const u$=lt(([{overscan:e,visibleRange:t,listBoundary:n,increaseViewportBy:s},{scrollTop:r,viewportHeight:o,scrollBy:i,scrollTo:a,smoothScrollTargetReached:l,scrollContainerState:u,footerHeight:d,headerHeight:f},p,g,{propsReady:m,didMount:v},{windowViewportRect:b,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,windowScrollTo:S},C])=>{const j=fe(0),E=fe(0),O=fe(Gm),P=fe({height:0,width:0}),T=fe({height:0,width:0}),_=We(),L=We(),N=fe(0),V=fe(null),A=fe({row:0,column:0}),H=We(),U=We(),D=fe(!1),$=fe(0),I=fe(!0),R=fe(!1),z=fe(!1);at(le(v,He($),Pe(([W,Q])=>!!Q)),()=>{ke(I,!1)}),at(le(Wt(v,I,T,P,$,R),Pe(([W,Q,ae,ge,,Ce])=>W&&!Q&&ae.height!==0&&ge.height!==0&&!Ce)),([,,,,W])=>{ke(R,!0),vh(1,()=>{ke(_,W)}),Us(le(r),()=>{ke(n,[0,0]),ke(I,!0)})}),ye(le(U,Pe(W=>W!=null&&W.scrollTop>0),As(0)),E),at(le(v,He(U),Pe(([,W])=>W!=null)),([,W])=>{W&&(ke(P,W.viewport),ke(T,W==null?void 0:W.item),ke(A,W.gap),W.scrollTop>0&&(ke(D,!0),Us(le(r,Ei(1)),Q=>{ke(D,!1)}),ke(a,{top:W.scrollTop})))}),ye(le(P,me(({height:W})=>W)),o),ye(le(Wt(Te(P,Il),Te(T,Il),Te(A,(W,Q)=>W&&W.column===Q.column&&W.row===Q.row),Te(r)),me(([W,Q,ae,ge])=>({viewport:W,item:Q,gap:ae,scrollTop:ge}))),H),ye(le(Wt(Te(j),t,Te(A,c$),Te(T,Il),Te(P,Il),Te(V),Te(E),Te(D),Te(I),Te($)),Pe(([,,,,,,,W])=>!W),me(([W,[Q,ae],ge,Ce,Se,et,Ye,,Ct,ct])=>{const{row:we,column:nt}=ge,{height:st,width:vt}=Ce,{width:Me}=Se;if(Ye===0&&(W===0||Me===0))return Gm;if(vt===0){const Ft=bh(ct,W),Xs=Math.max(Ft+Ye-1,0);return l$(Zm(Ft,Xs,et))}const ft=ex(Me,vt,nt);let ut,Fe;Ct?Q===0&&ae===0&&Ye>0?(ut=0,Fe=Ye-1):(ut=ft*kc((Q+we)/(st+we)),Fe=ft*Km((ae+we)/(st+we))-1,Fe=Td(W-1,ca(Fe,ft-1)),ut=Td(Fe,ca(0,ut))):(ut=0,Fe=-1);const Zt=Zm(ut,Fe,et),{top:he,bottom:Ve}=Ym(Se,ge,Ce,Zt),De=Km(W/ft),Ot=De*st+(De-1)*we-Ve;return{items:Zt,offsetTop:he,offsetBottom:Ot,top:he,bottom:Ve,itemHeight:st,itemWidth:vt}})),O),ye(le(V,Pe(W=>W!==null),me(W=>W.length)),j),ye(le(Wt(P,T,O,A),Pe(([W,Q,{items:ae}])=>ae.length>0&&Q.height!==0&&W.height!==0),me(([W,Q,{items:ae},ge])=>{const{top:Ce,bottom:Se}=Ym(W,ge,Q,ae);return[Ce,Se]}),Et(Ma)),n);const X=fe(!1);ye(le(r,He(X),me(([W,Q])=>Q||W!==0)),X);const Z=$n(le(Te(O),Pe(({items:W})=>W.length>0),He(j,X),Pe(([{items:W},Q,ae])=>ae&&W[W.length-1].index===Q-1),me(([,W])=>W-1),Et())),Y=$n(le(Te(O),Pe(({items:W})=>W.length>0&&W[0].index===0),As(0),Et())),J=$n(le(Te(O),He(D),Pe(([{items:W},Q])=>W.length>0&&!Q),me(([{items:W}])=>({startIndex:W[0].index,endIndex:W[W.length-1].index})),Et(Fy),kr(0)));ye(J,g.scrollSeekRangeChanged),ye(le(_,He(P,T,j,A),me(([W,Q,ae,ge,Ce])=>{const Se=Hy(W),{align:et,behavior:Ye,offset:Ct}=Se;let ct=Se.index;ct==="LAST"&&(ct=ge-1),ct=ca(0,ct,Td(ge-1,ct));let we=If(Q,Ce,ae,ct);return et==="end"?we=qm(we-Q.height+ae.height):et==="center"&&(we=qm(we-Q.height/2+ae.height/2)),Ct&&(we+=Ct),{top:we,behavior:Ye}})),a);const ee=dn(le(O,me(W=>W.offsetBottom+W.bottom)),0);return ye(le(b,me(W=>({width:W.visibleWidth,height:W.visibleHeight}))),P),{data:V,totalCount:j,viewportDimensions:P,itemDimensions:T,scrollTop:r,scrollHeight:L,overscan:e,increaseViewportBy:s,scrollBy:i,scrollTo:a,scrollToIndex:_,smoothScrollTargetReached:l,windowViewportRect:b,windowScrollTo:S,useWindowScroll:x,customScrollParent:y,windowScrollContainerState:w,deviation:N,scrollContainerState:u,footerHeight:d,headerHeight:f,initialItemCount:E,gap:A,restoreStateFrom:U,...g,initialTopMostItemIndex:$,horizontalDirection:z,gridState:O,totalListHeight:ee,...p,startReached:Y,endReached:Z,rangeChanged:J,stateChanged:H,propsReady:m,stateRestoreInProgress:D,...C}},Pt(yh,hn,pl,zy,ao,xh,io));function Ym(e,t,n,s){const{height:r}=n;if(r===void 0||s.length===0)return{top:0,bottom:0};const o=If(e,t,n,s[0].index),i=If(e,t,n,s[s.length-1].index)+r;return{top:o,bottom:i}}function If(e,t,n,s){const r=ex(e.width,n.width,t.column),o=kc(s/r),i=o*n.height+ca(0,o-1)*t.row;return i>0?i+t.row:i}function ex(e,t,n){return ca(1,kc((e+n)/(kc(t)+n)))}const d$=lt(()=>{const e=fe(f=>`Item ${f}`),t=fe({}),n=fe(null),s=fe("virtuoso-grid-item"),r=fe("virtuoso-grid-list"),o=fe(Yy),i=fe("div"),a=fe(Ri),l=(f,p=null)=>dn(le(t,me(g=>g[f]),Et()),p),u=fe(!1),d=fe(!1);return ye(Te(d),u),{readyStateChanged:u,reportReadyState:d,context:n,itemContent:e,components:t,computeItemKey:o,itemClassName:s,listClassName:r,headerFooterTag:i,scrollerRef:a,FooterComponent:l("Footer"),HeaderComponent:l("Header"),ListComponent:l("List","div"),ItemComponent:l("Item","div"),ScrollerComponent:l("Scroller","div"),ScrollSeekPlaceholder:l("ScrollSeekPlaceholder","div")}}),f$=lt(([e,t])=>({...e,...t}),Pt(u$,d$)),p$=h.memo(function(){const t=_t("gridState"),n=_t("listClassName"),s=_t("itemClassName"),r=_t("itemContent"),o=_t("computeItemKey"),i=_t("isSeeking"),a=Xn("scrollHeight"),l=_t("ItemComponent"),u=_t("ListComponent"),d=_t("ScrollSeekPlaceholder"),f=_t("context"),p=Xn("itemDimensions"),g=Xn("gap"),m=_t("log"),v=_t("stateRestoreInProgress"),b=Xn("reportReadyState"),x=Wo(h.useMemo(()=>y=>{const w=y.parentElement.parentElement.scrollHeight;a(w);const S=y.firstChild;if(S){const{width:C,height:j}=S.getBoundingClientRect();p({width:C,height:j})}g({row:Xm("row-gap",getComputedStyle(y).rowGap,m),column:Xm("column-gap",getComputedStyle(y).columnGap,m)})},[a,p,g,m]),!0,!1);return Oy(()=>{t.itemHeight>0&&t.itemWidth>0&&b(!0)},[t]),v?null:c.jsx(u,{ref:x,className:n,...un(u,f),style:{paddingTop:t.offsetTop,paddingBottom:t.offsetBottom},"data-testid":"virtuoso-item-list",children:t.items.map(y=>{const w=o(y.index,y.data,f);return i?c.jsx(d,{...un(d,f),index:y.index,height:t.itemHeight,width:t.itemWidth},w):h.createElement(l,{...un(l,f),className:s,"data-index":y.index,key:w},r(y.index,y.data,f))})})}),h$=h.memo(function(){const t=_t("HeaderComponent"),n=Xn("headerHeight"),s=_t("headerFooterTag"),r=Wo(h.useMemo(()=>i=>n(qr(i,"height")),[n]),!0,!1),o=_t("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...un(t,o)})}):null}),g$=h.memo(function(){const t=_t("FooterComponent"),n=Xn("footerHeight"),s=_t("headerFooterTag"),r=Wo(h.useMemo(()=>i=>n(qr(i,"height")),[n]),!0,!1),o=_t("context");return t?c.jsx(s,{ref:r,children:c.jsx(t,{...un(t,o)})}):null}),m$=({children:e})=>{const t=h.useContext(Zy),n=Xn("itemDimensions"),s=Xn("viewportDimensions"),r=Wo(h.useMemo(()=>o=>{s(o.getBoundingClientRect())},[s]),!0,!1);return h.useEffect(()=>{t&&(s({height:t.viewportHeight,width:t.viewportWidth}),n({height:t.itemHeight,width:t.itemWidth}))},[t,s,n]),c.jsx("div",{style:Eu(!1),ref:r,children:e})},v$=({children:e})=>{const t=h.useContext(Zy),n=Xn("windowViewportRect"),s=Xn("itemDimensions"),r=_t("customScrollParent"),o=qy(n,r,!1);return h.useEffect(()=>{t&&(s({height:t.itemHeight,width:t.itemWidth}),n({offsetTop:0,visibleHeight:t.viewportHeight,visibleWidth:t.viewportWidth}))},[t,n,s]),c.jsx("div",{ref:o,style:Eu(!1),children:e})},b$=h.memo(function({...t}){const n=_t("useWindowScroll"),s=_t("customScrollParent"),r=s||n?w$:x$,o=s||n?v$:m$;return c.jsx(r,{...t,children:c.jsxs(o,{children:[c.jsx(h$,{}),c.jsx(p$,{}),c.jsx(g$,{})]})})}),{Component:y$,usePublisher:Xn,useEmitterValue:_t,useEmitter:tx}=Py(f$,{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"}},b$),x$=Jy({usePublisher:Xn,useEmitterValue:_t,useEmitter:tx}),w$=Qy({usePublisher:Xn,useEmitterValue:_t,useEmitter:tx});function Xm(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 Tu=y$,Sh=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},S$=e=>!!(e&&!Array.isArray(e)&&typeof e=="object");async function C$(e){const t=e.map(({id:i,src:a})=>({id:i,src:a})),n=e.reduce((i,a)=>(i[a.id]=a,i),{}),s=[],r=[];return(await Uw(t)).forEach(i=>{i.status==="fulfilled"?s.push(n[i.value]):r.push(n[i.reason])}),{loaded:s,failed:r}}const j$=async e=>{const t=[...e],n={};if(t.length){const s={},r=[];if(t.forEach((o,i)=>{S$(o)&&(s[o.id]={index:i},r.push(o))}),r.length){const{loaded:o}=await C$(r);o.forEach(({id:i,options:a})=>{s[i].loaded=!0,n[i]=a||{}})}Object.keys(s).forEach(o=>{const i=s[o];i.loaded?t[i.index]=o:t[i.index]=!1})}return{plugins:t.filter(Boolean),pluginOptions:n}},E$=(e,t,n,s={})=>{const{skipReplace:r}=s;e.loadData(t);const o=e.getCss()||"",i=r?o:o.replace(/:root\s*{/gi,"[data-body]{");let a=`${e.getHtml()}<style>${i}</style>`;if(n===jt.email)try{a=e.runCommand(gu).html}catch(l){console.error(l)}return s.removeScripts&&(a=a.replace(/<script[^>]*>[\s\S]*?<\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*><\/script>/gi,"").replace(/<script[^>]*src=["'][^"']*["'][^>]*\/?>/gi,"")),r?a:a.replace("<body","<div data-body").replace("</body>","</div>")},T$=async(e,t,n)=>{const s=Cw(t,{appStore:n}),r=await j$(s);return e==null?void 0:e.init({headless:!0,projectData:{},log:!1,undoManager:!1,noticeOnUnload:!1,storageManager:!1,plugins:[...r.plugins,o=>{o.Storage.setCurrent("")}],pluginsOpts:r.pluginOptions,protectedCss:`
|
|
369
304
|
* { box-sizing: border-box; }
|
|
370
305
|
[data-body] {
|
|
371
306
|
margin: 0;
|
|
@@ -383,42 +318,42 @@ $2`),e=e.replace(/([^\s]);([^\s\}])/g,`$1;
|
|
|
383
318
|
height: 0px;
|
|
384
319
|
overflow: hidden;
|
|
385
320
|
}
|
|
386
|
-
`})};function fu({children:e,text:t,onConfirm:n,onCancel:s,className:r="w-[200px]",confirmButtonProps:o={},...i}){const a=Re();return c.jsx(ps,{...i,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(k,{className:ee(r),space:"m",col:!0,children:[c.jsx(D,{grow:!0,className:ee("text-center"),children:t||a.t("confirmAction")}),c.jsxs(k,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[c.jsx(Ke,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),n==null||n()},...o,children:o.children||a.t("confirm")}),c.jsx(Ke,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),s==null||s()},children:a.t("cancel")})]})]})})}const $m=new Map,km=new Map,vL=async({html:e="",el:t})=>{const n=e,s={};if(document.body.attachShadow){const r=t.shadowRoot||t.attachShadow({mode:"open"});r.innerHTML=n}return s},yL=fe(function({template:t,projectType:n,skipProjectNamePopover:s,className:r,onSelect:o,onRemove:i}){var E;const a=Re(),l=ye(),u=l.editor,[d,f]=h.useState(""),p=h.useRef(null),g=a.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((E=t.data.custom)==null?void 0:E.id),b=n===yt.web,v=!t.isTemplate||s,x=()=>{v&&(o==null||o({editor:u,template:t,loadTemplate:y}))},y=l.setProject,w=_=>{_.preventDefault(),o({editor:u,template:t,loadTemplate:y})};h.useEffect(()=>{const T=setTimeout(async()=>{if(!p.current||!u)return;const P=`${t.isTemplate?"t-":""}${t.id}`;let A=$m.get(P);if(!A){let R=km.get(n);if(!R){const F=new m7({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});R=await bL(u.config.grapesjs,n,F.appEditorStore),km.set(n,R)}A=R?mL(R,t.data,n):"",$m.set(P,A)}const M=p.current;vL({el:M,html:A})});return()=>clearTimeout(T)},[p,u,n,t.data]);const{media:S,author:C}=t,j=c.jsx(Ke,{className:ue("text-sm"),size:"m2",variant:"pr",onClick:x,disabled:m,children:a.t("select")});return c.jsx(Xn,{padding:!1,className:ue("overflow-hidden max-w-full group",r),children:c.jsxs(k,{col:!0,children:[c.jsxs(D,{className:ue("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ue("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:S?c.jsx("img",{src:S,alt:t.name,className:ue("max-w-full")}):c.jsx("div",{className:ue("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(Rr,{className:ue("absolute top-2 right-2",z.bgA2),label:a.t("current"),s:"s",pill:!0}),c.jsx(k,{justify:"center",items:"center",className:ue(Ee.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:v?j:c.jsx(ps,{overlay:!0,title:!1,buttonAs:"span",handler:j,children:()=>c.jsx("form",{onSubmit:w,children:c.jsxs(k,{space:"m",col:!0,children:[c.jsx(D,{children:c.jsx(tt,{size:"s",value:d,onChange:f,placeholder:g,required:!0})}),c.jsx(D,{children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:a.t("load")})})]})})})})]}),c.jsxs(k,{className:ue("gjs-p-2 max-w-full",re.bt,z.br),col:!0,space:"s",children:[c.jsxs(k,{className:ue("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(D,{className:ue(Ee.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!C&&c.jsxs(D,{children:["by"," ",c.jsx("a",{className:ue($r.link),href:C.link,rel:"noreferrer",target:"_blank",children:C.name})]})]}),c.jsxs(k,{items:"center",children:[b&&c.jsxs(D,{className:ue("gjs-mr-auto"),children:[a.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&i&&c.jsx(D,{className:ue("gjs-ml-auto"),children:c.jsx(fu,{onConfirm:()=>i(t),className:"",children:c.jsx(bt,{title:a.t("delete"),children:c.jsx(oe,{icon:Z.delete,size:le.sx})})})})]})]})]})})}),Py=fe(function({templates:e,projectType:t,content:n,skipProjectNamePopover:s,onSelect:r,onRemove:o}){const[i]=Bp(),l=Re().tScoped("templates"),d=ye().editor,f=Qp(n==null?void 0:n.itemsPerRow),p=r??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(k,{justify:"center",children:l("notFound")}):c.jsx(du,{data:e,listClassName:ue("grid gap-2 gjs-pr-2",f),itemContent:(g,m)=>c.jsx(yL,{template:m,projectType:t,onSelect:p,onRemove:o,skipProjectNamePopover:s},m.id)},i):c.jsx(Co,{})})}),xL=fe(function(){var b;const t=ye(),n=C0(),{filteredTemplates:s,projectSourceFilter:r,projectTypeFilter:o}=n,i=Re(),a=ji(),{sdkOptions:l}=t,u=i.tScoped("projectManager"),d=async({loadTemplate:v,template:x})=>{v(x),a.close()},f=async v=>{n.setProjectTypeFilter(v),await n.loadAllTemplates()},p=v=>{n.removeProject(v.id),n.loadProjects()},g=h.useMemo(()=>[{id:ma.Existing,label:u("existentProjects")},{id:ma.Templates,label:u("templates")}],[i]),m=((b=l.project)==null?void 0:b.types)&&Ff();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(k,{col:!0,full:!0,space:"m",children:[m&&c.jsx(k,{items:"center",space:"m",children:c.jsx(D,{className:ue("gjs-ml-auto"),children:c.jsx(_e,{value:o,onChange:f,options:wM(),handlerSelected:v=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",v.label]})})})}),c.jsx(D,{children:c.jsx(Yr,{tabs:g,value:r,onChange:n.setProjectSourceFilter})}),c.jsx(D,{grow:!0,children:c.jsx(Py,{templates:s,projectType:yt[o],onSelect:d,onRemove:p,content:{itemsPerRow:3}})})]})}),wL=({items:e,editor:t,customItems:n})=>n===!1?[]:Ye(n)?n({items:e,editor:t}):n||e,Vm=e=>({icon:Z.plus,size:le.s,className:ee("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),_y=e=>!e.type||e.type==="button",SL="gs-cmp-topbar-left",CL=fe(function({buttons:t,className:n,style:s}){const r=ye(),o=Re(),{isOpen:i,toggleOpen:a}=zA(),l=r.editor,d=o.tScoped("blockManager")("blocks"),f=wL({items:[{id:`blocks-${d}`,tooltip:d,size:W0.s,icon:Vm(i),variant:U0.primary,editorEvents:{[Tn.toggleBlocksPanel]:({fromEvent:p,setState:g})=>{g({icon:Vm(p.isOpen)})}},onClick:()=>a()}],customItems:t,editor:l});return c.jsx(k,{gap:"s",items:"center",justify:"start",className:ee(SL,je.xS,n),style:s,nowrap:!0,children:f.map(({id:p,...g})=>_y(g)?c.jsx(su,{...g},p):Ot({id:p,...g}))})}),jL=[{id:Nr.auto,label:"Auto"},{id:Nr.dark,label:"Dark"},{id:Nr.light,label:"Light"}],EL={size:"s"},pd=".grapesjs",PL=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},_L=({actions:e,editor:t,buttons:n,sdkOptions:s})=>{const r=s.actions;return r===!1?[]:Ye(r)?r({actions:e,editor:t}):r||(n?Ye(n)?n({items:e,editor:t}):n:e)},TL="gs-cmp-topbar-right",OL=fe(function({editor:t,className:n,buttons:s,...r}){const o=ye(),{theme:i,setTheme:a}=Ds(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:f,isBrowserMode:p,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:b}=o,v=ji(),x=Re(),y=M=>x.t(`actions.${M}`),w=t.Storage.events,S=l.events,C="change:changesCount",j=(M,R)=>()=>{Ye(M)?M({editor:t}):l.isActive(M)?l.stop(M):l.run(M,R)},E=M=>({[`${S.runCommand}${M}`]:({setState:R})=>R({active:!0}),[`${S.stopCommand}${M}`]:({setState:R})=>R({active:!1})}),_=[{id:ts.componentOutline,icon:Z.borderRadius,tooltip:y("componentOutline.title"),onClick:j("core:component-outline"),editorEvents:E("core:component-outline")},{id:ts.preview,icon:Z.eye,tooltip:y("preview.title"),onClick:j("core:preview"),editorEvents:E("core:preview")},{id:ts.fullscreen,icon:Z.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:j("core:fullscreen",{target:"body"}),editorEvents:E("core:fullscreen")},{id:ts.showCode,icon:Z.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(ie.dialogExportCode)},{id:ts.showImportCode,icon:Z.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>v.open({title:y("importCode.title"),content:()=>c.jsx(K0,{})})},{id:ts.clearCanvas,icon:Z.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:ts.store,tooltip:y("store.title"),onClick:async()=>!o.isSaving&&t.store(),editorEvents:{"change:changesCount":({setState:M})=>M({}),[w.startStore]:({setState:M})=>M({disabled:!0}),[w.endStore]:({setState:M})=>M({disabled:!1})},label:()=>c.jsxs("div",{className:ee("relative"),children:[c.jsx(oe,{icon:Z.floppy,size:le.s}),!!t.getDirtyCount()&&!o.isSaving&&c.jsx("div",{className:ee("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",z.bg),children:c.jsx("div",{className:ee(Ee.dot,z.bgW)})}),o.isSaving&&c.jsx("div",{className:ee("absolute right-0 bottom-0 gjs-rounded-full",z.bg),children:c.jsx(oe,{icon:Z.refresh,size:"11px",className:ee(Ee.spin)})})]})},{id:ts.undo,icon:Z.arrowULeftTop,disabled:!0,onClick:j("core:undo"),editorEvents:{[C]:({setState:M})=>M({disabled:!u.hasUndo()})}},{id:ts.redo,icon:Z.arrowURightTop,disabled:!0,onClick:j("core:redo"),editorEvents:{[C]:({setState:M})=>M({disabled:!u.hasRedo()})}}],T=_L({actions:_,sdkOptions:m,editor:t,buttons:s}),P=[{id:"about",label:y("about.title"),icon:Z.helpCircle,action:()=>v.open({size:"m",title:y("about.title"),content:()=>c.jsx(yM,{})})},{id:"embed",label:y("embed.title"),icon:Z.powerPlug,action:()=>v.open({size:"m",title:y("embed.title"),content:()=>c.jsx(xM,{})})},{id:"openProject",label:y("open.title"),icon:Z.folder,action:async()=>{let M="";try{M=await(await nM({extensions:[pd]})).text()}catch(R){return console.error(R)}o.loadProjectData(JSON.parse(M))}},{id:"saveProject",label:y("save.title"),icon:Z.contentSave,action:async()=>{const M=t.getProjectData(),R=new Blob([JSON.stringify(M)]),F=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await rM(R,{fileName:`${F}${pd}`,extensions:[pd]})}catch(L){return console.error(L)}}},{id:"loadProject",label:y("newProject.title"),icon:Z.newspaperVariantOutline,action:()=>v.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(xL,{})})},{id:"installApp",label:y(f?"installApp.installed":"installApp.title"),icon:Z.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(k,{items:"center",space:"m",children:[c.jsx(D,{children:"Theme"}),c.jsx(D,{children:c.jsx(Yr,{tabs:jL,onChange:M=>a(M),value:i,variant:"pills"})})]})}]].filter(({id:M})=>!((!p||!d)&&M==="installApp"||!PL(m,M))),A=(M,R)=>F=>{Ye(M)&&(M(F),R())};return c.jsxs(k,{space:"s",items:"center",justify:"end",className:ee(TL,je.xS,n),nowrap:!0,...r,children:[T.map(({id:M,...R})=>_y(R)?c.jsx(su,{size:"s",...R},M):Ot({id:M,...R})),c.jsx(D,{children:m.settingsMenu!==!1&&P.length>0&&c.jsx(ps,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(oe,{icon:Z.cog,size:le.s}),buttonProps:EL,overlay:!0,children:({close:M})=>c.jsx(c.Fragment,{children:P.map(R=>c.jsx(_i,{action:A(R.action,M),icon:R.icon,label:R.label},R.id))})})})]})});function AL({devices:e,selected:t,className:n,style:s,select:r}){const o=e.map(i=>({id:i.id,label:i.getName(),icon:i.attributes.icon}));return o.length?c.jsx(_e,{size:"xs",className:n,style:s,value:t,options:o,onChange:r}):null}const NL="gs-devices",Ty=h.memo(function({className:t,style:n}){return c.jsx(V4,{children:s=>c.jsx(AL,{className:N(NL,t),style:n,...s})})}),Hi="gs-cmp-editor-topbar",ML=fe(function({className:t,height:n,style:s,children:r,leftContainer:o,rightContainer:i,devices:a}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:f}=ye(),p=n??l,g=h.useMemo(()=>({...s,minHeight:p,marginTop:u||!f?`-${p}px`:0}),[u,f,s]);return c.jsxs(c.Fragment,{children:[c.jsx(D,{className:N(Hi,"gs-utl-transition-spacing gs-utl-w-full",re.bb,z.br,t),style:g,children:r??c.jsxs(k,{className:N(`${Hi}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(D,{className:N(`${Hi}__wrp-left`),grow:!0,children:o!==!1&&c.jsx(CL,{...o})}),c.jsx(D,{className:N(`${Hi}__wrp-center`),children:a!==!1&&c.jsx(Ty,{...a})}),c.jsx(D,{className:N(`${Hi}__wrp-right`),grow:!0,children:i!==!1&&d&&c.jsx(OL,{editor:d,...i})})]})}),c.jsx(D,{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(oe,{icon:Z.eyeOff,size:le.s})})})]})}),LL="gs-sidebar-top",Oy=h.memo(fe(function({height:t,children:n,...s}){return c.jsx(ML,{height:t,...s,style:ou(s),className:N(LL,"gs-utl-flex",ru(s)),children:n?Ot(n):void 0})})),RL="gs-canvas-sidebar-top",$L=h.memo(fe(function({className:t,sidebarTop:n,...s}){return c.jsxs(mn,{className:N(RL,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...s,children:[c.jsx(Oy,{...n}),c.jsx(cy,{grow:!0})]})})),kL="gs-code-field",VL=fe(function(e){const{editor:t}=ye(),{isDarkTheme:n}=Ds(),{editorEvents:s,onChange:r}=e,[o,i]=h.useState(()=>e),a=u=>({value:u,editor:t,state:o,setState:d=>i(f=>({...f,...d}))}),l=u=>r==null?void 0:r(a(u||""));return Jr({editor:t,editorEvents:s,localState:o,setLocalState:i}),c.jsx(ir,{className:N(kL,o.className),language:o.language,style:o.style,label:o.label,name:o.name,defaultValue:o.value,size:o.size,required:o.required,disabled:o.disabled,readOnly:o.readOnly,minHeight:o.minHeight,row:o.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});var IL={grad:.9,turn:360,rad:360/(2*Math.PI)},Gs=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Vt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Un=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},Ay=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},Im=function(e){return{r:Un(e.r,0,255),g:Un(e.g,0,255),b:Un(e.b,0,255),a:Un(e.a)}},hd=function(e){return{r:Vt(e.r),g:Vt(e.g),b:Vt(e.b),a:Vt(e.a,3)}},DL=/^#([0-9a-f]{3,8})$/i,_l=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},Ny=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:60*(a<0?a+6:a),s:o?i/o*100:0,v:o/255*100,a:r}},My=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:255*[s,a,i,i,l,s][u],g:255*[l,s,s,a,i,i][u],b:255*[i,i,l,s,s,a][u],a:r}},Dm=function(e){return{h:Ay(e.h),s:Un(e.s,0,100),l:Un(e.l,0,100),a:Un(e.a)}},Hm=function(e){return{h:Vt(e.h),s:Vt(e.s),l:Vt(e.l),a:Vt(e.a,3)}},Fm=function(e){return My((n=(t=e).s,{h:t.h,s:(n*=((s=t.l)<50?s:100-s)/100)>0?2*n/(s+n)*100:0,v:s+n,a:t.a}));var t,n,s},ra=function(e){return{h:(t=Ny(e)).h,s:(r=(200-(n=t.s))*(s=t.v)/100)>0&&r<200?n*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,s,r},HL=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,FL=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,BL=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zL=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,wf={string:[[function(e){var t=DL.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?Vt(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?Vt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=BL.exec(e)||zL.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:Im({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=HL.exec(e)||FL.exec(e);if(!t)return null;var n,s,r=Dm({h:(n=t[1],s=t[2],s===void 0&&(s="deg"),Number(n)*(IL[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Fm(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=r===void 0?1:r;return Gs(t)&&Gs(n)&&Gs(s)?Im({r:Number(t),g:Number(n),b:Number(s),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,n=e.s,s=e.l,r=e.a,o=r===void 0?1:r;if(!Gs(t)||!Gs(n)||!Gs(s))return null;var i=Dm({h:Number(t),s:Number(n),l:Number(s),a:Number(o)});return Fm(i)},"hsl"],[function(e){var t=e.h,n=e.s,s=e.v,r=e.a,o=r===void 0?1:r;if(!Gs(t)||!Gs(n)||!Gs(s))return null;var i=function(a){return{h:Ay(a.h),s:Un(a.s,0,100),v:Un(a.v,0,100),a:Un(a.a)}}({h:Number(t),s:Number(n),v:Number(s),a:Number(o)});return My(i)},"hsv"]]},Bm=function(e,t){for(var n=0;n<t.length;n++){var s=t[n][0](e);if(s)return[s,t[n][1]]}return[null,void 0]},UL=function(e){return typeof e=="string"?Bm(e.trim(),wf.string):typeof e=="object"&&e!==null?Bm(e,wf.object):[null,void 0]},gd=function(e,t){var n=ra(e);return{h:n.h,s:Un(n.s+100*t,0,100),l:n.l,a:n.a}},md=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},zm=function(e,t){var n=ra(e);return{h:n.h,s:n.s,l:Un(n.l+100*t,0,100),a:n.a}},Sf=function(){function e(t){this.parsed=UL(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 Vt(md(this.rgba),2)},e.prototype.isDark=function(){return md(this.rgba)<.5},e.prototype.isLight=function(){return md(this.rgba)>=.5},e.prototype.toHex=function(){return t=hd(this.rgba),n=t.r,s=t.g,r=t.b,i=(o=t.a)<1?_l(Vt(255*o)):"","#"+_l(n)+_l(s)+_l(r)+i;var t,n,s,r,o,i},e.prototype.toRgb=function(){return hd(this.rgba)},e.prototype.toRgbString=function(){return t=hd(this.rgba),n=t.r,s=t.g,r=t.b,(o=t.a)<1?"rgba("+n+", "+s+", "+r+", "+o+")":"rgb("+n+", "+s+", "+r+")";var t,n,s,r,o},e.prototype.toHsl=function(){return Hm(ra(this.rgba))},e.prototype.toHslString=function(){return t=Hm(ra(this.rgba)),n=t.h,s=t.s,r=t.l,(o=t.a)<1?"hsla("+n+", "+s+"%, "+r+"%, "+o+")":"hsl("+n+", "+s+"%, "+r+"%)";var t,n,s,r,o},e.prototype.toHsv=function(){return t=Ny(this.rgba),{h:Vt(t.h),s:Vt(t.s),v:Vt(t.v),a:Vt(t.a,3)};var t},e.prototype.invert=function(){return vs({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),vs(gd(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),vs(gd(this.rgba,-t))},e.prototype.grayscale=function(){return vs(gd(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),vs(zm(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),vs(zm(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"?vs({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):Vt(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=ra(this.rgba);return typeof t=="number"?vs({h:t,s:n.s,l:n.l,a:n.a}):Vt(n.h)},e.prototype.isEqual=function(t){return this.toHex()===vs(t).toHex()},e}(),vs=function(e){return e instanceof Sf?e:new Sf(e)},Um=[],WL=function(e){e.forEach(function(t){Um.indexOf(t)<0&&(t(Sf,wf),Um.push(t))})};function GL(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in n)s[n[r]]=r;var o={};e.prototype.toName=function(i){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=s[this.toHex()];if(u)return u;if(i!=null&&i.closest){var d=this.toRgb(),f=1/0,p="black";if(!o.length)for(var g in n)o[g]=new e(n[g]).toRgb();for(var m in n){var b=(a=d,l=o[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));b<f&&(f=b,p=m)}return p}},t.string.push([function(i){var a=i.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new e(l).toRgb():null},"name"])}function pu(){return(pu=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}function Ly(e,t){if(e==null)return{};var n,s,r={},o=Object.keys(e);for(s=0;s<o.length;s++)t.indexOf(n=o[s])>=0||(r[n]=e[n]);return r}function Cf(e){var t=h.useRef(e),n=h.useRef(function(s){t.current&&t.current(s)});return t.current=e,n.current}var xi=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},oa=function(e){return"touches"in e},jf=function(e){return e&&e.ownerDocument.defaultView||self},Wm=function(e,t,n){var s=e.getBoundingClientRect(),r=oa(t)?function(o,i){for(var a=0;a<o.length;a++)if(o[a].identifier===i)return o[a];return o[0]}(t.touches,n):t;return{left:xi((r.pageX-(s.left+jf(e).pageXOffset))/s.width),top:xi((r.pageY-(s.top+jf(e).pageYOffset))/s.height)}},Gm=function(e){!oa(e)&&e.preventDefault()},eh=h.memo(function(e){var t=e.onMove,n=e.onKey,s=Ly(e,["onMove","onKey"]),r=h.useRef(null),o=Cf(t),i=Cf(n),a=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(v){Gm(v),(oa(v)?v.touches.length>0:v.buttons>0)&&r.current?o(Wm(r.current,v,a.current)):b(!1)},m=function(){return b(!1)};function b(v){var x=l.current,y=jf(r.current),w=v?y.addEventListener:y.removeEventListener;w(x?"touchmove":"mousemove",g),w(x?"touchend":"mouseup",m)}return[function(v){var x=v.nativeEvent,y=r.current;if(y&&(Gm(x),!function(S,C){return C&&!oa(S)}(x,l.current)&&y)){if(oa(x)){l.current=!0;var w=x.changedTouches||[];w.length&&(a.current=w[0].identifier)}y.focus(),o(Wm(y,x,a.current)),b(!0)}},function(v){var x=v.which||v.keyCode;x<37||x>40||(v.preventDefault(),i({left:x===39?.05:x===37?-.05:0,top:x===40?.05:x===38?-.05:0}))},b]},[i,o]),d=u[0],f=u[1],p=u[2];return h.useEffect(function(){return p},[p]),h.createElement("div",pu({},s,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:r,onKeyDown:f,tabIndex:0,role:"slider"}))}),hu=function(e){return e.filter(Boolean).join(" ")},th=function(e){var t=e.color,n=e.left,s=e.top,r=s===void 0?.5:s,o=hu(["react-colorful__pointer",e.className]);return h.createElement("div",{className:o,style:{top:100*r+"%",left:100*n+"%"}},h.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},rn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},Ry=function(e){var t=e.s,n=e.v,s=e.a,r=(200-t)*n/100;return{h:rn(e.h),s:rn(r>0&&r<200?t*n/100/(r<=100?r:200-r)*100:0),l:rn(r/2),a:rn(s,2)}},Ef=function(e){var t=Ry(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},bd=function(e){var t=Ry(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},qL=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:rn(255*[s,a,i,i,l,s][u]),g:rn(255*[l,s,s,a,i,i][u]),b:rn(255*[i,i,l,s,s,a][u]),a:rn(r,2)}},KL=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?YL({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}},YL=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:rn(60*(a<0?a+6:a)),s:rn(o?i/o*100:0),v:rn(o/255*100),a:r}},ZL=h.memo(function(e){var t=e.hue,n=e.onChange,s=hu(["react-colorful__hue",e.className]);return h.createElement("div",{className:s},h.createElement(eh,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:xi(t+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":rn(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(th,{className:"react-colorful__hue-pointer",left:t/360,color:Ef({h:t,s:100,v:100,a:1})})))}),XL=h.memo(function(e){var t=e.hsva,n=e.onChange,s={backgroundColor:Ef({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:s},h.createElement(eh,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:xi(t.s+100*r.left,0,100),v:xi(t.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+rn(t.s)+"%, Brightness "+rn(t.v)+"%"},h.createElement(th,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Ef(t)})))}),JL=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},QL=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function eR(e,t,n){var s=Cf(n),r=h.useState(function(){return e.toHsva(t)}),o=r[0],i=r[1],a=h.useRef({color:t,hsva:o});h.useEffect(function(){if(!e.equal(t,a.current.color)){var u=e.toHsva(t);a.current={hsva:u,color:t},i(u)}},[t,e]),h.useEffect(function(){var u;JL(o,a.current.hsva)||e.equal(u=e.fromHsva(o),a.current.color)||(a.current={hsva:o,color:u},s(u))},[o,e,s]);var l=h.useCallback(function(u){i(function(d){return Object.assign({},d,u)})},[]);return[o,l]}var tR=typeof window<"u"?h.useLayoutEffect:h.useEffect,nR=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},qm=new Map,sR=function(e){tR(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!qm.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}`,qm.set(t,n);var s=nR();s&&n.setAttribute("nonce",s),t.head.appendChild(n)}},[])},rR=function(e){var t=e.className,n=e.hsva,s=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+bd(Object.assign({},n,{a:0}))+", "+bd(Object.assign({},n,{a:1}))+")"},o=hu(["react-colorful__alpha",t]),i=rn(100*n.a);return h.createElement("div",{className:o},h.createElement("div",{className:"react-colorful__alpha-gradient",style:r}),h.createElement(eh,{onMove:function(a){s({a:a.left})},onKey:function(a){s({a:xi(n.a+a.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(th,{className:"react-colorful__alpha-pointer",left:n.a,color:bd(n)})))},oR=function(e){var t=e.className,n=e.colorModel,s=e.color,r=s===void 0?n.defaultColor:s,o=e.onChange,i=Ly(e,["className","colorModel","color","onChange"]),a=h.useRef(null);sR(a);var l=eR(n,r,o),u=l[0],d=l[1],f=hu(["react-colorful",t]);return h.createElement("div",pu({},i,{ref:a,className:f}),h.createElement(XL,{hsva:u,onChange:d}),h.createElement(ZL,{hue:u.h,onChange:d}),h.createElement(rR,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},iR={defaultColor:"rgba(0, 0, 0, 1)",toHsva:KL,fromHsva:function(e){var t=qL(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:QL},aR=function(e){return h.createElement(oR,pu({},e,{colorModel:iR}))};WL([GL]);const lR=e=>e.startsWith("rgba")?e:vs(e).toRgbString();function $y({value:e,onChange:t,disabled:n}){const s=lR(e||""),r=h.useRef(s),[o,i]=h.useState(!1),a=Vs()&&!!window.EyeDropper,l=g=>{r.current=g,t==null||t(g)},u=g=>{r.current=g,t==null||t(g,!0)},d=()=>{a&&new window.EyeDropper().open().then(m=>l(m.sRGBHex)).catch(console.warn)},f=()=>{i(!0)},p=()=>{t==null||t(r.current,!1),i(!1)};return c.jsxs(c.Fragment,{children:[o&&c.jsx("div",{onPointerUp:p,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx(aR,{className:"color-picker",color:s,onChange:u,onPointerDown:f,onPointerUp:p}),c.jsxs(k,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(D,{grow:!0,children:c.jsx(tt,{size:"s",value:s,onChange:l,disabled:n})}),a&&c.jsx(Ke,{type:"button",onClick:d,children:c.jsx(oe,{icon:Z.eyedropperVariant,size:le.s})})]})]})}const cR="gs-cmp-studio-color-picker",uR=h.memo(fe(function({className:t,style:n,value:s="",disabled:r,onChange:o,editorEvents:i}){const{editor:a}=ye(),[l,u]=h.useState(()=>({className:t,style:n,value:s,disabled:r})),d=(f,p)=>{const g=f||"";o==null||o({value:g,partial:p,editor:a,state:l,setState:m=>u(b=>({...b,...m}))})};return Jr({editor:a,editorEvents:i,localState:l,setLocalState:u}),c.jsx("div",{className:N(cR,l.className,je.m),style:l.style,children:c.jsx($y,{value:l.value||"",onChange:d,disabled:l.disabled})})})),dR="gs-cmp-column",fR=h.memo(function({className:t,children:n,full:s,...r}){return c.jsx(mn,{className:N(dR,z.bg,"gs-utl-flex gs-utl-flex-col",s&&"gs-utl-h-full",t),...r,children:Ot(n)})}),nh=`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
|
|
387
|
-
<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",sh={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},ky={stylable:!1,traits:[]};function pR(e){return typeof e=="object"&&e.type===Dt.variable}function Km(e){if(pR(e)){const{path:t}=e;return Vy(t||"")}return e}function Vy(e){return`{{ ${e} }}`}function hR(e){const t={};return e.DataSources.getAll().forEach(n=>{const s=n.get("id");if(!s)return;const r=n.getRecords();if(!r){t[s]={};return}t[s]=r.reduce((o,i)=>{if(!i)return o;let a={...i.attributes};return delete a.__p,delete a.id,s===ko.globalStyles&&(a={value:a.value}),{...o,[i.id]:a}},{})}),t}function Iy(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const rh=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags)??t?{...ky}:{}},Pf=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e,s=(i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags;return t||s===!0?{...ky}:{}},gR=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,mR=e=>Array.isArray(e)?"array":e===null?"default":typeof e,bR=fe(({name:e,value:t,isActive:n,isCollection:s,onClick:r,className:o})=>{const i=Re().tScoped("dataSources"),a=typeof t=="object"&&t!==null,l={array:Z.codeBrackets,object:Z.codeBraces,string:Z.codeString,number:Z.number,boolean:Z.toggleSwitchOffOutline,default:Z.null},u=mR(t),d=N(o,"gs-utl-text-left",z.hBgH,re.b,re.rnd,je.xy,n?[re.bA,z.tA]:[z.br,z.txtHighEmphasisH]),f=p=>typeof p=="object"?Array.isArray(p)?i("items",{params:{length:p.length}}):p?i("properties",{params:{length:Object.keys(p).length}}):"null":String(p);return c.jsx(Ke,{onClick:r,border:!1,className:d,full:!0,children:c.jsxs(k,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs(k,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs(k,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(oe,{icon:l[u],size:le.s}),c.jsx(D,{className:N(Ee.txtEllips,s&&"gs-utl-font-bold"),children:e})]}),c.jsx(D,{className:N("gs-utl-w-full",Ee.txtEllips,Ee.disabled),children:f(t)})]}),a&&c.jsx(D,{children:c.jsx(oe,{size:le.sx,icon:Z.arrowRight,className:N(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),vR="gs-cmp-data-path-explorer",Ym=fe(function({additionalSources:t,onChange:n,path:s=""}){const{editor:r}=ye(),o=h.useRef({}),[i,a]=h.useState(()=>s.split(".")),[l,u]=h.useState([]),d=h.useMemo(()=>({...r?hR(r):{},...t}),[r,t]),f=(b,v)=>{let x=o.current;for(let y=0;y<v&&y<b.length;y++){const w=b[y];if(x&&typeof x=="object"&&w in x)x=x[w];else{x=void 0;break}}return!x||typeof x!="object"?[]:Object.entries(x).map(([y,w])=>{const S=b.slice(0,v).concat(y),C=i[v]===y,j=v===0&&ur(w)&&w.collectionId===y,E=()=>{const _=C?S.slice(0,-1):S;n==null||n(_.join("."),{paths:_}),a(_)};return c.jsx(bR,{className:N(j&&"-gs-utl-order-1"),isCollection:j,name:y,value:w,isActive:C,onClick:E},y)})};h.useEffect(()=>{o.current=d;const b=[];for(let v=0;v<=i.length;v++){const x=f(i,v);x.length>0&&b.push(x)}u(b)},[d,i]);const p=N(vR,z.bg,z.br,re.b,re.rnd,Ee.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]",Ee.scrollY,je.xyS);return c.jsx(k,{className:p,full:!0,nowrap:!0,children:l.map((b,v)=>c.jsx(D,{className:N(g,v!==l.length-1&&re.br),children:c.jsx(k,{col:!0,nowrap:!0,gap:"m",className:m,children:b})},v))})});function Dy(e){const{collectionId:t,variableType:n,path:s=""}=e;return t?[t,n,s].filter(Boolean).join("."):s}function oh(e,t){const[n="",s="",...r]=e.split(".");return n&&t[n]?{collectionId:n,variableType:s,path:r.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const yR=e=>{const{path:t,collectionId:n,variableType:s}=e.dataResolver||{};return n?[n,s,t].filter(Boolean).join("."):e.value||t||""},xR=e=>{const{dataResolver:t,editor:n,value:s,defaultValue:r,additionalSources:o}=e,{path:i="",collectionId:a,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(a){const d=o==null?void 0:o[a],f=l&&d?d[l]:d;return(u==null?void 0:u.getValue(i,r,{context:f}))||""}else return(u==null?void 0:u.getValue(s,r))||""},wR="gs-cmp-data-path-field",el=fe(e=>{const{size:t="m",value:n="",label:s,open:r,defaultValue:o,additionalSources:i,dataResolver:a,readOnly:l,disabled:u,pickerInPopover:d,onChange:f,onPickerToggle:p}=e,{editor:g}=ye(),m=Re().tScoped("dataSources"),[b,v]=h.useState(!!r),[x,y]=h.useState(!1),w=!!l||b||x,S=()=>y(!x),C=H=>{const $=H??!b;v($),p==null||p($)},j=()=>C(!1),E=(...H)=>{f==null||f(...H)},_=H=>{w||f==null||f(H,{paths:H.split(".")})},T=yR({dataResolver:a,value:n}),P=x&&g?`"${xR({editor:g,dataResolver:a,additionalSources:i,value:n,defaultValue:o})}"`:T,A=t==="m",M=A?"lg":t,R=A?le.l:le.s,F=m(b?"closePathExplorer":"openPathExplorer"),L={icon:b?Z.close:Z.databaseOutline,size:le.l},B={icon:x?Z.eyeOff:Z.eye,size:A?le.m:R},q=c.jsx(bt,{block:!0,variant:"pr",size:M,title:F,onClick:()=>C(),icon:L});return c.jsxs(k,{className:wR,gap:t,col:!0,children:[c.jsxs(k,{gap:t,items:"end",nowrap:!0,children:[c.jsx(tt,{readOnly:w,label:s,value:x?P:T,size:t,disabled:u,onChange:_,placeholder:m("selectVariablePath"),className:N("gs-utl-flex-grow",z.txt,Ee.txtEllips),afterInput:!!n&&c.jsx(bt,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:S,className:Ee.hover,icon:B})}),d?c.jsx(ps,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:q,onClose:j,overlay:!0,children:c.jsx(Ym,{path:T,onChange:E,additionalSources:i})}):q]}),!!b&&!d&&c.jsx(Ym,{path:T,onChange:E,additionalSources:i})]})}),SR=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},Hy=({value:e,step:t})=>{const n=parseFloat(`${e}`);let s=0;if(Math.floor(n)!==n&&t){const r=`${t}`.split(".")[1];s=(r==null?void 0:r.length)||0}return s?parseFloat(n.toFixed(s)):n},CR=({value:e,key:t,shiftKey:n,min:s,max:r,step:o=1})=>{const i=t==="ArrowUp",a=t==="ArrowDown";let l=null;if(i||a){l=Number(e);const u=parseFloat(`${o}`);i&&(l+=(n?10:1)*u),a&&(l-=(n?10:1)*u),l=`${gu({min:s,max:r,value:l})}`,l=Hy({value:l,step:o})}return l},gu=({min:e,max:t,value:n})=>{const s=parseFloat(`${n}`);let r=s||0;return Lt(e)&&(r=Math.max(r,parseFloat(`${e}`)||0)),Lt(t)&&(r=Math.min(r,parseFloat(`${t}`)||0)),`${`${s}`!=`${n}`?n:r}`},jR=(e,t,n,s={})=>{const r=parseInt(`${e}`,10)||0,{min:o,max:i,step:a=1}=s;let l=r;const u=f=>{const p=f.clientY-t,g=r-p*parseFloat(`${a}`);l=Hy({value:gu({min:o,max:i,value:g}),step:a}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},ER=(e,t,n={})=>{const{partial:s}=n,r=(o,i)=>o===i||s&&o.startsWith(i);return t.some(o=>r(typeof o=="string"?o:o.id,e))},Zm=e=>Lt(e)?e:"",PR="gs-cmp-number-field";function Ne(e){const{className:t,value:n,units:s,valueUnit:r,size:o="m",pan:i=!0,min:a,max:l,step:u,placeholder:d,disabled:f,onChange:p,onChangeUnit:g}=e,[m,b]=h.useState(Zm(n)),[v,x]=h.useState(!1),y=(s==null?void 0:s.map(T=>({id:T,label:T})))||[],w={min:a,max:l,step:u};h.useEffect(()=>{b(Zm(n))},[n,r]);const S=(T,P)=>{p==null||p(gu({min:a,max:l,value:T}),P)},C=T=>{if(f)return;x(!0);const P=(A,M)=>{S(A,!!M),!M&&x(!1)};jR(m,T.clientY,P,w)},j=T=>{const{key:P,shiftKey:A}=T;switch(P){case"Escape":return b(n);case"Enter":return S(m)}const M=CR({step:u,value:n,key:P,shiftKey:A});M!==null&&(T.preventDefault(),S(M))},E=()=>{S(m)},_=qr({...e,className:N(PR,t)});return c.jsxs("div",{..._,children:[v&&c.jsx("div",{className:N("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(fs,{as:e.labelAs,...e}),c.jsxs(k,{className:Gp(e),items:"center",space:"x2s",children:[!!i&&c.jsx(D,{onMouseDown:C,className:N("gs-utl-opacity-50 gs-utl-cursor-ns",o==="m"&&"-gs-utl-ml-3",o==="s"&&"-gs-utl-ml-2",i!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:i===!0?c.jsx(oe,{icon:Z.panVertical,size:le.s2x}):i}),c.jsx(D,{grow:!0,children:c.jsx("input",{className:Xa(e),value:m,disabled:f,onChange:T=>b(T.target.value),placeholder:d,onBlur:E,onKeyDown:j})}),!!y.length&&c.jsx(D,{className:N(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(_e,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:r,disabled:f,onChange:T=>g==null?void 0:g(T),options:y})})]})]})}const _R="gs-cmp-switch-field";function wa(e){const{className:t,value:n,label:s,labelAs:r,border:o,disabled:i,onChange:a}=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,pa.focus,o&&`${z.br} ${re.b}`);return c.jsx(Ku.Group,{children:c.jsxs(k,{items:"center",className:N(_R,t),full:!0,children:[!!s&&c.jsx(Ku.Label,{as:r,className:N("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(fs,{...e,as:"span"})}),c.jsx(Ku,{checked:l,onChange:a,className:u,disabled:i,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 ih(e){var i;const[t,n]=h.useState(((i=e.getDataResolver)==null?void 0:i.call(e))??{}),s=h.useRef(t),r=a=>{const l={...s.current,...a};s.current=l,n(l)},o=()=>{e.setDataResolver(s.current)};return h.useEffect(()=>{const a="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(a,l),()=>{e.off(a,l)}},[e]),{localData:t,updateLocalData:r,syncToComponent:o}}const TR="gs-cmp-data-collection-picker",OR=fe(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=ih(e),{collectionId:o="",dataSource:i={},startIndex:a=0,endIndex:l=10}=n,u=Dy(i),d=l===Number.MAX_VALUE,f=Re().tScoped("dataSources"),p=d?"":l,g=()=>{r(),t==null||t({value:n})},m=y=>s({dataSource:{...i,path:y}}),b=y=>s({startIndex:y}),v=y=>s({endIndex:y}),x=y=>s({endIndex:y?Number.MAX_VALUE:4});return c.jsxs(k,{className:TR,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(tt,{className:"gs-utl-flex-grow",size:"s",label:f("collectionId"),value:o,readOnly:!0,disabled:!0}),c.jsx(Z0,{size:"s",value:o,block:!0})]}),c.jsx(el,{label:f("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(Ne,{size:"s",className:"gs-utl-flex-grow",label:f("collectionStartIndex"),value:a==null?void 0:a.toString(),onChange:b}),c.jsx(Ne,{size:"s",label:f("collectionEndIndex"),placeholder:d?"-":"",value:p==null?void 0:p.toString(),onChange:v,className:N("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(D,{children:c.jsx(wa,{label:f("collectionUpToEndIndex"),value:d,onChange:x})})]}),c.jsx(k,{full:!0,justify:"end",children:c.jsx(Ke,{onClick:g,variant:"pr",size:"m",children:f("confirm")})})]})}),AR="gs-data-collection-picker",NR=fe(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(mn,{className:N(AR,t),...r,children:c.jsx(OR,{component:n,onConfirm:s})})});var Cn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Cn||{}),yn=(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))(yn||{}),ah=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(ah||{}),lh=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(lh||{});const MR=[...Object.values(lh),...Object.values(ah),...Object.values(yn)],_f={string:Object.values(lh),number:Object.values(ah),dataSource:MR},LR=h.memo(function(t){const{additionalSources:n,side:s,type:r,value:o,onChange:i}=t;switch(r){case Cn.DATA_SOURCE:return c.jsx(el,{size:"s",pickerInPopover:!0,value:Dy(o),onChange:a=>i(s,a,r),additionalSources:n});case Cn.NUMBER:return c.jsx(Ne,{size:"s",value:o,onChange:a=>i(s,a,r)});default:return c.jsx(tt,{size:"s",value:o,onChange:a=>i(s,a,r)})}}),RR="gs-cmp-statement-side",Xm=h.memo(function({side:t,type:n,value:s,label:r,onChange:o,onTypeChange:i,additionalSources:a,typeOptions:l}){return c.jsxs(k,{className:N(RR,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Dr,{size:"s",children:r}),c.jsxs(k,{items:"center",gap:"xs",children:[c.jsx(D,{children:c.jsx(_e,{size:"s",value:n,options:l,onChange:u=>i(t,u)})}),c.jsx(D,{grow:!0,children:c.jsx(LR,{additionalSources:a,side:t,type:n,value:s,onChange:o})})]})]})}),Tl=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Cn.DATA_SOURCE:typeof e=="string"?Cn.STRING:typeof e=="number"?Cn.NUMBER:Cn.STRING,$R=(e,t,n)=>{switch(t){case Cn.STRING:return e||"";case Cn.NUMBER:return e?Number(e):0;case Cn.DATA_SOURCE:{const s=n||{};return{type:"data-variable",...(ot(e)?oh(e,s):e)??{path:"",defaultValue:""}}}default:return e}},kR=e=>_f[e][0],VR=e=>![yn.isTruthy,yn.isFalsy,yn.isDefined,yn.isNull,yn.isUndefined,yn.isArray,yn.isObject,yn.isString,yn.isNumber,yn.isBoolean,yn.isDefaultValue].includes(e),IR="gs-cmp-statement",DR=fe(e=>{const{statement:t,onChange:n,className:s,additionalSources:r}=e,o=Re().tScoped("dataSources"),[i,a]=h.useState(()=>Tl(t.left)),[l,u]=h.useState(()=>Tl(t.right)),d=_f[i]||_f[Cn.STRING],f=h.useMemo(()=>Object.values(Cn).map(S=>({id:S,label:Ts(S)})),[]),p=h.useMemo(()=>d.map(S=>({id:S,label:o(`operators.${S}`)})),[d,o]);h.useEffect(()=>{a(Tl(t.left)),u(Tl(t.right))},[t.left,t.right]);const g=S=>{n({...t,...S})},m=(S,C,j)=>{const E=$R(C,j,r),_=S==="left",T=_&&j!==Cn.DATA_SOURCE;_?a(j):u(j),g({[S]:E,...T&&{operator:kR(j)}})},b=(S,C)=>m(S,null,C),v=S=>g({operator:S}),x=N(IR,s,z.br,re.b,re.rnd,je.xy),y=VR(t.operator),w={additionalSources:r,onChange:m,onTypeChange:b,typeOptions:f};return c.jsx(k,{className:N(x,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs(k,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(Xm,{side:"left",type:i,value:t.left,label:o("leftValue"),...w}),c.jsx(D,{children:c.jsx(_e,{size:"s",label:o("operator"),value:t.operator,options:p,onChange:v})}),y&&c.jsx(Xm,{side:"right",type:l,value:t.right,label:o("rightValue"),...w})]})})}),vd="gs-cmp-statements-group",HR=e=>e==="and"||e==="or",Ec=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),Fy=fe(e=>{const{className:t,condition:n,onUpdate:s,additionalSources:r,skipAddCondition:o}=e,i=Re().tScoped("dataSources"),a=n.statements??[],l=n.logicalOperator||"and",u=m=>{HR(m)&&s({...n,logicalOperator:m})},d=()=>{Ec(n),s(Ec(n))},f=m=>{const b=a.filter((v,x)=>x!==m);s({...n,statements:b})},p=(m,b)=>{if(m>=0&&m<a.length){const v=[...a];v[m]=b,s({...n,statements:v})}},g=[{id:"and",label:i("conditionAnd")},{id:"or",label:i("conditionOr")}];return c.jsxs(k,{className:N(vd,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[a.length>1&&c.jsx(Yr,{value:l,onChange:u,tabs:g}),c.jsx(k,{className:`${vd}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:a.map((m,b)=>c.jsxs(k,{className:N(`${vd}__item`),gap:"s",col:!0,children:[c.jsx(DR,{additionalSources:r,statement:m,onChange:v=>p(b,v)}),b<a.length-1&&c.jsxs(k,{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(bt,{block:!0,variant:"out-clear",title:i("deleteCondition"),onClick:()=>f(b+1),icon:{icon:Z.delete,size:le.s}})]})]},`stmt-${b}`))}),!o&&c.jsx(k,{justify:"end",children:c.jsx(Ke,{variant:"pr",onClick:d,icon:{icon:Z.plus,size:le.s},children:i("addCondition")})})]})}),FR="gs-cmp-data-condition-picker",BR=fe(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=ih(e),o=Re().tScoped("dataSources"),i=n.condition,a=d=>s({condition:d}),l=()=>{r(),t==null||t({value:n})},u=()=>{s({condition:Ec(i)})};return c.jsxs(k,{className:FR,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(Fy,{additionalSources:e.collectionsStateMap??{},condition:i,onUpdate:a,skipAddCondition:!0}),c.jsxs(k,{gap:"m",justify:"end",full:!0,children:[c.jsx(Ke,{variant:"out",onClick:u,icon:{icon:Z.plus,size:le.s},children:o("addCondition")}),c.jsx(Ke,{onClick:l,variant:"pr",size:"m",children:o("confirm")})]})]})}),zR="gs-data-condition-picker",UR=fe(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(mn,{className:N(zR,t),...r,children:c.jsx(BR,{component:n,onConfirm:s})})}),WR="gs-data-path-field",GR=fe(({className:e,value:t="",onChange:n,...s})=>c.jsx(mn,{className:N(WR,e),...s,children:c.jsx(el,{onChange:r=>n({value:r}),value:t})})),Ol={type:"data-variable",path:"",defaultValue:""},Jm={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function Hr(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const Qm="gs-cmp-dynamic-value-picker",qR=fe(({value:e,onChange:t,onConfirm:n,additionalSources:s})=>{const[r,o]=h.useState(()=>Hr(e)?e:Ol),[i,a]=h.useState(r.type),l=Re().tScoped("dataSources");h.useEffect(()=>{const w=Hr(e)?e:Ol;(w.type!==r.type||JSON.stringify(w)!==JSON.stringify(r))&&(o(w),a(w.type))},[e]);const u=w=>{o(w),t==null||t({value:w})},d=w=>{const S=w;a(S);const C=r.type===S?r:S==="data-variable"?Ol:Jm;u(C)},f=w=>{u({type:"data-variable",defaultValue:r.defaultValue,...oh(w,s)})},p=w=>{o(S=>{const C={...S,defaultValue:w};return t==null||t({value:C}),C})},g=w=>{u({...r,condition:w})},m=(w,S)=>{u({...r,[w]:S})},b=()=>{const w=r.condition;g(Ec(w))},v=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],x=(r==null?void 0:r.type)==="data-variable"?r:Ol,y=(r==null?void 0:r.type)==="data-condition"?r:Jm;return c.jsxs(k,{className:Qm,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{className:Qm,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(Yr,{value:i,onChange:d,tabs:v}),c.jsx(D,{grow:!0,className:je.y,style:{overflowY:"auto",overflowX:"hidden"},children:i==="data-variable"?c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(el,{value:x.path,label:l("variablePath"),additionalSources:s,defaultValue:x.defaultValue,onChange:f}),c.jsx(tt,{label:l("defaultValue"),value:x.defaultValue||"",onChange:p})]}):c.jsxs(k,{gap:"m",col:!0,children:[c.jsx(Fy,{additionalSources:s,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(tt,{label:l("ifTrue"),value:y.ifTrue,onChange:w=>m("ifTrue",w)}),c.jsx(tt,{label:l("ifFalse"),value:y.ifFalse,onChange:w=>m("ifFalse",w)})]})]})}),i==="data-condition"&&c.jsx(k,{full:!0,justify:"end",className:je.x,children:c.jsx(Ke,{variant:"out",onClick:b,icon:{icon:Z.plus,size:le.s},children:l("addCondition")})})]}),c.jsx(k,{full:!0,justify:"end",className:je.y,children:c.jsx(Ke,{onClick:()=>{n==null||n({value:r})},variant:"pr",size:"m",children:l("confirm")})})]})}),KR="gs-data-value-picker",YR=fe(({className:e,value:t={},onChange:n,onConfirm:s,additionalSources:r={},...o})=>c.jsx(mn,{className:N(KR,e),...o,children:c.jsx(qR,{value:t,onConfirm:i=>s==null?void 0:s(i),onChange:i=>n==null?void 0:n(i),additionalSources:r})})),ZR="gs-cmp-data-variable-picker",XR=fe(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=ih(e),o=Re().tScoped("dataSources"),{path:i="",defaultValue:a=""}=n,l=e.collectionsStateMap,u=p=>{s(oh(p,l))},d=()=>{r(),t==null||t({value:n})},f=p=>s({defaultValue:p});return c.jsxs(k,{className:ZR,gap:"s",col:!0,nowrap:!0,children:[c.jsx(el,{value:i,label:o("variablePath"),dataResolver:n,additionalSources:l,defaultValue:a,onChange:u}),c.jsx(tt,{label:o("defaultValue"),value:a,onChange:f}),c.jsx(k,{full:!0,justify:"end",className:je.y,children:c.jsx(Ke,{onClick:d,variant:"pr",size:"m",children:o("confirm")})})]})}),JR="gs-data-variable-picker",QR=fe(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(mn,{className:N(JR,t),...r,children:c.jsx(XR,{component:n,onConfirm:s})})}),e$="gs-cmp-input-field",t$=h.memo(fe(function({className:t,style:n,label:s,name:r,value:o,size:i,disabled:a,inputType:l,readOnly:u,required:d,placeholder:f,onChange:p,onInput:g,editorEvents:m}){const{editor:b}=ye(),[v,x]=h.useState(()=>({className:t,style:n,label:s,name:r,value:o,size:i,readOnly:u,disabled:a,required:d,placeholder:f})),y=C=>({value:C,editor:b,state:v,setState:j=>x(E=>({...E,...j}))}),w=C=>p==null?void 0:p(y(C)),S=C=>g==null?void 0:g(y(C));return Jr({editor:b,editorEvents:m,localState:v,setLocalState:x}),c.jsx(tt,{type:l,className:N(e$,v.className),style:v.style,label:v.label,name:v.name,value:v.value,size:v.size,required:v.required,disabled:v.disabled,readOnly:v.readOnly,placeholder:v.placeholder,onChange:w,onInput:S})})),n$="gs-menu-list",s$=fe(function({className:e,items:t,onItemClick:n,...s}){const{editor:r}=ye(),[o,i]=h.useState(),a=u=>{const{onClick:d}=u;if(d&&r)return f=>d({item:u,editor:r,...f})},l=()=>{if(n&&r)return u=>n({...u,editor:r})};return c.jsx(mn,{className:N(n$,z.bg,"gs-utl-flex gs-utl-flex-col",e),...s,children:(t||[]).map((u,d)=>h.createElement(_i,{...u,label:u.layout?Ot(u.layout):u.label,key:u.id??d,className:u.className,action:a(u),onActive:()=>i(u),onItemClick:l(),active:o===u,items:u.items}))})});function r$({children:e,accept:t,onChange:n,multiple:s=!0,...r}){const o=Re(),i=h.useRef(null),a=()=>{const{current:l}=i;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:ee("hidden"),ref:i,type:"file",multiple:s,accept:t,onChange:n}),c.jsx(Ke,{variant:"pr",size:"m2",...r,onClick:a,children:e||o.t("upload")})]})}const o$=fe(r$),i$=fe(function({editor:t,assetProps:n,itemLayout:s,onSelect:r,onRemove:o}){const i=Ka();return Ot(s({asset:Er(i.toAsset(n)),assetProps:Er(n),onSelect:a=>r(i.toAssetProps(a)),onDelete:o&&(a=>o(i.toAssetProps(a))),editor:t}))}),a$="gs-cmp-asset-card",l$=fe(function(t){var f;const{assetProps:n,onSelect:s,onRemove:r,className:o,itemLayout:i}=t,a=Re(),{editor:l}=ye();if(i)return l?c.jsx(i$,{...t,editor:l,itemLayout:i}):null;const{src:u}=n,d=n.name||((f=u.split("/").pop())==null?void 0:f.split("?").shift());return c.jsx(Xn,{padding:!1,className:ue(a$,"overflow-hidden max-w-full group",o),children:c.jsxs(k,{col:!0,children:[c.jsxs(D,{className:ue("relative group h-24 cursor-pointer bg-checker"),onClick:()=>s(n),children:[c.jsx("div",{className:ue("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(k,{justify:"center",items:"center",className:ue(Ee.coverAbs,z.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Ke,{className:ue("text-sm"),size:"m2",variant:"pr",children:a.t("select")})})]}),c.jsxs(k,{className:ue("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(D,{className:ue(Ee.txtEllips,"text-sm gjs-mr-auto"),children:d}),r&&c.jsx(fu,{onConfirm:()=>r==null?void 0:r(n),text:c.jsxs(k,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ue("text-center",z.txtHighEmphasis),children:a.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ue("text-center"),children:a.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(bt,{title:a.t("delete"),children:c.jsx(oe,{icon:Z.delete,size:le.sx})})})]})]})})}),bs="gs-asset-manager",c$={search:!0,addUrl:!0,upload:!0},u$=fe(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:s,typeFilter:r,providerFilter:o,searchValue:i,isLoading:a,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:f,content:p,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:b,onChangeSearchValue:v,onChangeUpload:x,onAddUrl:y,onRemove:w,onEndReached:S,layoutAfterHeader:C}){const j=ye(),{editor:E}=j,_=Re(),[T]=Bp(),P=Qp(p==null?void 0:p.itemsPerRow),[A,M]=h.useState(""),R=(p==null?void 0:p.header)===!1?!1:{...c$,...ur(p==null?void 0:p.header)?p.header:{}};if(!E)return;const F=d?t.filter(L=>!(i&&!ni(L.src,i)&&!ni(L.name??"",i))):t;return c.jsxs(k,{className:ee(bs,"relative gs-utl-h-full",a&&Ee.disabled),nowrap:!0,col:!0,space:"m",children:[R!==!1&&c.jsxs(k,{className:`${bs}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(k,{className:`${bs}__header-filters`,items:"center",gap:"m",children:[R.search&&c.jsx(D,{children:c.jsx(tt,{className:`${bs}__search-filter`,size:"m",type:"search",value:i,onInput:v,placeholder:`${_.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(D,{children:c.jsx(_e,{className:ee(`${bs}__type-filter`,"items-center"),size:"m",options:n,value:r,onChange:m,emptyState:_.t("assetManager.assetTypes.all"),includeEmpty:l})}),s.length>(u?0:1)&&c.jsx(D,{children:c.jsx(_e,{classNameContainer:ee(`${bs}__provider-filter`,"items-center"),size:"m",options:s.map(L=>({...L,label:Ye(L.label)?L.label({editor:E}):L.label,icon:L.icon})),value:o,onChange:b,emptyState:_.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(k,{className:`${bs}__header-buttons`,items:"center",gap:"m",children:[R.upload&&c.jsx(D,{children:c.jsx(o$,{className:`${bs}__upload-field`,onChange:x})}),R.addUrl&&!!y&&c.jsx(D,{children:c.jsx(ps,{className:`${bs}__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(k,{gap:"m",children:[c.jsx(D,{children:c.jsx(tt,{type:"url",size:"s",value:A,onChange:M,placeholder:_.t("assetManager.inputPlh")})}),c.jsx(D,{children:c.jsx(Ke,{variant:"pr",size:"m2",onClick:()=>{y(A),L()},children:_.t("add")})})]})})})]}),C&&c.jsx(c.Fragment,{children:Ot(C({editor:E}))})]}),c.jsx(k,{className:ee(`${bs}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!a&&!F.length?c.jsx(k,{justify:"center",children:_.t("noItems")}):!!T&&c.jsx(du,{data:F,listClassName:ee("gs-utl-grid gs-utl-gap-2",P),endReached:S,itemContent:(L,B)=>c.jsx(l$,{assetProps:B,onSelect:g,onRemove:w,itemLayout:f},B.id),components:{Footer:S?d$:void 0}})}),a&&c.jsx(Co,{abs:!0})]})}),d$=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),f$=fe(function({panelId:t,content:n,assets:s,types:r,providers:o,typeId:i,providerId:a,optionalType:l,optionalProvider:u,onSelect:d,close:f,layoutAfterHeader:p}){const{appEditorStore:g,i18nStore:m}=bn(),{editor:b}=g,v=Ka(),{customOnLoad:x}=v,y=w0(t);h.useEffect(()=>{const E=T=>ot(T)?{id:T,label:m.t(`assetManager.assetTypes.${T}`)||T}:T;y.setCustomTypes(r==null?void 0:r.map(E)),y.setCustomProviders(ot(o)?[o]:o),i?y.setTypeFilter(i):y.initTypeFilter(),a?y.setProviderFilter(a):y.initProviderFilter(),Lt(l)?y.setOptionalType(l):y.initOptionalType(),Lt(u)?y.setOptionalProvider(u):y.initOptionalProvider();const _=setTimeout(()=>y.loadAssets());return()=>clearTimeout(_)},[r,o,i,a,l,u]);const w=E=>{v.addToProjectAssets([{id:E,src:E,type:y.typeFilter??go.image}])},S=E=>{b&&(d==null||d({asset:v.toAsset(E),assetProps:E,editor:b}),f==null||f())},C=s==null?void 0:s.map(v.toAssetProps),j=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(u$,{assetProps:C??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:E=>{y.setTypeFilter(E),y.loadAssets()},onChangeProviderFilter:E=>{y.setProviderFilter(E),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:S,onAddUrl:x?void 0:w,onChangeUpload:E=>v.uploadFile(E.nativeEvent),onRemove:C?void 0:y.handleDelete,onEndReached:j,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:p})});var p$=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),Tt=function(){return Tt=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Tt.apply(this,arguments)},e1={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},t1={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Al={width:"20px",height:"20px",position:"absolute"},h$={top:Tt(Tt({},e1),{top:"-5px"}),right:Tt(Tt({},t1),{left:void 0,right:"-5px"}),bottom:Tt(Tt({},e1),{top:void 0,bottom:"-5px"}),left:Tt(Tt({},t1),{left:"-5px"}),topRight:Tt(Tt({},Al),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Tt(Tt({},Al),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Tt(Tt({},Al),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Tt(Tt({},Al),{left:"-10px",top:"-10px",cursor:"nw-resize"})},g$=function(e){p$(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(s){n.props.onResizeStart(s,n.props.direction)},n.onTouchStart=function(s){n.props.onResizeStart(s,n.props.direction)},n}return t.prototype.render=function(){return et.createElement("div",{className:this.props.className||"",style:Tt(Tt({position:"absolute",userSelect:"none"},h$[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(et.PureComponent),m$=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),xs=function(){return xs=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},xs.apply(this,arguments)},b$={width:"auto",height:"auto"},Nl=function(e,t,n){return Math.max(Math.min(e,n),t)},n1=function(e,t,n){var s=Math.round(e/t);return s*t+n*(s-1)},Uo=function(e,t){return new RegExp(e,"i").test(t)},Ml=function(e){return!!(e.touches&&e.touches.length)},v$=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},s1=function(e,t,n){n===void 0&&(n=0);var s=t.reduce(function(o,i,a){return Math.abs(i-e)<Math.abs(t[o]-e)?a:o},0),r=Math.abs(t[s]-e);return n===0||r<n?t[s]:e},yd=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"},Ll=function(e,t,n,s){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var r=Number(e.replace("%",""))/100;return t*r}if(e.endsWith("vw")){var r=Number(e.replace("vw",""))/100;return n*r}if(e.endsWith("vh")){var r=Number(e.replace("vh",""))/100;return s*r}}return e},y$=function(e,t,n,s,r,o,i){return s=Ll(s,e.width,t,n),r=Ll(r,e.height,t,n),o=Ll(o,e.width,t,n),i=Ll(i,e.height,t,n),{maxWidth:typeof s>"u"?void 0:Number(s),maxHeight:typeof r>"u"?void 0:Number(r),minWidth:typeof o>"u"?void 0:Number(o),minHeight:typeof i>"u"?void 0:Number(i)}},x$=function(e){return Array.isArray(e)?e:[e,e]},w$=["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"],r1="__resizable_base__",S$=function(e){m$(t,e);function t(n){var s,r,o,i,a=e.call(this,n)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.appendBase=function(){if(!a.resizable||!a.window)return null;var l=a.parentNode;if(!l)return null;var u=a.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(r1):u.className+=r1,l.appendChild(u),u},a.removeBase=function(l){var u=a.parentNode;u&&u.removeChild(l)},a.state={isResizing:!1,width:(r=(s=a.propsSize)===null||s===void 0?void 0:s.width)!==null&&r!==void 0?r:"auto",height:(i=(o=a.propsSize)===null||o===void 0?void 0:o.height)!==null&&i!==void 0?i:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||b$},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,s=0;if(this.resizable&&this.window){var r=this.resizable.offsetWidth,o=this.resizable.offsetHeight,i=this.resizable.style.position;i!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:r,s=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:o,this.resizable.style.position=i}return{width:n,height:s}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,s=this.props.size,r=function(a){var l;if(typeof n.state[a]>"u"||n.state[a]==="auto")return"auto";if(n.propsSize&&n.propsSize[a]&&(!((l=n.propsSize[a])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[a].toString().endsWith("%"))return n.state[a].toString();var u=n.getParentSize(),d=Number(n.state[a].toString().replace("px","")),f=d/u[a]*100;return f+"%"}return yd(n.state[a])},o=s&&typeof s.width<"u"&&!this.state.isResizing?yd(s.width):r("width"),i=s&&typeof s.height<"u"&&!this.state.isResizing?yd(s.height):r("height");return{width:o,height:i}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var s=!1,r=this.parentNode.style.flexWrap;r!=="wrap"&&(s=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var o={width:n.offsetWidth,height:n.offsetHeight};return s&&(this.parentNode.style.flexWrap=r),this.removeBase(n),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,s){var r=this.propsSize&&this.propsSize[s];return this.state[s]==="auto"&&this.state.original[s]===n&&(typeof r>"u"||r==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,s){var r=this.props.boundsByDirection,o=this.state.direction,i=r&&Uo("left",o),a=r&&Uo("top",o),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=i?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=i?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=i?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n<l?n:l),u&&Number.isFinite(u)&&(s=s&&s<u?s:u),{maxWidth:n,maxHeight:s}},t.prototype.calculateNewSizeFromDirection=function(n,s){var r=this.props.scale||1,o=x$(this.props.resizeRatio||1),i=o[0],a=o[1],l=this.state,u=l.direction,d=l.original,f=this.props,p=f.lockAspectRatio,g=f.lockAspectRatioExtraHeight,m=f.lockAspectRatioExtraWidth,b=d.width,v=d.height,x=g||0,y=m||0;return Uo("right",u)&&(b=d.width+(n-d.x)*i/r,p&&(v=(b-y)/this.ratio+x)),Uo("left",u)&&(b=d.width-(n-d.x)*i/r,p&&(v=(b-y)/this.ratio+x)),Uo("bottom",u)&&(v=d.height+(s-d.y)*a/r,p&&(b=(v-x)*this.ratio+y)),Uo("top",u)&&(v=d.height-(s-d.y)*a/r,p&&(b=(v-x)*this.ratio+y)),{newWidth:b,newHeight:v}},t.prototype.calculateNewSizeFromAspectRatio=function(n,s,r,o){var i=this.props,a=i.lockAspectRatio,l=i.lockAspectRatioExtraHeight,u=i.lockAspectRatioExtraWidth,d=typeof o.width>"u"?10:o.width,f=typeof r.width>"u"||r.width<0?n:r.width,p=typeof o.height>"u"?10:o.height,g=typeof r.height>"u"||r.height<0?s:r.height,m=l||0,b=u||0;if(a){var v=(p-m)*this.ratio+b,x=(g-m)*this.ratio+b,y=(d-b)/this.ratio+m,w=(f-b)/this.ratio+m,S=Math.max(d,v),C=Math.min(f,x),j=Math.max(p,y),E=Math.min(g,w);n=Nl(n,S,C),s=Nl(s,j,E)}else n=Nl(n,d,f),s=Nl(s,p,g);return{newWidth:n,newHeight:s}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var s=this.parentNode;if(s){var r=s.getBoundingClientRect();this.parentLeft=r.left*n,this.parentTop=r.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left*n,this.targetTop=o.top*n}if(this.resizable){var i=this.resizable.getBoundingClientRect(),a=i.left,l=i.top,u=i.right,d=i.bottom;this.resizableLeft=a*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,s){if(!(!this.resizable||!this.window)){var r=0,o=0;if(n.nativeEvent&&v$(n.nativeEvent)?(r=n.nativeEvent.clientX,o=n.nativeEvent.clientY):n.nativeEvent&&Ml(n.nativeEvent)&&(r=n.nativeEvent.touches[0].clientX,o=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var i=this.props.onResizeStart(n,s,this.resizable);if(i===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",a=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var f={original:{x:r,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:xs(xs({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:s,flexBasis:a};this.setState(f)}},t.prototype.onMouseMove=function(n){var s=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&Ml(n))try{n.preventDefault(),n.stopPropagation()}catch{}var r=this.props,o=r.maxWidth,i=r.maxHeight,a=r.minWidth,l=r.minHeight,u=Ml(n)?n.touches[0].clientX:n.clientX,d=Ml(n)?n.touches[0].clientY:n.clientY,f=this.state,p=f.direction,g=f.original,m=f.width,b=f.height,v=this.getParentSize(),x=y$(v,this.window.innerWidth,this.window.innerHeight,o,i,a,l);o=x.maxWidth,i=x.maxHeight,a=x.minWidth,l=x.minHeight;var y=this.calculateNewSizeFromDirection(u,d),w=y.newHeight,S=y.newWidth,C=this.calculateNewMaxFromBoundary(o,i);this.props.snap&&this.props.snap.x&&(S=s1(S,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(w=s1(w,this.props.snap.y,this.props.snapGap));var j=this.calculateNewSizeFromAspectRatio(S,w,{width:C.maxWidth,height:C.maxHeight},{width:a,height:l});if(S=j.newWidth,w=j.newHeight,this.props.grid){var E=n1(S,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),_=n1(w,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),T=this.props.snapGap||0,P=T===0||Math.abs(E-S)<=T?E:S,A=T===0||Math.abs(_-w)<=T?_:w;S=P,w=A}var M={width:S-g.width,height:w-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var R=S/v.width*100;S=R+"%"}else if(m.endsWith("vw")){var F=S/this.window.innerWidth*100;S=F+"vw"}else if(m.endsWith("vh")){var L=S/this.window.innerHeight*100;S=L+"vh"}}if(b&&typeof b=="string"){if(b.endsWith("%")){var R=w/v.height*100;w=R+"%"}else if(b.endsWith("vw")){var F=w/this.window.innerWidth*100;w=F+"vw"}else if(b.endsWith("vh")){var L=w/this.window.innerHeight*100;w=L+"vh"}}var B={width:this.createSizeForCssProperty(S,"width"),height:this.createSizeForCssProperty(w,"height")};this.flexDir==="row"?B.flexBasis=B.width:this.flexDir==="column"&&(B.flexBasis=B.height);var q=this.state.width!==B.width,H=this.state.height!==B.height,$=this.state.flexBasis!==B.flexBasis,I=q||H||$;I&&Dn.flushSync(function(){s.setState(B)}),this.props.onResize&&I&&this.props.onResize(n,p,this.resizable,M)}},t.prototype.onMouseUp=function(n){var s,r,o=this.state,i=o.isResizing,a=o.direction,l=o.original;if(!(!i||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,a,this.resizable,u),this.props.size&&this.setState({width:(s=this.props.size.width)!==null&&s!==void 0?s:"auto",height:(r=this.props.size.height)!==null&&r!==void 0?r:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:xs(xs({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var s,r;this.setState({width:(s=n.width)!==null&&s!==void 0?s:"auto",height:(r=n.height)!==null&&r!==void 0?r:"auto"})},t.prototype.renderResizer=function(n){var s=this,r=this.props,o=r.enable,i=r.handleStyles,a=r.handleClasses,l=r.handleWrapperStyle,u=r.handleWrapperClass,d=r.handleComponent;if(!o)return null;var f=n.filter(function(p){return o[p]!==!1}).map(function(p){return o[p]!==!1?et.createElement(g$,{key:p,direction:p,onResizeStart:s.onResizeStart,replaceStyles:i&&i[p],className:a&&a[p]},d&&d[p]?d[p]:null):null});return et.createElement("div",{className:u,style:l},f)},t.prototype.render=function(){var n=this,s=Object.keys(this.props).reduce(function(i,a){return w$.indexOf(a)!==-1||(i[a]=n.props[a]),i},{}),r=xs(xs(xs({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(r.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return et.createElement(o,xs({style:r,className:this.props.className},s,{ref:function(i){i&&(n.resizable=i)}}),this.state.isResizing&&et.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}(et.PureComponent);function mu({className:e,children:t,top:n,bottom:s,right:r,left:o,width:i,height:a,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,onResize:g,onResizeStop:m,...b}){const v={top:n||!1,right:r||!1,bottom:s||!1,left:o||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},x={width:i||"auto",height:a||"auto"},y=N("gs-utl-z-10",z.hBgAct),w={top:y,bottom:y,right:y,left:y},S={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(S$,{className:e,enable:b.enable??v,defaultSize:x,handleStyles:S,handleClasses:w,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,children:t})}const ch="gs-cmp-accordion",Tf=`${ch}-handler`,Rl=`${Tf}__content`,C$=`${ch}-content`;function ar({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:s,style:r,handler:o,handlerIcon:i,children:a,inverted:l,disabled:u,sticky:d,onChange:f,open:p}){return c.jsx(Wu,{as:"div",defaultOpen:p,className:ee(ch,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(Wu.Button,{as:u?"div":"button",disabled:u,style:r,onClick:m=>f==null?void 0:f({event:m,open:!g}),className:({open:m})=>N(Tf,Ye(e)?e(m):e,d&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:m})=>c.jsxs(k,{items:"center",className:ee("gap-2"),full:!0,children:[c.jsx(D,{className:ee(Rl,s,"text-left"),grow:!0,children:Ye(o)?o(m):c.jsxs(k,{items:"center",className:ee(`${Rl}-wrp`,"gap-3"),nowrap:!0,children:[!!i&&c.jsx(oe,{className:ee(`${Rl}-icon`),icon:i,size:le.s2x}),c.jsx(D,{className:ee(`${Rl}-label gs-utl-w-full`),children:o})]})}),c.jsx(D,{className:ee(`${Tf}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(oe,{icon:Z.chevronDown,className:ee("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(Wu.Panel,{className:ee(C$,n),children:a})]})})}const Fi="gs-studio-panel",By=(e,t={})=>({...t,...e===!0?{}:e||void 0}),hs=h.memo(function({children:t,header:n,resizable:s,className:r,classNameAccordion:o,classNameAccordionContent:i,...a}){const l=c.jsx(mn,{className:N(Fi,r),...a,children:t}),u=s?s===!0?{top:!0,right:!0,bottom:!0,left:!0}:s:void 0,d=u?c.jsx(mu,{className:N([`${Fi}__resizer`]),...u,children:l}):l,f=n===!0?{collapsible:!0}:n||void 0;return f?c.jsx(ar,{classNameWrap:N(`${Fi}__accordion`,o),className:N(`${Fi}__accordion-header`,je.xy,f.className),classNameContent:N(`${Fi}__accordion-content`,i),disabled:f.collapsible===!1,style:f.style,handler:c.jsxs(k,{space:"s",items:"center",children:[!!f.icon&&c.jsx(oe,{icon:f.icon,size:le.s}),c.jsx(D,{grow:!0,children:f.label})]}),open:n?f.collapsed!==!0:!0,children:d}):d}),j$="gs-panel-assets",E$=h.memo(fe(function({className:t,onSelect:n,content:s,assets:r,types:o,providers:i,typeId:a,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:f,layoutAfterHeader:p,...g}){var C;const m=ye(),b=Ka(),v=m.editor,x=(C=m.sdkOptions.assets)==null?void 0:C.layoutAfterHeader,y=p||x,[w]=h.useState(()=>g.id||n0());return h.useEffect(()=>(b.createAssetManager(w),()=>{b.removeAssetManager(w)}),[w]),w0(w)?c.jsx(hs,{className:N(j$,"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:v&&c.jsx(f$,{panelId:w,assets:r,types:o,providers:i,onSelect:n,typeId:a,providerId:l,content:s,optionalType:u,optionalProvider:f??d,layoutAfterHeader:y})}):null}));var Yi=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(Yi||{}),Ps=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Ps||{});const o1="gs-block-item",P$=e=>{const{block:t,className:n,itemLayout:s,onClick:r,variant:o}=e,{editor:i}=ye(),a=Re(),[,l]=h.useState(0),u=a.tScoped("blockManager.labels"),d=t.getId(),f=!!t.get("full"),p=r||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),b=t.getMedia(),v=t.get("attributes")||{},x=u(d)||t.getLabel(),y=o==="compact",w=N(o1,`${o1}--${d}`,n,"gs-utl-px-2 gs-utl-transition-colors",re.b,re.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?Ee.disabledM:N("gs-utl-cursor-pointer",z.hTAo,z.hBgH)),S=Lt(v.class)&&!y?v.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"),C=N("gs-utl-text-center",Ee.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!i)return;const{Blocks:A}=i,M=A.events.update,R=F=>F===t&&l(L=>++L);return i.on(M,R),()=>{i.off(M,R)}},[t,i]),!i)return null;const{Blocks:j}=i,T={className:w,...!g&&{onDragStart:()=>j.startDrag(t),onDragEnd:()=>j.endDrag(!1),draggable:!r},...!!p&&{onClick:()=>p(t,i)}},P=s==null?void 0:s({editor:i,block:t,attributes:T});return P&&Ot(P)||c.jsxs(k,{items:"center",...T,children:[m||c.jsx("div",{className:S,dangerouslySetInnerHTML:{__html:b}}),c.jsx("div",{className:C,title:x,children:x})]})},i1=fe(P$);function uh({className:e,value:t,onChange:n}){const[s,r]=h.useState(t),o=h.useRef(null),i=u=>{const{value:d}=u.target;r(d)},a=()=>{n(s||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(s||t);break}};return h.useEffect(()=>{o.current&&o.current.select()},[]),c.jsx("input",{autoFocus:!0,className:ee([e,"w-full",z.bgTr]),value:s,onChange:i,onBlur:a,onKeyDown:l,onPointerDown:bo,ref:o})}function zy({className:e,value:t,active:n,unstyled:s,activable:r,onChange:o,onActive:i,...a}){const[l,u]=h.useState(n);h.useEffect(()=>{u(n)},[n]);const d=p=>{i==null||i(p),u(p)},f=p=>{o(p),d(!1)};return c.jsx("div",{className:ee("truncate",e),...a,onDoubleClick:()=>r&&d(!0),children:l?c.jsx(uh,{className:ee(s&&Ee.noFocusOut),value:t,onChange:f}):c.jsx(c.Fragment,{children:t})})}const a1=ue("text-sm w-full",Ee.txtEllips),_$=({symbol:e,className:t})=>{const n=Ja(),{Components:s}=n,r=Re(),o=ji(),i=r.tScoped("blockManager.symbols"),a=()=>{const{draggable:x,droppable:y,attributes:w,type:S,tagName:C}=e.attributes;n.Canvas.startDrag({content:()=>s.addSymbol(e),model:e,dragDef:{type:S,tagName:C,draggable:x,droppable:y,attributes:w}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),f=s.getSymbolInfo(e).instances.length,p=ue("h-10 w-10 block-media",z.grouphTAo),g=ue("gjs-pt-1 gjs-mt-2",re.bt,z.br),m=ue("cursor-pointer gjs-p-2 transition-colors group",re.b,re.rnd,z.br,z.hBgH,t),b=()=>{o.confirm({title:i("delete"),content:i("deleteConfirm"),onConfirm:()=>e.remove()})},v=x=>{e.set("custom-name",x)};return c.jsxs(k,{className:m,onDragStart:a,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:p,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(k,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(D,{children:c.jsx(k,{className:ue(a1,"gjs-mr-auto"),children:c.jsx(It,{title:`${f} ${i("instancesProject")}`,children:c.jsx(Rr,{label:`${f}`,className:ue(z.bgH75)})})})}),c.jsx(D,{className:ue("truncate"),grow:!0,title:d,children:c.jsx(zy,{activable:!0,value:d,className:a1,onChange:v})}),c.jsx(D,{className:ue(Ee.hoverGroup),children:c.jsx(k,{justify:"end",full:!0,children:c.jsx(bt,{onClick:b,title:i("delete"),border:!1,size:"",block:!0,children:c.jsx(oe,{icon:Z.delete,size:le.s})})})})]})]})},T$=fe(_$),vr="gs-block-manager",l1={id:Ps.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>'},O$={id:Ps.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>'},A$={id:Ps.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>'},c1={id:Ps.after,title:"Add after",icon:'<svg xmlns="http://www.w3.org/2000/svg" stroke="currentColor" fill="none" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" viewBox="0 0 24 24"> <rect fill="none" x="4" y="5" width="12" height="14" rx="2" ry="2"/> <path d="M20 5v14"/> </svg>'},u1=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},Uy=e=>{const t=e.getContent();return Ye(t)?e.getDragDef():t},N$=e=>{const t=Uy(e);return Array.isArray(t)?t[0]:t},M$=fe(function({isOpen:t,className:n,hideCategories:s,target:r,variant:o,itemLayout:i,...a}){var Ie,Wt;const{editor:l}=ye(),u=Re(),[d,f]=h.useState(0),[p,g]=h.useState(Yi.REGULAR),[m,b]=h.useState(""),[v,x]=h.useState(""),y=h.useRef(new Set),[w,S]=h.useState((r==null?void 0:r.position)||Ps.after),[C,j]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),E=p===Yi.SYMBOLS,_=h.useRef(null),T=u.tScoped("blockManager"),P=r==null?void 0:r.component;if(h.useEffect(()=>{if(!l)return;const{Blocks:ge,Components:$e}=l,Ve=ge.events.custom,Me=$e.events.symbol,wt=()=>{j($e.getSymbols()),f($t=>++$t)};return l.on(Me,wt),l.on(Ve,wt),()=>{l.off(Me,wt),l.off(Ve,wt)}},[l]),h.useEffect(()=>{if(_.current&&t){const ge=_.current.querySelector("input");setTimeout(()=>ge==null?void 0:ge.focus(),tp)}},[_.current,t]),!l)return null;const{Blocks:A,Components:M}=l,R=ge=>T(`labels.${ge.getId()}`)||ge.getLabel(),F=C.filter(ge=>ni(ge.getName(),m)),L=A.getAll().map(ge=>ge),B=((Ie=a.blocks)==null?void 0:Ie.call(a,{blocks:L}))||L,q=w===Ps.before,H=w===Ps.beforeInside,$=w===Ps.afterInside,I=w===Ps.after,O=!!(P!=null&&P.attributes.droppable),V=B.filter(ge=>{const $e=u1(l,ge.category);if(m&&!ni($e,m)&&!ni(R(ge),m))return!1;if(P){const Ve=N$(ge);if(O&&(H||$)){const Me=H?0:void 0;return M.canMove(P,Ve,Me).result}else if(q||I){const Me=P.index(),wt=P.parent(),$t=q?Me:Me+1;return wt&&M.canMove(wt,Ve,$t).result}}return!0}),G=A.getBlocksByCategory(V),W=s?V:(Wt=G.find(ge=>!ge.category))==null?void 0:Wt.items,K=s?[]:G.filter(ge=>ge.category),J=a.symbols!==!1,Y=a.search!==!1,U=!J&&!Y,Q=o==="compact",se=T("search")||u.t("search"),de=N(vr,n,"gap-2"),Se=N(`${vr}__header`,"gs-utl-pt-2",je.xS,U&&"gs-utl-hidden"),ne=N(`${vr}__content`,Ee.scrollY,z.br,re.bt),Te=N(`${vr}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),ke=N(`${vr}__not-found`,"gs-utl-text-center gs-utl-p-4"),it=N(`${vr}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",Q?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),st=N(`${vr}__no-category`,it,z.br,K.length&&re.bb),xe=N(z.tAo,z.bgH75,re.bA),Ze=`${vr}__category`,Xe=[{id:Yi.REGULAR,label:T("types.regular")},{id:Yi.SYMBOLS,label:T("types.symbols")}],ft=O?[l1,O$,A$,c1]:[l1,c1],Ae=P?ge=>{const $e=Uy(ge);if(!$e)return;let Ve;if(H||$){const Me=H?0:void 0;Ve=P.append($e,{at:Me})[0]}else if(q||I){const Me=P.index(),wt=P.parent(),$t=q?Me:Me+1;Ve=wt==null?void 0:wt.append($e,{at:$t})[0]}if(Ve){const{activate:Me,select:wt}=ge.attributes;wt||Me&&wt!==!1?l.em.setSelected(Ve,{activate:Me}):Me&&Ve.trigger("active")}}:void 0,at=ge=>{if(!P)return;const $e=Array.from(y.current);if(ge.key==="ArrowDown")ge.preventDefault(),x(Ve=>{const Me=$e.indexOf(Ve);return $e.at(Math.min(Me+1,$e.length-1))||""});else if(ge.key==="ArrowUp")ge.preventDefault(),x(Ve=>{const Me=$e.indexOf(Ve);return $e.at(Math.max(Me-1,0))||""});else if(ge.key==="Enter"&&v){const Ve=A.get(v);Ve&&(Ae==null||Ae(Ve))}},rt=ge=>{y.current.clear(),b(ge)};return c.jsxs(k,{className:de,col:!0,full:!0,children:[c.jsxs(k,{className:Se,gap:"s",col:!0,children:[J&&c.jsx(Yr,{tabs:Xe,onChange:g,value:p,variant:"pills"}),P&&c.jsx(Yt,{size:"s",options:ft,value:w,onChange:ge=>S(ge)}),Y&&c.jsx(tt,{ref:_,size:"s",value:m,onInput:rt,onKeyDown:at,placeholder:se,type:"search"})]}),c.jsxs(D,{className:ne,grow:!0,children:[E&&(F.length?c.jsx(k,{className:Te,children:F.map(ge=>c.jsx(T$,{symbol:ge},`${d}_${ge.getId()}`))}):c.jsx(k,{className:ke,justify:"center",children:T("symbols.notFound")})),!E&&(V.length?c.jsxs(c.Fragment,{children:[!!(W!=null&&W.length)&&c.jsx(k,{className:st,children:W==null?void 0:W.map(ge=>(y.current.add(`${ge.id}`),c.jsx(i1,{block:ge,itemLayout:i,onClick:Ae,variant:o,className:N(v===ge.id&&xe)},ge.id)))}),K.map(({category:ge,items:$e},Ve)=>c.jsx(ar,{sticky:!0,className:Me=>sp.itemList({index:Ve,open:Me,length:K.length}),open:!!(ge!=null&&ge.get("open")),onChange:({open:Me})=>ge==null?void 0:ge.set({open:Me}),handler:u1(l,ge),handlerIcon:ge==null?void 0:ge.get("icon"),classNameWrap:N(Ze,`${Ze}--${ge==null?void 0:ge.id}`),children:c.jsx(k,{className:it,children:$e.map(Me=>(y.current.add(`${Me.id}`),c.jsx(i1,{block:Me,itemLayout:i,onClick:Ae,variant:o,className:N(v===Me.id&&xe)},Me.id)))})},ge==null?void 0:ge.id))]}):c.jsx(k,{className:ke,justify:"center",children:T("notFound")}))]})]})}),L$=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:N(ue("gs-block-manager-after"),n),ref:r,...s,children:t})}),R$=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:N(ue("gs-block-manager-before"),n),ref:r,...s,children:t})}),$$="gs-panel-blocks",k$=h.memo(fe(function({className:t,symbols:n,search:s,hideCategories:r,target:o,variant:i,blocks:a,itemLayout:l,...u}){const d=ye().sdkProps.children,f={search:s,symbols:n,hideCategories:r,isOpen:!0,target:o,variant:i,blocks:a,itemLayout:l};return c.jsx(hs,{className:N($$,"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(Qa,{children:[Bn(d,R$),c.jsx(M$,{className:N("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...f}),Bn(d,L$)]})})})),V$="gs-cmp-color-picker",I$={backgroundSize:"10px"},D$=[0,15];function Wy({className:e,value:t,onChange:n,disabled:s}){const[r,o]=h.useState(!1),i=N(`${V$}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,re.b,re.rnd,z.br),a=()=>{o(!1)},l=c.jsxs("div",{style:I$,className:i,children:[r&&c.jsx("div",{onPointerUp:a,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(ps,{handler:l,title:"Color",size:"s",placement:"left-end",offset:D$,clickAway:!0,disabled:s,children:c.jsx($y,{value:t,onChange:n,disabled:s})})}const H$="gs-cmp-color-field";function lr(e){const{className:t,value:n,placeholder:s,preventSubmitOnEnter:r=!1,onChange:o,labelAs:i,disabled:a}=e,[l,u]=h.useState(yc(n)),d=Xa(e);h.useEffect(()=>{u(yc(n))},[n]);const f=(b,v)=>{o==null||o(b,v)},p=b=>{switch(b.key){case"Escape":return u(n);case"Enter":f(l),r&&(b.preventDefault(),b.stopPropagation())}},g=()=>{f(l)},m=qr({...e,className:N(H$,t)});return c.jsxs("div",{...m,children:[c.jsx(fs,{...e,as:i}),c.jsxs(k,{className:Gp(e),items:"center",space:"s",children:[c.jsx(D,{children:c.jsx(Wy,{value:n,onChange:o,disabled:a})}),c.jsx(D,{grow:!0,children:c.jsx("input",{className:N(d,a&&"gs-utl-pointer-events-none"),value:l,onChange:b=>u(b.target.value),placeholder:s,onBlur:g,onKeyDown:p,disabled:a})})]})]})}const F$=(e,t)=>{t.runCommand(ie.fontAdd,{font:e})},dh=(e,{onSelect:t,...n}={})=>{const s="font",i=e.runCommand(ie.assetProviderGet).filter(a=>ot(a.types)?a.types===s:a.types.includes(s))[0];if(!i){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:s,providerId:i.id,onSelect:a=>{const l=a.assetProps;F$(l.customData.font,e),t==null||t(a)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},bu=fe(e=>{const{buttonClassName:t,value:n,...s}=e,{editor:r}=ye(),o=Re(),i=Ka(),a=Ya(),l=[...s.options||[],...a.fontFamilyOptions].map(u=>{const d=a.getFont(u.id),f=d?Hp(d):u.id;return{...u,content:c.jsx(k,{col:!0,children:c.jsx(D,{style:{fontFamily:f},children:u.label})})}});return c.jsx(_e,{...s,value:Po(n),options:l,afterLabel:a.sdkAddFonts&&i.hasType("font")&&c.jsx(bt,{className:t,title:o.t("fontManager.addFontToProject"),icon:Z.plus,size:"xs",border:!1,block:!0,onClick:()=>r&&dh(r,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;s.onChange(Po(d.family))}})})})}),B$=(e,{t,id:n})=>t(`fields.${n}.label`)||Ts(`${e}`.replace(/-/g," ")),Gy=(e,{t,id:n})=>{const s=ot(e)?{id:e,label:e}:e;return{...s,label:t(`fields.${n}.options.${s.id}`)||s.label}},qy=e=>e.get("defaultValue")||"",tl=e=>e.get("field"),Ky=e=>{const t=tl(e);return ot(t)?{type:t}:t},Yy=e=>`${e.get("value")||qy(e)||Ky(e).defaultValue||""}`,z$=(e,t)=>e||qy(t)||"",Sa=({record:e,value:t,partial:n})=>{e.set({value:z$(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},Ca=(e,t)=>{const{className:n,defaultValue:s,size:r,...o}=Ky(e),i=s??e.get("defaultValue");return{...o,hasClear:()=>{const a=e.get("value");return!!a&&Lt(i)&&a!==i},className:N(n,"gs-utl-w-full"),size:r||"s",value:Yy(e),label:B$(e.get("label")||e.id||"",t),onChange:(a,l)=>Sa({record:e,value:a,partial:l})}},U$=(e,t)=>{const n=tl(e),s=ur(n)?n:void 0,r=(s==null?void 0:s.units)||[],o=SR(Yy(e)),i=o.number,a=o.unit||r[0]||"";return{...Ca(e,t),value:i,valueUnit:a,min:s==null?void 0:s.min,max:s==null?void 0:s.max,step:s==null?void 0:s.step,units:s==null?void 0:s.units,onChange:(l,u)=>{Sa({value:l?`${l}${a}`:"",record:e,partial:u})},onChangeUnit:l=>{Sa({value:i?`${i}${l}`:"",record:e})}}},Zy=(e,t)=>{var o;const n=tl(e),s=ur(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>Gy(i,t)))||[];return{...Ca(e,t),options:r,onChange:i=>Sa({value:i,record:e})}},W$=(e,t)=>({...Ca(e,t),onChange:n=>Sa({value:n,record:e})}),G$=(e,t)=>{var o;const n=tl(e),s=ur(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>Gy(i,t)))||[];return{...Zy(e,t),size:"s",options:r}};function q$(e,t){const n=tl(e);switch(ot(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(Yt,{...G$(e,t)});case"select":return c.jsx(_e,{...Zy(e,t)});case"selectFont":{const r=W$(e,t);return c.jsx(bu,{...r,labelAs:"div"})}case"number":return c.jsx(Ne,{...U$(e,t)});case"color":return c.jsx(lr,{...Ca(e,t)});default:return c.jsx(tt,{...Ca(e,t)})}}const d1="gs-cmp-global-style-field",K$=fe(function({record:t}){const n=ye(),r=Re().tScoped("globalStyleManager"),[,o]=h.useState(0),i=n.editor,a=t.id,l={t:r,id:a};return h.useEffect(()=>{if(!i)return;const u=`data:path:${t.getPath("value")}`,d=()=>o(f=>++f);return i.on(u,d),()=>{i.off(u,d)}},[i]),c.jsx(k,{className:N(d1,`${d1}__${a}`),children:q$(t,l)})}),ia="gs-cmp-global-style-manager",f1=({items:e,category:t,className:n})=>{const s=N(t?`${ia}__cat-fields--${t.id}`:`${ia}__uncat-fields`,"gs-utl-gap-2",je.xy,n);return c.jsx(k,{className:s,nowrap:!0,col:!0,children:e.map(r=>c.jsx(K$,{record:r},r.id))})},Y$=fe(function(){const t=UN(),{recordsByCategory:n,openCategories:s}=t,o=Re().tScoped("globalStyleManager");return c.jsx(k,{col:!0,full:!0,nowrap:!0,className:N(ia,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(k,{col:!0,nowrap:!0,className:N(`${ia}__fields`,Ee.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:i,items:a},l)=>i?c.jsx(ar,{sticky:!0,open:s.get(i.id)??i.open,handler:o(`categories.${i.id}.label`)||i.label||i.id,onChange:({open:u})=>t.setCategoryOpen(i.id,u),className:u=>N(`${ia}__cat-fields`,sp.itemList({index:l,open:u,length:n.length}),l===0&&re.bt),children:c.jsx(f1,{category:i,items:a})},i.id):c.jsx(f1,{items:a,className:N(n.length!==1&&[re.bt,z.br])},l)):c.jsx(k,{className:N("gs-utl-text-center"),justify:"center",children:o("notFound")})})})}),Z$="gs-panel-global-styles",X$=h.memo(fe(function({className:t,...n}){return c.jsx(hs,{className:N(Z$,"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(Qa,{children:c.jsx(Y$,{})})})})),J$={maxWidth:`${Cw}px`},Q$="gs-cmp-layer-item";function Xy({component:e,draggingCmp:t,dragParent:n,...s}){const r=Ja(),{Layers:o}=r,i=h.useRef(null),[a,l]=h.useState(!1),[u,d]=h.useState(o.getLayerData(e)),{open:f,selected:p,hovered:g,components:m,visible:b,locked:v,name:x}=u,y=m.map(H=>H.cid),w=t===e,S=y.join("-"),C=s.level+1,j=g||n===e;h.useEffect(()=>{C===0&&d(o.getLayerData(e)),i.current&&(i.current.__cmp=e)},[e]),h.useEffect(()=>{const H=i.current;if(!H)return;const{select:$}=r.Components.events,I=O=>O===e&&H.scrollIntoView({block:"nearest"});return r.on($,I),()=>{r.off($,I)}},[e,i.current]),h.useEffect(()=>{const H=I=>{I===e&&d(o.getLayerData(I))},$=o.events.component;return r.on($,H),()=>{r.off($,H)}},[r,o,e]);const E=h.useMemo(()=>m.map(H=>c.jsx(Xy,{component:H,level:C,draggingCmp:t,dragParent:n},H.cid)),[S,t,n]),_=H=>{o.setLayerData(e,{name:H}),l(!1)},T=H=>{H.stopPropagation(),o.setLayerData(e,{open:!f})},P=H=>{H.stopPropagation(),o.setLayerData(e,{visible:!b})},A=H=>{H.stopPropagation(),o.setLayerData(e,{locked:!v})},M=H=>{H.stopPropagation(),o.setLayerData(e,{selected:!0},{event:H})},R=H=>{H.preventDefault(),r.runCommand(ie.contextMenuComponent,{source:Dp.layers,component:e,event:H.nativeEvent,x:H.clientX,y:H.clientY})},F=H=>{(!H||!t)&&o.setLayerData(e,{hovered:H})},L=mv(e),B=ee("layer-item",(p||L.isSymbol)&&L.bgSoftX,(!b||w)&&"opacity-50"),q=ee(je.xyS,re.b,j?L.border:re.bT,p&&L.bgSoft);return c.jsx("div",{className:Q$,children:c.jsxs(k,{col:!0,className:B,children:[c.jsx(D,{onClick:M,onContextMenu:R,onMouseEnter:()=>F(!0),onMouseLeave:()=>F(!1),className:ee("group max-w-full"),"data-layer-item":!0,ref:i,children:c.jsxs(k,{items:"center",space:"xs",className:q,children:[c.jsx(D,{style:{marginLeft:`${C*10}px`},className:ee("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:T,children:c.jsx(oe,{icon:Z.menuDown,size:le.sx,rotate:f?0:-90})}),c.jsx(D,{children:h0(e)}),c.jsx(D,{className:ee("truncate"),onDoubleClick:()=>l(!0),style:J$,grow:!0,children:a?c.jsx(uh,{value:x,onChange:_}):c.jsx(c.Fragment,{children:x})}),!a&&c.jsxs(c.Fragment,{children:[c.jsx(D,{className:ee("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-100":"opacity-0"),onClick:A,children:c.jsx(oe,{icon:v?Z.lock:Z.lockOpenVariant,size:le.s3x})}),c.jsx(D,{className:ee("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-0":"opacity-100"),onClick:P,children:c.jsx(oe,{icon:b?Z.eyeOutline:Z.eyeOffOutline,size:le.sx})})]})]})}),!!(f&&m.length)&&c.jsx(D,{className:ee("max-w-full",!f&&"hidden"),children:E})]})})}const e6={touchAction:"none"},p1=5,t6=e=>{var o,i;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),s=n==null?void 0:n.__cmp,r=((i=(o=s==null?void 0:s.delegate)==null?void 0:o.move)==null?void 0:i.call(o,s))||s;return{el:n,cmp:r}},Jy=fe(function({root:t,header:n}){const{editor:s}=ye(),[r,o]=h.useState(!1),[i,a]=h.useState({}),[l,u]=h.useState(),[d,f]=h.useState(),[p,g]=h.useState(),[m,b]=h.useState(),v=h.useRef(null);if(h.useEffect(()=>{const T=window.document,P=A=>{A.key==="Escape"&&(a({...i,result:!1}),S())};return T.addEventListener("keydown",P),()=>{T.removeEventListener("keydown",P)}},[]),!s)return null;const{Components:x}=s,y=T=>{T.button===0&&o(!0)},w=T=>{if(!r)return;const{cmp:P,el:A}=t6(T);if(!A||!P)return;const M=A.getBoundingClientRect(),R=A.offsetHeight,F=A.offsetTop,L=T.clientY,B=L<M.y+R/2,q=d||P,H=P.parent(),$=P.index()+(B?0:1);!d&&f(P),u(P);const I=x.canMove(H,q,$),O=x.canMove(P,q),V={...I,canMoveInside:O,index:$};let G=!1;O.result&&L>M.y+p1&&L<M.y+R-p1&&(G=!0,V.target=P,delete V.index),g(G?P:void 0),a(V),b({pointerInside:G,y:F+(B?0:R),h:R})},S=()=>{var T;i!=null&&i.result&&((T=i.source)==null||T.move(i.target,{at:i.index})),a({}),o(!1),f(void 0),u(void 0),g(void 0),b(void 0)},C=(l?l.parents():[]).length,j=!!(d&&m&&(i!=null&&i.result)&&!m.pointerInside),E=j?{top:m.y,left:0,marginLeft:C*10+20}:{},_=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(k,{col:!0,full:!0,nowrap:!0,className:ee("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(D,{children:c.jsxs(k,{space:"s",items:"center",className:ee([je.xy,re.bb,z.br]),children:[c.jsx(D,{children:c.jsx(oe,{icon:Z.layers,size:le.s})}),c.jsx(D,{grow:!0,children:_})]})}),c.jsxs(D,{className:ee("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:e6,onPointerDown:y,onPointerMove:w,onPointerUp:S,grow:!0,children:[!!t&&c.jsx(Xy,{component:t,level:-1,draggingCmp:d,dragParent:p}),j&&c.jsx("div",{ref:v,className:ee("absolute w-full gs-utl-h-0.5",z.cmp),style:E})]})]})}),Qy=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:N(ue("gs-layer-manager-after"),n),ref:r,...s,children:t})}),ex=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:N(ue("gs-layer-manager-before"),n),ref:r,...s,children:t})}),n6="gs-panel-layers",tx=h.memo(fe(function({className:t,...n}){const s=ye().sdkProps.children;return c.jsx(hs,{className:N(n6,"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(sy,{children:r=>c.jsxs(c.Fragment,{children:[Bn(s,ex),c.jsx(Jy,{...r,header:!1}),Bn(s,Qy)]})})})})),so="gs-cmp-file-field";function ja(e){var C;const{className:t,value:n,btnLabel:s,nameLabel:r,size:o,isContain:i,clear:a,inputField:l,placeholder:u,preview:d=50,disabled:f,hideButton:p,labelAs:g,onChange:m,onOpen:b}=e,v=(n||"").replace(/^"|"$/gi,""),x=((C=v.split("/").pop())==null?void 0:C.split("?")[0])||"",y={minWidth:d,minHeight:d},w=v?{...y,backgroundImage:`url("${v}")`}:y,S=N(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",i?"gs-utl-bg-contain":"gs-utl-bg-cover",re.b,re.rnd,z.br);return c.jsxs(k,{className:N(so,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(fs,{...e,as:g}),c.jsxs(k,{className:N(`${so}-content gs-utl-gap-1`,z.bg),items:"center",nowrap:!0,children:[c.jsx(D,{className:N(`${so}-preview`),children:c.jsx("div",{className:S,style:w})}),c.jsxs(D,{className:N(`${so}-fields gs-utl-overflow-hidden`),grow:!0,children:[x&&r!==!1&&c.jsx(Dr,{className:N(`${so}-name`,"gs-utl-mb-2",Ee.txtEllips),as:"div",size:o,capitalize:!1,children:x}),c.jsxs(k,{className:N(`${so}-buttons`),space:"s",nowrap:!0,children:[!p&&c.jsx(Ke,{onClick:()=>b==null?void 0:b(n),size:o,type:"button",block:!0,full:!0,disabled:f,children:s||"Select image"}),!!n&&a&&c.jsx(bt,{onClick:()=>m==null?void 0:m(""),title:a.tooltip,size:o,icon:{icon:Z.close,size:le.s},type:"button",block:!0})]})]})]}),l&&c.jsx(tt,{className:N(`${so}-input`),value:v,onChange:m,size:o,placeholder:u})]})}function s6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>s=>{t.forEach(r=>r(s))},t)}const vu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Oi(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function fh(e){return"nodeType"in e}function Xr(e){var t,n;return e?Oi(e)?e:fh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function ph(e){const{Document:t}=Xr(e);return e instanceof t}function Ai(e){return Oi(e)?!1:e instanceof Xr(e).HTMLElement}function nx(e){return e instanceof Xr(e).SVGElement}function Ni(e){return e?Oi(e)?e.document:fh(e)?ph(e)?e:Ai(e)||nx(e)?e.ownerDocument:document:document:document}const _o=vu?h.useLayoutEffect:h.useEffect;function r6(e){const t=h.useRef(e);return _o(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.current==null?void 0:t.current(...s)},[])}function o6(){const e=h.useRef(null),t=h.useCallback((s,r)=>{e.current=setInterval(s,r)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function nl(e,t){const n=h.useRef();return h.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function hh(e){const t=r6(e),n=h.useRef(null),s=h.useCallback(r=>{r!==n.current&&(t==null||t(r,n.current)),n.current=r},[]);return[n,s]}let xd={};function sl(e,t){return h.useMemo(()=>{if(t)return t;const n=xd[e]==null?0:xd[e]+1;return xd[e]=n,e+"-"+n},[e,t])}function sx(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.reduce((o,i)=>{const a=Object.entries(i);for(const[l,u]of a){const d=o[l];d!=null&&(o[l]=d+e*u)}return o},{...t})}}const Ea=sx(1),rx=sx(-1);function i6(e){return"clientX"in e&&"clientY"in e}function a6(e){if(!e)return!1;const{KeyboardEvent:t}=Xr(e.target);return t&&e instanceof t}function l6(e){if(!e)return!1;const{TouchEvent:t}=Xr(e.target);return t&&e instanceof t}function Of(e){if(l6(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 i6(e)?{x:e.clientX,y:e.clientY}:null}const Pa=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[Pa.Translate.toString(e),Pa.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),c6={display:"none"};function u6(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:c6},n)}function d6(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const r={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function f6(){const[e,t]=h.useState("");return{announce:h.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const p6={draggable:`
|
|
321
|
+
`})};function Pu({children:e,text:t,onConfirm:n,onCancel:s,className:r="w-[200px]",confirmButtonProps:o={},...i}){const a=Ie();return c.jsx(xs,{...i,overlay:!0,title:!1,buttonAs:"span",handler:e,children:({close:l})=>c.jsxs(k,{className:K(r),space:"m",col:!0,children:[c.jsx(F,{grow:!0,className:K("text-center"),children:t||a.t("confirmAction")}),c.jsxs(k,{justify:"center",items:"center",gap:"m",nowrap:!0,children:[c.jsx(Ke,{variant:"pr",size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),n==null||n()},...o,children:o.children||a.t("confirm")}),c.jsx(Ke,{size:"m2",className:"gs-utl-whitespace-nowrap",onClick:()=>{l(),s==null||s()},children:a.t("cancel")})]})]})})}const Jm=new Map,Qm=new Map,P$=async({html:e="",el:t})=>{const n=e,s={};if(document.body.attachShadow){const r=t.shadowRoot||t.attachShadow({mode:"open"});r.innerHTML=n}return s},O$=ce(function({template:t,projectType:n,skipProjectNamePopover:s,className:r,onSelect:o,onRemove:i}){var E;const a=Ie(),l=xe(),u=l.editor,[d,f]=h.useState(""),p=h.useRef(null),g=a.t("projectManager.projectName"),m=!t.isTemplate&&l.currentProjectId===((E=t.data.custom)==null?void 0:E.id),v=n===jt.web,b=!t.isTemplate||s,x=()=>{b&&(o==null||o({editor:u,template:t,loadTemplate:y}))},y=l.setProject,w=O=>{O.preventDefault(),o({editor:u,template:t,loadTemplate:y})};h.useEffect(()=>{const P=setTimeout(async()=>{if(!p.current||!u)return;const T=`${t.isTemplate?"t-":""}${t.id}`;let _=Jm.get(T);if(!_){let N=Qm.get(n);if(!N){const V=new E7({appEditorStore:{sdkProps:{options:{licenseKey:""}}}});N=await T$(u.config.grapesjs,n,V.appEditorStore),Qm.set(n,N)}_=N?E$(N,t.data,n):"",Jm.set(T,_)}const L=p.current;P$({el:L,html:_})});return()=>clearTimeout(P)},[p,u,n,t.data]);const{media:S,author:C}=t,j=c.jsx(Ke,{className:ie("text-sm"),size:"m2",variant:"pr",onClick:x,disabled:m,children:a.t("select")});return c.jsx(ns,{padding:!1,className:ie("overflow-hidden max-w-full group",r),children:c.jsxs(k,{col:!0,children:[c.jsxs(F,{className:ie("relative group h-36 bg-checker max-w-full"),children:[c.jsx("div",{className:ie("gs-utl-relative","gs-utl-h-full","gs-utl-overflow-hidden","gs-utl-flex","gs-utl-justify-center"),children:S?c.jsx("img",{src:S,alt:t.name,className:ie("max-w-full")}):c.jsx("div",{className:ie("gs-utl-w-[1200px]","gs-utl-flex-shrink-0","gs-utl-flex-grow-0","gs-utl-origin-top","gs-utl-bg-white","gs-utl-scale-[0.232]","gs-utl-h-[431.034%]"),ref:p})}),m&&c.jsx(Dr,{className:ie("absolute top-2 right-2",B.bgA2),label:a.t("current"),s:"s",pill:!0}),c.jsx(k,{justify:"center",items:"center",className:ie(Oe.coverAbs,B.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:b?j:c.jsx(xs,{overlay:!0,title:!1,buttonAs:"span",handler:j,children:()=>c.jsx("form",{onSubmit:w,children:c.jsxs(k,{space:"m",col:!0,children:[c.jsx(F,{children:c.jsx(ot,{size:"s",value:d,onChange:f,placeholder:g,required:!0})}),c.jsx(F,{children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:a.t("load")})})]})})})})]}),c.jsxs(k,{className:ie("gjs-p-2 max-w-full",te.bt,B.br),col:!0,space:"s",children:[c.jsxs(k,{className:ie("text-sm w-full"),space:"s",nowrap:!0,children:[c.jsx(F,{className:ie(Oe.txtEllips,"max-w-full"),grow:!0,children:t.name}),!!C&&c.jsxs(F,{children:["by"," ",c.jsx("a",{className:ie(Fr.link),href:C.link,rel:"noreferrer",target:"_blank",children:C.name})]})]}),c.jsxs(k,{items:"center",children:[v&&c.jsxs(F,{className:ie("gjs-mr-auto"),children:[a.t("projectManager.pages"),": ",t.data.pages.length]}),!t.isTemplate&&i&&c.jsx(F,{className:ie("gjs-ml-auto"),children:c.jsx(Pu,{onConfirm:()=>i(t),className:"",children:c.jsx(St,{title:a.t("delete"),children:c.jsx(ne,{icon:G.delete,size:oe.sx})})})})]})]})]})})}),nx=ce(function({templates:e,projectType:t,content:n,skipProjectNamePopover:s,onSelect:r,onRemove:o}){const[i]=rh(),l=Ie().tScoped("templates"),d=xe().editor,f=Sh(n==null?void 0:n.itemsPerRow),p=r??(({template:g,loadTemplate:m})=>m(g));return c.jsx(c.Fragment,{children:d&&e?e.length===0?c.jsx(k,{justify:"center",children:l("notFound")}):c.jsx(Tu,{data:e,listClassName:ie("grid gap-2 gjs-pr-2",f),itemContent:(g,m)=>c.jsx(O$,{template:m,projectType:t,onSelect:p,onRemove:o,skipProjectNamePopover:s},m.id)},i):c.jsx(Br,{})})}),_$=ce(function(){var v;const t=xe(),n=k0(),{filteredTemplates:s,projectSourceFilter:r,projectTypeFilter:o}=n,i=Ie(),a=Li(),{sdkOptions:l}=t,u=i.tScoped("projectManager"),d=async({loadTemplate:b,template:x})=>{b(x),a.close()},f=async b=>{n.setProjectTypeFilter(b),await n.loadAllTemplates()},p=b=>{n.removeProject(b.id),n.loadProjects()},g=h.useMemo(()=>[{id:Ca.Existing,label:u("existentProjects")},{id:Ca.Templates,label:u("templates")}],[i]),m=((v=l.project)==null?void 0:v.types)&&op();return h.useEffect(()=>{n.loadAllTemplates()},[]),c.jsxs(k,{col:!0,full:!0,space:"m",children:[m&&c.jsx(k,{items:"center",space:"m",children:c.jsx(F,{className:ie("gjs-ml-auto"),children:c.jsx(Le,{value:o,onChange:f,options:YM(),handlerSelected:b=>c.jsxs(c.Fragment,{children:[c.jsx("b",{children:u("projectType")}),": ",b.label]})})})}),c.jsx(F,{children:c.jsx(ro,{tabs:g,value:r,onChange:n.setProjectSourceFilter})}),c.jsx(F,{grow:!0,children:c.jsx(nx,{templates:s,projectType:jt[o],onSelect:d,onRemove:p,content:{itemsPerRow:3}})})]})}),A$=({items:e,editor:t,customItems:n})=>n===!1?[]:tt(n)?n({items:e,editor:t}):n||e,e1=e=>({icon:G.plus,size:oe.s,className:K("gs-utl-transition-transform",e&&"gs-utl-rotate-45")}),sx=e=>!e.type||e.type==="button",L$="gs-cmp-topbar-left",M$=ce(function({buttons:t,className:n,style:s}){const r=xe(),o=Ie(),{isOpen:i,toggleOpen:a}=b3(),l=r.editor,d=o.tScoped("blockManager")("blocks"),f=A$({items:[{id:`blocks-${d}`,tooltip:d,size:sy.s,icon:e1(i),variant:ny.primary,editorEvents:{[Rn.toggleBlocksPanel]:({fromEvent:p,setState:g})=>{g({icon:e1(p.isOpen)})}},onClick:()=>a()}],customItems:t,editor:l});return c.jsx(k,{gap:"s",items:"center",justify:"start",className:K(L$,Ee.xS,n),style:s,nowrap:!0,children:f.map(({id:p,...g})=>sx(g)?c.jsx(vu,{...g},p):$t({id:p,...g}))})}),N$=[{id:Ir.auto,label:"Auto"},{id:Ir.dark,label:"Dark"},{id:Ir.light,label:"Light"}],$$={size:"s"},Pd=".grapesjs",k$=(e,t)=>{const n=e==null?void 0:e.settingsMenu;return n!==!1&&(n==null?void 0:n[t])!==!1},R$=({actions:e,editor:t,buttons:n,sdkOptions:s})=>{const r=s.actions;return r===!1?[]:tt(r)?r({actions:e,editor:t}):r||(n?tt(n)?n({items:e,editor:t}):n:e)},I$="gs-cmp-topbar-right",V$=ce(function({editor:t,className:n,buttons:s,...r}){const o=xe(),{theme:i,setTheme:a}=qs(),{Commands:l,UndoManager:u}=t,{installEvent:d,appInstalled:f,isBrowserMode:p,setInstallEvent:g,sdkOptions:m,isProjectTypeEmail:v}=o,b=Li(),x=Ie(),y=L=>x.t(`actions.${L}`),w=t.Storage.events,S=l.events,C="change:changesCount",j=(L,N)=>()=>{tt(L)?L({editor:t}):l.isActive(L)?l.stop(L):l.run(L,N)},E=L=>({[`${S.runCommand}${L}`]:({setState:N})=>N({active:!0}),[`${S.stopCommand}${L}`]:({setState:N})=>N({active:!1})}),O=[{id:os.componentOutline,icon:G.borderRadius,tooltip:y("componentOutline.title"),onClick:j("core:component-outline"),editorEvents:E("core:component-outline")},{id:os.preview,icon:G.eye,tooltip:y("preview.title"),onClick:j("core:preview"),editorEvents:E("core:preview")},{id:os.fullscreen,icon:G.arrowExpandAll,tooltip:y("fullscreen.title"),onClick:j("core:fullscreen",{target:"body"}),editorEvents:E("core:fullscreen")},{id:os.showCode,icon:G.xml,tooltip:y("showCode.title"),onClick:()=>t.runCommand(se.dialogExportCode)},{id:os.showImportCode,icon:G.trayArrowDown,tooltip:y("importCode.title"),onClick:()=>t.runCommand(se.dialogImportCode)},{id:os.clearCanvas,icon:G.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:os.store,tooltip:y("store.title"),onClick:async()=>!o.isSaving&&t.store(),editorEvents:{"change:changesCount":({setState:L})=>L({}),[w.startStore]:({setState:L})=>L({disabled:!0}),[w.endStore]:({setState:L})=>L({disabled:!1})},label:()=>c.jsxs("div",{className:K("relative"),children:[c.jsx(ne,{icon:G.floppy,size:oe.s}),!!t.getDirtyCount()&&!o.isSaving&&c.jsx("div",{className:K("absolute right-0 gjs-p-0.5 bottom-0 gjs-rounded-full",B.bg),children:c.jsx("div",{className:K(Oe.dot,B.bgW)})}),o.isSaving&&c.jsx("div",{className:K("absolute right-0 bottom-0 gjs-rounded-full",B.bg),children:c.jsx(ne,{icon:G.refresh,size:"11px",className:K(Oe.spin)})})]})},{id:os.undo,icon:G.arrowULeftTop,disabled:!0,onClick:j("core:undo"),editorEvents:{[C]:({setState:L})=>L({disabled:!u.hasUndo()})}},{id:os.redo,icon:G.arrowURightTop,disabled:!0,onClick:j("core:redo"),editorEvents:{[C]:({setState:L})=>L({disabled:!u.hasRedo()})}}],P=R$({actions:O,sdkOptions:m,editor:t,buttons:s}),T=[{id:"about",label:y("about.title"),icon:G.helpCircle,action:()=>b.open({size:"m",title:y("about.title"),content:()=>c.jsx(KM,{})})},{id:"embed",label:y("embed.title"),icon:G.powerPlug,action:()=>b.open({size:"m",title:y("embed.title"),content:()=>c.jsx(ZM,{})})},{id:"openProject",label:y("open.title"),icon:G.folder,action:async()=>{let L="";try{L=await(await LM({extensions:[Pd]})).text()}catch(N){return console.error(N)}o.loadProjectData(JSON.parse(L))}},{id:"saveProject",label:y("save.title"),icon:G.contentSave,action:async()=>{const L=t.getProjectData(),N=new Blob([JSON.stringify(L)]),V=`Untitled-${new Date().toISOString().replace("T","-").replace(/:|\./g,"").substring(0,17)}`;try{await NM(N,{fileName:`${V}${Pd}`,extensions:[Pd]})}catch(A){return console.error(A)}}},{id:"loadProject",label:y("newProject.title"),icon:G.newspaperVariantOutline,action:()=>b.open({fullH:!0,title:y("newProject.title"),content:()=>c.jsx(_$,{})})},{id:"installApp",label:y(f?"installApp.installed":"installApp.title"),icon:G.applicationBracketsOutline,action:async()=>{if(f)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:c.jsxs(k,{items:"center",space:"m",children:[c.jsx(F,{children:"Theme"}),c.jsx(F,{children:c.jsx(ro,{tabs:N$,onChange:L=>a(L),value:i,variant:"pills"})})]})}]].filter(({id:L})=>!((!p||!d)&&L==="installApp"||!k$(m,L))),_=(L,N)=>V=>{tt(L)&&(L(V),N())};return c.jsxs(k,{space:"s",items:"center",justify:"end",className:K(I$,Ee.xS,n),nowrap:!0,...r,children:[P.map(({id:L,...N})=>sx(N)?c.jsx(vu,{size:"s",...N},L):$t({id:L,...N})),c.jsx(F,{children:m.settingsMenu!==!1&&T.length>0&&c.jsx(xs,{placement:"bottom-end",title:!1,padding:!1,handler:c.jsx(ne,{icon:G.cog,size:oe.s}),buttonProps:$$,overlay:!0,children:({close:L})=>c.jsx(c.Fragment,{children:T.map(N=>c.jsx($i,{action:_(N.action,L),icon:N.icon,label:N.label},N.id))})})})]})});function H$({devices:e,selected:t,className:n,style:s,select:r}){const o=e.map(i=>({id:i.id,label:i.getName(),icon:i.attributes.icon}));return o.length?c.jsx(Le,{size:"xs",className:n,style:s,value:t,options:o,onChange:r}):null}const D$="gs-devices",rx=h.memo(function({className:t,style:n}){return c.jsx(fM,{children:s=>c.jsx(H$,{className:M(D$,t),style:n,...s})})}),Ki="gs-cmp-editor-topbar",F$=ce(function({className:t,height:n,style:s,children:r,leftContainer:o,rightContainer:i,devices:a}){const{topBarSize:l,isInPreview:u,editor:d,isTopSidebarOpen:f}=xe(),p=n??l,g=h.useMemo(()=>({...s,minHeight:p,marginTop:u||!f?`-${p}px`:0}),[u,f,s]);return c.jsxs(c.Fragment,{children:[c.jsx(F,{className:M(Ki,"gs-utl-transition-spacing gs-utl-w-full",te.bb,B.br,t),style:g,children:r??c.jsxs(k,{className:M(`${Ki}__wrp`,"gs-utl-h-full"),items:"center",full:!0,nowrap:!0,children:[c.jsx(F,{className:M(`${Ki}__wrp-left`),grow:!0,children:o!==!1&&c.jsx(M$,{...o})}),c.jsx(F,{className:M(`${Ki}__wrp-center`),children:a!==!1&&c.jsx(rx,{...a})}),c.jsx(F,{className:M(`${Ki}__wrp-right`),grow:!0,children:i!==!1&&d&&c.jsx(V$,{editor:d,...i})})]})}),c.jsx(F,{className:M("gs-utl-transition-transform gs-utl-absolute gs-utl-top-0 gs-utl-left-0 gs-utl-z-10",!u&&"-gs-utl-translate-y-full"),children:c.jsx(Ke,{className:M("gs-cmp-close-preview gs-utl-m-4",B.bg),size:"s",onClick:()=>d==null?void 0:d.Commands.stop("core:preview"),children:c.jsx(ne,{icon:G.eyeOff,size:oe.s})})})]})}),B$="gs-sidebar-top",ox=h.memo(ce(function({height:t,children:n,...s}){return c.jsx(F$,{height:t,...s,style:yu(s),className:M(B$,"gs-utl-flex",bu(s)),children:n?$t(n):void 0})})),z$="gs-canvas-sidebar-top",U$=h.memo(ce(function({className:t,sidebarTop:n,...s}){return c.jsxs(Cn,{className:M(z$,"gs-utl-flex gs-utl-flex-col",t),grow:!0,...s,children:[c.jsx(ox,{...n}),c.jsx(wy,{grow:!0})]})})),W$="gs-code-field",G$=ce(function(e){const{editor:t}=xe(),{isDarkTheme:n}=qs(),{editorEvents:s,onChange:r}=e,[o,i]=h.useState(()=>e),a=u=>({value:u,editor:t,state:o,setState:d=>i(f=>({...f,...d}))}),l=u=>r==null?void 0:r(a(u||""));return co({editor:t,editorEvents:s,localState:o,setLocalState:i}),c.jsx(pr,{className:M(W$,o.className),language:o.language,style:o.style,label:o.label,name:o.name,defaultValue:o.value,size:o.size,required:o.required,disabled:o.disabled,readOnly:o.readOnly,minHeight:o.minHeight,row:o.row,isDarkTheme:n,monacoOptions:e.monacoOptions,onChange:l})});var q$={grad:.9,turn:360,rad:360/(2*Math.PI)},Qs=function(e){return typeof e=="string"?e.length>0:typeof e=="number"},Bt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n+0},Jn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},ix=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},t1=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)}},Od=function(e){return{r:Bt(e.r),g:Bt(e.g),b:Bt(e.b),a:Bt(e.a,3)}},K$=/^#([0-9a-f]{3,8})$/i,Vl=function(e){var t=e.toString(16);return t.length<2?"0"+t:t},ax=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:60*(a<0?a+6:a),s:o?i/o*100:0,v:o/255*100,a:r}},lx=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:255*[s,a,i,i,l,s][u],g:255*[l,s,s,a,i,i][u],b:255*[i,i,l,s,s,a][u],a:r}},n1=function(e){return{h:ix(e.h),s:Jn(e.s,0,100),l:Jn(e.l,0,100),a:Jn(e.a)}},s1=function(e){return{h:Bt(e.h),s:Bt(e.s),l:Bt(e.l),a:Bt(e.a,3)}},r1=function(e){return lx((n=(t=e).s,{h:t.h,s:(n*=((s=t.l)<50?s:100-s)/100)>0?2*n/(s+n)*100:0,v:s+n,a:t.a}));var t,n,s},ua=function(e){return{h:(t=ax(e)).h,s:(r=(200-(n=t.s))*(s=t.v)/100)>0&&r<200?n*s/100/(r<=100?r:200-r)*100:0,l:r/2,a:t.a};var t,n,s,r},Z$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Y$=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,X$=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,J$=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Vf={string:[[function(e){var t=K$.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?Bt(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?Bt(parseInt(e.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(e){var t=X$.exec(e)||J$.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:t1({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=Z$.exec(e)||Y$.exec(e);if(!t)return null;var n,s,r=n1({h:(n=t[1],s=t[2],s===void 0&&(s="deg"),Number(n)*(q$[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return r1(r)},"hsl"]],object:[[function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=r===void 0?1:r;return Qs(t)&&Qs(n)&&Qs(s)?t1({r:Number(t),g:Number(n),b:Number(s),a:Number(o)}):null},"rgb"],[function(e){var t=e.h,n=e.s,s=e.l,r=e.a,o=r===void 0?1:r;if(!Qs(t)||!Qs(n)||!Qs(s))return null;var i=n1({h:Number(t),s:Number(n),l:Number(s),a:Number(o)});return r1(i)},"hsl"],[function(e){var t=e.h,n=e.s,s=e.v,r=e.a,o=r===void 0?1:r;if(!Qs(t)||!Qs(n)||!Qs(s))return null;var i=function(a){return{h:ix(a.h),s:Jn(a.s,0,100),v:Jn(a.v,0,100),a:Jn(a.a)}}({h:Number(t),s:Number(n),v:Number(s),a:Number(o)});return lx(i)},"hsv"]]},o1=function(e,t){for(var n=0;n<t.length;n++){var s=t[n][0](e);if(s)return[s,t[n][1]]}return[null,void 0]},Q$=function(e){return typeof e=="string"?o1(e.trim(),Vf.string):typeof e=="object"&&e!==null?o1(e,Vf.object):[null,void 0]},_d=function(e,t){var n=ua(e);return{h:n.h,s:Jn(n.s+100*t,0,100),l:n.l,a:n.a}},Ad=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},i1=function(e,t){var n=ua(e);return{h:n.h,s:n.s,l:Jn(n.l+100*t,0,100),a:n.a}},Hf=function(){function e(t){this.parsed=Q$(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return Bt(Ad(this.rgba),2)},e.prototype.isDark=function(){return Ad(this.rgba)<.5},e.prototype.isLight=function(){return Ad(this.rgba)>=.5},e.prototype.toHex=function(){return t=Od(this.rgba),n=t.r,s=t.g,r=t.b,i=(o=t.a)<1?Vl(Bt(255*o)):"","#"+Vl(n)+Vl(s)+Vl(r)+i;var t,n,s,r,o,i},e.prototype.toRgb=function(){return Od(this.rgba)},e.prototype.toRgbString=function(){return t=Od(this.rgba),n=t.r,s=t.g,r=t.b,(o=t.a)<1?"rgba("+n+", "+s+", "+r+", "+o+")":"rgb("+n+", "+s+", "+r+")";var t,n,s,r,o},e.prototype.toHsl=function(){return s1(ua(this.rgba))},e.prototype.toHslString=function(){return t=s1(ua(this.rgba)),n=t.h,s=t.s,r=t.l,(o=t.a)<1?"hsla("+n+", "+s+"%, "+r+"%, "+o+")":"hsl("+n+", "+s+"%, "+r+"%)";var t,n,s,r,o},e.prototype.toHsv=function(){return t=ax(this.rgba),{h:Bt(t.h),s:Bt(t.s),v:Bt(t.v),a:Bt(t.a,3)};var t},e.prototype.invert=function(){return Es({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),Es(_d(this.rgba,t))},e.prototype.desaturate=function(t){return t===void 0&&(t=.1),Es(_d(this.rgba,-t))},e.prototype.grayscale=function(){return Es(_d(this.rgba,-1))},e.prototype.lighten=function(t){return t===void 0&&(t=.1),Es(i1(this.rgba,t))},e.prototype.darken=function(t){return t===void 0&&(t=.1),Es(i1(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"?Es({r:(n=this.rgba).r,g:n.g,b:n.b,a:t}):Bt(this.rgba.a,3);var n},e.prototype.hue=function(t){var n=ua(this.rgba);return typeof t=="number"?Es({h:t,s:n.s,l:n.l,a:n.a}):Bt(n.h)},e.prototype.isEqual=function(t){return this.toHex()===Es(t).toHex()},e}(),Es=function(e){return e instanceof Hf?e:new Hf(e)},a1=[],ek=function(e){e.forEach(function(t){a1.indexOf(t)<0&&(t(Hf,Vf),a1.push(t))})};function tk(e,t){var n={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var r in n)s[n[r]]=r;var o={};e.prototype.toName=function(i){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=s[this.toHex()];if(u)return u;if(i!=null&&i.closest){var d=this.toRgb(),f=1/0,p="black";if(!o.length)for(var g in n)o[g]=new e(n[g]).toRgb();for(var m in n){var v=(a=d,l=o[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));v<f&&(f=v,p=m)}return p}},t.string.push([function(i){var a=i.toLowerCase(),l=a==="transparent"?"#0000":n[a];return l?new e(l).toRgb():null},"name"])}function Ou(){return(Ou=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(e[s]=n[s])}return e}).apply(this,arguments)}function cx(e,t){if(e==null)return{};var n,s,r={},o=Object.keys(e);for(s=0;s<o.length;s++)t.indexOf(n=o[s])>=0||(r[n]=e[n]);return r}function Df(e){var t=h.useRef(e),n=h.useRef(function(s){t.current&&t.current(s)});return t.current=e,n.current}var Ti=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e<t?t:e},da=function(e){return"touches"in e},Ff=function(e){return e&&e.ownerDocument.defaultView||self},l1=function(e,t,n){var s=e.getBoundingClientRect(),r=da(t)?function(o,i){for(var a=0;a<o.length;a++)if(o[a].identifier===i)return o[a];return o[0]}(t.touches,n):t;return{left:Ti((r.pageX-(s.left+Ff(e).pageXOffset))/s.width),top:Ti((r.pageY-(s.top+Ff(e).pageYOffset))/s.height)}},c1=function(e){!da(e)&&e.preventDefault()},Ch=h.memo(function(e){var t=e.onMove,n=e.onKey,s=cx(e,["onMove","onKey"]),r=h.useRef(null),o=Df(t),i=Df(n),a=h.useRef(null),l=h.useRef(!1),u=h.useMemo(function(){var g=function(b){c1(b),(da(b)?b.touches.length>0:b.buttons>0)&&r.current?o(l1(r.current,b,a.current)):v(!1)},m=function(){return v(!1)};function v(b){var x=l.current,y=Ff(r.current),w=b?y.addEventListener:y.removeEventListener;w(x?"touchmove":"mousemove",g),w(x?"touchend":"mouseup",m)}return[function(b){var x=b.nativeEvent,y=r.current;if(y&&(c1(x),!function(S,C){return C&&!da(S)}(x,l.current)&&y)){if(da(x)){l.current=!0;var w=x.changedTouches||[];w.length&&(a.current=w[0].identifier)}y.focus(),o(l1(y,x,a.current)),v(!0)}},function(b){var x=b.which||b.keyCode;x<37||x>40||(b.preventDefault(),i({left:x===39?.05:x===37?-.05:0,top:x===40?.05:x===38?-.05:0}))},v]},[i,o]),d=u[0],f=u[1],p=u[2];return h.useEffect(function(){return p},[p]),h.createElement("div",Ou({},s,{onTouchStart:d,onMouseDown:d,className:"react-colorful__interactive",ref:r,onKeyDown:f,tabIndex:0,role:"slider"}))}),_u=function(e){return e.filter(Boolean).join(" ")},jh=function(e){var t=e.color,n=e.left,s=e.top,r=s===void 0?.5:s,o=_u(["react-colorful__pointer",e.className]);return h.createElement("div",{className:o,style:{top:100*r+"%",left:100*n+"%"}},h.createElement("div",{className:"react-colorful__pointer-fill",style:{backgroundColor:t}}))},fn=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=Math.pow(10,t)),Math.round(n*e)/n},ux=function(e){var t=e.s,n=e.v,s=e.a,r=(200-t)*n/100;return{h:fn(e.h),s:fn(r>0&&r<200?t*n/100/(r<=100?r:200-r)*100:0),l:fn(r/2),a:fn(s,2)}},Bf=function(e){var t=ux(e);return"hsl("+t.h+", "+t.s+"%, "+t.l+"%)"},Ld=function(e){var t=ux(e);return"hsla("+t.h+", "+t.s+"%, "+t.l+"%, "+t.a+")"},nk=function(e){var t=e.h,n=e.s,s=e.v,r=e.a;t=t/360*6,n/=100,s/=100;var o=Math.floor(t),i=s*(1-n),a=s*(1-(t-o)*n),l=s*(1-(1-t+o)*n),u=o%6;return{r:fn(255*[s,a,i,i,l,s][u]),g:fn(255*[l,s,s,a,i,i][u]),b:fn(255*[i,i,l,s,s,a][u]),a:fn(r,2)}},sk=function(e){var t=/rgba?\(?\s*(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?[,\s]+(-?\d*\.?\d+)(%)?,?\s*[/\s]*(-?\d*\.?\d+)?(%)?\s*\)?/i.exec(e);return t?rk({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}},rk=function(e){var t=e.r,n=e.g,s=e.b,r=e.a,o=Math.max(t,n,s),i=o-Math.min(t,n,s),a=i?o===t?(n-s)/i:o===n?2+(s-t)/i:4+(t-n)/i:0;return{h:fn(60*(a<0?a+6:a)),s:fn(o?i/o*100:0),v:fn(o/255*100),a:r}},ok=h.memo(function(e){var t=e.hue,n=e.onChange,s=_u(["react-colorful__hue",e.className]);return h.createElement("div",{className:s},h.createElement(Ch,{onMove:function(r){n({h:360*r.left})},onKey:function(r){n({h:Ti(t+360*r.left,0,360)})},"aria-label":"Hue","aria-valuenow":fn(t),"aria-valuemax":"360","aria-valuemin":"0"},h.createElement(jh,{className:"react-colorful__hue-pointer",left:t/360,color:Bf({h:t,s:100,v:100,a:1})})))}),ik=h.memo(function(e){var t=e.hsva,n=e.onChange,s={backgroundColor:Bf({h:t.h,s:100,v:100,a:1})};return h.createElement("div",{className:"react-colorful__saturation",style:s},h.createElement(Ch,{onMove:function(r){n({s:100*r.left,v:100-100*r.top})},onKey:function(r){n({s:Ti(t.s+100*r.left,0,100),v:Ti(t.v-100*r.top,0,100)})},"aria-label":"Color","aria-valuetext":"Saturation "+fn(t.s)+"%, Brightness "+fn(t.v)+"%"},h.createElement(jh,{className:"react-colorful__saturation-pointer",top:1-t.v/100,left:t.s/100,color:Bf(t)})))}),ak=function(e,t){if(e===t)return!0;for(var n in e)if(e[n]!==t[n])return!1;return!0},lk=function(e,t){return e.replace(/\s/g,"")===t.replace(/\s/g,"")};function ck(e,t,n){var s=Df(n),r=h.useState(function(){return e.toHsva(t)}),o=r[0],i=r[1],a=h.useRef({color:t,hsva:o});h.useEffect(function(){if(!e.equal(t,a.current.color)){var u=e.toHsva(t);a.current={hsva:u,color:t},i(u)}},[t,e]),h.useEffect(function(){var u;ak(o,a.current.hsva)||e.equal(u=e.fromHsva(o),a.current.color)||(a.current={hsva:o,color:u},s(u))},[o,e,s]);var l=h.useCallback(function(u){i(function(d){return Object.assign({},d,u)})},[]);return[o,l]}var uk=typeof window<"u"?h.useLayoutEffect:h.useEffect,dk=function(){return typeof __webpack_nonce__<"u"?__webpack_nonce__:void 0},u1=new Map,fk=function(e){uk(function(){var t=e.current?e.current.ownerDocument:document;if(t!==void 0&&!u1.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}`,u1.set(t,n);var s=dk();s&&n.setAttribute("nonce",s),t.head.appendChild(n)}},[])},pk=function(e){var t=e.className,n=e.hsva,s=e.onChange,r={backgroundImage:"linear-gradient(90deg, "+Ld(Object.assign({},n,{a:0}))+", "+Ld(Object.assign({},n,{a:1}))+")"},o=_u(["react-colorful__alpha",t]),i=fn(100*n.a);return h.createElement("div",{className:o},h.createElement("div",{className:"react-colorful__alpha-gradient",style:r}),h.createElement(Ch,{onMove:function(a){s({a:a.left})},onKey:function(a){s({a:Ti(n.a+a.left)})},"aria-label":"Alpha","aria-valuetext":i+"%","aria-valuenow":i,"aria-valuemin":"0","aria-valuemax":"100"},h.createElement(jh,{className:"react-colorful__alpha-pointer",left:n.a,color:Ld(n)})))},hk=function(e){var t=e.className,n=e.colorModel,s=e.color,r=s===void 0?n.defaultColor:s,o=e.onChange,i=cx(e,["className","colorModel","color","onChange"]),a=h.useRef(null);fk(a);var l=ck(n,r,o),u=l[0],d=l[1],f=_u(["react-colorful",t]);return h.createElement("div",Ou({},i,{ref:a,className:f}),h.createElement(ik,{hsva:u,onChange:d}),h.createElement(ok,{hue:u.h,onChange:d}),h.createElement(pk,{hsva:u,onChange:d,className:"react-colorful__last-control"}))},gk={defaultColor:"rgba(0, 0, 0, 1)",toHsva:sk,fromHsva:function(e){var t=nk(e);return"rgba("+t.r+", "+t.g+", "+t.b+", "+t.a+")"},equal:lk},mk=function(e){return h.createElement(hk,Ou({},e,{colorModel:gk}))};ek([tk]);const vk=e=>e.startsWith("rgba")?e:Es(e).toRgbString();function dx({value:e,onChange:t,disabled:n}){const s=vk(e||""),r=h.useRef(s),[o,i]=h.useState(!1),a=Ws()&&!!window.EyeDropper,l=g=>{r.current=g,t==null||t(g)},u=g=>{r.current=g,t==null||t(g,!0)},d=()=>{a&&new window.EyeDropper().open().then(m=>l(m.sRGBHex)).catch(console.warn)},f=()=>{i(!0)},p=()=>{t==null||t(r.current,!1),i(!1)};return c.jsxs(c.Fragment,{children:[o&&c.jsx("div",{onPointerUp:p,className:"gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-grabbing"}),c.jsx(mk,{className:"color-picker",color:s,onChange:u,onPointerDown:f,onPointerUp:p}),c.jsxs(k,{className:"gs-utl-mt-3",gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(ot,{size:"s",value:s,onChange:l,disabled:n})}),a&&c.jsx(Ke,{type:"button",onClick:d,children:c.jsx(ne,{icon:G.eyedropperVariant,size:oe.s})})]})]})}const bk="gs-cmp-studio-color-picker",yk=h.memo(ce(function({className:t,style:n,value:s="",disabled:r,onChange:o,editorEvents:i}){const{editor:a}=xe(),[l,u]=h.useState(()=>({className:t,style:n,value:s,disabled:r})),d=(f,p)=>{const g=f||"";o==null||o({value:g,partial:p,editor:a,state:l,setState:m=>u(v=>({...v,...m}))})};return co({editor:a,editorEvents:i,localState:l,setLocalState:u}),c.jsx("div",{className:M(bk,l.className,Ee.m),style:l.style,children:c.jsx(dx,{value:l.value||"",onChange:d,disabled:l.disabled})})})),xk="gs-cmp-column",wk=h.memo(function({className:t,children:n,full:s,...r}){return c.jsx(Cn,{className:M(xk,B.bg,"gs-utl-flex gs-utl-flex-col",s&&"gs-utl-h-full",t),...r,children:$t(n)})}),Eh=`<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>`,So="--before-content",Th={select:!0,activate:!0,category:{id:"data-sources",label:"Data Sources"}},fx={stylable:!1,traits:[]};function Sk(e){return typeof e=="object"&&e.type===Ut.variable}function d1(e){if(Sk(e)){const{path:t}=e;return px(t||"")}return e}function px(e){return`{{ ${e} }}`}function Ck(e){const t={};return e.DataSources.getAll().forEach(n=>{const s=n.get("id");if(!s)return;const r=n.getRecords();if(!r){t[s]={};return}t[s]=r.reduce((o,i)=>{if(!i)return o;let a={...i.attributes};return delete a.__p,delete a.id,s===Uo.globalStyles&&(a={value:a.value}),{...o,[i.id]:a}},{})}),t}function hx(e){return Object.entries(e||{}).map(([t,n])=>({id:t,data:n}))}const Ph=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e;return((i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags)??t?{...fx}:{}},zf=e=>{var o,i;const{isProjectTypeEmail:t,sdkOptions:n}=e,s=(i=(o=n.dataSources)==null?void 0:o.exportConfig)==null?void 0:i.skipTags;return t||s===!0?{...fx}:{}},jk=e=>!!e&&typeof e=="object"&&"logicalOperator"in e,Ek=e=>Array.isArray(e)?"array":e===null?"default":typeof e,Tk=ce(({name:e,value:t,isActive:n,isCollection:s,onClick:r,className:o})=>{const i=Ie().tScoped("dataSources"),a=typeof t=="object"&&t!==null,l={array:G.codeBrackets,object:G.codeBraces,string:G.codeString,number:G.number,boolean:G.toggleSwitchOffOutline,default:G.null},u=Ek(t),d=M(o,"gs-utl-text-left",B.hBgH,te.b,te.rnd,Ee.xy,n?[te.bA,B.tA]:[B.br,B.txtHighEmphasisH]),f=p=>typeof p=="object"?Array.isArray(p)?i("items",{params:{length:p.length}}):p?i("properties",{params:{length:Object.keys(p).length}}):"null":String(p);return c.jsx(Ke,{onClick:r,border:!1,className:d,full:!0,children:c.jsxs(k,{items:"center",justify:"between",gap:"s",nowrap:!0,children:[c.jsxs(k,{className:"gs-utl-flex-grow gs-utl-overflow-hidden",gap:"s",col:!0,children:[c.jsxs(k,{className:"gs-utl-overflow-hidden",items:"center",gap:"s",full:!0,nowrap:!0,children:[c.jsx(ne,{icon:l[u],size:oe.s}),c.jsx(F,{className:M(Oe.txtEllips,s&&"gs-utl-font-bold"),children:e})]}),c.jsx(F,{className:M("gs-utl-w-full",Oe.txtEllips,Oe.disabled),children:f(t)})]}),a&&c.jsx(F,{children:c.jsx(ne,{size:oe.sx,icon:G.arrowRight,className:M(n&&"gs-utl-rotate-180","gs-utl-transition-transform gs-utl-duration-200")})})]})})}),Pk="gs-cmp-data-path-explorer",f1=ce(function({additionalSources:t,onChange:n,path:s=""}){const{editor:r}=xe(),o=h.useRef({}),[i,a]=h.useState(()=>s.split(".")),[l,u]=h.useState([]),d=h.useMemo(()=>({...r?Ck(r):{},...t}),[r,t]),f=(v,b)=>{let x=o.current;for(let y=0;y<b&&y<v.length;y++){const w=v[y];if(x&&typeof x=="object"&&w in x)x=x[w];else{x=void 0;break}}return!x||typeof x!="object"?[]:Object.entries(x).map(([y,w])=>{const S=v.slice(0,b).concat(y),C=i[b]===y,j=b===0&&vr(w)&&w.collectionId===y,E=()=>{const O=C?S.slice(0,-1):S;n==null||n(O.join("."),{paths:O}),a(O)};return c.jsx(Tk,{className:M(j&&"-gs-utl-order-1"),isCollection:j,name:y,value:w,isActive:C,onClick:E},y)})};h.useEffect(()=>{o.current=d;const v=[];for(let b=0;b<=i.length;b++){const x=f(i,b);x.length>0&&v.push(x)}u(v)},[d,i]);const p=M(Pk,B.bg,B.br,te.b,te.rnd,Oe.scrollX,"gs-utl-h-full"),g=M("gs-utl-min-w-[220px]",B.br),m=M("gs-utl-h-full gs-utl-max-h-[60vh]",Oe.scrollY,Ee.xyS);return c.jsx(k,{className:p,full:!0,nowrap:!0,children:l.map((v,b)=>c.jsx(F,{className:M(g,b!==l.length-1&&te.br),children:c.jsx(k,{col:!0,nowrap:!0,gap:"m",className:m,children:v})},b))})});function gx(e){const{collectionId:t,variableType:n,path:s=""}=e;return t?[t,n,s].filter(Boolean).join("."):s}function Oh(e,t){const[n="",s="",...r]=e.split(".");return n&&t[n]?{collectionId:n,variableType:s,path:r.join(".")}:{path:e,collectionId:void 0,variableType:void 0}}const Ok=e=>{const{path:t,collectionId:n,variableType:s}=e.dataResolver||{};return n?[n,s,t].filter(Boolean).join("."):e.value||t||""},_k=e=>{const{dataResolver:t,editor:n,value:s,defaultValue:r,additionalSources:o}=e,{path:i="",collectionId:a,variableType:l}=t||{},u=n==null?void 0:n.DataSources;if(a){const d=o==null?void 0:o[a],f=l&&d?d[l]:d;return(u==null?void 0:u.getValue(i,r,{context:f}))||""}else return(u==null?void 0:u.getValue(s,r))||""},Ak="gs-cmp-data-path-field",gl=ce(e=>{const{size:t="m",value:n="",label:s,open:r,defaultValue:o,additionalSources:i,dataResolver:a,readOnly:l,disabled:u,pickerInPopover:d,onChange:f,onPickerToggle:p}=e,{editor:g}=xe(),m=Ie().tScoped("dataSources"),[v,b]=h.useState(!!r),[x,y]=h.useState(!1),w=!!l||v||x,S=()=>y(!x),C=D=>{const $=D??!v;b($),p==null||p($)},j=()=>C(!1),E=(...D)=>{f==null||f(...D)},O=D=>{w||f==null||f(D,{paths:D.split(".")})},P=Ok({dataResolver:a,value:n}),T=x&&g?`"${_k({editor:g,dataResolver:a,additionalSources:i,value:n,defaultValue:o})}"`:P,_=t==="m",L=_?"lg":t,N=_?oe.l:oe.s,V=m(v?"closePathExplorer":"openPathExplorer"),A={icon:v?G.close:G.databaseOutline,size:oe.l},H={icon:x?G.eyeOff:G.eye,size:_?oe.m:N},U=c.jsx(St,{block:!0,variant:"pr",size:L,title:V,onClick:()=>C(),icon:A});return c.jsxs(k,{className:Ak,gap:t,col:!0,children:[c.jsxs(k,{gap:t,items:"end",nowrap:!0,children:[c.jsx(ot,{readOnly:w,label:s,value:x?T:P,size:t,disabled:u,onChange:O,placeholder:m("selectVariablePath"),className:M("gs-utl-flex-grow",B.txt,Oe.txtEllips),afterInput:!!n&&c.jsx(St,{block:!0,variant:"out-clear",size:"xs",border:!1,title:m("toggleResolvedPath"),onClick:S,className:Oe.hover,icon:H})}),d?c.jsx(xs,{placement:"bottom-end",classNameBody:"gs-utl-w-[400px] gs-utl-h-[300px]",title:!1,padding:!1,border:!1,buttonAs:"span",handler:U,onClose:j,overlay:!0,children:c.jsx(f1,{path:P,onChange:E,additionalSources:i})}):U]}),!!v&&!d&&c.jsx(f1,{path:P,onChange:E,additionalSources:i})]})}),Lk=e=>{const t=parseFloat(e),n=e.replace(`${t}`,"").trim();return{number:t||t===0?`${t}`:"",unit:n}},mx=({value:e,step:t})=>{const n=parseFloat(`${e}`);let s=0;if(Math.floor(n)!==n&&t){const r=`${t}`.split(".")[1];s=(r==null?void 0:r.length)||0}return s?parseFloat(n.toFixed(s)):n},Mk=({value:e,key:t,shiftKey:n,min:s,max:r,step:o=1})=>{const i=t==="ArrowUp",a=t==="ArrowDown";let l=null;if(i||a){l=Number(e);const u=parseFloat(`${o}`);i&&(l+=(n?10:1)*u),a&&(l-=(n?10:1)*u),l=`${Au({min:s,max:r,value:l})}`,l=mx({value:l,step:o})}return l},Au=({min:e,max:t,value:n})=>{const s=parseFloat(`${n}`);let r=s||0;return Dt(e)&&(r=Math.max(r,parseFloat(`${e}`)||0)),Dt(t)&&(r=Math.min(r,parseFloat(`${t}`)||0)),`${`${s}`!=`${n}`?n:r}`},Nk=(e,t,n,s={})=>{const r=parseInt(`${e}`,10)||0,{min:o,max:i,step:a=1}=s;let l=r;const u=f=>{const p=f.clientY-t,g=r-p*parseFloat(`${a}`);l=mx({value:Au({min:o,max:i,value:g}),step:a}),n(l,!0)},d=()=>{window.removeEventListener("mousemove",u),window.removeEventListener("mouseup",d),n(l)};window.addEventListener("mousemove",u),window.addEventListener("mouseup",d)},$k=(e,t,n={})=>{const{partial:s}=n,r=(o,i)=>o===i||s&&o.startsWith(i);return t.some(o=>r(typeof o=="string"?o:o.id,e))},p1=e=>Dt(e)?e:"",kk="gs-cmp-number-field";function Ne(e){const{className:t,value:n,units:s,valueUnit:r,size:o="m",pan:i=!0,min:a,max:l,step:u,placeholder:d,disabled:f,onChange:p,onChangeUnit:g}=e,[m,v]=h.useState(p1(n)),[b,x]=h.useState(!1),y=(s==null?void 0:s.map(P=>({id:P,label:P})))||[],w={min:a,max:l,step:u};h.useEffect(()=>{v(p1(n))},[n,r]);const S=(P,T)=>{p==null||p(Au({min:a,max:l,value:P}),T)},C=P=>{if(f)return;x(!0);const T=(_,L)=>{S(_,!!L),!L&&x(!1)};Nk(m,P.clientY,T,w)},j=P=>{const{key:T,shiftKey:_}=P;switch(T){case"Escape":return v(n);case"Enter":return S(m)}const L=Mk({step:u,value:n,key:T,shiftKey:_});L!==null&&(P.preventDefault(),S(L))},E=()=>{S(m)},O=no({...e,className:M(kk,t)});return c.jsxs("div",{...O,children:[b&&c.jsx("div",{className:M("gs-utl-fixed gs-utl-inset-0 gs-utl-z-50 gs-utl-cursor-ns")}),c.jsx(ys,{as:e.labelAs,...e}),c.jsxs(k,{className:lh(e),items:"center",space:"x2s",children:[!!i&&c.jsx(F,{onMouseDown:C,className:M("gs-utl-opacity-50 gs-utl-cursor-ns",o==="m"&&"-gs-utl-ml-3",o==="s"&&"-gs-utl-ml-2",i!==!0&&"gs-utl-mr-0.5 -gs-utl-ml-1"),children:i===!0?c.jsx(ne,{icon:G.panVertical,size:oe.s2x}):i}),c.jsx(F,{grow:!0,children:c.jsx("input",{className:cl(e),value:m,disabled:f,onChange:P=>v(P.target.value),placeholder:d,onBlur:E,onKeyDown:j})}),!!y.length&&c.jsx(F,{className:M(y.length===1&&"gs-utl-opacity-50 gs-utl-pointer-events-none"),children:c.jsx(Le,{caret:"",size:"x2s",pos:"right",width:"75px",emptyState:"-",border:!1,value:r,disabled:f,onChange:P=>g==null?void 0:g(P),options:y})})]})]})}const Rk="gs-cmp-switch-field";function Na(e){const{className:t,value:n,label:s,labelAs:r,border:o,disabled:i,onChange:a}=e,l=!!n,u=M("gs-utl-relative gs-utl-inline-flex gs-utl-items-center gs-utl-h-6 gs-utl-rounded-full gs-utl-w-11 gs-utl-transition-colors focus:gs-utl-outline-none",l?B.bgA:B.bgH,xa.focus,o&&`${B.br} ${te.b}`);return c.jsx(id.Group,{children:c.jsxs(k,{items:"center",className:M(Rk,t),full:!0,children:[!!s&&c.jsx(id.Label,{as:r,className:M("gs-utl-mr-4 gs-utl-flex-1"),passive:!0,children:c.jsx(ys,{...e,as:"span"})}),c.jsx(id,{checked:l,onChange:a,className:u,disabled:i,children:c.jsx("span",{className:M(B.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 _h(e){var i;const[t,n]=h.useState(((i=e.getDataResolver)==null?void 0:i.call(e))??{}),s=h.useRef(t),r=a=>{const l={...s.current,...a};s.current=l,n(l)},o=()=>{e.setDataResolver(s.current)};return h.useEffect(()=>{const a="change:dataResolver",l=()=>{const u=e.getDataResolver();n(u)};return e.on(a,l),()=>{e.off(a,l)}},[e]),{localData:t,updateLocalData:r,syncToComponent:o}}const Ik="gs-cmp-data-collection-picker",Vk=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=_h(e),{collectionId:o="",dataSource:i={},startIndex:a=0,endIndex:l=10}=n,u=gx(i),d=l===Number.MAX_VALUE,f=Ie().tScoped("dataSources"),p=d?"":l,g=()=>{r(),t==null||t({value:n})},m=y=>s({dataSource:{...i,path:y}}),v=y=>s({startIndex:y}),b=y=>s({endIndex:y}),x=y=>s({endIndex:y?Number.MAX_VALUE:4});return c.jsxs(k,{className:Ik,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(ot,{className:"gs-utl-flex-grow",size:"s",label:f("collectionId"),value:o,readOnly:!0,disabled:!0}),c.jsx(ly,{size:"s",value:o,block:!0})]}),c.jsx(gl,{label:f("variablePath"),value:u,onChange:m,dataResolver:n}),c.jsxs(k,{items:"end",gap:"s",nowrap:!0,children:[c.jsx(Ne,{size:"s",className:"gs-utl-flex-grow",label:f("collectionStartIndex"),value:a==null?void 0:a.toString(),onChange:v}),c.jsx(Ne,{size:"s",label:f("collectionEndIndex"),placeholder:d?"-":"",value:p==null?void 0:p.toString(),onChange:b,className:M("gs-utl-flex-grow",d&&"gs-utl-opacity-50 gs-utl-pointer-events-none")}),c.jsx(F,{children:c.jsx(Na,{label:f("collectionUpToEndIndex"),value:d,onChange:x})})]}),c.jsx(k,{full:!0,justify:"end",children:c.jsx(Ke,{onClick:g,variant:"pr",size:"m",children:f("confirm")})})]})}),Hk="gs-data-collection-picker",Dk=ce(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(Cn,{className:M(Hk,t),...r,children:c.jsx(Vk,{component:n,onConfirm:s})})});var Mn=(e=>(e.STRING="string",e.NUMBER="number",e.DATA_SOURCE="dataSource",e))(Mn||{}),Pn=(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))(Pn||{}),Ah=(e=>(e.greaterThan=">",e.lessThan="<",e.greaterThanOrEqual=">=",e.lessThanOrEqual="<=",e.equals="=",e.notEquals="!=",e))(Ah||{}),Lh=(e=>(e.contains="contains",e.startsWith="startsWith",e.endsWith="endsWith",e.equalsIgnoreCase="equalsIgnoreCase",e.trimEquals="trimEquals",e))(Lh||{});const Fk=[...Object.values(Lh),...Object.values(Ah),...Object.values(Pn)],Uf={string:Object.values(Lh),number:Object.values(Ah),dataSource:Fk},Bk=h.memo(function(t){const{additionalSources:n,side:s,type:r,value:o,onChange:i}=t;switch(r){case Mn.DATA_SOURCE:return c.jsx(gl,{size:"s",pickerInPopover:!0,value:gx(o),onChange:a=>i(s,a,r),additionalSources:n});case Mn.NUMBER:return c.jsx(Ne,{size:"s",value:o,onChange:a=>i(s,a,r)});default:return c.jsx(ot,{size:"s",value:o,onChange:a=>i(s,a,r)})}}),zk="gs-cmp-statement-side",h1=h.memo(function({side:t,type:n,value:s,label:r,onChange:o,onTypeChange:i,additionalSources:a,typeOptions:l}){return c.jsxs(k,{className:M(zk,"gs-utl-flex-grow"),col:!0,children:[c.jsx(Gr,{size:"s",children:r}),c.jsxs(k,{items:"center",gap:"xs",children:[c.jsx(F,{children:c.jsx(Le,{size:"s",value:n,options:l,onChange:u=>i(t,u)})}),c.jsx(F,{grow:!0,children:c.jsx(Bk,{additionalSources:a,side:t,type:n,value:s,onChange:o})})]})]})}),Hl=e=>typeof e=="object"&&(e==null?void 0:e.type)==="data-variable"?Mn.DATA_SOURCE:typeof e=="string"?Mn.STRING:typeof e=="number"?Mn.NUMBER:Mn.STRING,Uk=(e,t,n)=>{switch(t){case Mn.STRING:return e||"";case Mn.NUMBER:return e?Number(e):0;case Mn.DATA_SOURCE:{const s=n||{};return{type:"data-variable",...(dt(e)?Oh(e,s):e)??{path:"",defaultValue:""}}}default:return e}},Wk=e=>Uf[e][0],Gk=e=>![Pn.isTruthy,Pn.isFalsy,Pn.isDefined,Pn.isNull,Pn.isUndefined,Pn.isArray,Pn.isObject,Pn.isString,Pn.isNumber,Pn.isBoolean,Pn.isDefaultValue].includes(e),qk="gs-cmp-statement",Kk=ce(e=>{const{statement:t,onChange:n,className:s,additionalSources:r}=e,o=Ie().tScoped("dataSources"),[i,a]=h.useState(()=>Hl(t.left)),[l,u]=h.useState(()=>Hl(t.right)),d=Uf[i]||Uf[Mn.STRING],f=h.useMemo(()=>Object.values(Mn).map(S=>({id:S,label:$s(S)})),[]),p=h.useMemo(()=>d.map(S=>({id:S,label:o(`operators.${S}`)})),[d,o]);h.useEffect(()=>{a(Hl(t.left)),u(Hl(t.right))},[t.left,t.right]);const g=S=>{n({...t,...S})},m=(S,C,j)=>{const E=Uk(C,j,r),O=S==="left",P=O&&j!==Mn.DATA_SOURCE;O?a(j):u(j),g({[S]:E,...P&&{operator:Wk(j)}})},v=(S,C)=>m(S,null,C),b=S=>g({operator:S}),x=M(qk,s,B.br,te.b,te.rnd,Ee.xy),y=Gk(t.operator),w={additionalSources:r,onChange:m,onTypeChange:v,typeOptions:f};return c.jsx(k,{className:M(x,"gs-utl-w-full"),items:"stretch",gap:"m",col:!0,full:!0,nowrap:!0,children:c.jsxs(k,{gap:"m",items:"center",full:!0,nowrap:!0,children:[c.jsx(h1,{side:"left",type:i,value:t.left,label:o("leftValue"),...w}),c.jsx(F,{children:c.jsx(Le,{size:"s",label:o("operator"),value:t.operator,options:p,onChange:b})}),y&&c.jsx(h1,{side:"right",type:l,value:t.right,label:o("rightValue"),...w})]})})}),Md="gs-cmp-statements-group",Zk=e=>e==="and"||e==="or",Rc=e=>({...e,statements:[...e.statements??[],{left:"",operator:"equals",right:""}]}),vx=ce(e=>{const{className:t,condition:n,onUpdate:s,additionalSources:r,skipAddCondition:o}=e,i=Ie().tScoped("dataSources"),a=n.statements??[],l=n.logicalOperator||"and",u=m=>{Zk(m)&&s({...n,logicalOperator:m})},d=()=>{Rc(n),s(Rc(n))},f=m=>{const v=a.filter((b,x)=>x!==m);s({...n,statements:v})},p=(m,v)=>{if(m>=0&&m<a.length){const b=[...a];b[m]=v,s({...n,statements:b})}},g=[{id:"and",label:i("conditionAnd")},{id:"or",label:i("conditionOr")}];return c.jsxs(k,{className:M(Md,t,"gs-utl-w-full"),full:!0,gap:"m",col:!0,nowrap:!0,children:[a.length>1&&c.jsx(ro,{value:l,onChange:u,tabs:g}),c.jsx(k,{className:`${Md}__items`,gap:"s",col:!0,full:!0,nowrap:!0,children:a.map((m,v)=>c.jsxs(k,{className:M(`${Md}__item`),gap:"s",col:!0,children:[c.jsx(Kk,{additionalSources:r,statement:m,onChange:b=>p(v,b)}),v<a.length-1&&c.jsxs(k,{justify:"center",items:"center",gap:"m",children:[c.jsx("span",{className:M(B.txtHighEmphasis,"gs-utl-text-sm gs-utl-font-bold"),children:l.toUpperCase()}),c.jsx(St,{block:!0,variant:"out-clear",title:i("deleteCondition"),onClick:()=>f(v+1),icon:{icon:G.delete,size:oe.s}})]})]},`stmt-${v}`))}),!o&&c.jsx(k,{justify:"end",children:c.jsx(Ke,{variant:"pr",onClick:d,icon:{icon:G.plus,size:oe.s},children:i("addCondition")})})]})}),Yk="gs-cmp-data-condition-picker",Xk=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=_h(e),o=Ie().tScoped("dataSources"),i=n.condition,a=d=>s({condition:d}),l=()=>{r(),t==null||t({value:n})},u=()=>{s({condition:Rc(i)})};return c.jsxs(k,{className:Yk,items:"stretch",gap:"m",full:!0,col:!0,children:[c.jsx(vx,{additionalSources:e.collectionsStateMap??{},condition:i,onUpdate:a,skipAddCondition:!0}),c.jsxs(k,{gap:"m",justify:"end",full:!0,children:[c.jsx(Ke,{variant:"out",onClick:u,icon:{icon:G.plus,size:oe.s},children:o("addCondition")}),c.jsx(Ke,{onClick:l,variant:"pr",size:"m",children:o("confirm")})]})]})}),Jk="gs-data-condition-picker",Qk=ce(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(Cn,{className:M(Jk,t),...r,children:c.jsx(Xk,{component:n,onConfirm:s})})}),eR="gs-data-path-field",tR=ce(({className:e,value:t="",onChange:n,...s})=>c.jsx(Cn,{className:M(eR,e),...s,children:c.jsx(gl,{onChange:r=>n({value:r}),value:t})})),Dl={type:"data-variable",path:"",defaultValue:""},g1={type:"data-condition",condition:{logicalOperator:"and",statements:[{left:"",operator:"",right:""}]},ifTrue:"",ifFalse:""};function Kr(e){return["data-variable","data-condition"].includes((e==null?void 0:e.type)??"")}const m1="gs-cmp-dynamic-value-picker",nR=ce(({value:e,onChange:t,onConfirm:n,additionalSources:s})=>{const[r,o]=h.useState(()=>Kr(e)?e:Dl),[i,a]=h.useState(r.type),l=Ie().tScoped("dataSources");h.useEffect(()=>{const w=Kr(e)?e:Dl;(w.type!==r.type||JSON.stringify(w)!==JSON.stringify(r))&&(o(w),a(w.type))},[e]);const u=w=>{o(w),t==null||t({value:w})},d=w=>{const S=w;a(S);const C=r.type===S?r:S==="data-variable"?Dl:g1;u(C)},f=w=>{u({type:"data-variable",defaultValue:r.defaultValue,...Oh(w,s)})},p=w=>{o(S=>{const C={...S,defaultValue:w};return t==null||t({value:C}),C})},g=w=>{u({...r,condition:w})},m=(w,S)=>{u({...r,[w]:S})},v=()=>{const w=r.condition;g(Rc(w))},b=[{id:"data-variable",label:l("variable")},{id:"data-condition",label:l("condition")}],x=(r==null?void 0:r.type)==="data-variable"?r:Dl,y=(r==null?void 0:r.type)==="data-condition"?r:g1;return c.jsxs(k,{className:m1,gap:"s",col:!0,nowrap:!0,children:[c.jsxs(k,{className:m1,gap:"m",col:!0,nowrap:!0,full:!0,children:[c.jsx(ro,{value:i,onChange:d,tabs:b}),c.jsx(F,{grow:!0,className:Ee.y,style:{overflowY:"auto",overflowX:"hidden"},children:i==="data-variable"?c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(gl,{value:x.path,label:l("variablePath"),additionalSources:s,defaultValue:x.defaultValue,onChange:f}),c.jsx(ot,{label:l("defaultValue"),value:x.defaultValue||"",onChange:p})]}):c.jsxs(k,{gap:"m",col:!0,children:[c.jsx(vx,{additionalSources:s,condition:y.condition,onUpdate:g,skipAddCondition:!0}),c.jsxs(k,{gap:"s",col:!0,nowrap:!0,children:[c.jsx(ot,{label:l("ifTrue"),value:y.ifTrue,onChange:w=>m("ifTrue",w)}),c.jsx(ot,{label:l("ifFalse"),value:y.ifFalse,onChange:w=>m("ifFalse",w)})]})]})}),i==="data-condition"&&c.jsx(k,{full:!0,justify:"end",className:Ee.x,children:c.jsx(Ke,{variant:"out",onClick:v,icon:{icon:G.plus,size:oe.s},children:l("addCondition")})})]}),c.jsx(k,{full:!0,justify:"end",className:Ee.y,children:c.jsx(Ke,{onClick:()=>{n==null||n({value:r})},variant:"pr",size:"m",children:l("confirm")})})]})}),sR="gs-data-value-picker",rR=ce(({className:e,value:t={},onChange:n,onConfirm:s,additionalSources:r={},...o})=>c.jsx(Cn,{className:M(sR,e),...o,children:c.jsx(nR,{value:t,onConfirm:i=>s==null?void 0:s(i),onChange:i=>n==null?void 0:n(i),additionalSources:r})})),oR="gs-cmp-data-variable-picker",iR=ce(({component:e,onConfirm:t})=>{const{localData:n,updateLocalData:s,syncToComponent:r}=_h(e),o=Ie().tScoped("dataSources"),{path:i="",defaultValue:a=""}=n,l=e.collectionsStateMap,u=p=>{s(Oh(p,l))},d=()=>{r(),t==null||t({value:n})},f=p=>s({defaultValue:p});return c.jsxs(k,{className:oR,gap:"s",col:!0,nowrap:!0,children:[c.jsx(gl,{value:i,label:o("variablePath"),dataResolver:n,additionalSources:l,defaultValue:a,onChange:u}),c.jsx(ot,{label:o("defaultValue"),value:a,onChange:f}),c.jsx(k,{full:!0,justify:"end",className:Ee.y,children:c.jsx(Ke,{onClick:d,variant:"pr",size:"m",children:o("confirm")})})]})}),aR="gs-data-variable-picker",lR=ce(function({className:t,component:n,onConfirm:s,...r}){return c.jsx(Cn,{className:M(aR,t),...r,children:c.jsx(iR,{component:n,onConfirm:s})})}),cR="gs-cmp-input-field",uR=h.memo(ce(function({className:t,style:n,label:s,name:r,value:o,size:i,disabled:a,inputType:l,readOnly:u,required:d,placeholder:f,onChange:p,onInput:g,editorEvents:m}){const{editor:v}=xe(),[b,x]=h.useState(()=>({className:t,style:n,label:s,name:r,value:o,size:i,readOnly:u,disabled:a,required:d,placeholder:f})),y=C=>({value:C,editor:v,state:b,setState:j=>x(E=>({...E,...j}))}),w=C=>p==null?void 0:p(y(C)),S=C=>g==null?void 0:g(y(C));return co({editor:v,editorEvents:m,localState:b,setLocalState:x}),c.jsx(ot,{type:l,className:M(cR,b.className),style:b.style,label:b.label,name:b.name,value:b.value,size:b.size,required:b.required,disabled:b.disabled,readOnly:b.readOnly,placeholder:b.placeholder,onChange:w,onInput:S})})),dR="gs-menu-list",fR=ce(function({className:e,items:t,onItemClick:n,...s}){const{editor:r}=xe(),[o,i]=h.useState(),a=u=>{const{onClick:d}=u;if(d&&r)return f=>d({item:u,editor:r,...f})},l=()=>{if(n&&r)return u=>n({...u,editor:r})};return c.jsx(Cn,{className:M(dR,B.bg,"gs-utl-flex gs-utl-flex-col",e),...s,children:(t||[]).map((u,d)=>h.createElement($i,{...u,label:u.layout?$t(u.layout):u.label,key:u.id??d,className:u.className,action:a(u),onActive:()=>i(u),onItemClick:l(),active:o===u,items:u.items}))})});function pR({children:e,accept:t,onChange:n,multiple:s=!0,...r}){const o=Ie(),i=h.useRef(null),a=()=>{const{current:l}=i;l&&(l.value="",l.click())};return c.jsxs(c.Fragment,{children:[c.jsx("input",{className:K("hidden"),ref:i,type:"file",multiple:s,accept:t,onChange:n}),c.jsx(Ke,{variant:"pr",size:"m2",...r,onClick:a,children:e||o.t("upload")})]})}const hR=ce(pR),gR=ce(function({editor:t,assetProps:n,itemLayout:s,onSelect:r,onRemove:o}){const i=il();return $t(s({asset:Lr(i.toAsset(n)),assetProps:Lr(n),onSelect:a=>r(i.toAssetProps(a)),onDelete:o&&(a=>o(i.toAssetProps(a))),editor:t}))}),mR="gs-cmp-asset-card",vR=ce(function(t){var f;const{assetProps:n,onSelect:s,onRemove:r,className:o,itemLayout:i}=t,a=Ie(),{editor:l}=xe();if(i)return l?c.jsx(gR,{...t,editor:l,itemLayout:i}):null;const{src:u}=n,d=n.name||((f=u.split("/").pop())==null?void 0:f.split("?").shift());return c.jsx(ns,{padding:!1,className:ie(mR,"overflow-hidden max-w-full group",o),children:c.jsxs(k,{col:!0,children:[c.jsxs(F,{className:ie("relative group h-24 cursor-pointer bg-checker"),onClick:()=>s(n),children:[c.jsx("div",{className:ie("w-full h-full bg-contain bg-no-repeat bg-center"),style:{backgroundImage:`url("${u}")`}}),c.jsx(k,{justify:"center",items:"center",className:ie(Oe.coverAbs,B.bgH75,"group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),children:c.jsx(Ke,{className:ie("text-sm"),size:"m2",variant:"pr",children:a.t("select")})})]}),c.jsxs(k,{className:ie("gjs-p-1 max-w-full"),space:"s",items:"center",nowrap:!0,children:[c.jsx(F,{className:ie(Oe.txtEllips,"text-sm gjs-mr-auto"),children:d}),r&&c.jsx(Pu,{onConfirm:()=>r==null?void 0:r(n),text:c.jsxs(k,{col:!0,space:"m",items:"stretch",children:[c.jsx("p",{className:ie("text-center",B.txtHighEmphasis),children:a.t("assetManager.deleteConfirmQuestion")}),c.jsx("p",{className:ie("text-center"),children:a.t("assetManager.deleteConfirmExplanation")})]}),confirmButtonProps:{variant:"danger"},children:c.jsx(St,{title:a.t("delete"),children:c.jsx(ne,{icon:G.delete,size:oe.sx})})})]})]})})}),js="gs-asset-manager",bR={search:!0,addUrl:!0,upload:!0},yR=ce(function({assetProps:t,typeFilterOptions:n,providerFilterOptions:s,typeFilter:r,providerFilter:o,searchValue:i,isLoading:a,optionalType:l,optionalProvider:u,useLocalSearch:d,itemLayout:f,content:p,onSelect:g,onChangeTypeFilter:m,onChangeProviderFilter:v,onChangeSearchValue:b,onChangeUpload:x,onAddUrl:y,onRemove:w,onEndReached:S,layoutAfterHeader:C}){const j=xe(),{editor:E}=j,O=Ie(),[P]=rh(),T=Sh(p==null?void 0:p.itemsPerRow),[_,L]=h.useState(""),N=(p==null?void 0:p.header)===!1?!1:{...bR,...vr(p==null?void 0:p.header)?p.header:{}};if(!E)return;const V=d?t.filter(A=>!(i&&!di(A.src,i)&&!di(A.name??"",i))):t;return c.jsxs(k,{className:K(js,"relative gs-utl-h-full",a&&Oe.disabled),nowrap:!0,col:!0,space:"m",children:[N!==!1&&c.jsxs(k,{className:`${js}__header`,gap:"m",justify:"between",items:"center",children:[c.jsxs(k,{className:`${js}__header-filters`,items:"center",gap:"m",children:[N.search&&c.jsx(F,{children:c.jsx(ot,{className:`${js}__search-filter`,size:"m",type:"search",value:i,onInput:b,placeholder:`${O.t("search")}...`})}),n.length>(l?0:1)&&c.jsx(F,{children:c.jsx(Le,{className:K(`${js}__type-filter`,"items-center"),size:"m",options:n,value:r,onChange:m,emptyState:O.t("assetManager.assetTypes.all"),includeEmpty:l})}),s.length>(u?0:1)&&c.jsx(F,{children:c.jsx(Le,{classNameContainer:K(`${js}__provider-filter`,"items-center"),size:"m",options:s.map(A=>({...A,label:tt(A.label)?A.label({editor:E}):A.label,icon:A.icon})),value:o,onChange:v,emptyState:O.t("assetManager.noProvider"),includeEmpty:u})})]}),c.jsxs(k,{className:`${js}__header-buttons`,items:"center",gap:"m",children:[N.upload&&c.jsx(F,{children:c.jsx(hR,{className:`${js}__upload-field`,onChange:x})}),N.addUrl&&!!y&&c.jsx(F,{children:c.jsx(xs,{className:`${js}__add-url-popover`,overlay:!0,placement:"bottom-end",title:!1,buttonAs:"span",handler:c.jsx(Ke,{variant:"pr",size:"m2",children:O.t("assetManager.addUrl")}),children:({close:A})=>c.jsxs(k,{gap:"m",children:[c.jsx(F,{children:c.jsx(ot,{type:"url",size:"s",value:_,onChange:L,placeholder:O.t("assetManager.inputPlh")})}),c.jsx(F,{children:c.jsx(Ke,{variant:"pr",size:"m2",onClick:()=>{y(_),A()},children:O.t("add")})})]})})})]}),C&&c.jsx(c.Fragment,{children:$t(C({editor:E}))})]}),c.jsx(k,{className:K(`${js}__content`,"gs-utl-h-[75vh] gs-utl-flex-grow"),space:"m",col:!0,nowrap:!0,children:!a&&!V.length?c.jsx(k,{justify:"center",children:O.t("noItems")}):!!P&&c.jsx(Tu,{data:V,listClassName:K("gs-utl-grid gs-utl-gap-2",T),endReached:S,itemContent:(A,H)=>c.jsx(vR,{assetProps:H,onSelect:g,onRemove:w,itemLayout:f},H.id),components:{Footer:S?xR:void 0}})}),a&&c.jsx(Br,{abs:!0})]})}),xR=()=>c.jsx("div",{style:{padding:"2rem",display:"flex",justifyContent:"center",height:200}}),wR=ce(function({panelId:t,content:n,assets:s,types:r,providers:o,typeId:i,providerId:a,optionalType:l,optionalProvider:u,onSelect:d,close:f,layoutAfterHeader:p}){const{appEditorStore:g,i18nStore:m}=jn(),{editor:v}=g,b=il(),{customOnLoad:x}=b,y=N0(t);h.useEffect(()=>{const E=P=>dt(P)?{id:P,label:m.t(`assetManager.assetTypes.${P}`)||P}:P;y.setCustomTypes(r==null?void 0:r.map(E)),y.setCustomProviders(dt(o)?[o]:o),i?y.setTypeFilter(i):y.initTypeFilter(),a?y.setProviderFilter(a):y.initProviderFilter(),Dt(l)?y.setOptionalType(l):y.initOptionalType(),Dt(u)?y.setOptionalProvider(u):y.initOptionalProvider();const O=setTimeout(()=>y.loadAssets());return()=>clearTimeout(O)},[r,o,i,a,l,u]);const w=E=>{b.addToProjectAssets([{id:E,src:E,type:y.typeFilter??To.image}])},S=E=>{v&&(d==null||d({asset:b.toAsset(E),assetProps:E,editor:v}),f==null||f())},C=s==null?void 0:s.map(b.toAssetProps),j=y.shouldLoadNextPage?()=>y.loadAssets(!1):void 0;return c.jsx(yR,{assetProps:C??y.assetProps,typeFilter:y.typeFilter,typeFilterOptions:y.typeFilterOptions,providerFilter:y.providerFilter,providerFilterOptions:y.providerFilterOptions,searchValue:y.searchValue,onChangeTypeFilter:E=>{y.setTypeFilter(E),y.loadAssets()},onChangeProviderFilter:E=>{y.setProviderFilter(E),y.loadAssets()},onChangeSearchValue:y.setSearchValue,onSelect:S,onAddUrl:x?void 0:w,onChangeUpload:E=>b.uploadFile(E.nativeEvent),onRemove:C?void 0:y.handleDelete,onEndReached:j,isLoading:y.isLoading,itemLayout:y.itemLayout,content:n,optionalType:y.optionalType,optionalProvider:y.optionalProvider,useLocalSearch:!y.reloadOnInput,layoutAfterHeader:p})});var SR=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),Rt=function(){return Rt=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Rt.apply(this,arguments)},v1={width:"100%",height:"10px",top:"0px",left:"0px",cursor:"row-resize"},b1={width:"10px",height:"100%",top:"0px",left:"0px",cursor:"col-resize"},Fl={width:"20px",height:"20px",position:"absolute"},CR={top:Rt(Rt({},v1),{top:"-5px"}),right:Rt(Rt({},b1),{left:void 0,right:"-5px"}),bottom:Rt(Rt({},v1),{top:void 0,bottom:"-5px"}),left:Rt(Rt({},b1),{left:"-5px"}),topRight:Rt(Rt({},Fl),{right:"-10px",top:"-10px",cursor:"ne-resize"}),bottomRight:Rt(Rt({},Fl),{right:"-10px",bottom:"-10px",cursor:"se-resize"}),bottomLeft:Rt(Rt({},Fl),{left:"-10px",bottom:"-10px",cursor:"sw-resize"}),topLeft:Rt(Rt({},Fl),{left:"-10px",top:"-10px",cursor:"nw-resize"})},jR=function(e){SR(t,e);function t(){var n=e!==null&&e.apply(this,arguments)||this;return n.onMouseDown=function(s){n.props.onResizeStart(s,n.props.direction)},n.onTouchStart=function(s){n.props.onResizeStart(s,n.props.direction)},n}return t.prototype.render=function(){return rt.createElement("div",{className:this.props.className||"",style:Rt(Rt({position:"absolute",userSelect:"none"},CR[this.props.direction]),this.props.replaceStyles||{}),onMouseDown:this.onMouseDown,onTouchStart:this.onTouchStart},this.props.children)},t}(rt.PureComponent),ER=function(){var e=function(t,n){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(s,r){s.__proto__=r}||function(s,r){for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(s[o]=r[o])},e(t,n)};return function(t,n){e(t,n);function s(){this.constructor=t}t.prototype=n===null?Object.create(n):(s.prototype=n.prototype,new s)}}(),Ps=function(){return Ps=Object.assign||function(e){for(var t,n=1,s=arguments.length;n<s;n++){t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},Ps.apply(this,arguments)},TR={width:"auto",height:"auto"},Bl=function(e,t,n){return Math.max(Math.min(e,n),t)},y1=function(e,t,n){var s=Math.round(e/t);return s*t+n*(s-1)},Qo=function(e,t){return new RegExp(e,"i").test(t)},zl=function(e){return!!(e.touches&&e.touches.length)},PR=function(e){return!!((e.clientX||e.clientX===0)&&(e.clientY||e.clientY===0))},x1=function(e,t,n){n===void 0&&(n=0);var s=t.reduce(function(o,i,a){return Math.abs(i-e)<Math.abs(t[o]-e)?a:o},0),r=Math.abs(t[s]-e);return n===0||r<n?t[s]:e},Nd=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"},Ul=function(e,t,n,s){if(e&&typeof e=="string"){if(e.endsWith("px"))return Number(e.replace("px",""));if(e.endsWith("%")){var r=Number(e.replace("%",""))/100;return t*r}if(e.endsWith("vw")){var r=Number(e.replace("vw",""))/100;return n*r}if(e.endsWith("vh")){var r=Number(e.replace("vh",""))/100;return s*r}}return e},OR=function(e,t,n,s,r,o,i){return s=Ul(s,e.width,t,n),r=Ul(r,e.height,t,n),o=Ul(o,e.width,t,n),i=Ul(i,e.height,t,n),{maxWidth:typeof s>"u"?void 0:Number(s),maxHeight:typeof r>"u"?void 0:Number(r),minWidth:typeof o>"u"?void 0:Number(o),minHeight:typeof i>"u"?void 0:Number(i)}},_R=function(e){return Array.isArray(e)?e:[e,e]},AR=["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"],w1="__resizable_base__",LR=function(e){ER(t,e);function t(n){var s,r,o,i,a=e.call(this,n)||this;return a.ratio=1,a.resizable=null,a.parentLeft=0,a.parentTop=0,a.resizableLeft=0,a.resizableRight=0,a.resizableTop=0,a.resizableBottom=0,a.targetLeft=0,a.targetTop=0,a.appendBase=function(){if(!a.resizable||!a.window)return null;var l=a.parentNode;if(!l)return null;var u=a.window.document.createElement("div");return u.style.width="100%",u.style.height="100%",u.style.position="absolute",u.style.transform="scale(0, 0)",u.style.left="0",u.style.flex="0 0 100%",u.classList?u.classList.add(w1):u.className+=w1,l.appendChild(u),u},a.removeBase=function(l){var u=a.parentNode;u&&u.removeChild(l)},a.state={isResizing:!1,width:(r=(s=a.propsSize)===null||s===void 0?void 0:s.width)!==null&&r!==void 0?r:"auto",height:(i=(o=a.propsSize)===null||o===void 0?void 0:o.height)!==null&&i!==void 0?i:"auto",direction:"right",original:{x:0,y:0,width:0,height:0},backgroundStyle:{height:"100%",width:"100%",backgroundColor:"rgba(0,0,0,0)",cursor:"auto",opacity:0,position:"fixed",zIndex:9999,top:"0",left:"0",bottom:"0",right:"0"},flexBasis:void 0},a.onResizeStart=a.onResizeStart.bind(a),a.onMouseMove=a.onMouseMove.bind(a),a.onMouseUp=a.onMouseUp.bind(a),a}return Object.defineProperty(t.prototype,"parentNode",{get:function(){return this.resizable?this.resizable.parentNode:null},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"window",{get:function(){return!this.resizable||!this.resizable.ownerDocument?null:this.resizable.ownerDocument.defaultView},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"propsSize",{get:function(){return this.props.size||this.props.defaultSize||TR},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){var n=0,s=0;if(this.resizable&&this.window){var r=this.resizable.offsetWidth,o=this.resizable.offsetHeight,i=this.resizable.style.position;i!=="relative"&&(this.resizable.style.position="relative"),n=this.resizable.style.width!=="auto"?this.resizable.offsetWidth:r,s=this.resizable.style.height!=="auto"?this.resizable.offsetHeight:o,this.resizable.style.position=i}return{width:n,height:s}},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"sizeStyle",{get:function(){var n=this,s=this.props.size,r=function(a){var l;if(typeof n.state[a]>"u"||n.state[a]==="auto")return"auto";if(n.propsSize&&n.propsSize[a]&&(!((l=n.propsSize[a])===null||l===void 0)&&l.toString().endsWith("%"))){if(n.state[a].toString().endsWith("%"))return n.state[a].toString();var u=n.getParentSize(),d=Number(n.state[a].toString().replace("px","")),f=d/u[a]*100;return f+"%"}return Nd(n.state[a])},o=s&&typeof s.width<"u"&&!this.state.isResizing?Nd(s.width):r("width"),i=s&&typeof s.height<"u"&&!this.state.isResizing?Nd(s.height):r("height");return{width:o,height:i}},enumerable:!1,configurable:!0}),t.prototype.getParentSize=function(){if(!this.parentNode)return this.window?{width:this.window.innerWidth,height:this.window.innerHeight}:{width:0,height:0};var n=this.appendBase();if(!n)return{width:0,height:0};var s=!1,r=this.parentNode.style.flexWrap;r!=="wrap"&&(s=!0,this.parentNode.style.flexWrap="wrap"),n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="100%";var o={width:n.offsetWidth,height:n.offsetHeight};return s&&(this.parentNode.style.flexWrap=r),this.removeBase(n),o},t.prototype.bindEvents=function(){this.window&&(this.window.addEventListener("mouseup",this.onMouseUp),this.window.addEventListener("mousemove",this.onMouseMove),this.window.addEventListener("mouseleave",this.onMouseUp),this.window.addEventListener("touchmove",this.onMouseMove,{capture:!0,passive:!1}),this.window.addEventListener("touchend",this.onMouseUp))},t.prototype.unbindEvents=function(){this.window&&(this.window.removeEventListener("mouseup",this.onMouseUp),this.window.removeEventListener("mousemove",this.onMouseMove),this.window.removeEventListener("mouseleave",this.onMouseUp),this.window.removeEventListener("touchmove",this.onMouseMove,!0),this.window.removeEventListener("touchend",this.onMouseUp))},t.prototype.componentDidMount=function(){if(!(!this.resizable||!this.window)){var n=this.window.getComputedStyle(this.resizable);this.setState({width:this.state.width||this.size.width,height:this.state.height||this.size.height,flexBasis:n.flexBasis!=="auto"?n.flexBasis:void 0})}},t.prototype.componentWillUnmount=function(){this.window&&this.unbindEvents()},t.prototype.createSizeForCssProperty=function(n,s){var r=this.propsSize&&this.propsSize[s];return this.state[s]==="auto"&&this.state.original[s]===n&&(typeof r>"u"||r==="auto")?"auto":n},t.prototype.calculateNewMaxFromBoundary=function(n,s){var r=this.props.boundsByDirection,o=this.state.direction,i=r&&Qo("left",o),a=r&&Qo("top",o),l,u;if(this.props.bounds==="parent"){var d=this.parentNode;d&&(l=i?this.resizableRight-this.parentLeft:d.offsetWidth+(this.parentLeft-this.resizableLeft),u=a?this.resizableBottom-this.parentTop:d.offsetHeight+(this.parentTop-this.resizableTop))}else this.props.bounds==="window"?this.window&&(l=i?this.resizableRight:this.window.innerWidth-this.resizableLeft,u=a?this.resizableBottom:this.window.innerHeight-this.resizableTop):this.props.bounds&&(l=i?this.resizableRight-this.targetLeft:this.props.bounds.offsetWidth+(this.targetLeft-this.resizableLeft),u=a?this.resizableBottom-this.targetTop:this.props.bounds.offsetHeight+(this.targetTop-this.resizableTop));return l&&Number.isFinite(l)&&(n=n&&n<l?n:l),u&&Number.isFinite(u)&&(s=s&&s<u?s:u),{maxWidth:n,maxHeight:s}},t.prototype.calculateNewSizeFromDirection=function(n,s){var r=this.props.scale||1,o=_R(this.props.resizeRatio||1),i=o[0],a=o[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,x=g||0,y=m||0;return Qo("right",u)&&(v=d.width+(n-d.x)*i/r,p&&(b=(v-y)/this.ratio+x)),Qo("left",u)&&(v=d.width-(n-d.x)*i/r,p&&(b=(v-y)/this.ratio+x)),Qo("bottom",u)&&(b=d.height+(s-d.y)*a/r,p&&(v=(b-x)*this.ratio+y)),Qo("top",u)&&(b=d.height-(s-d.y)*a/r,p&&(v=(b-x)*this.ratio+y)),{newWidth:v,newHeight:b}},t.prototype.calculateNewSizeFromAspectRatio=function(n,s,r,o){var i=this.props,a=i.lockAspectRatio,l=i.lockAspectRatioExtraHeight,u=i.lockAspectRatioExtraWidth,d=typeof o.width>"u"?10:o.width,f=typeof r.width>"u"||r.width<0?n:r.width,p=typeof o.height>"u"?10:o.height,g=typeof r.height>"u"||r.height<0?s:r.height,m=l||0,v=u||0;if(a){var b=(p-m)*this.ratio+v,x=(g-m)*this.ratio+v,y=(d-v)/this.ratio+m,w=(f-v)/this.ratio+m,S=Math.max(d,b),C=Math.min(f,x),j=Math.max(p,y),E=Math.min(g,w);n=Bl(n,S,C),s=Bl(s,j,E)}else n=Bl(n,d,f),s=Bl(s,p,g);return{newWidth:n,newHeight:s}},t.prototype.setBoundingClientRect=function(){var n=1/(this.props.scale||1);if(this.props.bounds==="parent"){var s=this.parentNode;if(s){var r=s.getBoundingClientRect();this.parentLeft=r.left*n,this.parentTop=r.top*n}}if(this.props.bounds&&typeof this.props.bounds!="string"){var o=this.props.bounds.getBoundingClientRect();this.targetLeft=o.left*n,this.targetTop=o.top*n}if(this.resizable){var i=this.resizable.getBoundingClientRect(),a=i.left,l=i.top,u=i.right,d=i.bottom;this.resizableLeft=a*n,this.resizableRight=u*n,this.resizableTop=l*n,this.resizableBottom=d*n}},t.prototype.onResizeStart=function(n,s){if(!(!this.resizable||!this.window)){var r=0,o=0;if(n.nativeEvent&&PR(n.nativeEvent)?(r=n.nativeEvent.clientX,o=n.nativeEvent.clientY):n.nativeEvent&&zl(n.nativeEvent)&&(r=n.nativeEvent.touches[0].clientX,o=n.nativeEvent.touches[0].clientY),this.props.onResizeStart&&this.resizable){var i=this.props.onResizeStart(n,s,this.resizable);if(i===!1)return}this.props.size&&(typeof this.props.size.height<"u"&&this.props.size.height!==this.state.height&&this.setState({height:this.props.size.height}),typeof this.props.size.width<"u"&&this.props.size.width!==this.state.width&&this.setState({width:this.props.size.width})),this.ratio=typeof this.props.lockAspectRatio=="number"?this.props.lockAspectRatio:this.size.width/this.size.height;var a,l=this.window.getComputedStyle(this.resizable);if(l.flexBasis!=="auto"){var u=this.parentNode;if(u){var d=this.window.getComputedStyle(u).flexDirection;this.flexDir=d.startsWith("row")?"row":"column",a=l.flexBasis}}this.setBoundingClientRect(),this.bindEvents();var f={original:{x:r,y:o,width:this.size.width,height:this.size.height},isResizing:!0,backgroundStyle:Ps(Ps({},this.state.backgroundStyle),{cursor:this.window.getComputedStyle(n.target).cursor||"auto"}),direction:s,flexBasis:a};this.setState(f)}},t.prototype.onMouseMove=function(n){var s=this;if(!(!this.state.isResizing||!this.resizable||!this.window)){if(this.window.TouchEvent&&zl(n))try{n.preventDefault(),n.stopPropagation()}catch{}var r=this.props,o=r.maxWidth,i=r.maxHeight,a=r.minWidth,l=r.minHeight,u=zl(n)?n.touches[0].clientX:n.clientX,d=zl(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(),x=OR(b,this.window.innerWidth,this.window.innerHeight,o,i,a,l);o=x.maxWidth,i=x.maxHeight,a=x.minWidth,l=x.minHeight;var y=this.calculateNewSizeFromDirection(u,d),w=y.newHeight,S=y.newWidth,C=this.calculateNewMaxFromBoundary(o,i);this.props.snap&&this.props.snap.x&&(S=x1(S,this.props.snap.x,this.props.snapGap)),this.props.snap&&this.props.snap.y&&(w=x1(w,this.props.snap.y,this.props.snapGap));var j=this.calculateNewSizeFromAspectRatio(S,w,{width:C.maxWidth,height:C.maxHeight},{width:a,height:l});if(S=j.newWidth,w=j.newHeight,this.props.grid){var E=y1(S,this.props.grid[0],this.props.gridGap?this.props.gridGap[0]:0),O=y1(w,this.props.grid[1],this.props.gridGap?this.props.gridGap[1]:0),P=this.props.snapGap||0,T=P===0||Math.abs(E-S)<=P?E:S,_=P===0||Math.abs(O-w)<=P?O:w;S=T,w=_}var L={width:S-g.width,height:w-g.height};if(m&&typeof m=="string"){if(m.endsWith("%")){var N=S/b.width*100;S=N+"%"}else if(m.endsWith("vw")){var V=S/this.window.innerWidth*100;S=V+"vw"}else if(m.endsWith("vh")){var A=S/this.window.innerHeight*100;S=A+"vh"}}if(v&&typeof v=="string"){if(v.endsWith("%")){var N=w/b.height*100;w=N+"%"}else if(v.endsWith("vw")){var V=w/this.window.innerWidth*100;w=V+"vw"}else if(v.endsWith("vh")){var A=w/this.window.innerHeight*100;w=A+"vh"}}var H={width:this.createSizeForCssProperty(S,"width"),height:this.createSizeForCssProperty(w,"height")};this.flexDir==="row"?H.flexBasis=H.width:this.flexDir==="column"&&(H.flexBasis=H.height);var U=this.state.width!==H.width,D=this.state.height!==H.height,$=this.state.flexBasis!==H.flexBasis,I=U||D||$;I&&Gn.flushSync(function(){s.setState(H)}),this.props.onResize&&I&&this.props.onResize(n,p,this.resizable,L)}},t.prototype.onMouseUp=function(n){var s,r,o=this.state,i=o.isResizing,a=o.direction,l=o.original;if(!(!i||!this.resizable)){var u={width:this.size.width-l.width,height:this.size.height-l.height};this.props.onResizeStop&&this.props.onResizeStop(n,a,this.resizable,u),this.props.size&&this.setState({width:(s=this.props.size.width)!==null&&s!==void 0?s:"auto",height:(r=this.props.size.height)!==null&&r!==void 0?r:"auto"}),this.unbindEvents(),this.setState({isResizing:!1,backgroundStyle:Ps(Ps({},this.state.backgroundStyle),{cursor:"auto"})})}},t.prototype.updateSize=function(n){var s,r;this.setState({width:(s=n.width)!==null&&s!==void 0?s:"auto",height:(r=n.height)!==null&&r!==void 0?r:"auto"})},t.prototype.renderResizer=function(n){var s=this,r=this.props,o=r.enable,i=r.handleStyles,a=r.handleClasses,l=r.handleWrapperStyle,u=r.handleWrapperClass,d=r.handleComponent;if(!o)return null;var f=n.filter(function(p){return o[p]!==!1}).map(function(p){return o[p]!==!1?rt.createElement(jR,{key:p,direction:p,onResizeStart:s.onResizeStart,replaceStyles:i&&i[p],className:a&&a[p]},d&&d[p]?d[p]:null):null});return rt.createElement("div",{className:u,style:l},f)},t.prototype.render=function(){var n=this,s=Object.keys(this.props).reduce(function(i,a){return AR.indexOf(a)!==-1||(i[a]=n.props[a]),i},{}),r=Ps(Ps(Ps({position:"relative",userSelect:this.state.isResizing?"none":"auto"},this.props.style),this.sizeStyle),{maxWidth:this.props.maxWidth,maxHeight:this.props.maxHeight,minWidth:this.props.minWidth,minHeight:this.props.minHeight,boxSizing:"border-box",flexShrink:0});this.state.flexBasis&&(r.flexBasis=this.state.flexBasis);var o=this.props.as||"div";return rt.createElement(o,Ps({style:r,className:this.props.className},s,{ref:function(i){i&&(n.resizable=i)}}),this.state.isResizing&&rt.createElement("div",{style:this.state.backgroundStyle}),this.renderResizer(["topLeft","top","topRight","left"]),this.props.children,this.renderResizer(["right","bottomLeft","bottom","bottomRight"]))},t.defaultProps={as:"div",onResizeStart:function(){},onResize:function(){},onResizeStop:function(){},enable:{top:!0,right:!0,bottom:!0,left:!0,topRight:!0,bottomRight:!0,bottomLeft:!0,topLeft:!0},style:{},grid:[1,1],gridGap:[0,0],lockAspectRatio:!1,lockAspectRatioExtraWidth:0,lockAspectRatioExtraHeight:0,scale:1,resizeRatio:1,snapGap:0},t}(rt.PureComponent);function Lu({className:e,children:t,top:n,bottom:s,right:r,left:o,width:i,height:a,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,onResize:g,onResizeStop:m,...v}){const b={top:n||!1,right:r||!1,bottom:s||!1,left:o||!1,topRight:!1,bottomRight:!1,bottomLeft:!1,topLeft:!1},x={width:i||"auto",height:a||"auto"},y=M("gs-utl-z-10",B.hBgAct),w={top:y,bottom:y,right:y,left:y},S={top:{top:-1,height:2},bottom:{bottom:0,height:2},right:{right:-1,width:2},left:{left:-1,width:2}};return c.jsx(LR,{className:e,enable:v.enable??b,defaultSize:x,handleStyles:S,handleClasses:w,onResize:g,onResizeStop:m,minHeight:l,minWidth:u,maxHeight:d,maxWidth:f,style:p,children:t})}const Mh="gs-cmp-accordion",Wf=`${Mh}-handler`,Wl=`${Wf}__content`,MR=`${Mh}-content`;function hr({className:e,classNameWrap:t,classNameContent:n,classNameHandlerContent:s,style:r,handler:o,handlerIcon:i,children:a,inverted:l,disabled:u,sticky:d,onChange:f,open:p}){return c.jsx(sd,{as:"div",defaultOpen:p,className:K(Mh,t,"relative"),children:({open:g})=>c.jsxs(c.Fragment,{children:[c.jsx(sd.Button,{as:u?"div":"button",disabled:u,style:r,onClick:m=>f==null?void 0:f({event:m,open:!g}),className:({open:m})=>M(Wf,tt(e)?e(m):e,d&&"gs-utl-sticky gs-utl-top-0 gs-utl-z-10","gs-utl-w-full"),children:({open:m})=>c.jsxs(k,{items:"center",className:K("gap-2"),full:!0,children:[c.jsx(F,{className:K(Wl,s,"text-left"),grow:!0,children:tt(o)?o(m):c.jsxs(k,{items:"center",className:K(`${Wl}-wrp`,"gap-3"),nowrap:!0,children:[!!i&&c.jsx(ne,{className:K(`${Wl}-icon`),icon:i,size:oe.s2x}),c.jsx(F,{className:K(`${Wl}-label gs-utl-w-full`),children:o})]})}),c.jsx(F,{className:K(`${Wf}-toggle`,l&&"-order-1",u&&"gs-utl-hidden"),children:c.jsx(ne,{icon:G.chevronDown,className:K("w-5 h-5 transition-transform",m&&"rotate-180")})})]})}),c.jsx(sd.Panel,{className:K(MR,n),children:a})]})})}const Zi="gs-studio-panel",bx=(e,t={})=>({...t,...e===!0?{}:e||void 0}),ws=h.memo(function({children:t,header:n,resizable:s,className:r,classNameAccordion:o,classNameAccordionContent:i,...a}){const l=c.jsx(Cn,{className:M(Zi,r),...a,children:t}),u=s?s===!0?{top:!0,right:!0,bottom:!0,left:!0}:s:void 0,d=u?c.jsx(Lu,{className:M([`${Zi}__resizer`]),...u,children:l}):l,f=n===!0?{collapsible:!0}:n||void 0;return f?c.jsx(hr,{classNameWrap:M(`${Zi}__accordion`,o),className:M(`${Zi}__accordion-header`,Ee.xy,f.className),classNameContent:M(`${Zi}__accordion-content`,i),disabled:f.collapsible===!1,style:f.style,handler:c.jsxs(k,{space:"s",items:"center",children:[!!f.icon&&c.jsx(ne,{icon:f.icon,size:oe.s}),c.jsx(F,{grow:!0,children:f.label})]}),open:n?f.collapsed!==!0:!0,children:d}):d}),NR="gs-panel-assets",$R=h.memo(ce(function({className:t,onSelect:n,content:s,assets:r,types:o,providers:i,typeId:a,providerId:l,optionalType:u,optionalProvider:d,projectAssetsOption:f,layoutAfterHeader:p,...g}){var C;const m=xe(),v=il(),b=m.editor,x=(C=m.sdkOptions.assets)==null?void 0:C.layoutAfterHeader,y=p||x,[w]=h.useState(()=>g.id||h0());return h.useEffect(()=>(v.createAssetManager(w),()=>{v.removeAssetManager(w)}),[w]),N0(w)?c.jsx(ws,{className:M(NR,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...g,children:b&&c.jsx(wR,{panelId:w,assets:r,types:o,providers:i,onSelect:n,typeId:a,providerId:l,content:s,optionalType:u,optionalProvider:f??d,layoutAfterHeader:y})}):null}));var na=(e=>(e.REGULAR="regular",e.SYMBOLS="symbols",e))(na||{}),Ms=(e=>(e.before="before",e.beforeInside="beforeInside",e.afterInside="afterInside",e.after="after",e))(Ms||{});const S1="gs-block-item",kR=e=>{const{block:t,className:n,itemLayout:s,onClick:r,variant:o}=e,{editor:i}=xe(),a=Ie(),[,l]=h.useState(0),u=a.tScoped("blockManager.labels"),d=t.getId(),f=!!t.get("full"),p=r||t.get("onClick"),g=t.get("disable"),m=t.get("mediaReact"),v=t.getMedia(),b=t.get("attributes")||{},x=u(d)||t.getLabel(),y=o==="compact",w=M(S1,`${S1}--${d}`,n,"gs-utl-px-2 gs-utl-transition-colors",te.b,te.rnd,B.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?Oe.disabledM:M("gs-utl-cursor-pointer",B.hTAo,B.hBgH)),S=Dt(b.class)&&!y?b.class:M("gs-utl-block-media gs-utl-w-full",y?"gs-utl-max-h-7 gs-utl-max-w-7 gs-utl-overflow-hidden":"gs-utl-max-h-10 gs-utl-max-w-10"),C=M("gs-utl-text-center",Oe.txtEllips,!y&&"gs-utl-w-full");if(h.useEffect(()=>{if(!i)return;const{Blocks:_}=i,L=_.events.update,N=V=>V===t&&l(A=>++A);return i.on(L,N),()=>{i.off(L,N)}},[t,i]),!i)return null;const{Blocks:j}=i,P={className:w,...!g&&{onDragStart:()=>j.startDrag(t),onDragEnd:()=>j.endDrag(!1),draggable:!r},...!!p&&{onClick:()=>p(t,i)}},T=s==null?void 0:s({editor:i,block:t,attributes:P});return T&&$t(T)||c.jsxs(k,{items:"center",...P,children:[m||c.jsx("div",{className:S,dangerouslySetInnerHTML:{__html:v}}),c.jsx("div",{className:C,title:x,children:x})]})},C1=ce(kR);function Nh({className:e,value:t,onChange:n}){const[s,r]=h.useState(t),o=h.useRef(null),i=u=>{const{value:d}=u.target;r(d)},a=()=>{n(s||t)},l=u=>{switch(u.key){case"Escape":n(t);break;case"Enter":n(s||t);break}};return h.useEffect(()=>{o.current&&o.current.select()},[]),c.jsx("input",{autoFocus:!0,className:K([e,"w-full",B.bgTr]),value:s,onChange:i,onBlur:a,onKeyDown:l,onPointerDown:Po,ref:o})}function yx({className:e,value:t,active:n,unstyled:s,activable:r,onChange:o,onActive:i,...a}){const[l,u]=h.useState(n);h.useEffect(()=>{u(n)},[n]);const d=p=>{i==null||i(p),u(p)},f=p=>{o(p),d(!1)};return c.jsx("div",{className:K("truncate",e),...a,onDoubleClick:()=>r&&d(!0),children:l?c.jsx(Nh,{className:K(s&&Oe.noFocusOut),value:t,onChange:f}):c.jsx(c.Fragment,{children:t})})}const j1=ie("text-sm w-full",Oe.txtEllips),RR=({symbol:e,className:t})=>{const n=ul(),{Components:s}=n,r=Ie(),o=Li(),i=r.tScoped("blockManager.symbols"),a=()=>{const{draggable:x,droppable:y,attributes:w,type:S,tagName:C}=e.attributes;n.Canvas.startDrag({content:()=>s.addSymbol(e),model:e,dragDef:{type:S,tagName:C,draggable:x,droppable:y,attributes:w}})},l=()=>{n.Canvas.endDrag()},u=e.getIcon(),d=e.getName(),f=s.getSymbolInfo(e).instances.length,p=ie("h-10 w-10 block-media",B.grouphTAo),g=ie("gjs-pt-1 gjs-mt-2",te.bt,B.br),m=ie("cursor-pointer gjs-p-2 transition-colors group",te.b,te.rnd,B.br,B.hBgH,t),v=()=>{o.confirm({title:i("delete"),content:i("deleteConfirm"),onConfirm:()=>e.remove()})},b=x=>{e.set("custom-name",x)};return c.jsxs(k,{className:m,onDragStart:a,onDragEnd:l,items:"center",draggable:!0,col:!0,children:[c.jsx("div",{className:p,dangerouslySetInnerHTML:{__html:u}}),c.jsxs(k,{items:"center",justify:"between",className:g,space:"m",full:!0,children:[c.jsx(F,{children:c.jsx(k,{className:ie(j1,"gjs-mr-auto"),children:c.jsx(zt,{title:`${f} ${i("instancesProject")}`,children:c.jsx(Dr,{label:`${f}`,className:ie(B.bgH75)})})})}),c.jsx(F,{className:ie("truncate"),grow:!0,title:d,children:c.jsx(yx,{activable:!0,value:d,className:j1,onChange:b})}),c.jsx(F,{className:ie(Oe.hoverGroup),children:c.jsx(k,{justify:"end",full:!0,children:c.jsx(St,{onClick:v,title:i("delete"),border:!1,size:"",block:!0,children:c.jsx(ne,{icon:G.delete,size:oe.s})})})})]})]})},IR=ce(RR),Er="gs-block-manager",E1={id:Ms.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>'},VR={id:Ms.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>'},HR={id:Ms.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>'},T1={id:Ms.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>'},P1=(e,t)=>{const n=t==null?void 0:t.getId();return n&&e.I18n.t(`blockManager.categories.${n}`)||(t==null?void 0:t.getLabel())||""},xx=e=>{const t=e.getContent();return tt(t)?e.getDragDef():t},DR=e=>{const t=xx(e);return Array.isArray(t)?t[0]:t},FR=ce(function({isOpen:t,className:n,hideCategories:s,target:r,variant:o,itemLayout:i,...a}){var Fe,Zt;const{editor:l}=xe(),u=Ie(),[d,f]=h.useState(0),[p,g]=h.useState(na.REGULAR),[m,v]=h.useState(""),[b,x]=h.useState(""),y=h.useRef(new Set),[w,S]=h.useState((r==null?void 0:r.position)||Ms.after),[C,j]=h.useState(()=>(l==null?void 0:l.Components.getSymbols())||[]),E=p===na.SYMBOLS,O=h.useRef(null),P=u.tScoped("blockManager"),T=r==null?void 0:r.component;if(h.useEffect(()=>{if(!l)return;const{Blocks:he,Components:Ve}=l,De=he.events.custom,$e=Ve.events.symbol,Ot=()=>{j(Ve.getSymbols()),f(Ft=>++Ft)};return l.on($e,Ot),l.on(De,Ot),()=>{l.off($e,Ot),l.off(De,Ot)}},[l]),h.useEffect(()=>{if(O.current&&t){const he=O.current.querySelector("input");setTimeout(()=>he==null?void 0:he.focus(),vp)}},[O.current,t]),!l)return null;const{Blocks:_,Components:L}=l,N=he=>P(`labels.${he.getId()}`)||he.getLabel(),V=C.filter(he=>di(he.getName(),m)),A=_.getAll().map(he=>he),H=((Fe=a.blocks)==null?void 0:Fe.call(a,{blocks:A}))||A,U=w===Ms.before,D=w===Ms.beforeInside,$=w===Ms.afterInside,I=w===Ms.after,R=!!(T!=null&&T.attributes.droppable),z=H.filter(he=>{const Ve=P1(l,he.category);if(m&&!di(Ve,m)&&!di(N(he),m))return!1;if(T){const De=DR(he);if(R&&(D||$)){const $e=D?0:void 0;return L.canMove(T,De,$e).result}else if(U||I){const $e=T.index(),Ot=T.parent(),Ft=U?$e:$e+1;return Ot&&L.canMove(Ot,De,Ft).result}}return!0}),X=_.getBlocksByCategory(z),Z=s?z:(Zt=X.find(he=>!he.category))==null?void 0:Zt.items,Y=s?[]:X.filter(he=>he.category),J=a.symbols!==!1,ee=a.search!==!1,W=!J&&!ee,Q=o==="compact",ae=P("search")||u.t("search"),ge=M(Er,n,"gap-2"),Ce=M(`${Er}__header`,"gs-utl-pt-2",Ee.xS,W&&"gs-utl-hidden"),Se=M(`${Er}__content`,Oe.scrollY,B.br,te.bt),et=M(`${Er}__symbols`,"gs-utl-grid gs-utl-grid-cols-1 gs-utl-gap-2 gs-utl-p-2"),Ye=M(`${Er}__not-found`,"gs-utl-text-center gs-utl-p-4"),Ct=M(`${Er}__blocks`,"gs-utl-grid gs-utl-gap-2 gs-utl-p-2 gs-utl-text-sm",Q?"gs-utl-grid-cols-1":"gs-utl-grid-cols-2"),ct=M(`${Er}__no-category`,Ct,B.br,Y.length&&te.bb),we=M(B.tAo,B.bgH75,te.bA),nt=`${Er}__category`,st=[{id:na.REGULAR,label:P("types.regular")},{id:na.SYMBOLS,label:P("types.symbols")}],vt=R?[E1,VR,HR,T1]:[E1,T1],Me=T?he=>{const Ve=xx(he);if(!Ve)return;let De;if(D||$){const $e=D?0:void 0;De=T.append(Ve,{at:$e})[0]}else if(U||I){const $e=T.index(),Ot=T.parent(),Ft=U?$e:$e+1;De=Ot==null?void 0:Ot.append(Ve,{at:Ft})[0]}if(De){const{activate:$e,select:Ot}=he.attributes;Ot||$e&&Ot!==!1?l.em.setSelected(De,{activate:$e}):$e&&De.trigger("active")}}:void 0,ft=he=>{if(!T)return;const Ve=Array.from(y.current);if(he.key==="ArrowDown")he.preventDefault(),x(De=>{const $e=Ve.indexOf(De);return Ve.at(Math.min($e+1,Ve.length-1))||""});else if(he.key==="ArrowUp")he.preventDefault(),x(De=>{const $e=Ve.indexOf(De);return Ve.at(Math.max($e-1,0))||""});else if(he.key==="Enter"&&b){const De=_.get(b);De&&(Me==null||Me(De))}},ut=he=>{y.current.clear(),v(he)};return c.jsxs(k,{className:ge,col:!0,full:!0,children:[c.jsxs(k,{className:Ce,gap:"s",col:!0,children:[J&&c.jsx(ro,{tabs:st,onChange:g,value:p,variant:"pills"}),T&&c.jsx(en,{size:"s",options:vt,value:w,onChange:he=>S(he)}),ee&&c.jsx(ot,{ref:O,size:"s",value:m,onInput:ut,onKeyDown:ft,placeholder:ae,type:"search"})]}),c.jsxs(F,{className:Se,grow:!0,children:[E&&(V.length?c.jsx(k,{className:et,children:V.map(he=>c.jsx(IR,{symbol:he},`${d}_${he.getId()}`))}):c.jsx(k,{className:Ye,justify:"center",children:P("symbols.notFound")})),!E&&(z.length?c.jsxs(c.Fragment,{children:[!!(Z!=null&&Z.length)&&c.jsx(k,{className:ct,children:Z==null?void 0:Z.map(he=>(y.current.add(`${he.id}`),c.jsx(C1,{block:he,itemLayout:i,onClick:Me,variant:o,className:M(b===he.id&&we)},he.id)))}),Y.map(({category:he,items:Ve},De)=>c.jsx(hr,{sticky:!0,className:$e=>yp.itemList({index:De,open:$e,length:Y.length}),open:!!(he!=null&&he.get("open")),onChange:({open:$e})=>he==null?void 0:he.set({open:$e}),handler:P1(l,he),handlerIcon:he==null?void 0:he.get("icon"),classNameWrap:M(nt,`${nt}--${he==null?void 0:he.id}`),children:c.jsx(k,{className:Ct,children:Ve.map($e=>(y.current.add(`${$e.id}`),c.jsx(C1,{block:$e,itemLayout:i,onClick:Me,variant:o,className:M(b===$e.id&&we)},$e.id)))})},he==null?void 0:he.id))]}):c.jsx(k,{className:Ye,justify:"center",children:P("notFound")}))]})]})}),BR=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-block-manager-after"),n),ref:r,...s,children:t})}),zR=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-block-manager-before"),n),ref:r,...s,children:t})}),UR="gs-panel-blocks",WR=h.memo(ce(function({className:t,symbols:n,search:s,hideCategories:r,target:o,variant:i,blocks:a,itemLayout:l,...u}){const d=xe().sdkProps.children,f={search:s,symbols:n,hideCategories:r,isOpen:!0,target:o,variant:i,blocks:a,itemLayout:l};return c.jsx(ws,{className:M(UR,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...u,children:c.jsxs(dl,{children:[Zn(d,zR),c.jsx(FR,{className:M("gs-utl-overflow-hidden gs-utl-flex-nowrap"),...f}),Zn(d,BR)]})})})),GR="gs-cmp-color-picker",qR={backgroundSize:"10px"},KR=[0,15];function wx({className:e,value:t,onChange:n,disabled:s}){const[r,o]=h.useState(!1),i=M(`${GR}-handler gs-utl-bg-checker gs-utl-overflow-hidden gs-utl-cursor-pointer`,e,te.b,te.rnd,B.br),a=()=>{o(!1)},l=c.jsxs("div",{style:qR,className:i,children:[r&&c.jsx("div",{onPointerUp:a,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(xs,{handler:l,title:"Color",size:"s",placement:"left-end",offset:KR,clickAway:!0,disabled:s,children:c.jsx(dx,{value:t,onChange:n,disabled:s})})}const ZR="gs-cmp-color-field";function gr(e){const{className:t,value:n,placeholder:s,preventSubmitOnEnter:r=!1,onChange:o,labelAs:i,disabled:a}=e,[l,u]=h.useState(Lc(n)),d=cl(e);h.useEffect(()=>{u(Lc(n))},[n]);const f=(v,b)=>{o==null||o(v,b)},p=v=>{switch(v.key){case"Escape":return u(n);case"Enter":f(l),r&&(v.preventDefault(),v.stopPropagation())}},g=()=>{f(l)},m=no({...e,className:M(ZR,t)});return c.jsxs("div",{...m,children:[c.jsx(ys,{...e,as:i}),c.jsxs(k,{className:lh(e),items:"center",space:"s",children:[c.jsx(F,{children:c.jsx(wx,{value:n,onChange:o,disabled:a})}),c.jsx(F,{grow:!0,children:c.jsx("input",{className:M(d,a&&"gs-utl-pointer-events-none"),value:l,onChange:v=>u(v.target.value),placeholder:s,onBlur:g,onKeyDown:p,disabled:a})})]})]})}const YR=(e,t)=>{t.runCommand(se.fontAdd,{font:e})},$h=(e,{onSelect:t,...n}={})=>{const s="font",i=e.runCommand(se.assetProviderGet).filter(a=>dt(a.types)?a.types===s:a.types.includes(s))[0];if(!i){e.em.logWarning("No font provider found");return}e.Assets.open({types:[],modalTitle:e.I18n.t("fontManager.selectFont"),projectAssetsOption:!1,typeId:s,providerId:i.id,onSelect:a=>{const l=a.assetProps;YR(l.customData.font,e),t==null||t(a)},content:{header:{addUrl:!1,upload:!1},itemsPerRow:1},...n})},Mu=ce(e=>{const{buttonClassName:t,value:n,...s}=e,{editor:r}=xe(),o=Ie(),i=il(),a=al(),l=[...s.options||[],...a.fontFamilyOptions].map(u=>{const d=a.getFont(u.id),f=d?nh(d):u.id;return{...u,content:c.jsx(k,{col:!0,children:c.jsx(F,{style:{fontFamily:f},children:u.label})})}});return c.jsx(Le,{...s,value:ko(n),options:l,afterLabel:a.sdkAddFonts&&i.hasType("font")&&c.jsx(St,{className:t,title:o.t("fontManager.addFontToProject"),icon:G.plus,size:"xs",border:!1,block:!0,onClick:()=>r&&$h(r,{onSelect:({assetProps:u})=>{const{customData:{font:d}}=u;s.onChange(ko(d.family))}})})})}),XR=(e,{t,id:n})=>t(`fields.${n}.label`)||$s(`${e}`.replace(/-/g," ")),Sx=(e,{t,id:n})=>{const s=dt(e)?{id:e,label:e}:e;return{...s,label:t(`fields.${n}.options.${s.id}`)||s.label}},Cx=e=>e.get("defaultValue")||"",ml=e=>e.get("field"),jx=e=>{const t=ml(e);return dt(t)?{type:t}:t},Ex=e=>`${e.get("value")||Cx(e)||jx(e).defaultValue||""}`,JR=(e,t)=>e||Cx(t)||"",$a=({record:e,value:t,partial:n})=>{e.set({value:JR(t,e)},{partial:n}),e.em.refreshCanvas({tools:!0})},ka=(e,t)=>{const{className:n,defaultValue:s,size:r,...o}=jx(e),i=s??e.get("defaultValue");return{...o,hasClear:()=>{const a=e.get("value");return!!a&&Dt(i)&&a!==i},className:M(n,"gs-utl-w-full"),size:r||"s",value:Ex(e),label:XR(e.get("label")||e.id||"",t),onChange:(a,l)=>$a({record:e,value:a,partial:l})}},QR=(e,t)=>{const n=ml(e),s=vr(n)?n:void 0,r=(s==null?void 0:s.units)||[],o=Lk(Ex(e)),i=o.number,a=o.unit||r[0]||"";return{...ka(e,t),value:i,valueUnit:a,min:s==null?void 0:s.min,max:s==null?void 0:s.max,step:s==null?void 0:s.step,units:s==null?void 0:s.units,onChange:(l,u)=>{$a({value:l?`${l}${a}`:"",record:e,partial:u})},onChangeUnit:l=>{$a({value:i?`${i}${l}`:"",record:e})}}},Tx=(e,t)=>{var o;const n=ml(e),s=vr(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>Sx(i,t)))||[];return{...ka(e,t),options:r,onChange:i=>$a({value:i,record:e})}},e6=(e,t)=>({...ka(e,t),onChange:n=>$a({value:n,record:e})}),t6=(e,t)=>{var o;const n=ml(e),s=vr(n)?n:void 0,r=((o=s==null?void 0:s.options)==null?void 0:o.map(i=>Sx(i,t)))||[];return{...Tx(e,t),size:"s",options:r}};function n6(e,t){const n=ml(e);switch(dt(n)?n:n==null?void 0:n.type){case"radio":return c.jsx(en,{...t6(e,t)});case"select":return c.jsx(Le,{...Tx(e,t)});case"selectFont":{const r=e6(e,t);return c.jsx(Mu,{...r,labelAs:"div"})}case"number":return c.jsx(Ne,{...QR(e,t)});case"color":return c.jsx(gr,{...ka(e,t)});default:return c.jsx(ot,{...ka(e,t)})}}const O1="gs-cmp-global-style-field",s6=ce(function({record:t}){const n=xe(),r=Ie().tScoped("globalStyleManager"),[,o]=h.useState(0),i=n.editor,a=t.id,l={t:r,id:a};return h.useEffect(()=>{if(!i)return;const u=`data:path:${t.getPath("value")}`,d=()=>o(f=>++f);return i.on(u,d),()=>{i.off(u,d)}},[i]),c.jsx(k,{className:M(O1,`${O1}__${a}`),children:n6(t,l)})}),fa="gs-cmp-global-style-manager",_1=({items:e,category:t,className:n})=>{const s=M(t?`${fa}__cat-fields--${t.id}`:`${fa}__uncat-fields`,"gs-utl-gap-2",Ee.xy,n);return c.jsx(k,{className:s,nowrap:!0,col:!0,children:e.map(r=>c.jsx(s6,{record:r},r.id))})},r6=ce(function(){const t=y4(),{recordsByCategory:n,openCategories:s}=t,o=Ie().tScoped("globalStyleManager");return c.jsx(k,{col:!0,full:!0,nowrap:!0,className:M(fa,"gs-utl-flex-grow gs-utl-overflow-hidden"),children:c.jsx(k,{col:!0,nowrap:!0,className:M(`${fa}__fields`,Oe.scrollY,"gs-utl-select-none"),children:n.length?n.map(({category:i,items:a},l)=>i?c.jsx(hr,{sticky:!0,open:s.get(i.id)??i.open,handler:o(`categories.${i.id}.label`)||i.label||i.id,onChange:({open:u})=>t.setCategoryOpen(i.id,u),className:u=>M(`${fa}__cat-fields`,yp.itemList({index:l,open:u,length:n.length}),l===0&&te.bt),children:c.jsx(_1,{category:i,items:a})},i.id):c.jsx(_1,{items:a,className:M(n.length!==1&&[te.bt,B.br])},l)):c.jsx(k,{className:M("gs-utl-text-center"),justify:"center",children:o("notFound")})})})}),o6="gs-panel-global-styles",i6=h.memo(ce(function({className:t,...n}){return c.jsx(ws,{className:M(o6,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(dl,{children:c.jsx(r6,{})})})})),a6={maxWidth:`${Qw}px`},l6="gs-cmp-layer-item";function Px({component:e,draggingCmp:t,dragParent:n,...s}){const r=ul(),{Layers:o}=r,i=h.useRef(null),[a,l]=h.useState(!1),[u,d]=h.useState(o.getLayerData(e)),{open:f,selected:p,hovered:g,components:m,visible:v,locked:b,name:x}=u,y=m.map(D=>D.cid),w=t===e,S=y.join("-"),C=s.level+1,j=g||n===e;h.useEffect(()=>{C===0&&d(o.getLayerData(e)),i.current&&(i.current.__cmp=e)},[e]),h.useEffect(()=>{const D=i.current;if(!D)return;const{select:$}=r.Components.events,I=R=>R===e&&D.scrollIntoView({block:"nearest"});return r.on($,I),()=>{r.off($,I)}},[e,i.current]),h.useEffect(()=>{const D=I=>{I===e&&d(o.getLayerData(I))},$=o.events.component;return r.on($,D),()=>{r.off($,D)}},[r,o,e]);const E=h.useMemo(()=>m.map(D=>c.jsx(Px,{component:D,level:C,draggingCmp:t,dragParent:n},D.cid)),[S,t,n]),O=D=>{o.setLayerData(e,{name:D}),l(!1)},P=D=>{D.stopPropagation(),o.setLayerData(e,{open:!f})},T=D=>{D.stopPropagation(),o.setLayerData(e,{visible:!v})},_=D=>{D.stopPropagation(),o.setLayerData(e,{locked:!b})},L=D=>{D.stopPropagation(),o.setLayerData(e,{selected:!0},{event:D})},N=D=>{D.preventDefault(),r.runCommand(se.contextMenuComponent,{source:th.layers,component:e,event:D.nativeEvent,x:D.clientX,y:D.clientY})},V=D=>{(!D||!t)&&o.setLayerData(e,{hovered:D})},A=xb(e),H=K("layer-item",(p||A.isSymbol)&&A.bgSoftX,(!v||w)&&"opacity-50"),U=K(Ee.xyS,te.b,j?A.border:te.bT,p&&A.bgSoft);return c.jsx("div",{className:l6,children:c.jsxs(k,{col:!0,className:H,children:[c.jsx(F,{onClick:L,onContextMenu:N,onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1),className:K("group max-w-full"),"data-layer-item":!0,ref:i,children:c.jsxs(k,{items:"center",space:"xs",className:U,children:[c.jsx(F,{style:{marginLeft:`${C*10}px`},className:K("cursor-pointer",!m.length&&"pointer-events-none opacity-0"),onClick:P,children:c.jsx(ne,{icon:G.menuDown,size:oe.sx,rotate:f?0:-90})}),c.jsx(F,{children:T0(e)}),c.jsx(F,{className:K("truncate"),onDoubleClick:()=>l(!0),style:a6,grow:!0,children:a?c.jsx(Nh,{value:x,onChange:O}):c.jsx(c.Fragment,{children:x})}),!a&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:K("group-hover:gs-utl-opacity-100 cursor-pointer",b?"opacity-100":"opacity-0"),onClick:_,children:c.jsx(ne,{icon:b?G.lock:G.lockOpenVariant,size:oe.s3x})}),c.jsx(F,{className:K("group-hover:gs-utl-opacity-100 cursor-pointer",v?"opacity-0":"opacity-100"),onClick:T,children:c.jsx(ne,{icon:v?G.eyeOutline:G.eyeOffOutline,size:oe.sx})})]})]})}),!!(f&&m.length)&&c.jsx(F,{className:K("max-w-full",!f&&"hidden"),children:E})]})})}const c6={touchAction:"none"},A1=5,u6=e=>{var o,i;const t=document.elementFromPoint(e.clientX,e.clientY),n=t==null?void 0:t.closest("[data-layer-item]"),s=n==null?void 0:n.__cmp,r=((i=(o=s==null?void 0:s.delegate)==null?void 0:o.move)==null?void 0:i.call(o,s))||s;return{el:n,cmp:r}},Ox=ce(function({root:t,header:n}){const{editor:s}=xe(),[r,o]=h.useState(!1),[i,a]=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 P=window.document,T=_=>{_.key==="Escape"&&(a({...i,result:!1}),S())};return P.addEventListener("keydown",T),()=>{P.removeEventListener("keydown",T)}},[]),!s)return null;const{Components:x}=s,y=P=>{P.button===0&&o(!0)},w=P=>{if(!r)return;const{cmp:T,el:_}=u6(P);if(!_||!T)return;const L=_.getBoundingClientRect(),N=_.offsetHeight,V=_.offsetTop,A=P.clientY,H=A<L.y+N/2,U=d||T,D=T.parent(),$=T.index()+(H?0:1);!d&&f(T),u(T);const I=x.canMove(D,U,$),R=x.canMove(T,U),z={...I,canMoveInside:R,index:$};let X=!1;R.result&&A>L.y+A1&&A<L.y+N-A1&&(X=!0,z.target=T,delete z.index),g(X?T:void 0),a(z),v({pointerInside:X,y:V+(H?0:N),h:N})},S=()=>{var P;i!=null&&i.result&&((P=i.source)==null||P.move(i.target,{at:i.index})),a({}),o(!1),f(void 0),u(void 0),g(void 0),v(void 0)},C=(l?l.parents():[]).length,j=!!(d&&m&&(i!=null&&i.result)&&!m.pointerInside),E=j?{top:m.y,left:0,marginLeft:C*10+20}:{},O=n&&(n==null?void 0:n.label)||"Layers";return c.jsxs(k,{col:!0,full:!0,nowrap:!0,className:K("gs-layer-manager flex-grow overflow-hidden"),children:[n!==!1&&c.jsx(F,{children:c.jsxs(k,{space:"s",items:"center",className:K([Ee.xy,te.bb,B.br]),children:[c.jsx(F,{children:c.jsx(ne,{icon:G.layers,size:oe.s})}),c.jsx(F,{grow:!0,children:O})]})}),c.jsxs(F,{className:K("overflow-y-auto overflow-x-hidden text-sm select-none relative"),style:c6,onPointerDown:y,onPointerMove:w,onPointerUp:S,grow:!0,children:[!!t&&c.jsx(Px,{component:t,level:-1,draggingCmp:d,dragParent:p}),j&&c.jsx("div",{ref:b,className:K("absolute w-full gs-utl-h-0.5",B.cmp),style:E})]})]})}),_x=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-layer-manager-after"),n),ref:r,...s,children:t})}),Ax=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-layer-manager-before"),n),ref:r,...s,children:t})}),d6="gs-panel-layers",Lx=h.memo(ce(function({className:t,...n}){const s=xe().sdkProps.children;return c.jsx(ws,{className:M(d6,"gs-utl-overflow-auto",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(gy,{children:r=>c.jsxs(c.Fragment,{children:[Zn(s,Ax),c.jsx(Ox,{...r,header:!1}),Zn(s,_x)]})})})})),ho="gs-cmp-file-field";function Ra(e){var C;const{className:t,value:n,btnLabel:s,nameLabel:r,size:o,isContain:i,clear:a,inputField:l,placeholder:u,preview:d=50,disabled:f,hideButton:p,labelAs:g,onChange:m,onOpen:v}=e,b=(n||"").replace(/^"|"$/gi,""),x=((C=b.split("/").pop())==null?void 0:C.split("?")[0])||"",y={minWidth:d,minHeight:d},w=b?{...y,backgroundImage:`url("${b}")`}:y,S=M(" gs-utl-w-full gs-utl-bg-checker gs-utl-bg-no-repeat gs-utl-bg-center",i?"gs-utl-bg-contain":"gs-utl-bg-cover",te.b,te.rnd,B.br);return c.jsxs(k,{className:M(ho,t,"gs-utl-gap-1"),col:!0,nowrap:!0,children:[c.jsx(ys,{...e,as:g}),c.jsxs(k,{className:M(`${ho}-content gs-utl-gap-1`,B.bg),items:"center",nowrap:!0,children:[c.jsx(F,{className:M(`${ho}-preview`),children:c.jsx("div",{className:S,style:w})}),c.jsxs(F,{className:M(`${ho}-fields gs-utl-overflow-hidden`),grow:!0,children:[x&&r!==!1&&c.jsx(Gr,{className:M(`${ho}-name`,"gs-utl-mb-2",Oe.txtEllips),as:"div",size:o,capitalize:!1,children:x}),c.jsxs(k,{className:M(`${ho}-buttons`),space:"s",nowrap:!0,children:[!p&&c.jsx(Ke,{onClick:()=>v==null?void 0:v(n),size:o,type:"button",block:!0,full:!0,disabled:f,children:s||"Select image"}),!!n&&a&&c.jsx(St,{onClick:()=>m==null?void 0:m(""),title:a.tooltip,size:o,icon:{icon:G.close,size:oe.s},type:"button",block:!0})]})]})]}),l&&c.jsx(ot,{className:M(`${ho}-input`),value:b,onChange:m,size:o,placeholder:u})]})}function f6(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return h.useMemo(()=>s=>{t.forEach(r=>r(s))},t)}const Nu=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function Ii(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function kh(e){return"nodeType"in e}function lo(e){var t,n;return e?Ii(e)?e:kh(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function Rh(e){const{Document:t}=lo(e);return e instanceof t}function Vi(e){return Ii(e)?!1:e instanceof lo(e).HTMLElement}function Mx(e){return e instanceof lo(e).SVGElement}function Hi(e){return e?Ii(e)?e.document:kh(e)?Rh(e)?e:Vi(e)||Mx(e)?e.ownerDocument:document:document:document}const Ro=Nu?h.useLayoutEffect:h.useEffect;function p6(e){const t=h.useRef(e);return Ro(()=>{t.current=e}),h.useCallback(function(){for(var n=arguments.length,s=new Array(n),r=0;r<n;r++)s[r]=arguments[r];return t.current==null?void 0:t.current(...s)},[])}function h6(){const e=h.useRef(null),t=h.useCallback((s,r)=>{e.current=setInterval(s,r)},[]),n=h.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function vl(e,t){const n=h.useRef();return h.useMemo(()=>{const s=e(n.current);return n.current=s,s},[...t])}function Ih(e){const t=p6(e),n=h.useRef(null),s=h.useCallback(r=>{r!==n.current&&(t==null||t(r,n.current)),n.current=r},[]);return[n,s]}let $d={};function bl(e,t){return h.useMemo(()=>{if(t)return t;const n=$d[e]==null?0:$d[e]+1;return $d[e]=n,e+"-"+n},[e,t])}function Nx(e){return function(t){for(var n=arguments.length,s=new Array(n>1?n-1:0),r=1;r<n;r++)s[r-1]=arguments[r];return s.reduce((o,i)=>{const a=Object.entries(i);for(const[l,u]of a){const d=o[l];d!=null&&(o[l]=d+e*u)}return o},{...t})}}const Ia=Nx(1),$x=Nx(-1);function g6(e){return"clientX"in e&&"clientY"in e}function m6(e){if(!e)return!1;const{KeyboardEvent:t}=lo(e.target);return t&&e instanceof t}function v6(e){if(!e)return!1;const{TouchEvent:t}=lo(e.target);return t&&e instanceof t}function Gf(e){if(v6(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 g6(e)?{x:e.clientX,y:e.clientY}:null}const Va=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[Va.Translate.toString(e),Va.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:s}=e;return t+" "+n+"ms "+s}}}),b6={display:"none"};function y6(e){let{id:t,value:n}=e;return h.createElement("div",{id:t,style:b6},n)}function x6(e){let{id:t,announcement:n,ariaLiveType:s="assertive"}=e;const r={position:"fixed",width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return h.createElement("div",{id:t,style:r,role:"status","aria-live":s,"aria-atomic":!0},n)}function w6(){const[e,t]=h.useState("");return{announce:h.useCallback(s=>{s!=null&&t(s)},[]),announcement:e}}const S6={draggable:`
|
|
388
323
|
To pick up a draggable item, press the space bar.
|
|
389
324
|
While dragging, use the arrow keys to move the item.
|
|
390
325
|
Press space again to drop the item in its new position, or press escape to cancel.
|
|
391
|
-
`},h6={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 ut;(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"})(ut||(ut={}));function wd(...e){}class aa extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:t})=>!t)}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const yu=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:wd,draggableNodes:{},droppableRects:new Map,droppableContainers:new aa,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:wd},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:wd,windowRect:null,willRecomputeLayouts:!1});function g6(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new aa}}}function m6(e,t){switch(t.type){case ut.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ut.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 ut.DragEnd:case ut.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ut.RegisterDroppable:{const{element:n}=t,{id:s}=n,r=new aa(e.droppable.containers);return r.set(s,n),{...e,droppable:{...e.droppable,containers:r}}}case ut.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new aa(e.droppable.containers);return i.set(n,{...o,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case ut.UnregisterDroppable:{const{id:n,key:s}=t,r=e.droppable.containers.get(n);if(!r||s!==r.key)return e;const o=new aa(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}const ox=h.createContext({type:null,event:null});function b6({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:s,onDragCancel:r}){const o=h.useContext(ox),i=h.useRef(o);h.useEffect(()=>{if(o!==i.current){const{type:a,event:l}=o;switch(a){case ut.DragStart:e==null||e(l);break;case ut.DragMove:t==null||t(l);break;case ut.DragOver:n==null||n(l);break;case ut.DragCancel:r==null||r(l);break;case ut.DragEnd:s==null||s(l);break}i.current=o}},[o,e,t,n,s,r])}function v6({announcements:e=h6,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:s,announcement:r}=f6(),o=sl("DndLiveRegion"),[i,a]=h.useState(!1);return h.useEffect(()=>{a(!0)},[]),b6(h.useMemo(()=>({onDragStart({active:l}){s(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&s(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){s(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){s(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){s(e.onDragCancel(l.id))}}),[s,e])),i?Dn.createPortal(h.createElement(h.Fragment,null,h.createElement(u6,{id:t,value:n.draggable}),h.createElement(d6,{id:o,announcement:r})),document.body):null}const cr=Object.freeze({x:0,y:0});function ix(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function h1(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const y6=({collisionRect:e,droppableContainers:t})=>{const n=h1(e,e.left,e.top);let s=1/0,r=null;for(const o of t){const{rect:{current:i}}=o;if(i){const a=ix(h1(i),n);a<s&&(s=a,r=o.id)}}return r};function x6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function w6(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:cr}function S6(e){return function(n,...s){return s.reduce((r,o)=>({...r,top:r.top+e*o.y,bottom:r.bottom+e*o.y,left:r.left+e*o.x,right:r.right+e*o.x,offsetLeft:r.offsetLeft+e*o.x,offsetTop:r.offsetTop+e*o.y}),{...n})}}const g1=S6(1);function C6(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function j6(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(r=>{const o=t[r];return typeof o=="string"?n.test(o):!1})!=null}function gh(e){const t=[];function n(s){if(!s)return t;if(ph(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!Ai(s)||nx(s)||t.includes(s))return t;const r=window.getComputedStyle(s);return j6(s,r)&&t.push(s),C6(s,r)?t:n(s.parentNode)}return e?n(e.parentNode):t}function Sd(e){return!vu||!e?null:Oi(e)?e:fh(e)?ph(e)||e===Ni(e).scrollingElement?window:Ai(e)?e:null:null}function Af(e){return Oi(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var ti;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ti||(ti={}));function ax(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},s=e.scrollTop<=t.y,r=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:r,isBottom:o,isRight:i,maxScroll:n,minScroll:t}}function E6(e){return!vu||!e?!1:e===document.scrollingElement}const P6={x:.2,y:.2};function _6(e,t,{top:n,left:s,right:r,bottom:o},i=10,a=P6){const{clientHeight:l,clientWidth:u}=e,d=E6(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:f,isBottom:p,isLeft:g,isRight:m}=ax(e),b={x:0,y:0},v={x:0,y:0},x={height:d.height*a.y,width:d.width*a.x};return!f&&n<=d.top+x.height?(b.y=ti.Backward,v.y=i*Math.abs((d.top+x.height-n)/x.height)):!p&&o>=d.bottom-x.height&&(b.y=ti.Forward,v.y=i*Math.abs((d.bottom-x.height-o)/x.height)),!m&&r>=d.right-x.width?(b.x=ti.Forward,v.x=i*Math.abs((d.right-x.width-r)/x.width)):!g&&s<=d.left+x.width&&(b.x=ti.Backward,v.x=i*Math.abs((d.left+x.width-s)/x.width)),{direction:b,speed:v}}function T6(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:s,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:r,width:e.clientWidth,height:e.clientHeight}}function lx(e){return e.reduce((t,n)=>Ea(t,Af(n)),cr)}function cx(e,t,n=cr){if(!e||!Ai(e))return n;const s={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?s:cx(e.offsetParent,t,s)}function xu(e){const{offsetWidth:t,offsetHeight:n}=e,{x:s,y:r}=cx(e,null);return{width:t,height:n,offsetTop:r,offsetLeft:s}}function wu(e){if(Oi(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}=xu(e),{width:s,height:r,top:o,bottom:i,left:a,right:l}=e.getBoundingClientRect();return{width:s,height:r,top:o,bottom:i,right:l,left:a,offsetTop:t,offsetLeft:n}}function Nf(e){const{width:t,height:n,offsetTop:s,offsetLeft:r}=xu(e),o=gh(e),i=lx(o),a=s-i.y,l=r-i.x;return{width:t,height:n,top:a,bottom:a+n,right:l+t,left:l,offsetTop:s,offsetLeft:r}}function m1(e){return"top"in e}function b1(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 O6=({collisionRect:e,droppableContainers:t})=>{let n=1/0,s=null;const r=b1(e,e.left,e.top);for(const o of t){const{rect:{current:i}}=o;if(i){const a=b1(i,m1(i)?i.left:void 0,m1(i)?i.top:void 0),l=r.reduce((d,f,p)=>d+ix(a[p],f),0),u=Number((l/4).toFixed(4));u<n&&(n=u,s=o.id)}}return s};function A6(e,t){const n=Math.max(t.top,e.offsetTop),s=Math.max(t.left,e.offsetLeft),r=Math.min(t.left+t.width,e.offsetLeft+e.width),o=Math.min(t.top+t.height,e.offsetTop+e.height),i=r-s,a=o-n;if(s<r&&n<o){const l=t.width*t.height,u=e.width*e.height,d=i*a,f=d/(l+u-d);return Number(f.toFixed(4))}return 0}const N6=({collisionRect:e,droppableContainers:t})=>{let n=0,s=null;for(const r of t){const{rect:{current:o}}=r;if(o){const i=A6(o,e);i>n&&(n=i,s=r.id)}}return s};var la;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(la||(la={}));var Pc;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Pc||(Pc={}));function M6({acceleration:e,activator:t=la.Pointer,canScroll:n,draggingRect:s,enabled:r,interval:o=5,order:i=Pc.TreeOrder,pointerCoordinates:a,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[f,p]=o6(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case la.Pointer:return a?{top:a.y,bottom:a.y,left:a.x,right:a.x}:null;case la.DraggableRect:return s}return null},[t,s,a]),b=h.useRef(cr),v=h.useRef(null),x=h.useCallback(()=>{const w=v.current;if(!w)return;const S=g.current.x*b.current.x,C=g.current.y*b.current.y;w.scrollBy(S,C)},[]),y=h.useMemo(()=>i===Pc.TreeOrder?[...l].reverse():l,[i,l]);h.useEffect(()=>{if(!r||!l.length||!m){p();return}for(const w of y){if((n==null?void 0:n(w))===!1)continue;const S=l.indexOf(w),C=u[S];if(!C)continue;const{direction:j,speed:E}=_6(w,C,m,e,d);if(E.x>0||E.y>0){p(),v.current=w,f(x,o),g.current=E,b.current=j;return}}g.current={x:0,y:0},b.current={x:0,y:0},p()},[e,x,n,p,r,o,JSON.stringify(m),f,l,y,u,JSON.stringify(d)])}function L6(e,t){const n=t!==null?e[t]:void 0,s=n?n.node.current:null;return nl(r=>{var o;return t===null?null:(o=s??r)!=null?o:null},[s,t])}function R6(e,t){return h.useMemo(()=>e.reduce((n,s)=>{const{sensor:r}=s,o=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...n,...o]},[]),[e,t])}function ux(e){const t=h.useRef(e);return _o(()=>{t.current!==e&&(t.current=e)},[e]),t}var _a;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(_a||(_a={}));var Mf;(function(e){e.Optimized="optimized"})(Mf||(Mf={}));const v1=new Map,$6={measure:xu,strategy:_a.WhileDragging,frequency:Mf.Optimized};function k6(e,{dragging:t,dependencies:n,config:s}){const[r,o]=h.useState(!1),{frequency:i,measure:a,strategy:l}={...$6,...s},u=h.useRef(e),d=h.useCallback(()=>o(!0),[]),f=h.useRef(null),p=m(),g=nl(b=>{if(p&&!t)return v1;if(!b||b===v1||u.current!==e||r){for(let v of e)v&&(v.rect.current=v.node.current?a(v.node.current):null);return V6(e)}return b},[e,t,p,a,r]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{r&&o(!1)},[r]),h.useEffect(function(){p||requestAnimationFrame(d)},[t,p]),h.useEffect(function(){p||typeof i!="number"||f.current!==null||(f.current=setTimeout(()=>{d(),f.current=null},i))},[i,p,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:r};function m(){switch(l){case _a.Always:return!1;case _a.BeforeDragging:return t;default:return!t}}}function V6(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:s,rect:r}=n;r.current!=null&&t.set(s,r.current)}return t}function I6(e){const[t,n]=h.useState(null),s=h.useRef(e),r=h.useCallback(o=>{const i=Sd(o.target);i&&n(a=>a?(a.set(i,Af(i)),new Map(a)):null)},[]);return h.useEffect(()=>{const o=s.current;if(e!==o){i(o);const a=e.map(l=>{const u=Sd(l);return u?(u.addEventListener("scroll",r,{passive:!0}),[u,Af(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),s.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const u=Sd(l);u==null||u.removeEventListener("scroll",r)})}},[r,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Ea(o,i),cr):lx(e):cr,[e,t])}const D6=[];function H6(e){const t=h.useRef(e),n=nl(s=>e?s&&e&&t.current&&e.parentNode===t.current.parentNode?s:gh(e):D6,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function F6(e){h.useEffect(()=>{if(!vu)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 B6(e,t){return h.useMemo(()=>e.reduce((n,{eventName:s,handler:r})=>(n[s]=o=>{r(o,t)},n),{}),[e,t])}const Cd=fx(wu),z6=U6(wu);function dx(e,t,n){const s=h.useRef(e);return nl(r=>e?n||!r&&e||e!==s.current?Ai(e)&&e.parentNode==null?null:t(e):r??null:null,[e,n,t])}function fx(e){return(t,n)=>dx(t,e,n)}function U6(e){const t=[];return function(s,r){const o=h.useRef(s);return nl(i=>s.length?r||!i&&s.length||s!==o.current?s.map(a=>e(a)):i??t:t,[s,r])}}function W6(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Ai(t)?t:e}function G6(e){const{width:t,height:n,offsetLeft:s,offsetTop:r}=xu(e);return{top:r,bottom:r+n,left:s,right:s+t,width:t,height:n,offsetTop:r,offsetLeft:s}}const q6=fx(G6);function K6({disabled:e,forceRecompute:t}){const[n,s]=hh(),r=q6(e?null:W6(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:r,setRef:s}),[r,n,s])}function y1(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function Y6(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class ca{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})}}add(t,n,s){var r;(r=this.target)==null||r.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function Z6(e){const{EventTarget:t}=Xr(e);return e instanceof t?e:Ni(e)}function jd(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var $n;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})($n||($n={}));function x1(e){e.preventDefault()}function X6(e){e.stopPropagation()}var Be;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(Be||(Be={}));const px={start:[Be.Space,Be.Enter],cancel:[Be.Esc],end:[Be.Space,Be.Enter]},J6=(e,{currentCoordinates:t})=>{switch(e.code){case Be.Right:return{...t,x:t.x+25};case Be.Left:return{...t,x:t.x-25};case Be.Down:return{...t,y:t.y+25};case Be.Up:return{...t,y:t.y-25}}};class mh{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=cr;const{event:{target:n}}=t;this.props=t,this.listeners=new ca(Ni(n)),this.windowListeners=new ca(Xr(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add($n.Resize,this.handleCancel),this.windowListeners.add($n.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add($n.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const s=wu(t.node.current),r={x:s.left,y:s.top};this.coordinates=r,n(r)}handleKeyDown(t){if(a6(t)){const{coordinates:n}=this,{active:s,context:r,options:o}=this.props,{keyboardCodes:i=px,coordinateGetter:a=J6,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const d=a(t,{active:s,context:r.current,currentCoordinates:n});if(d){const f={x:0,y:0},{scrollableAncestors:p}=r.current;for(const g of p){const m=t.code,b=rx(d,n),{isTop:v,isRight:x,isLeft:y,isBottom:w,maxScroll:S,minScroll:C}=ax(g),j=T6(g),E={x:Math.min(m===Be.Right?j.right-j.width/2:j.right,Math.max(m===Be.Right?j.left:j.left+j.width/2,d.x)),y:Math.min(m===Be.Down?j.bottom-j.height/2:j.bottom,Math.max(m===Be.Down?j.top:j.top+j.height/2,d.y))},_=m===Be.Right&&!x||m===Be.Left&&!y,T=m===Be.Down&&!w||m===Be.Up&&!v;if(_&&E.x!==d.x){if(m===Be.Right&&g.scrollLeft+b.x<=S.x||m===Be.Left&&g.scrollLeft+b.x>=C.x){g.scrollBy({left:b.x,behavior:l});return}f.x=m===Be.Right?g.scrollLeft-S.x:g.scrollLeft-C.x,g.scrollBy({left:-f.x,behavior:l});break}else if(T&&E.y!==d.y){if(m===Be.Down&&g.scrollTop+b.y<=S.y||m===Be.Up&&g.scrollTop+b.y>=C.y){g.scrollBy({top:b.y,behavior:l});return}f.y=m===Be.Down?g.scrollTop-S.y:g.scrollTop-C.y,g.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,Ea(d,f))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n),this.coordinates=n}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}mh.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=px,onActivation:n})=>{const{code:s}=e.nativeEvent;return t.start.includes(s)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function w1(e){return!!(e&&"distance"in e)}function S1(e){return!!(e&&"delay"in e)}class bh{constructor(t,n,s=Z6(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=t,{target:o}=r;this.props=t,this.events=n,this.document=Ni(o),this.documentListeners=new ca(this.document),this.listeners=new ca(s),this.windowListeners=new ca(Xr(o)),this.initialCoordinates=Of(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add($n.Resize,this.handleCancel),this.windowListeners.add($n.DragStart,x1),this.windowListeners.add($n.VisibilityChange,this.handleCancel),this.windowListeners.add($n.ContextMenu,x1),this.documentListeners.add($n.Keydown,this.handleKeydown),n){if(w1(n))return;if(S1(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($n.Click,X6,{capture:!0}),this.removeTextSelection(),this.documentListeners.add($n.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:s,props:r}=this,{onMove:o,options:{activationConstraint:i}}=r;if(!s)return;const a=Of(t),l=rx(s,a);if(!n&&i){if(S1(i))return jd(l,i.tolerance)?this.handleCancel():void 0;if(w1(i))return i.tolerance!=null&&jd(l,i.tolerance)?this.handleCancel():jd(l,i.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),o(a)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===Be.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const Q6={move:{name:"pointermove"},end:{name:"pointerup"}};class vh extends bh{constructor(t){const{event:n}=t,s=Ni(n.target);super(t,Q6,s)}}vh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const ek={move:{name:"mousemove"},end:{name:"mouseup"}};var Lf;(function(e){e[e.RightClick=2]="RightClick"})(Lf||(Lf={}));class tk extends bh{constructor(t){super(t,ek,Ni(t.event.target))}}tk.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===Lf.RightClick?!1:(t==null||t({event:e}),!0)}];const Ed={move:{name:"touchmove"},end:{name:"touchend"}};class nk extends bh{constructor(t){super(t,Ed)}static setup(){return window.addEventListener(Ed.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Ed.move.name,t)};function t(){}}}nk.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function sk(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((s,r)=>r({transform:s,...n}),t):t}const rk=[{sensor:vh,options:{}},{sensor:mh,options:{}}],ok={current:{}},hx=h.createContext({...cr,scaleX:1,scaleY:1}),ik=h.memo(function({id:t,autoScroll:n=!0,announcements:s,children:r,sensors:o=rk,collisionDetection:i=N6,measuring:a,modifiers:l,screenReaderInstructions:u=p6,...d}){var f,p,g,m,b;const v=h.useReducer(m6,void 0,g6),[x,y]=v,[w,S]=h.useState(()=>({type:null,event:null})),[C,j]=h.useState(!1),{draggable:{active:E,nodes:_,translate:T},droppable:{containers:P}}=x,A=E?_[E]:null,M=h.useRef({initial:null,translated:null}),R=h.useMemo(()=>{var We;return E!=null?{id:E,data:(We=A==null?void 0:A.data)!=null?We:ok,rect:M}:null},[E,A]),F=h.useRef(null),[L,B]=h.useState(null),[q,H]=h.useState(null),$=h.useRef(d),I=sl("DndDescribedBy",t),O=h.useMemo(()=>P.getEnabled(),[P]),{layoutRectMap:V,recomputeLayouts:G,willRecomputeLayouts:W}=k6(O,{dragging:C,dependencies:[T.x,T.y],config:a==null?void 0:a.droppable}),K=L6(_,E),J=q?Of(q):null,Y=dx(K,(f=a==null||(p=a.draggable)==null?void 0:p.measure)!=null?f:Nf),U=Cd(K),Q=h.useRef(null),se=Q.current,de=h.useRef({active:null,activeNode:K,collisionRect:null,droppableRects:V,draggableNodes:_,draggingNodeRect:null,droppableContainers:P,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Se=P.getNodeFor((g=de.current.over)==null?void 0:g.id),ne=Cd(K?K.ownerDocument.defaultView:null),Te=Cd(K?K.parentElement:null),ke=H6(E?Se??K:null),it=z6(ke),st=K6({disabled:E==null,forceRecompute:W}),xe=(m=st.rect)!=null?m:Y,Ze=xe===Y?w6(Y,se):cr,Xe=sk(l,{transform:{x:T.x-Ze.x,y:T.y-Ze.y,scaleX:1,scaleY:1},activatorEvent:q,active:R,activeNodeRect:U,containerNodeRect:Te,draggingNodeRect:xe,over:de.current.over,overlayNodeRect:st.rect,scrollableAncestors:ke,scrollableAncestorRects:it,windowRect:ne}),ft=J?Ea(J,T):null,Ae=I6(ke),at=Ea(Xe,Ae),rt=xe?g1(xe,Xe):null,Ie=rt?g1(rt,Ae):null,Wt=R&&Ie?i({active:R,collisionRect:Ie,droppableContainers:O}):null,[ge,$e]=h.useState(null),Ve=x6(Xe,(b=ge==null?void 0:ge.rect)!=null?b:null,Y),Me=h.useCallback((We,{sensor:pt,options:Gt})=>{if(!F.current)return;const Nn=_[F.current];if(!Nn)return;const Ht=new pt({active:F.current,activeNode:Nn,event:We.nativeEvent,options:Gt,context:de,onStart(an){const Us=F.current;if(!Us)return;const fr=_[Us];if(!fr)return;const{onDragStart:pr}=$.current,hr={active:{id:Us,data:fr.data,rect:M}};Dn.unstable_batchedUpdates(()=>{y({type:ut.DragStart,initialCoordinates:an,active:Us}),S({type:ut.DragStart,event:hr})}),pr==null||pr(hr)},onMove(an){y({type:ut.DragMove,coordinates:an})},onEnd:eo(ut.DragEnd),onCancel:eo(ut.DragCancel)});Dn.unstable_batchedUpdates(()=>{B(Ht),H(We.nativeEvent)});function eo(an){return async function(){const{active:fr,over:pr,scrollAdjustedTranslate:hr}=de.current;let gr=null;if(fr&&hr){const{cancelDrop:Xt}=$.current;gr={active:fr,delta:hr,over:pr},an===ut.DragEnd&&typeof Xt=="function"&&await Promise.resolve(Xt(gr))&&(an=ut.DragCancel)}if(F.current=null,Dn.unstable_batchedUpdates(()=>{y({type:an}),$e(null),j(!1),B(null),H(null),gr&&S({type:an,event:gr})}),gr){const{onDragCancel:Xt,onDragEnd:Qn}=$.current,ol=an===ut.DragEnd?Qn:Xt;ol==null||ol(gr)}}}},[y,_]),wt=h.useCallback((We,pt)=>(Gt,Nn)=>{const Ht=Gt.nativeEvent;F.current!==null||Ht.dndKit||Ht.defaultPrevented||We(Gt,pt.options)===!0&&(Ht.dndKit={capturedBy:pt.sensor},F.current=Nn,Me(Gt,pt))},[Me]),$t=R6(o,wt);F6(o),_o(()=>{$.current=d},Object.values(d)),h.useEffect(()=>{E!=null&&j(!0)},[E]),h.useEffect(()=>{R||(Q.current=null),R&&Y&&!Q.current&&(Q.current=Y)},[Y,R]),h.useEffect(()=>{const{onDragMove:We}=$.current,{active:pt,over:Gt}=de.current;if(!pt)return;const Nn={active:pt,delta:{x:at.x,y:at.y},over:Gt};S({type:ut.DragMove,event:Nn}),We==null||We(Nn)},[at.x,at.y]),h.useEffect(()=>{const{active:We,droppableContainers:pt,scrollAdjustedTranslate:Gt}=de.current;if(!We||!F.current||!Gt)return;const{onDragOver:Nn}=$.current,Ht=pt.get(Wt),eo=Ht&&Ht.rect.current?{id:Ht.id,rect:Ht.rect.current,data:Ht.data,disabled:Ht.disabled}:null,an={active:We,delta:{x:Gt.x,y:Gt.y},over:eo};Dn.unstable_batchedUpdates(()=>{$e(eo),S({type:ut.DragOver,event:an}),Nn==null||Nn(an)})},[Wt]),_o(()=>{de.current={active:R,activeNode:K,collisionRect:Ie,droppableRects:V,draggableNodes:_,draggingNodeRect:xe,droppableContainers:P,over:ge,scrollableAncestors:ke,scrollAdjustedTranslate:at,translatedRect:rt},M.current={initial:xe,translated:rt}},[R,K,Ie,_,xe,V,P,ge,ke,at,rt]),M6({...Qr(),draggingRect:rt,pointerCoordinates:ft,scrollableAncestors:ke,scrollableAncestorRects:it});const zs=h.useMemo(()=>({active:R,activeNode:K,activeNodeRect:Y,activeNodeClientRect:U,activatorEvent:q,activators:$t,ariaDescribedById:{draggable:I},containerNodeRect:Te,dispatch:y,dragOverlay:st,draggableNodes:_,droppableContainers:P,droppableRects:V,over:ge,recomputeLayouts:G,scrollableAncestors:ke,scrollableAncestorRects:it,willRecomputeLayouts:W,windowRect:ne}),[R,K,U,Y,q,$t,Te,st,y,_,I,P,V,ge,G,ke,it,W,ne]);return h.createElement(ox.Provider,{value:w},h.createElement(yu.Provider,{value:zs},h.createElement(hx.Provider,{value:Ve},r)),h.createElement(v6,{announcements:s,hiddenTextDescribedById:I,screenReaderInstructions:u}));function Qr(){const We=(L==null?void 0:L.autoScrollEnabled)===!1,pt=typeof n=="object"?n.enabled===!1:n===!1,Gt=!We&&!pt;return typeof n=="object"?{...n,enabled:Gt}:{enabled:Gt}}}),ak=h.createContext(null),C1="button",lk="Droppable";function ck({id:e,data:t,disabled:n=!1,attributes:s}){const r=sl(lk),{active:o,activeNodeRect:i,activatorEvent:a,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:f,over:p}=h.useContext(yu),{role:g=C1,roleDescription:m="draggable",tabIndex:b=0}=s??{},v=(o==null?void 0:o.id)===e,x=h.useContext(v?hx:ak),[y,w]=hh(),S=B6(f,e),C=ux(t);h.useEffect(()=>(u[e]={id:e,key:r,node:y,data:C},()=>{const E=u[e];E&&E.key===r&&delete u[e]}),[u,e]);const j=h.useMemo(()=>({role:g,tabIndex:b,"aria-pressed":v&&g===C1?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[g,b,v,m,l.draggable]);return{active:o,activeNodeRect:i,activatorEvent:a,attributes:j,droppableRects:d,isDragging:v,listeners:n?void 0:S,node:y,over:p,setNodeRef:w,transform:x}}function uk(){return h.useContext(yu)}const dk="Droppable";function fk({data:e,disabled:t=!1,id:n}){const s=sl(dk),{active:r,dispatch:o,over:i}=h.useContext(yu),a=h.useRef(null),[l,u]=hh(),d=ux(e);return _o(()=>(o({type:ut.RegisterDroppable,element:{id:n,key:s,disabled:t,node:l,rect:a,data:d}}),()=>o({type:ut.UnregisterDroppable,key:s,id:n})),[n]),h.useEffect(()=>{o({type:ut.SetDroppableDisabled,id:n,key:s,disabled:t})},[t]),{active:r,rect:a,isOver:(i==null?void 0:i.id)===n,node:l,over:i,setNodeRef:u}}function pk(e,t,n){const s={...e};return t.top+e.y<=n.top?s.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(s.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?s.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(s.x=n.left+n.width-t.right),s}const hk=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const s=n[0];return!e||!s?t:pk(t,e,s)},gk=({transform:e})=>({...e,x:0});function gx(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function mk(e,t){return e.reduce((n,s,r)=>{const o=t.get(s);return o&&(n[r]=o),n},Array(e.length))}function $l(e){return e!==null&&e>=0}const mx=({layoutRects:e,activeIndex:t,overIndex:n,index:s})=>{const r=gx(e,n,t),o=e[s],i=r[s];return!i||!o?null:{x:i.offsetLeft-o.offsetLeft,y:i.offsetTop-o.offsetTop,scaleX:i.width/o.width,scaleY:i.height/o.height}},kl={scaleX:1,scaleY:1},bk=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:s,overIndex:r})=>{var o;const i=(o=s[e])!=null?o:t;if(!i)return null;if(n===e){const l=s[r];return l?{x:0,y:e<r?l.offsetTop+l.height-(i.offsetTop+i.height):l.offsetTop-i.offsetTop,...kl}:null}const a=vk(s,n,e);return n>e&&n<=r?{x:0,y:-i.height-a,...kl}:n<e&&n>=r?{x:0,y:i.height+a,...kl}:{x:0,y:0,...kl}};function vk(e,t,n){const s=e[t],r=e[t-1],o=e[t+1];return s?n<t?r?s.offsetTop-(r.offsetTop+r.height):o?o.offsetTop-(s.offsetTop+s.height):0:o?o.offsetTop-(s.offsetTop+s.height):r?s.offsetTop-(r.offsetTop+r.height):0:0}const bx="Sortable",vx=h.createContext({activeIndex:-1,containerId:bx,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:mx,wasDragging:{current:!1}});function yk({children:e,id:t,items:n,strategy:s=mx}){const{active:r,dragOverlay:o,droppableRects:i,over:a,recomputeLayouts:l,willRecomputeLayouts:u}=uk(),d=sl(bx,t),f=o.rect!==null,p=h.useMemo(()=>n.map(E=>typeof E=="string"?E:E.id),[n]),g=r!=null,m=h.useRef(!1),b=r?p.indexOf(r.id):-1,v=b!==-1,x=a?p.indexOf(a.id):-1,y=h.useRef(p),w=mk(p,i),S=!xk(p,y.current),C=x!==-1&&b===-1||S;_o(()=>{S&&v&&!u&&l()},[S,v,l,u]),h.useEffect(()=>{y.current=p},[p]),h.useEffect(()=>{const E=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(E)},[g]);const j=h.useMemo(()=>({activeIndex:b,containerId:d,disableTransforms:C,items:p,overIndex:x,useDragOverlay:f,sortedRects:w,strategy:s,wasDragging:m}),[b,d,C,p,x,w,f,s,m]);return h.createElement(vx.Provider,{value:j},e)}function xk(e,t){return e.join()===t.join()}const wk=({id:e,items:t,activeIndex:n,overIndex:s})=>gx(t,n,s).indexOf(e),Sk=({containerId:e,isSorting:t,wasDragging:n,index:s,items:r,newIndex:o,previousItems:i,previousContainerId:a,transition:l})=>!l||!n||i!==r&&s===o?!1:t?!0:o!==s&&e===a,Ck={duration:200,easing:"ease"},yx="transform",jk=Pa.Transition.toString({property:yx,duration:0,easing:"linear"}),Ek={roleDescription:"sortable"};function Pk({disabled:e,index:t,node:n,rect:s}){const[r,o]=h.useState(null),i=h.useRef(t);return _o(()=>{if(!e&&t!==i.current&&n.current){const a=s.current;if(a){const l=wu(n.current),u={x:a.offsetLeft-l.offsetLeft,y:a.offsetTop-l.offsetTop,scaleX:a.width/l.width,scaleY:a.height/l.height};(u.x||u.y)&&o(u)}}t!==i.current&&(i.current=t)},[e,t,n,s]),h.useEffect(()=>{r&&requestAnimationFrame(()=>{o(null)})},[r]),r}function _k({animateLayoutChanges:e=Sk,attributes:t,disabled:n,data:s,getNewIndex:r=wk,id:o,strategy:i,transition:a=Ck}){const{items:l,containerId:u,activeIndex:d,disableTransforms:f,sortedRects:p,overIndex:g,useDragOverlay:m,strategy:b,wasDragging:v}=h.useContext(vx),x=l.indexOf(o),y=h.useMemo(()=>({sortable:{containerId:u,index:x,items:l},...s}),[u,s,x,l]),{rect:w,node:S,setNodeRef:C}=fk({id:o,data:y}),{active:j,activeNodeRect:E,activatorEvent:_,attributes:T,setNodeRef:P,listeners:A,isDragging:M,over:R,transform:F}=ck({id:o,data:y,attributes:{...Ek,...t},disabled:n}),L=s6(C,P),B=!!j,q=B&&v.current&&!f&&$l(d)&&$l(g),H=!m&&M,$=H&&q?F:null,O=q?$??(i??b)({layoutRects:p,activeNodeRect:E,activeIndex:d,overIndex:g,index:x}):null,V=$l(d)&&$l(g)?r({id:o,items:l,activeIndex:d,overIndex:g}):x,G=h.useRef(l),W=l!==G.current,K=h.useRef(V),J=h.useRef(u),Y=e({active:j,containerId:u,isDragging:M,isSorting:B,id:o,index:x,items:l,newIndex:K.current,previousItems:G.current,previousContainerId:J.current,transition:a,wasDragging:v.current}),U=Pk({disabled:!Y,index:x,node:S,rect:w});return h.useEffect(()=>{B&&K.current!==V&&(K.current=V),u!==J.current&&(J.current=u),l!==G.current&&(G.current=l)},[B,V,u,l]),{active:j,attributes:T,activatorEvent:_,rect:w,index:x,isSorting:B,isDragging:M,listeners:A,node:S,overIndex:g,over:R,setNodeRef:L,setDroppableNodeRef:C,setDraggableNodeRef:P,transform:U??O,transition:Q()};function Q(){if(U||W&&K.current===x)return jk;if(!(H||!a)&&(B||Y))return Pa.Transition.toString({...a,property:yx})}}const Tk=[Be.Down,Be.Right,Be.Up,Be.Left],Ok=(e,{context:{active:t,droppableContainers:n,translatedRect:s,scrollableAncestors:r}})=>{if(Tk.includes(e.code)){if(e.preventDefault(),!t||!s)return;const i=[];n.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const u=l==null?void 0:l.node.current;if(!u)return;const d=Nf(u),f={...l,rect:{current:d}};switch(e.code){case Be.Down:s.top+s.height<=d.top&&i.push(f);break;case Be.Up:s.top>=d.top+d.height&&i.push(f);break;case Be.Left:s.left>=d.left+d.width&&i.push(f);break;case Be.Right:s.left+s.width<=d.left&&i.push(f);break}});const a=O6({active:t,collisionRect:s,droppableContainers:i});if(a){var o;const l=(o=n.get(a))==null?void 0:o.node.current;if(l){const d=gh(l).some((m,b)=>r[b]!==m),f=Nf(l),p=d?{x:0,y:0}:{x:s.width-f.width,y:s.height-f.height};return{x:f.left-p.x,y:f.top-p.y}}}}};function Ak(e){const{id:t,item:n,className:s,select:r,remove:o,renderItem:i,previewStyle:a,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:f,listeners:p,setNodeRef:g,transform:m,transition:b}=_k({id:t,disabled:u}),v={transform:Pa.Transform.toString(m),transition:b},x=()=>!u&&(r==null?void 0:r(n));return c.jsx("div",{...l?{ref:g,style:v,...f}:{},children:c.jsxs(k,{space:"s",onClick:x,className:s,items:"center",nowrap:!0,children:[l&&c.jsx(D,{className:ee(!u&&Ee.hover,!u&&"cursor-grab"),...p,children:c.jsx(oe,{icon:Z.dotsVertical,size:le.sx})}),c.jsx(D,{grow:!0,className:ee("overflow-hidden"),children:c.jsxs(k,{children:[c.jsx(D,{grow:!0,className:ee("overflow-ellipsis overflow-hidden"),children:i(n)}),!!a&&c.jsx(D,{children:c.jsx("div",{className:ee("w-4 h-4 gjs-bg-white",re.b,re.rnd),style:a(n)})})]})}),o&&d?c.jsx(fu,{disabled:u,onConfirm:()=>{o==null||o(n)},children:c.jsx(D,{className:ee(!u&&Ee.click),children:c.jsx(oe,{icon:Z.close,size:le.sx})})}):c.jsx(D,{className:ee(!u&&Ee.click),onClick:y=>{bo(y),!u&&(o==null||o(n))},children:c.jsx(oe,{icon:Z.close,size:le.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Es(e){const{className:t,items:n,selected:s,renderItem:r,select:o,add:i,remove:a,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:b="Add",emptyState:v,disabled:x=!1,hidePopover:y,popoverPlacement:w="left",confirmRemove:S}=e,C=Y6(y1(vh),y1(mh,{coordinateGetter:Ok}));function j(P){const{active:A,over:M}=P;if(A.id!==(M==null?void 0:M.id)){const R=n.find(L=>d(L)===A.id),F=n.findIndex(L=>d(L)===(M==null?void 0:M.id));R&&(l==null||l(R,F))}}const E=ee(re.rnd,z.br,n.length&&re.b,n.length&&"gjs-mt-1");let _=c.jsxs("div",{className:E,children:[n.length===0&&v&&c.jsx(k,{className:N("gs-utl-p-2 gs-utl-text-center",z.txtLowEmphasis),items:"center",justify:"center",children:v}),n.map((P,A)=>{const M=d(P),R=P===s,F=ee("gjs-px-2 gjs-py-2 text-xs",z.br,A&&re.bt,!!o&&!R&&!x&&z.hBgH2,R&&z.bgH,x&&"opacity-75");return c.jsx(Ak,{id:M,item:P,className:F,select:o,remove:a,renderItem:r,previewStyle:u,sortable:!!l,disabled:x,confirmRemove:S},M||A)})]});l&&(_=c.jsx(ik,{sensors:C,collisionDetection:y6,onDragEnd:j,modifiers:[gk,hk],children:c.jsx(yk,{items:n.map(d),strategy:bk,children:_})})),o&&!y&&(_=c.jsx(ps,{placement:w,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!s&&!x,onClose:()=>o==null?void 0:o(null),handler:_,children:g}));const T=i?[{type:"button",icon:Z.plus,tooltip:b,variant:"outline",size:"xs",disabled:x,onClick:i}]:[];return c.jsxs("div",{className:ee(t,"w-full"),children:[!!(f||i)&&c.jsx(fs,{...e,as:p,afterLabelButtons:T}),_]})}const Nk=fe(function(){const t=Re(),{editor:n}=ye(),s=Ka(),r=Ya(),o=r.sortedFonts;return n?c.jsx(Es,{items:o,selected:null,renderItem:i=>{const a=Hp(i);return c.jsxs(k,{col:!0,children:[c.jsx(D,{className:"gs-utl-text-lg",style:{fontFamily:a},children:i.familyLabel}),c.jsx(D,{children:i.familyLabel})]})},remove:i=>r.removeFont(i.family),add:r.sdkAddFonts&&s.hasType("font")?()=>dh(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:i=>i.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),xx=h.forwardRef(function({size:t="m",className:n,classNameContent:s,border:r=!0,children:o,...i},a){const l=ue(z.bg,z.br,r&&`${re.b} ${re.rnd}`,t==="m"&&je.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx(k,{className:l,items:"center",space:"x2s",...i,ref:a,children:c.jsx(D,{grow:!0,className:s,children:o})})}),wx=h.forwardRef(({autoResize:e,style:t={},...n},s)=>{const r=h.useRef(null),o=s||r;return h.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[n.value,e,o]),c.jsx("textarea",{ref:o,style:{...t,...e?{resize:"none"}:{}},...n})});wx.displayName="TextAreaWithAutoResize";const Mk="gs-field-textarea";function j1(e){const{className:t,value:n,label:s,size:r,description:o,placeholder:i,readOnly:a,disabled:l,required:u,onChange:d,onKeyDown:f,afterInput:p,minHeight:g,maxHeight:m,autoResize:b,classNameField:v,classNameFieldContent:x,classNameInput:y}=e,w=Xa(e);return c.jsxs("div",{className:ee(Mk,t),children:[!!s&&c.jsx(Dr,{size:r,children:s}),!!o&&c.jsx(Dr,{size:r,as:"span",className:ee(z.txtLowEmphasis),capitalize:!1,children:o}),c.jsxs(xx,{size:r,className:v,classNameContent:x,children:[c.jsx(wx,{className:ee(w,y),autoResize:b,value:n,placeholder:i,readOnly:a,disabled:l,required:u,onChange:S=>d==null?void 0:d(S.target.value),onKeyDown:f,style:{minHeight:g,maxHeight:m}}),p]})]})}const Su="gs-page-settings",Lk=`${Su}-header`,Rk=`${Su}-content`,$k=`${Su}-footer`,E1="",kk=fe(function({className:t,classNameHeader:n,classNameContent:s,classNameFooter:r,page:o,size:i=Wp.m}){const a=ye(),{isDarkTheme:l}=Ds(),u=Ya(),d=Re(),[f,p]=h.useState(o),[g,m]=h.useState(()=>Bg(f,a)),[b,v]=h.useState(()=>d.t("update")),x=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:w}=a,S={containerClassName:"gs-utl-min-h-80",size:i,padding:5,isDarkTheme:l,clean:!0};if(!w)return null;const C=R=>m(F=>({...F,...R})),j=R=>{R.preventDefault();const{name:F,...L}=g;L.customCodeHead=bw(L.customCodeHead),L.customCodeBody=mw(L.customCodeBody),f?(mA(f,L),f.setName(F)):a.setProjectDataCustom({globalPageSettings:L}),v(d.t("updated")),setTimeout(()=>v(d.t("update")),2e3),g0(w),w.trigger(Tn.pageSettingsUpdate,{page:f,data:{name:F,...L}})},E={tooltip:d.t("clear")},_=(f==null?void 0:f.getId())??E1,T=R=>{const F=w.Pages.get(R);p(F),m(Bg(F,a))},P=Fp(f),A=!!f&&Qc(f),M=[{id:E1,label:x("global")},...w.Pages.getAll().map(R=>({icon:p0(R),id:R.getId(),label:R.getName()}))];return c.jsx("form",{onSubmit:j,className:N(Su,"gs-utl-h-full",t),children:c.jsxs(k,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(D,{className:N(Lk,n,z.br,re.bb),children:c.jsx(_e,{value:_,onChange:T,options:M,handlerSelected:R=>c.jsxs(k,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),R.icon&&ot(R.icon)&&c.jsx(oe,{icon:R.icon,size:le.s2x}),c.jsx("span",{children:R.label})]})})}),c.jsxs(k,{col:!0,className:N(Rk,"gs-utl-gap-5 gs-utl-overflow-y-auto",s),nowrap:!0,children:[!!_&&c.jsxs(c.Fragment,{children:[c.jsx(tt,{size:i,value:g.name,onChange:R=>C({name:R}),label:y("name.label"),description:y("name.description"),required:!0}),!P&&c.jsx(tt,{size:i,value:g.slug,onChange:R=>C({slug:A?Ow(R,["id"]):Ac(R)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(tt,{size:i,value:g.title,onChange:R=>C({title:R}),label:y("title.label"),description:y("title.description")}),c.jsx(j1,{size:i,value:g.description,onChange:R=>C({description:R}),label:y("description.label"),description:y("description.description")}),c.jsx(ja,{size:i,clear:E,value:g.favicon,onChange:R=>C({favicon:R}),onOpen:()=>{w.Assets.open({select(R){C({favicon:R.getSrc()}),w.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(tt,{size:i,value:g.keywords,onChange:R=>C({keywords:R}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(tt,{size:i,value:g.socialTitle,onChange:R=>C({socialTitle:R}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(ja,{size:i,clear:E,value:g.socialImage,onChange:R=>C({socialImage:R}),onOpen:()=>{w.Assets.open({select(R){C({socialImage:R.getSrc()}),w.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(j1,{size:i,value:g.socialDescription,onChange:R=>C({socialDescription:R}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(ir,{language:"html",defaultValue:g.customCodeHead,onChange:R=>C({customCodeHead:R}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...S},`head-${_}`),c.jsx(ir,{language:"html",defaultValue:g.customCodeBody,onChange:R=>C({customCodeBody:R}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...S},`body-${_}`),u.sdkShowProjectFonts&&!_&&c.jsx(Nk,{})]}),c.jsx(k,{className:N($k,"gs-utl-mt-auto",r,z.br,re.bt),children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:b})})]})})}),Vk="gs-panel-page-settings",Ik=h.memo(fe(function({className:t,page:n,...s}){return c.jsx(hs,{className:N(Vk,"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"),...s,children:c.jsx(Qa,{children:c.jsx(kk,{className:N("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:Wp.s,classNameHeader:je.s,classNameContent:je.s,classNameFooter:je.s})})})})),Vl="gs-page-item",P1=fe(function({page:t,rename:n,setRename:s,commandItems:r}){const o=ye(),i=Re(),a=o.editor,{Pages:l}=a,u=o.sdkPagesConfig,d=u==null?void 0:u.settings,f=u==null?void 0:u.showHomeIcon,p=u==null?void 0:u.layoutBefore,g=j=>i.t(`pageManager.${j}`),m=j=>l.select(j),b=j=>l.getSelected()===j,v=j=>j===n,x=b(t),y=j=>j.getName()||j.getId(),w=j=>{n==null||n.set({name:j}),s(void 0)},S=ue("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),C=()=>a.runCommand(ie.setPageSettings,{page:t,isOpen:!0});return c.jsxs(k,{gap:"s",items:"center",onClick:()=>m(t),className:ue([Vl,"group cursor-default",je.xy,x?z.bgH:z.hBgH2]),children:[f&&Fp(t)&&c.jsx(D,{className:`${Vl}__icon-home`,title:g("homePage"),children:c.jsx(oe,{icon:Z.home,size:le.s3x})}),p&&Ot(p({page:t,editor:a,isSelected:x})),c.jsx(D,{className:ue(`${Vl}__name truncate`),grow:!0,children:v(t)?c.jsx(uh,{value:y(t),onChange:w}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(k,{className:`${Vl}__actions`,gap:"xs",onClick:bo,items:"center",children:[!n&&d!==!1&&c.jsx(bt,{className:S,size:"xs",border:!1,title:g("settings.label"),onClick:C,block:!0,children:c.jsx(oe,{icon:Z.cog,size:le.s3x})}),x&&!!r.length&&c.jsx(ps,{placement:"right-start",handler:c.jsx(oe,{icon:Z.dotsVertical,size:le.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:j})=>r.map(E=>c.jsx(_i,{icon:E.icon,label:Ye(E.label)?E.label({editor:a}):E.label,action:()=>{var _;j(),(_=E.cmd)==null||_.call(E,{page:t,editor:a})}},E.id))})]})]},t.getId())});function Dk({dragging:e,dragRect:t}){const n=!!(e&&t),s=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:s}}var Sx=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Sx||{});const Pd="gs-cmp-sortable",_1=3;function Hk({items:e,direction:t,onDrop:n,renderItem:s}){const[r,o]=h.useState(null),[i,a]=h.useState(-1),[l,u]=h.useState(),[d,f]=h.useState(!1),p=h.useRef(null),{showIndicator:g,indicatorStyle:m}=Dk({dragging:!!r&&d,dragRect:l}),b=h.useMemo(()=>[],[e]);h.useEffect(()=>{const E=window.document,_=T=>T.key==="Escape"&&y(T);return E.addEventListener("keydown",_),()=>E.removeEventListener("keydown",_)},[]);const v=E=>_=>{_.button===0&&(p.current={x:_.clientX,y:_.clientY},o(E),f(!1),_.target.setPointerCapture(_.pointerId))},x=E=>{const _=p.current;if(!r||!_)return;if(!d){const R=Math.abs(E.clientX-_.x),F=Math.abs(E.clientY-_.y);(t==="vertical"?F>_1:R>_1)&&f(!0);return}const T=E.clientY;let P=-1;b.forEach((R,F)=>{const L=R.getBoundingClientRect();T>L.top+L.height/2&&(P=F)});const A=e.findIndex(R=>R.id===r.id);P<A&&(P+=1),P=Math.min(P,e.length-1),a(P);const M=b[P];if(M){const{height:R,top:F}=M.getBoundingClientRect(),L=T<F+R/2;u({y:M.offsetTop+(L?0:R),h:R})}},y=E=>{o(null),f(!1),p.current=null,u(void 0);const _=E.target,{pointerId:T}=E;T&&(_==null||_.releasePointerCapture(T))},w=E=>{!r||!p.current||(l&&i!==-1&&(n==null||n(r,i)),y(E))},S=N(Pd,"gs-utl-relative"),C=N(`${Pd}__indicator`,z.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),j=E=>N(`${Pd}__item`,g&&(r==null?void 0:r.id)===E.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx(k,{col:t==="vertical",className:S,children:e.map((E,_)=>c.jsx(D,{ref:T=>{T&&(b[_]=T)},className:j(E),onPointerDown:v(E),onPointerMove:x,onPointerUp:w,children:s(E)},E.id))}),g&&c.jsx("div",{className:C,style:m})]})}const Fk=({pages:e,commandItems:t,rename:n,setRename:s,editor:r})=>{if(!r.Pages.move)return e.map(l=>c.jsx(P1,{page:l,commandItems:t,rename:n,setRename:s},l.getId()));const o=(l,u)=>{r.Pages.move(l.entity,{at:u})},i=l=>c.jsx(P1,{page:l.entity,commandItems:t,rename:n,setRename:s},l.id),a=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(Hk,{items:a,direction:Sx.vertical,onDrop:o,renderItem:i})},Bk=({items:e,editor:t,sdkPageConfig:n})=>{const s=n==null?void 0:n.commandItems;return s===!1?[]:Ye(s)?s({items:e,editor:t}):s||e},_d="gs-panel-page-manager",Cx=fe(function({pages:t,select:n,add:s,remove:r,header:o,resizable:i={bottom:!0},height:a=200}){const l=ye(),u=ji(),d=Re(),{sdkPagesConfig:f}=l,p=l.editor,[g,m]=h.useState(),b=M=>d.t(`pageManager.${M}`),v=f==null?void 0:f.add,x=f==null?void 0:f.duplicate,y=f==null?void 0:f.remove,w=M=>{bo(M);const R=L=>{const B=t.length+1;return s({name:`${b("page")} ${B}`,component:`<div>${b("newPage")} ${B}</div>`,...L},{select:!0})};if(v)return v({event:M,editor:p,rename:m,addPage:R});const F=R();F&&m(F)},S=({page:M})=>{if(y)return y({editor:p,page:M});u.confirm({title:b("deletePage"),content:b("confirmDelete"),confirmButton:{variant:"danger",children:b("deletePage")},onConfirm:()=>{const R=t.indexOf(M),F=t[R+1]||t[0];n(F),r(M)}})},C=({page:M})=>{if(x)return x({editor:p,page:M,rename:m});const R=M.getMainComponent(),F=s({name:`${M.getName()} (${b("copy")})`,component:R.clone()},{select:!0});F&&m(F)},j=[{id:"rename",label:b("rename"),icon:Z.pencil,cmd:({page:M})=>m(M)},x!==!1&&{id:"duplicate",label:b("duplicate"),icon:Z.contentCopy,cmd:C},t.length>1&&y!==!1&&{id:"remove",label:b("delete"),icon:Z.delete,cmd:S}].filter(Boolean),E=Bk({items:j,editor:p,sdkPageConfig:f}),_=By(o,{collapsible:!0,label:b("pages"),icon:Z.textBoxMultiple}),T=i?i===!0?{top:!0,right:!0,bottom:!0,left:!0}:i:void 0,P=c.jsx(Fk,{pages:t,commandItems:E,rename:g,setRename:m,editor:p}),A=T?c.jsx(mu,{className:ee([`${_d}__content`,"text-sm overflow-auto",re.bt,z.br]),height:a,...T,children:P}):P;return c.jsx(ar,{classNameWrap:_d,className:ee(`${_d}__header`,je.xy,o===!1&&"gs-utl-hidden"),disabled:_&&_.collapsible===!1,handler:c.jsxs(k,{space:"s",items:"center",children:[!!_.icon&&c.jsx(D,{children:c.jsx(oe,{icon:_.icon,size:le.s})}),c.jsx(D,{grow:!0,children:_.label}),v!==!1&&c.jsx(It,{title:b("add"),children:c.jsx(k,{onClick:w,className:ee("cursor-pointer"),children:c.jsx(oe,{icon:Z.plus,size:le.s})})})]}),open:_?_.collapsed!==!0:!0,children:A})}),jx=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:N(ue("gs-page-manager-after"),n),ref:r,...s,children:t})}),Ex=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:N(ue("gs-page-manager-before"),n),ref:r,...s,children:t})}),zk="gs-panel-pages",Px=h.memo(fe(function({className:t,header:n,height:s,resizable:r,...o}){const i=ye().sdkProps.children;return c.jsx(mn,{className:N(zk,t),...o,children:c.jsx(ry,{children:a=>c.jsxs(c.Fragment,{children:[Bn(i,Ex),c.jsx(Cx,{header:n,height:s,resizable:r,...a}),Bn(i,jx)]})})})})),Uk="gs-panel-pages-layers",Wk=h.memo(fe(function({className:t,panelPagesProps:n,panelLayersProps:s,...r}){const{showPages:o}=ye(),i=Re(),{className:a,...l}=n||{},u=By(s==null?void 0:s.header,{icon:Z.layers,collapsible:!1,label:i.t("layerManager.layers"),className:N(re.bb,z.br)});return c.jsxs(hs,{className:N(Uk,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...r,children:[o&&c.jsx(Px,{className:N(a,re.bb,z.br),...l}),c.jsx(tx,{...s,header:u})]})})),Gk="gs-trait-custom",qk=fe(function(t){const{trait:n,editor:s,value:r,disabled:o,labelAs:i,className:a}=t,[,l]=h.useState(0),u=h.useRef(null),d=n.get("component"),f=n.get("render"),p=n.target,g=u.current;if(h.useEffect(()=>{if(p){let v=()=>{},x=()=>{};const y=()=>{x(),l(w=>++w)};if(p.on("change",y),!d&&f&&g){const w=j=>g.appendChild(j),S=j=>g.removeChild(j),C=f({editor:s,component:p,trait:n,addEl:w,removeEl:S,onUpdate:j=>{x=j}});C instanceof HTMLElement?(w(C),v=()=>S(C)):Ye(C)&&(v=()=>C())}return()=>{p.off("change",y),v()}}},[p,g,r]),!p)return null;const m=qr({...t,className:N(Gk,a)}),b={trait:n,component:p,editor:s,value:r,disabled:o};return c.jsxs("div",{...m,children:[c.jsx(fs,{...t,as:i}),c.jsx("div",{className:N(o&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...b}):f?c.jsx("div",{ref:u}):null})]})});function _x({className:e,options:t,value:n,name:s,label:r,border:o,hideCaret:i,size:a="s",autoFocus:l,open:u,allowNew:d,onChange:f,onBlur:p,placeholder:g}){const[m,b]=h.useState(null),[v,x]=h.useState(null),{styles:y,attributes:w}=Wa(m,v,qp),[S,C]=h.useState(""),j=Xa(),E=S===""?t:t.filter(F=>F.label.toLowerCase().includes(S.toLowerCase())),_=F=>C(F.target.value),T=F=>F==null?void 0:F.label,P=d&&S.length>0&&!E.some(F=>F.label===S),A=Ye(d)?d(S):d,M={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},R=()=>p==null?void 0:p();return c.jsxs("div",{className:ee("w-full",e),children:[!!r&&c.jsx(Dr,{size:a,children:r}),c.jsxs(Bo,{value:n,onChange:f,name:s,nullable:!0,children:[c.jsx(xx,{size:a,ref:b,border:o,children:c.jsxs(k,{nowrap:!0,children:[c.jsx(Bo.Input,{autoFocus:l,className:j,displayValue:T,onChange:_,onBlur:R,placeholder:g}),!i&&c.jsx(Bo.Button,{children:c.jsx(oe,{icon:Z.chevronDown,size:le.sx})})]})}),c.jsx(Bo.Options,{static:u,className:J0,ref:x,style:y.popper,...w.popper,children:c.jsxs(Xn,{className:ee("h-full"),padding:!1,style:M,children:[P&&c.jsx(Bo.Option,{value:{id:null,label:S},children:({active:F})=>c.jsx(pm,{option:{id:null,label:A},active:F,selected:n})}),!P&&E.length===0&&c.jsx("div",{className:ee(je.xy),children:"No items found"}),E.map(F=>c.jsx(Bo.Option,{value:F,children:({active:L})=>c.jsx(pm,{option:F,active:L,selected:n})},F.id))]})})]})]})}const Kk=(e,t)=>{const n=`${Xc}${t}`,s=e.get(n,{skipResolve:!0});return s?Tx(s):e.get(n)||""};function Tx(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const Yk=({page:e,component:t})=>{const{DataSources:n,I18n:s}=e.em,r=["prevItem","currentItem","nextItem"],o=Jc(e)||"",i=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return r.map(f=>{if(d!=null&&d[f]){const{collectionId:p}=d,g=s.t(`dataSources.collections.${p}`)||p,m=s.t(`dataSources.variableTypes.${f}`)||f,b={collectionId:p,path:"id",type:n.dataComponentTypes.variable,variableType:f};return{id:Tx(b),label:`${g} > ${m}`,dataVariable:b}}}).filter(Boolean)}).flat().filter(Boolean),a=n.get(o),l=a==null?void 0:a.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...i,...l]},Ox="#",ec="mailto:",Td="subject=",Rf="tel:",Ax="hrefType",T1="showIdList",O1=(e,t)=>{const n=t==null?void 0:t.get(Ax);return n||(e.startsWith(Rf)?"phone":e.startsWith(ec)?"email":e.startsWith(va)?"pages":e.startsWith(Ox)?"elements":"url")},A1=e=>`${e.getName()} - #${e.getId()}`,Zk="gs-trait-href",Xk=fe(function(t){const{trait:n,value:s,disabled:r,labelAs:o,className:i}=t,a=n.component,l=ye(),{isSelectingTarget:u,editor:d}=l,[,f]=h.useState(0),[p,g]=h.useState(""),[m,b]=h.useState(""),[v,x]=h.useState(""),[y,w]=h.useState([]),S=Re(),C=d==null?void 0:d.Pages.getAll(),j=S.tScoped("traitManager.traits.labels"),E=()=>f(J=>++J),_=a.get(T1)??!1,T=O1(s,a),P=T==="pages"?s==null?void 0:s.replace(va,""):"",A=!!P&&(d==null?void 0:d.Pages.get(P)),M=A?Qc(A):!1,R=h.useMemo(()=>!M||!A||!d?[]:Yk({page:A,component:a}),[d,A,M,a]),F=J=>{n.setValue(J)},L=J=>{a.set({[T1]:J}),E()},B=J=>{g(""),b(""),x(""),F(""),a.set({[Ax]:J}),E()},q=J=>{F(J),E()},H=(J,Y)=>{yA(a,"id",(Y==null?void 0:Y.dataVariable)||J),E()},$=J=>{J&&(F(J.id),E())},I=J=>{F(`${Rf}${J}`),x(J)},O=J=>{F(`${ec}${J}${m?`?${Td}${m}`:""}`),g(J)},V=J=>{F(`${ec}${p}${J?`?${Td}${J}`:""}`),b(J)},G=()=>{l.setSelectingTarget(!u)},W=J=>{const Y=J.replace(Ox,""),U=d==null?void 0:d.Components.componentsById[Y];return{id:J,label:U?A1(U):J}};h.useEffect(()=>{var Y;const J=[];if(_){const U=["path","br","b","u","i","strike"],Q=(Y=d==null?void 0:d.Pages.getSelected())==null?void 0:Y.getMainComponent();Q==null||Q.forEachChild(se=>{!se.is("comment")&&!se.is("textnode")&&!U.includes(se.get("tagName"))&&J.push({id:`#${se.getId()}`,label:A1(se)})})}w(J)},[d,_]),h.useEffect(()=>{let J=()=>{};const Y=()=>{J(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(Tc))};return u&&(J=fw(Y),d==null||d.runCommand(Tc,{onSelect:U=>F(`#${U.getId()}`)})),Y},[d,u]),h.useEffect(()=>{if(!s)return;switch(O1(s,a)){case"phone":x(s.replace(Rf,""));break;case"email":{const[Y,U=""]=s.replace(ec,"").split("?");g(Y),b(U.replace(Td,""));break}}},[s]);const K=qr({className:N(Zk,i)});return c.jsxs("div",{...K,children:[c.jsx(fs,{...t,as:o}),c.jsx("div",{className:N(r&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(Yr,{onChange:B,classNamePanel:"gs-utl-p-1",value:T,tabs:[{id:"url",label:c.jsx(oe,{icon:Z.link,size:le.s}),content:c.jsx(tt,{placeholder:"eg. https://google.com",value:s,label:"URL",onChange:F,size:"s",type:"url"})},{id:"pages",label:c.jsx(oe,{icon:Z.textBoxMultiple,size:le.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(_e,{size:"s",options:(C||[]).map(J=>({id:`${va}${J.getId()}`,icon:p0(J),label:J.getName()})),value:s,onChange:q,label:"Page"}),M&&c.jsx(_e,{size:"s",options:R,value:Kk(a,"id"),onChange:H,label:S.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(oe,{icon:Z.viewDayOutline,size:le.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(Dr,{size:"s",children:"Element ID"}),c.jsxs(k,{gap:"xs",nowrap:!0,children:[_?c.jsx(_x,{options:y,onChange:$,value:W(s),placeholder:S.t("selectList")}):c.jsx(tt,{size:"s",placeholder:"eg. #my-element-in-page",value:s,onChange:F,className:"gs-utl-flex-1"}),c.jsx(bt,{title:S.t("selectTarget"),size:"m2",active:u,onClick:G,className:"gs-utl-h-[30px]",children:c.jsx(oe,{icon:Z.target,size:le.sx})})]}),c.jsx(wa,{value:_,onChange:L,label:j("showList")})]})},{id:"email",label:c.jsx(oe,{icon:Z.email,size:le.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(tt,{placeholder:"eg. mail@gmail.com",value:p,onChange:O,size:"s",label:"Email",type:"email"}),c.jsx(tt,{placeholder:"eg. My subject",value:m,onChange:V,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(oe,{icon:Z.phone,size:le.s}),content:c.jsx(tt,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:v,onChange:I})}]})})]})});function Jk({trait:e,value:t,disabled:n,label:s,labelAs:r}){const[o,i]=h.useState(),a=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],f=d.findIndex(p=>p.id===(o==null?void 0:o.id));return c.jsx(Es,{items:d,selected:f>-1?o:null,select:i,disabled:n,label:s,labelAs:r,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(b=>b.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(k,{space:"m",col:!0,children:!!o&&a.map(p=>{const{name:g,getValue:m}=p,b=p.setValue,v=p.label||g,x=d[f];if(!x)return null;const y=x[g],w=m?m(y):y,S=j=>{const E={...x};x[g]=b?b(j,w):j,e.setValue([...d],{item:x,previous:E}),g==="id"&&i(x)};let C=c.jsx(tt,{label:v,value:w,onChange:S});switch(p.type){case"select":C=c.jsx(_e,{label:v,options:p.options,value:w,onChange:S})}return c.jsx(h.Fragment,{children:C},g)})})})}const Qk="gs-trait-custom-type",e8=fe(function({trait:t,editor:n}){const s=h.useRef(null),r=t.getType(),o=t.target,{Traits:i}=n,a=i.getType(r),l=!!(o&&a);return h.useEffect(()=>{const u=s.current;if(a&&u&&o){const d=new a({model:t,config:i.getConfig(),attributes:t.get("attributes")}),f=d.render().el;return u.appendChild(f),d.listenTo(o,"change",()=>d.postUpdate()),()=>{u.removeChild(f),d.removeView()}}},[o,a,t]),l&&c.jsx("div",{className:Qk,ref:s})}),t8=e=>{const{value:t={},onConfirm:n,additionalSources:s,editor:r}=e;if(!r)return;const o="DataValuePicker",i={id:o,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:a})=>{n==null||n(a),r.runCommand(ie.layoutRemove,{id:o})},additionalSources:s},placer:{type:"dialog",size:"l"}};r.runCommand(ie.layoutToggle,{...i})};function Nx(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:s,editor:r,additionalSources:o,enableDataValue:i,hasDataResolverValue:a}=e;if(!r||!i)return[];const l={type:"button",className:a?z.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:r.I18n.t("dataSources.connectDataValue"),icon:{icon:Z.databaseOutline,size:le.s2x},onClick:()=>t8({value:t,onConfirm:n,additionalSources:o,editor:r})}];return a&&u.push({...l,title:r.I18n.t("dataSources.clearDataValue"),icon:{icon:Z.close,size:le.s2x},onClick:s}),u}function n8(e,t){const n=e.em.getEditor(),s=e.target;let r=!1;t===!0?r=!0:ur(t)&&Ye(t.enable)&&(r=t.enable({trait:e,component:s,editor:n}));const o=e.getValue({skipResolve:!0}),i=s.collectionsStateMap,a=Hr(o);return{hasDataResolverValue:a,dataResolverValue:a?e.getValue():void 0,enableDataValue:r,initialDataValue:o,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:i}}const s8=({label:e,buttons:t})=>c.jsxs(k,{items:"center",nowrap:!0,full:!0,children:[c.jsx(D,{grow:!0,children:e}),c.jsx(k,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,s)=>c.jsx(bt,{...n},s))})]}),Mx=e=>Ts((e||"").replace(/-/g," ")),r8=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&Mx(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,s)=>e.setValue(n,{partial:s})}),gs=(e,t,n)=>{const s=n8(e,n.traitManagerDataConfig),r=Nx(s),{hasDataResolverValue:o,dataResolverValue:i}=s,a=r8(e,t);return{...a,value:i??a.value,disabled:o,labelAs:r.length?"span":void 0,label:c.jsx(s8,{label:a.label,buttons:r})}},N1=(e,t,n)=>gs(e,t,n),o8=(e,t,n)=>gs(e,t,n),i8=(e,t,n)=>{const s=Hr(e.getValue({skipResolve:!0})),r=gs(e,t,n),o={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!s,units:s?[]:e.get("units"),onChange:(i,a)=>{const l=a||isNaN(parseFloat(i))?i:parseFloat(i);e.setValue(l,{partial:a})}};return{...r,...o}},Lx=(e,t,n)=>{const s=e.get("labelToTitle"),r=Hr(e.getValue({skipResolve:!0})),o=gs(e,t,n),i={options:e.getOptions().map(a=>{const l=a.labelReact||a.name||a.label||a.value;return ot(a)?{id:a,label:a}:{id:a.id||a.value,title:s?l:a.title,icon:a.icon,label:s?"":l}}),onChange:a=>e.setValue(a),emptyState:r&&e.getValue()||void 0,hideCaret:r};return{...o,...i}},a8=(e,t,n)=>{const{options:s,onChange:r}=Lx(e,t,n),o={options:s,onChange:r};return{...gs(e,t,n),...o}},l8=(e,t,n)=>{const s=e.get("typeProps")||{},r=Hr(e.getValue({skipResolve:!0}));return{...gs(e,t,n),isContain:!0,hideButton:r,btnLabel:e.get("text"),onOpen(){if(r)return;const i=t==null?void 0:t.Assets;i==null||i.open({select(a){e.setValue(a.getSrc()),i.close()}})},...s}},c8=e=>({children:Mx(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");ot(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),u8=(e,t,n)=>{const s=gs(e,t,n),o={value:!!(s.disabled?s.value:e.getValue({useType:!0})),onChange:i=>e.setValue(i)};return{...s,...o}},d8=(e,t,n)=>{const s=gs(e,t,n),r=e.get("typeProps")||{},o=Hr(e.getValue({skipResolve:!0}));return{language:"css",...r,...s,formatOnMount:!o,onChange:i=>e.setValue(i)}},f8=(e,t,n)=>({...gs(e,t,n),trait:e}),p8=(e,t,n)=>({...gs(e,t,n),trait:e}),h8=(e,t,n)=>({...gs(e,t,n),trait:e,editor:t});function g8(e,t,n={}){var i;const s=e.get("visible"),r=e.getType(),o={traitManagerDataConfig:n.traitManagerDataConfig};if(Ye(s)&&s({component:e.target,trait:e})===!1)return null;switch(r){case"text":return c.jsx(tt,{...N1(e,t,o)});case"select":return c.jsx(_e,{...Lx(e,t,o)});case"number":return c.jsx(Ne,{...i8(e,t,o)});case"color":return c.jsx(lr,{...o8(e,t,o)});case"checkbox":return c.jsx(wa,{...u8(e,t,o)});case"button":return c.jsx(Ke,{...c8(e)});case"radio":return c.jsx(Yt,{...a8(e,t,o)});case"code":return c.jsx(ir,{...d8(e,t,o),...n},((i=t==null?void 0:t.getSelected())==null?void 0:i.getId())||"");case"image":case"file":return c.jsx(ja,{...l8(e,t,o)});case"stack":return c.jsx(Jk,{...f8(e,t,o)});case"href":return c.jsx(Xk,{...p8(e,t,o)});case"custom":return c.jsx(qk,{...h8(e,t,o)});default:return!!t.Traits.getType(r)?c.jsx(e8,{editor:t,trait:e}):c.jsx(tt,{...N1(e,t,o)})}}const $f="gs-trait-manager",M1=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(D,{className:ee(`${$f}-field gs-utl-mb-2 gs-utl-w-full`),children:g8(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function m8({traits:e,className:t}){var d,f;const n=Ja(),{isDarkTheme:s}=Ds(),o=(d=ye().sdkOptions.dataSources)==null?void 0:d.traitManager,i=n.Traits.getTraitsByCategory(e),a=(f=i.find(p=>!p.category))==null?void 0:f.items,l=i.filter(p=>p.category),u=ee("gs-utl-text-center");return c.jsx(k,{className:ee($f,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[a==null?void 0:a.map(p=>c.jsx(M1,{trait:p,isDarkTheme:s,traitManagerDataConfig:o},p.id)),l.map(({category:p,items:g},m)=>c.jsx(ar,{open:!!(p!=null&&p.get("open")),onChange:({open:b})=>p==null?void 0:p.set({open:b}),handler:p==null?void 0:p.getLabel(),handlerIcon:p==null?void 0:p.get("icon"),classNameContent:"gs-utl-p-2",classNameWrap:`${$f}-category -gs-utl-mx-2`,className:b=>ee(sp.itemList({index:m+(a?1:0),open:b,length:l.length})),children:g.map(b=>c.jsx(M1,{trait:b,isDarkTheme:s,traitManagerDataConfig:o},b.id))},p==null?void 0:p.id))]}):c.jsx(D,{className:u,children:"No properties available"}):c.jsx(D,{className:u,children:n.t("traitManager.empty")})})}const kf=fe(m8),b8="gs-panel-properties",v8=h.memo(fe(function({className:t,...n}){return c.jsx(hs,{className:N(b8,"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(bf,{children:s=>c.jsx(kf,{...s})})})})),y8=async({html:e="",css:t="",el:n})=>{const s=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,r={};if(document.body.attachShadow){const o=n.shadowRoot||n.attachShadow({mode:"open"});o.innerHTML=s}return r},x8=fe(function({rule:t,onSelect:n,onRemove:s,className:r}){const o=h.useRef(null),a=ye().editor,l=Re(),u=t.getDevice(),d=t.getState(),{isDarkTheme:f}=Ds(),[p,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,b]=h.useState(p),v=t.selectorsToString(),x=()=>{a.select(),setTimeout(()=>a.Selectors.select(t)),n==null||n()},y=()=>{a.Css.remove(t),s==null||s()},w=()=>{if(m){const S=a.Parser.parseCss(m)[0];S&&(t.setStyle(S.style),g(m))}};return h.useEffect(()=>{if(o.current){const S=o.current;y8({el:S,html:'<div class="prv-rule">Preview</div>',css:`
|
|
326
|
+
`},C6={onDragStart(e){return`Picked up draggable item ${e}.`},onDragOver(e,t){return t?`Draggable item ${e} was moved over droppable area ${t}.`:`Draggable item ${e} is no longer over a droppable area.`},onDragEnd(e,t){return t?`Draggable item ${e} was dropped over droppable area ${t}`:`Draggable item ${e} was dropped.`},onDragCancel(e){return`Dragging was cancelled. Draggable item ${e} was dropped.`}};var ht;(function(e){e.DragStart="dragStart",e.DragMove="dragMove",e.DragEnd="dragEnd",e.DragCancel="dragCancel",e.DragOver="dragOver",e.RegisterDroppable="registerDroppable",e.SetDroppableDisabled="setDroppableDisabled",e.UnregisterDroppable="unregisterDroppable"})(ht||(ht={}));function kd(...e){}class pa extends Map{get(t){var n;return t!=null&&(n=super.get(t))!=null?n:void 0}toArray(){return Array.from(this.values())}getEnabled(){return this.toArray().filter(({disabled:t})=>!t)}getNodeFor(t){var n,s;return(n=(s=this.get(t))==null?void 0:s.node.current)!=null?n:void 0}}const $u=h.createContext({activatorEvent:null,active:null,activeNode:null,activeNodeRect:null,activeNodeClientRect:null,activators:[],ariaDescribedById:{draggable:""},containerNodeRect:null,dispatch:kd,draggableNodes:{},droppableRects:new Map,droppableContainers:new pa,over:null,dragOverlay:{nodeRef:{current:null},rect:null,setRef:kd},scrollableAncestors:[],scrollableAncestorRects:[],recomputeLayouts:kd,windowRect:null,willRecomputeLayouts:!1});function j6(){return{draggable:{active:null,initialCoordinates:{x:0,y:0},nodes:{},translate:{x:0,y:0}},droppable:{containers:new pa}}}function E6(e,t){switch(t.type){case ht.DragStart:return{...e,draggable:{...e.draggable,initialCoordinates:t.initialCoordinates,active:t.active}};case ht.DragMove:return e.draggable.active?{...e,draggable:{...e.draggable,translate:{x:t.coordinates.x-e.draggable.initialCoordinates.x,y:t.coordinates.y-e.draggable.initialCoordinates.y}}}:e;case ht.DragEnd:case ht.DragCancel:return{...e,draggable:{...e.draggable,active:null,initialCoordinates:{x:0,y:0},translate:{x:0,y:0}}};case ht.RegisterDroppable:{const{element:n}=t,{id:s}=n,r=new pa(e.droppable.containers);return r.set(s,n),{...e,droppable:{...e.droppable,containers:r}}}case ht.SetDroppableDisabled:{const{id:n,key:s,disabled:r}=t,o=e.droppable.containers.get(n);if(!o||s!==o.key)return e;const i=new pa(e.droppable.containers);return i.set(n,{...o,disabled:r}),{...e,droppable:{...e.droppable,containers:i}}}case ht.UnregisterDroppable:{const{id:n,key:s}=t,r=e.droppable.containers.get(n);if(!r||s!==r.key)return e;const o=new pa(e.droppable.containers);return o.delete(n),{...e,droppable:{...e.droppable,containers:o}}}default:return e}}const kx=h.createContext({type:null,event:null});function T6({onDragStart:e,onDragMove:t,onDragOver:n,onDragEnd:s,onDragCancel:r}){const o=h.useContext(kx),i=h.useRef(o);h.useEffect(()=>{if(o!==i.current){const{type:a,event:l}=o;switch(a){case ht.DragStart:e==null||e(l);break;case ht.DragMove:t==null||t(l);break;case ht.DragOver:n==null||n(l);break;case ht.DragCancel:r==null||r(l);break;case ht.DragEnd:s==null||s(l);break}i.current=o}},[o,e,t,n,s,r])}function P6({announcements:e=C6,hiddenTextDescribedById:t,screenReaderInstructions:n}){const{announce:s,announcement:r}=w6(),o=bl("DndLiveRegion"),[i,a]=h.useState(!1);return h.useEffect(()=>{a(!0)},[]),T6(h.useMemo(()=>({onDragStart({active:l}){s(e.onDragStart(l.id))},onDragMove({active:l,over:u}){e.onDragMove&&s(e.onDragMove(l.id,u==null?void 0:u.id))},onDragOver({active:l,over:u}){s(e.onDragOver(l.id,u==null?void 0:u.id))},onDragEnd({active:l,over:u}){s(e.onDragEnd(l.id,u==null?void 0:u.id))},onDragCancel({active:l}){s(e.onDragCancel(l.id))}}),[s,e])),i?Gn.createPortal(h.createElement(h.Fragment,null,h.createElement(y6,{id:t,value:n.draggable}),h.createElement(x6,{id:o,announcement:r})),document.body):null}const mr=Object.freeze({x:0,y:0});function Rx(e,t){return Math.sqrt(Math.pow(e.x-t.x,2)+Math.pow(e.y-t.y,2))}function L1(e,t=e.offsetLeft,n=e.offsetTop){return{x:t+e.width*.5,y:n+e.height*.5}}const O6=({collisionRect:e,droppableContainers:t})=>{const n=L1(e,e.left,e.top);let s=1/0,r=null;for(const o of t){const{rect:{current:i}}=o;if(i){const a=Rx(L1(i),n);a<s&&(s=a,r=o.id)}}return r};function _6(e,t,n){return{...e,scaleX:t&&n?t.width/n.width:1,scaleY:t&&n?t.height/n.height:1}}function A6(e,t){return e&&t?{x:e.left-t.left,y:e.top-t.top}:mr}function L6(e){return function(n,...s){return s.reduce((r,o)=>({...r,top:r.top+e*o.y,bottom:r.bottom+e*o.y,left:r.left+e*o.x,right:r.right+e*o.x,offsetLeft:r.offsetLeft+e*o.x,offsetTop:r.offsetTop+e*o.y}),{...n})}}const M1=L6(1);function M6(e,t=window.getComputedStyle(e)){return t.position==="fixed"}function N6(e,t=window.getComputedStyle(e)){const n=/(auto|scroll|overlay)/;return["overflow","overflowX","overflowY"].find(r=>{const o=t[r];return typeof o=="string"?n.test(o):!1})!=null}function Vh(e){const t=[];function n(s){if(!s)return t;if(Rh(s)&&s.scrollingElement!=null&&!t.includes(s.scrollingElement))return t.push(s.scrollingElement),t;if(!Vi(s)||Mx(s)||t.includes(s))return t;const r=window.getComputedStyle(s);return N6(s,r)&&t.push(s),M6(s,r)?t:n(s.parentNode)}return e?n(e.parentNode):t}function Rd(e){return!Nu||!e?null:Ii(e)?e:kh(e)?Rh(e)||e===Hi(e).scrollingElement?window:Vi(e)?e:null:null}function qf(e){return Ii(e)?{x:e.scrollX,y:e.scrollY}:{x:e.scrollLeft,y:e.scrollTop}}var ui;(function(e){e[e.Forward=1]="Forward",e[e.Backward=-1]="Backward"})(ui||(ui={}));function Ix(e){const t={x:0,y:0},n={x:e.scrollWidth-e.clientWidth,y:e.scrollHeight-e.clientHeight},s=e.scrollTop<=t.y,r=e.scrollLeft<=t.x,o=e.scrollTop>=n.y,i=e.scrollLeft>=n.x;return{isTop:s,isLeft:r,isBottom:o,isRight:i,maxScroll:n,minScroll:t}}function $6(e){return!Nu||!e?!1:e===document.scrollingElement}const k6={x:.2,y:.2};function R6(e,t,{top:n,left:s,right:r,bottom:o},i=10,a=k6){const{clientHeight:l,clientWidth:u}=e,d=$6(e)?{top:0,left:0,right:u,bottom:l,width:u,height:l}:t,{isTop:f,isBottom:p,isLeft:g,isRight:m}=Ix(e),v={x:0,y:0},b={x:0,y:0},x={height:d.height*a.y,width:d.width*a.x};return!f&&n<=d.top+x.height?(v.y=ui.Backward,b.y=i*Math.abs((d.top+x.height-n)/x.height)):!p&&o>=d.bottom-x.height&&(v.y=ui.Forward,b.y=i*Math.abs((d.bottom-x.height-o)/x.height)),!m&&r>=d.right-x.width?(v.x=ui.Forward,b.x=i*Math.abs((d.right-x.width-r)/x.width)):!g&&s<=d.left+x.width&&(v.x=ui.Backward,b.x=i*Math.abs((d.left+x.width-s)/x.width)),{direction:v,speed:b}}function I6(e){if(e===document.scrollingElement){const{innerWidth:o,innerHeight:i}=window;return{top:0,left:0,right:o,bottom:i,width:o,height:i}}const{top:t,left:n,right:s,bottom:r}=e.getBoundingClientRect();return{top:t,left:n,right:s,bottom:r,width:e.clientWidth,height:e.clientHeight}}function Vx(e){return e.reduce((t,n)=>Ia(t,qf(n)),mr)}function Hx(e,t,n=mr){if(!e||!Vi(e))return n;const s={x:n.x+e.offsetLeft,y:n.y+e.offsetTop};return e.offsetParent===t?s:Hx(e.offsetParent,t,s)}function ku(e){const{offsetWidth:t,offsetHeight:n}=e,{x:s,y:r}=Hx(e,null);return{width:t,height:n,offsetTop:r,offsetLeft:s}}function Ru(e){if(Ii(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}=ku(e),{width:s,height:r,top:o,bottom:i,left:a,right:l}=e.getBoundingClientRect();return{width:s,height:r,top:o,bottom:i,right:l,left:a,offsetTop:t,offsetLeft:n}}function Kf(e){const{width:t,height:n,offsetTop:s,offsetLeft:r}=ku(e),o=Vh(e),i=Vx(o),a=s-i.y,l=r-i.x;return{width:t,height:n,top:a,bottom:a+n,right:l+t,left:l,offsetTop:s,offsetLeft:r}}function N1(e){return"top"in e}function $1(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 V6=({collisionRect:e,droppableContainers:t})=>{let n=1/0,s=null;const r=$1(e,e.left,e.top);for(const o of t){const{rect:{current:i}}=o;if(i){const a=$1(i,N1(i)?i.left:void 0,N1(i)?i.top:void 0),l=r.reduce((d,f,p)=>d+Rx(a[p],f),0),u=Number((l/4).toFixed(4));u<n&&(n=u,s=o.id)}}return s};function H6(e,t){const n=Math.max(t.top,e.offsetTop),s=Math.max(t.left,e.offsetLeft),r=Math.min(t.left+t.width,e.offsetLeft+e.width),o=Math.min(t.top+t.height,e.offsetTop+e.height),i=r-s,a=o-n;if(s<r&&n<o){const l=t.width*t.height,u=e.width*e.height,d=i*a,f=d/(l+u-d);return Number(f.toFixed(4))}return 0}const D6=({collisionRect:e,droppableContainers:t})=>{let n=0,s=null;for(const r of t){const{rect:{current:o}}=r;if(o){const i=H6(o,e);i>n&&(n=i,s=r.id)}}return s};var ha;(function(e){e[e.Pointer=0]="Pointer",e[e.DraggableRect=1]="DraggableRect"})(ha||(ha={}));var Ic;(function(e){e[e.TreeOrder=0]="TreeOrder",e[e.ReversedTreeOrder=1]="ReversedTreeOrder"})(Ic||(Ic={}));function F6({acceleration:e,activator:t=ha.Pointer,canScroll:n,draggingRect:s,enabled:r,interval:o=5,order:i=Ic.TreeOrder,pointerCoordinates:a,scrollableAncestors:l,scrollableAncestorRects:u,threshold:d}){const[f,p]=h6(),g=h.useRef({x:1,y:1}),m=h.useMemo(()=>{switch(t){case ha.Pointer:return a?{top:a.y,bottom:a.y,left:a.x,right:a.x}:null;case ha.DraggableRect:return s}return null},[t,s,a]),v=h.useRef(mr),b=h.useRef(null),x=h.useCallback(()=>{const w=b.current;if(!w)return;const S=g.current.x*v.current.x,C=g.current.y*v.current.y;w.scrollBy(S,C)},[]),y=h.useMemo(()=>i===Ic.TreeOrder?[...l].reverse():l,[i,l]);h.useEffect(()=>{if(!r||!l.length||!m){p();return}for(const w of y){if((n==null?void 0:n(w))===!1)continue;const S=l.indexOf(w),C=u[S];if(!C)continue;const{direction:j,speed:E}=R6(w,C,m,e,d);if(E.x>0||E.y>0){p(),b.current=w,f(x,o),g.current=E,v.current=j;return}}g.current={x:0,y:0},v.current={x:0,y:0},p()},[e,x,n,p,r,o,JSON.stringify(m),f,l,y,u,JSON.stringify(d)])}function B6(e,t){const n=t!==null?e[t]:void 0,s=n?n.node.current:null;return vl(r=>{var o;return t===null?null:(o=s??r)!=null?o:null},[s,t])}function z6(e,t){return h.useMemo(()=>e.reduce((n,s)=>{const{sensor:r}=s,o=r.activators.map(i=>({eventName:i.eventName,handler:t(i.handler,s)}));return[...n,...o]},[]),[e,t])}function Dx(e){const t=h.useRef(e);return Ro(()=>{t.current!==e&&(t.current=e)},[e]),t}var Ha;(function(e){e[e.Always=0]="Always",e[e.BeforeDragging=1]="BeforeDragging",e[e.WhileDragging=2]="WhileDragging"})(Ha||(Ha={}));var Zf;(function(e){e.Optimized="optimized"})(Zf||(Zf={}));const k1=new Map,U6={measure:ku,strategy:Ha.WhileDragging,frequency:Zf.Optimized};function W6(e,{dragging:t,dependencies:n,config:s}){const[r,o]=h.useState(!1),{frequency:i,measure:a,strategy:l}={...U6,...s},u=h.useRef(e),d=h.useCallback(()=>o(!0),[]),f=h.useRef(null),p=m(),g=vl(v=>{if(p&&!t)return k1;if(!v||v===k1||u.current!==e||r){for(let b of e)b&&(b.rect.current=b.node.current?a(b.node.current):null);return G6(e)}return v},[e,t,p,a,r]);return h.useEffect(()=>{u.current=e},[e]),h.useEffect(()=>{r&&o(!1)},[r]),h.useEffect(function(){p||requestAnimationFrame(d)},[t,p]),h.useEffect(function(){p||typeof i!="number"||f.current!==null||(f.current=setTimeout(()=>{d(),f.current=null},i))},[i,p,d,...n]),{layoutRectMap:g,recomputeLayouts:d,willRecomputeLayouts:r};function m(){switch(l){case Ha.Always:return!1;case Ha.BeforeDragging:return t;default:return!t}}}function G6(e){const t=new Map;if(e)for(const n of e){if(!n)continue;const{id:s,rect:r}=n;r.current!=null&&t.set(s,r.current)}return t}function q6(e){const[t,n]=h.useState(null),s=h.useRef(e),r=h.useCallback(o=>{const i=Rd(o.target);i&&n(a=>a?(a.set(i,qf(i)),new Map(a)):null)},[]);return h.useEffect(()=>{const o=s.current;if(e!==o){i(o);const a=e.map(l=>{const u=Rd(l);return u?(u.addEventListener("scroll",r,{passive:!0}),[u,qf(u)]):null}).filter(l=>l!=null);n(a.length?new Map(a):null),s.current=e}return()=>{i(e),i(o)};function i(a){a.forEach(l=>{const u=Rd(l);u==null||u.removeEventListener("scroll",r)})}},[r,e]),h.useMemo(()=>e.length?t?Array.from(t.values()).reduce((o,i)=>Ia(o,i),mr):Vx(e):mr,[e,t])}const K6=[];function Z6(e){const t=h.useRef(e),n=vl(s=>e?s&&e&&t.current&&e.parentNode===t.current.parentNode?s:Vh(e):K6,[e]);return h.useEffect(()=>{t.current=e},[e]),n}function Y6(e){h.useEffect(()=>{if(!Nu)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 X6(e,t){return h.useMemo(()=>e.reduce((n,{eventName:s,handler:r})=>(n[s]=o=>{r(o,t)},n),{}),[e,t])}const Id=Bx(Ru),J6=Q6(Ru);function Fx(e,t,n){const s=h.useRef(e);return vl(r=>e?n||!r&&e||e!==s.current?Vi(e)&&e.parentNode==null?null:t(e):r??null:null,[e,n,t])}function Bx(e){return(t,n)=>Fx(t,e,n)}function Q6(e){const t=[];return function(s,r){const o=h.useRef(s);return vl(i=>s.length?r||!i&&s.length||s!==o.current?s.map(a=>e(a)):i??t:t,[s,r])}}function e8(e){if(!e)return null;if(e.children.length>1)return e;const t=e.children[0];return Vi(t)?t:e}function t8(e){const{width:t,height:n,offsetLeft:s,offsetTop:r}=ku(e);return{top:r,bottom:r+n,left:s,right:s+t,width:t,height:n,offsetTop:r,offsetLeft:s}}const n8=Bx(t8);function s8({disabled:e,forceRecompute:t}){const[n,s]=Ih(),r=n8(e?null:e8(n.current),t);return h.useMemo(()=>({nodeRef:n,rect:r,setRef:s}),[r,n,s])}function R1(e,t){return h.useMemo(()=>({sensor:e,options:t??{}}),[e,t])}function r8(...e){return h.useMemo(()=>[...e].filter(t=>t!=null),[...e])}class ga{constructor(t){this.target=t,this.listeners=[],this.removeAll=()=>{this.listeners.forEach(n=>{var s;return(s=this.target)==null?void 0:s.removeEventListener(...n)})}}add(t,n,s){var r;(r=this.target)==null||r.addEventListener(t,n,s),this.listeners.push([t,n,s])}}function o8(e){const{EventTarget:t}=lo(e);return e instanceof t?e:Hi(e)}function Vd(e,t){const n=Math.abs(e.x),s=Math.abs(e.y);return typeof t=="number"?Math.sqrt(n**2+s**2)>t:"x"in t&&"y"in t?n>t.x&&s>t.y:"x"in t?n>t.x:"y"in t?s>t.y:!1}var zn;(function(e){e.Click="click",e.DragStart="dragstart",e.Keydown="keydown",e.ContextMenu="contextmenu",e.Resize="resize",e.SelectionChange="selectionchange",e.VisibilityChange="visibilitychange"})(zn||(zn={}));function I1(e){e.preventDefault()}function i8(e){e.stopPropagation()}var Ue;(function(e){e.Space="Space",e.Down="ArrowDown",e.Right="ArrowRight",e.Left="ArrowLeft",e.Up="ArrowUp",e.Esc="Escape",e.Enter="Enter"})(Ue||(Ue={}));const zx={start:[Ue.Space,Ue.Enter],cancel:[Ue.Esc],end:[Ue.Space,Ue.Enter]},a8=(e,{currentCoordinates:t})=>{switch(e.code){case Ue.Right:return{...t,x:t.x+25};case Ue.Left:return{...t,x:t.x-25};case Ue.Down:return{...t,y:t.y+25};case Ue.Up:return{...t,y:t.y-25}}};class Hh{constructor(t){this.props=t,this.autoScrollEnabled=!1,this.coordinates=mr;const{event:{target:n}}=t;this.props=t,this.listeners=new ga(Hi(n)),this.windowListeners=new ga(lo(n)),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleCancel=this.handleCancel.bind(this),this.attach()}attach(){this.handleStart(),this.windowListeners.add(zn.Resize,this.handleCancel),this.windowListeners.add(zn.VisibilityChange,this.handleCancel),setTimeout(()=>this.listeners.add(zn.Keydown,this.handleKeyDown))}handleStart(){const{activeNode:t,onStart:n}=this.props;if(!t.node.current)throw new Error("Active draggable node is undefined");const s=Ru(t.node.current),r={x:s.left,y:s.top};this.coordinates=r,n(r)}handleKeyDown(t){if(m6(t)){const{coordinates:n}=this,{active:s,context:r,options:o}=this.props,{keyboardCodes:i=zx,coordinateGetter:a=a8,scrollBehavior:l="smooth"}=o,{code:u}=t;if(i.end.includes(u)){this.handleEnd(t);return}if(i.cancel.includes(u)){this.handleCancel(t);return}const d=a(t,{active:s,context:r.current,currentCoordinates:n});if(d){const f={x:0,y:0},{scrollableAncestors:p}=r.current;for(const g of p){const m=t.code,v=$x(d,n),{isTop:b,isRight:x,isLeft:y,isBottom:w,maxScroll:S,minScroll:C}=Ix(g),j=I6(g),E={x:Math.min(m===Ue.Right?j.right-j.width/2:j.right,Math.max(m===Ue.Right?j.left:j.left+j.width/2,d.x)),y:Math.min(m===Ue.Down?j.bottom-j.height/2:j.bottom,Math.max(m===Ue.Down?j.top:j.top+j.height/2,d.y))},O=m===Ue.Right&&!x||m===Ue.Left&&!y,P=m===Ue.Down&&!w||m===Ue.Up&&!b;if(O&&E.x!==d.x){if(m===Ue.Right&&g.scrollLeft+v.x<=S.x||m===Ue.Left&&g.scrollLeft+v.x>=C.x){g.scrollBy({left:v.x,behavior:l});return}f.x=m===Ue.Right?g.scrollLeft-S.x:g.scrollLeft-C.x,g.scrollBy({left:-f.x,behavior:l});break}else if(P&&E.y!==d.y){if(m===Ue.Down&&g.scrollTop+v.y<=S.y||m===Ue.Up&&g.scrollTop+v.y>=C.y){g.scrollBy({top:v.y,behavior:l});return}f.y=m===Ue.Down?g.scrollTop-S.y:g.scrollTop-C.y,g.scrollBy({top:-f.y,behavior:l});break}}this.handleMove(t,Ia(d,f))}}}handleMove(t,n){const{onMove:s}=this.props;t.preventDefault(),s(n),this.coordinates=n}handleEnd(t){const{onEnd:n}=this.props;t.preventDefault(),this.detach(),n()}handleCancel(t){const{onCancel:n}=this.props;t.preventDefault(),this.detach(),n()}detach(){this.listeners.removeAll(),this.windowListeners.removeAll()}}Hh.activators=[{eventName:"onKeyDown",handler:(e,{keyboardCodes:t=zx,onActivation:n})=>{const{code:s}=e.nativeEvent;return t.start.includes(s)?(e.preventDefault(),n==null||n({event:e.nativeEvent}),!0):!1}}];function V1(e){return!!(e&&"distance"in e)}function H1(e){return!!(e&&"delay"in e)}class Dh{constructor(t,n,s=o8(t.event.target)){this.props=t,this.events=n,this.autoScrollEnabled=!0,this.activated=!1,this.timeoutId=null;const{event:r}=t,{target:o}=r;this.props=t,this.events=n,this.document=Hi(o),this.documentListeners=new ga(this.document),this.listeners=new ga(s),this.windowListeners=new ga(lo(o)),this.initialCoordinates=Gf(r),this.handleStart=this.handleStart.bind(this),this.handleMove=this.handleMove.bind(this),this.handleEnd=this.handleEnd.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleKeydown=this.handleKeydown.bind(this),this.removeTextSelection=this.removeTextSelection.bind(this),this.attach()}attach(){const{events:t,props:{options:{activationConstraint:n}}}=this;if(this.listeners.add(t.move.name,this.handleMove,{passive:!1}),this.listeners.add(t.end.name,this.handleEnd),this.windowListeners.add(zn.Resize,this.handleCancel),this.windowListeners.add(zn.DragStart,I1),this.windowListeners.add(zn.VisibilityChange,this.handleCancel),this.windowListeners.add(zn.ContextMenu,I1),this.documentListeners.add(zn.Keydown,this.handleKeydown),n){if(V1(n))return;if(H1(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(zn.Click,i8,{capture:!0}),this.removeTextSelection(),this.documentListeners.add(zn.SelectionChange,this.removeTextSelection),n(t))}handleMove(t){const{activated:n,initialCoordinates:s,props:r}=this,{onMove:o,options:{activationConstraint:i}}=r;if(!s)return;const a=Gf(t),l=$x(s,a);if(!n&&i){if(H1(i))return Vd(l,i.tolerance)?this.handleCancel():void 0;if(V1(i))return i.tolerance!=null&&Vd(l,i.tolerance)?this.handleCancel():Vd(l,i.distance)?this.handleStart():void 0}t.cancelable&&t.preventDefault(),o(a)}handleEnd(){const{onEnd:t}=this.props;this.detach(),t()}handleCancel(){const{onCancel:t}=this.props;this.detach(),t()}handleKeydown(t){t.code===Ue.Esc&&this.handleCancel()}removeTextSelection(){var t;(t=this.document.getSelection())==null||t.removeAllRanges()}}const l8={move:{name:"pointermove"},end:{name:"pointerup"}};class Fh extends Dh{constructor(t){const{event:n}=t,s=Hi(n.target);super(t,l8,s)}}Fh.activators=[{eventName:"onPointerDown",handler:({nativeEvent:e},{onActivation:t})=>!e.isPrimary||e.button!==0?!1:(t==null||t({event:e}),!0)}];const c8={move:{name:"mousemove"},end:{name:"mouseup"}};var Yf;(function(e){e[e.RightClick=2]="RightClick"})(Yf||(Yf={}));class u8 extends Dh{constructor(t){super(t,c8,Hi(t.event.target))}}u8.activators=[{eventName:"onMouseDown",handler:({nativeEvent:e},{onActivation:t})=>e.button===Yf.RightClick?!1:(t==null||t({event:e}),!0)}];const Hd={move:{name:"touchmove"},end:{name:"touchend"}};class d8 extends Dh{constructor(t){super(t,Hd)}static setup(){return window.addEventListener(Hd.move.name,t,{capture:!1,passive:!1}),function(){window.removeEventListener(Hd.move.name,t)};function t(){}}}d8.activators=[{eventName:"onTouchStart",handler:({nativeEvent:e},{onActivation:t})=>{const{touches:n}=e;return n.length>1?!1:(t==null||t({event:e}),!0)}}];function f8(e,{transform:t,...n}){return e!=null&&e.length?e.reduce((s,r)=>r({transform:s,...n}),t):t}const p8=[{sensor:Fh,options:{}},{sensor:Hh,options:{}}],h8={current:{}},Ux=h.createContext({...mr,scaleX:1,scaleY:1}),g8=h.memo(function({id:t,autoScroll:n=!0,announcements:s,children:r,sensors:o=p8,collisionDetection:i=D6,measuring:a,modifiers:l,screenReaderInstructions:u=S6,...d}){var f,p,g,m,v;const b=h.useReducer(E6,void 0,j6),[x,y]=b,[w,S]=h.useState(()=>({type:null,event:null})),[C,j]=h.useState(!1),{draggable:{active:E,nodes:O,translate:P},droppable:{containers:T}}=x,_=E?O[E]:null,L=h.useRef({initial:null,translated:null}),N=h.useMemo(()=>{var Xe;return E!=null?{id:E,data:(Xe=_==null?void 0:_.data)!=null?Xe:h8,rect:L}:null},[E,_]),V=h.useRef(null),[A,H]=h.useState(null),[U,D]=h.useState(null),$=h.useRef(d),I=bl("DndDescribedBy",t),R=h.useMemo(()=>T.getEnabled(),[T]),{layoutRectMap:z,recomputeLayouts:X,willRecomputeLayouts:Z}=W6(R,{dragging:C,dependencies:[P.x,P.y],config:a==null?void 0:a.droppable}),Y=B6(O,E),J=U?Gf(U):null,ee=Fx(Y,(f=a==null||(p=a.draggable)==null?void 0:p.measure)!=null?f:Kf),W=Id(Y),Q=h.useRef(null),ae=Q.current,ge=h.useRef({active:null,activeNode:Y,collisionRect:null,droppableRects:z,draggableNodes:O,draggingNodeRect:null,droppableContainers:T,over:null,scrollableAncestors:[],scrollAdjustedTranslate:null,translatedRect:null}),Ce=T.getNodeFor((g=ge.current.over)==null?void 0:g.id),Se=Id(Y?Y.ownerDocument.defaultView:null),et=Id(Y?Y.parentElement:null),Ye=Z6(E?Ce??Y:null),Ct=J6(Ye),ct=s8({disabled:E==null,forceRecompute:Z}),we=(m=ct.rect)!=null?m:ee,nt=we===ee?A6(ee,ae):mr,st=f8(l,{transform:{x:P.x-nt.x,y:P.y-nt.y,scaleX:1,scaleY:1},activatorEvent:U,active:N,activeNodeRect:W,containerNodeRect:et,draggingNodeRect:we,over:ge.current.over,overlayNodeRect:ct.rect,scrollableAncestors:Ye,scrollableAncestorRects:Ct,windowRect:Se}),vt=J?Ia(J,P):null,Me=q6(Ye),ft=Ia(st,Me),ut=we?M1(we,st):null,Fe=ut?M1(ut,Me):null,Zt=N&&Fe?i({active:N,collisionRect:Fe,droppableContainers:R}):null,[he,Ve]=h.useState(null),De=_6(st,(v=he==null?void 0:he.rect)!=null?v:null,ee),$e=h.useCallback((Xe,{sensor:bt,options:Yt})=>{if(!V.current)return;const En=O[V.current];if(!En)return;const Gt=new bt({active:V.current,activeNode:En,event:Xe.nativeEvent,options:Yt,context:ge,onStart(gn){const br=V.current;if(!br)return;const yr=O[br];if(!yr)return;const{onDragStart:xr}=$.current,wr={active:{id:br,data:yr.data,rect:L}};Gn.unstable_batchedUpdates(()=>{y({type:ht.DragStart,initialCoordinates:gn,active:br}),S({type:ht.DragStart,event:wr})}),xr==null||xr(wr)},onMove(gn){y({type:ht.DragMove,coordinates:gn})},onEnd:fo(ht.DragEnd),onCancel:fo(ht.DragCancel)});Gn.unstable_batchedUpdates(()=>{H(Gt),D(Xe.nativeEvent)});function fo(gn){return async function(){const{active:yr,over:xr,scrollAdjustedTranslate:wr}=ge.current;let Sr=null;if(yr&&wr){const{cancelDrop:sn}=$.current;Sr={active:yr,delta:wr,over:xr},gn===ht.DragEnd&&typeof sn=="function"&&await Promise.resolve(sn(Sr))&&(gn=ht.DragCancel)}if(V.current=null,Gn.unstable_batchedUpdates(()=>{y({type:gn}),Ve(null),j(!1),H(null),D(null),Sr&&S({type:gn,event:Sr})}),Sr){const{onDragCancel:sn,onDragEnd:rs}=$.current,xl=gn===ht.DragEnd?rs:sn;xl==null||xl(Sr)}}}},[y,O]),Ot=h.useCallback((Xe,bt)=>(Yt,En)=>{const Gt=Yt.nativeEvent;V.current!==null||Gt.dndKit||Gt.defaultPrevented||Xe(Yt,bt.options)===!0&&(Gt.dndKit={capturedBy:bt.sensor},V.current=En,$e(Yt,bt))},[$e]),Ft=z6(o,Ot);Y6(o),Ro(()=>{$.current=d},Object.values(d)),h.useEffect(()=>{E!=null&&j(!0)},[E]),h.useEffect(()=>{N||(Q.current=null),N&&ee&&!Q.current&&(Q.current=ee)},[ee,N]),h.useEffect(()=>{const{onDragMove:Xe}=$.current,{active:bt,over:Yt}=ge.current;if(!bt)return;const En={active:bt,delta:{x:ft.x,y:ft.y},over:Yt};S({type:ht.DragMove,event:En}),Xe==null||Xe(En)},[ft.x,ft.y]),h.useEffect(()=>{const{active:Xe,droppableContainers:bt,scrollAdjustedTranslate:Yt}=ge.current;if(!Xe||!V.current||!Yt)return;const{onDragOver:En}=$.current,Gt=bt.get(Zt),fo=Gt&&Gt.rect.current?{id:Gt.id,rect:Gt.rect.current,data:Gt.data,disabled:Gt.disabled}:null,gn={active:Xe,delta:{x:Yt.x,y:Yt.y},over:fo};Gn.unstable_batchedUpdates(()=>{Ve(fo),S({type:ht.DragOver,event:gn}),En==null||En(gn)})},[Zt]),Ro(()=>{ge.current={active:N,activeNode:Y,collisionRect:Fe,droppableRects:z,draggableNodes:O,draggingNodeRect:we,droppableContainers:T,over:he,scrollableAncestors:Ye,scrollAdjustedTranslate:ft,translatedRect:ut},L.current={initial:we,translated:ut}},[N,Y,Fe,O,we,z,T,he,Ye,ft,ut]),F6({...uo(),draggingRect:ut,pointerCoordinates:vt,scrollableAncestors:Ye,scrollableAncestorRects:Ct});const Xs=h.useMemo(()=>({active:N,activeNode:Y,activeNodeRect:ee,activeNodeClientRect:W,activatorEvent:U,activators:Ft,ariaDescribedById:{draggable:I},containerNodeRect:et,dispatch:y,dragOverlay:ct,draggableNodes:O,droppableContainers:T,droppableRects:z,over:he,recomputeLayouts:X,scrollableAncestors:Ye,scrollableAncestorRects:Ct,willRecomputeLayouts:Z,windowRect:Se}),[N,Y,W,ee,U,Ft,et,ct,y,O,I,T,z,he,X,Ye,Ct,Z,Se]);return h.createElement(kx.Provider,{value:w},h.createElement($u.Provider,{value:Xs},h.createElement(Ux.Provider,{value:De},r)),h.createElement(P6,{announcements:s,hiddenTextDescribedById:I,screenReaderInstructions:u}));function uo(){const Xe=(A==null?void 0:A.autoScrollEnabled)===!1,bt=typeof n=="object"?n.enabled===!1:n===!1,Yt=!Xe&&!bt;return typeof n=="object"?{...n,enabled:Yt}:{enabled:Yt}}}),m8=h.createContext(null),D1="button",v8="Droppable";function b8({id:e,data:t,disabled:n=!1,attributes:s}){const r=bl(v8),{active:o,activeNodeRect:i,activatorEvent:a,ariaDescribedById:l,draggableNodes:u,droppableRects:d,activators:f,over:p}=h.useContext($u),{role:g=D1,roleDescription:m="draggable",tabIndex:v=0}=s??{},b=(o==null?void 0:o.id)===e,x=h.useContext(b?Ux:m8),[y,w]=Ih(),S=X6(f,e),C=Dx(t);h.useEffect(()=>(u[e]={id:e,key:r,node:y,data:C},()=>{const E=u[e];E&&E.key===r&&delete u[e]}),[u,e]);const j=h.useMemo(()=>({role:g,tabIndex:v,"aria-pressed":b&&g===D1?!0:void 0,"aria-roledescription":m,"aria-describedby":l.draggable}),[g,v,b,m,l.draggable]);return{active:o,activeNodeRect:i,activatorEvent:a,attributes:j,droppableRects:d,isDragging:b,listeners:n?void 0:S,node:y,over:p,setNodeRef:w,transform:x}}function y8(){return h.useContext($u)}const x8="Droppable";function w8({data:e,disabled:t=!1,id:n}){const s=bl(x8),{active:r,dispatch:o,over:i}=h.useContext($u),a=h.useRef(null),[l,u]=Ih(),d=Dx(e);return Ro(()=>(o({type:ht.RegisterDroppable,element:{id:n,key:s,disabled:t,node:l,rect:a,data:d}}),()=>o({type:ht.UnregisterDroppable,key:s,id:n})),[n]),h.useEffect(()=>{o({type:ht.SetDroppableDisabled,id:n,key:s,disabled:t})},[t]),{active:r,rect:a,isOver:(i==null?void 0:i.id)===n,node:l,over:i,setNodeRef:u}}function S8(e,t,n){const s={...e};return t.top+e.y<=n.top?s.y=n.top-t.top:t.bottom+e.y>=n.top+n.height&&(s.y=n.top+n.height-t.bottom),t.left+e.x<=n.left?s.x=n.left-t.left:t.right+e.x>=n.left+n.width&&(s.x=n.left+n.width-t.right),s}const C8=({draggingNodeRect:e,transform:t,scrollableAncestorRects:n})=>{const s=n[0];return!e||!s?t:S8(t,e,s)},j8=({transform:e})=>({...e,x:0});function Wx(e,t,n){const s=e.slice();return s.splice(n<0?s.length+n:n,0,s.splice(t,1)[0]),s}function E8(e,t){return e.reduce((n,s,r)=>{const o=t.get(s);return o&&(n[r]=o),n},Array(e.length))}function Gl(e){return e!==null&&e>=0}const Gx=({layoutRects:e,activeIndex:t,overIndex:n,index:s})=>{const r=Wx(e,n,t),o=e[s],i=r[s];return!i||!o?null:{x:i.offsetLeft-o.offsetLeft,y:i.offsetTop-o.offsetTop,scaleX:i.width/o.width,scaleY:i.height/o.height}},ql={scaleX:1,scaleY:1},T8=({activeIndex:e,activeNodeRect:t,index:n,layoutRects:s,overIndex:r})=>{var o;const i=(o=s[e])!=null?o:t;if(!i)return null;if(n===e){const l=s[r];return l?{x:0,y:e<r?l.offsetTop+l.height-(i.offsetTop+i.height):l.offsetTop-i.offsetTop,...ql}:null}const a=P8(s,n,e);return n>e&&n<=r?{x:0,y:-i.height-a,...ql}:n<e&&n>=r?{x:0,y:i.height+a,...ql}:{x:0,y:0,...ql}};function P8(e,t,n){const s=e[t],r=e[t-1],o=e[t+1];return s?n<t?r?s.offsetTop-(r.offsetTop+r.height):o?o.offsetTop-(s.offsetTop+s.height):0:o?o.offsetTop-(s.offsetTop+s.height):r?s.offsetTop-(r.offsetTop+r.height):0:0}const qx="Sortable",Kx=h.createContext({activeIndex:-1,containerId:qx,disableTransforms:!1,items:[],overIndex:-1,useDragOverlay:!1,sortedRects:[],strategy:Gx,wasDragging:{current:!1}});function O8({children:e,id:t,items:n,strategy:s=Gx}){const{active:r,dragOverlay:o,droppableRects:i,over:a,recomputeLayouts:l,willRecomputeLayouts:u}=y8(),d=bl(qx,t),f=o.rect!==null,p=h.useMemo(()=>n.map(E=>typeof E=="string"?E:E.id),[n]),g=r!=null,m=h.useRef(!1),v=r?p.indexOf(r.id):-1,b=v!==-1,x=a?p.indexOf(a.id):-1,y=h.useRef(p),w=E8(p,i),S=!_8(p,y.current),C=x!==-1&&v===-1||S;Ro(()=>{S&&b&&!u&&l()},[S,b,l,u]),h.useEffect(()=>{y.current=p},[p]),h.useEffect(()=>{const E=setTimeout(()=>{m.current=g},100);return()=>clearTimeout(E)},[g]);const j=h.useMemo(()=>({activeIndex:v,containerId:d,disableTransforms:C,items:p,overIndex:x,useDragOverlay:f,sortedRects:w,strategy:s,wasDragging:m}),[v,d,C,p,x,w,f,s,m]);return h.createElement(Kx.Provider,{value:j},e)}function _8(e,t){return e.join()===t.join()}const A8=({id:e,items:t,activeIndex:n,overIndex:s})=>Wx(t,n,s).indexOf(e),L8=({containerId:e,isSorting:t,wasDragging:n,index:s,items:r,newIndex:o,previousItems:i,previousContainerId:a,transition:l})=>!l||!n||i!==r&&s===o?!1:t?!0:o!==s&&e===a,M8={duration:200,easing:"ease"},Zx="transform",N8=Va.Transition.toString({property:Zx,duration:0,easing:"linear"}),$8={roleDescription:"sortable"};function k8({disabled:e,index:t,node:n,rect:s}){const[r,o]=h.useState(null),i=h.useRef(t);return Ro(()=>{if(!e&&t!==i.current&&n.current){const a=s.current;if(a){const l=Ru(n.current),u={x:a.offsetLeft-l.offsetLeft,y:a.offsetTop-l.offsetTop,scaleX:a.width/l.width,scaleY:a.height/l.height};(u.x||u.y)&&o(u)}}t!==i.current&&(i.current=t)},[e,t,n,s]),h.useEffect(()=>{r&&requestAnimationFrame(()=>{o(null)})},[r]),r}function R8({animateLayoutChanges:e=L8,attributes:t,disabled:n,data:s,getNewIndex:r=A8,id:o,strategy:i,transition:a=M8}){const{items:l,containerId:u,activeIndex:d,disableTransforms:f,sortedRects:p,overIndex:g,useDragOverlay:m,strategy:v,wasDragging:b}=h.useContext(Kx),x=l.indexOf(o),y=h.useMemo(()=>({sortable:{containerId:u,index:x,items:l},...s}),[u,s,x,l]),{rect:w,node:S,setNodeRef:C}=w8({id:o,data:y}),{active:j,activeNodeRect:E,activatorEvent:O,attributes:P,setNodeRef:T,listeners:_,isDragging:L,over:N,transform:V}=b8({id:o,data:y,attributes:{...$8,...t},disabled:n}),A=f6(C,T),H=!!j,U=H&&b.current&&!f&&Gl(d)&&Gl(g),D=!m&&L,$=D&&U?V:null,R=U?$??(i??v)({layoutRects:p,activeNodeRect:E,activeIndex:d,overIndex:g,index:x}):null,z=Gl(d)&&Gl(g)?r({id:o,items:l,activeIndex:d,overIndex:g}):x,X=h.useRef(l),Z=l!==X.current,Y=h.useRef(z),J=h.useRef(u),ee=e({active:j,containerId:u,isDragging:L,isSorting:H,id:o,index:x,items:l,newIndex:Y.current,previousItems:X.current,previousContainerId:J.current,transition:a,wasDragging:b.current}),W=k8({disabled:!ee,index:x,node:S,rect:w});return h.useEffect(()=>{H&&Y.current!==z&&(Y.current=z),u!==J.current&&(J.current=u),l!==X.current&&(X.current=l)},[H,z,u,l]),{active:j,attributes:P,activatorEvent:O,rect:w,index:x,isSorting:H,isDragging:L,listeners:_,node:S,overIndex:g,over:N,setNodeRef:A,setDroppableNodeRef:C,setDraggableNodeRef:T,transform:W??R,transition:Q()};function Q(){if(W||Z&&Y.current===x)return N8;if(!(D||!a)&&(H||ee))return Va.Transition.toString({...a,property:Zx})}}const I8=[Ue.Down,Ue.Right,Ue.Up,Ue.Left],V8=(e,{context:{active:t,droppableContainers:n,translatedRect:s,scrollableAncestors:r}})=>{if(I8.includes(e.code)){if(e.preventDefault(),!t||!s)return;const i=[];n.getEnabled().forEach(l=>{if(!l||l!=null&&l.disabled)return;const u=l==null?void 0:l.node.current;if(!u)return;const d=Kf(u),f={...l,rect:{current:d}};switch(e.code){case Ue.Down:s.top+s.height<=d.top&&i.push(f);break;case Ue.Up:s.top>=d.top+d.height&&i.push(f);break;case Ue.Left:s.left>=d.left+d.width&&i.push(f);break;case Ue.Right:s.left+s.width<=d.left&&i.push(f);break}});const a=V6({active:t,collisionRect:s,droppableContainers:i});if(a){var o;const l=(o=n.get(a))==null?void 0:o.node.current;if(l){const d=Vh(l).some((m,v)=>r[v]!==m),f=Kf(l),p=d?{x:0,y:0}:{x:s.width-f.width,y:s.height-f.height};return{x:f.left-p.x,y:f.top-p.y}}}}};function H8(e){const{id:t,item:n,className:s,select:r,remove:o,renderItem:i,previewStyle:a,sortable:l=!0,disabled:u,confirmRemove:d}=e,{attributes:f,listeners:p,setNodeRef:g,transform:m,transition:v}=R8({id:t,disabled:u}),b={transform:Va.Transform.toString(m),transition:v},x=()=>!u&&(r==null?void 0:r(n));return c.jsx("div",{...l?{ref:g,style:b,...f}:{},children:c.jsxs(k,{space:"s",onClick:x,className:s,items:"center",nowrap:!0,children:[l&&c.jsx(F,{className:K(!u&&Oe.hover,!u&&"cursor-grab"),...p,children:c.jsx(ne,{icon:G.dotsVertical,size:oe.sx})}),c.jsx(F,{grow:!0,className:K("overflow-hidden"),children:c.jsxs(k,{children:[c.jsx(F,{grow:!0,className:K("overflow-ellipsis overflow-hidden"),children:i(n)}),!!a&&c.jsx(F,{children:c.jsx("div",{className:K("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:a(n)})})]})}),o&&d?c.jsx(Pu,{disabled:u,onConfirm:()=>{o==null||o(n)},children:c.jsx(F,{className:K(!u&&Oe.click),children:c.jsx(ne,{icon:G.close,size:oe.sx})})}):c.jsx(F,{className:K(!u&&Oe.click),onClick:y=>{Po(y),!u&&(o==null||o(n))},children:c.jsx(ne,{icon:G.close,size:oe.sx})})]},n.getIndex?n.getIndex():n.id||n.cid)})}function Ls(e){const{className:t,items:n,selected:s,renderItem:r,select:o,add:i,remove:a,move:l,previewStyle:u,getItemId:d=T=>T.id||T.name||T.title||T.label||"",label:f,labelAs:p,children:g,title:m="Select",titleAdd:v="Add",emptyState:b,disabled:x=!1,hidePopover:y,popoverPlacement:w="left",confirmRemove:S}=e,C=r8(R1(Fh),R1(Hh,{coordinateGetter:V8}));function j(T){const{active:_,over:L}=T;if(_.id!==(L==null?void 0:L.id)){const N=n.find(A=>d(A)===_.id),V=n.findIndex(A=>d(A)===(L==null?void 0:L.id));N&&(l==null||l(N,V))}}const E=K(te.rnd,B.br,n.length&&te.b,n.length&&"gjs-mt-1");let O=c.jsxs("div",{className:E,children:[n.length===0&&b&&c.jsx(k,{className:M("gs-utl-p-2 gs-utl-text-center",B.txtLowEmphasis),items:"center",justify:"center",children:b}),n.map((T,_)=>{const L=d(T),N=T===s,V=K("gjs-px-2 gjs-py-2 text-xs",B.br,_&&te.bt,!!o&&!N&&!x&&B.hBgH2,N&&B.bgH,x&&"opacity-75");return c.jsx(H8,{id:L,item:T,className:V,select:o,remove:a,renderItem:r,previewStyle:u,sortable:!!l,disabled:x,confirmRemove:S},L||_)})]});l&&(O=c.jsx(g8,{sensors:C,collisionDetection:O6,onDragEnd:j,modifiers:[j8,C8],children:c.jsx(O8,{items:n.map(d),strategy:T8,children:O})})),o&&!y&&(O=c.jsx(xs,{placement:w,size:"s",buttonAs:"div",title:m,classNameBody:"gs-utl-gap-2 gs-utl-flex gs-utl-flex-col",open:!!s&&!x,onClose:()=>o==null?void 0:o(null),handler:O,children:g}));const P=i?[{type:"button",icon:G.plus,tooltip:v,variant:"outline",size:"xs",disabled:x,onClick:i}]:[];return c.jsxs("div",{className:K(t,"w-full"),children:[!!(f||i)&&c.jsx(ys,{...e,as:p,afterLabelButtons:P}),O]})}const D8=ce(function(){const t=Ie(),{editor:n}=xe(),s=il(),r=al(),o=r.sortedFonts;return n?c.jsx(Ls,{items:o,selected:null,renderItem:i=>{const a=nh(i);return c.jsxs(k,{col:!0,children:[c.jsx(F,{className:"gs-utl-text-lg",style:{fontFamily:a},children:i.familyLabel}),c.jsx(F,{children:i.familyLabel})]})},remove:i=>r.removeFont(i.family),add:r.sdkAddFonts&&s.hasType("font")?()=>$h(n):void 0,titleAdd:t.t("fontManager.addFontToProject"),label:t.t("fontManager.projectFonts"),getItemId:i=>i.family,emptyState:t.t("fontManager.emptyProjectFonts")}):null}),Yx=h.forwardRef(function({size:t="m",className:n,classNameContent:s,border:r=!0,children:o,...i},a){const l=ie(B.bg,B.br,r&&`${te.b} ${te.rnd}`,t==="m"&&Ee.xy,t==="s"&&"gjs-px-3 gjs-py-1",n);return c.jsx(k,{className:l,items:"center",space:"x2s",...i,ref:a,children:c.jsx(F,{grow:!0,className:s,children:o})})}),Xx=h.forwardRef(({autoResize:e,style:t={},...n},s)=>{const r=h.useRef(null),o=s||r;return h.useEffect(()=>{!o.current||!e||(o.current.style.height="auto",o.current.style.height=o.current.scrollHeight+"px")},[n.value,e,o]),c.jsx("textarea",{ref:o,style:{...t,...e?{resize:"none"}:{}},...n})});Xx.displayName="TextAreaWithAutoResize";const F8="gs-field-textarea";function F1(e){const{className:t,value:n,label:s,size:r,description:o,placeholder:i,readOnly:a,disabled:l,required:u,onChange:d,onKeyDown:f,afterInput:p,minHeight:g,maxHeight:m,autoResize:v,classNameField:b,classNameFieldContent:x,classNameInput:y}=e,w=cl(e);return c.jsxs("div",{className:K(F8,t),children:[!!s&&c.jsx(Gr,{size:r,children:s}),!!o&&c.jsx(Gr,{size:r,as:"span",className:K(B.txtLowEmphasis),capitalize:!1,children:o}),c.jsxs(Yx,{size:r,className:b,classNameContent:x,children:[c.jsx(Xx,{className:K(w,y),autoResize:v,value:n,placeholder:i,readOnly:a,disabled:l,required:u,onChange:S=>d==null?void 0:d(S.target.value),onKeyDown:f,style:{minHeight:g,maxHeight:m}}),p]})]})}const Iu="gs-page-settings",B8=`${Iu}-header`,z8=`${Iu}-content`,U8=`${Iu}-footer`,B1="",W8=ce(function({className:t,classNameHeader:n,classNameContent:s,classNameFooter:r,page:o,size:i=ah.m}){const a=xe(),{isDarkTheme:l}=qs(),u=al(),d=Ie(),[f,p]=h.useState(o),[g,m]=h.useState(()=>em(f,a)),[v,b]=h.useState(()=>d.t("update")),x=d.tScoped("pageManager.settings"),y=d.tScoped("pageManager.settings.fields"),{editor:w}=a,S={containerClassName:"gs-utl-min-h-80",size:i,padding:5,isDarkTheme:l,clean:!0};if(!w)return null;const C=N=>m(V=>({...V,...N})),j=N=>{N.preventDefault();const{name:V,...A}=g;A.customCodeHead=qw(A.customCodeHead),A.customCodeBody=Gw(A.customCodeBody),f?(WA(f,A),f.setName(V)):a.setProjectDataCustom({globalPageSettings:A}),b(d.t("updated")),setTimeout(()=>b(d.t("update")),2e3),P0(w),w.trigger(Rn.pageSettingsUpdate,{page:f,data:{name:V,...A}})},E={tooltip:d.t("clear")},O=(f==null?void 0:f.getId())??B1,P=N=>{const V=w.Pages.get(N);p(V),m(em(V,a))},T=sh(f),_=!!f&&pu(f),L=[{id:B1,label:x("global")},...w.Pages.getAll().map(N=>({icon:E0(N),id:N.getId(),label:N.getName()}))];return c.jsx("form",{onSubmit:j,className:M(Iu,"gs-utl-h-full",t),children:c.jsxs(k,{col:!0,full:!0,className:"gs-utl-gap-1 gs-utl-overflow-hidden",nowrap:!0,children:[c.jsx(F,{className:M(B8,n,B.br,te.bb),children:c.jsx(Le,{value:O,onChange:P,options:L,handlerSelected:N=>c.jsxs(k,{items:"center",gap:"xs",nowrap:!0,children:[c.jsxs("b",{children:[d.t("pageManager.page"),":"]}),N.icon&&dt(N.icon)&&c.jsx(ne,{icon:N.icon,size:oe.s2x}),c.jsx("span",{children:N.label})]})})}),c.jsxs(k,{col:!0,className:M(z8,"gs-utl-gap-5 gs-utl-overflow-y-auto",s),nowrap:!0,children:[!!O&&c.jsxs(c.Fragment,{children:[c.jsx(ot,{size:i,value:g.name,onChange:N=>C({name:N}),label:y("name.label"),description:y("name.description"),required:!0}),!T&&c.jsx(ot,{size:i,value:g.slug,onChange:N=>C({slug:_?oS(N,["id"]):Fc(N)}),label:y("slug.label"),description:y("slug.description"),required:!0})]}),c.jsx(ot,{size:i,value:g.title,onChange:N=>C({title:N}),label:y("title.label"),description:y("title.description")}),c.jsx(F1,{size:i,value:g.description,onChange:N=>C({description:N}),label:y("description.label"),description:y("description.description")}),c.jsx(Ra,{size:i,clear:E,value:g.favicon,onChange:N=>C({favicon:N}),onOpen:()=>{w.Assets.open({select(N){C({favicon:N.getSrc()}),w.Assets.close()}})},label:y("favicon.label"),description:y("favicon.description")}),c.jsx(ot,{size:i,value:g.keywords,onChange:N=>C({keywords:N}),label:y("keywords.label"),description:y("keywords.description")}),c.jsx(ot,{size:i,value:g.socialTitle,onChange:N=>C({socialTitle:N}),label:y("socialTitle.label"),description:y("socialTitle.description")}),c.jsx(Ra,{size:i,clear:E,value:g.socialImage,onChange:N=>C({socialImage:N}),onOpen:()=>{w.Assets.open({select(N){C({socialImage:N.getSrc()}),w.Assets.close()}})},label:y("socialImage.label"),description:y("socialImage.description")}),c.jsx(F1,{size:i,value:g.socialDescription,onChange:N=>C({socialDescription:N}),label:y("socialDescription.label"),description:y("socialDescription.description")}),c.jsx(pr,{language:"html",defaultValue:g.customCodeHead,onChange:N=>C({customCodeHead:N}),label:y("customCodeHead.label"),description:y("customCodeHead.description"),...S},`head-${O}`),c.jsx(pr,{language:"html",defaultValue:g.customCodeBody,onChange:N=>C({customCodeBody:N}),label:y("customCodeBody.label"),description:y("customCodeBody.description"),...S},`body-${O}`),u.sdkShowProjectFonts&&!O&&c.jsx(D8,{})]}),c.jsx(k,{className:M(U8,"gs-utl-mt-auto",r,B.br,te.bt),children:c.jsx(Ke,{type:"submit",variant:"pr",size:"m2",full:!0,children:v})})]})})}),G8="gs-panel-page-settings",q8=h.memo(ce(function({className:t,page:n,...s}){return c.jsx(ws,{className:M(G8,"gs-utl-overflow-hidden",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...s,children:c.jsx(dl,{children:c.jsx(W8,{className:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),page:n,size:ah.s,classNameHeader:Ee.s,classNameContent:Ee.s,classNameFooter:Ee.s})})})})),Kl="gs-page-item",z1=ce(function({page:t,rename:n,setRename:s,commandItems:r}){const o=xe(),i=Ie(),a=o.editor,{Pages:l}=a,u=o.sdkPagesConfig,d=u==null?void 0:u.settings,f=u==null?void 0:u.showHomeIcon,p=u==null?void 0:u.layoutBefore,g=j=>i.t(`pageManager.${j}`),m=j=>l.select(j),v=j=>l.getSelected()===j,b=j=>j===n,x=v(t),y=j=>j.getName()||j.getId(),w=j=>{n==null||n.set({name:j}),s(void 0)},S=ie("group-hover:gs-utl-opacity-100 opacity-0 cursor-pointer transition-opacity"),C=()=>a.runCommand(se.setPageSettings,{page:t,isOpen:!0});return c.jsxs(k,{gap:"s",items:"center",onClick:()=>m(t),className:ie([Kl,"group cursor-default",Ee.xy,x?B.bgH:B.hBgH2]),children:[f&&sh(t)&&c.jsx(F,{className:`${Kl}__icon-home`,title:g("homePage"),children:c.jsx(ne,{icon:G.home,size:oe.s3x})}),p&&$t(p({page:t,editor:a,isSelected:x})),c.jsx(F,{className:ie(`${Kl}__name truncate`),grow:!0,children:b(t)?c.jsx(Nh,{value:y(t),onChange:w}):c.jsx(c.Fragment,{children:y(t)})}),c.jsxs(k,{className:`${Kl}__actions`,gap:"xs",onClick:Po,items:"center",children:[!n&&d!==!1&&c.jsx(St,{className:S,size:"xs",border:!1,title:g("settings.label"),onClick:C,block:!0,children:c.jsx(ne,{icon:G.cog,size:oe.s3x})}),x&&!!r.length&&c.jsx(xs,{placement:"right-start",handler:c.jsx(ne,{icon:G.dotsVertical,size:oe.s}),title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:j})=>r.map(E=>c.jsx($i,{icon:E.icon,label:tt(E.label)?E.label({editor:a}):E.label,action:()=>{var O;j(),(O=E.cmd)==null||O.call(E,{page:t,editor:a})}},E.id))})]})]},t.getId())});function K8({dragging:e,dragRect:t}){const n=!!(e&&t),s=n?{top:t.y,left:0,marginLeft:0}:{};return{showIndicator:n,indicatorStyle:s}}var Jx=(e=>(e.horizontal="horizontal",e.vertical="vertical",e))(Jx||{});const Dd="gs-cmp-sortable",U1=3;function Z8({items:e,direction:t,onDrop:n,renderItem:s}){const[r,o]=h.useState(null),[i,a]=h.useState(-1),[l,u]=h.useState(),[d,f]=h.useState(!1),p=h.useRef(null),{showIndicator:g,indicatorStyle:m}=K8({dragging:!!r&&d,dragRect:l}),v=h.useMemo(()=>[],[e]);h.useEffect(()=>{const E=window.document,O=P=>P.key==="Escape"&&y(P);return E.addEventListener("keydown",O),()=>E.removeEventListener("keydown",O)},[]);const b=E=>O=>{O.button===0&&(p.current={x:O.clientX,y:O.clientY},o(E),f(!1),O.target.setPointerCapture(O.pointerId))},x=E=>{const O=p.current;if(!r||!O)return;if(!d){const N=Math.abs(E.clientX-O.x),V=Math.abs(E.clientY-O.y);(t==="vertical"?V>U1:N>U1)&&f(!0);return}const P=E.clientY;let T=-1;v.forEach((N,V)=>{const A=N.getBoundingClientRect();P>A.top+A.height/2&&(T=V)});const _=e.findIndex(N=>N.id===r.id);T<_&&(T+=1),T=Math.min(T,e.length-1),a(T);const L=v[T];if(L){const{height:N,top:V}=L.getBoundingClientRect(),A=P<V+N/2;u({y:L.offsetTop+(A?0:N),h:N})}},y=E=>{o(null),f(!1),p.current=null,u(void 0);const O=E.target,{pointerId:P}=E;P&&(O==null||O.releasePointerCapture(P))},w=E=>{!r||!p.current||(l&&i!==-1&&(n==null||n(r,i)),y(E))},S=M(Dd,"gs-utl-relative"),C=M(`${Dd}__indicator`,B.cmp,"gs-utl-absolute gs-utl-w-full gs-utl-h-0.5"),j=E=>M(`${Dd}__item`,g&&(r==null?void 0:r.id)===E.id&&"gs-utl-opacity-50 gs-utl-select-none");return c.jsxs(c.Fragment,{children:[c.jsx(k,{col:t==="vertical",className:S,children:e.map((E,O)=>c.jsx(F,{ref:P=>{P&&(v[O]=P)},className:j(E),onPointerDown:b(E),onPointerMove:x,onPointerUp:w,children:s(E)},E.id))}),g&&c.jsx("div",{className:C,style:m})]})}const Y8=({pages:e,commandItems:t,rename:n,setRename:s,editor:r})=>{if(!r.Pages.move)return e.map(l=>c.jsx(z1,{page:l,commandItems:t,rename:n,setRename:s},l.getId()));const o=(l,u)=>{r.Pages.move(l.entity,{at:u})},i=l=>c.jsx(z1,{page:l.entity,commandItems:t,rename:n,setRename:s},l.id),a=e.map(l=>({id:l.getId(),entity:l}));return c.jsx(Z8,{items:a,direction:Jx.vertical,onDrop:o,renderItem:i})},X8=({items:e,editor:t,sdkPageConfig:n})=>{const s=n==null?void 0:n.commandItems;return s===!1?[]:tt(s)?s({items:e,editor:t}):s||e},Fd="gs-panel-page-manager",Qx=ce(function({pages:t,select:n,add:s,remove:r,header:o,resizable:i={bottom:!0},height:a=200}){const l=xe(),u=Li(),d=Ie(),{sdkPagesConfig:f}=l,p=l.editor,[g,m]=h.useState(),v=L=>d.t(`pageManager.${L}`),b=f==null?void 0:f.add,x=f==null?void 0:f.duplicate,y=f==null?void 0:f.remove,w=L=>{Po(L);const N=A=>{const H=t.length+1;return s({name:`${v("page")} ${H}`,component:`<div>${v("newPage")} ${H}</div>`,...A},{select:!0})};if(b)return b({event:L,editor:p,rename:m,addPage:N});const V=N();V&&m(V)},S=({page:L})=>{if(y)return y({editor:p,page:L});u.confirm({title:v("deletePage"),content:v("confirmDelete"),confirmButton:{variant:"danger",children:v("deletePage")},onConfirm:()=>{const N=t.indexOf(L),V=t[N+1]||t[0];n(V),r(L)}})},C=({page:L})=>{if(x)return x({editor:p,page:L,rename:m});const N=L.getMainComponent(),V=s({name:`${L.getName()} (${v("copy")})`,component:N.clone()},{select:!0});V&&m(V)},j=[{id:"rename",label:v("rename"),icon:G.pencil,cmd:({page:L})=>m(L)},x!==!1&&{id:"duplicate",label:v("duplicate"),icon:G.contentCopy,cmd:C},t.length>1&&y!==!1&&{id:"remove",label:v("delete"),icon:G.delete,cmd:S}].filter(Boolean),E=X8({items:j,editor:p,sdkPageConfig:f}),O=bx(o,{collapsible:!0,label:v("pages"),icon:G.textBoxMultiple}),P=i?i===!0?{top:!0,right:!0,bottom:!0,left:!0}:i:void 0,T=c.jsx(Y8,{pages:t,commandItems:E,rename:g,setRename:m,editor:p}),_=P?c.jsx(Lu,{className:K([`${Fd}__content`,"text-sm overflow-auto",te.bt,B.br]),height:a,...P,children:T}):T;return c.jsx(hr,{classNameWrap:Fd,className:K(`${Fd}__header`,Ee.xy,o===!1&&"gs-utl-hidden"),disabled:O&&O.collapsible===!1,handler:c.jsxs(k,{space:"s",items:"center",children:[!!O.icon&&c.jsx(F,{children:c.jsx(ne,{icon:O.icon,size:oe.s})}),c.jsx(F,{grow:!0,children:O.label}),b!==!1&&c.jsx(zt,{title:v("add"),children:c.jsx(k,{onClick:w,className:K("cursor-pointer"),children:c.jsx(ne,{icon:G.plus,size:oe.s})})})]}),open:O?O.collapsed!==!0:!0,children:_})}),ew=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-page-manager-after"),n),ref:r,...s,children:t})}),tw=h.forwardRef(function({children:t,className:n,...s},r){return c.jsx("div",{className:M(ie("gs-page-manager-before"),n),ref:r,...s,children:t})}),J8="gs-panel-pages",nw=h.memo(ce(function({className:t,header:n,height:s,resizable:r,...o}){const i=xe().sdkProps.children;return c.jsx(Cn,{className:M(J8,t),...o,children:c.jsx(my,{children:a=>c.jsxs(c.Fragment,{children:[Zn(i,tw),c.jsx(Qx,{header:n,height:s,resizable:r,...a}),Zn(i,ew)]})})})})),Q8="gs-panel-pages-layers",eI=h.memo(ce(function({className:t,panelPagesProps:n,panelLayersProps:s,...r}){const{showPages:o}=xe(),i=Ie(),{className:a,...l}=n||{},u=bx(s==null?void 0:s.header,{icon:G.layers,collapsible:!1,label:i.t("layerManager.layers"),className:M(te.bb,B.br)});return c.jsxs(ws,{className:M(Q8,"gs-utl-flex gs-utl-flex-col gs-utl-h-full",t),...r,children:[o&&c.jsx(nw,{className:M(a,te.bb,B.br),...l}),c.jsx(Lx,{...s,header:u})]})})),tI="gs-trait-custom",nI=ce(function(t){const{trait:n,editor:s,value:r,disabled:o,labelAs:i,className:a}=t,[,l]=h.useState(0),u=h.useRef(null),d=n.get("component"),f=n.get("render"),p=n.target,g=u.current;if(h.useEffect(()=>{if(p){let b=()=>{},x=()=>{};const y=()=>{x(),l(w=>++w)};if(p.on("change",y),!d&&f&&g){const w=j=>g.appendChild(j),S=j=>g.removeChild(j),C=f({editor:s,component:p,trait:n,addEl:w,removeEl:S,onUpdate:j=>{x=j}});C instanceof HTMLElement?(w(C),b=()=>S(C)):tt(C)&&(b=()=>C())}return()=>{p.off("change",y),b()}}},[p,g,r]),!p)return null;const m=no({...t,className:M(tI,a)}),v={trait:n,component:p,editor:s,value:r,disabled:o};return c.jsxs("div",{...m,children:[c.jsx(ys,{...t,as:i}),c.jsx("div",{className:M(o&&"gs-utl-pointer-events-none opacity-50"),children:d?c.jsx(d,{...v}):f?c.jsx("div",{ref:u}):null})]})});function sw({className:e,options:t,value:n,name:s,label:r,border:o,hideCaret:i,size:a="s",autoFocus:l,open:u,allowNew:d,onChange:f,onBlur:p,placeholder:g}){const[m,v]=h.useState(null),[b,x]=h.useState(null),{styles:y,attributes:w}=sl(m,b,ch),[S,C]=h.useState(""),j=cl(),E=S===""?t:t.filter(V=>V.label.toLowerCase().includes(S.toLowerCase())),O=V=>C(V.target.value),P=V=>V==null?void 0:V.label,T=d&&S.length>0&&!E.some(V=>V.label===S),_=tt(d)?d(S):d,L={minWidth:`${m==null?void 0:m.offsetWidth}px`,maxHeight:200},N=()=>p==null?void 0:p();return c.jsxs("div",{className:K("w-full",e),children:[!!r&&c.jsx(Gr,{size:a,children:r}),c.jsxs(Xo,{value:n,onChange:f,name:s,nullable:!0,children:[c.jsx(Yx,{size:a,ref:v,border:o,children:c.jsxs(k,{nowrap:!0,children:[c.jsx(Xo.Input,{autoFocus:l,className:j,displayValue:P,onChange:O,onBlur:N,placeholder:g}),!i&&c.jsx(Xo.Button,{children:c.jsx(ne,{icon:G.chevronDown,size:oe.sx})})]})}),c.jsx(Xo.Options,{static:u,className:uy,ref:x,style:y.popper,...w.popper,children:c.jsxs(ns,{className:K("h-full"),padding:!1,style:L,children:[T&&c.jsx(Xo.Option,{value:{id:null,label:S},children:({active:V})=>c.jsx(Em,{option:{id:null,label:_},active:V,selected:n})}),!T&&E.length===0&&c.jsx("div",{className:K(Ee.xy),children:"No items found"}),E.map(V=>c.jsx(Xo.Option,{value:V,children:({active:A})=>c.jsx(Em,{option:V,active:A,selected:n})},V.id))]})})]})]})}const sI=(e,t)=>{const n=`${du}${t}`,s=e.get(n,{skipResolve:!0});return s?rw(s):e.get(n)||""};function rw(e){return`${e.collectionId}.${e.variableType}.${e.path}`}const rI=({page:e,component:t})=>{const{DataSources:n,I18n:s}=e.em,r=["prevItem","currentItem","nextItem"],o=fu(e)||"",i=Object.values((t==null?void 0:t.collectionsStateMap)||{}).map(u=>{const d=u;return r.map(f=>{if(d!=null&&d[f]){const{collectionId:p}=d,g=s.t(`dataSources.collections.${p}`)||p,m=s.t(`dataSources.variableTypes.${f}`)||f,v={collectionId:p,path:"id",type:n.dataComponentTypes.variable,variableType:f};return{id:rw(v),label:`${g} > ${m}`,dataVariable:v}}}).filter(Boolean)}).flat().filter(Boolean),a=n.get(o),l=a==null?void 0:a.getRecords().map(u=>({id:u.id,label:u.get("title")||u.get("name")||u.id}));return[...i,...l]},ow="#",pc="mailto:",Bd="subject=",Xf="tel:",iw="hrefType",W1="showIdList",G1=(e,t)=>{const n=t==null?void 0:t.get(iw);return n||(e.startsWith(Xf)?"phone":e.startsWith(pc)?"email":e.startsWith(Ea)?"pages":e.startsWith(ow)?"elements":"url")},q1=e=>`${e.getName()} - #${e.getId()}`,oI="gs-trait-href",iI=ce(function(t){const{trait:n,value:s,disabled:r,labelAs:o,className:i}=t,a=n.component,l=xe(),{isSelectingTarget:u,editor:d}=l,[,f]=h.useState(0),[p,g]=h.useState(""),[m,v]=h.useState(""),[b,x]=h.useState(""),[y,w]=h.useState([]),S=Ie(),C=d==null?void 0:d.Pages.getAll(),j=S.tScoped("traitManager.traits.labels"),E=()=>f(J=>++J),O=a.get(W1)??!1,P=G1(s,a),T=P==="pages"?s==null?void 0:s.replace(Ea,""):"",_=!!T&&(d==null?void 0:d.Pages.get(T)),L=_?pu(_):!1,N=h.useMemo(()=>!L||!_||!d?[]:rI({page:_,component:a}),[d,_,L,a]),V=J=>{n.setValue(J)},A=J=>{a.set({[W1]:J}),E()},H=J=>{g(""),v(""),x(""),V(""),a.set({[iw]:J}),E()},U=J=>{V(J),E()},D=(J,ee)=>{KA(a,"id",(ee==null?void 0:ee.dataVariable)||J),E()},$=J=>{J&&(V(J.id),E())},I=J=>{V(`${Xf}${J}`),x(J)},R=J=>{V(`${pc}${J}${m?`?${Bd}${m}`:""}`),g(J)},z=J=>{V(`${pc}${p}${J?`?${Bd}${J}`:""}`),v(J)},X=()=>{l.setSelectingTarget(!u)},Z=J=>{const ee=J.replace(ow,""),W=d==null?void 0:d.Components.componentsById[ee];return{id:J,label:W?q1(W):J}};h.useEffect(()=>{var ee;const J=[];if(O){const W=["path","br","b","u","i","strike"],Q=(ee=d==null?void 0:d.Pages.getSelected())==null?void 0:ee.getMainComponent();Q==null||Q.forEachChild(ae=>{!ae.is("comment")&&!ae.is("textnode")&&!W.includes(ae.get("tagName"))&&J.push({id:`#${ae.getId()}`,label:q1(ae)})})}w(J)},[d,O]),h.useEffect(()=>{let J=()=>{};const ee=()=>{J(),!(d!=null&&d.em.destroyed)&&(d==null||d.stopCommand(Hc))};return u&&(J=Bw(ee),d==null||d.runCommand(Hc,{onSelect:W=>V(`#${W.getId()}`)})),ee},[d,u]),h.useEffect(()=>{if(!s)return;switch(G1(s,a)){case"phone":x(s.replace(Xf,""));break;case"email":{const[ee,W=""]=s.replace(pc,"").split("?");g(ee),v(W.replace(Bd,""));break}}},[s]);const Y=no({className:M(oI,i)});return c.jsxs("div",{...Y,children:[c.jsx(ys,{...t,as:o}),c.jsx("div",{className:M(r&&"gs-utl-pointer-events-none opacity-50"),children:c.jsx(ro,{onChange:H,classNamePanel:"gs-utl-p-1",value:P,tabs:[{id:"url",label:c.jsx(ne,{icon:G.link,size:oe.s}),content:c.jsx(ot,{placeholder:"eg. https://google.com",value:s,label:"URL",onChange:V,size:"s",type:"url"})},{id:"pages",label:c.jsx(ne,{icon:G.textBoxMultiple,size:oe.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(Le,{size:"s",options:(C||[]).map(J=>({id:`${Ea}${J.getId()}`,icon:E0(J),label:J.getName()})),value:s,onChange:U,label:"Page"}),L&&c.jsx(Le,{size:"s",options:N,value:sI(a,"id"),onChange:D,label:S.t("dataSources.collectionItem")})]})},{id:"elements",label:c.jsx(ne,{icon:G.viewDayOutline,size:oe.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(Gr,{size:"s",children:"Element ID"}),c.jsxs(k,{gap:"xs",nowrap:!0,children:[O?c.jsx(sw,{options:y,onChange:$,value:Z(s),placeholder:S.t("selectList")}):c.jsx(ot,{size:"s",placeholder:"eg. #my-element-in-page",value:s,onChange:V,className:"gs-utl-flex-1"}),c.jsx(St,{title:S.t("selectTarget"),size:"m2",active:u,onClick:X,className:"gs-utl-h-[30px]",children:c.jsx(ne,{icon:G.target,size:oe.sx})})]}),c.jsx(Na,{value:O,onChange:A,label:j("showList")})]})},{id:"email",label:c.jsx(ne,{icon:G.email,size:oe.s}),content:c.jsxs(k,{gap:"s",col:!0,children:[c.jsx(ot,{placeholder:"eg. mail@gmail.com",value:p,onChange:R,size:"s",label:"Email",type:"email"}),c.jsx(ot,{placeholder:"eg. My subject",value:m,onChange:z,label:"Subject",size:"s"})]})},{id:"phone",label:c.jsx(ne,{icon:G.phone,size:oe.s}),content:c.jsx(ot,{size:"s",type:"tel",label:"Phone",placeholder:"eg. +55123456789",value:b,onChange:I})}]})})]})});function aI({trait:e,value:t,disabled:n,label:s,labelAs:r}){const[o,i]=h.useState(),a=e.get("properties"),l=e.get("addItem"),u=e.get("labelItem"),d=t||[],f=d.findIndex(p=>p.id===(o==null?void 0:o.id));return c.jsx(Ls,{items:d,selected:f>-1?o:null,select:i,disabled:n,label:s,labelAs:r,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(k,{space:"m",col:!0,children:!!o&&a.map(p=>{const{name:g,getValue:m}=p,v=p.setValue,b=p.label||g,x=d[f];if(!x)return null;const y=x[g],w=m?m(y):y,S=j=>{const E={...x};x[g]=v?v(j,w):j,e.setValue([...d],{item:x,previous:E}),g==="id"&&i(x)};let C=c.jsx(ot,{label:b,value:w,onChange:S});switch(p.type){case"select":C=c.jsx(Le,{label:b,options:p.options,value:w,onChange:S})}return c.jsx(h.Fragment,{children:C},g)})})})}const lI="gs-trait-custom-type",cI=ce(function({trait:t,editor:n}){const s=h.useRef(null),r=t.getType(),o=t.target,{Traits:i}=n,a=i.getType(r),l=!!(o&&a);return h.useEffect(()=>{const u=s.current;if(a&&u&&o){const d=new a({model:t,config:i.getConfig(),attributes:t.get("attributes")}),f=d.render().el;return u.appendChild(f),d.listenTo(o,"change",()=>d.postUpdate()),()=>{u.removeChild(f),d.removeView()}}},[o,a,t]),l&&c.jsx("div",{className:lI,ref:s})}),uI=e=>{const{value:t={},onConfirm:n,additionalSources:s,editor:r}=e;if(!r)return;const o="DataValuePicker",i={id:o,header:!1,layout:{type:"panelDataValuePicker",value:t,onConfirm:({value:a})=>{n==null||n(a),r.runCommand(se.layoutRemove,{id:o})},additionalSources:s},placer:{type:"dialog",size:"l"}};r.runCommand(se.layoutToggle,{...i})};function aw(e){const{initialDataValue:t,handleDataValueChange:n,handleValueClear:s,editor:r,additionalSources:o,enableDataValue:i,hasDataResolverValue:a}=e;if(!r||!i)return[];const l={type:"button",className:a?B.tAo:"",variant:"out-clear",size:"x2s",block:!0,border:!1},u=[{...l,title:r.I18n.t("dataSources.connectDataValue"),icon:{icon:G.databaseOutline,size:oe.s2x},onClick:()=>uI({value:t,onConfirm:n,additionalSources:o,editor:r})}];return a&&u.push({...l,title:r.I18n.t("dataSources.clearDataValue"),icon:{icon:G.close,size:oe.s2x},onClick:s}),u}function dI(e,t){const n=e.em.getEditor(),s=e.target;let r=!1;t===!0?r=!0:vr(t)&&tt(t.enable)&&(r=t.enable({trait:e,component:s,editor:n}));const o=e.getValue({skipResolve:!0}),i=s.collectionsStateMap,a=Kr(o);return{hasDataResolverValue:a,dataResolverValue:a?e.getValue():void 0,enableDataValue:r,initialDataValue:o,handleDataValueChange:l=>e.setValue(l),handleValueClear:()=>{const l=e.getValue();e.setValue(""),e.setValue(l)},editor:n,additionalSources:i}}const fI=({label:e,buttons:t})=>c.jsxs(k,{items:"center",nowrap:!0,full:!0,children:[c.jsx(F,{grow:!0,children:e}),c.jsx(k,{nowrap:!0,items:"center",justify:"end",gap:"x2s",children:t.map((n,s)=>c.jsx(St,{...n},s))})]}),lw=e=>$s((e||"").replace(/-/g," ")),pI=(e,t)=>({size:"s",tip:e.get("tip"),type:e.getType(),value:e.getValue(),label:e.get("label")!==!1&&lw(e.getLabel({locale:!0})),placeholder:(t==null?void 0:t.t(`traitManager.traits.attributes.${e.getId()}.placeholder`))||e.get("placeholder")||"",onChange:(n,s)=>e.setValue(n,{partial:s})}),Ss=(e,t,n)=>{const s=dI(e,n.traitManagerDataConfig),r=aw(s),{hasDataResolverValue:o,dataResolverValue:i}=s,a=pI(e,t);return{...a,value:i??a.value,disabled:o,labelAs:r.length?"span":void 0,label:c.jsx(fI,{label:a.label,buttons:r})}},K1=(e,t,n)=>Ss(e,t,n),hI=(e,t,n)=>Ss(e,t,n),gI=(e,t,n)=>{const s=Kr(e.getValue({skipResolve:!0})),r=Ss(e,t,n),o={min:e.get("min"),max:e.get("max"),step:e.get("step"),pan:!s,units:s?[]:e.get("units"),onChange:(i,a)=>{const l=a||isNaN(parseFloat(i))?i:parseFloat(i);e.setValue(l,{partial:a})}};return{...r,...o}},cw=(e,t,n)=>{const s=e.get("labelToTitle"),r=Kr(e.getValue({skipResolve:!0})),o=Ss(e,t,n),i={options:e.getOptions().map(a=>{const l=a.labelReact||a.name||a.label||a.value;return dt(a)?{id:a,label:a}:{id:a.id||a.value,title:s?l:a.title,icon:a.icon,label:s?"":l}}),onChange:a=>e.setValue(a),emptyState:r&&e.getValue()||void 0,hideCaret:r};return{...o,...i}},mI=(e,t,n)=>{const{options:s,onChange:r}=cw(e,t,n),o={options:s,onChange:r};return{...Ss(e,t,n),...o}},vI=(e,t,n)=>{const s=e.get("typeProps")||{},r=Kr(e.getValue({skipResolve:!0}));return{...Ss(e,t,n),isContain:!0,hideButton:r,btnLabel:e.get("text"),onOpen(){if(r)return;const i=t==null?void 0:t.Assets;i==null||i.open({select(a){e.setValue(a.getSrc()),i.close()}})},...s}},bI=e=>({children:lw(e.getLabel()||e.get("text")||e.get("labelButton")),onClick:()=>{const t=e.em.Editor,n=e.get("command");dt(n)?t.runCommand(n):n==null||n(t,e)},full:!0}),yI=(e,t,n)=>{const s=Ss(e,t,n),o={value:!!(s.disabled?s.value:e.getValue({useType:!0})),onChange:i=>e.setValue(i)};return{...s,...o}},xI=(e,t,n)=>{const s=Ss(e,t,n),r=e.get("typeProps")||{},o=Kr(e.getValue({skipResolve:!0}));return{language:"css",...r,...s,formatOnMount:!o,onChange:i=>e.setValue(i)}},wI=(e,t,n)=>({...Ss(e,t,n),trait:e}),SI=(e,t,n)=>({...Ss(e,t,n),trait:e}),CI=(e,t,n)=>({...Ss(e,t,n),trait:e,editor:t});function jI(e,t,n={}){var i;const s=e.get("visible"),r=e.getType(),o={traitManagerDataConfig:n.traitManagerDataConfig};if(tt(s)&&s({component:e.target,trait:e})===!1)return null;switch(r){case"text":return c.jsx(ot,{...K1(e,t,o)});case"select":return c.jsx(Le,{...cw(e,t,o)});case"number":return c.jsx(Ne,{...gI(e,t,o)});case"color":return c.jsx(gr,{...hI(e,t,o)});case"checkbox":return c.jsx(Na,{...yI(e,t,o)});case"button":return c.jsx(Ke,{...bI(e)});case"radio":return c.jsx(en,{...mI(e,t,o)});case"code":return c.jsx(pr,{...xI(e,t,o),...n},((i=t==null?void 0:t.getSelected())==null?void 0:i.getId())||"");case"image":case"file":return c.jsx(Ra,{...vI(e,t,o)});case"stack":return c.jsx(aI,{...wI(e,t,o)});case"href":return c.jsx(iI,{...SI(e,t,o)});case"custom":return c.jsx(nI,{...CI(e,t,o)});default:return!!t.Traits.getType(r)?c.jsx(cI,{editor:t,trait:e}):c.jsx(ot,{...K1(e,t,o)})}}const Jf="gs-trait-manager",Z1=({trait:e,isDarkTheme:t,traitManagerDataConfig:n})=>c.jsx(F,{className:K(`${Jf}-field gs-utl-mb-2 gs-utl-w-full`),children:jI(e,e.em.getEditor(),{isDarkTheme:t,traitManagerDataConfig:n})});function EI({traits:e,className:t}){var d,f;const n=ul(),{isDarkTheme:s}=qs(),o=(d=xe().sdkOptions.dataSources)==null?void 0:d.traitManager,i=n.Traits.getTraitsByCategory(e),a=(f=i.find(p=>!p.category))==null?void 0:f.items,l=i.filter(p=>p.category),u=K("gs-utl-text-center");return c.jsx(k,{className:K(Jf,t),col:!0,children:n.getSelected()?e.length?c.jsxs(c.Fragment,{children:[a==null?void 0:a.map(p=>c.jsx(Z1,{trait:p,isDarkTheme:s,traitManagerDataConfig:o},p.id)),l.map(({category:p,items:g},m)=>c.jsx(hr,{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:`${Jf}-category -gs-utl-mx-2`,className:v=>K(yp.itemList({index:m+(a?1:0),open:v,length:l.length})),children:g.map(v=>c.jsx(Z1,{trait:v,isDarkTheme:s,traitManagerDataConfig:o},v.id))},p==null?void 0:p.id))]}):c.jsx(F,{className:u,children:"No properties available"}):c.jsx(F,{className:u,children:n.t("traitManager.empty")})})}const Qf=ce(EI),TI="gs-panel-properties",PI=h.memo(ce(function({className:t,...n}){return c.jsx(ws,{className:M(TI,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(Mf,{children:s=>c.jsx(Qf,{...s})})})})),OI=async({html:e="",css:t="",el:n})=>{const s=`<span style="color: initial; display: inline-block;"><style> body { margin: 0; } ${t}</style>${e}</span>`,r={};if(document.body.attachShadow){const o=n.shadowRoot||n.attachShadow({mode:"open"});o.innerHTML=s}return r},_I=ce(function({rule:t,onSelect:n,onRemove:s,className:r}){const o=h.useRef(null),a=xe().editor,l=Ie(),u=t.getDevice(),d=t.getState(),{isDarkTheme:f}=qs(),[p,g]=h.useState(t.toCSS({allowEmpty:!0})),[m,v]=h.useState(p),b=t.selectorsToString(),x=()=>{a.select(),setTimeout(()=>a.Selectors.select(t)),n==null||n()},y=()=>{a.Css.remove(t),s==null||s()},w=()=>{if(m){const S=a.Parser.parseCss(m)[0];S&&(t.setStyle(S.style),g(m))}};return h.useEffect(()=>{if(o.current){const S=o.current;OI({el:S,html:'<div class="prv-rule">Preview</div>',css:`
|
|
392
327
|
.prv-rule {
|
|
393
328
|
background-color: #fff;
|
|
394
329
|
padding: 5px;
|
|
395
330
|
}
|
|
396
331
|
.prv-rule, ${p}
|
|
397
|
-
`})}},[o,p]),c.jsx(
|
|
332
|
+
`})}},[o,p]),c.jsx(ns,{padding:!1,className:ie("overflow-hidden max-w-full group",r),children:c.jsxs(k,{col:!0,space:"xs",children:[c.jsx(k,{className:ie("bg-checker gjs-p-3 overflow-auto overflow-x-hidden h-20"),justify:"center",items:"center",children:c.jsx("div",{ref:o,className:ie("relative flex items-center justify-center")})}),c.jsxs(k,{className:ie("gjs-p-1 w-full"),col:!0,space:"s",children:[c.jsxs(k,{nowrap:!0,items:"center",space:"xs",full:!0,children:[c.jsx(F,{grow:!0,children:c.jsx("pre",{className:ie("text-xs bg-white/10",B.txt,te.rnd,Ee.xyS),children:b})}),!!u&&u.getWidthMedia()&&c.jsx(F,{children:c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[l.t("deviceManager.device"),": ",c.jsx("b",{children:u.getName()})]}),children:c.jsx(ne,{icon:G.cellphoneLink,size:oe.sx})})}),!!d&&c.jsx(F,{children:c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[l.t("selectorManager.state"),": ",c.jsx("b",{children:d.getLabel()})]}),children:c.jsx(ne,{icon:G.flare,size:oe.sx})})})]}),c.jsxs(k,{nowrap:!0,className:ie(Oe.txtEllips),space:"s",children:[c.jsx(F,{className:ie("group-hover:gs-utl-opacity-100 opacity-0 transition-opacity"),grow:!0,children:c.jsx(Ke,{onClick:x,className:ie("text-sm gjs-mr-auto"),size:"m2",full:!0,children:l.t("select")})}),c.jsx(xs,{overlay:!0,title:!1,padding:!1,buttonAs:"span",handler:c.jsx(St,{title:l.t("selectorManager.showCSS"),children:c.jsx(ne,{icon:G.codeBraces,size:oe.sx})}),children:({close:S})=>c.jsxs(k,{className:ie("relative w-80 h-48"),col:!0,children:[c.jsx(F,{grow:!0,children:c.jsx(pr,{defaultValue:uh(p),onChange:v,language:"css",padding:5,isDarkTheme:f,clean:!0})}),c.jsx(Ke,{className:ie("absolute right-2 bottom-2 text-sm"),variant:"pr",size:"m2",onClick:()=>{w(),S()},children:l.t("update")})]})}),c.jsx(Pu,{onConfirm:y,className:ie("w-48"),children:c.jsx(St,{title:l.t("selectorManager.deleteStyle"),children:c.jsx(ne,{icon:G.delete,size:oe.sx})})})]})]})]},t.cid)})}),AI=ce(function(){const[t]=rh(),n=Li(),s=Ie(),[r,o]=h.useState(""),[i,a]=h.useState(""),u=xe().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!(r&&!di(v.selectorsToString(),r)||i&&((b=v.getDevice())==null?void 0:b.id)!==i)}),m=()=>f(u.Css.getRules(""));return c.jsxs(k,{col:!0,space:"m",children:[c.jsxs(k,{items:"center",space:"m",children:[c.jsx(F,{children:c.jsx(ot,{size:"s",type:"search",value:r,onInput:o,placeholder:`${s.t("selectorManager.searchStyle")}...`})}),c.jsx(F,{children:c.jsx(Le,{includeEmpty:!0,size:"s",value:i,options:p,onChange:a,emptyState:s.t("deviceManager.allDevices"),handlerSelected:v=>c.jsxs(k,{space:"s",items:"center",children:[c.jsx(ne,{icon:G.cellphoneLink,size:oe.sx}),c.jsx("span",{children:v.label})]})})})]}),c.jsx(F,{className:ie("gs-utl-h-[75vh] w-full overflow-auto"),children:g.length?c.jsx(Tu,{data:g,listClassName:ie("grid grid-cols-4 gap-2 gjs-pr-2"),itemContent:(v,b)=>c.jsx(_I,{rule:b,onRemove:m,onSelect:n.close},b.cid)},t):c.jsx(k,{justify:"center",children:s.t("modals.styleCatalog.noStyles")})})]})}),LI=ce(function({selector:t,className:n,removable:s,toggleable:r}){const o=Ie(),i=xe(),[a,l]=h.useState(),[u,d]=h.useState(t.getActive()),f=i.editor,{Selectors:p}=f,g=t.getLabel(),m=c.jsx(ne,{icon:G.dotsVertical,size:oe.sx}),v=()=>{p.removeSelected(t)},b=j=>{a&&p.rename(a,j),l(void 0)},x=()=>{p.duplicateSelected(t)},y=()=>{const j=!t.getActive();d(j),t.setActive(j)},S=[{id:"rename",label:o.t("rename"),action:()=>l(t)},{id:"duplicate",label:o.t("duplicate"),action:x},s&&{id:"delete",label:o.t("delete"),action:v},r&&{id:"active",label:o.t(u?"disable":"enable"),action:y}].filter(Boolean),C=(j,E)=>O=>{j(),tt(E)&&E(O)};return c.jsx(Dr,{className:ie(["gjs-ml-1 gjs-my-1 group overflow-hidden cursor-default relative",B.sel,n]),s:"s",children:c.jsxs(k,{items:"center",children:[c.jsx(F,{className:ie("gjs-mr-4",!a&&!u&&"opacity-50 line-through"),children:c.jsx(yx,{value:g,onChange:b,active:!!a,unstyled:!0})}),c.jsx(k,{className:ie("absolute h-full right-0 transition-opacity",B.sel,B.selBr,te.bl),children:c.jsx(xs,{handler:m,title:!1,padding:!1,fixed:!0,overlay:!0,children:({close:j})=>S.map(E=>c.jsx($i,{className:ie(B.txt),label:E.label,action:C(j,E.action)},E.id))})})]})})}),MI=e=>(e==null?void 0:e.get("groups"))||[],NI=/^\.[a-zA-Z_][\w-]*$/;function $I(e,t={}){const n=e.Css.getAll().filter(s=>MI(s).some(r=>r.startsWith(Uo.globalStyles)));return t.withSingleClass?n.filter(s=>NI.test(s.getSelectorsString())):n}const kI=e=>{const{Selectors:t}=e,n=t.getAll({array:!0});return t.getSelectedAll().reduce((o,i)=>{const a=o.indexOf(i);return a>=0&&o.splice(a,1),o},n).filter(o=>o.isClass())},RI=(e,t)=>{const{sdkGlobalStylesConfig:n}=t,{i18nStore:s}=t.store,o=(n!=null&&n.showInClassSelectors?$I(e,{withSingleClass:!0}):[]).map(a=>{const l=a.getSelectorsString().replace(".","");return{id:l,label:`${s.t("globalStyleManager.globalStyles")}: ${l}`}});return[...kI(e).map(a=>({id:a,label:a.getLabel()})),...o]},II=e=>{var s,r;let t=(s=e==null?void 0:e.selectorsToString)==null?void 0:s.call(e);const n=(r=e==null?void 0:e.getAtRule)==null?void 0:r.call(e);return t&&n&&(t=`${n} {
|
|
398
333
|
${t}
|
|
399
|
-
}`),t},Rn="gs-cmp-selector-manager",Od={},Rx=fe(function(t){var se,de,Se;const{selectedState:n,states:s,setState:r,styleCatalog:o,stateSelector:i}=t,a=ye(),[l,u]=h.useState(!1),[d,f]=h.useState([]),[p,g]=h.useState(Od),{toggleCssPanel:m,isCssPanelActive:b,editor:v,store:x}=ye(),{i18nStore:y,modalStore:w}=x,S=v==null?void 0:v.getSelected(),C=v==null?void 0:v.Styles.getSelected();if(h.useEffect(()=>{if(v&&C&&a){const ne=setTimeout(()=>{let Te=Od;const ke=S==null?void 0:S.get("selectorManager");S&&Ye(ke)&&(Te=ke({editor:v,component:S})),g(Te||Od),f(_8(v,a))});return()=>clearTimeout(ne)}},[S,v,C,a]),!v)return null;const{Selectors:j}=v,E=p.disableClasses,_=p.disableComponent,T=E&&_,P=j.getComponentFirst()&&!_,A=j.getSelectedAll(),M=v.getSelectedAll(),R=s.map(ne=>({id:ne.getName(),label:ne.getLabel()})),F=v.getModel(),L=(se=C==null?void 0:C.getDevice)==null?void 0:se.call(C),B=(de=C==null?void 0:C.getState)==null?void 0:de.call(C),q=N("gs-utl-overflow-hidden",re.b,re.rnd,z.br),H=N(z.bA),$=N("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",re.br,z.br),I=`${z.bgA}`,O=T8(C),V=A.length>0,G=M.length>0,W=V||G,K=P&&G||!P&&!V,J=K?"Components":"Selectors",Y=ne=>y.t(`selectorManager.${ne}`),U=y.t("modals.styleCatalog.title"),Q=()=>w.open({title:U,content:c.jsx(w8,{})});return c.jsxs(k,{className:Rn,gap:"s",col:!0,full:!0,children:[c.jsxs(k,{className:N(`${Rn}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(k,{className:N(`${Rn}__head-start`),items:"center",gap:"s",children:[c.jsx(D,{className:N(`${Rn}__head-title`),children:Y("selection")}),o!==!1&&c.jsx(D,{className:N(`${Rn}__style-catalog`),children:c.jsx(It,{className:"gs-utl-cursor-pointer",onClick:Q,title:U,children:c.jsx(oe,{icon:Z.paletteSwatch,size:le.s})})})]}),!!C&&i!==!1&&!T&&c.jsx(D,{className:`${Rn}__head-end`,children:c.jsx(_e,{size:"s",value:n,options:R,includeEmpty:!0,onChange:r,emptyState:`- ${Y("state")} -`,className:N(n&&z.bA)})})]}),W&&!T?c.jsxs(c.Fragment,{children:[!E&&c.jsxs(k,{className:N(`${Rn}__field-selectors`,q,!K&&H),items:"stretch",gap:"xs",children:[c.jsx(It,{title:Y(V?"applyOnSelector":"noSelectors"),className:N($,!K&&I),onClick:()=>V&&j.setComponentFirst(!1),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(oe,{icon:Z.tag,size:le.sx})})}),c.jsx(D,{grow:!0,children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(_x,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:Y("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:ne=>{ne&&(j.addSelected(ne.id||ne.label),u(!1))}}):c.jsxs(c.Fragment,{children:[G&&c.jsx(bt,{title:Y("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(oe,{icon:Z.plus,size:le.sx})}),A.map(ne=>c.jsx(S8,{selector:ne,removable:G,toggleable:G&&A.filter(Te=>Te.getActive()||Te===ne).length>1},ne.toString()))]})})})]}),!_&&c.jsxs(k,{className:N(`${Rn}__field-components`,q,K&&H),items:"stretch",gap:"xs",children:[c.jsx(It,{title:Y(G?"applyOnComponents":"noComponents"),onClick:()=>G&&j.setComponentFirst(!0),className:N($,K&&I),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(oe,{icon:Z.targetVariant,size:le.sx})})}),c.jsx(D,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:M.map(ne=>c.jsx(Rr,{s:"s",className:N("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",z.cmp),onPointerEnter:()=>F.setHovered(ne),onPointerOut:()=>F.setHovered(),label:ne.getName()},ne.getId()))})})]}),c.jsxs(k,{className:`${Rn}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(It,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:Y("selected")}),c.jsx("pre",{className:N("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",re.rnd,je.xyS),children:O}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:Y("currentSelection")})]}),children:c.jsx(Rr,{className:N(re.b,re.rnd,z.br),s:"xs",nopad:!0,block:!0,children:c.jsx(oe,{icon:Z.target,size:le.sx})})}),c.jsx(D,{className:"gs-utl-text-sm",children:c.jsx(Rr,{className:N(re.b,re.rnd,z.br),s:"xs",nopad:!0,children:c.jsxs(k,{space:"xs",items:"center",nowrap:!0,children:[!!L&&L.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(It,{title:c.jsxs(c.Fragment,{children:[Y("device"),": ",c.jsx("b",{children:L.getName()})]}),children:c.jsx(oe,{icon:Z.cellphoneLink,size:le.sx})}),c.jsx(D,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(It,{title:c.jsxs(c.Fragment,{children:[Y("target"),": ",c.jsx("b",{children:J}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(Se=C==null?void 0:C.selectorsToString)==null?void 0:Se.call(C,{skipState:1})]})]}),children:c.jsx(oe,{icon:K?Z.targetVariant:Z.tag,size:le.sx})}),!!B&&c.jsxs(c.Fragment,{children:[c.jsx(D,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(It,{title:c.jsxs(c.Fragment,{children:[Y("state"),": ",c.jsx("b",{children:B.getLabel()})]}),children:c.jsx(oe,{icon:Z.flare,size:le.sx})})]})]})})}),c.jsx(bt,{title:y.t("toggleCss"),onClick:m,active:b,size:"s",children:c.jsx(oe,{icon:Z.codeBraces,size:le.sx})})]})]}):c.jsxs(k,{className:N(`${Rn}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(D,{className:`${Rn}__empty-state-title`,children:Y("noSelecton")}),c.jsxs("ul",{className:N(`${Rn}__empty-state-list`,"gs-utl-list-disc gs-utl-pl-5 gs-utl-mt-2"),children:[c.jsx("li",{children:Y("selectFromCanvas")}),c.jsx("li",{children:Y("selectFromList")})]})]})]})}),O8="gs-panel-selectors",A8=h.memo(fe(function({className:t,styleCatalog:n,stateSelector:s,...r}){return c.jsx(hs,{className:N(O8,t),...r,children:c.jsx(oy,{children:o=>c.jsx(Rx,{...o,styleCatalog:n,stateSelector:s})})})}));function Cr({label:e,property:t,hasValue:n,empty:s,onClear:r,children:o,shallow:i,row:a,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||!s&&(t==null?void 0:t.hasValue({noParent:!0})),b=!m&&(t==null?void 0:t.hasValue())&&g,v=g==null?void 0:g.getDevice(),x=g==null?void 0:g.getState(),y=g==null?void 0:g.getComponent(),w=()=>r?r():t==null?void 0:t.clear(),S={className:N(d,"gs-utl-text-sm gs-utl-w-full"),col:!a,items:a?"center":void 0,...f},C=N("gs-utl-flex-1",m&&!i&&z.tAo);return t&&!t.isVisible()?null:c.jsxs(k,{gap:"xs",...S,children:[c.jsxs(k,{className:C,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(D,{children:c.jsx(It,{title:l,children:c.jsx(oe,{icon:Z.information,size:le.sx})})}),c.jsx(D,{children:s?c.jsx("span",{children:" "}):p}),!!b&&!i&&c.jsx(It,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N("gs-utl-mb-1"),children:"Value inherited from"}),!!v&&c.jsxs(k,{gap:"s",children:[c.jsx(D,{children:c.jsx(oe,{icon:Z.cellphoneLink,size:le.sx})}),c.jsx(D,{children:c.jsx("b",{children:v.getName()})})]}),c.jsxs(k,{gap:"s",children:[c.jsx(D,{children:c.jsx(oe,{icon:y?Z.targetVariant:Z.tag,size:le.sx})}),c.jsxs(D,{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})]})]})]}),!!x&&c.jsxs(k,{gap:"s",children:[c.jsx(D,{children:c.jsx(oe,{icon:Z.flare,size:le.sx})}),c.jsx(D,{children:c.jsx("b",{children:x.getLabel()})})]})]}),children:c.jsx("div",{className:N("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",z.bgW)})}),m&&!i&&!u&&c.jsx(It,{title:"Clear value",onClick:w,children:c.jsx(oe,{className:Ee.click,icon:Z.close,size:le.s2x})})]}),!!o&&c.jsx(D,{grow:!0,className:"gs-utl-max-w-full",children:o})]})}function Cu(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 N8=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,M8=/,(?![^(]*\))/,Ad=/\s(?![^(]*\))/,L8=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Nd=/^circle|ellipse/i,yh=e=>{var d;const t=[],{name:n,value:s}=Cu(e),[r,...o]=s.split(M8).map(f=>f.trim()).filter(Boolean),i=o.length>1,a=i?r:"",l={type:"none"},u=i?o:[r,...o];if(N8.test(a))l.type="angle",l.value=a;else if(/^to\s/.test(a))l.type="side-or-corner",l.value=a;else if(L8.test(a))l.type="size",l.value=a;else if(Nd.test(a)||/^at\s/.test(a)||/\sat\s/.test(a)){l.type="at",l.value=a;const f=((d=a.match(Nd))==null?void 0:d[0])||"circle";l.shape=f;const p={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,b]=a.replace(Nd,"").trim().split("at").map(v=>v.trim());if(m){const[v,x]=m.split(Ad);p.x=v,p.y=x||v}if(b){const[v,x]=b.split(Ad);g.x=v,g.y=x||v}l.size=p,l.position=g}return u.forEach(f=>{const[p,g]=f.split(Ad);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}},yr=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const r=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(o=>`${o.color} ${o.hint?`${o.hint}%`:""}`.trim()).join(", ");return r?`${n}(${t}, ${r})`:"none"},R8=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),$8="gs-cmp-grad-picker";function k8({className:e,value:t,onChange:n}){var B,q,H;const s=yh(t),[r,o]=h.useState(s.colorStops),[i,a]=h.useState(null),l=h.useRef(null),u=ee($8,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,re.rnd),d=s.name||"linear-gradient",f=d.indexOf("radial")>=0,p=d.indexOf("repeating")>=0,g=s.orientation.value,m=`${parseFloat(`${g}`)||180}`,b=`${parseFloat(`${(B=s.orientation.size)==null?void 0:B.x}`)||0}`,v=`${parseFloat(`${(q=s.orientation.position)==null?void 0:q.x}`)||0}`,x=`${parseFloat(`${(H=s.orientation.position)==null?void 0:H.y}`)||0}`,y=0,w=100,S=($,I=!1)=>{const O=R8($);o(O),n==null||n(yr({name:d,orientation:g,stops:O}),I)},C=($,I=!1)=>{n==null||n(yr({stops:r,name:d,orientation:`${$}deg`}),I)},j=($,I=!1)=>{n==null||n(yr({stops:r,name:d,orientation:`${$}px at ${v}% ${x}%`}),I)},E=($,I=!1)=>{n==null||n(yr({stops:r,name:d,orientation:`${b}px at ${$}% ${x}%`}),I)},_=($,I=!1)=>{n==null||n(yr({stops:r,name:d,orientation:`${b}px at ${v}% ${$}%`}),I)},T=$=>{const I=`${$?"repeating-":""}${f?"radial":"linear"}-gradient`;n==null||n(yr({stops:r,orientation:g,name:I}))},P=$=>{const I=`${p?"repeating-":""}${$?"radial":"linear"}-gradient`;n==null||n(yr({stops:r,orientation:$?"100px at 50% 50%":"90deg",name:I}))};h.useEffect(()=>{if(!i)return;const $=parseFloat(`${i.stop.hint}`),I=V=>{let W=(V.clientX-i.x)*100;W=W/i.w,W=$+W,W=W<y?y:W,W=W>w?w:W,i.stop.hint=parseInt(`${W}`,10),S(r,!0)},O=()=>{a(null),S(r)};return window.addEventListener("pointermove",I),window.addEventListener("pointerup",O),()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",O),O()}},[i]);const A=($,I)=>{const O=l.current;a({stop:I,w:(O==null?void 0:O.clientWidth)||0,h:(O==null?void 0:O.clientHeight)||0,x:$.clientX,y:$.clientY})},M=$=>{const I=l.current,O=(I==null?void 0:I.clientWidth)||0,V=(I==null?void 0:I.clientHeight)||0,G=$.nativeEvent.offsetX-((I==null?void 0:I.clientLeft)||0),W=$.nativeEvent.offsetY-((I==null?void 0:I.clientTop)||0),K=G/O*100,J=document.createElement("canvas"),Y=J.getContext("2d");if(!Y)return;J.width=O,J.height=V;const U=Y.createLinearGradient(0,0,O,V);r.forEach(ne=>U.addColorStop(parseFloat(`${ne.hint}`)/100,ne.color)),Y.fillStyle=U,Y.fillRect(0,0,J.width,J.height),J.style.background="black";const Q=Y.getImageData(G,W,1,1).data,se=Q[3]?(100/255*Q[3]/100).toFixed(2):0,de=`rgba(${Q[0]}, ${Q[1]}, ${Q[2]}, ${se})`,Se=de==="rgba(0, 0, 0, 0)"?"#000":de;S([...r,{color:Se,hint:K}])},R=$=>{S(r.filter(I=>I!==$))},F=($,I,O)=>{I&&($.color=I),S(r,O)},L=$=>(i==null?void 0:i.stop)===$;return c.jsxs(k,{className:u,col:!0,children:[!!(i!=null&&i.stop)&&c.jsx("div",{className:ee("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:ee("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:ee("bg-checker h-8",re.rnd),children:c.jsx("div",{ref:l,className:ee("w-full h-full cursor-cross",re.b,re.rnd,z.br),style:{backgroundImage:yr({stops:r})},onClick:M})}),r.map(($,I)=>c.jsxs("div",{className:ee("absolute top-0 h-full"),style:{left:`${$.hint}%`},children:[c.jsx("div",{className:ee("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>R($),children:c.jsx(oe,{icon:Z.close,size:le.s3x})}),c.jsx("div",{onPointerDown:O=>A(O,$),className:ee("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",re.br,re.bl,L($)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:ee("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(Wy,{value:$.color,onChange:(O,V)=>F($,O,V),className:ee("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},I))]}),c.jsxs(k,{space:"s",items:"center",children:[c.jsx(D,{grow:!0,children:c.jsx(wa,{label:"Repeat",value:p,onChange:T})}),c.jsx(D,{grow:!0,children:c.jsx(wa,{label:"Radial",value:f,onChange:P})})]}),f?c.jsxs(k,{space:"s",col:!0,children:[c.jsx(D,{children:c.jsx(k,{space:"s",items:"center",children:c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"S",size:"s",value:b,onChange:j,valueUnit:"px",units:["px"]})})})}),c.jsx(D,{children:c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"X",size:"s",value:v,onChange:E,valueUnit:"%",units:["%"]})}),c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"Y",size:"s",value:x,onChange:_,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(k,{space:"s",items:"center",nowrap:!0,children:c.jsx(D,{grow:!0,children:c.jsx(Ne,{pan:"A",size:"s",value:m,onChange:C,valueUnit:"deg",units:["deg"]})})})]})}const V8="gs-sm-custom-type",I8=fe(function({property:t,editor:n}){const s=h.useRef(null),r=t.getType(),o=n.StyleManager,i=o.getType(r),a=i==null?void 0:i.view;return h.useEffect(()=>{const l=s.current;if(a&&l){const u=new a({model:t,config:o.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[a,t,n]),a&&c.jsx("div",{className:V8,ref:s})});function $x(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const L1="gs-cmp-style-field";function kx({property:e,sector:t,styleManagerDataConfig:n,fieldProps:s}){const r=N(L1,`${L1}__${e.id}`),o={sector:t,styleManagerDataConfig:n},i=t.em.getEditor(),a=e.getType();switch(a){case"selectFont":return c.jsx(bu,{className:r,...Fx(e,o),...s});case"number":case"slider":case"integer":return c.jsx(Ne,{className:r,...nt(e,o),...s});case"color":return c.jsx(lr,{className:r,...To(e,o),...s});case"select":return c.jsx(_e,{className:r,...jt(e,o),...s});case"radio":return c.jsx(Yt,{className:r,..._s(e,o),...s});case"file":return c.jsx(ja,{className:r,...a9(e,o),...s});case"composite":return c.jsx(fn,{className:r,property:e,corners:e.get("corners"),generic:e.get("generic"),...o});case"stack":{const l=e.getProperties();return c.jsx(Es,{className:r,...jr(e,o),children:c.jsx(Bs,{properties:l,sector:t})})}default:{const l=i.StyleManager.getType(a);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(I8,{editor:i,property:e}):c.jsx(tt,{className:r,...xh(e,o)})}}}const R1="gs-cmp-style-prop-row";function Bs({properties:e,sector:t,styleManagerDataConfig:n}){const s={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(r=>{const o=r.getId(),i=N(R1,`${R1}__${o}`,$x(r)&&"gs-utl-col-span-full");return r.isVisible()?c.jsx("div",{className:i,children:c.jsx(kx,{property:r,...s})},o):null})})}function D8({sector:e,styleManagerDataConfig:t}){const n=Ya(),s=e.getProperties().filter(r=>r.isVisible()).map(r=>(n.sdkAddFonts&&r.getId()==="font-family"&&r.set("type","selectFont"),r));return c.jsx("div",{className:N("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(Bs,{properties:s,sector:e,styleManagerDataConfig:t})})}const H8="gs-cmp-sector-row";function be({className:e,children:t,bottom:n,separator:s,separatorTop:r,property:o,...i}){const a=c.jsx("div",{className:ee("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",re.bb,z.br)}),l=ee(H8,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(o)?o:[o]).filter(Boolean);return(u.length?u.some(f=>f.isVisible()):!0)?c.jsxs(c.Fragment,{children:[r&&a,c.jsx(k,{className:l,nowrap:!0,...i,children:t}),s&&a]}):null}function Bi(e,t,n={}){const s=e.getType(),{compact:r=!1,sector:o,styleManagerDataConfig:i}=n,a=e.getParent(),l={sector:o,styleManagerDataConfig:i},u=e.getDefaultValue();if(s==="select"){const f={property:a.getName()};return c.jsx(_e,{...jt(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 s==="color"?c.jsx(lr,{...To(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(Ne,{...nt(e,l),...r?{pan:e.getLabel()[0]}:{},...t?{value:t.same?e.getValue({noDefault:!0}):"",valueUnit:t.same?e.getUnit():"",placeholder:t.same?u:"Custom",onChange:(d,f)=>t.all.map(p=>p.upValue(d,{partial:f})),onChangeUnit:d=>t.all.map(f=>f.upUnit(d))}:{},label:void 0})}const Il="gs-cmp-style-prop-composite";function fn({className:e,property:t,sector:n,styleManagerDataConfig:s,corners:r,compact:o,generic:i,children:a,options:l}){const[u,d]=h.useState(null);if(!(t!=null&&t.isVisible()))return null;const f={id:"custom",label:c.jsx(oe,{icon:Z.borderStyle,size:le.s}),title:"Custom"},p=[{id:"all",label:c.jsx(oe,{icon:Z.borderAllVariant,size:le.s}),title:"All"},f],g=t.isDetached(),m=t.getProperties(),b=m.length,[v,x,y,w]=m,S=v.getFullValue(),j=m.map(H=>H.getFullValue()).every(H=>H===S),E=u!==null?u:j||l?"all":f.id,_=l?[...l,f]:[],T=t.getFullValue(),P=_.some(H=>H.id===T),A=E===f.id||(l?!P:!1)||!!i,M={compact:o,sector:n,styleManagerDataConfig:s},R=c.jsx(Cr,{property:o?null:v,shallow:!g,children:Bi(v,null,M)}),F=c.jsx(Cr,{property:o?null:x,shallow:!g,children:Bi(x,null,M)}),L=!!y&&c.jsx(Cr,{property:o?null:y,shallow:!g,children:Bi(y,null,M)}),B=!!w&&c.jsx(Cr,{property:o?null:w,shallow:!g,children:Bi(w,null,M)}),q=o?{label:t.getLabel()}:{property:t};return c.jsxs(k,{className:ee(Il,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(be,{className:`${Il}__main`,children:c.jsx(Cr,{...q,children:!i&&c.jsx(be,{bottom:"0",children:a!==void 0?a:l?c.jsx(c.Fragment,{children:c.jsx(D,{grow:!0,children:c.jsx(Yt,{size:"s",options:_,value:A?f.id:T,onChange:H=>{H===f.id?d(H):(t.upValue(H),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(D,{grow:!0,children:Bi(v,{same:j,all:m},M)}),c.jsx(D,{grow:!0,children:c.jsx(Yt,{size:"s",options:p,value:E,onChange:d})})]})})})}),A&&c.jsx(be,{col:!0,className:ee(`${Il}__details`,"gjs-px-2 gjs-py-1",z.bgH2,re.rnd,re.b,z.br),children:i?c.jsx("div",{className:ee(`${Il}__props`,"grid grid-cols-2 gap-2"),children:m.map(H=>c.jsx(Cr,{property:H,shallow:!g,className:ee($x(H)&&"col-span-full"),children:c.jsx(kx,{property:H,...M,fieldProps:{label:void 0}})},H.getId()))}):b===2?c.jsx(c.Fragment,{children:c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:R}),c.jsx(D,{grow:!0,children:F})]})}):b===3?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:R}),c.jsx(D,{grow:!0,children:F})]}),c.jsx(k,{space:"s",children:c.jsx(D,{grow:!0,children:L})})]}):r?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:R}),c.jsx(D,{grow:!0,children:F})]}),c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:B}),c.jsx(D,{grow:!0,children:L})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(k,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:R}),c.jsxs(k,{space:"s",children:[c.jsx(D,{grow:!0,children:B}),c.jsx(D,{grow:!0,children:F})]}),c.jsx(k,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:L})]})})]})}var Or=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(Or||{});const tc="background-image",Ns="__background-type",ua=tc,Vx="https://placehold.co/150/777/white.png?text=IMAGE",Vf="50px",F8={[Ns]:"image","background-image":`url("${Vx}")`,"background-size":`${Vf} ${Vf}`,"background-repeat":"repeat","background-position":"0px 0px"},B8=e=>(e.includes("gradient(")?yh(e).colorStops[0].color:e)||"";function z8({sector:e,styleManagerDataConfig:t}){var S;const n=Ja(),s=e.getProperty("background"),r=s.getProperty(Ns),o=s.getProperty("background-image"),i=s.getProperty("background-position"),a=s.getProperty("background-size"),l=e.getProperty("background-color"),u=e.getProperty("background-clip"),d={sector:e,styleManagerDataConfig:t},f=[s,l,u].map(C=>C==null?void 0:C.id),p=e.getProperties().filter(C=>!f.includes(`${C.id}`)),g=((S=s.getSelectedLayer())==null?void 0:S.getIndex())||-1,m=r==null?void 0:r.getValue(),b=m==="image",v=o.getValue(),x=()=>{const C=n.Assets;C.open({select(j){const E=j.getSrc();o.upValue(`url("${E}")`),C.close()}})},y=C=>{let j="none",E="100%";C==="image"?(j=`url("${Vx}")`,E=Vf):C==="gradient"?j="linear-gradient(90deg, black 10%, white 90%)":C==="color"&&(j="rgba(0, 0, 0, 0.5)"),o.upValue(j),r.upValue(C),i.upValue("0 0"),a.upValue(`${E} ${E}`)},w=o9(r,[{id:"image",label:c.jsx(oe,{icon:Z.image,size:le.s})},{id:"gradient",label:c.jsx(oe,{icon:Z.gradientVertical,size:le.s})},{id:"color",label:c.jsx(oe,{icon:Z.checkboxBlank,size:le.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(be,{property:s,separator:!0,children:c.jsxs(Es,{...jr(s,d,F8),previewStyle:C=>s.getStyleFromLayer(C,{camelCase:!0}),children:[c.jsx(be,{children:c.jsx(Yt,{..._s(r,d),options:w,onChange:y,label:void 0})}),c.jsx(be,{children:c.jsxs(Cr,{children:[b&&c.jsx(ja,{value:Cu(v).value,onOpen:x}),m==="color"&&c.jsx(lr,{...To(o,d),value:B8(v),label:void 0}),m==="gradient"&&c.jsx(k8,{value:v,onChange:(C,j)=>o.upValue(C,{partial:j})},g)]})}),b&&c.jsxs(c.Fragment,{children:[c.jsx(be,{col:!0,children:c.jsx(fn,{property:i,...d})}),c.jsx(be,{col:!0,children:c.jsx(fn,{property:a,...d})}),c.jsxs(be,{children:[c.jsx(_e,{...jt(s.getProperty("background-repeat"),{sector:e})}),c.jsx(_e,{...jt(s.getProperty("background-attachment"),{sector:e})})]}),c.jsx(be,{children:c.jsx(_e,{...jt(s.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(be,{property:l,children:c.jsx(lr,{...To(l,d)})}),c.jsx(be,{property:u,children:c.jsx(_e,{...jt(u,d)})}),p.length>0&&c.jsx(Bs,{properties:p,...d})]})}function U8({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),s=e.getProperty("border-width"),r=e.getProperty("border-style"),o=e.getProperty("border-color"),i={sector:e,styleManagerDataConfig:t},a=[n,s,r,o].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!a.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(fn,{property:n,corners:!0,...i}),c.jsx(fn,{property:s,...i}),c.jsx(fn,{property:r,...i}),c.jsx(fn,{property:o,...i}),l.length>0&&c.jsx(Bs,{properties:l,...i})]})}const ro=e=>gu({value:parseFloat(e),min:-3,max:3}),Md=(e,t="filter",n)=>{const s=e.getProperty(`${t}-value`),r=e.getProperty(`${t}-name`).getOption()||{},o=r.units||[],i=s.getUnit(),a=ER(i,o)?i:o[0];return{...nt(s,n),units:o,valueUnit:a,onChange:(l,u)=>{s.upValue(l,{partial:u,units:o,min:r.min,max:r.max})}}},$1=(e,t,n,s)=>{const r=e.getProperty(`${t}-name`),o=e.getProperty(`${t}-value`);return{...jt(r,n,s),onChange:i=>{r.upValue(i),o.upValue("")}}},W8={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function G8({sector:e,styleManagerDataConfig:t}){const n=Re(),s=_=>n.t(`styleManager.effects.${_}`),r=e.getProperty("box-shadow"),o=e.getProperty("text-shadow"),i=e.getProperty("filter"),a=e.getProperty("backdrop-filter"),l=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),f=e.getProperty("backface-visibility"),p=e.getProperty("perspective"),g=e.getProperty("transform-style"),m=e.getProperty("opacity"),b=e.getProperty("mix-blend-mode"),v=e.getProperty("cursor"),x=e.getProperty("transform-origin"),y=e.getProperty("overflow"),w={sector:e,styleManagerDataConfig:t},S=[r,o,i,a,l,u,d,f,p,g,m,b,v,x,y].map(_=>_==null?void 0:_.id),C=e.getProperties().filter(_=>!S.includes(`${_.id}`)),j=_=>{const{boxShadowH:T,boxShadowV:P,boxShadowBlur:A,boxShadowColor:M,boxShadowSpread:R,boxShadowType:F}=_.getValues({camelCase:!0}),L=ro(T),B=ro(P),q=ro(A),H=ro(R),$=`${L}px ${B}px ${q}px ${H}px ${M} ${F}`.trim();return c.jsxs(k,{space:"s",items:"center",children:[c.jsxs(D,{grow:!0,children:[T," ",P," ",A," ",R]}),c.jsx(D,{children:c.jsx("div",{className:ee("w-4 h-4 gjs-bg-white",re.b,re.rnd),style:{boxShadow:$}})})]})},E=_=>{const{textShadowH:T,textShadowV:P,textShadowBlur:A,textShadowColor:M}=_.getValues({camelCase:!0}),R=ro(T),F=ro(P),L=ro(A),B=`${R}px ${F}px ${L}px ${M}`.trim();return c.jsxs(k,{space:"s",items:"center",children:[c.jsxs(D,{grow:!0,children:[T," ",P," ",A]}),c.jsx(D,{children:c.jsx("div",{className:ee("w-4 h-4 gjs-bg-white",re.b,re.rnd),style:{boxShadow:B}})})]})};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:[m,b],children:[c.jsx(Ne,{...nt(m,w)}),c.jsx(_e,{...jt(b,w)})]}),c.jsx(be,{property:v,separator:!0,children:c.jsx(_e,{...jt(v,w)})}),c.jsx(be,{property:r,separator:!0,children:c.jsxs(Es,{...jr(r,w),renderItem:j,children:[c.jsx(be,{children:c.jsx(Yt,{..._s(r.getProperty("box-shadow-type"),w),label:""})}),c.jsxs(be,{children:[c.jsx(Ne,{...nt(r.getProperty("box-shadow-h"),w),label:s("boxShadow.xOffset")}),c.jsx(Ne,{...nt(r.getProperty("box-shadow-v"),w),label:s("boxShadow.yOffset")})]}),c.jsxs(be,{children:[c.jsx(Ne,{...nt(r.getProperty("box-shadow-blur"),w),label:s("boxShadow.blur")}),c.jsx(Ne,{...nt(r.getProperty("box-shadow-spread"),w),label:s("boxShadow.spread")})]}),c.jsx(be,{children:c.jsx(lr,{...To(r.getProperty("box-shadow-color"),w),label:s("boxShadow.color")})})]})}),c.jsx(be,{property:o,separator:!0,children:c.jsxs(Es,{...jr(o,w,W8),renderItem:E,children:[c.jsxs(be,{children:[c.jsx(Ne,{...nt(o.getProperty("text-shadow-h"),w),label:s("textShadow.xOffset")}),c.jsx(Ne,{...nt(o.getProperty("text-shadow-v"),w),label:s("textShadow.yOffset")})]}),c.jsx(be,{children:c.jsx(Ne,{...nt(o.getProperty("text-shadow-blur"),w),label:s("textShadow.blur")})}),c.jsx(be,{children:c.jsx(lr,{...To(o.getProperty("text-shadow-color"),w),label:s("textShadow.color")})})]})}),c.jsx(be,{property:i,separator:!0,children:c.jsx(Es,{...jr(i,w,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(_e,{...$1(i,"filter",w),label:s("filter.type")}),c.jsx(Ne,{...Md(i,void 0,w),label:s("filter.value")})]})})}),c.jsx(be,{property:a,separator:!0,children:c.jsx(Es,{...jr(a,w,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(be,{children:[c.jsx(_e,{...jt(a.getProperty("backdrop-filter-name"),w),label:s("backdropFilter.type")}),c.jsx(Ne,{...Md(a,"backdrop-filter",w),label:s("backdropFilter.value")})]})})}),c.jsx(be,{property:l,separator:!0,children:c.jsxs(Es,{...jr(l,w),children:[c.jsx(be,{children:c.jsx(_e,{...jt(l.getProperty("transition-property"),w),label:s("transition.type")})}),c.jsx(be,{children:c.jsx(_e,{...jt(l.getProperty("transition-timing-function"),w),label:s("transition.easing")})}),c.jsxs(be,{children:[c.jsx(Ne,{...nt(l.getProperty("transition-duration"),w),label:s("transition.duration")}),c.jsx(Ne,{...nt(l.getProperty("transition-delay"),w),label:s("transition.delay")})]})]})}),c.jsx(be,{property:u,separator:!0,children:c.jsx(Es,{...jr(u,w),children:c.jsxs(be,{children:[c.jsx(_e,{...$1(u,"transform",w),label:s("transform.type")}),c.jsx(Ne,{...Md(u,"transform",w),label:s("transform.value")})]})})}),c.jsx(fn,{property:x,...w}),c.jsx(fn,{property:y,...w}),c.jsx(be,{property:f,children:c.jsx(Yt,{..._s(f,w)})}),c.jsx(be,{property:[p,g,d],separatorTop:!0,children:s("childrenTransform")}),c.jsxs(be,{property:[p,g],children:[c.jsx(Ne,{...nt(p,w)}),c.jsx(Yt,{..._s(g,w)})]}),c.jsx(fn,{property:d,...w}),C.length>0&&c.jsx(Bs,{properties:C,...w})]})}function q8(e,t){return e.indexOf(t)>=0}const ht=le.s,Dl="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",Hl="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",Fl="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",k1="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",V1="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",K8="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",Ld="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function Y8({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),s=Re(),[r,o]=h.useState({}),[i,a]=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"),b=e.getProperty("order"),v=e.getProperty("gap"),x=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},w=[l,u,d,f,p,g,m,b,v,x].map(H=>H.id),S=e.getProperties().filter(H=>!w.includes(`${H.id}`)),C=H=>s.t(`styleManager.layout.${H}`),j=l.getValue(),E=j==="flex",_=(i.display||"").indexOf("flex")>=0,T=u.getValue(),P=T.indexOf("reverse")>=0,A=!q8(["column","column-reverse"],T),M=[{id:"row",label:c.jsx(oe,{icon:Z.arrowRight,size:le.sx}),title:C("direction.title.row")},{id:"row-reverse",label:c.jsx(oe,{icon:Z.arrowRight,size:ht,horizontal:!0}),title:C("direction.title.row-reverse")},{id:"column",label:c.jsx(oe,{icon:Z.arrowDown,size:le.sx}),title:C("direction.title.column")},{id:"column-reverse",label:c.jsx(oe,{icon:Z.arrowDown,size:ht,vertical:!0}),title:C("direction.title.column-reverse")}],R=[{id:"flex-start",title:C("justify.title.start"),label:c.jsx(oe,{icon:Dl,size:ht,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:C("justify.title.center"),label:c.jsx(oe,{icon:Hl,size:ht,rotate:A?0:90})},{id:"flex-end",title:C("justify.title.end"),label:c.jsx(oe,{icon:Fl,size:ht,rotate:A?0:90,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:C("justify.title.spaceBetween"),label:c.jsx(oe,{icon:k1,size:ht,rotate:A?0:90})},{id:"space-around",title:C("justify.title.spaceAround"),label:c.jsx(oe,{icon:V1,size:ht,rotate:A?0:90})},{id:"space-evenly",title:C("justify.title.spaceEvenly"),label:c.jsx(oe,{icon:K8,size:ht,rotate:A?0:90})}],F=[{id:"stretch",title:C("align.title.stretch"),label:c.jsx(oe,{icon:Ld,size:ht,rotate:A?0:90})},{id:"flex-start",title:C("align.title.start"),label:c.jsx(oe,{icon:Dl,size:ht,rotate:A?90:0})},{id:"center",title:C("align.title.center"),label:c.jsx(oe,{icon:Hl,size:ht,rotate:A?90:0})},{id:"flex-end",title:C("align.title.end"),label:c.jsx(oe,{icon:Fl,size:ht,rotate:A?90:0})}],L=[{id:"flex-start",title:C("alignContent.title.start"),label:c.jsx(oe,{icon:Dl,size:ht,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"center",title:C("alignContent.title.center"),label:c.jsx(oe,{icon:Hl,size:ht,rotate:A?90:0})},{id:"flex-end",title:C("alignContent.title.end"),label:c.jsx(oe,{icon:Fl,size:ht,rotate:A?90:0,horizontal:A&&P,vertical:!A&&P})},{id:"space-between",title:C("alignContent.title.spaceBetween"),label:c.jsx(oe,{icon:k1,size:ht,rotate:A?90:0})},{id:"space-around",title:C("alignContent.title.spaceAround"),label:c.jsx(oe,{icon:V1,size:ht,rotate:A?90:0})},{id:"stretch",title:C("alignContent.title.stretch"),label:c.jsx(oe,{icon:Ld,size:ht,rotate:A?0:90})}],B=[{id:"auto",title:C("alignSelf.title.auto"),label:c.jsx(oe,{icon:Z.close,size:ht})},{id:"flex-start",title:C("alignSelf.title.start"),label:c.jsx(oe,{icon:Dl,size:ht,rotate:90})},{id:"center",title:C("alignSelf.title.center"),label:c.jsx(oe,{icon:Hl,size:ht,rotate:90})},{id:"flex-end",title:C("alignSelf.title.end"),label:c.jsx(oe,{icon:Fl,size:ht,rotate:90})},{id:"stretch",title:C("alignSelf.title.stretch"),label:c.jsx(oe,{icon:Ld,size:ht,rotate:0})}],q=[{id:"0 0 auto",label:c.jsx(oe,{icon:Z.close,size:ht}),title:C("flex.title.auto")},{id:"1 1 0%",label:c.jsx(oe,{icon:Z.unfoldMoreHorizontal,size:ht,rotate:90}),title:C("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(oe,{icon:Z.unfoldLessHorizontal,size:ht,rotate:90}),title:C("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:H}=n,$=()=>{const O=n.getSelected();let V={},G={};if(O){const W=O.getEl();if(W){V=window.getComputedStyle(W);const K=W.parentElement;K&&(G=window.getComputedStyle(K))}}o(V),a(G)},I=H.events.target;return n.on(I,$),$(),()=>n.off(I,$)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(_e,{...jt(l,y),...If,tip:C(`display.tips.${j}`)})}),E&&c.jsxs(c.Fragment,{children:[c.jsx(be,{children:c.jsx(Yt,{..._s(u,y),options:M})}),c.jsx(be,{children:c.jsx(Yt,{..._s(d,y),options:R})}),c.jsx(be,{children:c.jsx(Yt,{..._s(f,y),options:F})}),c.jsx(be,{children:c.jsx(fn,{property:v,...y})}),c.jsx(be,{children:c.jsx(_e,{...jt(p,y),...If})}),p.getValue()!=="nowrap"&&c.jsx(be,{children:c.jsx(Yt,{..._s(g,y),options:L})})]}),_&&c.jsxs(c.Fragment,{children:[c.jsx(be,{separatorTop:!0,children:C("flexChild")}),c.jsx(be,{children:c.jsx(fn,{property:x,options:q,...y})}),c.jsx(be,{children:c.jsx(Yt,{..._s(m,y),options:B})}),c.jsx(be,{children:c.jsx(Ne,{...nt(b,{sector:e,styleManagerDataConfig:t})})})]}),S.length>0&&c.jsx(Bs,{properties:S,...y})]})}const Z8=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function X8({sector:e,styleManagerDataConfig:t}){var x;const n=Re(),s=e.getProperty("position"),r=s.getValue(),o=e.getProperty("top"),i=e.getProperty("right"),a=e.getProperty("bottom"),l=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},f=y=>n.t(`styleManager.position.${y}`),p=[s,o,i,a,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!p.includes(`${y.id}`)),m=Z8.map(y=>({id:y,label:f(`presets.options.${y}`)})),b=["absolute","fixed"].includes(r),v=y=>{let w="auto",S="auto",C="auto",j="auto";switch(y){case"topLeft":w="0%",j="0%";break;case"topRight":w="0%",S="0%";break;case"bottomLeft":C="0%",j="0%";break;case"bottomRight":C="0%",S="0%";break;case"left":w="0%",C="0%",j="0%";break;case"right":w="0%",C="0%",S="0%";break;case"bottom":j="0%",C="0%",S="0%";break;case"top":j="0%",w="0%",S="0%";break;case"full":j="0%",w="0%",S="0%",C="0%";break}o.upValue(w),i.upValue(S),a.upValue(C),l.upValue(j)};return c.jsxs(c.Fragment,{children:[c.jsxs(be,{property:s,children:[c.jsx(_e,{...jt(s,d),tip:f(`tips.${(x=s.getOption())==null?void 0:x.id}`),...If}),b&&c.jsx(D,{children:c.jsx(It,{title:f("presets.title"),children:c.jsx(_e,{options:m,onChange:v,emptyState:"P",size:"s",caret:"",value:!0})})})]}),r!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(be,{col:!0,children:[c.jsx(k,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...nt(o,d)})}),c.jsxs(k,{gap:"s",children:[c.jsx(D,{grow:!0,children:c.jsx(Ne,{...nt(l,d)})}),c.jsx(D,{grow:!0,children:c.jsx(Ne,{...nt(i,d)})})]}),c.jsx(k,{className:ee("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...nt(a,d)})})]}),c.jsx(be,{children:c.jsx(Ne,{...nt(u,d)})})]}),g.length>0&&c.jsx(Bs,{properties:g,...d})]})}function J8({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),s=e.getProperty("min-width"),r=e.getProperty("max-width"),o=e.getProperty("height"),i=e.getProperty("min-height"),a=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,s,r,o,i,a].map(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,o],children:[c.jsx(Ne,{...nt(n,l)}),c.jsx(Ne,{...nt(o,l)})]}),c.jsxs(be,{property:[s,i],children:[c.jsx(Ne,{...nt(s,l)}),c.jsx(Ne,{...nt(i,l)})]}),c.jsxs(be,{property:[r,a],children:[c.jsx(Ne,{...nt(r,l)}),c.jsx(Ne,{...nt(a,l)})]}),d.length>0&&c.jsx(Bs,{properties:d,...l})]})}function Q8({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),s=e.getProperty("margin"),r={sector:e,styleManagerDataConfig:t},o=[n,s].map(a=>a==null?void 0:a.id),i=e.getProperties().filter(a=>!o.includes(`${a.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(fn,{property:n,...r}),c.jsx(fn,{property:s,...r}),i.length>0&&c.jsx(Bs,{properties:i,...r})]})}function e9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),s=e.getProperty("color"),r=e.getProperty("font-size"),o=e.getProperty("font-weight"),i=e.getProperty("line-height"),a=e.getProperty("letter-spacing"),l=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),f=e.getProperty("text-transform"),p=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},b=[n,s,r,o,i,a,l,u,d,f,p,g].map(y=>y==null?void 0:y.id),v=e.getProperties().filter(y=>!b.includes(`${y.id}`)),{sdkAddFonts:x}=Ya();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(be,{property:n,children:x?c.jsx(bu,{...Fx(n,m)}):c.jsx(_e,{...jt(n,m)})}),!!s&&c.jsx(be,{property:s,children:c.jsx(lr,{...To(s,m)})}),c.jsxs(be,{property:[r,o],children:[!!r&&c.jsx(Ne,{...nt(r,m)}),!!o&&c.jsx(_e,{...jt(o,m)})]}),c.jsxs(be,{property:[i,a],children:[!!i&&c.jsx(Ne,{...nt(i,m)}),!!a&&c.jsx(Ne,{...nt(a,m)})]}),c.jsxs(be,{property:[l,u],children:[!!l&&c.jsx(_e,{...jt(l,m)}),!!u&&c.jsx(_e,{...jt(u,m)})]}),c.jsxs(be,{property:[f,p],children:[!!f&&c.jsx(_e,{...jt(f,m)}),!!p&&c.jsx(_e,{...jt(p,m)})]}),c.jsxs(be,{property:[g,d],children:[!!g&&c.jsx(_e,{...jt(g,m)}),!!d&&c.jsx(_e,{...jt(d,m)})]}),v.length>0&&c.jsx(Bs,{properties:v,...m})]})}const If={row:!0,classNameLabel:"gs-utl-w-full"},t9=({property:e,skipClear:t,label:n,afterLabelButtons:s=[]})=>c.jsxs(k,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(D,{grow:!1,children:c.jsx(Cr,{property:e,skipClear:t,label:n})}),!!s.length&&c.jsx(k,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:s.map((r,o)=>c.jsx(bt,{...r},o))})]}),Ix="gs-style-manager",_c=`${Ix}-sector`,n9=`${_c}-header`,s9=`${_c}-content`,Dx=(e,t=0,n=!0)=>N(n9,z.bgH2,je.xyS,z.br,t&&re.bt,(e||n)&&re.bb),r9=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),o9=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),rl=(e,t)=>{const n=i9(e,t),s=Nx(n),{hasDataResolverValue:r}=n,{label:o}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:r,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:s.length?"span":void 0,label:c.jsx(t9,{property:e,skipClear:r,label:o,afterLabelButtons:s})}}},xh=(e,t)=>{const{connectDataSources:n,commonProps:s}=rl(e,t);return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(r,o)=>e.upValue(r,{partial:o})}},Hx=(e,t,n)=>{const{connectDataSources:s,commonProps:r}=rl(e,t),{hasDataResolverValue:o,initialDataValue:i}=s;return{fieldProps:{...r,value:o?i:e.getValue(),options:r9(e,n??{}),onChange:a=>e.upValue(a)},connectDataSources:s}},_s=(e,t,n)=>Hx(e,t,n).fieldProps,jt=(e,t,n)=>{const{fieldProps:s,connectDataSources:r}=Hx(e,t,n),{hasDataResolverValue:o}=r,i=o?e.getValue()||" ":s.emptyState;return{...s,emptyState:i,hideCaret:o}},Fx=(e,t)=>{const{commonProps:n,connectDataSources:s}=rl(e,t),r=s.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:r,hideCaret:s.hasDataResolverValue,value:s.dataResolverValue??e.getValue(),onChange:o=>e.upValue(o)}},jr=(e,t,n={})=>{const{connectDataSources:s,commonProps:r}=rl(e,t),{hasDataResolverValue:o,dataResolverValue:i}=s;return{...r,title:e.getLabel(),emptyState:o?i:void 0,titleAdd:`Add new ${e.getLabel()}`,items:o?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:a=>e.getLayerLabel(a),add:o?void 0:()=>e.addLayer(n,{at:0}),select:a=>e.selectLayer(a),remove:a=>e.removeLayer(a),move:(a,l=0)=>e.moveLayer(a,l)}},nt=(e,t)=>{const{connectDataSources:n,commonProps:s}=rl(e,t),{hasDataResolverValue:r}=n;return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,i)=>e.upValue(o,{partial:i}),valueUnit:e.getUnit(),pan:!r,units:r?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:o=>e.upUnit(o)}};function i9(e,t){const{styleManagerDataConfig:n=!1,sector:s}=t,r=e.em.getEditor(),{Styles:o}=r,i=r.getSelected(),a=o.getSelectedAll(),l=o.getSelected();let u=!1;n===!0?u=!0:i&&ur(n)&&Ye(n.enable)&&(u=n.enable({property:e,sector:s,component:i,editor:r}));const d=e.getName(),f=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",p=Hr(f),g=i==null?void 0:i.collectionsStateMap;return{hasDataResolverValue:p,dataResolverValue:p?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:f,handleDataValueChange:m=>{a.forEach(b=>{b.addStyle({[d]:m})})},handleValueClear:()=>{a.forEach(m=>{const b=m.getStyle()[d]??"";m.addStyle({[d]:b})})},editor:r,additionalSources:g}}const To=(e,t)=>xh(e,t),a9=(e,t)=>{const{label:n,...s}=xh(e,t);return{...s,label:n,isContain:e.get("contain")??!0,hideButton:s.disabled,inputField:e.get("inputField"),onOpen(){const r=e.em.Assets;r.open({select(o){e.upValue(o.getSrc()),r.close()}})}}},l9=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let s=D8;switch(n){case"gs-layout":s=Y8;break;case"gs-size":s=J8;break;case"gs-space":s=Q8;break;case"gs-position":s=X8;break;case"gs-borders":s=U8;break;case"gs-effects":s=G8;break;case"gs-typography":s=e9;break;case"gs-background":s=z8;break}return c.jsx(s,{sector:e,styleManagerDataConfig:t})},Rd={},Bx=fe(function({className:t,sectors:n}){var p;const[s,r]=h.useState(Rd),o=ye(),{editor:i}=o,a=i==null?void 0:i.Styles,l=a==null?void 0:a.getSelected(),u=i==null?void 0:i.getSelected();if(h.useEffect(()=>{if(u&&i){const g=setTimeout(()=>{let m=Rd;const b=u.get("styleManager");Ye(b)&&(m=b({editor:i,component:u})),r(m||Rd)});return()=>clearTimeout(g)}},[u,i]),!a||!l)return null;const d=n.length?n:a.getSectors({visible:!0}),f=(p=o.sdkOptions.dataSources)==null?void 0:p.styleManager;return s.disabled?null:c.jsx("div",{className:N(Ix,t,"gs-utl-select-none"),children:d.map((g,m)=>c.jsx(ar,{open:g.isOpen(),onChange:({open:b})=>g.setOpen(b),classNameWrap:N(_c,`${_c}__${g.id}`),sticky:!0,handler:()=>{const b=g.getProperties({withValue:!0}).length>0,v=g.getProperties({withParentValue:!0}).length>0;return c.jsxs(k,{gap:"xs",items:"center",children:[c.jsx(D,{className:"gs-utl-mr-2",children:g.getName()}),b&&c.jsx(D,{children:c.jsx("div",{className:N(Ee.dot,z.bgA2)})}),v&&c.jsx(D,{children:c.jsx("div",{className:N(Ee.dot,z.bgW)})})]})},className:b=>Dx(b,m,m===d.length-1),children:c.jsx(k,{className:N(s9,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:l9(g,{styleManagerDataConfig:f})})},g.id))})}),c9=h.forwardRef(function({children:t,className:n,content:s,...r},o){return c.jsx("div",{className:N(ue("gs-design-manager-tab"),n),ref:o,...r,children:t})}),I1="gs-cmp-sidebar-right",D1="gs-cmp-traits-provider",$d=N("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function u9(){var y,w,S;const{isCssPanelActive:e,selectedDesignerTab:t,showSelectors:n,setSelectedDesignerTab:s,sdkProps:r,sdkOptions:o,isProjectTypeEmail:i}=ye(),a=Re(),l=N(e&&"gs-utl-hidden"),d=(((y=Bn(r.children,c9))==null?void 0:y.filter(Boolean))||[]).map(({props:C},j)=>({id:C.id,label:C.label,content:c.jsx(Qa,{children:C.children}),order:C.order??2+j+1})),f=(w=o.designPanel)==null?void 0:w.propsInStyles,p=(S=o.designPanel)==null?void 0:S.hideTabs,g=f===!0||i&&f!==!1,m=p===!0||i&&p!==!1,b=a.t("traitManager.panelLabel"),x=[{id:"style",label:a.t("styleManager.panelLabel"),order:1,content:c.jsxs(k,{col:!0,full:!0,children:[!!n&&c.jsx(D,{className:N("gs-cmp-selectors-provider",je.s,re.bb,z.br),children:c.jsx(oy,{children:C=>c.jsx(Rx,{...C})})}),g&&c.jsx(D,{className:N(D1,$d),children:c.jsx(ar,{handler:b,className:Dx(!1),sticky:!0,open:!0,children:c.jsx(bf,{children:C=>c.jsx(kf,{...C,className:N("gs-utl-p-2",z.br,re.bb)})})})}),c.jsx(D,{className:N("gs-cmp-styles-provider",$d),grow:!0,children:c.jsx(iy,{children:C=>c.jsxs(c.Fragment,{children:[e&&c.jsx(ay,{}),c.jsx(Bx,{className:l,...C})]})})})]})},!g&&{id:"props",label:b,order:2,content:c.jsx(k,{className:D1,col:!0,full:!0,children:c.jsx(D,{className:N(je.s,$d),children:c.jsx(bf,{children:C=>c.jsx(kf,{...C})})})})},...d].filter(Boolean).sort((C,j)=>C.order-j.order);return c.jsx(k,{className:I1,col:!0,full:!0,nowrap:!0,children:c.jsx(Yr,{value:t,onChange:s,tabs:x,className:N(`${I1}__tabs`,m&&"gs-utl-hidden")})})}const zx=fe(u9),d9="gs-panel-sidebar-tabs",f9=h.memo(fe(function({className:t,...n}){return c.jsx(hs,{className:N(d9,"gs-utl-h-full",t),...n,children:c.jsx(zx,{})})})),p9="gs-panel-styles",h9=h.memo(fe(function({className:t,...n}){const{isCssPanelActive:s}=ye(),r=N(s&&" gs-utl-hidden");return c.jsx(hs,{className:N(p9,"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(iy,{children:o=>c.jsxs(c.Fragment,{children:[s&&c.jsx(ay,{}),c.jsx(Bx,{className:r,...o})]})})})})),g9="gs-panel-templates",m9=h.memo(fe(function({className:t,templates:n,content:s,onSelect:r,...o}){const i=C0(),{projectTypeFilter:a}=i;let l=n??i.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),h.useEffect(()=>{n||i.loadTemplates()},[n]),c.jsx(hs,{className:N(g9,"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"),...o,children:c.jsx(k,{className:ue("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(k,{className:ue("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(Py,{templates:l,projectType:yt[a],content:s,onSelect:r,skipProjectNamePopover:!0})})})})})),b9="gs-cmp-row",v9=h.memo(function({className:t,children:n,full:s,...r}){return c.jsx(mn,{className:N(b9,z.bg,"gs-utl-flex",s&&"gs-utl-w-full",t),...r,children:Ot(n)})}),y9="gs-cmp-select-field",x9=h.memo(fe(function({className:t,style:n,label:s,name:r,value:o,options:i,size:a,onChange:l,required:u,disabled:d,emptyState:f,editorEvents:p}){const{editor:g}=ye(),[m,b]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:s,name:r,value:o,options:i,size:a,emptyState:f})),v=x=>{l({value:x,editor:g,state:m,setState:y=>b(w=>({...w,...y}))})};return Jr({editor:g,editorEvents:p,localState:m,setLocalState:b}),c.jsx(_e,{classNameContainer:N(y9,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})})),w9="gs-cmp-select-field",S9=h.memo(fe(function({className:t,style:n,label:s,name:r,value:o,size:i,onChange:a,required:l,disabled:u,emptyState:d,editorEvents:f}){const{editor:p}=ye(),[g,m]=h.useState(()=>({required:l,disabled:u,style:n,className:t,label:s,name:r,value:o,size:i,emptyState:d})),b=v=>{a({value:v,editor:p,state:g,setState:x=>m(y=>({...y,...x}))})};return Jr({editor:p,editorEvents:f,localState:g,setLocalState:m}),c.jsx(bu,{classNameContainer:N(w9,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})})),C9="gs-sidebar-bottom",j9=h.memo(fe(function({children:t,className:n,style:s,height:r,...o}){const{isInPreview:i,isBottomSidebarOpen:a}=ye(),l=r??35,u=h.useMemo(()=>({height:l,marginBottom:i||!a?`-${l}px`:0,...s}),[i,a,s]);return c.jsx(mn,{className:N(C9,"gs-utl-flex gs-utl-transition-spacing",re.bt,z.br,n),style:u,...o,children:t?Ot(t):void 0})})),E9=fe(function(t){var w;const{leftSidebarSize:n,setLeftSidebarSize:s,editor:r,isInPreview:o,isLeftSidebarOpen:i,sdkProps:a,showPages:l}=ye(),u=a.children,d=((w=t.style)==null?void 0:w.width)??t.width,f=d??n,p=t.resizable===!1,g=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",re.br,z.br),m=N("gs-utl-w-full",re.bb,z.br),b=N("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),v=h.useMemo(()=>({marginLeft:o||!i?`-${f}px`:0,...t.style}),[f,o,i,t.style]),x=()=>r==null?void 0:r.refresh(),y=(S,C,j)=>{s(j.getBoundingClientRect().width)};return c.jsx(mu,{className:g,enable:p?!1:void 0,right:!p,style:v,height:"100%",width:f,minWidth:d??200,maxWidth:d??400,onResize:x,onResizeStop:y,children:t.children??c.jsxs(k,{full:!0,col:!0,children:[l&&c.jsx(D,{className:m,children:c.jsx(ry,{children:S=>c.jsxs(c.Fragment,{children:[Bn(u,Ex),c.jsx(Cx,{...S}),Bn(u,jx)]})})}),c.jsx(D,{className:b,grow:!0,children:c.jsx(sy,{children:S=>c.jsxs(c.Fragment,{children:[Bn(u,ex),c.jsx(Jy,{...S}),Bn(u,Qy)]})})})]})})}),P9="gs-sidebar-left",_9=h.memo(fe(function({children:t,width:n,resizable:s,...r}){return c.jsx(E9,{className:N(P9,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",ru(r)),width:n,resizable:s,style:ou(r),children:t?Ot(t):void 0})})),T9=fe(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:s,editor:r,isInPreview:o,isRightSidebarOpen:i}=ye(),a=((m=t.style)==null?void 0:m.width)??t.width,l=a??n,u=t.resizable===!1,d=N(t.className,"gs-utl-h-full gs-utl-transition-spacing",re.bl,z.br),f=h.useMemo(()=>({marginRight:o||!i?`-${l}px`:0,...t.style}),[l,o,i,t.style]),p=()=>r==null?void 0:r.refresh(),g=(b,v,x)=>{s(x.getBoundingClientRect().width)};return c.jsx(mu,{className:d,enable:u?!1:void 0,left:!u,style:f,height:"100%",width:l,minWidth:a??200,maxWidth:a??400,onResize:p,onResizeStop:g,children:t.children??c.jsx(zx,{})})}),O9="gs-sidebar-right",A9=h.memo(fe(function({children:t,resizable:n,...s}){return c.jsx(T9,{className:N(O9,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",ru(s)),resizable:n,style:ou(s),children:t?Ot(t):void 0})})),N9=fe(function({className:t,variant:n,value:s,tabs:r,style:o,editorEvents:i,onChange:a}){const{editor:l}=ye(),[u,d]=h.useState(()=>({tabs:r,style:o,value:s,variant:n,className:t})),f=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:Ot(m.children)})))||[]},[u.tabs]),p=g=>{a&&l?a({value:g,editor:l,state:u,setState:m=>d(b=>({...b,...m}))}):d(m=>({...m,value:g}))};return Jr({editor:l,editorEvents:i,localState:u,setLocalState:d}),c.jsx(Yr,{tabs:f,className:N(u.className),variant:u.variant,value:u.value,style:u.style,onChange:p})}),M9="gs-cmp-text",L9=h.memo(function({className:t,content:n,children:s,...r}){return c.jsx(mn,{className:N(M9,t),...r,children:s||n})}),R9="gs-cmp-virtual-list",$9=fe(function({id:t,items:n,itemLayout:s,itemsPerRow:r=12,className:o,style:i,htmlAttrs:a}){const[l,u]=h.useState(0),{editor:d,transitionTime:f}=ye(),p=Qp(r);return h.useEffect(()=>{const g=setTimeout(()=>u(m=>++m),f);return()=>clearTimeout(g)},[f]),!!l&&c.jsx(du,{...a,data:n,className:N(R9,"gs-utl-h-full",o),listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${p}`,style:i,itemContent:(g,m)=>c.jsx(h.Fragment,{children:s?Ot(s({item:m,editor:d})):c.jsx("pre",{children:JSON.stringify(m,void 0,2)})},m.id??g)},t)});var Df=(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))(Df||{});const k9={icon:oe,row:v9,column:fR,text:L9,tabs:N9,button:su,buttonMenu:q4,buttonGroupField:Y4,colorPicker:uR,menuList:s$,inputField:t$,codeField:VL,selectField:x9,selectFontField:S9,devices:Ty,panelPages:Px,panelPageSettings:Ik,panelLayers:tx,panelPagesLayers:Wk,panelBlocks:k$,panelGlobalStyles:X$,panelSelectors:A8,panelStyles:h9,panelProperties:v8,panelSidebarTabs:f9,panelAssets:E$,panelTemplates:m9,sidebarRight:A9,sidebarLeft:_9,sidebarTop:Oy,sidebarBottom:j9,canvas:cy,canvasSidebarTop:$L,virtualList:$9,dataPathField:GR,panelDataVariablePicker:QR,panelDataConditionPicker:UR,panelDataCollectionPicker:NR,panelDataValuePicker:YR},Ot=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=IA();return t.filter(Boolean).map((s,r)=>{const{type:o,...i}=ot(s)?{type:Df.text,content:s}:s||{},a=i.id||"",l=k9[o],u=n.layoutChildren.get(a),d=n.customLayoutComponents.get(o),f=a||r;if(u)return c.jsx(ff,{id:a,...u},f);if(d){const p=d({id:a,...i});return Ot([p])[0]}else{if(o===Df.custom)return c.jsx(ff,{id:a,...i},f);if(l)return c.jsx(l,{id:a,...i},f)}return null})},V9=fe(({components:e})=>(S0().customLayoutComponents,Ot(e))),Jr=e=>{const{editorEvents:t,editor:n,localState:s,setLocalState:r}=e;h.useEffect(()=>{if(!t||!n)return;const o=Object.keys(t).reduce((a,l)=>(a[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:s,setState:f=>r(p=>({...p,...f}))})},a),{}),i=Object.keys(o);return i.forEach(a=>n.on(a,o[a])),()=>{i.forEach(a=>n.off(a,o[a]))}},[n,s])},I9=e=>e.Assets.getAll().reduce((s,r)=>{const o=r.getSrc(),i=o.match(/^data:([^;]+);/);if(i){const a=o.split(",")[1],l=dA(r.get("name"));s[o]={mime:i[1],name:l,base64:a}}return s},{}),D9=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),H1=(e,t,n={})=>{let s=e;const r=n.pathPfx||"";for(const o in t)if(s.includes(o)){const i=t[o];s=s.replace(new RegExp(D9(o),"g"),`${r}${i.name}`),i.found=!0}return s},H9=(e,t,n)=>`${t||""}${e||""}${n||""}`,F9=(e,t)=>{const n=e?`<div ${mc}>${e}</div>`:"",s=t?`<div ${mc} data-gjs-global>${t}</div>`:"";return`${n}${s}`},B9=async(e,t={})=>{const{page:n,skipProject:s,assetsFolder:r="assets",filenameCss:o="style.css",styles:i,isMJML:a,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:f}=t,p={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),b=I9(e),v=`${r}/`,x=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=H1(x,b,{pathPfx:v}),w=i==="inline",S=i==="skip",C=i==="skipInPage",j=f==="skip",E=u?{}:yi(e).globalPageSettings||{},_=[],T=(P,A)=>{var $t,zs,Qr;const{pageSettingOpts:M}=A||{},R=P.getName(),F=w||(M==null?void 0:M.replaceDataSources),L=br(P,"title",M)||R,B=br(P,"favicon",M),q=br(P,"description",M),H=br(P,"keywords",M),$=br(P,"socialTitle",M),I=br(P,"socialDescription",M),O=br(P,"socialImage",M),V=u?"":f0(br(P,"fonts")),G=Qt({page:P,key:"customCodeHead",opts:M})??"",W=H9(G,E.customCodeHead,V),K=Qt({page:P,key:"customCodeBody",opts:M})??"",J=d?"":F9(K,E.customCodeBody),Y=P.getMainComponent(),U=j?"":e.getJs({component:Y}),Q=U?`<script>${U}<\/script>`:"",se=[],de=[],Se={asDocument:!1,...p},ne=Y.toHTML(Se).replace("</body>",()=>`${J}${Q}</body>`),Te=Y.head;let ke=L&&`<title>${L}</title>`,it=B&&`<link rel="icon" href="${B}"/>`,st=q&&`<meta name="description" content="${q}"/>`,xe=H&&`<meta name="keywords" content="${H}"/>`,Ze=$&&`<meta property="og:title" content="${$}"/>`,Xe=I&&`<meta property="og:description" content="${I}"/>`,ft=O&&`<meta property="og:image" content="${O}"/>`,Ae='<meta charset="utf-8">',at='<meta name="viewport" content="width=device-width,initial-scale=1">',rt='<meta name="robots" content="index,follow">',Ie='<meta name="generator" content="GrapesJS Studio">';Te.components().forEach(We=>{const pt=We.toHTML(p);lt.title({cmp:We})?ke=pt:lt.favicon({cmp:We})?it=pt:lt.description({cmp:We})?st=pt:lt.keywords({cmp:We})?xe=pt:lt.socialTitle({cmp:We})?Ze=pt:lt.socialDescription({cmp:We})?Xe=pt:lt.socialImage({cmp:We})?ft=pt:lt.charset({cmp:We})?Ae=pt:lt.viewport({cmp:We})?at=pt:lt.robots({cmp:We})?rt=pt:lt.generator({cmp:We})&&(Ie=pt)}),ke&&se.push(ke),Ae&&se.push(Ae),at&&se.push(at),rt&&se.push(rt),Ie&&se.push(Ie),st&&se.push(st),xe&&se.push(xe),Ze&&se.push(Ze),Xe&&se.push(Xe),ft&&se.push(ft),it&&se.push(it),de.length&&se.push(...de),W&&se.push(W),y&&!(S||C)&&se.push(F?`<style>${y}</style>`:`<link rel="stylesheet" href="./${o}">`);const ge=Y.doctype||"<!DOCTYPE html>",$e=(zs=($t=Y.docEl).__attrToString)==null?void 0:zs.call($t,p),Ve=(Qr=Te.__attrToString)==null?void 0:Qr.call(Te,p),Me=e.getHtml(p).trim(),wt=a?e.runCommand(tu,{mjml:Me}).html:`${ge}
|
|
400
|
-
<html${
|
|
401
|
-
<head${
|
|
402
|
-
${
|
|
334
|
+
}`),t},Bn="gs-cmp-selector-manager",zd={},uw=ce(function(t){var ae,ge,Ce;const{selectedState:n,states:s,setState:r,styleCatalog:o,stateSelector:i}=t,a=xe(),[l,u]=h.useState(!1),[d,f]=h.useState([]),[p,g]=h.useState(zd),{toggleCssPanel:m,isCssPanelActive:v,editor:b,store:x}=xe(),{i18nStore:y,modalStore:w}=x,S=b==null?void 0:b.getSelected(),C=b==null?void 0:b.Styles.getSelected();if(h.useEffect(()=>{if(b&&C&&a){const Se=setTimeout(()=>{let et=zd;const Ye=S==null?void 0:S.get("selectorManager");S&&tt(Ye)&&(et=Ye({editor:b,component:S})),g(et||zd),f(RI(b,a))});return()=>clearTimeout(Se)}},[S,b,C,a]),!b)return null;const{Selectors:j}=b,E=p.disableClasses,O=p.disableComponent,P=E&&O,T=j.getComponentFirst()&&!O,_=j.getSelectedAll(),L=b.getSelectedAll(),N=s.map(Se=>({id:Se.getName(),label:Se.getLabel()})),V=b.getModel(),A=(ae=C==null?void 0:C.getDevice)==null?void 0:ae.call(C),H=(ge=C==null?void 0:C.getState)==null?void 0:ge.call(C),U=M("gs-utl-overflow-hidden",te.b,te.rnd,B.br),D=M(B.bA),$=M("gs-utl-flex gs-utl-h-full gs-utl-cursor-pointer gs-utl-p-2",te.br,B.br),I=`${B.bgA}`,R=II(C),z=_.length>0,X=L.length>0,Z=z||X,Y=T&&X||!T&&!z,J=Y?"Components":"Selectors",ee=Se=>y.t(`selectorManager.${Se}`),W=y.t("modals.styleCatalog.title"),Q=()=>w.open({title:W,content:c.jsx(AI,{})});return c.jsxs(k,{className:Bn,gap:"s",col:!0,full:!0,children:[c.jsxs(k,{className:M(`${Bn}__head`),items:"center",justify:"between",gap:"m",children:[c.jsxs(k,{className:M(`${Bn}__head-start`),items:"center",gap:"s",children:[c.jsx(F,{className:M(`${Bn}__head-title`),children:ee("selection")}),o!==!1&&c.jsx(F,{className:M(`${Bn}__style-catalog`),children:c.jsx(zt,{className:"gs-utl-cursor-pointer",onClick:Q,title:W,children:c.jsx(ne,{icon:G.paletteSwatch,size:oe.s})})})]}),!!C&&i!==!1&&!P&&c.jsx(F,{className:`${Bn}__head-end`,children:c.jsx(Le,{size:"s",value:n,options:N,includeEmpty:!0,onChange:r,emptyState:`- ${ee("state")} -`,className:M(n&&B.bA)})})]}),Z&&!P?c.jsxs(c.Fragment,{children:[!E&&c.jsxs(k,{className:M(`${Bn}__field-selectors`,U,!Y&&D),items:"stretch",gap:"xs",children:[c.jsx(zt,{title:ee(z?"applyOnSelector":"noSelectors"),className:M($,!Y&&I),onClick:()=>z&&j.setComponentFirst(!1),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:G.tag,size:oe.sx})})}),c.jsx(F,{grow:!0,children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:l?c.jsx(sw,{autoFocus:!0,open:!0,hideCaret:!0,border:!1,options:d,allowNew:ee("addNewSelector"),onBlur:()=>setTimeout(()=>u(!1),100),onChange:Se=>{Se&&(j.addSelected(Se.id||Se.label),u(!1))}}):c.jsxs(c.Fragment,{children:[X&&c.jsx(St,{title:ee("addNewSelector"),variant:"out",size:"xs",className:"gs-utl-p-0.5",onClick:()=>u(!0),block:!0,children:c.jsx(ne,{icon:G.plus,size:oe.sx})}),_.map(Se=>c.jsx(LI,{selector:Se,removable:X,toggleable:X&&_.filter(et=>et.getActive()||et===Se).length>1},Se.toString()))]})})})]}),!O&&c.jsxs(k,{className:M(`${Bn}__field-components`,U,Y&&D),items:"stretch",gap:"xs",children:[c.jsx(zt,{title:ee(X?"applyOnComponents":"noComponents"),onClick:()=>X&&j.setComponentFirst(!0),className:M($,Y&&I),children:c.jsx(k,{className:"gs-utl-h-full",items:"center",children:c.jsx(ne,{icon:G.targetVariant,size:oe.sx})})}),c.jsx(F,{grow:!0,className:"gs-utl-py-0.5",children:c.jsx(k,{className:"gs-utl-h-full gs-utl-pr-1",items:"center",children:L.map(Se=>c.jsx(Dr,{s:"s",className:M("gs-utl-ml-1 gs-utl-my-0.5 gs-utl-cursor-default",B.cmp),onPointerEnter:()=>V.setHovered(Se),onPointerOut:()=>V.setHovered(),label:Se.getName()},Se.getId()))})})]}),c.jsxs(k,{className:`${Bn}__actions`,gap:"s",items:"center",justify:"between",children:[c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{children:ee("selected")}),c.jsx("pre",{className:M("gs-utl-text-xs gs-utl-mt-1 gs-utl-bg-white/10 gs-utl-text-gray-400",te.rnd,Ee.xyS),children:R}),c.jsx("div",{className:"gs-utl-text-xs gs-utl-mt-1.5",children:ee("currentSelection")})]}),children:c.jsx(Dr,{className:M(te.b,te.rnd,B.br),s:"xs",nopad:!0,block:!0,children:c.jsx(ne,{icon:G.target,size:oe.sx})})}),c.jsx(F,{className:"gs-utl-text-sm",children:c.jsx(Dr,{className:M(te.b,te.rnd,B.br),s:"xs",nopad:!0,children:c.jsxs(k,{space:"xs",items:"center",nowrap:!0,children:[!!A&&A.getWidthMedia()&&c.jsxs(c.Fragment,{children:[c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[ee("device"),": ",c.jsx("b",{children:A.getName()})]}),children:c.jsx(ne,{icon:G.cellphoneLink,size:oe.sx})}),c.jsx(F,{className:"gs-utl-opacity-30",children:"|"})]}),c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[ee("target"),": ",c.jsx("b",{children:J}),c.jsxs("span",{className:"gs-utl-text-xs gs-utl-opacity-75",children:[" ",(Ce=C==null?void 0:C.selectorsToString)==null?void 0:Ce.call(C,{skipState:1})]})]}),children:c.jsx(ne,{icon:Y?G.targetVariant:G.tag,size:oe.sx})}),!!H&&c.jsxs(c.Fragment,{children:[c.jsx(F,{className:"gs-utl-opacity-30",children:"|"}),c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[ee("state"),": ",c.jsx("b",{children:H.getLabel()})]}),children:c.jsx(ne,{icon:G.flare,size:oe.sx})})]})]})})}),c.jsx(St,{title:y.t("toggleCss"),onClick:m,active:v,size:"s",children:c.jsx(ne,{icon:G.codeBraces,size:oe.sx})})]})]}):c.jsxs(k,{className:M(`${Bn}__empty-state`,"gs-utl-text-sm gs-utl-leading-6 gs-utl-my-4"),col:!0,children:[c.jsx(F,{className:`${Bn}__empty-state-title`,children:ee("noSelecton")}),c.jsxs("ul",{className:M(`${Bn}__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")})]})]})]})}),VI="gs-panel-selectors",HI=h.memo(ce(function({className:t,styleCatalog:n,stateSelector:s,...r}){return c.jsx(ws,{className:M(VI,t),...r,children:c.jsx(vy,{children:o=>c.jsx(uw,{...o,styleCatalog:n,stateSelector:s})})})}));function _r({label:e,property:t,hasValue:n,empty:s,onClear:r,children:o,shallow:i,row:a,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||!s&&(t==null?void 0:t.hasValue({noParent:!0})),v=!m&&(t==null?void 0:t.hasValue())&&g,b=g==null?void 0:g.getDevice(),x=g==null?void 0:g.getState(),y=g==null?void 0:g.getComponent(),w=()=>r?r():t==null?void 0:t.clear(),S={className:M(d,"gs-utl-text-sm gs-utl-w-full"),col:!a,items:a?"center":void 0,...f},C=M("gs-utl-flex-1",m&&!i&&B.tAo);return t&&!t.isVisible()?null:c.jsxs(k,{gap:"xs",...S,children:[c.jsxs(k,{className:C,as:"label",items:"center",gap:"xs",nowrap:!0,children:[l&&c.jsx(F,{children:c.jsx(zt,{title:l,children:c.jsx(ne,{icon:G.information,size:oe.sx})})}),c.jsx(F,{children:s?c.jsx("span",{children:" "}):p}),!!v&&!i&&c.jsx(zt,{title:c.jsxs(c.Fragment,{children:[c.jsx("div",{className:M("gs-utl-mb-1"),children:"Value inherited from"}),!!b&&c.jsxs(k,{gap:"s",children:[c.jsx(F,{children:c.jsx(ne,{icon:G.cellphoneLink,size:oe.sx})}),c.jsx(F,{children:c.jsx("b",{children:b.getName()})})]}),c.jsxs(k,{gap:"s",children:[c.jsx(F,{children:c.jsx(ne,{icon:y?G.targetVariant:G.tag,size:oe.sx})}),c.jsxs(F,{children:[c.jsx("b",{children:y?"Components":"Selectors"}),c.jsxs("span",{className:M("gs-utl-text-xs gs-utl-opacity-75"),children:[" ",g==null?void 0:g.selectorsToString({skipState:1})]})]})]}),!!x&&c.jsxs(k,{gap:"s",children:[c.jsx(F,{children:c.jsx(ne,{icon:G.flare,size:oe.sx})}),c.jsx(F,{children:c.jsx("b",{children:x.getLabel()})})]})]}),children:c.jsx("div",{className:M("gs-utl-w-[6px] gs-utl-h-[6px] gs-utl-rounded-full",B.bgW)})}),m&&!i&&!u&&c.jsx(zt,{title:"Clear value",onClick:w,children:c.jsx(ne,{className:Oe.click,icon:G.close,size:oe.s2x})})]}),!!o&&c.jsx(F,{grow:!0,className:"gs-utl-max-w-full",children:o})]})}function Vu(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 DI=/^-?[0-9]+(\.[0-9]+)?[a-zA-Z%]{0,}$/,FI=/,(?![^(]*\))/,Ud=/\s(?![^(]*\))/,BI=/^(closest-side|closest-corner|farthest-side|farthest-corner)/i,Wd=/^circle|ellipse/i,Bh=e=>{var d;const t=[],{name:n,value:s}=Vu(e),[r,...o]=s.split(FI).map(f=>f.trim()).filter(Boolean),i=o.length>1,a=i?r:"",l={type:"none"},u=i?o:[r,...o];if(DI.test(a))l.type="angle",l.value=a;else if(/^to\s/.test(a))l.type="side-or-corner",l.value=a;else if(BI.test(a))l.type="size",l.value=a;else if(Wd.test(a)||/^at\s/.test(a)||/\sat\s/.test(a)){l.type="at",l.value=a;const f=((d=a.match(Wd))==null?void 0:d[0])||"circle";l.shape=f;const p={x:"0%",y:"0%"},g={x:"0%",y:"0%"},[m,v]=a.replace(Wd,"").trim().split("at").map(b=>b.trim());if(m){const[b,x]=m.split(Ud);p.x=b,p.y=x||b}if(v){const[b,x]=v.split(Ud);g.x=b,g.y=x||b}l.size=p,l.position=g}return u.forEach(f=>{const[p,g]=f.split(Ud);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}},Tr=({stops:e,orientation:t="to right",name:n="linear-gradient"})=>{const r=(e.length===1?[{color:e[0].color,hint:null},{color:e[0].color,hint:null}]:e).map(o=>`${o.color} ${o.hint?`${o.hint}%`:""}`.trim()).join(", ");return r?`${n}(${t}, ${r})`:"none"},zI=e=>e.slice().sort((t,n)=>(t.hint||0)-(n.hint||0)),UI="gs-cmp-grad-picker";function WI({className:e,value:t,onChange:n}){var H,U,D;const s=Bh(t),[r,o]=h.useState(s.colorStops),[i,a]=h.useState(null),l=h.useRef(null),u=K(UI,"gs-grad-picker gs-utl-select-none gs-utl-gap-1",e,te.rnd),d=s.name||"linear-gradient",f=d.indexOf("radial")>=0,p=d.indexOf("repeating")>=0,g=s.orientation.value,m=`${parseFloat(`${g}`)||180}`,v=`${parseFloat(`${(H=s.orientation.size)==null?void 0:H.x}`)||0}`,b=`${parseFloat(`${(U=s.orientation.position)==null?void 0:U.x}`)||0}`,x=`${parseFloat(`${(D=s.orientation.position)==null?void 0:D.y}`)||0}`,y=0,w=100,S=($,I=!1)=>{const R=zI($);o(R),n==null||n(Tr({name:d,orientation:g,stops:R}),I)},C=($,I=!1)=>{n==null||n(Tr({stops:r,name:d,orientation:`${$}deg`}),I)},j=($,I=!1)=>{n==null||n(Tr({stops:r,name:d,orientation:`${$}px at ${b}% ${x}%`}),I)},E=($,I=!1)=>{n==null||n(Tr({stops:r,name:d,orientation:`${v}px at ${$}% ${x}%`}),I)},O=($,I=!1)=>{n==null||n(Tr({stops:r,name:d,orientation:`${v}px at ${b}% ${$}%`}),I)},P=$=>{const I=`${$?"repeating-":""}${f?"radial":"linear"}-gradient`;n==null||n(Tr({stops:r,orientation:g,name:I}))},T=$=>{const I=`${p?"repeating-":""}${$?"radial":"linear"}-gradient`;n==null||n(Tr({stops:r,orientation:$?"100px at 50% 50%":"90deg",name:I}))};h.useEffect(()=>{if(!i)return;const $=parseFloat(`${i.stop.hint}`),I=z=>{let Z=(z.clientX-i.x)*100;Z=Z/i.w,Z=$+Z,Z=Z<y?y:Z,Z=Z>w?w:Z,i.stop.hint=parseInt(`${Z}`,10),S(r,!0)},R=()=>{a(null),S(r)};return window.addEventListener("pointermove",I),window.addEventListener("pointerup",R),()=>{window.removeEventListener("pointermove",I),window.removeEventListener("pointerup",R),R()}},[i]);const _=($,I)=>{const R=l.current;a({stop:I,w:(R==null?void 0:R.clientWidth)||0,h:(R==null?void 0:R.clientHeight)||0,x:$.clientX,y:$.clientY})},L=$=>{const I=l.current,R=(I==null?void 0:I.clientWidth)||0,z=(I==null?void 0:I.clientHeight)||0,X=$.nativeEvent.offsetX-((I==null?void 0:I.clientLeft)||0),Z=$.nativeEvent.offsetY-((I==null?void 0:I.clientTop)||0),Y=X/R*100,J=document.createElement("canvas"),ee=J.getContext("2d");if(!ee)return;J.width=R,J.height=z;const W=ee.createLinearGradient(0,0,R,z);r.forEach(Se=>W.addColorStop(parseFloat(`${Se.hint}`)/100,Se.color)),ee.fillStyle=W,ee.fillRect(0,0,J.width,J.height),J.style.background="black";const Q=ee.getImageData(X,Z,1,1).data,ae=Q[3]?(100/255*Q[3]/100).toFixed(2):0,ge=`rgba(${Q[0]}, ${Q[1]}, ${Q[2]}, ${ae})`,Ce=ge==="rgba(0, 0, 0, 0)"?"#000":ge;S([...r,{color:Ce,hint:Y}])},N=$=>{S(r.filter(I=>I!==$))},V=($,I,R)=>{I&&($.color=I),S(r,R)},A=$=>(i==null?void 0:i.stop)===$;return c.jsxs(k,{className:u,col:!0,children:[!!(i!=null&&i.stop)&&c.jsx("div",{className:K("fixed inset-0 z-50 cursor-colr")}),c.jsxs("div",{className:K("relative gjs-mb-6 gjs-mt-3"),children:[c.jsx("div",{className:K("bg-checker h-8",te.rnd),children:c.jsx("div",{ref:l,className:K("w-full h-full cursor-cross",te.b,te.rnd,B.br),style:{backgroundImage:Tr({stops:r})},onClick:L})}),r.map(($,I)=>c.jsxs("div",{className:K("absolute top-0 h-full"),style:{left:`${$.hint}%`},children:[c.jsx("div",{className:K("cursor-pointer absolute gs-utl-translate-x-[-50%] gs-utl-top-[-14px]"),onClick:()=>N($),children:c.jsx(ne,{icon:G.close,size:oe.s3x})}),c.jsx("div",{onPointerDown:R=>_(R,$),className:K("h-full w-1 gs-utl-translate-x-[-50%] cursor-colr opacity-50 gjs-border-white",te.br,te.bl,A($)?"gjs-bg-white":"gjs-bg-black")}),c.jsx("div",{className:K("cursor-pointer gs-utl-bottom-[-17px] gs-utl-left-[-7px] absolute"),children:c.jsx(wx,{value:$.color,onChange:(R,z)=>V($,R,z),className:K("h-4 w-4 gjs-rounded-full gjs-border-2")})})]},I))]}),c.jsxs(k,{space:"s",items:"center",children:[c.jsx(F,{grow:!0,children:c.jsx(Na,{label:"Repeat",value:p,onChange:P})}),c.jsx(F,{grow:!0,children:c.jsx(Na,{label:"Radial",value:f,onChange:T})})]}),f?c.jsxs(k,{space:"s",col:!0,children:[c.jsx(F,{children:c.jsx(k,{space:"s",items:"center",children:c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"S",size:"s",value:v,onChange:j,valueUnit:"px",units:["px"]})})})}),c.jsx(F,{children:c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"X",size:"s",value:b,onChange:E,valueUnit:"%",units:["%"]})}),c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"Y",size:"s",value:x,onChange:O,valueUnit:"%",units:["%"]})})]})})]}):c.jsx(k,{space:"s",items:"center",nowrap:!0,children:c.jsx(F,{grow:!0,children:c.jsx(Ne,{pan:"A",size:"s",value:m,onChange:C,valueUnit:"deg",units:["deg"]})})})]})}const GI="gs-sm-custom-type",qI=ce(function({property:t,editor:n}){const s=h.useRef(null),r=t.getType(),o=n.StyleManager,i=o.getType(r),a=i==null?void 0:i.view;return h.useEffect(()=>{const l=s.current;if(a&&l){const u=new a({model:t,config:o.getConfig(),attributes:t.get("attributes")}),d=u.render().el;return l.appendChild(d),()=>{l.removeChild(d),u.remove()}}},[a,t,n]),a&&c.jsx("div",{className:GI,ref:s})});function dw(e){return e.isFull()||["slider","composite","stack","file"].includes(e.getType())}const Y1="gs-cmp-style-field";function fw({property:e,sector:t,styleManagerDataConfig:n,fieldProps:s}){const r=M(Y1,`${Y1}__${e.id}`),o={sector:t,styleManagerDataConfig:n},i=t.em.getEditor(),a=e.getType();switch(a){case"selectFont":return c.jsx(Mu,{className:r,...vw(e,o),...s});case"number":case"slider":case"integer":return c.jsx(Ne,{className:r,...it(e,o),...s});case"color":return c.jsx(gr,{className:r,...Io(e,o),...s});case"select":return c.jsx(Le,{className:r,...Lt(e,o),...s});case"radio":return c.jsx(en,{className:r,...Ns(e,o),...s});case"file":return c.jsx(Ra,{className:r,...m9(e,o),...s});case"composite":return c.jsx(yn,{className:r,property:e,corners:e.get("corners"),generic:e.get("generic"),...o});case"stack":{const l=e.getProperties();return c.jsx(Ls,{className:r,...Ar(e,o),children:c.jsx(Ys,{properties:l,sector:t})})}default:{const l=i.StyleManager.getType(a);return!!(l!=null&&l.create)&&!!(l!=null&&l.view)?c.jsx(qI,{editor:i,property:e}):c.jsx(ot,{className:r,...zh(e,o)})}}}const X1="gs-cmp-style-prop-row";function Ys({properties:e,sector:t,styleManagerDataConfig:n}){const s={sector:t,styleManagerDataConfig:n};return c.jsx(c.Fragment,{children:e.map(r=>{const o=r.getId(),i=M(X1,`${X1}__${o}`,dw(r)&&"gs-utl-col-span-full");return r.isVisible()?c.jsx("div",{className:i,children:c.jsx(fw,{property:r,...s})},o):null})})}function KI({sector:e,styleManagerDataConfig:t}){const n=al(),s=e.getProperties().filter(r=>r.isVisible()).map(r=>(n.sdkAddFonts&&r.getId()==="font-family"&&r.set("type","selectFont"),r));return c.jsx("div",{className:M("gs-utl-grid gs-utl-grid-cols-2 gs-utl-gap-2"),children:c.jsx(Ys,{properties:s,sector:e,styleManagerDataConfig:t})})}const ZI="gs-cmp-sector-row";function ve({className:e,children:t,bottom:n,separator:s,separatorTop:r,property:o,...i}){const a=c.jsx("div",{className:K("gjs-mb-2 -gjs-ml-2 -gjs-mr-2",te.bb,B.br)}),l=K(ZI,e,"w-full gs-utl-gap-2",n),u=(Array.isArray(o)?o:[o]).filter(Boolean);return(u.length?u.some(f=>f.isVisible()):!0)?c.jsxs(c.Fragment,{children:[r&&a,c.jsx(k,{className:l,nowrap:!0,...i,children:t}),s&&a]}):null}function Yi(e,t,n={}){const s=e.getType(),{compact:r=!1,sector:o,styleManagerDataConfig:i}=n,a=e.getParent(),l={sector:o,styleManagerDataConfig:i},u=e.getDefaultValue();if(s==="select"){const f={property:a.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 s==="color"?c.jsx(gr,{...Io(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(Ne,{...it(e,l),...r?{pan:e.getLabel()[0]}:{},...t?{value:t.same?e.getValue({noDefault:!0}):"",valueUnit:t.same?e.getUnit():"",placeholder:t.same?u:"Custom",onChange:(d,f)=>t.all.map(p=>p.upValue(d,{partial:f})),onChangeUnit:d=>t.all.map(f=>f.upUnit(d))}:{},label:void 0})}const Zl="gs-cmp-style-prop-composite";function yn({className:e,property:t,sector:n,styleManagerDataConfig:s,corners:r,compact:o,generic:i,children:a,options:l}){const[u,d]=h.useState(null);if(!(t!=null&&t.isVisible()))return null;const f={id:"custom",label:c.jsx(ne,{icon:G.borderStyle,size:oe.s}),title:"Custom"},p=[{id:"all",label:c.jsx(ne,{icon:G.borderAllVariant,size:oe.s}),title:"All"},f],g=t.isDetached(),m=t.getProperties(),v=m.length,[b,x,y,w]=m,S=b.getFullValue(),j=m.map(D=>D.getFullValue()).every(D=>D===S),E=u!==null?u:j||l?"all":f.id,O=l?[...l,f]:[],P=t.getFullValue(),T=O.some(D=>D.id===P),_=E===f.id||(l?!T:!1)||!!i,L={compact:o,sector:n,styleManagerDataConfig:s},N=c.jsx(_r,{property:o?null:b,shallow:!g,children:Yi(b,null,L)}),V=c.jsx(_r,{property:o?null:x,shallow:!g,children:Yi(x,null,L)}),A=!!y&&c.jsx(_r,{property:o?null:y,shallow:!g,children:Yi(y,null,L)}),H=!!w&&c.jsx(_r,{property:o?null:w,shallow:!g,children:Yi(w,null,L)}),U=o?{label:t.getLabel()}:{property:t};return c.jsxs(k,{className:K(Zl,e,"gs-utl-w-full gs-utl-gap-2"),col:!0,nowrap:!0,children:[c.jsx(ve,{className:`${Zl}__main`,children:c.jsx(_r,{...U,children:!i&&c.jsx(ve,{bottom:"0",children:a!==void 0?a:l?c.jsx(c.Fragment,{children:c.jsx(F,{grow:!0,children:c.jsx(en,{size:"s",options:O,value:_?f.id:P,onChange:D=>{D===f.id?d(D):(t.upValue(D),d(""))}})})}):c.jsxs(c.Fragment,{children:[c.jsx(F,{grow:!0,children:Yi(b,{same:j,all:m},L)}),c.jsx(F,{grow:!0,children:c.jsx(en,{size:"s",options:p,value:E,onChange:d})})]})})})}),_&&c.jsx(ve,{col:!0,className:K(`${Zl}__details`,"gjs-px-2 gjs-py-1",B.bgH2,te.rnd,te.b,B.br),children:i?c.jsx("div",{className:K(`${Zl}__props`,"grid grid-cols-2 gap-2"),children:m.map(D=>c.jsx(_r,{property:D,shallow:!g,className:K(dw(D)&&"col-span-full"),children:c.jsx(fw,{property:D,...L,fieldProps:{label:void 0}})},D.getId()))}):v===2?c.jsx(c.Fragment,{children:c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:N}),c.jsx(F,{grow:!0,children:V})]})}):v===3?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:N}),c.jsx(F,{grow:!0,children:V})]}),c.jsx(k,{space:"s",children:c.jsx(F,{grow:!0,children:A})})]}):r?c.jsxs(c.Fragment,{children:[c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:N}),c.jsx(F,{grow:!0,children:V})]}),c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:H}),c.jsx(F,{grow:!0,children:A})]})]}):c.jsxs(c.Fragment,{children:[c.jsx(k,{className:K("gs-utl-w-1/2 gjs-m-auto"),children:N}),c.jsxs(k,{space:"s",children:[c.jsx(F,{grow:!0,children:H}),c.jsx(F,{grow:!0,children:V})]}),c.jsx(k,{className:K("gs-utl-w-1/2 gjs-m-auto"),children:A})]})})]})}var Rr=(e=>(e.Image="image",e.Gradient="gradient",e.Color="color",e))(Rr||{});const hc="background-image",Is="__background-type",ma=hc,pw="https://placehold.co/150/777/white.png?text=IMAGE",ep="50px",YI={[Is]:"image","background-image":`url("${pw}")`,"background-size":`${ep} ${ep}`,"background-repeat":"repeat","background-position":"0px 0px"},XI=e=>(e.includes("gradient(")?Bh(e).colorStops[0].color:e)||"";function JI({sector:e,styleManagerDataConfig:t}){var S;const n=ul(),s=e.getProperty("background"),r=s.getProperty(Is),o=s.getProperty("background-image"),i=s.getProperty("background-position"),a=s.getProperty("background-size"),l=e.getProperty("background-color"),u=e.getProperty("background-clip"),d={sector:e,styleManagerDataConfig:t},f=[s,l,u].map(C=>C==null?void 0:C.id),p=e.getProperties().filter(C=>!f.includes(`${C.id}`)),g=((S=s.getSelectedLayer())==null?void 0:S.getIndex())||-1,m=r==null?void 0:r.getValue(),v=m==="image",b=o.getValue(),x=()=>{const C=n.Assets;C.open({select(j){const E=j.getSrc();o.upValue(`url("${E}")`),C.close()}})},y=C=>{let j="none",E="100%";C==="image"?(j=`url("${pw}")`,E=ep):C==="gradient"?j="linear-gradient(90deg, black 10%, white 90%)":C==="color"&&(j="rgba(0, 0, 0, 0.5)"),o.upValue(j),r.upValue(C),i.upValue("0 0"),a.upValue(`${E} ${E}`)},w=h9(r,[{id:"image",label:c.jsx(ne,{icon:G.image,size:oe.s})},{id:"gradient",label:c.jsx(ne,{icon:G.gradientVertical,size:oe.s})},{id:"color",label:c.jsx(ne,{icon:G.checkboxBlank,size:oe.s})}]);return c.jsxs(c.Fragment,{children:[c.jsx(ve,{property:s,separator:!0,children:c.jsxs(Ls,{...Ar(s,d,YI),previewStyle:C=>s.getStyleFromLayer(C,{camelCase:!0}),children:[c.jsx(ve,{children:c.jsx(en,{...Ns(r,d),options:w,onChange:y,label:void 0})}),c.jsx(ve,{children:c.jsxs(_r,{children:[v&&c.jsx(Ra,{value:Vu(b).value,onOpen:x}),m==="color"&&c.jsx(gr,{...Io(o,d),value:XI(b),label:void 0}),m==="gradient"&&c.jsx(WI,{value:b,onChange:(C,j)=>o.upValue(C,{partial:j})},g)]})}),v&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{col:!0,children:c.jsx(yn,{property:i,...d})}),c.jsx(ve,{col:!0,children:c.jsx(yn,{property:a,...d})}),c.jsxs(ve,{children:[c.jsx(Le,{...Lt(s.getProperty("background-repeat"),{sector:e})}),c.jsx(Le,{...Lt(s.getProperty("background-attachment"),{sector:e})})]}),c.jsx(ve,{children:c.jsx(Le,{...Lt(s.getProperty("background-origin"),{sector:e})})})]})]})}),c.jsx(ve,{property:l,children:c.jsx(gr,{...Io(l,d)})}),c.jsx(ve,{property:u,children:c.jsx(Le,{...Lt(u,d)})}),p.length>0&&c.jsx(Ys,{properties:p,...d})]})}function QI({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("border-radius"),s=e.getProperty("border-width"),r=e.getProperty("border-style"),o=e.getProperty("border-color"),i={sector:e,styleManagerDataConfig:t},a=[n,s,r,o].map(u=>u==null?void 0:u.id),l=e.getProperties().filter(u=>!a.includes(`${u.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(yn,{property:n,corners:!0,...i}),c.jsx(yn,{property:s,...i}),c.jsx(yn,{property:r,...i}),c.jsx(yn,{property:o,...i}),l.length>0&&c.jsx(Ys,{properties:l,...i})]})}const go=e=>Au({value:parseFloat(e),min:-3,max:3}),Gd=(e,t="filter",n)=>{const s=e.getProperty(`${t}-value`),r=e.getProperty(`${t}-name`).getOption()||{},o=r.units||[],i=s.getUnit(),a=$k(i,o)?i:o[0];return{...it(s,n),units:o,valueUnit:a,onChange:(l,u)=>{s.upValue(l,{partial:u,units:o,min:r.min,max:r.max})}}},J1=(e,t,n,s)=>{const r=e.getProperty(`${t}-name`),o=e.getProperty(`${t}-value`);return{...Lt(r,n,s),onChange:i=>{r.upValue(i),o.upValue("")}}},e9={"text-shadow-h":"1px","text-shadow-v":"1px","text-shadow-blur":"5px"};function t9({sector:e,styleManagerDataConfig:t}){const n=Ie(),s=O=>n.t(`styleManager.effects.${O}`),r=e.getProperty("box-shadow"),o=e.getProperty("text-shadow"),i=e.getProperty("filter"),a=e.getProperty("backdrop-filter"),l=e.getProperty("transition"),u=e.getProperty("transform"),d=e.getProperty("perspective-origin"),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"),x=e.getProperty("transform-origin"),y=e.getProperty("overflow"),w={sector:e,styleManagerDataConfig:t},S=[r,o,i,a,l,u,d,f,p,g,m,v,b,x,y].map(O=>O==null?void 0:O.id),C=e.getProperties().filter(O=>!S.includes(`${O.id}`)),j=O=>{const{boxShadowH:P,boxShadowV:T,boxShadowBlur:_,boxShadowColor:L,boxShadowSpread:N,boxShadowType:V}=O.getValues({camelCase:!0}),A=go(P),H=go(T),U=go(_),D=go(N),$=`${A}px ${H}px ${U}px ${D}px ${L} ${V}`.trim();return c.jsxs(k,{space:"s",items:"center",children:[c.jsxs(F,{grow:!0,children:[P," ",T," ",_," ",N]}),c.jsx(F,{children:c.jsx("div",{className:K("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:$}})})]})},E=O=>{const{textShadowH:P,textShadowV:T,textShadowBlur:_,textShadowColor:L}=O.getValues({camelCase:!0}),N=go(P),V=go(T),A=go(_),H=`${N}px ${V}px ${A}px ${L}`.trim();return c.jsxs(k,{space:"s",items:"center",children:[c.jsxs(F,{grow:!0,children:[P," ",T," ",_]}),c.jsx(F,{children:c.jsx("div",{className:K("w-4 h-4 gjs-bg-white",te.b,te.rnd),style:{boxShadow:H}})})]})};return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:[m,v],children:[c.jsx(Ne,{...it(m,w)}),c.jsx(Le,{...Lt(v,w)})]}),c.jsx(ve,{property:b,separator:!0,children:c.jsx(Le,{...Lt(b,w)})}),c.jsx(ve,{property:r,separator:!0,children:c.jsxs(Ls,{...Ar(r,w),renderItem:j,children:[c.jsx(ve,{children:c.jsx(en,{...Ns(r.getProperty("box-shadow-type"),w),label:""})}),c.jsxs(ve,{children:[c.jsx(Ne,{...it(r.getProperty("box-shadow-h"),w),label:s("boxShadow.xOffset")}),c.jsx(Ne,{...it(r.getProperty("box-shadow-v"),w),label:s("boxShadow.yOffset")})]}),c.jsxs(ve,{children:[c.jsx(Ne,{...it(r.getProperty("box-shadow-blur"),w),label:s("boxShadow.blur")}),c.jsx(Ne,{...it(r.getProperty("box-shadow-spread"),w),label:s("boxShadow.spread")})]}),c.jsx(ve,{children:c.jsx(gr,{...Io(r.getProperty("box-shadow-color"),w),label:s("boxShadow.color")})})]})}),c.jsx(ve,{property:o,separator:!0,children:c.jsxs(Ls,{...Ar(o,w,e9),renderItem:E,children:[c.jsxs(ve,{children:[c.jsx(Ne,{...it(o.getProperty("text-shadow-h"),w),label:s("textShadow.xOffset")}),c.jsx(Ne,{...it(o.getProperty("text-shadow-v"),w),label:s("textShadow.yOffset")})]}),c.jsx(ve,{children:c.jsx(Ne,{...it(o.getProperty("text-shadow-blur"),w),label:s("textShadow.blur")})}),c.jsx(ve,{children:c.jsx(gr,{...Io(o.getProperty("text-shadow-color"),w),label:s("textShadow.color")})})]})}),c.jsx(ve,{property:i,separator:!0,children:c.jsx(Ls,{...Ar(i,w,{"filter-name":"blur","filter-value":"3px"}),children:c.jsxs(ve,{children:[c.jsx(Le,{...J1(i,"filter",w),label:s("filter.type")}),c.jsx(Ne,{...Gd(i,void 0,w),label:s("filter.value")})]})})}),c.jsx(ve,{property:a,separator:!0,children:c.jsx(Ls,{...Ar(a,w,{"backdrop-filter-name":"blur","backdrop-filter-value":"3px"}),children:c.jsxs(ve,{children:[c.jsx(Le,{...Lt(a.getProperty("backdrop-filter-name"),w),label:s("backdropFilter.type")}),c.jsx(Ne,{...Gd(a,"backdrop-filter",w),label:s("backdropFilter.value")})]})})}),c.jsx(ve,{property:l,separator:!0,children:c.jsxs(Ls,{...Ar(l,w),children:[c.jsx(ve,{children:c.jsx(Le,{...Lt(l.getProperty("transition-property"),w),label:s("transition.type")})}),c.jsx(ve,{children:c.jsx(Le,{...Lt(l.getProperty("transition-timing-function"),w),label:s("transition.easing")})}),c.jsxs(ve,{children:[c.jsx(Ne,{...it(l.getProperty("transition-duration"),w),label:s("transition.duration")}),c.jsx(Ne,{...it(l.getProperty("transition-delay"),w),label:s("transition.delay")})]})]})}),c.jsx(ve,{property:u,separator:!0,children:c.jsx(Ls,{...Ar(u,w),children:c.jsxs(ve,{children:[c.jsx(Le,{...J1(u,"transform",w),label:s("transform.type")}),c.jsx(Ne,{...Gd(u,"transform",w),label:s("transform.value")})]})})}),c.jsx(yn,{property:x,...w}),c.jsx(yn,{property:y,...w}),c.jsx(ve,{property:f,children:c.jsx(en,{...Ns(f,w)})}),c.jsx(ve,{property:[p,g,d],separatorTop:!0,children:s("childrenTransform")}),c.jsxs(ve,{property:[p,g],children:[c.jsx(Ne,{...it(p,w)}),c.jsx(en,{...Ns(g,w)})]}),c.jsx(yn,{property:d,...w}),C.length>0&&c.jsx(Ys,{properties:C,...w})]})}function n9(e,t){return e.indexOf(t)>=0}const yt=oe.s,Yl="M6 6v12h13V6H6zm0 13v5H5V0h1v5h13c.6 0 1 .4 1 1v12c0 .6-.4 1-1 1H6zm6-14h1v14h-1V5z",Xl="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",Jl="M6 6v12h13V6H6zm13-1V0h1v24h-1v-5H6a1 1 0 01-1-1V6c0-.6.4-1 1-1h13zm-7 0h1v14h-1V5z",Q1="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",ev="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",s9="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",qd="M15 19H9V6h6v13zM8 6v13H0v1h24v-1h-8V6h8V5H0v1h8z";function r9({sector:e,styleManagerDataConfig:t}){const n=e.em.getEditor(),s=Ie(),[r,o]=h.useState({}),[i,a]=h.useState({}),l=e.getProperty("display"),u=e.getProperty("flex-direction"),d=e.getProperty("justify-content"),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"),x=e.getProperty("flex"),y={sector:e,styleManagerDataConfig:t},w=[l,u,d,f,p,g,m,v,b,x].map(D=>D.id),S=e.getProperties().filter(D=>!w.includes(`${D.id}`)),C=D=>s.t(`styleManager.layout.${D}`),j=l.getValue(),E=j==="flex",O=(i.display||"").indexOf("flex")>=0,P=u.getValue(),T=P.indexOf("reverse")>=0,_=!n9(["column","column-reverse"],P),L=[{id:"row",label:c.jsx(ne,{icon:G.arrowRight,size:oe.sx}),title:C("direction.title.row")},{id:"row-reverse",label:c.jsx(ne,{icon:G.arrowRight,size:yt,horizontal:!0}),title:C("direction.title.row-reverse")},{id:"column",label:c.jsx(ne,{icon:G.arrowDown,size:oe.sx}),title:C("direction.title.column")},{id:"column-reverse",label:c.jsx(ne,{icon:G.arrowDown,size:yt,vertical:!0}),title:C("direction.title.column-reverse")}],N=[{id:"flex-start",title:C("justify.title.start"),label:c.jsx(ne,{icon:Yl,size:yt,rotate:_?0:90,horizontal:_&&T,vertical:!_&&T})},{id:"center",title:C("justify.title.center"),label:c.jsx(ne,{icon:Xl,size:yt,rotate:_?0:90})},{id:"flex-end",title:C("justify.title.end"),label:c.jsx(ne,{icon:Jl,size:yt,rotate:_?0:90,horizontal:_&&T,vertical:!_&&T})},{id:"space-between",title:C("justify.title.spaceBetween"),label:c.jsx(ne,{icon:Q1,size:yt,rotate:_?0:90})},{id:"space-around",title:C("justify.title.spaceAround"),label:c.jsx(ne,{icon:ev,size:yt,rotate:_?0:90})},{id:"space-evenly",title:C("justify.title.spaceEvenly"),label:c.jsx(ne,{icon:s9,size:yt,rotate:_?0:90})}],V=[{id:"stretch",title:C("align.title.stretch"),label:c.jsx(ne,{icon:qd,size:yt,rotate:_?0:90})},{id:"flex-start",title:C("align.title.start"),label:c.jsx(ne,{icon:Yl,size:yt,rotate:_?90:0})},{id:"center",title:C("align.title.center"),label:c.jsx(ne,{icon:Xl,size:yt,rotate:_?90:0})},{id:"flex-end",title:C("align.title.end"),label:c.jsx(ne,{icon:Jl,size:yt,rotate:_?90:0})}],A=[{id:"flex-start",title:C("alignContent.title.start"),label:c.jsx(ne,{icon:Yl,size:yt,rotate:_?90:0,horizontal:_&&T,vertical:!_&&T})},{id:"center",title:C("alignContent.title.center"),label:c.jsx(ne,{icon:Xl,size:yt,rotate:_?90:0})},{id:"flex-end",title:C("alignContent.title.end"),label:c.jsx(ne,{icon:Jl,size:yt,rotate:_?90:0,horizontal:_&&T,vertical:!_&&T})},{id:"space-between",title:C("alignContent.title.spaceBetween"),label:c.jsx(ne,{icon:Q1,size:yt,rotate:_?90:0})},{id:"space-around",title:C("alignContent.title.spaceAround"),label:c.jsx(ne,{icon:ev,size:yt,rotate:_?90:0})},{id:"stretch",title:C("alignContent.title.stretch"),label:c.jsx(ne,{icon:qd,size:yt,rotate:_?0:90})}],H=[{id:"auto",title:C("alignSelf.title.auto"),label:c.jsx(ne,{icon:G.close,size:yt})},{id:"flex-start",title:C("alignSelf.title.start"),label:c.jsx(ne,{icon:Yl,size:yt,rotate:90})},{id:"center",title:C("alignSelf.title.center"),label:c.jsx(ne,{icon:Xl,size:yt,rotate:90})},{id:"flex-end",title:C("alignSelf.title.end"),label:c.jsx(ne,{icon:Jl,size:yt,rotate:90})},{id:"stretch",title:C("alignSelf.title.stretch"),label:c.jsx(ne,{icon:qd,size:yt,rotate:0})}],U=[{id:"0 0 auto",label:c.jsx(ne,{icon:G.close,size:yt}),title:C("flex.title.auto")},{id:"1 1 0%",label:c.jsx(ne,{icon:G.unfoldMoreHorizontal,size:yt,rotate:90}),title:C("flex.title.fillContainer")},{id:"0 1 auto",label:c.jsx(ne,{icon:G.unfoldLessHorizontal,size:yt,rotate:90}),title:C("flex.title.hugContents")}];return h.useEffect(()=>{if(!n)return()=>{};const{Styles:D}=n,$=()=>{const R=n.getSelected();let z={},X={};if(R){const Z=R.getEl();if(Z){z=window.getComputedStyle(Z);const Y=Z.parentElement;Y&&(X=window.getComputedStyle(Y))}}o(z),a(X)},I=D.events.target;return n.on(I,$),$(),()=>n.off(I,$)},[n]),c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(Le,{...Lt(l,y),...tp,tip:C(`display.tips.${j}`)})}),E&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{children:c.jsx(en,{...Ns(u,y),options:L})}),c.jsx(ve,{children:c.jsx(en,{...Ns(d,y),options:N})}),c.jsx(ve,{children:c.jsx(en,{...Ns(f,y),options:V})}),c.jsx(ve,{children:c.jsx(yn,{property:b,...y})}),c.jsx(ve,{children:c.jsx(Le,{...Lt(p,y),...tp})}),p.getValue()!=="nowrap"&&c.jsx(ve,{children:c.jsx(en,{...Ns(g,y),options:A})})]}),O&&c.jsxs(c.Fragment,{children:[c.jsx(ve,{separatorTop:!0,children:C("flexChild")}),c.jsx(ve,{children:c.jsx(yn,{property:x,options:U,...y})}),c.jsx(ve,{children:c.jsx(en,{...Ns(m,y),options:H})}),c.jsx(ve,{children:c.jsx(Ne,{...it(v,{sector:e,styleManagerDataConfig:t})})})]}),S.length>0&&c.jsx(Ys,{properties:S,...y})]})}const o9=["topLeft","topRight","bottomLeft","bottomRight","left","right","bottom","top","full"];function i9({sector:e,styleManagerDataConfig:t}){var x;const n=Ie(),s=e.getProperty("position"),r=s.getValue(),o=e.getProperty("top"),i=e.getProperty("right"),a=e.getProperty("bottom"),l=e.getProperty("left"),u=e.getProperty("z-index"),d={sector:e,styleManagerDataConfig:t},f=y=>n.t(`styleManager.position.${y}`),p=[s,o,i,a,l,u].map(y=>y==null?void 0:y.id),g=e.getProperties().filter(y=>!p.includes(`${y.id}`)),m=o9.map(y=>({id:y,label:f(`presets.options.${y}`)})),v=["absolute","fixed"].includes(r),b=y=>{let w="auto",S="auto",C="auto",j="auto";switch(y){case"topLeft":w="0%",j="0%";break;case"topRight":w="0%",S="0%";break;case"bottomLeft":C="0%",j="0%";break;case"bottomRight":C="0%",S="0%";break;case"left":w="0%",C="0%",j="0%";break;case"right":w="0%",C="0%",S="0%";break;case"bottom":j="0%",C="0%",S="0%";break;case"top":j="0%",w="0%",S="0%";break;case"full":j="0%",w="0%",S="0%",C="0%";break}o.upValue(w),i.upValue(S),a.upValue(C),l.upValue(j)};return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:s,children:[c.jsx(Le,{...Lt(s,d),tip:f(`tips.${(x=s.getOption())==null?void 0:x.id}`),...tp}),v&&c.jsx(F,{children:c.jsx(zt,{title:f("presets.title"),children:c.jsx(Le,{options:m,onChange:b,emptyState:"P",size:"s",caret:"",value:!0})})})]}),r!=="static"&&c.jsxs(c.Fragment,{children:[c.jsxs(ve,{col:!0,children:[c.jsx(k,{className:K("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...it(o,d)})}),c.jsxs(k,{gap:"s",children:[c.jsx(F,{grow:!0,children:c.jsx(Ne,{...it(l,d)})}),c.jsx(F,{grow:!0,children:c.jsx(Ne,{...it(i,d)})})]}),c.jsx(k,{className:K("gs-utl-w-1/2 gjs-m-auto"),children:c.jsx(Ne,{...it(a,d)})})]}),c.jsx(ve,{children:c.jsx(Ne,{...it(u,d)})})]}),g.length>0&&c.jsx(Ys,{properties:g,...d})]})}function a9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("width"),s=e.getProperty("min-width"),r=e.getProperty("max-width"),o=e.getProperty("height"),i=e.getProperty("min-height"),a=e.getProperty("max-height"),l={sector:e,styleManagerDataConfig:t},u=[n,s,r,o,i,a].map(f=>f==null?void 0:f.id),d=e.getProperties().filter(f=>!u.includes(`${f.id}`));return c.jsxs(c.Fragment,{children:[c.jsxs(ve,{property:[n,o],children:[c.jsx(Ne,{...it(n,l)}),c.jsx(Ne,{...it(o,l)})]}),c.jsxs(ve,{property:[s,i],children:[c.jsx(Ne,{...it(s,l)}),c.jsx(Ne,{...it(i,l)})]}),c.jsxs(ve,{property:[r,a],children:[c.jsx(Ne,{...it(r,l)}),c.jsx(Ne,{...it(a,l)})]}),d.length>0&&c.jsx(Ys,{properties:d,...l})]})}function l9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("padding"),s=e.getProperty("margin"),r={sector:e,styleManagerDataConfig:t},o=[n,s].map(a=>a==null?void 0:a.id),i=e.getProperties().filter(a=>!o.includes(`${a.id}`));return c.jsxs(c.Fragment,{children:[c.jsx(yn,{property:n,...r}),c.jsx(yn,{property:s,...r}),i.length>0&&c.jsx(Ys,{properties:i,...r})]})}function c9({sector:e,styleManagerDataConfig:t}){const n=e.getProperty("font-family"),s=e.getProperty("color"),r=e.getProperty("font-size"),o=e.getProperty("font-weight"),i=e.getProperty("line-height"),a=e.getProperty("letter-spacing"),l=e.getProperty("text-align"),u=e.getProperty("vertical-align"),d=e.getProperty("text-decoration"),f=e.getProperty("text-transform"),p=e.getProperty("direction"),g=e.getProperty("white-space"),m={sector:e,styleManagerDataConfig:t},v=[n,s,r,o,i,a,l,u,d,f,p,g].map(y=>y==null?void 0:y.id),b=e.getProperties().filter(y=>!v.includes(`${y.id}`)),{sdkAddFonts:x}=al();return c.jsxs(c.Fragment,{children:[!!n&&c.jsx(ve,{property:n,children:x?c.jsx(Mu,{...vw(n,m)}):c.jsx(Le,{...Lt(n,m)})}),!!s&&c.jsx(ve,{property:s,children:c.jsx(gr,{...Io(s,m)})}),c.jsxs(ve,{property:[r,o],children:[!!r&&c.jsx(Ne,{...it(r,m)}),!!o&&c.jsx(Le,{...Lt(o,m)})]}),c.jsxs(ve,{property:[i,a],children:[!!i&&c.jsx(Ne,{...it(i,m)}),!!a&&c.jsx(Ne,{...it(a,m)})]}),c.jsxs(ve,{property:[l,u],children:[!!l&&c.jsx(Le,{...Lt(l,m)}),!!u&&c.jsx(Le,{...Lt(u,m)})]}),c.jsxs(ve,{property:[f,p],children:[!!f&&c.jsx(Le,{...Lt(f,m)}),!!p&&c.jsx(Le,{...Lt(p,m)})]}),c.jsxs(ve,{property:[g,d],children:[!!g&&c.jsx(Le,{...Lt(g,m)}),!!d&&c.jsx(Le,{...Lt(d,m)})]}),b.length>0&&c.jsx(Ys,{properties:b,...m})]})}const tp={row:!0,classNameLabel:"gs-utl-w-full"},u9=({property:e,skipClear:t,label:n,afterLabelButtons:s=[]})=>c.jsxs(k,{nowrap:!0,full:!0,items:"center",justify:"between",gap:"s",children:[c.jsx(F,{grow:!1,children:c.jsx(_r,{property:e,skipClear:t,label:n})}),!!s.length&&c.jsx(k,{nowrap:!0,items:"center",justify:"start",gap:"x2s",children:s.map((r,o)=>c.jsx(St,{...r},o))})]}),hw="gs-style-manager",Vc=`${hw}-sector`,d9=`${Vc}-header`,f9=`${Vc}-content`,gw=(e,t=0,n=!0)=>M(d9,B.bgH2,Ee.xyS,B.br,t&&te.bt,(e||n)&&te.bb),p9=(e,t={})=>e.getOptions().map(n=>({id:e.getOptionId(n),label:e.getOptionLabel(e.getOptionId(n),t),title:n.title})),h9=(e,t)=>t.map(n=>({...n,title:e.getOptionLabel(e.getOptionId(n))})),yl=(e,t)=>{const n=g9(e,t),s=aw(n),{hasDataResolverValue:r}=n,{label:o}=t;return{connectDataSources:n,commonProps:{size:"s",disabled:r,placeholder:e.getDefaultValue(),tip:e.get("tip")||e.get("info"),labelAs:s.length?"span":void 0,label:c.jsx(u9,{property:e,skipClear:r,label:o,afterLabelButtons:s})}}},zh=(e,t)=>{const{connectDataSources:n,commonProps:s}=yl(e,t);return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(r,o)=>e.upValue(r,{partial:o})}},mw=(e,t,n)=>{const{connectDataSources:s,commonProps:r}=yl(e,t),{hasDataResolverValue:o,initialDataValue:i}=s;return{fieldProps:{...r,value:o?i:e.getValue(),options:p9(e,n??{}),onChange:a=>e.upValue(a)},connectDataSources:s}},Ns=(e,t,n)=>mw(e,t,n).fieldProps,Lt=(e,t,n)=>{const{fieldProps:s,connectDataSources:r}=mw(e,t,n),{hasDataResolverValue:o}=r,i=o?e.getValue()||" ":s.emptyState;return{...s,emptyState:i,hideCaret:o}},vw=(e,t)=>{const{commonProps:n,connectDataSources:s}=yl(e,t),r=s.hasDataResolverValue?e.getValue()||" ":void 0;return{...n,options:void 0,emptyState:r,hideCaret:s.hasDataResolverValue,value:s.dataResolverValue??e.getValue(),onChange:o=>e.upValue(o)}},Ar=(e,t,n={})=>{const{connectDataSources:s,commonProps:r}=yl(e,t),{hasDataResolverValue:o,dataResolverValue:i}=s;return{...r,title:e.getLabel(),emptyState:o?i:void 0,titleAdd:`Add new ${e.getLabel()}`,items:o?[]:e.getLayers(),selected:e.getSelectedLayer(),renderItem:a=>e.getLayerLabel(a),add:o?void 0:()=>e.addLayer(n,{at:0}),select:a=>e.selectLayer(a),remove:a=>e.removeLayer(a),move:(a,l=0)=>e.moveLayer(a,l)}},it=(e,t)=>{const{connectDataSources:n,commonProps:s}=yl(e,t),{hasDataResolverValue:r}=n;return{...s,value:n.dataResolverValue??e.getValue({noDefault:!0}),onChange:(o,i)=>e.upValue(o,{partial:i}),valueUnit:e.getUnit(),pan:!r,units:r?[]:e.getUnits(),min:e.getMin(),max:e.getMax()||void 0,step:e.getStep(),onChangeUnit:o=>e.upUnit(o)}};function g9(e,t){const{styleManagerDataConfig:n=!1,sector:s}=t,r=e.em.getEditor(),{Styles:o}=r,i=r.getSelected(),a=o.getSelectedAll(),l=o.getSelected();let u=!1;n===!0?u=!0:i&&vr(n)&&tt(n.enable)&&(u=n.enable({property:e,sector:s,component:i,editor:r}));const d=e.getName(),f=(l==null?void 0:l.getStyle("",{skipResolve:!0})[d])??"",p=Kr(f),g=i==null?void 0:i.collectionsStateMap;return{hasDataResolverValue:p,dataResolverValue:p?l==null?void 0:l.getStyle()[d]:void 0,enableDataValue:u,initialDataValue:f,handleDataValueChange:m=>{a.forEach(v=>{v.addStyle({[d]:m})})},handleValueClear:()=>{a.forEach(m=>{const v=m.getStyle()[d]??"";m.addStyle({[d]:v})})},editor:r,additionalSources:g}}const Io=(e,t)=>zh(e,t),m9=(e,t)=>{const{label:n,...s}=zh(e,t);return{...s,label:n,isContain:e.get("contain")??!0,hideButton:s.disabled,inputField:e.get("inputField"),onOpen(){const r=e.em.Assets;r.open({select(o){e.upValue(o.getSrc()),r.close()}})}}},v9=(e,{styleManagerDataConfig:t})=>{const n=e.getId();let s=KI;switch(n){case"gs-layout":s=r9;break;case"gs-size":s=a9;break;case"gs-space":s=l9;break;case"gs-position":s=i9;break;case"gs-borders":s=QI;break;case"gs-effects":s=t9;break;case"gs-typography":s=c9;break;case"gs-background":s=JI;break}return c.jsx(s,{sector:e,styleManagerDataConfig:t})},Kd={},bw=ce(function({className:t,sectors:n}){var p;const[s,r]=h.useState(Kd),o=xe(),{editor:i}=o,a=i==null?void 0:i.Styles,l=a==null?void 0:a.getSelected(),u=i==null?void 0:i.getSelected();if(h.useEffect(()=>{if(u&&i){const g=setTimeout(()=>{let m=Kd;const v=u.get("styleManager");tt(v)&&(m=v({editor:i,component:u})),r(m||Kd)});return()=>clearTimeout(g)}},[u,i]),!a||!l)return null;const d=n.length?n:a.getSectors({visible:!0}),f=(p=o.sdkOptions.dataSources)==null?void 0:p.styleManager;return s.disabled?null:c.jsx("div",{className:M(hw,t,"gs-utl-select-none"),children:d.map((g,m)=>c.jsx(hr,{open:g.isOpen(),onChange:({open:v})=>g.setOpen(v),classNameWrap:M(Vc,`${Vc}__${g.id}`),sticky:!0,handler:()=>{const v=g.getProperties({withValue:!0}).length>0,b=g.getProperties({withParentValue:!0}).length>0;return c.jsxs(k,{gap:"xs",items:"center",children:[c.jsx(F,{className:"gs-utl-mr-2",children:g.getName()}),v&&c.jsx(F,{children:c.jsx("div",{className:M(Oe.dot,B.bgA2)})}),b&&c.jsx(F,{children:c.jsx("div",{className:M(Oe.dot,B.bgW)})})]})},className:v=>gw(v,m,m===d.length-1),children:c.jsx(k,{className:M(f9,"gs-utl-p-2 gs-utl-gap-2"),col:!0,children:v9(g,{styleManagerDataConfig:f})})},g.id))})}),b9=h.forwardRef(function({children:t,className:n,content:s,...r},o){return c.jsx("div",{className:M(ie("gs-design-manager-tab"),n),ref:o,...r,children:t})}),tv="gs-cmp-sidebar-right",nv="gs-cmp-traits-provider",Zd=M("gs-utl-overflow-y-auto gs-utl-overflow-x-hidden gs-utl-max-w-full");function y9(){var y,w,S;const{isCssPanelActive:e,selectedDesignerTab:t,showSelectors:n,setSelectedDesignerTab:s,sdkProps:r,sdkOptions:o,isProjectTypeEmail:i}=xe(),a=Ie(),l=M(e&&"gs-utl-hidden"),d=(((y=Zn(r.children,b9))==null?void 0:y.filter(Boolean))||[]).map(({props:C},j)=>({id:C.id,label:C.label,content:c.jsx(dl,{children:C.children}),order:C.order??2+j+1})),f=(w=o.designPanel)==null?void 0:w.propsInStyles,p=(S=o.designPanel)==null?void 0:S.hideTabs,g=f===!0||i&&f!==!1,m=p===!0||i&&p!==!1,v=a.t("traitManager.panelLabel"),x=[{id:"style",label:a.t("styleManager.panelLabel"),order:1,content:c.jsxs(k,{col:!0,full:!0,children:[!!n&&c.jsx(F,{className:M("gs-cmp-selectors-provider",Ee.s,te.bb,B.br),children:c.jsx(vy,{children:C=>c.jsx(uw,{...C})})}),g&&c.jsx(F,{className:M(nv,Zd),children:c.jsx(hr,{handler:v,className:gw(!1),sticky:!0,open:!0,children:c.jsx(Mf,{children:C=>c.jsx(Qf,{...C,className:M("gs-utl-p-2",B.br,te.bb)})})})}),c.jsx(F,{className:M("gs-cmp-styles-provider",Zd),grow:!0,children:c.jsx(by,{children:C=>c.jsxs(c.Fragment,{children:[e&&c.jsx(yy,{}),c.jsx(bw,{className:l,...C})]})})})]})},!g&&{id:"props",label:v,order:2,content:c.jsx(k,{className:nv,col:!0,full:!0,children:c.jsx(F,{className:M(Ee.s,Zd),children:c.jsx(Mf,{children:C=>c.jsx(Qf,{...C})})})})},...d].filter(Boolean).sort((C,j)=>C.order-j.order);return c.jsx(k,{className:tv,col:!0,full:!0,nowrap:!0,children:c.jsx(ro,{value:t,onChange:s,tabs:x,className:M(`${tv}__tabs`,m&&"gs-utl-hidden")})})}const yw=ce(y9),x9="gs-panel-sidebar-tabs",w9=h.memo(ce(function({className:t,...n}){return c.jsx(ws,{className:M(x9,"gs-utl-h-full",t),...n,children:c.jsx(yw,{})})})),S9="gs-panel-styles",C9=h.memo(ce(function({className:t,...n}){const{isCssPanelActive:s}=xe(),r=M(s&&" gs-utl-hidden");return c.jsx(ws,{className:M(S9,"gs-utl-overflow-auto gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-auto"),...n,children:c.jsx(by,{children:o=>c.jsxs(c.Fragment,{children:[s&&c.jsx(yy,{}),c.jsx(bw,{className:r,...o})]})})})})),j9="gs-panel-templates",E9=h.memo(ce(function({className:t,templates:n,content:s,onSelect:r,...o}){const i=k0(),{projectTypeFilter:a}=i;let l=n??i.templates;return l=l==null?void 0:l.map(u=>({...u,isTemplate:!0})),h.useEffect(()=>{n||i.loadTemplates()},[n]),c.jsx(ws,{className:M(j9,"gs-utl-overflow-hidden gs-utl-h-full",t),classNameAccordion:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),classNameAccordionContent:M("gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),...o,children:c.jsx(k,{className:ie("relative gs-utl-h-full"),nowrap:!0,col:!0,space:"m",children:c.jsx(k,{className:ie("gs-utl-h-[75vh] gs-utl-flex-grow"),nowrap:!0,col:!0,space:"m",children:c.jsx(nx,{templates:l,projectType:jt[a],content:s,onSelect:r,skipProjectNamePopover:!0})})})})})),T9="gs-cmp-row",P9=h.memo(function({className:t,children:n,full:s,...r}){return c.jsx(Cn,{className:M(T9,B.bg,"gs-utl-flex",s&&"gs-utl-w-full",t),...r,children:$t(n)})}),O9="gs-cmp-select-field",_9=h.memo(ce(function({className:t,style:n,label:s,name:r,value:o,options:i,size:a,onChange:l,required:u,disabled:d,emptyState:f,editorEvents:p}){const{editor:g}=xe(),[m,v]=h.useState(()=>({required:u,disabled:d,style:n,className:t,label:s,name:r,value:o,options:i,size:a,emptyState:f})),b=x=>{l({value:x,editor:g,state:m,setState:y=>v(w=>({...w,...y}))})};return co({editor:g,editorEvents:p,localState:m,setLocalState:v}),c.jsx(Le,{classNameContainer:M(O9,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})})),A9="gs-cmp-select-field",L9=h.memo(ce(function({className:t,style:n,label:s,name:r,value:o,size:i,onChange:a,required:l,disabled:u,emptyState:d,editorEvents:f}){const{editor:p}=xe(),[g,m]=h.useState(()=>({required:l,disabled:u,style:n,className:t,label:s,name:r,value:o,size:i,emptyState:d})),v=b=>{a({value:b,editor:p,state:g,setState:x=>m(y=>({...y,...x}))})};return co({editor:p,editorEvents:f,localState:g,setLocalState:m}),c.jsx(Mu,{classNameContainer:M(A9,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})})),M9="gs-sidebar-bottom",N9=h.memo(ce(function({children:t,className:n,style:s,height:r,...o}){const{isInPreview:i,isBottomSidebarOpen:a}=xe(),l=r??35,u=h.useMemo(()=>({height:l,marginBottom:i||!a?`-${l}px`:0,...s}),[i,a,s]);return c.jsx(Cn,{className:M(M9,"gs-utl-flex gs-utl-transition-spacing",te.bt,B.br,n),style:u,...o,children:t?$t(t):void 0})})),$9=ce(function(t){var w;const{leftSidebarSize:n,setLeftSidebarSize:s,editor:r,isInPreview:o,isLeftSidebarOpen:i,sdkProps:a,showPages:l}=xe(),u=a.children,d=((w=t.style)==null?void 0:w.width)??t.width,f=d??n,p=t.resizable===!1,g=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.br,B.br),m=M("gs-utl-w-full",te.bb,B.br),v=M("gs-utl-w-full gs-utl-overflow-hidden gs-utl-flex gs-utl-flex-col"),b=h.useMemo(()=>({marginLeft:o||!i?`-${f}px`:0,...t.style}),[f,o,i,t.style]),x=()=>r==null?void 0:r.refresh(),y=(S,C,j)=>{s(j.getBoundingClientRect().width)};return c.jsx(Lu,{className:g,enable:p?!1:void 0,right:!p,style:b,height:"100%",width:f,minWidth:d??200,maxWidth:d??400,onResize:x,onResizeStop:y,children:t.children??c.jsxs(k,{full:!0,col:!0,children:[l&&c.jsx(F,{className:m,children:c.jsx(my,{children:S=>c.jsxs(c.Fragment,{children:[Zn(u,tw),c.jsx(Qx,{...S}),Zn(u,ew)]})})}),c.jsx(F,{className:v,grow:!0,children:c.jsx(gy,{children:S=>c.jsxs(c.Fragment,{children:[Zn(u,Ax),c.jsx(Ox,{...S}),Zn(u,_x)]})})})]})})}),k9="gs-sidebar-left",R9=h.memo(ce(function({children:t,width:n,resizable:s,...r}){return c.jsx($9,{className:M(k9,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",bu(r)),width:n,resizable:s,style:yu(r),children:t?$t(t):void 0})})),I9=ce(function(t){var m;const{rightSidebarSize:n,setRightSidebarSize:s,editor:r,isInPreview:o,isRightSidebarOpen:i}=xe(),a=((m=t.style)==null?void 0:m.width)??t.width,l=a??n,u=t.resizable===!1,d=M(t.className,"gs-utl-h-full gs-utl-transition-spacing",te.bl,B.br),f=h.useMemo(()=>({marginRight:o||!i?`-${l}px`:0,...t.style}),[l,o,i,t.style]),p=()=>r==null?void 0:r.refresh(),g=(v,b,x)=>{s(x.getBoundingClientRect().width)};return c.jsx(Lu,{className:d,enable:u?!1:void 0,left:!u,style:f,height:"100%",width:l,minWidth:a??200,maxWidth:a??400,onResize:p,onResizeStop:g,children:t.children??c.jsx(yw,{})})}),V9="gs-sidebar-right",H9=h.memo(ce(function({children:t,resizable:n,...s}){return c.jsx(I9,{className:M(V9,"gs-utl-flex gs-utl-flex-col gs-utl-flex-nowrap",bu(s)),resizable:n,style:yu(s),children:t?$t(t):void 0})})),D9=ce(function({className:t,variant:n,value:s,tabs:r,style:o,editorEvents:i,onChange:a}){const{editor:l}=xe(),[u,d]=h.useState(()=>({tabs:r,style:o,value:s,variant:n,className:t})),f=h.useMemo(()=>{var g;return((g=u.tabs)==null?void 0:g.map(m=>({...m,content:$t(m.children)})))||[]},[u.tabs]),p=g=>{a&&l?a({value:g,editor:l,state:u,setState:m=>d(v=>({...v,...m}))}):d(m=>({...m,value:g}))};return co({editor:l,editorEvents:i,localState:u,setLocalState:d}),c.jsx(ro,{tabs:f,className:M(u.className),variant:u.variant,value:u.value,style:u.style,onChange:p})}),F9="gs-cmp-text",B9=h.memo(function({className:t,content:n,children:s,...r}){return c.jsx(Cn,{className:M(F9,t),...r,children:s||n})}),z9="gs-cmp-virtual-list",U9=ce(function({id:t,items:n,itemLayout:s,footerLayout:r,onRef:o,itemsPerRow:i=12,className:a,style:l,htmlAttrs:u}){const[d,f]=h.useState(0),{editor:p,transitionTime:g}=xe(),m=Sh(i),v=i===1;h.useEffect(()=>{const w=setTimeout(()=>f(S=>++S),g);return()=>clearTimeout(w)},[g]);const b={id:t,...u},x=!!d&&!!p,y={data:n,style:l,className:M(z9,"gs-utl-h-full",a),itemContent:(w,S)=>c.jsx(h.Fragment,{children:s?$t(s({item:S,index:w,editor:p})):c.jsx("pre",{children:JSON.stringify(S,void 0,2)})},S.id??w),components:{Footer:r&&p?()=>$t(r({editor:p})):void 0}};return x&&(v?c.jsx(i$,{...b,...y,ref:o},t):c.jsx(Tu,{...b,listClassName:`gs-utl-grid gs-utl-gap-2 gs-utl-pr-2 ${m}`,...y,ref:o},t))});var np=(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))(np||{});const W9={icon:ne,row:P9,column:wk,text:B9,tabs:D9,button:vu,buttonMenu:SM,buttonGroupField:jM,colorPicker:yk,menuList:fR,inputField:uR,codeField:G$,selectField:_9,selectFontField:L9,devices:rx,panelPages:nw,panelPageSettings:q8,panelLayers:Lx,panelPagesLayers:eI,panelBlocks:WR,panelGlobalStyles:i6,panelSelectors:HI,panelStyles:C9,panelProperties:PI,panelSidebarTabs:w9,panelAssets:$R,panelTemplates:E9,sidebarRight:H9,sidebarLeft:R9,sidebarTop:ox,sidebarBottom:N9,canvas:wy,canvasSidebarTop:U$,virtualList:U9,dataPathField:tR,panelDataVariablePicker:lR,panelDataConditionPicker:Qk,panelDataCollectionPicker:Dk,panelDataValuePicker:rR},$t=e=>{const t=Array.isArray(e)?e:e?[e]:[],n=p3();return t.filter(Boolean).map((s,r)=>{const{type:o,...i}=dt(s)?{type:np.text,content:s}:s||{},a=i.id||"",l=W9[o],u=n.layoutChildren.get(a),d=n.customLayoutComponents.get(o),f=a||r;if(u)return c.jsx(Pf,{id:a,...u},f);if(d){const p=d({id:a,...i});return $t([p])[0]}else{if(o===np.custom)return c.jsx(Pf,{id:a,...i},f);if(l)return c.jsx(l,{id:a,...i},f)}return null})},G9=ce(({components:e})=>($0().customLayoutComponents,$t(e))),co=e=>{const{editorEvents:t,editor:n,localState:s,setLocalState:r}=e;h.useEffect(()=>{if(!t||!n)return;const o=Object.keys(t).reduce((a,l)=>(a[l]=(u={})=>{const d=t[l];d({fromEvent:u,editor:n,state:s,setState:f=>r(p=>({...p,...f}))})},a),{}),i=Object.keys(o);return i.forEach(a=>n.on(a,o[a])),()=>{i.forEach(a=>n.off(a,o[a]))}},[n,s])},q9=e=>e.Assets.getAll().reduce((s,r)=>{const o=r.getSrc(),i=o.match(/^data:([^;]+);/);if(i){const a=o.split(",")[1],l=DA(r.get("name"));s[o]={mime:i[1],name:l,base64:a}}return s},{}),K9=e=>e.replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"),sv=(e,t,n={})=>{let s=e;const r=n.pathPfx||"";for(const o in t)if(s.includes(o)){const i=t[o];s=s.replace(new RegExp(K9(o),"g"),`${r}${i.name}`),i.found=!0}return s},Z9=(e,t,n)=>`${t||""}${e||""}${n||""}`,Y9=(e,t)=>{const n=e?`<div ${Oc}>${e}</div>`:"",s=t?`<div ${Oc} data-gjs-global>${t}</div>`:"";return`${n}${s}`},X9=async(e,t={})=>{const{page:n,skipProject:s,assetsFolder:r="assets",filenameCss:o="style.css",styles:i,isMJML:a,exportConfig:l,skipGlobalCode:u,skipCustomCodeBody:d,scriptComponents:f}=t,p={...l,...e.config.optsHtml||{},...t.optionsHtml},g=[],m=n?[n]:e.Pages.getAll(),v=q9(e),b=`${r}/`,x=e.getCss({keepUnusedStyles:!0,component:n==null?void 0:n.getMainComponent(),...t.optionsCss})||"",y=sv(x,v,{pathPfx:b}),w=i==="inline",S=i==="skip",C=i==="skipInPage",j=f==="skip",E=u?{}:ji(e).globalPageSettings||{},O=[],P=(T,_)=>{var Ft,Xs,uo;const{pageSettingOpts:L}=_||{},N=T.getName(),V=w||(L==null?void 0:L.replaceDataSources),A=jr(T,"title",L)||N,H=jr(T,"favicon",L),U=jr(T,"description",L),D=jr(T,"keywords",L),$=jr(T,"socialTitle",L),I=jr(T,"socialDescription",L),R=jr(T,"socialImage",L),z=u?"":j0(jr(T,"fonts")),X=on({page:T,key:"customCodeHead",opts:L})??"",Z=Z9(X,E.customCodeHead,z),Y=on({page:T,key:"customCodeBody",opts:L})??"",J=d?"":Y9(Y,E.customCodeBody),ee=T.getMainComponent(),W=j?"":e.getJs({component:ee}),Q=W?`<script>${W}<\/script>`:"",ae=[],ge=[],Ce={asDocument:!1,...p},Se=ee.toHTML(Ce).replace("</body>",()=>`${J}${Q}</body>`),et=ee.head;let Ye=A&&`<title>${A}</title>`,Ct=H&&`<link rel="icon" href="${H}"/>`,ct=U&&`<meta name="description" content="${U}"/>`,we=D&&`<meta name="keywords" content="${D}"/>`,nt=$&&`<meta property="og:title" content="${$}"/>`,st=I&&`<meta property="og:description" content="${I}"/>`,vt=R&&`<meta property="og:image" content="${R}"/>`,Me='<meta charset="utf-8">',ft='<meta name="viewport" content="width=device-width,initial-scale=1">',ut='<meta name="robots" content="index,follow">',Fe='<meta name="generator" content="GrapesJS Studio">';et.components().forEach(Xe=>{const bt=Xe.toHTML(p);pt.title({cmp:Xe})?Ye=bt:pt.favicon({cmp:Xe})?Ct=bt:pt.description({cmp:Xe})?ct=bt:pt.keywords({cmp:Xe})?we=bt:pt.socialTitle({cmp:Xe})?nt=bt:pt.socialDescription({cmp:Xe})?st=bt:pt.socialImage({cmp:Xe})?vt=bt:pt.charset({cmp:Xe})?Me=bt:pt.viewport({cmp:Xe})?ft=bt:pt.robots({cmp:Xe})?ut=bt:pt.generator({cmp:Xe})&&(Fe=bt)}),Ye&&ae.push(Ye),Me&&ae.push(Me),ft&&ae.push(ft),ut&&ae.push(ut),Fe&&ae.push(Fe),ct&&ae.push(ct),we&&ae.push(we),nt&&ae.push(nt),st&&ae.push(st),vt&&ae.push(vt),Ct&&ae.push(Ct),ge.length&&ae.push(...ge),Z&&ae.push(Z),y&&!(S||C)&&ae.push(V?`<style>${y}</style>`:`<link rel="stylesheet" href="./${o}">`);const he=ee.doctype||"<!DOCTYPE html>",Ve=(Xs=(Ft=ee.docEl).__attrToString)==null?void 0:Xs.call(Ft,p),De=(uo=et.__attrToString)==null?void 0:uo.call(et,p),$e=e.getHtml(p).trim(),Ot=a?e.runCommand(gu,{mjml:$e}).html:`${he}
|
|
335
|
+
<html${Ve?` ${Ve}`:""}>
|
|
336
|
+
<head${De?` ${De}`:""}>
|
|
337
|
+
${ae.join(`
|
|
403
338
|
`)}
|
|
404
339
|
</head>
|
|
405
|
-
${
|
|
340
|
+
${Se}
|
|
406
341
|
</html>
|
|
407
|
-
`;return{filename:
|
|
342
|
+
`;return{filename:Ef(e,T),content:sv(Ot,v,{pathPfx:b}),mimeType:"text/html"}};m.forEach(T=>{if(fu(T)){const L=T.getMainComponent(),{dataSourceItem:N}=t,V=N?[N]:L.getDataSourceItems(),A=L.resolverCurrentItem;Object.entries(V).forEach(([H,U])=>{const D=U;L.setResolverCurrentItem(D.id??H);const $=P(T,{pageSettingOpts:{replaceDataSources:!0}}),{path:I,filename:R}=L0(T,{currentItem:D});$.path=I,$.filename=R,O.push($)}),L.setResolverCurrentItem(A)}else O.push(P(T))}),g.push(...O),a&&m.forEach(T=>{g.push({filename:Ef(e,T,"mjml"),content:T.getMainComponent().toHTML(p),mimeType:"text/mjml"})});for(const T in v){const _=v[T];_.found&&g.push({path:r,filename:_.name,content:atob(_.base64),mimeType:_.mime})}return y&&!w&&!S&&g.push({filename:o,content:y,mimeType:"text/css"}),s||g.push({filename:"gjs-project.grapesjs",content:JSON.stringify(e.getProjectData()),mimeType:"application/json"}),g};function J9(e){const{Components:t,Blocks:n}=e,s=r=>{const{model:o,id:i}=r,a=o.getDefaults(),l=n.get(i),u=a.icon,d=l==null?void 0:l.get("media"),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(i,{model:{defaults:{icon:p}}})};t.getTypes().forEach(s),e.on("component:type:add",s)}const Q9=(e,t)=>{const{contextMenu:n}=t.appStore.store,{Canvas:s}=e;e.on(s.events.frameLoad,({window:r,el:o})=>{r.document.addEventListener("contextmenu",async a=>{if(!n.isEnabled||e.getEditing())return;a.preventDefault();const l=a.target,u=e.getModel().get("componentHovered")||e.Utils.helpers.getModel(l);if(u){const d=o.getBoundingClientRect(),f=s.getZoomDecimal();e.runCommand(se.contextMenuComponent,{component:u,event:a,x:a.clientX*f+d.left,y:a.clientY*f+d.top})}})})};function e7(e,t){var g;const{Components:n,I18n:s}=e,{appStore:r}=t,o=s.t("dataSources.collection"),i=Ut.collection,a=Ut.collectionItem,l="data-type-data-collection",u='<svg viewBox="0 0 24 24"><path d="M2 14H8V20H2M16 8H10V10H16M2 10H8V4H2M10 4V6H22V4M10 20H16V18H10M10 16H22V14H10" /></svg>',d=(g=t.appStore.sdkOptions.dataSources)==null?void 0:g.blocks,f=m=>{const v=m.is(i)?m:m.closestType(i);if(!v)return;const b="dataCollectionPicker",x={id:b,header:!1,layout:{type:"panelDataCollectionPicker",component:v,onConfirm:()=>e.runCommand(se.layoutRemove,{id:b})},placer:{type:"dialog",title:s.t("dataSources.editCollection"),size:"l"}};e.runCommand(se.layoutToggle,{...x})},p=({items:m,component:v})=>[{id:`open-${i}-picker`,label:Eh,command:()=>f(v)},...m];n.addType(a,{isComponent:m=>pi(m,a),model:{defaults:{...zf(r),name:s.t("dataSources.collectionItem"),copyable:!1,emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M22 13H14V11H22V13M22 7H14V9H22V7M14 17H22V15H14V17M12 9V15C12 16.1 11.1 17 10 17H4C2.9 17 2 16.1 2 15V9C2 7.9 2.9 7 4 7H10C11.1 7 12 7.9 12 9M10.5 15L8.3 12L6.5 14.3L5.3 12.8L3.5 15H10.5Z" /></svg>',toolbarItems:p}}}),n.addType(i,{isComponent:m=>rl(m,l)||pi(m,i),block:d&&{label:o,media:u,content:{type:i,components:{type:a},dataResolver:{startIndex:0,endIndex:1,dataSource:{type:"data-variable",path:""}}},...Th},model:{defaults:{...Ph(r),icon:u,name:o,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 t7(e,t){var x;const{Components:n,I18n:s}=e,r=s.t("dataSources.condition"),o=s.t("dataSources.conditionTrue"),i=s.t("dataSources.conditionFalse"),a=s.t("dataSources.conditionElse"),{appStore:l}=t,u=(x=l.sdkOptions.dataSources)==null?void 0:x.blocks,d=Ut.condition,f=Ut.conditionTrue,p=Ut.conditionFalse,g="data-type-data-condition",m=`<svg viewBox="0 0 24 24">
|
|
408
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" />
|
|
409
|
-
</svg>`,
|
|
344
|
+
</svg>`,v=y=>{const w=y.is(d)?y:y.closestType(d);if(!w)return;const S="dataConditionPicker",C={id:S,header:!1,layout:{type:"panelDataConditionPicker",component:w,onConfirm:()=>e.runCommand(se.layoutRemove,{id:S})},placer:{type:"dialog",title:s.t("dataSources.editCondition"),size:"l"}};e.runCommand(se.layoutToggle,{...C})},b=({items:y,component:w})=>[{id:`open-${d}-picker`,label:Eh,command:()=>v(w)},...y];n.addType(f,{isComponent:y=>pi(y,f),model:{defaults:{...zf(l),tagName:"span",name:o,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M21,7L9,19L3.5,13.5L4.91,12.09L9,16.17L19.59,5.59L21,7Z" /></svg>',toolbarItems:b}}}),n.addType(p,{isComponent:y=>pi(y,p),model:{defaults:{...zf(l),tagName:"span",name:i,copyable:!1,emptyState:{styleIn:"display: inherit;"},icon:'<svg viewBox="0 0 24 24"><path d="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z" /></svg>',toolbarItems:b}}}),n.addType(d,{isComponent:y=>rl(y,g)||pi(y,d),block:u&&{label:r,media:m,content:{type:d,dataResolver:{condition:{logicalOperator:"and",statements:[{left:1,operator:">",right:0}]}},components:[{type:f},{type:p}]},...Th},model:{defaults:{...Ph(l),icon:m,name:r,textable:!0,stylable:!1,tagName:"span",attributes:{[g]:!0},toolbarItems:b}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:y}=this;this.listenTo(y,Rn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(y){e.getEditing()||(y==null||y.stopPropagation(),v(this.model))},getConditionString(){const{model:y}=this,{operator:w,statements:S=[]}=y.getCondition(),C=w==="AND"?" AND ":" OR ",E=S.map(O=>{const{left:P="",operator:T="",right:_=""}=O,L=d1(P),N=d1(_);return`(${L} ${T} ${N})`}).join(C);return`${r}: ${E}`},renderDataResolver(){const y=this.model,w=y.getIfTrueContent(),S=y.getIfFalseContent(),C=w==null?void 0:w.getEl(),j=S==null?void 0:S.getEl();if(e.runCommand(se.getStateDataSource).showPlaceholder){C&&(C.style.display="",C.style.setProperty(So,`"${this.getConditionString()} "`)),j&&(j.style.display="",j.style.setProperty(So,`" ${a} "`));return}const O=y.isTrue();C&&(C.style.removeProperty(So),C.style.display=O?"":"none"),j&&(j.style.removeProperty(So),j.style.display=O?"none":"")}}})}function n7(e,t){var f;const{Components:n,I18n:s}=e,r=Ut.variable,o="data-type-data-variable",i="Variable",a=`<svg viewBox="0 0 24 24"><path fill="currentColor" d="${ac.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(se.layoutRemove,{id:g})},placer:{type:"dialog",title:s.t("dataSources.editVariable"),size:"l"}};e.runCommand(se.layoutToggle,{...m})};n.addType(r,{isComponent:p=>rl(p,o)||pi(p,r),block:u&&{label:i,media:a,content:{type:r,dataResolver:{path:"",defaultValue:s.t("dataSources.defaultValue")}},...Th},model:{defaults:{...Ph(l),icon:a,name:i,textable:!0,tagName:"span",attributes:{[o]:!0},toolbarItems:({items:p,component:g})=>[{id:`open-${r}-modal`,label:Eh,command:()=>d(g)},...p]}},view:{events:()=>({dblclick:"onActive"}),init(){const{em:p}=this;this.listenTo(p,Rn.toggleDataSourcesPreview,this.renderDataResolver)},onActive(p){e.getEditing()||(p==null||p.stopPropagation(),d(this.model))},renderDataResolver(){const{model:p,el:g}=this;if(e.runCommand(se.getStateDataSource).showPlaceholder){const v=p.getPath();g.textContent="",g.style.setProperty(So,`"${px(v)}"`);return}g.style.removeProperty(So),g.textContent=p.getDataValue()}}})}const ei=(e,t,n)=>{const s=e.Components.getType(t);if(!s){console.warn(`Component type ${t} not found`);return}const r=s.model;e.Components.addType(t,{model:{...n,toHTML(o){var a;const{exporter:i}=o??{};return i?((a=n.toHTML)==null?void 0:a.call(this,o))??"":r.prototype.toHTML.call(this,o)??""}}})};function Ql({component:e,value:t,getCustomPath:n}){if(vr(t)&&t.path&&!t.collectionId&&n){const s=t.path??"",r=s.split(".");return{...t,path:n({component:e,path:s,paths:r})}}return t}function s7(e,{isProjectTypeEmail:t}){const n=({content:o})=>t?`<mj-raw>${o}</mj-raw>`:o,s=({content:o})=>o;function r(o){const i=this.getInnerHTML(o);if(t||o.skipTags)return i;const a=this.tagName,l=this.__attrToString(o),u=l?` ${l}`:"",d=`<${a}${u}>`,f=`</${a}>`;return`${d}${i}${f}`}ei(e,Ut.variable,{toHTML(o){var b;const i=o.skipTags??t,a=o.exporter,l=o.wrapTemplateContent??s,u=x=>l({component:this,content:x}),d=this.tagName,f=this.__attrToString(o),p=(b=this.getDataResolver)==null?void 0:b.call(this),g=Ql({component:this,value:p,getCustomPath:o==null?void 0:o.getCustomPath}),m=a.getVariableSyntax({component:this,dataResolver:g}),v=u(m);return i?v:`<${d}${f?` ${f}`:""}>${v}</${d}>`}}),ei(e,Ut.condition,{toHTML(o){var w,S,C;const{exporter:i}=o,a=o.wrapTemplateContent??n,l=j=>a({component:this,content:j}),u={component:this},d=o==null?void 0:o.getCustomPath,[f,p]=((w=this.components())==null?void 0:w.models)??[],g=(S=this.getDataResolver)==null?void 0:S.call(this),m=((C=this.resolveCondition)==null?void 0:C.call(this,g==null?void 0:g.condition,d))??{};let v="";if(p){const j=i.getConditionElseSyntax(u);v=`
|
|
410
345
|
${l(j)}
|
|
411
|
-
${p.toHTML(o)??""}`}const
|
|
412
|
-
${`${l(
|
|
413
|
-
${(f==null?void 0:f.toHTML(o))??""}${
|
|
346
|
+
${p.toHTML(o)??""}`}const b=i.getConditionalStartSyntax({...u,dataResolver:{condition:m}}),x=i.getConditionalEndSyntax(u);return`
|
|
347
|
+
${`${l(b)}
|
|
348
|
+
${(f==null?void 0:f.toHTML(o))??""}${v}
|
|
414
349
|
${l(x)}`}
|
|
415
|
-
`},resolveCondition(o,i){if(typeof o=="boolean")return o;if(!o)return{};if(
|
|
416
|
-
${
|
|
417
|
-
${u(
|
|
350
|
+
`},resolveCondition(o,i){if(typeof o=="boolean")return o;if(!o)return{};if(jk(o))return{...o,statements:o.statements.map(l=>this.resolveCondition(l,i))??[]};const a={component:this,getCustomPath:i};return{...o,left:Ql({...a,value:o.left}),right:Ql({...a,value:o.right})}}}),ei(e,Ut.collection,{toHTML(o){const i=o.skipTags??t,{exporter:a}=o,l=o.wrapTemplateContent??n,u=E=>l({component:this,content:E}),d={component:this},f=this.getDataResolver(),p={...f,dataSource:Ql({component:this,value:f==null?void 0:f.dataSource,getCustomPath:o==null?void 0:o.getCustomPath})},g=this.components().at(0),m=a.getCollectionStartSyntax({...d,dataResolver:p}),v=a.getCollectionEndSyntax(d),b=(g==null?void 0:g.toHTML(o))??"",x=`${u(m)}
|
|
351
|
+
${b}
|
|
352
|
+
${u(v)}`;if(i)return`
|
|
418
353
|
${x}
|
|
419
354
|
`;const y=this.tagName,w=this.__attrToString(o),S=w?` ${w}`:"",C=`<${y}${S}>`,j=`</${y}>`;return`
|
|
420
355
|
${C}${x}${j}
|
|
421
|
-
`}}),
|
|
356
|
+
`}}),ei(e,Ut.conditionTrue,{toHTML:r}),ei(e,Ut.conditionFalse,{toHTML:r}),ei(e,Ut.collectionItem,{toHTML:r})}const r7=function(e,t){const{Components:n,Canvas:s,events:r}=e;if(!n.getType(Ut.conditionTrue))return;const{isProjectTypeEmail:o,sdkOptions:i}=t.appStore,{dataSources:a}=i;a!=null&&a.globalData&&e.on(r.projectLoad,()=>{e.DataSources.add({id:Uo.globalData,records:hx(a.globalData),skipFromStorage:!0})}),e.on(s.events.frameLoadBody,({window:l})=>{const u="data-outline-ds",d=l.document;if(d.querySelector(`style[${u}]`))return;const p=d.createElement("style"),g=[Ut.variable,Ut.condition,Ut.collection].map(m=>`.gjs-dashed [data-gjs-highlightable][data-gjs-type="${m}"]`);p.setAttribute(u,""),p.textContent=`
|
|
422
357
|
${g.join(",")} {
|
|
423
358
|
outline: 2px dotted #8b5cf6;
|
|
424
359
|
}
|
|
@@ -431,7 +366,7 @@ ${C}${x}${j}
|
|
|
431
366
|
[data-gjs-type="data-variable"]::before,
|
|
432
367
|
[data-gjs-type="data-condition-true-content"]::before,
|
|
433
368
|
[data-gjs-type="data-condition-false-content"]::before {
|
|
434
|
-
content: var(${
|
|
369
|
+
content: var(${So});
|
|
435
370
|
font-style: italic;
|
|
436
371
|
color: #666;
|
|
437
372
|
white-space: nowrap;
|
|
@@ -442,7 +377,7 @@ ${C}${x}${j}
|
|
|
442
377
|
font-weight: 500;
|
|
443
378
|
font-family: sans-serif;
|
|
444
379
|
}
|
|
445
|
-
`,d.head.appendChild(p)}),
|
|
380
|
+
`,d.head.appendChild(p)}),n7(e,t),t7(e,t),e7(e,t),s7(e,{isProjectTypeEmail:o})};function o7(e){const{Components:t}=e,n=s=>{const{id:r,model:o}=s;if(r==="custom-code"){const i="<span>Insert here your custom code</span>";t.addType(r,{model:{defaults:{emptyState:!0,icon:'<svg viewBox="0 0 24 24"><path d="M14.6 16.6l4.6-4.6-4.6-4.6L16 6l6 6-6 6-1.4-1.4m-5.2 0L4.8 12l4.6-4.6L8 6l-6 6 6 6 1.4-1.4z"></path></svg>',classes:"gjs-custom-code",components:i,"custom-code-plugin__code":i,styles:".gjs-custom-code { padding: 5px; }"}}})}if(r==="typed"){const i=o.getDefaults().traits.map(a=>a.name==="strings"?{...a,type:"stack",addItem(l){return{id:l,label:`New string ${l}`}},getValue({component:l}){return l.get("strings").map((u,d)=>({id:`${d}`,label:u}))},setValue:({component:l,value:u})=>{const d=u.map(f=>f.label);l.set({strings:d}),l.trigger("rerender")},properties:[{name:"label"}]}:a);t.addType(r,{model:{defaults:{traits:i,strings:["These are the default values...!!!","Use your own strings from Properties!","Have a great day!"],icon:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 300 300"><path d="M212.3 44l2.3 49.6h-6A60 60 0 00204 75c-3.2-6-7.5-10.5-12.9-13.3a44.9 44.9 0 00-21.1-4.3h-29.8V219c0 13 1.4 21 4.2 24.3 4 4.4 10 6.6 18.2 6.6h7.4v5.7H80.2V250h7.5c9 0 15.3-2.7 19-8.2 2.4-3.3 3.5-10.9 3.5-22.7V57.3H84.8a71 71 0 00-21.1 2.2 29 29 0 00-13.9 11.3 46.1 46.1 0 00-6.9 22.8H37L39.5 44h172.8zM245 22h18v256h-18z"/></svg>',classes:"gjs-typed",styles:`
|
|
446
381
|
.gjs-typed {
|
|
447
382
|
padding: 5px;
|
|
448
383
|
}
|
|
@@ -450,4 +385,4 @@ ${C}${x}${j}
|
|
|
450
385
|
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
451
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"/>
|
|
452
387
|
</svg>
|
|
453
|
-
`:void 0};r==="tab"&&(a.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(Wx),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(r,{model:{defaults:a}})}};e.on("component:type:add",n)}const X9=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:s})=>s&&n.onLoad())},J9=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:s}=e;s.getConfig().uploadFile=async(...r)=>{const o=r[0],i=await n.handleUpload(o),a=r[1];i&&(a==null||a({data:i}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},Q9=()=>{const{baseApiUrl:e}=x0();return`${e}/sdk/projects`},Ux=e=>`${Q9()}/${e}`,e7=async({licenseKey:e,projectId:t,...n})=>{const s=await Is.put(Ux(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return s==null?void 0:s.result},t7=async(e,t)=>await Is.put(t,{body:e,headers:{"Content-Type":"application/json"}}),n7=async(e,t,n,s)=>{const r=JSON.stringify(e),o=await e7({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([r]).size},identityId:s,name:e.name,description:e.description});if(!o)throw new Error("Project not found");const{uploadUrl:i}=o;await t7(r,i)},s7=(e,t,n)=>Is.get(Ux(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),r7=async e=>await Is.get(e),o7=async(e,t,n,s)=>{const r=await s7(t,n,s),o=r==null?void 0:r.result,i=r==null?void 0:r.errorData;if(!o&&(i!=null&&i.notFoundInDb))return{id:n,project:{}};if(!o)throw new Error("Project not found");const{downloadUrl:a}=o,l=await r7(a);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},i7=(e,t)=>{const{appEditorStore:n,toastStore:s,i18nStore:r}=t.appStore.store,{isUsingProjectSelfHosted:o,isUsingProjectCloud:i,sdkOptions:a}=n,l=a.storage||{},{project:u,onLoad:d,onSave:f,autosaveChanges:p,autosaveIntervalMs:g}=l;let m,b,v,x;if(o)v=d,x=f,m=p,b=g;else if(i){const j=a.licenseKey,E=n.sdkProjectId,_=n.sdkIdentityId,T=10,P=1e4;x=({project:A})=>n7(A,j,E,_),v=({editor:A})=>o7(A,j,E,_),m=Math.max(T,p??T),g&&(b=Math.max(P,g))}const{Storage:y,events:w}=e,{events:S}=y;let C=!1;if(e.once(w.projectLoad,j=>{C=!!j.loaded}),e.once("change:readyLoad",()=>{var E;const j=(E=a.project)==null?void 0:E.default;!C&&j&&e.loadProjectData(j)}),e.on(S.startStore,()=>n.setIsSaving(!0)),e.on(S.endStore,()=>n.setIsSaving(!1)),(v||u)&&x){const j="remote";y.setCurrent(j),y.add(j,{async load(){return u||(await v({editor:e})).project},async store(E){await x({project:E,editor:e})}}),e.on(S.errorLoad,E=>{s.addError("storage-error-load",{header:r.t("storageManager.errorLoad"),content:E.message})}),e.on(S.errorStore,E=>{s.addError("storage-error-store",{header:r.t("storageManager.errorStore"),content:E.message})}),m&&y.setStepsBeforeSave(m),b&&e.onReady(()=>{const E=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},b);e.on("destroy",()=>clearInterval(E))})}},Tc="select-target",Wx="enable-sm";function a7(e,t){var L,B,q,H;const{appStore:n}=t,{appEditorStore:s,blockManagerStore:r,toastStore:o,modalStore:i,layoutStore:a,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:f,nextProjectData:p,sdkOptions:g}=s,m=()=>r.toggleOpen(),b=()=>s.toggleLeftSidebar(),v=()=>s.toggleRightSidebar(),x=e.getConfig(),{Assets:y,Storage:w,Commands:S}=e,C=S.events,j=e.events,E=(B=(L=g.gjsOptions)==null?void 0:L.assetManager)==null?void 0:B.custom;let _=!1;if(y.all.model.prototype.idAttribute="src",Lt(E)&&(y.getConfig().custom=E),p&&(x.projectData=p,s.setNextProjectData()),f){const $=w.getConfig().options;$&&($.local.key=f)}e.on(j.projectLoad,({project:$})=>{var I;n.setProjectDataCustom($.custom||{projectType:(I=s.sdkOptions.project)==null?void 0:I.type}),d.loadFonts()}),e.on(j.projectGet,({project:$})=>{$.custom=yi(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:T}=e,P=Tr(()=>s.setCanvasPanning(!1),200);e.on(T.events.coords,()=>{s.setCanvasPanning(!0),P()}),e.on(T.events.frameLoad,({el:$})=>{$.tabIndex=-1});const{Parser:A}=e,M=((q=s.sdkOptions.parser)==null?void 0:q.showErrors)!==!1;(H=A.events)!=null&&H.css&&M&&e.on(A.events.css,$=>{const{error:I}=$;if(I){const O=ot(I)?I:I.name&&I.reason?`${I.name}: ${I.reason}`:I.message;o.addError("css-error",{header:"CSS Parser Error",content:O})}}),[{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:ie.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:ie.symbolDetach}].forEach(({id:$,keys:I,cmd:O})=>{e.Keymaps.add(`preset:${$}`,I,O,{prevent:!0})}),e.on(`${C.runCommand}core:preview`,()=>{s.setPreview(!0),r.setOpen(!1),fm(e,!1)}),e.on(`${C.stopCommand}core:preview`,()=>{s.setPreview(!1),fm(e,!0),setTimeout(()=>{e.refresh()},s.transitionTime)});const R="target-selection",{Components:F}=e;S.add(Tc,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover($,I){const O={id:R,type:"target",component:I};I?T.addSpot(O):T.removeSpots(O)},beforeSelect($,I={}){I.abort=!0,I.useValid=!1,this.opts.onSelect($),e.stopCommand(Tc)},run($,I,O){this.opts=O,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),T.removeSpots({id:R}),s.setSelectingTarget(!1)}}),S.add(Wx,()=>{s.setSelectedDesignerTab("style")}),S.add(ie.toastAdd,($,I,O)=>{o.add(O.id,O)}),S.add(ie.toastRemove,($,I,O)=>{o.remove(O.id)}),S.add(ie.dialogOpen,($,I,O)=>{i.open(O)}),S.add(ie.dialogClose,()=>{i.close()}),S.add(ie.dialogExportCode,()=>{i.open({title:e.t("actions.showCode.title"),content:()=>{var $,I;return h.createElement(U4,{options:(I=($=g.commands)==null?void 0:$.options)==null?void 0:I[ts.showCode]})}})}),S.add(ie.sidebarLeftGet,()=>({visible:s.isLeftSidebarOpen})),S.add(ie.sidebarLeftSet,($,I,O)=>{s.setLeftSidebarOpen(!!O.visible)}),S.add(ie.sidebarLeftToggle,()=>{s.setLeftSidebarOpen(!s.isLeftSidebarOpen)}),S.add(ie.sidebarRightGet,()=>({visible:s.isRightSidebarOpen})),S.add(ie.sidebarRightSet,($,I,O)=>{s.setRightSidebarOpen(!!O.visible)}),S.add(ie.sidebarRightToggle,()=>{s.setRightSidebarOpen(!s.isRightSidebarOpen)}),S.add(ie.sidebarTopGet,()=>({visible:s.isTopSidebarOpen})),S.add(ie.sidebarTopSet,($,I,O)=>{s.setTopSidebarOpen(!!O.visible)}),S.add(ie.sidebarTopToggle,()=>{s.setTopSidebarOpen(!s.isTopSidebarOpen)}),S.add(ie.sidebarBottomGet,()=>({visible:s.isBottomSidebarOpen})),S.add(ie.sidebarBottomSet,($,I,O)=>{s.setBottomSidebarOpen(!!O.visible)}),S.add(ie.sidebarBottomToggle,()=>{s.setBottomSidebarOpen(!s.isBottomSidebarOpen)}),S.add(ie.layoutAdd,($,I,O)=>{O.id&&a.add(O.id,O)}),S.add(ie.layoutRemove,($,I,O)=>{const{id:V,...G}=O;a.remove(V,G)}),S.add(ie.layoutToggle,($,I,O)=>{const{id:V,...G}=O;V&&(a.get(V)?a.remove(V,G):a.add(V,G))}),S.add(ie.layoutUpdate,($,I,O)=>{const V=O;e.runCommand(ie.layoutRemove,{id:V.id,layout:{placer:{...V.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(ie.layoutAdd,{...V}))}),S.add(ie.layoutGet,($,I,O)=>[Er(a.get(O.id))]),S.add(ie.layoutConfigGet,()=>Er(a.customConfig)),S.add(ie.layoutConfigSet,($,I,O)=>{const V=O;a.setCustomConfig(V)}),S.add(ie.layoutComponentAdd,($,I,O)=>{const{type:V,component:G}=O;V&&G&&a.addCustomLayoutComponent(V,G)}),S.add(ie.layoutComponentGet,($,I,O)=>a.getCustomLayoutComponent(O.type)),S.add(ie.layoutComponentRemove,($,I,O)=>{a.removeCustomLayoutComponent(O.type)}),S.add(ie.layoutComponentRender,($,I,O)=>h.createElement(V9,{components:O.components})),S.add(ie.getStateTheme,()=>s.publicStateTheme),S.add(ie.setStateTheme,($,I,O)=>s.setPublicStateTheme(O)),S.add(ie.getPagesConfig,()=>s.sdkPagesConfig),S.add(ie.setPagesConfig,($,I,O)=>{const{config:V}=O||{};Lt(V)&&s.setSdkPagesConfig(V)}),S.add(ie.getPageSettings,()=>JSON.parse(JSON.stringify(s.panelPageSettings))),S.add(ie.setPageSettings,($,I,O)=>{s.setPanelPageSettings(O)}),S.add(ie.clearPage,()=>{const $=I=>e.t(`actions.${I}`);i.confirm({title:$("clearCanvas.title"),content:$("clearCanvas.content"),confirmButton:{variant:"danger",children:$("clearCanvas.title")},onConfirm:()=>{gA(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),S.add(ie.projectFiles,($,I,O)=>{var K,J;const V=(K=s.sdkOptions.dataSources)==null?void 0:K.exportConfig,G=((J=O.exportConfig)==null?void 0:J.exportPreset)??V,W={isMJML:s.isProjectTypeEmail,exportConfig:G,...O};return B9($,W)}),S.add(ie.validateCode,($,I,O)=>R0({...O,appStore:n})),S.add(ie.getBlocksPanel,()=>({isOpen:r.isOpen})),S.add(ie.setBlocksPanel,($,I,O)=>{const V=O||{};Lt(V.isOpen)&&r.setOpen(V.isOpen)}),S.add(ie.canvasReload,()=>{const $=e.getSelected(),I=T.getCanvasView(),{frames:O}=T.canvas;O.once("loaded:all",()=>{const V=$==null?void 0:$.getView();V&&!V.isInViewport()&&V.el.scrollIntoView({block:"center"})}),I.renderFrames()}),S.add(ie.contextMenuComponent,($,I,O)=>{const{component:V,...G}=O;l.showForComponent(V,G)}),S.add(ie.getStateContextMenu,()=>l.publicState),S.add(ie.setStateContextMenu,($,I,O)=>{l.setPublicState(O)}),S.add(ie.symbolAdd,($,I,O)=>{const V=O.component||e.getSelected();if(V)return F.getSymbolInfo(V).isSymbol?o.add("skip-symbol",{header:"The selected element is already a symbol",variant:nn.Warning}):F.addSymbol(V)}),S.add(ie.symbolDetach,($,I,O)=>{const V=O.component||e.getSelected();V&&F.getSymbolInfo(V).isRoot&&F.detachSymbol(V)}),S.add(ie.symbolOverride,($,I,O)=>{const V=O.component||e.getSelected();V&&(V.setSymbolOverride(O.override),e.Layers.updateLayer(V))}),S.add(ie.symbolPropagateStyles,($,I,O)=>{const V=O.component||e.getSelected();if(!V)return;const{Css:G}=e,W=G.getComponentRules(V,{current:!0})[0];if(W){const{state:K,mediaText:J}=W.attributes,Y=W.getStyle();F.getSymbolInfo(V).relatives.forEach(U=>{G.setIdRule(U.getId(),Y,{state:K,mediaText:J})})}O.deep&&V.components().forEach(K=>e.runCommand(ie.symbolPropagateStyles,{...O,component:K}))}),S.add(ie.assetProviderGet,()=>Er(u.allProviders)),S.add(ie.assetProviderAdd,($,I,{provider:O,index:V})=>{u.addProvider(O,V)}),S.add(ie.assetProviderRemove,($,I,{id:O})=>{const V=u.allProviders.filter(G=>G.id!==O);u.setAllProviders(V)}),S.add(ie.fontGet,()=>Er(d.fonts)),S.add(ie.fontAdd,($,I,{font:O})=>{d.addFont(O)}),S.add(ie.fontRemove,($,I,{family:O})=>{d.removeFont(O)}),S.add(ie.fontManagerOpen,($,I,O)=>{dh($,O)}),S.add(ie.menuFontLoad,($,I,{font:O})=>Hp(O,!1)),S.add(ie.toggleStateDataSource,()=>(_=!_,e.trigger(Tn.toggleDataSourcesPreview,{showPlaceholder:_}),e.refresh({tools:!0}),{showPlaceholder:_})),S.add(ie.getStateDataSource,()=>({showPlaceholder:_})),S.add(ie.dataSourceSetGlobalData,($,I,{globalData:O})=>{const V=Iy(O);return e.DataSources.get(ko.globalData).setRecords(V)}),S.add(ie.setDragAbsolute,($,I,{enabled:O})=>{s.setIsDraggingAbsolute(!!O)}),S.add(ie.dataSourceSetImporter,($,I,O)=>{e.on(e.Parser.events.htmlBefore,V=>{V.input=O.import(V.input)})}),S.add(ie.dataSourceSetExporter,($,I,O)=>{e.config.optsHtml={...e.config.optsHtml,exporter:O}}),J9(e,t),i7(e,t),X9(e,t),Z9(e),z9(e),v4(e),U9(e,t),Y9(e,t)}const l7=/\s(?![^(]*\))/,F1=/^-?[0-9]+[a-zA-Z%]{0,}$/;function B1(e){const t=e.split(l7),n=t.indexOf("inset")>=0,s=t.filter(d=>d!=="inset"),r=s.filter(d=>!F1.test(d))[0]||"currentColor",o=s.filter(d=>F1.test(d)),[i="0",a="0",l="0",u="0"]=o;return{x:i,y:a,blur:l,spread:u,inset:n,color:r}}const zl=["%"],Ul=["s","ms"],zi=["deg","rad","grad"],ws=["px","%","em","rem","vw","vh"],z1={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},c7=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Oc=e=>({id:e,label:e.split("-").map(Ts).join(" ")}),Gx=e=>({property:t,to:n})=>{if(n.value){const s=t.getOption(),r=t.getParent().getProperty(e),o=r.getUnit(),i={units:s.units||[],min:s.min,max:s.max,unit:""};(!o||(i==null?void 0:i.units.indexOf(o))<0)&&(i.unit=(i==null?void 0:i.units[0])||""),r.up(i)}},u7=e=>{const t=`${e}-name`,n=`${e}-value`;return(s,{separatorLayers:r})=>{const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Cu(i);return{[t]:a,[n]:l}}):[]}},U1=e=>{const t={[ua]:e};if(e.indexOf("url(")>-1)t[Ns]=Or.Image;else if(e.indexOf("gradient(")>-1){const n=yh(e),s=n.colorStops,r=n.name.indexOf("linear")>=0;s.length===2&&r&&s[0].color===s[1].color?t[Ns]=Or.Color:t[Ns]=Or.Gradient}else t[Ns]=Or.Color,t[ua]=c7(e);return t},W1=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(s,{separatorLayers:r}){const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Cu(i);return{[t]:a,[n]:l}}):[]},toStyle(s,{name:r}){return{[r]:`${s[t]}(${s[n]||"0"})`}},properties:[{property:t,type:"select",default:"blur",options:[{id:"blur",label:"Blur",min:0,units:["px","em","rem","vw","vh"]},{id:"brightness",label:"Brightness",min:0,units:["%"]},{id:"contrast",label:"Contrast",min:0,units:["%"]},{id:"grayscale",label:"Grayscale",min:0,max:100,units:["%"]},{id:"hue-rotate",label:"Hue rotate",min:0,max:360,units:["deg","rad","grad"]},{id:"invert",label:"Invert",min:0,max:100,units:["%"]},{id:"saturate",label:"Saturate",min:0,units:["%"]},{id:"sepia",label:"Sepia",min:0,max:100,units:["%"]}],onChange:Gx(n)},{property:n,type:"integer"}]}},Wl=(e,{x:t,y:n,mergable:s}={})=>{const r={property:`${e}-x`,type:"integer",units:ws,...t},o={property:`${e}-y`,type:"integer",units:ws,...n};return{property:e,type:"composite",properties:[r,o],...s&&{fromStyle(i,{name:a,separator:l,property:u}){const[d,f]=u.getProperties(),[p,g]=(i[a]||"").split(l);return{[d.getId()]:i[d.getName()]||p||"",[f.getId()]:i[f.getName()]||g||p||""}},toStyle(i,{name:a,property:l}){const[u,d]=l.getProperties(),f=i[u.getId()],p=i[d.getId()];return{[a]:f===p?f:`${f} ${p}`}}}}},d7=(e,t="")=>{const n=`${e}-name`,s=`${e}-value`;return(r,{name:o})=>({[o]:`${r[n]}(${r[s]||t})`})};["top","middle","bottom"].map(Oc),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Oc),["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"}));Wl("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Oc),yw("(?<!\\(.*[^)]),(?![^()]*\\))"),Or.Image,Or.Gradient,Or.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:ws,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:ws,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:ws})),["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"})),Wl("overflow",{x:z1,y:z1,mergable:!0}),W1(),W1("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(Oc),Ul[0],Ul[0],u7("transform"),d7("transform","0"),Gx("transform-value"),Wl("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),Wl("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function qx(e,t){return[n=>P4(n,t),...E4[e],n=>a7(n,t),w4(e,t)]}class f7{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,on(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const s=(yield h7()).filter(r=>r.projectType.includes(t));this.setProjectPlugins(s)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const s=[...qx(t,{appStore:n}),...this.projectPlugins||[]],r=n.sdkOptions.plugins||[];return Ye(r)?r({plugins:s}):[...s,...r]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;s.includes(r)?this.pendingUninstalled=s.filter(o=>o!==r):n.includes(r)||n.push(r)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;n.includes(r)?this.pendingInstalled=n.filter(o=>o!==r):s.push(r)}setSelectedShown(t){this.selectedShown=t}}const p7={db:s0.gjsStudio},h7=()=>new Promise(async e=>{let t=[];try{t=await IO(Yc.Settings,"plugins",p7)||[]}catch(n){Vs()&&console.error(n)}e(t)}),g7=h.createContext(void 0);class m7{constructor(t){this.blockManagerStore=new BA(this),this.appEditorStore=new jA(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new qN(t==null?void 0:t.localSettingsStore),this.toastStore=new FA(this),this.modalStore=new KN(this),this.i18nStore=new $A(this),this.pluginStore=new f7(this),this.pointerBadgeStore=new DA(this),this.contextMenu=new b7(this),this.layoutStore=new VA(this),this.templatesStore=new HA(this),this.assetsStore=new LA(this),this.globalStylesStore=new zN(this),this.fontsStore=new RA(this),this.appEditorStore.init(),Ff()&&(window.__gjss=this)}}const bn=()=>{const e=h.useContext(g7);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},wh=()=>{throw new Error("Store has not been initialized")};class b7{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=So(function*(n,s={}){var x;if(!(n!=null&&n.em))return[];const r=n.em.getEditor(),{isSymbol:o,isRoot:i}=r.Components.getSymbolInfo(n),a=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),f=[u&&{id:xr.selectParent,icon:Z.arrowUp,label:"Select parent",onClick:()=>{r.runCommand("core:component-exit",{force:!0})}},d&&{id:xr.duplicate,icon:Z.contentCopy,label:"Duplicate",onClick:()=>{r.runCommand("tlb-clone")}},!o&&l&&{id:xr.symbolCreate,icon:Z.rhombusSplit,label:"Create Symbol",onClick:()=>{r.runCommand(ie.symbolAdd)}},o&&i&&{id:xr.symbolDetach,icon:Z.alertRhombus,label:"Detach instance",onClick:()=>{r.runCommand(ie.symbolDetach)}},o&&!a&&{id:xr.symbolOverride,icon:Z.rhombusOutline,label:"Make overridable",onClick:()=>{r.runCommand(ie.symbolOverride,{override:!0})}},o&&a&&{id:xr.symbolOverrideClear,icon:Z.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{r.runCommand(ie.symbolOverride)}},l&&{id:xr.delete,icon:Z.delete,label:"Delete",onClick:()=>{r.runCommand("core:component-delete")}}].filter(Boolean),p=n.get("contextMenu"),g={...s,items:f,component:n,editor:r,type:n.get("type")||"default",source:s.source||Dp.canvas},m=yield G1(p,g),b=(x=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:x.contextMenu;return yield G1(b,{...g,items:m})}),this.store=t,on(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const s=t==null?void 0:t.em;if(!s)return;n.skipSelect||s.selected.hasComponent(t)||s.setSelected(t);const r=yield this.getItemsForComponent(t,n);r.length&&this.show({...n,items:r})}show({items:t,x:n,y:s,w:r,h:o}){this.isOpen=!0,this.coordinates={x:n,y:s,w:r,h:o},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const G1=async(e,t)=>Ye(e)?(await e(t)).filter(Boolean):t.items,v7=()=>bn().contextMenu,q1=Vs()&&document.body,Sh=(e={})=>({...qp,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??q1}},{name:"preventOverflow",options:{boundary:e.boundary??q1}}]}),y7=Sh(),Gl="gs-ctx-menu-list",x7=fe(function({onItemClick:t,open:n,items:s,x:r,y:o,w:i,h:a,className:l}){const u=v7(),[d,f]=h.useState(),[p,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(r,o,i,a)}),[r,o,i,a,n]),{styles:b,attributes:v}=Wa(m,p,y7),x=N(`${Gl}-wrp gs-utl-z-20`,l),y=N(`${Gl} gs-utl-z-20`),w=N(`${Gl}-body gs-utl-max-w-56`),S=N(`${Gl}-item`),C="gs-utl-max-w-40",j=E=>{const{action:_,onClick:T}=E;if(_||T)return P=>{const A={editor:u.store.appEditorStore.editor,...P};Ye(_)?(_(A),u.hide()):Ye(T)&&(T(A),u.hide())}};return c.jsx("div",{className:x,ref:g,style:b.popper,...v.popper,children:c.jsx(Ap,{show:!!n,...AE,unmount:!1,children:c.jsx(Xn,{padding:!1,className:y,classNameBody:w,children:s.map((E,_)=>h.createElement(_i,{onItemClick:t,...E,key:E.id??_,className:S,classNameLabel:C,action:j(E),onActive:()=>f(E),active:d===E}))})})})}),kd="gs-cmp-tooltip";function It({className:e,classNameWrp:t,classNameContent:n,strategy:s,placement:r="bottom",children:o,title:i,onClick:a,inline:l,size:u}){const[d,f]=h.useState(!1),[p,g]=h.useState(!1),m=Lt(u),[b,v]=h.useState(null),[x,y]=h.useState(null),w=Wa(b,x,{...Sh(),placement:r,...s?{strategy:s}:{}});h.useEffect(()=>{var j;d&&((j=w.update)==null||j.call(w))},[d,w.update]),h.useEffect(()=>{const j=setTimeout(()=>f(p),10);return()=>clearTimeout(j)},[p]);const S=N(`${kd}-target`,!l&&"gs-utl-block",e,!a&&"gs-utl-cursor-auto"),C=N(`${kd}-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(kd,"gs-utl-relative",t),children:[c.jsx("span",{ref:v,className:S,onMouseEnter:()=>i&&g(!0),onMouseLeave:()=>g(!1),children:c.jsx("div",{className:N(l&&"gs-utl-inline-block"),onClick:()=>{g(!1),a==null||a()},children:o})}),!!p&&c.jsx("div",{className:C,ref:y,style:w.styles.popper,...w.attributes.popper,children:c.jsx(Ap,{show:!!d,unmount:!1,...hv,children:c.jsx(Xn,{className:ug.txt,bg:ug.bg,size:"s",border:!1,children:i})})})]})}function bt({children:e,title:t,classNameWrp:n,tooltipProps:s,...r}){return c.jsx(It,{title:t,classNameWrp:n,...s,children:c.jsx(Ke,{...r,children:e})})}const Go="gs-cmp-ai-chat-assets",w7=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},S7=e=>e.mediaType==="application/pdf",Kx=({editor:e,assets:t,className:n,onRemove:s,style:r})=>{const o=`${Go}__asset-item`,i=N(`${Go}__asset-image`,"gs-utl-object-cover",re.rnd,hl.m),a=N(`${Go}__asset-pdf`,"gs-utl-overflow-hidden",re.rnd,hl.m),l=N(`${Go}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",re.rnd,hl.m,z.bgH2),u=N(`${Go}__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",hl.s,re.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}},b=e.t(`${d}.imageAlt`,m),v=e.t(`${d}.pdfTitle`,m);return w7(p)?c.jsx("img",{src:p.src,alt:b,className:i}):S7(p)?c.jsx("iframe",{src:p.src,title:v,className:a}):c.jsx("div",{className:l,children:c.jsx(oe,{icon:XS,size:le.l})})};return c.jsx(k,{className:N(Go,n),gap:"xs",wrap:"wrap",style:r,children:t.map((p,g)=>c.jsxs("div",{className:N(o,"gs-utl-relative gs-utl-inline-block"),children:[f(p,g),s&&c.jsx(bt,{title:e.t(`${d}.remove`),icon:{icon:Z.close,size:le.s3x},onClick:()=>s(g),size:"x2s",border:!1,className:u})]},p.src))})},en="gs-cmp-ai-chat-input",C7=e=>{const{className:t,style:n,editor:s,disabled:r,maxAssets:o,currentAssetsCount:i,acceptAssetType:a,onFilesSelected:l,onAssetSelected:u}=e,d=h.useRef(null);if(o<=0)return null;const f=`${en}__attach-btn`,p=`${en}__file-input`,g=i>=o,m="aiChat.input.attach",b=s.t(`${m}.upload`),v=s.t(`${m}.selectFromAssets`),x=s.t(`${m}.title`),y=s.t(`${m}.maxAssets`,{params:{count:o}}),w=C=>{const j=Array.from(C.target.files||[]);j.length>0&&l(j),d.current&&(d.current.value="")},S=C=>{if(!s||g)return;const j="btnAttachImages",E=()=>s.runCommand(ie.layoutRemove,{id:j});s.runCommand(ie.layoutToggle,{id:j,header:!1,placer:{type:"popover",target:C.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:E,items:[{id:"upload",label:b,icon:Z.trayArrowDown,onClick:()=>{var _;return(_=d.current)==null?void 0:_.click()}},{id:"assets",label:v,icon:a2,onClick:()=>{s.Assets.open({onSelect:({asset:_})=>{const T=_.getSrc();T&&u(T)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:a,multiple:!0,onChange:w,className:p,style:{display:"none"}}),c.jsx(bt,{className:N(f,re.pill,t),style:n,title:g?y:x,icon:Z.plus,border:!1,onClick:S,disabled:r||g,size:"s",block:!0})]})},j7=({editor:e,className:t,style:n,contextComponents:s,disabled:r})=>{const[o,i]=h.useState(()=>e.getSelectedAll()),a="aiChat.input.context";h.useEffect(()=>{const y=e.Components.events.select,w=()=>i(e.getSelectedAll());return e.on(y,w),()=>{e.off(y,w)}},[e]),h.useEffect(()=>{s.clear(),o.forEach(y=>s.add(y))},[o,s]);const l=()=>i([]);if(o.length===0)return null;const u=`${en}__context`,d=`${en}__context-icon`,f=`${en}__context-badge`,p=`${en}__context-name`,g=`${en}__context-divider`,m=o.length===1,b=o[0],v=e.t(`${a}.multiple`,{params:{count:o.length}}),x=m?b.getName():v;return c.jsxs(k,{className:N(u,r&&Ee.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(oe,{icon:Z.target,size:le.sx,className:N(d,z.txtLowEmphasis)}),c.jsx(Rr,{className:N(f,mv(b).bg,je.xyS2),s:"s",children:c.jsxs(k,{gap:"xs",items:"center",nowrap:!0,children:[m&&h0(b),c.jsx("div",{className:N(p,Ee.txtEllips,"gs-utl-max-w-36"),children:x}),!r&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:N(g,re.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(bt,{title:e.t(`${a}.clear`),icon:{icon:Z.close,size:le.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function K1(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function E7(){const[e,t]=h.useState(""),[n,s]=h.useState(!1),[r,o]=h.useState(!1),i=h.useRef();h.useEffect(()=>o(!!K1()),[]);const a=()=>{const u=K1();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>s(!0),d.onend=l,d.onresult=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()},i.current=d,d.start()},l=()=>{var u;(u=i.current)==null||u.stop(),s(!1)};return{transcript:e,isSupported:r,isListening:n,start:a,stop:l}}const P7=({editor:e,disabled:t,onTranscript:n,onListeningChange:s,className:r,style:o})=>{const i=`${en}__dictate`,{transcript:a,isSupported:l,isListening:u,start:d,stop:f}=E7(),p="aiChat.input.dictate",g=e.t(`${p}.start`),m=e.t(`${p}.stop`),b=u?m:g;return h.useEffect(()=>{a&&n(a)},[a]),h.useEffect(()=>{s==null||s(u)},[u]),l?c.jsx(bt,{block:!0,size:"s",border:!1,className:N(i,re.pill,r),style:o,title:b,disabled:t,icon:u?y2:v2,onClick:u?f:d,variant:u?"danger":"out-clear"}):null},_7=({autoResize:e,autoFocus:t,style:n={},...s})=>{const r=h.useRef(null);return h.useEffect(()=>{!r.current||!e||(r.current.style.height="auto",r.current.style.height=r.current.scrollHeight+"px")},[s.value,e]),h.useEffect(()=>{const o=r.current;if(o&&t){const i=setTimeout(()=>o==null?void 0:o.focus(),150);return()=>clearTimeout(i)}},[r.current,t]),c.jsx("textarea",{ref:r,style:{...n,...e?{resize:"none"}:{}},...s})},Y1=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},Z1=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,T7=({className:e,style:t,chatContext:n,editor:s,maxAssets:r=5,acceptAssetType:o="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:i,layoutBefore:a,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:f,assetsSectionProps:p,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:b,value:v})=>{const[x,y]=h.useState(v||""),[w,S]=h.useState(""),[C,j]=h.useState(!1),[E,_]=h.useState([]),[T,P]=h.useState(!1),A="aiChat.input",M=s.runCommand(Ss.getChatApi),R=s.runCommand(Ss.getChatState),{status:F,stop:L,sendMessage:B,setError:q}=n||M,H=F==="streaming"||F==="submitted",$=E.length>0,I=w?Z1(x,w):x,O=!T&&(H||I.trim()||$),V={input:I,assets:E},G=xe=>{const Ze=r-E.length,Xe=xe.slice(0,Ze);if(Xe.length===0)return;const ft=Xe.map(Ae=>({src:URL.createObjectURL(Ae),file:Ae,mediaType:Ae.type}));_(Ae=>[...Ae,...ft])},W=xe=>{E.length>=r||_(Ze=>[...Ze,{src:xe,mediaType:"image/*"}])},K=xe=>{const Ze=E[xe];Ze!=null&&Ze.file&&Y1([Ze.src]),_(Xe=>Xe.filter((ft,Ae)=>Ae!==xe))},J=async xe=>{if(xe.preventDefault(),H||T)return;const Ze=()=>Y();if(u){u({event:xe,submit:Ze,state:V});return}Ze()},Y=async()=>{if(H||T)return;const xe=I.trim();if(!xe&&!$)return;const Ze=E.filter(Ae=>Ae.file).map(Ae=>Ae.file);let ft=E.filter(Ae=>!Ae.file).map(Ae=>({type:"file",url:Ae.src,mediaType:Ae.mediaType}));if(Ze.length>0){P(!0);try{const at=await async function(Ie){return i?await i({files:Ie}):new Promise((Wt,ge)=>{try{const $e={dataTransfer:{files:Ie}};s.Assets.FileUploader().uploadFile($e,({data:Ve})=>{Wt(Ve)})}catch($e){ge($e)}})}(Ze),rt=E.filter(Ie=>Ie.file).map(Ie=>Ie.src);ft=[...ft,...at.map(Ie=>({type:"file",url:Ie.src,mediaType:Ie.mimeType}))],Y1(rt)}catch(Ae){const at=s.t(`${A}.uploadError`);q(Ae instanceof Error?Ae:new Error(at)),P(!1);return}finally{P(!1)}}B({text:xe,files:ft.length>0?ft:void 0,metadata:{createdAt:Date.now()}}),y(""),_([])},U=xe=>{xe.key==="Enter"&&!xe.shiftKey&&(xe.preventDefault(),J(xe))};h.useEffect(()=>{C||y(xe=>Z1(xe,w)),S("")},[C]);const Q=`${en}__root`,se=`${en}__actions`,de=`${en}__actions-left`,Se=`${en}__actions-right`,ne=`${en}__submit-btn`,Te=N(`${en}__textarea gs-utl-w-full`,z.bgTr,$r.inputText,Ee.noFocusOut,Ee.noResize),ke=s.t(`${A}.placeholder`),it=a==null?void 0:a({state:V}),st=l==null?void 0:l({state:V});return c.jsxs("form",{onSubmit:J,className:N(en,je.s,re.bt,z.br,e),style:t,children:[it&&sn(s,it),c.jsxs(k,{className:N(Q,re.b,re.rndLg,z.br,z.bg,je.s,"gs-utl-relative"),col:!0,gap:"s",children:[T&&c.jsx(Co,{abs:!0,full:!0,className:z.bgH25}),c.jsx(j7,{editor:s,disabled:H,contextComponents:R.contextComponents,...d}),c.jsx(_7,{value:I,name:"prompt",onChange:xe=>y(xe.target.value),onKeyDown:U,placeholder:ke,readOnly:C,disabled:H,className:Te,style:{minHeight:40,maxHeight:100},autoResize:!0,...f}),c.jsx(Kx,{editor:s,assets:E,onRemove:K,...p}),c.jsxs(k,{className:se,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(k,{className:de,gap:"s",items:"center",children:c.jsx(C7,{editor:s,disabled:H,maxAssets:r,currentAssetsCount:E.length,acceptAssetType:o,onFilesSelected:G,onAssetSelected:W,...g})}),c.jsxs(k,{className:Se,gap:"s",items:"center",children:[c.jsx(P7,{editor:s,disabled:H,onTranscript:S,onListeningChange:j,...m}),c.jsx(Ke,{className:N(ne,re.pill),size:"s",type:H?"button":"submit",onClick:H?L:void 0,icon:H?Z.stop:Z.arrowUp,variant:H?"out-clear":"pr",disabled:!O,disabledClassName:Ee.disabledM,...b})]})]})]}),st&&sn(s,st)]})},O7="gs-cmp-ai-chat-loading-state",A7=({className:e,chatContext:t,editor:n,...s})=>c.jsx(k,{className:N(O7,e),items:"center",justify:"center",full:!0,col:!0,...s,children:c.jsx(Co,{})}),N7="file-refs",Yx="gs-cmp-ai-chat-markdown",gt=`${Yx}__el`,M7={ul:({children:e})=>c.jsx("ul",{className:`${gt}-ul ${Nt.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${gt}-ol ${Nt.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${gt}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${gt}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${gt}-h1 ${Nt.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${gt}-h2 ${Nt.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${gt}-h3 ${Nt.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${gt}-h4 ${Nt.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${gt}-h5 ${Nt.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${gt}-h6 ${Nt.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${gt}-a ${$r.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${gt}-code-inline ${Nt.codeInline}`,children:e}):c.jsx("code",{className:`${gt}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${gt}-pre ${Nt.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${gt}-blockquote ${Nt.blockquote} ${z.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${gt}-hr ${Nt.hr} ${z.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${gt}-strong ${Nt.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${gt}-em ${Nt.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${gt}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${gt}-table ${Nt.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${gt}-thead ${Nt.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${gt}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${gt}-tr ${Nt.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${gt}-th ${Nt.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${gt}-td ${Nt.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${gt}-checkbox gs-utl-mr-2`,readOnly:!0}),[N7]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function L7(e){return sw.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const R7=h.memo(function({content:t}){return c.jsx(rw,{components:M7,remarkPlugins:[ow],children:t})},(e,t)=>e.content===t.content),X1=h.memo(function({content:t,id:n,className:s}){const r=h.useMemo(()=>L7(t),[t]);return c.jsx("div",{className:`${Yx} ${s||""}`,children:r.map((o,i)=>c.jsx(R7,{content:o},`${n}-block_${i}`))})});function J1(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function $7(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const Vd="gs-cmp-ai-chat-message",Ui="aiChat.message",k7=h.memo(function({className:t,style:n,message:s,isStreaming:r,editor:o,chatContext:i,layoutBeforeMessage:a,layoutAfterMessage:l,layoutPart:u,layoutPartToolLabel:d,layoutPartToolDetail:f,layoutPartToolResult:p}){const g=s.parts||[],m=g.filter(Ar.isFileUIPart),b=g.filter(_=>!Ar.isFileUIPart(_)),v=m.map(_=>({src:_.url,mediaType:_.mediaType??"image/*"})),x=b.length-1,y=s.role==="user",w=N(Vd,`${Vd}--${s.role}`,t),S=N(`${Vd}__content gs-utl-break-words`,y?N(z.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",je.xyS,re.rnd):"gs-utl-w-full"),C={editor:o,chatContext:i,message:s},j=a==null?void 0:a(C),E=l==null?void 0:l(C);return c.jsxs(k,{col:!0,gap:"s",className:w,style:n,children:[j&&sn(o,j),c.jsxs(k,{gap:"s",className:N(S,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((_,T)=>c.jsx(V7,{part:_,messageId:s.id,partIndex:T,isStreamingPart:T===x&&r,layoutPart:u,layoutPartToolLabel:d,layoutPartToolDetail:f,layoutPartToolResult:p,layoutProps:C},`${s.id}-part-${T}`)),c.jsx(Kx,{editor:o,assets:v,className:"gs-utl-justify-end"})]}),E&&sn(o,E)]})}),qs="gs-cmp-ai-chat-message-part",V7=h.memo(function({part:t,messageId:n,partIndex:s,isStreamingPart:r,layoutPart:o,layoutPartToolLabel:i,layoutPartToolDetail:a,layoutPartToolResult:l,layoutProps:u}){var d;if(o){const f=o({...u,part:t,partIndex:s});if(f)return sn(u.editor,f)}if(Ar.isReasoningUIPart(t)){const{text:f,state:p}=t,g=f==null?void 0:f.trim(),m=r&&p==="streaming",b=`${qs} ${qs}__reasoning`,v=u.editor.t(`${Ui}.reasoning`);return!!g&&c.jsx(ar,{className:N(b,z.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(k,{className:N(`${b}-label`,cn.semibold),items:"center",gap:"s",children:[m?c.jsx(Co,{size:"xs",currentColor:!0}):c.jsx(Wi,{path:d2,size:le.s2x}),c.jsx("div",{children:v})]}),children:c.jsx("div",{className:N(`${b}-text`,z.txtLowEmphasis,kn.xs,cn.italic),children:c.jsx(X1,{id:`${n}-${s}`,content:g})})})}if(Ar.isTextUIPart(t)){const f=t.text;if(!f)return null;const p=`${qs} ${qs}__text`;return c.jsx(X1,{content:f,id:`${n}-${s}`,className:p})}if(Ar.isToolUIPart(t)){const{type:f,toolCallId:p,input:g="",output:m="",errorText:b}=t,v=f.replace("tool-","").replace("dynamic-",""),x=typeof g=="string"?g:JSON.stringify(g),y=typeof m=="string"?m:JSON.stringify(m),w=typeof t.state=="string"?t.state:void 0,S=w==="output-available",C=r&&(w==="input-streaming"||w==="input-available"),j=`${qs}__tool`,E=`${qs}__tool-result`,_=`${j}-detail`,T=N(_,"gs-utl-max-w-full"),P="gs-utl-max-w-full gs-utl-whitespace-normal",A=N(`${_}-info gs-utl-max-h-24 gs-utl-overflow-auto`,P,z.txtLowEmphasis,kn.xs),M=N(`${qs}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,P,z.txtLowEmphasis,kn.xs),R=`${j}-section-label`,F=x&&x!=="{}",L=y&&y!=="{}",B=!!b,q=F||L||B,H=u.editor.t(`${Ui}.tool.input`),$=u.editor.t(`${Ui}.tool.output`),I=u.editor.t(`${Ui}.tool.error`),V=u.editor.runCommand(Ss.getChatManager).tools[v],G={...u,part:t,partIndex:s,toolName:v},W=i==null?void 0:i(G),K=a==null?void 0:a(G),J=(l==null?void 0:l(G))||((d=V==null?void 0:V.layoutToolResult)==null?void 0:d.call(V,G)),Y=W?sn(u.editor,W):v,U=J?sn(u.editor,J):null,Q=K?sn(u.editor,K):c.jsxs(k,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[F&&c.jsxs(k,{className:N(T,`${_}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:R,children:H}),c.jsx("pre",{className:A,children:x})]}),L&&c.jsxs(k,{className:N(T,`${_}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:R,children:$}),c.jsx("pre",{className:A,children:y})]}),B&&c.jsxs(k,{className:N(T,`${_}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:R,children:I}),c.jsx("pre",{className:A,children:b})]})]});return c.jsxs(k,{className:N(`${qs} ${j}`,z.bgH2,re.rnd,je.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(ar,{disabled:!q&&!K,handler:c.jsxs(k,{className:N(`${j}-label`),items:"center",gap:"s",children:[c.jsx("div",{className:`${j}-status`,children:S?c.jsx(Wi,{className:`${j}-status-success`,path:gb,size:le.s2x}):C?c.jsx(Co,{className:`${j}-status-processing`,size:"xs",currentColor:!0}):c.jsx(Wi,{className:`${j}-status-error`,path:mb,size:le.s2x})}),c.jsx("div",{className:N(`${j}-name`),children:Y})]}),children:Q}),c.jsx(I7,{toolCallId:p,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:r,className:M}),!!U&&c.jsx("div",{className:E,children:U})]})}if(J1(t)||$7(t)){const f=`${qs}__source`,g=J1(t)?t.url:void 0,m=t.title,b=u.editor.t(`${Ui}.source.document`),v=m||g||b,x=g?new URL(g).hostname:"",y=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:N(`${f}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:N(`${f}-title`,cn.semibold,kn.sm,"gs-utl-truncate"),children:v}),x&&c.jsx("div",{className:N(`${f}-url`,z.txtLowEmphasis,kn.xs,"gs-utl-truncate"),children:x})]}),g&&c.jsx(Wi,{className:N(`${f}-icon`,z.txtLowEmphasis),path:bb,size:le.s2x})]}),w=N(f,z.bgH2,re.rnd,je.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",g&&Ee.hoverM);return g?c.jsx("a",{href:g,target:"_blank",rel:"noopener noreferrer",className:w,children:y}):c.jsx("div",{className:w,children:y})}return null}),I7=h.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:s,className:r}){const[o,i]=h.useState(""),a=h.useRef(null);return h.useEffect(()=>{if(!s||!t){i("");return}const l=n.get(t);l!=null&&l.content&&i(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&i(d.content),d!=null&&d.completed&&(clearInterval(u),i(""))},100);return()=>clearInterval(u)},[t,n,s]),h.useEffect(()=>{a.current&&o&&(a.current.scrollTop=a.current.scrollHeight)},[o]),!o||!s?null:c.jsx("pre",{ref:a,className:r,children:o})}),D7="gs-cmp-ai-chat-messages-status",H7=({className:e,chatContext:t,style:n})=>{const{status:s}=t,r=s==="streaming"||s==="submitted",o=N(z.bgA,Ee.dot,Ee.bounce);return r?c.jsxs(k,{items:"center",gap:"xs",className:N(D7,e),style:n,children:[c.jsx("div",{className:o}),c.jsx("div",{className:o,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:o,style:{animationDelay:"0.3s"}})]}):null},F7="gs-cmp-ai-chat-messages";function B7({editor:e,chatContext:t,messages:n,pluginOptions:s}){const r=h.useRef(null),{status:o}=t,i=o==="streaming"||o==="submitted",a=N(F7,je.s,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-y-auto gs-utl-overflow-x-hidden");return h.useEffect(()=>{var l;(l=r.current)==null||l.scrollIntoView({behavior:"smooth"})},[n]),c.jsxs(k,{className:a,gap:"s",col:!0,nowrap:!0,children:[n.length===0?sn(e,{type:"aiChatEmptyState",chatContext:t},s):n.map((l,u)=>c.jsx(h.Fragment,{children:sn(e,{type:"aiChatMessage",chatContext:t,message:l,isStreaming:i&&u===n.length-1},s)},l.id)),sn(e,{type:"aiChatMessagesStatus",chatContext:t},s),c.jsx("div",{ref:r})]})}const Zx=h.createContext(void 0),z7=({chatManager:e,children:t})=>{const n=e.currentChatState,s=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(Zx.Provider,{value:s,children:t})},U7=()=>h.useContext(Zx),W7="gs-cmp-ai-chat-panel";function G7({editor:e,pluginOptions:t,style:n,className:s}){const{chatState:r}=U7(),[,o]=h.useState(0),[i,a]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:f}=r;h.useEffect(()=>r.onUpdate(()=>o(j=>++j)),[]);const p=Q1.useChat({chat:r.chat}),{messages:g,sendMessage:m,status:b,setMessages:v,error:x}=p,y=x||i,w=h.useMemo(()=>({id:p.id,messages:g,setMessages:v,sendMessage:m,status:b,stop:()=>(l.forEach(C=>C.abort()),l.clear(),p.stop()),addToolApprovalResponse:p.addToolApprovalResponse,addToolOutput:p.addToolOutput,error:y,setError:C=>a(typeof C=="string"?new Error(C):C),clearError:()=>{p.clearError(),a(void 0)},toolStatusProgress:u,contextComponents:d}),[e,b,g,y]),S=N(W7,s,"gs-utl-relative gs-utl-w-full gs-utl-h-full gs-utl-min-h-0 gs-utl-max-h-full gs-utl-overflow-hidden");return c.jsx(k,{className:S,style:n,col:!0,nowrap:!0,children:f?c.jsxs(c.Fragment,{children:[sn(e,{type:"aiChatHeader",chatContext:w},t),c.jsx(B7,{editor:e,chatContext:w,messages:g,pluginOptions:t}),w.error&&sn(e,{type:"aiChatError",chatContext:w},t),sn(e,{type:"aiChatInput",chatContext:w},t)]}):sn(e,{type:"aiChatLoadingState",chatContext:w},t)})}const q7=(e,t,n)=>(e.runCommand(ie.layoutComponentAdd,{type:"aiChatPanel",component:s=>({type:"custom",noWrapper:!0,component:()=>c.jsx(z7,{chatManager:n,children:c.jsx(G7,{...s,editor:e,pluginOptions:t})})})}),e.runCommand(ie.layoutComponentAdd,{type:"aiChatHeader",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:kE})}),e.runCommand(ie.layoutComponentAdd,{type:"aiChatError",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:$E})}),e.runCommand(ie.layoutComponentAdd,{type:"aiChatLoadingState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:A7})}),e.runCommand(ie.layoutComponentAdd,{type:"aiChatInput",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:T7})}),e.runCommand(ie.layoutComponentAdd,{type:"aiChatEmptyState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:RE})}),e.runCommand(ie.layoutComponentAdd,{type:"aiChatMessage",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:k7})}),e.runCommand(ie.layoutComponentAdd,{type:"aiChatMessagesStatus",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:H7})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(s=>{e.runCommand(ie.layoutComponentRemove,{type:s})})}),K7={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"}}}},Y7="aiChat",Z7=Ko.startup,X7=function(e,t={}){t.getAccessToken&&(Kt.getAccessToken=t.getAccessToken),ib();const n=new oS(e,t),{Commands:s}=e;s.add(Ss.getChatManager,()=>n),s.add(Ss.getChatState,()=>n.currentChatState),s.add(Ss.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:K7});const r=q7(e,t,n),o=()=>{delete s.commands[Ss.getChatManager],delete s.commands[Ss.getChatState],delete s.commands[Ss.getChatApi],r(),$w()};Lw({editor:e,licenseKey:t.licenseKey,plan:Z7,pluginName:Y7,onLicenseCheckResponse:i=>{i?Kt.license=i:Kt.license=void 0},cleanup:o})},J7=Mw(X7);module.exports=J7;
|
|
388
|
+
`:void 0};r==="tab"&&(a.traits=[{type:"button",label:!1,text:"Style Active",command:l=>{l.select(),l.runCommand(ww),setTimeout(()=>l.Selectors.select(".tab.tab-active"))}}]),t.addType(r,{model:{defaults:a}})}};e.on("component:type:add",n)}const i7=(e,t)=>{const n=t.appStore.store.globalStylesStore;e.on(e.events.projectLoad,({loaded:s})=>s&&n.onLoad())},a7=(e,t)=>{const{assetsStore:n}=t.appStore.store;if(n.onCloudOrCustomUpload){const{Assets:s}=e;s.getConfig().uploadFile=async(...r)=>{const o=r[0],i=await n.handleUpload(o),a=r[1];i&&(a==null||a({data:i}))}}e.on(e.events.destroy,()=>n.setAllProviders([]))},l7=()=>{const{baseApiUrl:e}=M0();return`${e}/sdk/projects`},xw=e=>`${l7()}/${e}`,c7=async({licenseKey:e,projectId:t,...n})=>{const s=await Gs.put(xw(t),{body:JSON.stringify(n),params:{d:window.location.hostname,licenseKey:e}});return s==null?void 0:s.result},u7=async(e,t)=>await Gs.put(t,{body:e,headers:{"Content-Type":"application/json"}}),d7=async(e,t,n,s)=>{const r=JSON.stringify(e),o=await c7({licenseKey:t,projectId:n,fileMetadata:{size:new Blob([r]).size},identityId:s,name:e.name,description:e.description});if(!o)throw new Error("Project not found");const{uploadUrl:i}=o;await u7(r,i)},f7=(e,t,n)=>Gs.get(xw(t),{params:{d:window.location.hostname,licenseKey:e,identityId:n}}),p7=async e=>await Gs.get(e),h7=async(e,t,n,s)=>{const r=await f7(t,n,s),o=r==null?void 0:r.result,i=r==null?void 0:r.errorData;if(!o&&(i!=null&&i.notFoundInDb))return{id:n,project:{}};if(!o)throw new Error("Project not found");const{downloadUrl:a}=o,l=await p7(a);if(!l||l instanceof Error)throw new Error("Project download failed");return{id:n,project:l}},g7=(e,t)=>{const{appEditorStore:n,toastStore:s,i18nStore:r}=t.appStore.store,{isUsingProjectSelfHosted:o,isUsingProjectCloud:i,sdkOptions:a}=n,l=a.storage||{},{project:u,onLoad:d,onSave:f,autosaveChanges:p,autosaveIntervalMs:g}=l;let m,v,b,x;if(o)b=d,x=f,m=p,v=g;else if(i){const j=a.licenseKey,E=n.sdkProjectId,O=n.sdkIdentityId,P=10,T=1e4;x=({project:_})=>d7(_,j,E,O),b=({editor:_})=>h7(_,j,E,O),m=Math.max(P,p??P),g&&(v=Math.max(T,g))}const{Storage:y,events:w}=e,{events:S}=y;let C=!1;if(e.once(w.projectLoad,j=>{C=!!j.loaded}),e.once("change:readyLoad",()=>{var E;const j=(E=a.project)==null?void 0:E.default;!C&&j&&e.loadProjectData(j)}),e.on(S.startStore,()=>n.setIsSaving(!0)),e.on(S.endStore,()=>n.setIsSaving(!1)),(b||u)&&x){const j="remote";y.setCurrent(j),y.add(j,{async load(){return u||(await b({editor:e})).project},async store(E){await x({project:E,editor:e})}}),e.on(S.errorLoad,E=>{s.addError("storage-error-load",{header:r.t("storageManager.errorLoad"),content:E.message})}),e.on(S.errorStore,E=>{s.addError("storage-error-store",{header:r.t("storageManager.errorStore"),content:E.message})}),m&&y.setStepsBeforeSave(m),v&&e.onReady(()=>{const E=setInterval(async()=>{e.getDirtyCount()>0&&!n.isSaving&&await e.store()},v);e.on("destroy",()=>clearInterval(E))})}},Hc="select-target",ww="enable-sm";function m7(e,t){var A,H,U,D;const{appStore:n}=t,{appEditorStore:s,blockManagerStore:r,toastStore:o,modalStore:i,layoutStore:a,contextMenu:l,assetsStore:u,fontsStore:d}=n.store,{projectIdToLoad:f,nextProjectData:p,sdkOptions:g}=s,m=()=>r.toggleOpen(),v=()=>s.toggleLeftSidebar(),b=()=>s.toggleRightSidebar(),x=e.getConfig(),{Assets:y,Storage:w,Commands:S}=e,C=S.events,j=e.events,E=(H=(A=g.gjsOptions)==null?void 0:A.assetManager)==null?void 0:H.custom;let O=!1;if(y.all.model.prototype.idAttribute="src",Dt(E)&&(y.getConfig().custom=E),p&&(x.projectData=p,s.setNextProjectData()),f){const $=w.getConfig().options;$&&($.local.key=f)}e.on(j.projectLoad,({project:$})=>{var I;n.setProjectDataCustom($.custom||{projectType:(I=s.sdkOptions.project)==null?void 0:I.type}),d.loadFonts()}),e.on(j.projectGet,({project:$})=>{$.custom=ji(e)}),e.RichTextEditor.getConfig().custom=!0;const{Canvas:P}=e,T=$r(()=>s.setCanvasPanning(!1),200);e.on(P.events.coords,()=>{s.setCanvasPanning(!0),T()}),e.on(P.events.frameLoad,({el:$})=>{$.tabIndex=-1});const{Parser:_}=e,L=((U=s.sdkOptions.parser)==null?void 0:U.showErrors)!==!1;(D=_.events)!=null&&D.css&&L&&e.on(_.events.css,$=>{const{error:I}=$;if(I){const R=dt(I)?I:I.name&&I.reason?`${I.name}: ${I.reason}`:I.message;o.addError("css-error",{header:"CSS Parser Error",content:R})}}),[{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:se.symbolAdd},{id:"detach-symbol",keys:"shift+alt+ctrl+k, shift+alt+⌘+k",cmd:se.symbolDetach}].forEach(({id:$,keys:I,cmd:R})=>{e.Keymaps.add(`preset:${$}`,I,R,{prevent:!0})}),e.on(`${C.runCommand}core:preview`,()=>{s.setPreview(!0),r.setOpen(!1),jm(e,!1)}),e.on(`${C.stopCommand}core:preview`,()=>{s.setPreview(!1),jm(e,!0),setTimeout(()=>{e.refresh()},s.transitionTime)});const N="target-selection",{Components:V}=e;S.add(Hc,{opts:{},init(){this.beforeSelect=this.beforeSelect.bind(this)},onComponentHover($,I){const R={id:N,type:"target",component:I};I?P.addSpot(R):P.removeSpots(R)},beforeSelect($,I={}){I.abort=!0,I.useValid=!1,this.opts.onSelect($),e.stopCommand(Hc)},run($,I,R){this.opts=R,e.on("component:select:before",this.beforeSelect),e.on("change:componentHovered",this.onComponentHover)},stop(){e.off("component:select:before",this.beforeSelect),e.off("change:componentHovered",this.onComponentHover),P.removeSpots({id:N}),s.setSelectingTarget(!1)}}),S.add(ww,()=>{s.setSelectedDesignerTab("style")}),S.add(se.toastAdd,($,I,R)=>{o.add(R.id,R)}),S.add(se.toastRemove,($,I,R)=>{o.remove(R.id)}),S.add(se.dialogOpen,($,I,R)=>{i.open(R)}),S.add(se.dialogClose,()=>{i.close()}),S.add(se.dialogExportCode,()=>{i.open({title:e.t("actions.showCode.title"),content:()=>{var $,I;return h.createElement(yM,{options:(I=($=g.commands)==null?void 0:$.options)==null?void 0:I[os.showCode]})}})}),S.add(se.dialogImportCode,()=>{i.open({title:e.t("actions.importCode.title"),content:()=>h.createElement(iy)})}),S.add(se.sidebarLeftGet,()=>({visible:s.isLeftSidebarOpen})),S.add(se.sidebarLeftSet,($,I,R)=>{s.setLeftSidebarOpen(!!R.visible)}),S.add(se.sidebarLeftToggle,()=>{s.setLeftSidebarOpen(!s.isLeftSidebarOpen)}),S.add(se.sidebarRightGet,()=>({visible:s.isRightSidebarOpen})),S.add(se.sidebarRightSet,($,I,R)=>{s.setRightSidebarOpen(!!R.visible)}),S.add(se.sidebarRightToggle,()=>{s.setRightSidebarOpen(!s.isRightSidebarOpen)}),S.add(se.sidebarTopGet,()=>({visible:s.isTopSidebarOpen})),S.add(se.sidebarTopSet,($,I,R)=>{s.setTopSidebarOpen(!!R.visible)}),S.add(se.sidebarTopToggle,()=>{s.setTopSidebarOpen(!s.isTopSidebarOpen)}),S.add(se.sidebarBottomGet,()=>({visible:s.isBottomSidebarOpen})),S.add(se.sidebarBottomSet,($,I,R)=>{s.setBottomSidebarOpen(!!R.visible)}),S.add(se.sidebarBottomToggle,()=>{s.setBottomSidebarOpen(!s.isBottomSidebarOpen)}),S.add(se.layoutAdd,($,I,R)=>{R.id&&a.add(R.id,R)}),S.add(se.layoutRemove,($,I,R)=>{const{id:z,...X}=R;a.remove(z,X)}),S.add(se.layoutToggle,($,I,R)=>{const{id:z,...X}=R;z&&(a.get(z)?a.remove(z,X):a.add(z,X))}),S.add(se.layoutUpdate,($,I,R)=>{const z=R;e.runCommand(se.layoutRemove,{id:z.id,layout:{placer:{...z.placer,skipCleanup:!0}},force:!0}),setTimeout(()=>e.runCommand(se.layoutAdd,{...z}))}),S.add(se.layoutGet,($,I,R)=>[Lr(a.get(R.id))]),S.add(se.layoutConfigGet,()=>Lr(a.customConfig)),S.add(se.layoutConfigSet,($,I,R)=>{const z=R;a.setCustomConfig(z)}),S.add(se.layoutComponentAdd,($,I,R)=>{const{type:z,component:X}=R;z&&X&&a.addCustomLayoutComponent(z,X)}),S.add(se.layoutComponentGet,($,I,R)=>a.getCustomLayoutComponent(R.type)),S.add(se.layoutComponentRemove,($,I,R)=>{a.removeCustomLayoutComponent(R.type)}),S.add(se.layoutComponentRender,($,I,R)=>h.createElement(G9,{components:R.components})),S.add(se.getStateTheme,()=>s.publicStateTheme),S.add(se.setStateTheme,($,I,R)=>s.setPublicStateTheme(R)),S.add(se.getPagesConfig,()=>s.sdkPagesConfig),S.add(se.setPagesConfig,($,I,R)=>{const{config:z}=R||{};Dt(z)&&s.setSdkPagesConfig(z)}),S.add(se.getPageSettings,()=>JSON.parse(JSON.stringify(s.panelPageSettings))),S.add(se.setPageSettings,($,I,R)=>{s.setPanelPageSettings(R)}),S.add(se.clearPage,()=>{const $=I=>e.t(`actions.${I}`);i.confirm({title:$("clearCanvas.title"),content:$("clearCanvas.content"),confirmButton:{variant:"danger",children:$("clearCanvas.title")},onConfirm:()=>{UA(e)?e.loadProjectData({pages:[{component:"<mjml><mj-body></mj-body></mjml>"}]}):e.Components.clear()}})}),S.add(se.projectFiles,($,I,R)=>{var Y,J;const z=(Y=s.sdkOptions.dataSources)==null?void 0:Y.exportConfig,X=((J=R.exportConfig)==null?void 0:J.exportPreset)??z,Z={isMJML:s.isProjectTypeEmail,exportConfig:X,...R};return X9($,Z)}),S.add(se.validateCode,($,I,R)=>G0({...R,appStore:n})),S.add(se.getBlocksPanel,()=>({isOpen:r.isOpen})),S.add(se.setBlocksPanel,($,I,R)=>{const z=R||{};Dt(z.isOpen)&&r.setOpen(z.isOpen)}),S.add(se.canvasReload,()=>{const $=e.getSelected(),I=P.getCanvasView(),{frames:R}=P.canvas;R.once("loaded:all",()=>{const z=$==null?void 0:$.getView();z&&!z.isInViewport()&&z.el.scrollIntoView({block:"center"})}),I.renderFrames()}),S.add(se.contextMenuComponent,($,I,R)=>{const{component:z,...X}=R;l.showForComponent(z,X)}),S.add(se.getStateContextMenu,()=>l.publicState),S.add(se.setStateContextMenu,($,I,R)=>{l.setPublicState(R)}),S.add(se.symbolAdd,($,I,R)=>{const z=R.component||e.getSelected();if(z)return V.getSymbolInfo(z).isSymbol?o.add("skip-symbol",{header:"The selected element is already a symbol",variant:cn.Warning}):V.addSymbol(z)}),S.add(se.symbolDetach,($,I,R)=>{const z=R.component||e.getSelected();z&&V.getSymbolInfo(z).isRoot&&V.detachSymbol(z)}),S.add(se.symbolOverride,($,I,R)=>{const z=R.component||e.getSelected();z&&(z.setSymbolOverride(R.override),e.Layers.updateLayer(z))}),S.add(se.symbolPropagateStyles,($,I,R)=>{const z=R.component||e.getSelected();if(!z)return;const{Css:X}=e,Z=X.getComponentRules(z,{current:!0})[0];if(Z){const{state:Y,mediaText:J}=Z.attributes,ee=Z.getStyle();V.getSymbolInfo(z).relatives.forEach(W=>{X.setIdRule(W.getId(),ee,{state:Y,mediaText:J})})}R.deep&&z.components().forEach(Y=>e.runCommand(se.symbolPropagateStyles,{...R,component:Y}))}),S.add(se.assetProviderGet,()=>Lr(u.allProviders)),S.add(se.assetProviderAdd,($,I,{provider:R,index:z})=>{u.addProvider(R,z)}),S.add(se.assetProviderRemove,($,I,{id:R})=>{const z=u.allProviders.filter(X=>X.id!==R);u.setAllProviders(z)}),S.add(se.fontGet,()=>Lr(d.fonts)),S.add(se.fontAdd,($,I,{font:R})=>{d.addFont(R)}),S.add(se.fontRemove,($,I,{family:R})=>{d.removeFont(R)}),S.add(se.fontManagerOpen,($,I,R)=>{$h($,R)}),S.add(se.menuFontLoad,($,I,{font:R})=>nh(R,!1)),S.add(se.toggleStateDataSource,()=>(O=!O,e.trigger(Rn.toggleDataSourcesPreview,{showPlaceholder:O}),e.refresh({tools:!0}),{showPlaceholder:O})),S.add(se.getStateDataSource,()=>({showPlaceholder:O})),S.add(se.dataSourceSetGlobalData,($,I,{globalData:R})=>{const z=hx(R);return e.DataSources.get(Uo.globalData).setRecords(z)}),S.add(se.setDragAbsolute,($,I,{enabled:R})=>{s.setIsDraggingAbsolute(!!R)}),S.add(se.dataSourceSetImporter,($,I,R)=>{e.on(e.Parser.events.htmlBefore,z=>{z.input=R.import(z.input)})}),S.add(se.dataSourceSetExporter,($,I,R)=>{e.config.optsHtml={...e.config.optsHtml,exporter:R}}),a7(e,t),g7(e,t),i7(e,t),o7(e),J9(e),qL(e),Q9(e,t),r7(e,t)}const v7=/\s(?![^(]*\))/,rv=/^-?[0-9]+[a-zA-Z%]{0,}$/;function ov(e){const t=e.split(v7),n=t.indexOf("inset")>=0,s=t.filter(d=>d!=="inset"),r=s.filter(d=>!rv.test(d))[0]||"currentColor",o=s.filter(d=>rv.test(d)),[i="0",a="0",l="0",u="0"]=o;return{x:i,y:a,blur:l,spread:u,inset:n,color:r}}const ec=["%"],tc=["s","ms"],Xi=["deg","rad","grad"],Os=["px","%","em","rem","vw","vh"],iv={type:"select",options:["visible","hidden","scroll","auto"].map(e=>({id:e})),default:"visible"},b7=e=>`linear-gradient(${e} 1%, ${e} 100%)`,Dc=e=>({id:e,label:e.split("-").map($s).join(" ")}),Sw=e=>({property:t,to:n})=>{if(n.value){const s=t.getOption(),r=t.getParent().getProperty(e),o=r.getUnit(),i={units:s.units||[],min:s.min,max:s.max,unit:""};(!o||(i==null?void 0:i.units.indexOf(o))<0)&&(i.unit=(i==null?void 0:i.units[0])||""),r.up(i)}},y7=e=>{const t=`${e}-name`,n=`${e}-value`;return(s,{separatorLayers:r})=>{const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Vu(i);return{[t]:a,[n]:l}}):[]}},av=e=>{const t={[ma]:e};if(e.indexOf("url(")>-1)t[Is]=Rr.Image;else if(e.indexOf("gradient(")>-1){const n=Bh(e),s=n.colorStops,r=n.name.indexOf("linear")>=0;s.length===2&&r&&s[0].color===s[1].color?t[Is]=Rr.Color:t[Is]=Rr.Gradient}else t[Is]=Rr.Color,t[ma]=b7(e);return t},lv=(e="filter")=>{const t=`${e}-name`,n=`${e}-value`;return{property:e,type:"stack",layerSeparator:" ",fromStyle(s,{separatorLayers:r}){const o=s[e]||"";return o?o.split(r).map(i=>{const{name:a,value:l}=Vu(i);return{[t]:a,[n]:l}}):[]},toStyle(s,{name:r}){return{[r]:`${s[t]}(${s[n]||"0"})`}},properties:[{property:t,type:"select",default:"blur",options:[{id:"blur",label:"Blur",min:0,units:["px","em","rem","vw","vh"]},{id:"brightness",label:"Brightness",min:0,units:["%"]},{id:"contrast",label:"Contrast",min:0,units:["%"]},{id:"grayscale",label:"Grayscale",min:0,max:100,units:["%"]},{id:"hue-rotate",label:"Hue rotate",min:0,max:360,units:["deg","rad","grad"]},{id:"invert",label:"Invert",min:0,max:100,units:["%"]},{id:"saturate",label:"Saturate",min:0,units:["%"]},{id:"sepia",label:"Sepia",min:0,max:100,units:["%"]}],onChange:Sw(n)},{property:n,type:"integer"}]}},nc=(e,{x:t,y:n,mergable:s}={})=>{const r={property:`${e}-x`,type:"integer",units:Os,...t},o={property:`${e}-y`,type:"integer",units:Os,...n};return{property:e,type:"composite",properties:[r,o],...s&&{fromStyle(i,{name:a,separator:l,property:u}){const[d,f]=u.getProperties(),[p,g]=(i[a]||"").split(l);return{[d.getId()]:i[d.getName()]||p||"",[f.getId()]:i[f.getName()]||g||p||""}},toStyle(i,{name:a,property:l}){const[u,d]=l.getProperties(),f=i[u.getId()],p=i[d.getId()];return{[a]:f===p?f:`${f} ${p}`}}}}},x7=(e,t="")=>{const n=`${e}-name`,s=`${e}-value`;return(r,{name:o})=>({[o]:`${r[n]}(${r[s]||t})`})};["top","middle","bottom"].map(Dc),["none","solid","dotted","dashed","double","groove","ridge","inset","outset"].map(Dc),["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"}));nc("gap",{x:{property:"row-gap",min:0,default:"0"},y:{property:"column-gap",min:0,default:"0"},mergable:!0}),["baseline","top","middle","bottom"].map(Dc),Zw("(?<!\\(.*[^)]),(?![^()]*\\))"),Rr.Image,Rr.Gradient,Rr.Color,["background-position-x","background-position-y"].map(e=>({type:"integer",property:e,units:Os,default:"0px"})),["background-size-x","background-size-y"].map(e=>({type:"integer",property:e,units:Os,default:"auto"})),["border-top-width","border-right-width","border-bottom-width","border-left-width"].map(e=>({type:"integer",property:e,default:"0",units:Os})),["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"})),nc("overflow",{x:iv,y:iv,mergable:!0}),lv(),lv("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(Dc),tc[0],tc[0],y7("transform"),x7("transform","0"),Sw("transform-value"),nc("transform-origin",{x:{default:"50%"},y:{default:"50%"}}),nc("perspective-origin",{x:{default:"50%"},y:{default:"50%"}});function Cw(e,t){return[n=>tM(n,t),...eM[e],n=>m7(n,t),YL(e,t)]}class w7{constructor(t){this.loadCounter=0,this.pendingInstalled=[],this.pendingUninstalled=[],this.selectedShown=!1,this.store=t,pn(this,{},{autoBind:!0})}get hasPending(){return!!this.pendingInstalled.length||!!this.pendingUninstalled.length}*initProjectPlugins(t){this.clearPending();const s=(yield C7()).filter(r=>r.projectType.includes(t));this.setProjectPlugins(s)}setProjectPlugins(t,n={}){this.projectPlugins=[...t],n.clearPending&&this.clearPending()}clearPending(){this.pendingInstalled=[],this.pendingUninstalled=[]}getPluginsToLoad(t,n){const s=[...Cw(t,{appStore:n}),...this.projectPlugins||[]],r=n.sdkOptions.plugins||[];return tt(r)?r({plugins:s}):[...s,...r]}addPendingInstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;s.includes(r)?this.pendingUninstalled=s.filter(o=>o!==r):n.includes(r)||n.push(r)}addPendingUninstalled(t){const{pendingInstalled:n,pendingUninstalled:s}=this,r=t.id;n.includes(r)?this.pendingInstalled=n.filter(o=>o!==r):s.push(r)}setSelectedShown(t){this.selectedShown=t}}const S7={db:g0.gjsStudio},C7=()=>new Promise(async e=>{let t=[];try{t=await pA(cu.Settings,"plugins",S7)||[]}catch(n){Ws()&&console.error(n)}e(t)}),j7=h.createContext(void 0);class E7{constructor(t){this.blockManagerStore=new v3(this),this.appEditorStore=new QA(this,t==null?void 0:t.appEditorStore),this.localSettingsStore=new S4(t==null?void 0:t.localSettingsStore),this.toastStore=new m3(this),this.modalStore=new C4(this),this.i18nStore=new u3(this),this.pluginStore=new w7(this),this.pointerBadgeStore=new h3(this),this.contextMenu=new T7(this),this.layoutStore=new f3(this),this.templatesStore=new g3(this),this.assetsStore=new l3(this),this.globalStylesStore=new b4(this),this.fontsStore=new c3(this),this.appEditorStore.init(),op()&&(window.__gjss=this)}}const jn=()=>{const e=h.useContext(j7);if(!e)throw new Error("useStore must be used inside of StoreProvider");return e},Uh=()=>{throw new Error("Store has not been initialized")};class T7{constructor(t){this.isOpen=!1,this.isEnabled=!0,this.items=[],this.coordinates={x:0,y:0},this.getItemsForComponent=Mo(function*(n,s={}){var x;if(!(n!=null&&n.em))return[];const r=n.em.getEditor(),{isSymbol:o,isRoot:i}=r.Components.getSymbolInfo(n),a=!!n.getSymbolOverride(),l=!!n.get("removable"),u=!!n.parent()&&!!n.toolbar.length,d=!!n.get("copyable"),f=[u&&{id:Pr.selectParent,icon:G.arrowUp,label:"Select parent",onClick:()=>{r.runCommand("core:component-exit",{force:!0})}},d&&{id:Pr.duplicate,icon:G.contentCopy,label:"Duplicate",onClick:()=>{r.runCommand("tlb-clone")}},!o&&l&&{id:Pr.symbolCreate,icon:G.rhombusSplit,label:"Create Symbol",onClick:()=>{r.runCommand(se.symbolAdd)}},o&&i&&{id:Pr.symbolDetach,icon:G.alertRhombus,label:"Detach instance",onClick:()=>{r.runCommand(se.symbolDetach)}},o&&!a&&{id:Pr.symbolOverride,icon:G.rhombusOutline,label:"Make overridable",onClick:()=>{r.runCommand(se.symbolOverride,{override:!0})}},o&&a&&{id:Pr.symbolOverrideClear,icon:G.rhombusSplitOutline,label:"Clear overridable",onClick:()=>{r.runCommand(se.symbolOverride)}},l&&{id:Pr.delete,icon:G.delete,label:"Delete",onClick:()=>{r.runCommand("core:component-delete")}}].filter(Boolean),p=n.get("contextMenu"),g={...s,items:f,component:n,editor:r,type:n.get("type")||"default",source:s.source||th.canvas},m=yield cv(p,g),v=(x=this.store.appEditorStore.sdkComponentsConfig)==null?void 0:x.contextMenu;return yield cv(v,{...g,items:m})}),this.store=t,pn(this,{},{autoBind:!0})}get publicState(){return{enabled:this.isEnabled}}setPublicState(t){t.enabled!==void 0&&(this.isEnabled=t.enabled)}*showForComponent(t,n){const s=t==null?void 0:t.em;if(!s)return;n.skipSelect||s.selected.hasComponent(t)||s.setSelected(t);const r=yield this.getItemsForComponent(t,n);r.length&&this.show({...n,items:r})}show({items:t,x:n,y:s,w:r,h:o}){this.isOpen=!0,this.coordinates={x:n,y:s,w:r,h:o},this.items=t}hide(){this.isOpen=!1,setTimeout(this.clear,101)}clear(){this.items=[],this.coordinates={x:0,y:0}}}const cv=async(e,t)=>tt(e)?(await e(t)).filter(Boolean):t.items,P7=()=>jn().contextMenu,uv=Ws()&&document.body,Wh=(e={})=>({...ch,placement:"right-start",modifiers:[{name:"offset",options:{offset:e.offset||[0,5]}},{name:"flip",options:{boundary:e.boundary??uv}},{name:"preventOverflow",options:{boundary:e.boundary??uv}}]}),O7=Wh(),sc="gs-ctx-menu-list",_7=ce(function({onItemClick:t,open:n,items:s,x:r,y:o,w:i,h:a,className:l}){const u=P7(),[d,f]=h.useState(),[p,g]=h.useState(null),m=h.useMemo(()=>({getBoundingClientRect:()=>new DOMRect(r,o,i,a)}),[r,o,i,a,n]),{styles:v,attributes:b}=sl(m,p,O7),x=M(`${sc}-wrp gs-utl-z-20`,l),y=M(`${sc} gs-utl-z-20`),w=M(`${sc}-body gs-utl-max-w-56`),S=M(`${sc}-item`),C="gs-utl-max-w-40",j=E=>{const{action:O,onClick:P}=E;if(O||P)return T=>{const _={editor:u.store.appEditorStore.editor,...T};tt(O)?(O(_),u.hide()):tt(P)&&(P(_),u.hide())}};return c.jsx("div",{className:x,ref:g,style:v.popper,...b.popper,children:c.jsx(Gp,{show:!!n,...CE,unmount:!1,children:c.jsx(ns,{padding:!1,className:y,classNameBody:w,children:s.map((E,O)=>h.createElement($i,{onItemClick:t,...E,key:E.id??O,className:S,classNameLabel:C,action:j(E),onActive:()=>f(E),active:d===E}))})})})}),Yd="gs-cmp-tooltip";function zt({className:e,classNameWrp:t,classNameContent:n,strategy:s,placement:r="bottom",children:o,title:i,onClick:a,inline:l,size:u}){const[d,f]=h.useState(!1),[p,g]=h.useState(!1),m=Dt(u),[v,b]=h.useState(null),[x,y]=h.useState(null),w=sl(v,x,{...Wh(),placement:r,...s?{strategy:s}:{}});h.useEffect(()=>{var j;d&&((j=w.update)==null||j.call(w))},[d,w.update]),h.useEffect(()=>{const j=setTimeout(()=>f(p),10);return()=>clearTimeout(j)},[p]);const S=M(`${Yd}-target`,!l&&"gs-utl-block",e,!a&&"gs-utl-cursor-auto"),C=M(`${Yd}-content`,n,"gs-utl-fixed gs-utl-z-30 gs-utl-text-sm",!m&&!n&&"gs-utl-whitespace-nowrap",u==="s"&&"gs-utl-w-60");return c.jsxs("div",{className:M(Yd,"gs-utl-relative",t),children:[c.jsx("span",{ref:b,className:S,onMouseEnter:()=>i&&g(!0),onMouseLeave:()=>g(!1),children:c.jsx("div",{className:M(l&&"gs-utl-inline-block"),onClick:()=>{g(!1),a==null||a()},children:o})}),!!p&&c.jsx("div",{className:C,ref:y,style:w.styles.popper,...w.attributes.popper,children:c.jsx(Gp,{show:!!d,unmount:!1,...bb,children:c.jsx(ns,{className:wg.txt,bg:wg.bg,size:"s",border:!1,children:i})})})]})}function St({children:e,title:t,classNameWrp:n,tooltipProps:s,...r}){return c.jsx(zt,{title:t,classNameWrp:n,...s,children:c.jsx(Ke,{...r,children:e})})}const ti="gs-cmp-ai-chat-assets",A7=e=>{var t;return((t=e.mediaType)==null?void 0:t.startsWith("image/"))||e.mediaType==="image/*"},L7=e=>e.mediaType==="application/pdf",jw=({editor:e,assets:t,className:n,onRemove:s,style:r})=>{const o=`${ti}__asset-item`,i=M(`${ti}__asset-image`,"gs-utl-object-cover",te.rnd,El.m),a=M(`${ti}__asset-pdf`,"gs-utl-overflow-hidden",te.rnd,El.m),l=M(`${ti}__asset-file`,"gs-utl-flex gs-utl-items-center gs-utl-justify-center",te.rnd,El.m,B.bgH2),u=M(`${ti}__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",El.s,te.pill,B.bgRed,B.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 A7(p)?c.jsx("img",{src:p.src,alt:v,className:i}):L7(p)?c.jsx("iframe",{src:p.src,title:b,className:a}):c.jsx("div",{className:l,children:c.jsx(ne,{icon:nC,size:oe.l})})};return c.jsx(k,{className:M(ti,n),gap:"xs",wrap:"wrap",style:r,children:t.map((p,g)=>c.jsxs("div",{className:M(o,"gs-utl-relative gs-utl-inline-block"),children:[f(p,g),s&&c.jsx(St,{title:e.t(`${d}.remove`),icon:{icon:G.close,size:oe.s3x},onClick:()=>s(g),size:"x2s",border:!1,className:u})]},p.src))})},an="gs-cmp-ai-chat-input",M7=e=>{const{className:t,style:n,editor:s,disabled:r,maxAssets:o,currentAssetsCount:i,acceptAssetType:a,onFilesSelected:l,onAssetSelected:u}=e,d=h.useRef(null);if(o<=0)return null;const f=`${an}__attach-btn`,p=`${an}__file-input`,g=i>=o,m="aiChat.input.attach",v=s.t(`${m}.upload`),b=s.t(`${m}.selectFromAssets`),x=s.t(`${m}.title`),y=s.t(`${m}.maxAssets`,{params:{count:o}}),w=C=>{const j=Array.from(C.target.files||[]);j.length>0&&l(j),d.current&&(d.current.value="")},S=C=>{if(!s||g)return;const j="btnAttachImages",E=()=>s.runCommand(se.layoutRemove,{id:j});s.runCommand(se.layoutToggle,{id:j,header:!1,placer:{type:"popover",target:C.currentTarget,closeOnClickAway:!0,options:{placement:"top-start"}},layout:{type:"menuList",className:"gs-utl-text-sm",onItemClick:E,items:[{id:"upload",label:v,icon:G.trayArrowDown,onClick:()=>{var O;return(O=d.current)==null?void 0:O.click()}},{id:"assets",label:b,icon:fC,onClick:()=>{s.Assets.open({onSelect:({asset:O})=>{const P=O.getSrc();P&&u(P)}})}}]}})};return c.jsxs(c.Fragment,{children:[c.jsx("input",{ref:d,type:"file",accept:a,multiple:!0,onChange:w,className:p,style:{display:"none"}}),c.jsx(St,{className:M(f,te.pill,t),style:n,title:g?y:x,icon:G.plus,border:!1,onClick:S,disabled:r||g,size:"s",block:!0})]})},N7=({editor:e,className:t,style:n,contextComponents:s,disabled:r})=>{const[o,i]=h.useState(()=>e.getSelectedAll()),a="aiChat.input.context";h.useEffect(()=>{const y=e.Components.events.select,w=()=>i(e.getSelectedAll());return e.on(y,w),()=>{e.off(y,w)}},[e]),h.useEffect(()=>{s.clear(),o.forEach(y=>s.add(y))},[o,s]);const l=()=>i([]);if(o.length===0)return null;const u=`${an}__context`,d=`${an}__context-icon`,f=`${an}__context-badge`,p=`${an}__context-name`,g=`${an}__context-divider`,m=o.length===1,v=o[0],b=e.t(`${a}.multiple`,{params:{count:o.length}}),x=m?v.getName():b;return c.jsxs(k,{className:M(u,r&&Oe.disabled,t),style:n,gap:"s",items:"center",nowrap:!0,children:[c.jsx(ne,{icon:G.target,size:oe.sx,className:M(d,B.txtLowEmphasis)}),c.jsx(Dr,{className:M(f,xb(v).bg,Ee.xyS2),s:"s",children:c.jsxs(k,{gap:"xs",items:"center",nowrap:!0,children:[m&&T0(v),c.jsx("div",{className:M(p,Oe.txtEllips,"gs-utl-max-w-36"),children:x}),!r&&c.jsxs(c.Fragment,{children:[c.jsx("div",{className:M(g,te.br,"gs-utl-h-[18px] gs-utl-opacity-30")}),c.jsx(St,{title:e.t(`${a}.clear`),icon:{icon:G.close,size:oe.s3x},onClick:l,size:"x2s",border:!1,block:!0})]})]})})]})};function dv(){return typeof window<"u"&&(window.SpeechRecognition||window.webkitSpeechRecognition)}function $7(){const[e,t]=h.useState(""),[n,s]=h.useState(!1),[r,o]=h.useState(!1),i=h.useRef();h.useEffect(()=>o(!!dv()),[]);const a=()=>{const u=dv();if(!u)return;t("");const d=new u;d.lang="en-US",d.continuous=!0,d.interimResults=!0,d.onstart=()=>s(!0),d.onend=l,d.onresult=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()},i.current=d,d.start()},l=()=>{var u;(u=i.current)==null||u.stop(),s(!1)};return{transcript:e,isSupported:r,isListening:n,start:a,stop:l}}const k7=({editor:e,disabled:t,onTranscript:n,onListeningChange:s,className:r,style:o})=>{const i=`${an}__dictate`,{transcript:a,isSupported:l,isListening:u,start:d,stop:f}=$7(),p="aiChat.input.dictate",g=e.t(`${p}.start`),m=e.t(`${p}.stop`),v=u?m:g;return h.useEffect(()=>{a&&n(a)},[a]),h.useEffect(()=>{s==null||s(u)},[u]),l?c.jsx(St,{block:!0,size:"s",border:!1,className:M(i,te.pill,r),style:o,title:v,disabled:t,icon:u?jC:CC,onClick:u?f:d,variant:u?"danger":"out-clear"}):null},R7=({autoResize:e,autoFocus:t,style:n={},...s})=>{const r=h.useRef(null);return h.useEffect(()=>{!r.current||!e||(r.current.style.height="auto",r.current.style.height=r.current.scrollHeight+"px")},[s.value,e]),h.useEffect(()=>{const o=r.current;if(o&&t){const i=setTimeout(()=>o==null?void 0:o.focus(),150);return()=>clearTimeout(i)}},[r.current,t]),c.jsx("textarea",{ref:r,style:{...n,...e?{resize:"none"}:{}},...s})},fv=e=>{e.forEach(t=>{t.startsWith("blob:")&&URL.revokeObjectURL(t)})},pv=(e,t)=>e?t?!e.endsWith(" ")&&!t.startsWith(" ")?`${e} ${t}`:`${e}${t}`:e:t,I7=({className:e,style:t,chatContext:n,editor:s,maxAssets:r=5,acceptAssetType:o="image/jpeg,image/png,image/gif,image/webp,application/pdf",uploadProjectAssets:i,layoutBefore:a,layoutAfter:l,onSubmit:u,contextSectionProps:d,textareaProps:f,assetsSectionProps:p,attachButtonProps:g,dictateButtonProps:m,submitButtonProps:v,value:b})=>{const[x,y]=h.useState(b||""),[w,S]=h.useState(""),[C,j]=h.useState(!1),[E,O]=h.useState([]),[P,T]=h.useState(!1),_="aiChat.input",L=s.runCommand(is.getChatApi),N=s.runCommand(is.getChatState),{status:V,stop:A,sendMessage:H,setError:U}=n||L,D=V==="streaming"||V==="submitted",$=E.length>0,I=w?pv(x,w):x,R=!P&&(D||I.trim()||$),z={input:I,assets:E},X=we=>{const nt=r-E.length,st=we.slice(0,nt);if(st.length===0)return;const vt=st.map(Me=>({src:URL.createObjectURL(Me),file:Me,mediaType:Me.type}));O(Me=>[...Me,...vt])},Z=we=>{E.length>=r||O(nt=>[...nt,{src:we,mediaType:"image/*"}])},Y=we=>{const nt=E[we];nt!=null&&nt.file&&fv([nt.src]),O(st=>st.filter((vt,Me)=>Me!==we))},J=async we=>{if(we.preventDefault(),D||P)return;const nt=()=>ee();if(u){u({event:we,submit:nt,state:z});return}nt()},ee=async()=>{if(D||P)return;const we=I.trim();if(!we&&!$)return;const nt=E.filter(Me=>Me.file).map(Me=>Me.file);let vt=E.filter(Me=>!Me.file).map(Me=>({type:"file",url:Me.src.trim(),mediaType:Me.mediaType}));if(nt.length>0){T(!0);try{const ft=await async function(Fe){return i?await i({files:Fe}):new Promise((Zt,he)=>{try{const Ve={dataTransfer:{files:Fe}};s.Assets.FileUploader().uploadFile(Ve,({data:De})=>{Zt(De)})}catch(Ve){he(Ve)}})}(nt),ut=E.filter(Fe=>Fe.file).map(Fe=>Fe.src);vt=[...vt,...ft.map(Fe=>({type:"file",url:Fe.src,mediaType:Fe.mimeType}))],fv(ut)}catch(Me){const ft=s.t(`${_}.uploadError`);U(Me instanceof Error?Me:new Error(ft)),T(!1);return}finally{T(!1)}}H({text:we,files:vt.length>0?vt:void 0,metadata:{createdAt:Date.now()}}),y(""),O([])},W=we=>{we.key==="Enter"&&!we.shiftKey&&(we.preventDefault(),J(we))};h.useEffect(()=>{C||y(we=>pv(we,w)),S("")},[C]);const Q=`${an}__root`,ae=`${an}__actions`,ge=`${an}__actions-left`,Ce=`${an}__actions-right`,Se=`${an}__submit-btn`,et=M(`${an}__textarea gs-utl-w-full`,B.bgTr,Fr.inputText,Oe.noFocusOut,Oe.noResize),Ye=s.t(`${_}.placeholder`),Ct=a==null?void 0:a({state:z}),ct=l==null?void 0:l({state:z});return c.jsxs("form",{onSubmit:J,className:M(an,Ee.s,te.bt,B.br,e),style:t,children:[Ct&&tn(s,Ct),c.jsxs(k,{className:M(Q,te.b,te.rndLg,B.br,B.bg,Ee.s,"gs-utl-relative"),col:!0,gap:"s",children:[P&&c.jsx(Br,{abs:!0,full:!0,className:B.bgH25}),c.jsx(N7,{editor:s,disabled:D,contextComponents:N.contextComponents,...d}),c.jsx(R7,{value:I,name:"prompt",onChange:we=>y(we.target.value),onKeyDown:W,placeholder:Ye,readOnly:C,disabled:D,className:et,style:{minHeight:40,maxHeight:100},autoResize:!0,...f}),c.jsx(jw,{editor:s,assets:E,onRemove:Y,...p}),c.jsxs(k,{className:ae,justify:"between",items:"center",gap:"s",full:!0,children:[c.jsx(k,{className:ge,gap:"s",items:"center",children:c.jsx(M7,{editor:s,disabled:D,maxAssets:r,currentAssetsCount:E.length,acceptAssetType:o,onFilesSelected:X,onAssetSelected:Z,...g})}),c.jsxs(k,{className:Ce,gap:"s",items:"center",children:[c.jsx(k7,{editor:s,disabled:D,onTranscript:S,onListeningChange:j,...m}),c.jsx(Ke,{className:M(Se,te.pill),size:"s",type:D?"button":"submit",onClick:D?A:void 0,icon:D?G.stop:G.arrowUp,variant:D?"out-clear":"pr",disabled:!R,disabledClassName:Oe.disabledM,...v})]})]})]}),ct&&tn(s,ct)]})},V7="gs-cmp-ai-chat-loading-state",H7=({className:e,chatContext:t,editor:n,...s})=>c.jsx(k,{className:M(V7,e),items:"center",justify:"center",full:!0,col:!0,...s,children:c.jsx(Br,{})}),D7="file-refs",Ew="gs-cmp-ai-chat-markdown",xt=`${Ew}__el`,F7={ul:({children:e})=>c.jsx("ul",{className:`${xt}-ul ${It.ul}`,children:e}),ol:({children:e})=>c.jsx("ol",{className:`${xt}-ol ${It.ol}`,children:e}),li:({children:e})=>c.jsx("li",{className:`${xt}-li`,children:e}),p:({children:e})=>c.jsx("p",{className:`${xt}-p`,children:e}),h1:({children:e})=>c.jsx("h1",{className:`${xt}-h1 ${It.h1}`,children:e}),h2:({children:e})=>c.jsx("h2",{className:`${xt}-h2 ${It.h2}`,children:e}),h3:({children:e})=>c.jsx("h3",{className:`${xt}-h3 ${It.h3}`,children:e}),h4:({children:e})=>c.jsx("h4",{className:`${xt}-h4 ${It.h4}`,children:e}),h5:({children:e})=>c.jsx("h5",{className:`${xt}-h5 ${It.h5}`,children:e}),h6:({children:e})=>c.jsx("h6",{className:`${xt}-h6 ${It.h6}`,children:e}),a:({href:e,children:t})=>c.jsx("a",{href:e,className:`${xt}-a ${Fr.link} gs-utl-underline`,target:"_blank",rel:"noopener noreferrer",children:t}),code:({children:e,className:t})=>!t?c.jsx("code",{className:`${xt}-code-inline ${It.codeInline}`,children:e}):c.jsx("code",{className:`${xt}-code-block ${t||""}`,children:e}),pre:({children:e})=>c.jsx("pre",{className:`${xt}-pre ${It.pre}`,children:e}),blockquote:({children:e})=>c.jsx("blockquote",{className:`${xt}-blockquote ${It.blockquote} ${B.br} [&>p]:gs-utl-my-0`,children:e}),hr:()=>c.jsx("hr",{className:`${xt}-hr ${It.hr} ${B.br}`}),strong:({children:e})=>c.jsx("strong",{className:`${xt}-strong ${It.strong}`,children:e}),em:({children:e})=>c.jsx("em",{className:`${xt}-em ${It.em}`,children:e}),del:({children:e})=>c.jsx("del",{className:`${xt}-del gs-utl-line-through`,children:e}),table:({children:e})=>c.jsx("table",{className:`${xt}-table ${It.table}`,children:e}),thead:({children:e})=>c.jsx("thead",{className:`${xt}-thead ${It.thead}`,children:e}),tbody:({children:e})=>c.jsx("tbody",{className:`${xt}-tbody`,children:e}),tr:({children:e})=>c.jsx("tr",{className:`${xt}-tr ${It.tr}`,children:e}),th:({children:e})=>c.jsx("th",{className:`${xt}-th ${It.th}`,children:e}),td:({children:e})=>c.jsx("td",{className:`${xt}-td ${It.td}`,children:e}),input:({checked:e,disabled:t})=>c.jsx("input",{type:"checkbox",checked:e,disabled:t,className:`${xt}-checkbox gs-utl-mr-2`,readOnly:!0}),[D7]:({children:e})=>c.jsx("img-refs",{style:{display:"none"},children:e})};function B7(e){return Nw.marked.lexer(e,{gfm:!0}).map(n=>n.raw)}const z7=h.memo(function({content:t}){return c.jsx($w,{components:F7,remarkPlugins:[kw],children:t})},(e,t)=>e.content===t.content),hv=h.memo(function({content:t,id:n,className:s}){const r=h.useMemo(()=>B7(t),[t]);return c.jsx("div",{className:`${Ew} ${s||""}`,children:r.map((o,i)=>c.jsx(z7,{content:o},`${n}-block_${i}`))})});function sp(e){return!!e&&typeof e=="object"&&e.type==="source-url"}function Tw(e){return!!e&&typeof e=="object"&&e.type==="source-document"}const Xd="gs-cmp-ai-chat-message",ni="aiChat.message",U7=h.memo(function({className:t,style:n,message:s,isStreaming:r,showSources:o=!1,editor:i,chatContext:a,layoutBeforeMessage:l,layoutAfterMessage:u,layoutPart:d,layoutPartToolLabel:f,layoutPartToolDetail:p,layoutPartToolResult:g}){const m=s.parts||[],v=m.filter(Co.isFileUIPart),b=m.filter(P=>!Co.isFileUIPart(P)&&(o||!sp(P)&&!Tw(P))),x=v.map(P=>({src:P.url,mediaType:P.mediaType??"image/*"})),y=b.length-1,w=s.role==="user",S=M(Xd,`${Xd}--${s.role}`,Ee.s,t),C=M(`${Xd}__content gs-utl-break-words`,w?M(B.bgA,"gs-utl-inline-block gs-utl-text-left gs-utl-max-w-[90%]",Ee.xyS,te.rnd):"gs-utl-w-full"),j={editor:i,chatContext:a,message:s},E=l==null?void 0:l(j),O=u==null?void 0:u(j);return c.jsxs(k,{col:!0,gap:"s",className:S,style:n,children:[E&&tn(i,E),c.jsxs(k,{gap:"s",className:M(C,"gs-utl-self-end"),col:!0,nowrap:!0,children:[b.map((P,T)=>c.jsx(W7,{part:P,messageId:s.id,partIndex:T,isStreamingPart:T===y&&r,layoutPart:d,layoutPartToolLabel:f,layoutPartToolDetail:p,layoutPartToolResult:g,layoutProps:j},`${s.id}-part-${T}`)),c.jsx(jw,{editor:i,assets:x,className:"gs-utl-justify-end"})]}),O&&tn(i,O)]})}),er="gs-cmp-ai-chat-message-part",W7=h.memo(function({part:t,messageId:n,partIndex:s,isStreamingPart:r,layoutPart:o,layoutPartToolLabel:i,layoutPartToolDetail:a,layoutPartToolResult:l,layoutProps:u}){var d,f;if(o){const p=o({...u,part:t,partIndex:s});if(p)return tn(u.editor,p)}if(Co.isReasoningUIPart(t)){const{text:p,state:g}=t,m=p==null?void 0:p.trim(),v=r&&g==="streaming",b=`${er} ${er}__reasoning`,x=u.editor.t(`${ni}.reasoning`);return!!m&&c.jsx(hr,{className:M(b,B.txtLowEmphasis),classNameHandlerContent:"gs-utl-flex-none",handler:c.jsxs(k,{className:M(`${b}-label`,vn.semibold),items:"center",gap:"s",children:[v?c.jsx(Br,{size:"xs",currentColor:!0}):c.jsx(Ji,{path:mC,size:oe.s2x}),c.jsx("div",{children:x})]}),children:c.jsx("div",{className:M(`${b}-text`,B.txtLowEmphasis,bn.xs,vn.italic),children:c.jsx(hv,{id:`${n}-${s}`,content:m})})})}if(Co.isTextUIPart(t)){const p=t.text;if(!p)return null;const g=`${er} ${er}__text`;return c.jsx(hv,{content:p,id:`${n}-${s}`,className:g})}if(Co.isToolUIPart(t)){const{type:p,toolCallId:g,input:m="",output:v="",errorText:b}=t,x=p.replace("tool-","").replace("dynamic-",""),y=typeof m=="string"?m:JSON.stringify(m),w=typeof v=="string"?v:JSON.stringify(v),S=typeof t.state=="string"?t.state:void 0,C=S==="output-available",j=!!r&&(S==="input-streaming"||S==="input-available"),E=`${er}__tool`,O=`${er}__tool-result`,P=`${E}-detail`,T=M(P,"gs-utl-max-w-full"),_="gs-utl-max-w-full gs-utl-whitespace-normal",L=M(`${P}-info gs-utl-max-h-24 gs-utl-overflow-auto`,_,B.txtLowEmphasis,bn.xs),N=M(`${er}__tool-streaming gs-utl-max-h-10 gs-utl-overflow-hidden`,_,B.txtLowEmphasis,bn.xs),V=`${E}-section-label`,A=y&&y!=="{}",H=w&&w!=="{}",U=!!b,D=A||H||U,$=u.editor.t(`${ni}.tool.input`),I=u.editor.t(`${ni}.tool.output`),R=u.editor.t(`${ni}.tool.error`),X=u.editor.t(`${ni}.tools.${x}`,{params:m||{}})||x,Y=u.editor.runCommand(is.getChatManager).tools[x],J={...u,part:t,partIndex:s,toolName:x,isCompleted:C,isProcessing:j,input:t.input,output:t.output},ee=(i==null?void 0:i(J))||((d=Y==null?void 0:Y.layoutToolLabel)==null?void 0:d.call(Y,J)),W=a==null?void 0:a(J),Q=(l==null?void 0:l(J))||((f=Y==null?void 0:Y.layoutToolResult)==null?void 0:f.call(Y,J)),ae=ee?tn(u.editor,ee):X,ge=Q?tn(u.editor,Q):null,Ce=W?tn(u.editor,W):c.jsxs(k,{col:!0,gap:"s",className:"gs-utl-mt-1",children:[A&&c.jsxs(k,{className:M(T,`${P}--input`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:V,children:$}),c.jsx("pre",{className:L,children:y})]}),H&&c.jsxs(k,{className:M(T,`${P}--output`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:V,children:I}),c.jsx("pre",{className:L,children:w})]}),U&&c.jsxs(k,{className:M(T,`${P}--error`),gap:"xs",col:!0,nowrap:!0,children:[c.jsx("div",{className:V,children:R}),c.jsx("pre",{className:L,children:b})]})]});return c.jsxs(k,{className:M(`${er} ${E}`,B.bgH2,te.rnd,Ee.xyS),gap:"xs",col:!0,nowrap:!0,children:[c.jsx(hr,{disabled:!D&&!W,handler:c.jsxs(k,{className:M(`${E}-label`),items:"center",gap:"s",nowrap:!0,children:[c.jsx("div",{className:`${E}-status`,children:C?c.jsx(Ji,{className:`${E}-status-success`,path:Sv,size:oe.s2x}):j?c.jsx(Br,{className:`${E}-status-processing`,size:"xs",currentColor:!0}):c.jsx(Ji,{className:`${E}-status-error`,path:Cv,size:oe.s2x})}),c.jsx("div",{className:M(`${E}-name`,jE.all),children:ae})]}),children:Ce}),c.jsx(G7,{toolCallId:g,toolStatusProgress:u.chatContext.toolStatusProgress,isStreaming:r,className:N}),!!ge&&c.jsx("div",{className:O,children:ge})]})}if(sp(t)||Tw(t)){const p=`${er}__source`,m=sp(t)?t.url:void 0,v=t.title,b=u.editor.t(`${ni}.source.document`),x=v||m||b,y=m?new URL(m).hostname:"",w=c.jsxs(c.Fragment,{children:[c.jsxs("div",{className:M(`${p}-content`,"gs-utl-flex-1 gs-utl-min-w-0"),children:[c.jsx("div",{className:M(`${p}-title`,vn.semibold,bn.sm,"gs-utl-truncate"),children:x}),y&&c.jsx("div",{className:M(`${p}-url`,B.txtLowEmphasis,bn.xs,"gs-utl-truncate"),children:y})]}),m&&c.jsx(Ji,{className:M(`${p}-icon`,B.txtLowEmphasis),path:jv,size:oe.s2x})]}),S=M(p,B.bgH2,te.rnd,Ee.xyS,"gs-utl-flex gs-utl-items-center gs-utl-gap-2 gs-utl-no-underline",m&&Oe.hoverM);return m?c.jsx("a",{href:m,target:"_blank",rel:"noopener noreferrer",className:S,children:w}):c.jsx("div",{className:S,children:w})}return null}),G7=h.memo(function({toolCallId:t,toolStatusProgress:n,isStreaming:s,className:r}){const[o,i]=h.useState(""),a=h.useRef(null);return h.useEffect(()=>{if(!s||!t){i("");return}const l=n.get(t);l!=null&&l.content&&i(l.content);const u=setInterval(()=>{const d=n.get(t);d!=null&&d.content&&i(d.content),d!=null&&d.completed&&(clearInterval(u),i(""))},100);return()=>clearInterval(u)},[t,n,s]),h.useEffect(()=>{a.current&&o&&(a.current.scrollTop=a.current.scrollHeight)},[o]),!o||!s?null:c.jsx("pre",{ref:a,className:r,children:o})}),q7="gs-cmp-ai-chat-messages-status",K7=({className:e,chatContext:t,style:n})=>{const{status:s}=t,r=s==="streaming"||s==="submitted",o=M(B.bgA,Oe.dot,Oe.bounce);return r?c.jsxs(k,{items:"center",gap:"xs",className:M(q7,e,Ee.s),style:n,children:[c.jsx("div",{className:o}),c.jsx("div",{className:o,style:{animationDelay:"0.15s"}}),c.jsx("div",{className:o,style:{animationDelay:"0.3s"}})]}):null},Jd="gs-cmp-ai-chat-messages";function Z7({editor:e,chatContext:t,messages:n,pluginOptions:s}){const r=h.useRef(null),[o,i]=h.useState(null),{status:a}=t,l=a==="streaming"||a==="submitted",u=M(Jd,"gs-utl-flex-1 gs-utl-min-h-0 gs-utl-overflow-hidden"),d=h.useCallback(({item:g,index:m})=>pf(e,{type:"aiChatMessage",chatContext:t,message:g,isStreaming:l&&m===n.length-1},s),[t,e,l,n.length,s]),f=h.useCallback(()=>({type:"column",className:`${Jd}__footer`,children:pf(e,{type:"aiChatMessagesStatus",chatContext:t},s)}),[t,e,s]),p=g=>{requestAnimationFrame(()=>{o==null||o.scrollToIndex({index:n.length-1,align:"end",behavior:g?"smooth":void 0})})};return h.useEffect(()=>{p(!0)},[n]),h.useEffect(()=>{p()},[o]),c.jsx(k,{ref:r,className:u,gap:"s",col:!0,nowrap:!0,children:n.length===0?tn(e,{type:"aiChatEmptyState",chatContext:t},s):tn(e,{type:"virtualList",className:`${Jd}__list`,itemsPerRow:1,items:n,onRef:i,itemLayout:d,footerLayout:f})})}const Pw=h.createContext(void 0),Y7=({chatManager:e,children:t})=>{const n=e.currentChatState,s=h.useMemo(()=>({chatManager:e,chatState:n}),[e,n]);return c.jsx(Pw.Provider,{value:s,children:t})},X7=()=>h.useContext(Pw),J7="gs-cmp-ai-chat-panel";function Q7({editor:e,pluginOptions:t,style:n,className:s}){const{chatState:r}=X7(),[,o]=h.useState(0),[i,a]=h.useState(),{toolAbortControllers:l,toolStatusProgress:u,contextComponents:d,isMessagesLoaded:f}=r;h.useEffect(()=>r.onUpdate(()=>o(j=>++j)),[]);const p=gv.useChat({chat:r.chat}),{messages:g,sendMessage:m,status:v,setMessages:b,error:x}=p,y=x||i,w=h.useMemo(()=>({id:p.id,messages:g,setMessages:b,sendMessage:m,status:v,stop:()=>(l.forEach(C=>C.abort()),l.clear(),p.stop()),addToolApprovalResponse:p.addToolApprovalResponse,addToolOutput:p.addToolOutput,error:y,setError:C=>a(typeof C=="string"?new Error(C):C),clearError:()=>{p.clearError(),a(void 0)},toolStatusProgress:u,contextComponents:d}),[e,v,g,y]),S=M(J7,s,"gs-utl-relative gs-utl-w-full gs-utl-h-full gs-utl-min-h-0 gs-utl-max-h-full gs-utl-overflow-hidden");return c.jsx(k,{className:S,style:n,col:!0,nowrap:!0,children:f?c.jsxs(c.Fragment,{children:[tn(e,{type:"aiChatHeader",chatContext:w},t),c.jsx(Z7,{editor:e,chatContext:w,messages:g,pluginOptions:t}),w.error&&tn(e,{type:"aiChatError",chatContext:w},t),tn(e,{type:"aiChatInput",chatContext:w},t)]}):tn(e,{type:"aiChatLoadingState",chatContext:w},t)})}const eV=(e,t,n)=>(e.runCommand(se.layoutComponentAdd,{type:"aiChatPanel",component:s=>({type:"custom",noWrapper:!0,component:()=>c.jsx(Y7,{chatManager:n,children:c.jsx(Q7,{...s,editor:e,pluginOptions:t})})})}),e.runCommand(se.layoutComponentAdd,{type:"aiChatHeader",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:dT})}),e.runCommand(se.layoutComponentAdd,{type:"aiChatError",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:uT})}),e.runCommand(se.layoutComponentAdd,{type:"aiChatLoadingState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:H7})}),e.runCommand(se.layoutComponentAdd,{type:"aiChatInput",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:I7})}),e.runCommand(se.layoutComponentAdd,{type:"aiChatEmptyState",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:cT})}),e.runCommand(se.layoutComponentAdd,{type:"aiChatMessage",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:U7})}),e.runCommand(se.layoutComponentAdd,{type:"aiChatMessagesStatus",component:s=>({type:"custom",noWrapper:!0,componentProps:s,component:K7})}),()=>{["aiChatPanel","aiChatHeader","aiChatError","aiChatLoadingState","aiChatInput","aiChatEmptyState","aiChatMessage","aiChatMessagesStatus"].forEach(s=>{e.runCommand(se.layoutComponentRemove,{type:s})})}),tV={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"}}}},nV="aiChat",sV=ri.startup,rV=function(e,t={}){t.getAccessToken&&(Qt.getAccessToken=t.getAccessToken),Sb();const n=new iT(e,t),{Commands:s}=e;s.add(is.getChatManager,()=>n),s.add(is.getChatState,()=>n.currentChatState),s.add(is.getChatApi,()=>n.currentChatState.chatApi),e.I18n.addMessages({en:tV});const r=eV(e,t,n),o=()=>{delete s.commands[is.getChatManager],delete s.commands[is.getChatState],delete s.commands[is.getChatApi],r(),TE()};cS({editor:e,licenseKey:t.licenseKey,plan:sV,pluginName:nV,onLicenseCheckResponse:i=>{i?Qt.license=i:Qt.license=void 0},cleanup:o})},oV=lS(rV);module.exports=oV;
|