@powerhousedao/connect 4.1.0-dev.12 → 4.1.0-dev.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/dist/assets/{AddDriveModal.DJ-dAFOA.js → AddDriveModal.Cf7H_0zj.js} +2 -2
  2. package/dist/assets/{AddDriveModal.DJ-dAFOA.js.map → AddDriveModal.Cf7H_0zj.js.map} +1 -1
  3. package/dist/assets/{AddRemoteDriveModal.Bbso9zlA.js → AddRemoteDriveModal.CrCRttWa.js} +2 -2
  4. package/dist/assets/{AddRemoteDriveModal.Bbso9zlA.js.map → AddRemoteDriveModal.CrCRttWa.js.map} +1 -1
  5. package/dist/assets/{CookiesPolicyModal._TIEDwTl.js → CookiesPolicyModal.D62jSGGv.js} +2 -2
  6. package/dist/assets/{CookiesPolicyModal._TIEDwTl.js.map → CookiesPolicyModal.D62jSGGv.js.map} +1 -1
  7. package/dist/assets/{CreateDocumentModal.6coMTZ5K.js → CreateDocumentModal.BwrS_1ZB.js} +2 -2
  8. package/dist/assets/{CreateDocumentModal.6coMTZ5K.js.map → CreateDocumentModal.BwrS_1ZB.js.map} +1 -1
  9. package/dist/assets/{DebugSettingsModal.CC8h7-01.js → DebugSettingsModal.BSj7FVgg.js} +2 -2
  10. package/dist/assets/{DebugSettingsModal.CC8h7-01.js.map → DebugSettingsModal.BSj7FVgg.js.map} +1 -1
  11. package/dist/assets/{DeleteDriveModal.MOCpt-lE.js → DeleteDriveModal.C2AZUpZJ.js} +2 -2
  12. package/dist/assets/{DeleteDriveModal.MOCpt-lE.js.map → DeleteDriveModal.C2AZUpZJ.js.map} +1 -1
  13. package/dist/assets/{DeleteItemModal.D1JNJ3SD.js → DeleteItemModal.C-OpfNuq.js} +2 -2
  14. package/dist/assets/{DeleteItemModal.D1JNJ3SD.js.map → DeleteItemModal.C-OpfNuq.js.map} +1 -1
  15. package/dist/assets/{DisclaimerModal.CpWL_8dJ.js → DisclaimerModal.Ccxc0nLf.js} +2 -2
  16. package/dist/assets/{DisclaimerModal.CpWL_8dJ.js.map → DisclaimerModal.Ccxc0nLf.js.map} +1 -1
  17. package/dist/assets/{DriveSettingsModal.Cq31PlSd.js → DriveSettingsModal.D5KNJY6l.js} +2 -2
  18. package/dist/assets/{DriveSettingsModal.Cq31PlSd.js.map → DriveSettingsModal.D5KNJY6l.js.map} +1 -1
  19. package/dist/assets/{SettingsModal.DXSp8FUL.js → SettingsModal.Dlv5ay3I.js} +2 -2
  20. package/dist/assets/{SettingsModal.DXSp8FUL.js.map → SettingsModal.Dlv5ay3I.js.map} +1 -1
  21. package/dist/assets/{Trans.B_Bse39z.js → Trans.D16e5lIT.js} +2 -2
  22. package/dist/assets/{Trans.B_Bse39z.js.map → Trans.D16e5lIT.js.map} +1 -1
  23. package/dist/assets/{UpgradeDriveModal.Bcaqra-T.js → UpgradeDriveModal.BlBs5hA2.js} +2 -2
  24. package/dist/assets/{UpgradeDriveModal.Bcaqra-T.js.map → UpgradeDriveModal.BlBs5hA2.js.map} +1 -1
  25. package/dist/assets/{atlas-import.CrAV29KX.js → atlas-import.BXzenTPn.js} +2 -2
  26. package/dist/assets/{atlas-import.CrAV29KX.js.map → atlas-import.BXzenTPn.js.map} +1 -1
  27. package/dist/assets/{content.BVfObTK-.js → content.C7Tf__J1.js} +3 -3
  28. package/dist/assets/{content.BVfObTK-.js.map → content.C7Tf__J1.js.map} +1 -1
  29. package/dist/assets/{cookie-banner.CqSpDuL2.js → cookie-banner.La7ZM_eP.js} +2 -2
  30. package/dist/assets/{cookie-banner.CqSpDuL2.js.map → cookie-banner.La7ZM_eP.js.map} +1 -1
  31. package/dist/assets/{index.TIUvoczv.js → index.3hOoElSf.js} +2 -2
  32. package/dist/assets/{index.TIUvoczv.js.map → index.3hOoElSf.js.map} +1 -1
  33. package/dist/assets/{index.Be3reTUB.js → index.BYC0NBlt.js} +2 -2
  34. package/dist/assets/{index.Be3reTUB.js.map → index.BYC0NBlt.js.map} +1 -1
  35. package/dist/assets/{index.ycvKRDCc.js → index.Bp-WcPxB.js} +2 -2
  36. package/dist/assets/{index.ycvKRDCc.js.map → index.Bp-WcPxB.js.map} +1 -1
  37. package/dist/assets/{index.DNX0QOJs.js → index.C6pm3WV4.js} +2 -2
  38. package/dist/assets/{index.DNX0QOJs.js.map → index.C6pm3WV4.js.map} +1 -1
  39. package/dist/assets/{index.MXCURbo4.js → index.CPOc398i.js} +2 -2
  40. package/dist/assets/{index.MXCURbo4.js.map → index.CPOc398i.js.map} +1 -1
  41. package/dist/assets/{index.C0tp--nk.js → index.Ckf1F9xL.js} +5 -5
  42. package/dist/assets/{index.C0tp--nk.js.map → index.Ckf1F9xL.js.map} +1 -1
  43. package/dist/assets/{index.CTYq_dOR.js → index.DZpmKvHm.js} +2 -2
  44. package/dist/assets/{index.CTYq_dOR.js.map → index.DZpmKvHm.js.map} +1 -1
  45. package/dist/assets/{index.hUDcoha1.js → index.Wtw69psk.js} +2 -2
  46. package/dist/assets/{index.hUDcoha1.js.map → index.Wtw69psk.js.map} +1 -1
  47. package/dist/assets/{main.CpBKbYrC.js → main.Ct4ze-gD.js} +3 -3
  48. package/dist/assets/{main.CpBKbYrC.js.map → main.Ct4ze-gD.js.map} +1 -1
  49. package/dist/assets/{modal.B6AxZ1yB.js → modal.DJJLv9Ix.js} +3 -3
  50. package/dist/assets/{modal.B6AxZ1yB.js.map → modal.DJJLv9Ix.js.map} +1 -1
  51. package/dist/assets/{modals.jKUpbvJU.js → modals.CwMSvvzX.js} +2 -2
  52. package/dist/assets/{modals.jKUpbvJU.js.map → modals.CwMSvvzX.js.map} +1 -1
  53. package/dist/assets/{nodefs.rxvmn5tR.js → nodefs.CMNcaR9K.js} +2 -2
  54. package/dist/assets/{nodefs.rxvmn5tR.js.map → nodefs.CMNcaR9K.js.map} +1 -1
  55. package/dist/assets/{nodes.CkHD8Mis.js → nodes.B1qtA14Q.js} +2 -2
  56. package/dist/assets/{nodes.CkHD8Mis.js.map → nodes.B1qtA14Q.js.map} +1 -1
  57. package/dist/assets/{opfs-ahp.BE5Mymun.js → opfs-ahp.9JvsZyp-.js} +2 -2
  58. package/dist/assets/{opfs-ahp.BE5Mymun.js.map → opfs-ahp.9JvsZyp-.js.map} +1 -1
  59. package/dist/assets/{registerServiceWorker.3WXSlUUt.js → registerServiceWorker.C9TfA3P-.js} +2 -2
  60. package/dist/assets/{registerServiceWorker.3WXSlUUt.js.map → registerServiceWorker.C9TfA3P-.js.map} +1 -1
  61. package/dist/assets/{root.20yJwNI0.js → root.CEBcq6z5.js} +2 -2
  62. package/dist/assets/{root.20yJwNI0.js.map → root.CEBcq6z5.js.map} +1 -1
  63. package/dist/assets/{useAcceptedCookies.BEC0OUzL.js → useAcceptedCookies.B8uxCrAk.js} +2 -2
  64. package/dist/assets/{useAcceptedCookies.BEC0OUzL.js.map → useAcceptedCookies.B8uxCrAk.js.map} +1 -1
  65. package/dist/assets/useDefaultDocumentModelEditor.p-onMWVd.js +2 -0
  66. package/dist/assets/{useDefaultDocumentModelEditor.oOnI3BO7.js.map → useDefaultDocumentModelEditor.p-onMWVd.js.map} +1 -1
  67. package/dist/assets/{useInitSentry.DX0S8ltZ.js → useInitSentry.BBnCtPcq.js} +6 -6
  68. package/dist/assets/{useInitSentry.DX0S8ltZ.js.map → useInitSentry.BBnCtPcq.js.map} +1 -1
  69. package/dist/index.html +1 -1
  70. package/dist/vite-envs.sh +1 -1
  71. package/package.json +11 -11
  72. package/dist/assets/useDefaultDocumentModelEditor.oOnI3BO7.js +0 -2
@@ -1,2 +1,2 @@
1
- import{jsxs as y,jsx as o}from"react/jsx-runtime";import{u as b}from"./useAcceptedCookies.BEC0OUzL.js";import{s as v,i as g,h as k,j as w}from"./index.C0tp--nk.js";import{useSyncExternalStore as S}from"react";import{i as l}from"./i18next.CqOP20KE.js";import{useModal as C}from"./modal.B6AxZ1yB.js";import{a6 as D}from"./index.CW6hXWch.js";import{T as B}from"./Trans.B_Bse39z.js";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";import"react-dom";const x={type:"3rdParty",init(e){v(e.options.react),g(e)}},A=k.routerBasename,c=`${A}:display-cookie-banner`,n=new Set;let d=T();function T(){try{return localStorage.getItem(c)!=="false"}catch(e){return console.error(e),!0}}function a(){return d}function N(e){d=e,localStorage.setItem(c,JSON.stringify(e))}function E(e){return n.add(e),()=>n.delete(e)}const I=()=>[S(E,a,a),N],j={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},P={placeholder:"Search Powerhouse",filterLabel:"File type"},F={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},O={options:{switchboardLink:"Switchboard Link"}},R={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},W={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},Y={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},L={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},U={common:j,searchbar:P,folderView:F,files:O,modals:R,notifications:W,footer:Y,cookieBanner:L},z={en:{code:"en",name:"English",translation:U}};l.use(x).init({resources:z,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(e=>{console.error(e)});const K=(e,i)=>e.some(t=>t.id===i&&t.value),oe=()=>{const{t:e}=w(void 0,{useSuspense:!0,i18n:l}),{showModal:i}=C(),[t,s]=I(),[,r]=b(),u=[{id:"analytics-cookie",label:e("cookieBanner.cookies.analytics"),value:!0}],m=p=>{s(!1),K(p,"analytics-cookie")&&r(h=>({...h,analytics:!0}))},f=()=>{s(!1),r(()=>({analytics:!1,functional:!1,marketing:!1}))};return t?y("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[o("div",{className:"absolute inset-0 bg-black opacity-15"}),o("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:o(D,{className:"max-w-[1024px] ",cookies:u,onSubmit:m,onReject:f,submitLabel:e("cookieBanner.accept"),rejectLabel:e("cookieBanner.reject"),children:o("p",{className:"font-semibold text-gray-500",children:o(B,{i18nKey:"cookieBanner.message",components:{a:o("a",{onClick:()=>i("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};export{oe as CookieBanner};
2
- //# sourceMappingURL=cookie-banner.CqSpDuL2.js.map
1
+ import{jsxs as y,jsx as o}from"react/jsx-runtime";import{u as b}from"./useAcceptedCookies.B8uxCrAk.js";import{s as v,i as g,h as k,j as w}from"./index.Ckf1F9xL.js";import{useSyncExternalStore as S}from"react";import{i as l}from"./i18next.CqOP20KE.js";import{useModal as C}from"./modal.DJJLv9Ix.js";import{a6 as D}from"./index.CW6hXWch.js";import{T as B}from"./Trans.D16e5lIT.js";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";import"react-dom";const x={type:"3rdParty",init(e){v(e.options.react),g(e)}},A=k.routerBasename,c=`${A}:display-cookie-banner`,n=new Set;let d=T();function T(){try{return localStorage.getItem(c)!=="false"}catch(e){return console.error(e),!0}}function a(){return d}function N(e){d=e,localStorage.setItem(c,JSON.stringify(e))}function E(e){return n.add(e),()=>n.delete(e)}const I=()=>[S(E,a,a),N],j={cancel:"Cancel",delete:"Delete",continue:"Continue",empty:"Empty",create:"Create",save:"Save",export:"Export",reload:"Reload",reloadConnect:"Click here to reload Connect"},P={placeholder:"Search Powerhouse",filterLabel:"File type"},F={sections:{folders:{title:"Folders",empty:"No folders 🗂️"},documents:{title:"Documents and files",empty:"No documents or files 📄"}}},O={options:{switchboardLink:"Switchboard Link"}},R={deleteItem:{folder:{header:"Delete “{{item}}” folder?",body:"Are you sure you want to delete this folder? All files and subfolders within it will be removed."},file:{header:"Delete “{{item}}” file?",body:"Are you sure you want to delete this file?"}},deleteDrive:{title:'Delete "{{label}}" drive?',body:"Are you sure you want to delete this drive? All files and subfolders within it will be removed. Do you want to proceed?",inputPlaceholder:"Enter drive name..."},upgradeDrive:{header:"Upgrade to cloud drive",body:"You are moving files from a private to a shared drive. These files will become accessible to others in the shared drive.Do you want to proceed?"},createDocument:{header:"Create a new document",placeholder:"Document name"},connectSettings:{title:"Settings",body:"These settings will apply to all drives.",clearStorage:{button:"Clear Storage",description:"Delete previous session data",confirmation:{title:"Clear Storage",body:"Are you sure you want to clear the storage? This will remove all previous session data.",clearButton:"Clear Storage"}},enabledDocumentTypes:{title:"Document Models",description:"Documents enabled",allSelected:"All documents are selected"}},exportDocumentWithErrors:{title:"Your document contains errors",body:"Your document contains structure errors. Do you want to export it anyway?"},disclaimer:{title:"Disclaimer",body:"All content provided herein our website, hyperlinked sites, associated applications, forums, blogs, social media accounts and other platforms (“Site”) is for your general information only, procured from third party sources. We make no warranties of any kind in relation to our content, including but not limited to accuracy and updatedness. No part of the content that we provide constitutes financial advice, legal advice or any other form of advice meant for your specific reliance for any purpose. Any use or reliance on our content is solely at your own risk and discretion. You should conduct your own research, review, analyse and verify our content before relying on them. Trading is a highly risky activity that can lead to major losses, please therefore consult your financial advisor before making any decision. No content on our Site is meant to be a solicitation or offer."},cookiesPolicy:{title:"Cookies Policy",body:"<subtitle>Use of Cookies and Similar Technologies</subtitle><p>The Site is using cookies. Cookies are small text files that are placed on your computer by websites that you visit. They are widely used in order to make websites work, or work more efficiently, as well as to provide information to the owners of the site. Cookies are typically stored on your computer´s hard drive.Information collected from cookies is used by us to evaluate the effectiveness of our Site and analyze trends. The information collected from cookies allows us to determine such things as which parts of the Site are most visited and difficulties our visitors may experience in accessing the SIte. With this knowledge, we can improve the quality of your experience on the Site by recognizing and delivering more of the most desired features and information, as well as by resolving access difficulties.</p><p>We use third party service providers, to assist us in better understanding the use of our Site. Our service providers will place cookies on the hard drive of your computer (or use similar technologies) and will receive information that we select that will educate us on such things as how visitors navigate around our Site. This information is aggregated to provide statistical data about our users browsing actions and patterns, and does not personally identify individuals. This information may include:</p><p>Computer or mobile device information, Website usage information, such as:<list></p><bullet>Page views,</bullet><bullet>Button clicks,</bullet><bullet>Input form changes (without the values being entered),</bullet><bullet>Errors.</bullet></list><p>Our service providers analyses this information and provides us with aggregate reports. The information and analysis provided by our service providers will be used to assist us in better understanding our visitors interests in our Site and how to better serve those interests. If you want to avoid using cookies altogether, you can disable cookies in your browser. However, disabling cookies might make it impossible for you to use certain features of the Site. Your use of the Site with a browser that is configured to accept cookies constitutes an acceptance of our and third-party cookies.</p>"}},W={deleteDriveSuccess:"Drive successfully deleted",deleteFolderSuccess:"Folder deleted",fileDeleteSuccess:"File deleted",addDriveSuccess:"New drive successfully added",driveSyncSuccess:"Drive synced successfully",driveSyncError:"Error synchronizing drive {{drive}}",driveSyncConflict:"Conflict error detected in {{drive}}",reloadApp:"It seems like you're running an outdated version of the app. Please reload Connect to get the latest version."},Y={cookiePolicy:"Cookie Policy",termsOfUse:"Terms of Use",disclaimer:"Disclaimer",builtWith:"Built with <icon /> Powerhouse"},L={message:"This website uses cookies for analytic purposes only. Cookies are anonymous and do not link to user data. We collect information to improve the user experience and validate UI changes. You can still use the page without cookies. For more information, please read our <a>cookies policy.</a>",accept:"Accept configured cookies",reject:"Reject all cookies",cookies:{functional:"Functional cookies",analytics:"Analytics cookies"}},U={common:j,searchbar:P,folderView:F,files:O,modals:R,notifications:W,footer:Y,cookieBanner:L},z={en:{code:"en",name:"English",translation:U}};l.use(x).init({resources:z,fallbackLng:"en",debug:!1,interpolation:{escapeValue:!1}}).catch(e=>{console.error(e)});const K=(e,i)=>e.some(t=>t.id===i&&t.value),oe=()=>{const{t:e}=w(void 0,{useSuspense:!0,i18n:l}),{showModal:i}=C(),[t,s]=I(),[,r]=b(),u=[{id:"analytics-cookie",label:e("cookieBanner.cookies.analytics"),value:!0}],m=p=>{s(!1),K(p,"analytics-cookie")&&r(h=>({...h,analytics:!0}))},f=()=>{s(!1),r(()=>({analytics:!1,functional:!1,marketing:!1}))};return t?y("div",{className:"absolute inset-0 z-[10000] backdrop-blur-sm",children:[o("div",{className:"absolute inset-0 bg-black opacity-15"}),o("div",{className:"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg",children:o(D,{className:"max-w-[1024px] ",cookies:u,onSubmit:m,onReject:f,submitLabel:e("cookieBanner.accept"),rejectLabel:e("cookieBanner.reject"),children:o("p",{className:"font-semibold text-gray-500",children:o(B,{i18nKey:"cookieBanner.message",components:{a:o("a",{onClick:()=>i("cookiesPolicy",{}),className:"cursor-pointer text-gray-900 hover:underline"},"cookieBanner.message-link")}},"cookieBanner.message")})})})]}):null};export{oe as CookieBanner};
2
+ //# sourceMappingURL=cookie-banner.La7ZM_eP.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"cookie-banner.CqSpDuL2.js","sources":["../../../../node_modules/.pnpm/react-i18next@13.5.0_i18next@23.16.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-i18next/dist/es/initReactI18next.js","../../src/hooks/useCookiebanner.ts","../../src/i18n/index.ts","../../src/components/cookie-banner.tsx"],"sourcesContent":["import { setDefaults } from './defaults.js';\nimport { setI18n } from './i18nInstance.js';\nexport const initReactI18next = {\n type: '3rdParty',\n init(instance) {\n setDefaults(instance.options.react);\n setI18n(instance);\n }\n};","import connectConfig from '#connect-config';\nimport { useSyncExternalStore } from 'react';\n\nconst namespace = connectConfig.routerBasename;\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst listeners = new Set<() => void>();\n\nlet bannerShown = getInitial();\n\nfunction getInitial(): boolean {\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== 'false';\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction getCookieBannerState(): boolean {\n return bannerShown;\n}\n\nfunction setCookieBannerState(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n}\n\nfunction subscribe(fn: () => void) {\n listeners.add(fn);\n return () => listeners.delete(fn);\n}\n\nexport const useCookieBanner = () => {\n const cookieBannerShown = useSyncExternalStore(\n subscribe,\n getCookieBannerState,\n getCookieBannerState,\n );\n return [cookieBannerShown, setCookieBannerState] as const;\n};\n","import i18n, { type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport translationEN from './locales/en.json' with { type: 'json' };\n\nconst resources: Resource = {\n en: {\n code: 'en',\n name: 'English',\n translation: translationEN,\n },\n};\n\ni18n.use(initReactI18next)\n .init({\n resources,\n fallbackLng: 'en',\n debug: false,\n interpolation: {\n escapeValue: false,\n },\n })\n .catch((e: unknown) => {\n console.error(e);\n });\n\nexport default i18n;\n","import {\n type CookieInput,\n CookieBanner as PHCookieBanner,\n} from '@powerhousedao/design-system';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { useAcceptedCookies } from '../hooks/useAcceptedCookies.js';\nimport { useCookieBanner } from '../hooks/useCookiebanner.js';\nimport i18n from '../i18n';\nimport { useModal } from './modal/index.js';\n\nconst isCookieAccepted = (cookies: CookieInput[], id: string) => {\n return cookies.some(cookie => cookie.id === id && cookie.value);\n};\n\nexport const CookieBanner = () => {\n const { t } = useTranslation(undefined, {\n useSuspense: true,\n i18n,\n });\n const { showModal } = useModal();\n const [showBanner, setShowBanner] = useCookieBanner();\n const [, setAcceptedCookies] = useAcceptedCookies();\n\n const cookiesInput: CookieInput[] = [\n {\n id: 'analytics-cookie',\n label: t('cookieBanner.cookies.analytics'),\n value: true,\n },\n ];\n\n const handleAccept = (cookies: CookieInput[]) => {\n setShowBanner(false);\n\n if (isCookieAccepted(cookies, 'analytics-cookie')) {\n setAcceptedCookies(acceptedCookies => ({\n ...acceptedCookies,\n analytics: true,\n }));\n }\n };\n\n const handleReject = () => {\n setShowBanner(false);\n setAcceptedCookies(() => ({\n analytics: false,\n functional: false,\n marketing: false,\n }));\n };\n\n if (!showBanner) {\n return null;\n }\n\n return (\n <div className=\"absolute inset-0 z-[10000] backdrop-blur-sm\">\n <div className=\"absolute inset-0 bg-black opacity-15\" />\n <div className=\"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg\">\n <PHCookieBanner\n className=\"max-w-[1024px] \"\n cookies={cookiesInput}\n onSubmit={handleAccept}\n onReject={handleReject}\n submitLabel={t('cookieBanner.accept')}\n rejectLabel={t('cookieBanner.reject')}\n >\n <p className=\"font-semibold text-gray-500\">\n <Trans\n key={'cookieBanner.message'}\n i18nKey=\"cookieBanner.message\"\n components={{\n a: (\n <a\n onClick={() =>\n showModal('cookiesPolicy', {})\n }\n key={'cookieBanner.message-link'}\n className=\"cursor-pointer text-gray-900 hover:underline\"\n />\n ),\n }}\n />\n </p>\n </PHCookieBanner>\n </div>\n </div>\n );\n};\n"],"names":["initReactI18next","instance","setDefaults","setI18n","namespace","connectConfig","COOKIE_BANNER_KEY_STORAGE","listeners","bannerShown","getInitial","error","getCookieBannerState","setCookieBannerState","state","subscribe","fn","useCookieBanner","useSyncExternalStore","resources","translationEN","i18n","isCookieAccepted","cookies","id","cookie","CookieBanner","t","useTranslation","showModal","useModal","showBanner","setShowBanner","setAcceptedCookies","useAcceptedCookies","cookiesInput","handleAccept","acceptedCookies","handleReject","jsxs","jsx","PHCookieBanner","Trans"],"mappings":"8dAEO,MAAMA,EAAmB,CAC9B,KAAM,WACN,KAAKC,EAAU,CACbC,EAAYD,EAAS,QAAQ,KAAK,EAClCE,EAAQF,CAAQ,CACpB,CACA,ECLMG,EAAYC,EAAc,eAEnBC,EAA4B,GAAGF,CAAS,yBAE/CG,MAAgB,IAEtB,IAAIC,EAAcC,EAAA,EAElB,SAASA,GAAsB,CAC3B,GAAI,CAEA,OADc,aAAa,QAAQH,CAAyB,IAC3C,OAAA,OACZI,EAAO,CACZ,eAAQ,MAAMA,CAAK,EACZ,EAAA,CAEf,CAEA,SAASC,GAAgC,CACrC,OAAOH,CACX,CAEA,SAASI,EAAqBC,EAAgB,CAC1CL,EAAcK,EACd,aAAa,QAAQP,EAA2B,KAAK,UAAUO,CAAK,CAAC,CACzE,CAEA,SAASC,EAAUC,EAAgB,CAC/B,OAAAR,EAAU,IAAIQ,CAAE,EACT,IAAMR,EAAU,OAAOQ,CAAE,CACpC,CAEO,MAAMC,EAAkB,IAMpB,CALmBC,EACtBH,EACAH,EACAA,CAAA,EAEuBC,CAAoB,47LCpC7CM,EAAsB,CACxB,GAAI,CACA,KAAM,KACN,KAAM,UACN,YAAaC,CAAA,CAErB,EAEAC,EAAK,IAAIpB,CAAgB,EACpB,KAAK,CACF,UAAAkB,EACA,YAAa,KACb,MAAO,GACP,cAAe,CACX,YAAa,EAAA,CAErB,CAAC,EACA,MAA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ignoreList":[0]}
1
+ {"version":3,"file":"cookie-banner.La7ZM_eP.js","sources":["../../../../node_modules/.pnpm/react-i18next@13.5.0_i18next@23.16.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/react-i18next/dist/es/initReactI18next.js","../../src/hooks/useCookiebanner.ts","../../src/i18n/index.ts","../../src/components/cookie-banner.tsx"],"sourcesContent":["import { setDefaults } from './defaults.js';\nimport { setI18n } from './i18nInstance.js';\nexport const initReactI18next = {\n type: '3rdParty',\n init(instance) {\n setDefaults(instance.options.react);\n setI18n(instance);\n }\n};","import connectConfig from '#connect-config';\nimport { useSyncExternalStore } from 'react';\n\nconst namespace = connectConfig.routerBasename;\n\nexport const COOKIE_BANNER_KEY_STORAGE = `${namespace}:display-cookie-banner`;\n\nconst listeners = new Set<() => void>();\n\nlet bannerShown = getInitial();\n\nfunction getInitial(): boolean {\n try {\n const value = localStorage.getItem(COOKIE_BANNER_KEY_STORAGE);\n return value !== 'false';\n } catch (error) {\n console.error(error);\n return true;\n }\n}\n\nfunction getCookieBannerState(): boolean {\n return bannerShown;\n}\n\nfunction setCookieBannerState(state: boolean) {\n bannerShown = state;\n localStorage.setItem(COOKIE_BANNER_KEY_STORAGE, JSON.stringify(state));\n}\n\nfunction subscribe(fn: () => void) {\n listeners.add(fn);\n return () => listeners.delete(fn);\n}\n\nexport const useCookieBanner = () => {\n const cookieBannerShown = useSyncExternalStore(\n subscribe,\n getCookieBannerState,\n getCookieBannerState,\n );\n return [cookieBannerShown, setCookieBannerState] as const;\n};\n","import i18n, { type Resource } from 'i18next';\nimport { initReactI18next } from 'react-i18next';\n\nimport translationEN from './locales/en.json' with { type: 'json' };\n\nconst resources: Resource = {\n en: {\n code: 'en',\n name: 'English',\n translation: translationEN,\n },\n};\n\ni18n.use(initReactI18next)\n .init({\n resources,\n fallbackLng: 'en',\n debug: false,\n interpolation: {\n escapeValue: false,\n },\n })\n .catch((e: unknown) => {\n console.error(e);\n });\n\nexport default i18n;\n","import {\n type CookieInput,\n CookieBanner as PHCookieBanner,\n} from '@powerhousedao/design-system';\nimport { Trans, useTranslation } from 'react-i18next';\nimport { useAcceptedCookies } from '../hooks/useAcceptedCookies.js';\nimport { useCookieBanner } from '../hooks/useCookiebanner.js';\nimport i18n from '../i18n';\nimport { useModal } from './modal/index.js';\n\nconst isCookieAccepted = (cookies: CookieInput[], id: string) => {\n return cookies.some(cookie => cookie.id === id && cookie.value);\n};\n\nexport const CookieBanner = () => {\n const { t } = useTranslation(undefined, {\n useSuspense: true,\n i18n,\n });\n const { showModal } = useModal();\n const [showBanner, setShowBanner] = useCookieBanner();\n const [, setAcceptedCookies] = useAcceptedCookies();\n\n const cookiesInput: CookieInput[] = [\n {\n id: 'analytics-cookie',\n label: t('cookieBanner.cookies.analytics'),\n value: true,\n },\n ];\n\n const handleAccept = (cookies: CookieInput[]) => {\n setShowBanner(false);\n\n if (isCookieAccepted(cookies, 'analytics-cookie')) {\n setAcceptedCookies(acceptedCookies => ({\n ...acceptedCookies,\n analytics: true,\n }));\n }\n };\n\n const handleReject = () => {\n setShowBanner(false);\n setAcceptedCookies(() => ({\n analytics: false,\n functional: false,\n marketing: false,\n }));\n };\n\n if (!showBanner) {\n return null;\n }\n\n return (\n <div className=\"absolute inset-0 z-[10000] backdrop-blur-sm\">\n <div className=\"absolute inset-0 bg-black opacity-15\" />\n <div className=\"absolute inset-x-0 bottom-0 flex justify-center bg-white px-10 pb-16 pt-10 shadow-lg\">\n <PHCookieBanner\n className=\"max-w-[1024px] \"\n cookies={cookiesInput}\n onSubmit={handleAccept}\n onReject={handleReject}\n submitLabel={t('cookieBanner.accept')}\n rejectLabel={t('cookieBanner.reject')}\n >\n <p className=\"font-semibold text-gray-500\">\n <Trans\n key={'cookieBanner.message'}\n i18nKey=\"cookieBanner.message\"\n components={{\n a: (\n <a\n onClick={() =>\n showModal('cookiesPolicy', {})\n }\n key={'cookieBanner.message-link'}\n className=\"cursor-pointer text-gray-900 hover:underline\"\n />\n ),\n }}\n />\n </p>\n </PHCookieBanner>\n </div>\n </div>\n );\n};\n"],"names":["initReactI18next","instance","setDefaults","setI18n","namespace","connectConfig","COOKIE_BANNER_KEY_STORAGE","listeners","bannerShown","getInitial","error","getCookieBannerState","setCookieBannerState","state","subscribe","fn","useCookieBanner","useSyncExternalStore","resources","translationEN","i18n","isCookieAccepted","cookies","id","cookie","CookieBanner","t","useTranslation","showModal","useModal","showBanner","setShowBanner","setAcceptedCookies","useAcceptedCookies","cookiesInput","handleAccept","acceptedCookies","handleReject","jsxs","jsx","PHCookieBanner","Trans"],"mappings":"8dAEO,MAAMA,EAAmB,CAC9B,KAAM,WACN,KAAKC,EAAU,CACbC,EAAYD,EAAS,QAAQ,KAAK,EAClCE,EAAQF,CAAQ,CACpB,CACA,ECLMG,EAAYC,EAAc,eAEnBC,EAA4B,GAAGF,CAAS,yBAE/CG,MAAgB,IAEtB,IAAIC,EAAcC,EAAA,EAElB,SAASA,GAAsB,CAC3B,GAAI,CAEA,OADc,aAAa,QAAQH,CAAyB,IAC3C,OAAA,OACZI,EAAO,CACZ,eAAQ,MAAMA,CAAK,EACZ,EAAA,CAEf,CAEA,SAASC,GAAgC,CACrC,OAAOH,CACX,CAEA,SAASI,EAAqBC,EAAgB,CAC1CL,EAAcK,EACd,aAAa,QAAQP,EAA2B,KAAK,UAAUO,CAAK,CAAC,CACzE,CAEA,SAASC,EAAUC,EAAgB,CAC/B,OAAAR,EAAU,IAAIQ,CAAE,EACT,IAAMR,EAAU,OAAOQ,CAAE,CACpC,CAEO,MAAMC,EAAkB,IAMpB,CALmBC,EACtBH,EACAH,EACAA,CAAA,EAEuBC,CAAoB,47LCpC7CM,EAAsB,CACxB,GAAI,CACA,KAAM,KACN,KAAM,UACN,YAAaC,CAAA,CAErB,EAEAC,EAAK,IAAIpB,CAAgB,EACpB,KAAK,CACF,UAAAkB,EACA,YAAa,KACb,MAAO,GACP,cAAe,CACX,YAAa,EAAA,CAErB,CAAC,EACA,MAAO,GAAe,CACnB,QA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-1,2 +1,2 @@
1
- var y=Object.defineProperty;var m=(r,t,e)=>t in r?y(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var g=(r,t,e)=>m(r,typeof t!="symbol"?t+"":t,e);import{A as d,D as $}from"./useInitSentry.DX0S8ltZ.js";import{c as S,q as v}from"./index.C0tp--nk.js";import"react/jsx-runtime";import"./index.CW6hXWch.js";import"react";import"react-dom";import"./useAcceptedCookies.BEC0OUzL.js";import"./registerServiceWorker.3WXSlUUt.js";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";function w(r,t){const e=[],i=p(r,t,"state.global","global");e.push(...i);const o=e.filter(l=>l.type==="add").length,a=e.filter(l=>l.type==="remove").length,s={global:e.filter(l=>l.scope==="global")};return{totalChanges:e.length,additions:o,removals:a,changesByScope:s,changes:e}}function p(r,t,e,i){const o=[];if(Array.isArray(r)&&Array.isArray(t)){let n=0;for(;n<r.length;n++){const c=r[n];if(!t[n])o.push(...p(c,typeof c=="string"?"":null,`${e}[${n}]`,i));else{const f=p(c,t[n],`${e}[${n}]`,i);o.push(...f)}}for(;n<t.length;n++){const c=t[n];if(!r[n])o.push(...p(typeof c=="string"?"":null,c,`${e}[${n}]`,i));else{const f=p(r[n],c,`${e}[${n}]`,i);o.push(...f)}}return o}if(typeof r!="object"||typeof t!="object"||r===null||t===null){if(r!==t){if(typeof r=="string"&&typeof t=="string")return A(r,t,e,i);o.push({type:"remove",path:e,oldValue:r,scope:i}),o.push({type:"add",path:e,newValue:t,scope:i})}return o}const a=r,s=t,l=Object.keys(a),u=Object.keys(s);for(const n of l)n in s||o.push({type:"remove",path:`${e}.${n}`,oldValue:a[n],scope:i});for(const n of u)if(!(n in a))o.push({type:"add",path:`${e}.${n}`,newValue:s[n],scope:i});else if(a[n]!==s[n]){const c=p(a[n],s[n],`${e}.${n}`,i);o.push(...c)}return o}function A(r,t,e,i){const o=[],a=Math.max(r.length,t.length);for(let s=0;s<a;s++)s>=r.length?o.push({type:"add",path:`${e}[${s}]`,newValue:t[s],scope:i}):s>=t.length?o.push({type:"remove",path:`${e}[${s}]`,oldValue:r[s],scope:i}):r[s]!==t[s]&&(o.push({type:"remove",path:`${e}[${s}]`,oldValue:r[s],scope:i}),o.push({type:"add",path:`${e}[${s}]`,newValue:t[s],scope:i}));return o}class V{constructor(t,e=S(["processor","diff-analytics"])){g(this,"analyticsStore");g(this,"logger");this.analyticsStore=t,this.logger=e}async onStrands(t){if(t.length!==0)for(const e of t){if(e.operations.length===0)continue;const i=e.operations[0],o=d.fromString(`ph/diff/${e.driveId}/${e.documentId}/${e.branch}/${e.scope}`);i.index===0&&await this.clearSource(o);const a=50;for(let s=0;s<e.operations.length;s+=a){const l=e.operations.slice(s,s+a),u=[];for(const n of l){const f=(await v(async()=>w(n.previousState,n.state))).changes.map(h=>this.generateInput(e.driveId,e.documentId,e.branch,e.scope,n.index,h.type,1,o,n.timestamp,h.path));for(u.push(...f);u.length>=a;){const h=u.splice(0,a);await this.analyticsStore.addSeriesValues(h)}}u.length>0&&await this.analyticsStore.addSeriesValues(u)}}}async onDisconnect(){}async clearSource(t){try{await this.analyticsStore.clearSeriesBySource(t,!0)}catch(e){this.logger.error("Failed to clear source",e)}}generateInput(t,e,i,o,a,s,l,u,n,c){const f={},h=c.split("[")[0].replaceAll(".","/");return f.changes=d.fromString(`ph/diff/changes/${s}`),f.document=d.fromString(`ph/diff/document/${e}/${i}/${o}/${a}`),f.path=d.fromString(`ph/diff/path/${h}`),f.drive=d.fromString(`ph/diff/drive/${t}/${e}`),{dimensions:f,metric:"Count",start:$.fromISO(n),source:u,value:l}}}const T=r=>t=>[{processor:new V(r.analyticsStore),filter:{branch:["main"],documentId:["*"],scope:["*"],documentType:["*"]}}];export{T as processorFactory};
2
- //# sourceMappingURL=index.TIUvoczv.js.map
1
+ var y=Object.defineProperty;var m=(r,t,e)=>t in r?y(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var g=(r,t,e)=>m(r,typeof t!="symbol"?t+"":t,e);import{A as d,D as $}from"./useInitSentry.BBnCtPcq.js";import{c as S,q as v}from"./index.Ckf1F9xL.js";import"react/jsx-runtime";import"./index.CW6hXWch.js";import"react";import"react-dom";import"./useAcceptedCookies.B8uxCrAk.js";import"./registerServiceWorker.C9TfA3P-.js";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";function w(r,t){const e=[],i=p(r,t,"state.global","global");e.push(...i);const o=e.filter(l=>l.type==="add").length,a=e.filter(l=>l.type==="remove").length,s={global:e.filter(l=>l.scope==="global")};return{totalChanges:e.length,additions:o,removals:a,changesByScope:s,changes:e}}function p(r,t,e,i){const o=[];if(Array.isArray(r)&&Array.isArray(t)){let n=0;for(;n<r.length;n++){const c=r[n];if(!t[n])o.push(...p(c,typeof c=="string"?"":null,`${e}[${n}]`,i));else{const f=p(c,t[n],`${e}[${n}]`,i);o.push(...f)}}for(;n<t.length;n++){const c=t[n];if(!r[n])o.push(...p(typeof c=="string"?"":null,c,`${e}[${n}]`,i));else{const f=p(r[n],c,`${e}[${n}]`,i);o.push(...f)}}return o}if(typeof r!="object"||typeof t!="object"||r===null||t===null){if(r!==t){if(typeof r=="string"&&typeof t=="string")return A(r,t,e,i);o.push({type:"remove",path:e,oldValue:r,scope:i}),o.push({type:"add",path:e,newValue:t,scope:i})}return o}const a=r,s=t,l=Object.keys(a),u=Object.keys(s);for(const n of l)n in s||o.push({type:"remove",path:`${e}.${n}`,oldValue:a[n],scope:i});for(const n of u)if(!(n in a))o.push({type:"add",path:`${e}.${n}`,newValue:s[n],scope:i});else if(a[n]!==s[n]){const c=p(a[n],s[n],`${e}.${n}`,i);o.push(...c)}return o}function A(r,t,e,i){const o=[],a=Math.max(r.length,t.length);for(let s=0;s<a;s++)s>=r.length?o.push({type:"add",path:`${e}[${s}]`,newValue:t[s],scope:i}):s>=t.length?o.push({type:"remove",path:`${e}[${s}]`,oldValue:r[s],scope:i}):r[s]!==t[s]&&(o.push({type:"remove",path:`${e}[${s}]`,oldValue:r[s],scope:i}),o.push({type:"add",path:`${e}[${s}]`,newValue:t[s],scope:i}));return o}class V{constructor(t,e=S(["processor","diff-analytics"])){g(this,"analyticsStore");g(this,"logger");this.analyticsStore=t,this.logger=e}async onStrands(t){if(t.length!==0)for(const e of t){if(e.operations.length===0)continue;const i=e.operations[0],o=d.fromString(`ph/diff/${e.driveId}/${e.documentId}/${e.branch}/${e.scope}`);i.index===0&&await this.clearSource(o);const a=50;for(let s=0;s<e.operations.length;s+=a){const l=e.operations.slice(s,s+a),u=[];for(const n of l){const f=(await v(async()=>w(n.previousState,n.state))).changes.map(h=>this.generateInput(e.driveId,e.documentId,e.branch,e.scope,n.index,h.type,1,o,n.timestamp,h.path));for(u.push(...f);u.length>=a;){const h=u.splice(0,a);await this.analyticsStore.addSeriesValues(h)}}u.length>0&&await this.analyticsStore.addSeriesValues(u)}}}async onDisconnect(){}async clearSource(t){try{await this.analyticsStore.clearSeriesBySource(t,!0)}catch(e){this.logger.error("Failed to clear source",e)}}generateInput(t,e,i,o,a,s,l,u,n,c){const f={},h=c.split("[")[0].replaceAll(".","/");return f.changes=d.fromString(`ph/diff/changes/${s}`),f.document=d.fromString(`ph/diff/document/${e}/${i}/${o}/${a}`),f.path=d.fromString(`ph/diff/path/${h}`),f.drive=d.fromString(`ph/diff/drive/${t}/${e}`),{dimensions:f,metric:"Count",start:$.fromISO(n),source:u,value:l}}}const T=r=>t=>[{processor:new V(r.analyticsStore),filter:{branch:["main"],documentId:["*"],scope:["*"],documentType:["*"]}}];export{T as processorFactory};
2
+ //# sourceMappingURL=index.3hOoElSf.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.TIUvoczv.js","sources":["../../../../node_modules/.pnpm/@powerhousedao+diff-analyzer@0.0.0-dev.10_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@powerhousedao/diff-analyzer/dist/lib/document-diff.js","../../../../node_modules/.pnpm/@powerhousedao+diff-analyzer@0.0.0-dev.10_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@powerhousedao/diff-analyzer/dist/processors/diff-analytics/index.js","../../../../node_modules/.pnpm/@powerhousedao+diff-analyzer@0.0.0-dev.10_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@powerhousedao/diff-analyzer/dist/processors/index.js"],"sourcesContent":["/**\n * Calculates the difference between two document states\n */\nexport function diffDocumentStates(doc1, doc2) {\n const changes = [];\n // Compare global state\n const globalChanges = diffStateObjects(doc1, doc2, \"state.global\", \"global\");\n changes.push(...globalChanges);\n // Count changes by type\n const additions = changes.filter((c) => c.type === \"add\").length;\n const removals = changes.filter((c) => c.type === \"remove\").length;\n // Group changes by scope\n const changesByScope = {\n global: changes.filter((c) => c.scope === \"global\"),\n };\n return {\n totalChanges: changes.length,\n additions,\n removals,\n changesByScope,\n changes,\n };\n}\n/**\n * Recursively compares two state objects and returns a list of changes\n */\nfunction diffStateObjects(obj1, obj2, path, scope) {\n const changes = [];\n // Handle arrays\n if (Array.isArray(obj1) && Array.isArray(obj2)) {\n let index = 0;\n for (; index < obj1.length; index++) {\n const element = obj1[index];\n if (!obj2[index]) {\n changes.push(...diffStateObjects(element, typeof element === \"string\" ? \"\" : null, `${path}[${index}]`, scope));\n }\n else {\n const elementChanges = diffStateObjects(element, obj2[index], `${path}[${index}]`, scope);\n changes.push(...elementChanges);\n }\n }\n for (; index < obj2.length; index++) {\n const element = obj2[index];\n if (!obj1[index]) {\n changes.push(...diffStateObjects(typeof element === \"string\" ? \"\" : null, element, `${path}[${index}]`, scope));\n }\n else {\n const elementChanges = diffStateObjects(obj1[index], element, `${path}[${index}]`, scope);\n changes.push(...elementChanges);\n }\n }\n return changes;\n }\n // Handle primitive values\n if (typeof obj1 !== \"object\" ||\n typeof obj2 !== \"object\" ||\n obj1 === null ||\n obj2 === null) {\n if (obj1 !== obj2) {\n // Special handling for strings to diff character by character\n if (typeof obj1 === \"string\" && typeof obj2 === \"string\") {\n return diffStateStrings(obj1, obj2, path, scope);\n }\n else {\n // For non-string primitives, treat a change as a remove + add\n changes.push({\n type: \"remove\",\n path,\n oldValue: obj1,\n scope,\n });\n changes.push({\n type: \"add\",\n path,\n newValue: obj2,\n scope,\n });\n }\n }\n return changes;\n }\n // Handle objects\n const obj1Record = obj1;\n const obj2Record = obj2;\n const obj1Keys = Object.keys(obj1Record);\n const obj2Keys = Object.keys(obj2Record);\n // First, check for removed keys\n for (const key of obj1Keys) {\n if (!(key in obj2Record)) {\n // Key was removed\n changes.push({\n type: \"remove\",\n path: `${path}.${key}`,\n oldValue: obj1Record[key],\n scope,\n });\n }\n }\n // Then, check for added keys and modified values\n for (const key of obj2Keys) {\n if (!(key in obj1Record)) {\n // Key was added\n changes.push({\n type: \"add\",\n path: `${path}.${key}`,\n newValue: obj2Record[key],\n scope,\n });\n }\n else if (obj1Record[key] !== obj2Record[key]) {\n // For object changes, recursively diff the objects\n const nestedChanges = diffStateObjects(obj1Record[key], obj2Record[key], `${path}.${key}`, scope);\n changes.push(...nestedChanges);\n }\n }\n return changes;\n}\n/**\n * Compares two strings character by character and returns a list of changes\n */\nfunction diffStateStrings(str1, str2, path, scope) {\n const changes = [];\n const maxLen = Math.max(str1.length, str2.length);\n for (let i = 0; i < maxLen; i++) {\n if (i >= str1.length) {\n // Addition of new character\n changes.push({\n type: \"add\",\n path: `${path}[${i}]`,\n newValue: str2[i],\n scope,\n });\n }\n else if (i >= str2.length) {\n // Removal of character\n changes.push({\n type: \"remove\",\n path: `${path}[${i}]`,\n oldValue: str1[i],\n scope,\n });\n }\n else if (str1[i] !== str2[i]) {\n // Character changed\n changes.push({\n type: \"remove\",\n path: `${path}[${i}]`,\n oldValue: str1[i],\n scope,\n });\n changes.push({\n type: \"add\",\n path: `${path}[${i}]`,\n newValue: str2[i],\n scope,\n });\n }\n }\n return changes;\n}\n/**\n * Generates analytics data from a state diff summary\n */\nexport function generateStateAnalyticsData(diff) {\n return {\n totalChanges: diff.totalChanges,\n changesByType: {\n add: diff.additions,\n remove: diff.removals,\n },\n changesByScope: {\n global: diff.changesByScope.global.length,\n },\n changePaths: diff.changes.map((c) => c.path),\n };\n}\n","import { AnalyticsPath, } from \"@powerhousedao/analytics-engine-core\";\nimport { DateTime } from \"luxon\";\nimport { diffDocumentStates } from \"../../lib/document-diff.js\";\nimport { childLogger } from \"document-drive\";\nimport { runAsapAsync } from \"document-drive/utils/misc\";\nexport class DiffAnalyticsProcessor {\n analyticsStore;\n logger;\n constructor(analyticsStore, logger = childLogger([\"processor\", \"diff-analytics\"])) {\n this.analyticsStore = analyticsStore;\n this.logger = logger;\n //\n }\n async onStrands(strands) {\n if (strands.length === 0) {\n return;\n }\n for (const strand of strands) {\n if (strand.operations.length === 0) {\n continue;\n }\n const firstOp = strand.operations[0];\n const source = AnalyticsPath.fromString(`ph/diff/${strand.driveId}/${strand.documentId}/${strand.branch}/${strand.scope}`);\n if (firstOp.index === 0) {\n await this.clearSource(source);\n }\n const CHUNK_SIZE = 50;\n for (let i = 0; i < strand.operations.length; i += CHUNK_SIZE) {\n const chunk = strand.operations.slice(i, i + CHUNK_SIZE);\n const buffer = [];\n for (const operation of chunk) {\n const diff = await runAsapAsync(async () => diffDocumentStates(operation.previousState, operation.state));\n const inputs = diff.changes.map((change) => this.generateInput(strand.driveId, strand.documentId, strand.branch, strand.scope, operation.index, change.type, 1, source, operation.timestamp, change.path));\n buffer.push(...inputs);\n while (buffer.length >= CHUNK_SIZE) {\n const batch = buffer.splice(0, CHUNK_SIZE);\n await this.analyticsStore.addSeriesValues(batch);\n }\n }\n // Flush any remaining inputs\n if (buffer.length > 0) {\n await this.analyticsStore.addSeriesValues(buffer);\n }\n }\n }\n }\n async onDisconnect() { }\n async clearSource(source) {\n try {\n await this.analyticsStore.clearSeriesBySource(source, true);\n }\n catch (e) {\n this.logger.error(\"Failed to clear source\", e);\n }\n }\n generateInput(driveId, documentId, branch, scope, revision, type, value, source, timestamp, path) {\n const dimensions = {};\n const changePath = path.split(\"[\")[0].replaceAll(\".\", \"/\");\n dimensions.changes = AnalyticsPath.fromString(`ph/diff/changes/${type}`);\n dimensions.document = AnalyticsPath.fromString(`ph/diff/document/${documentId}/${branch}/${scope}/${revision}`);\n dimensions.path = AnalyticsPath.fromString(`ph/diff/path/${changePath}`);\n dimensions.drive = AnalyticsPath.fromString(`ph/diff/drive/${driveId}/${documentId}`);\n return {\n dimensions,\n metric: \"Count\",\n start: DateTime.fromISO(timestamp),\n source,\n value,\n };\n }\n}\n","/**\n * This is a scaffold file meant for customization.\n * Delete the file and run the code generator again to have it reset\n */\nimport { DiffAnalyticsProcessor } from \"./diff-analytics/index.js\";\nexport const processorFactory = (module) => (driveId) => {\n return [\n {\n processor: new DiffAnalyticsProcessor(module.analyticsStore),\n filter: {\n branch: [\"main\"],\n documentId: [\"*\"],\n scope: [\"*\"],\n documentType: [\"*\"],\n },\n },\n ];\n};\n"],"names":["diffDocumentStates","doc1","doc2","changes","globalChanges","diffStateObjects","additions","c","removals","changesByScope","obj1","obj2","path","scope","index","element","elementChanges","diffStateStrings","obj1Record","obj2Record","obj1Keys","obj2Keys","key","nestedChanges","str1","str2","maxLen","i","DiffAnalyticsProcessor","analyticsStore","logger","childLogger","__publicField","strands","strand","firstOp","source","AnalyticsPath","CHUNK_SIZE","chunk","buffer","operation","inputs","runAsapAsync","change","batch","driveId","documentId","branch","revision","type","value","timestamp","dimensions","changePath","DateTime","processorFactory","module"],"mappings":"sgBAGO,SAASA,EAAmBC,EAAMC,EAAM,CAC3C,MAAMC,EAAU,CAAA,EAEVC,EAAgBC,EAAiBJ,EAAMC,EAAM,eAAgB,QAAQ,EAC3EC,EAAQ,KAAK,GAAGC,CAAa,EAE7B,MAAME,EAAYH,EAAQ,OAAQI,GAAMA,EAAE,OAAS,KAAK,EAAE,OACpDC,EAAWL,EAAQ,OAAQI,GAAMA,EAAE,OAAS,QAAQ,EAAE,OAEtDE,EAAiB,CACnB,OAAQN,EAAQ,OAAQI,GAAMA,EAAE,QAAU,QAAQ,CAC1D,EACI,MA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ElSf.js","sources":["../../../../node_modules/.pnpm/@powerhousedao+diff-analyzer@0.0.0-dev.10_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@powerhousedao/diff-analyzer/dist/lib/document-diff.js","../../../../node_modules/.pnpm/@powerhousedao+diff-analyzer@0.0.0-dev.10_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@powerhousedao/diff-analyzer/dist/processors/diff-analytics/index.js","../../../../node_modules/.pnpm/@powerhousedao+diff-analyzer@0.0.0-dev.10_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@powerhousedao/diff-analyzer/dist/processors/index.js"],"sourcesContent":["/**\n * Calculates the difference between two document states\n */\nexport function diffDocumentStates(doc1, doc2) {\n const changes = [];\n // Compare global state\n const globalChanges = diffStateObjects(doc1, doc2, \"state.global\", \"global\");\n changes.push(...globalChanges);\n // Count changes by type\n const additions = changes.filter((c) => c.type === \"add\").length;\n const removals = changes.filter((c) => c.type === \"remove\").length;\n // Group changes by scope\n const changesByScope = {\n global: changes.filter((c) => c.scope === \"global\"),\n };\n return {\n totalChanges: changes.length,\n additions,\n removals,\n changesByScope,\n changes,\n };\n}\n/**\n * Recursively compares two state objects and returns a list of changes\n */\nfunction diffStateObjects(obj1, obj2, path, scope) {\n const changes = [];\n // Handle arrays\n if (Array.isArray(obj1) && Array.isArray(obj2)) {\n let index = 0;\n for (; index < obj1.length; index++) {\n const element = obj1[index];\n if (!obj2[index]) {\n changes.push(...diffStateObjects(element, typeof element === \"string\" ? \"\" : null, `${path}[${index}]`, scope));\n }\n else {\n const elementChanges = diffStateObjects(element, obj2[index], `${path}[${index}]`, scope);\n changes.push(...elementChanges);\n }\n }\n for (; index < obj2.length; index++) {\n const element = obj2[index];\n if (!obj1[index]) {\n changes.push(...diffStateObjects(typeof element === \"string\" ? \"\" : null, element, `${path}[${index}]`, scope));\n }\n else {\n const elementChanges = diffStateObjects(obj1[index], element, `${path}[${index}]`, scope);\n changes.push(...elementChanges);\n }\n }\n return changes;\n }\n // Handle primitive values\n if (typeof obj1 !== \"object\" ||\n typeof obj2 !== \"object\" ||\n obj1 === null ||\n obj2 === null) {\n if (obj1 !== obj2) {\n // Special handling for strings to diff character by character\n if (typeof obj1 === \"string\" && typeof obj2 === \"string\") {\n return diffStateStrings(obj1, obj2, path, scope);\n }\n else {\n // For non-string primitives, treat a change as a remove + add\n changes.push({\n type: \"remove\",\n path,\n oldValue: obj1,\n scope,\n });\n changes.push({\n type: \"add\",\n path,\n newValue: obj2,\n scope,\n });\n }\n }\n return changes;\n }\n // Handle objects\n const obj1Record = obj1;\n const obj2Record = obj2;\n const obj1Keys = Object.keys(obj1Record);\n const obj2Keys = Object.keys(obj2Record);\n // First, check for removed keys\n for (const key of obj1Keys) {\n if (!(key in obj2Record)) {\n // Key was removed\n changes.push({\n type: \"remove\",\n path: `${path}.${key}`,\n oldValue: obj1Record[key],\n scope,\n });\n }\n }\n // Then, check for added keys and modified values\n for (const key of obj2Keys) {\n if (!(key in obj1Record)) {\n // Key was added\n changes.push({\n type: \"add\",\n path: `${path}.${key}`,\n newValue: obj2Record[key],\n scope,\n });\n }\n else if (obj1Record[key] !== obj2Record[key]) {\n // For object changes, recursively diff the objects\n const nestedChanges = diffStateObjects(obj1Record[key], obj2Record[key], `${path}.${key}`, scope);\n changes.push(...nestedChanges);\n }\n }\n return changes;\n}\n/**\n * Compares two strings character by character and returns a list of changes\n */\nfunction diffStateStrings(str1, str2, path, scope) {\n const changes = [];\n const maxLen = Math.max(str1.length, str2.length);\n for (let i = 0; i < maxLen; i++) {\n if (i >= str1.length) {\n // Addition of new character\n changes.push({\n type: \"add\",\n path: `${path}[${i}]`,\n newValue: str2[i],\n scope,\n });\n }\n else if (i >= str2.length) {\n // Removal of character\n changes.push({\n type: \"remove\",\n path: `${path}[${i}]`,\n oldValue: str1[i],\n scope,\n });\n }\n else if (str1[i] !== str2[i]) {\n // Character changed\n changes.push({\n type: \"remove\",\n path: `${path}[${i}]`,\n oldValue: str1[i],\n scope,\n });\n changes.push({\n type: \"add\",\n path: `${path}[${i}]`,\n newValue: str2[i],\n scope,\n });\n }\n }\n return changes;\n}\n/**\n * Generates analytics data from a state diff summary\n */\nexport function generateStateAnalyticsData(diff) {\n return {\n totalChanges: diff.totalChanges,\n changesByType: {\n add: diff.additions,\n remove: diff.removals,\n },\n changesByScope: {\n global: diff.changesByScope.global.length,\n },\n changePaths: diff.changes.map((c) => c.path),\n };\n}\n","import { AnalyticsPath, } from \"@powerhousedao/analytics-engine-core\";\nimport { DateTime } from \"luxon\";\nimport { diffDocumentStates } from \"../../lib/document-diff.js\";\nimport { childLogger } from \"document-drive\";\nimport { runAsapAsync } from \"document-drive/utils/misc\";\nexport class DiffAnalyticsProcessor {\n analyticsStore;\n logger;\n constructor(analyticsStore, logger = childLogger([\"processor\", \"diff-analytics\"])) {\n this.analyticsStore = analyticsStore;\n this.logger = logger;\n //\n }\n async onStrands(strands) {\n if (strands.length === 0) {\n return;\n }\n for (const strand of strands) {\n if (strand.operations.length === 0) {\n continue;\n }\n const firstOp = strand.operations[0];\n const source = AnalyticsPath.fromString(`ph/diff/${strand.driveId}/${strand.documentId}/${strand.branch}/${strand.scope}`);\n if (firstOp.index === 0) {\n await this.clearSource(source);\n }\n const CHUNK_SIZE = 50;\n for (let i = 0; i < strand.operations.length; i += CHUNK_SIZE) {\n const chunk = strand.operations.slice(i, i + CHUNK_SIZE);\n const buffer = [];\n for (const operation of chunk) {\n const diff = await runAsapAsync(async () => diffDocumentStates(operation.previousState, operation.state));\n const inputs = diff.changes.map((change) => this.generateInput(strand.driveId, strand.documentId, strand.branch, strand.scope, operation.index, change.type, 1, source, operation.timestamp, change.path));\n buffer.push(...inputs);\n while (buffer.length >= CHUNK_SIZE) {\n const batch = buffer.splice(0, CHUNK_SIZE);\n await this.analyticsStore.addSeriesValues(batch);\n }\n }\n // Flush any remaining inputs\n if (buffer.length > 0) {\n await this.analyticsStore.addSeriesValues(buffer);\n }\n }\n }\n }\n async onDisconnect() { }\n async clearSource(source) {\n try {\n await this.analyticsStore.clearSeriesBySource(source, true);\n }\n catch (e) {\n this.logger.error(\"Failed to clear source\", e);\n }\n }\n generateInput(driveId, documentId, branch, scope, revision, type, value, source, timestamp, path) {\n const dimensions = {};\n const changePath = path.split(\"[\")[0].replaceAll(\".\", \"/\");\n dimensions.changes = AnalyticsPath.fromString(`ph/diff/changes/${type}`);\n dimensions.document = AnalyticsPath.fromString(`ph/diff/document/${documentId}/${branch}/${scope}/${revision}`);\n dimensions.path = AnalyticsPath.fromString(`ph/diff/path/${changePath}`);\n dimensions.drive = AnalyticsPath.fromString(`ph/diff/drive/${driveId}/${documentId}`);\n return {\n dimensions,\n metric: \"Count\",\n start: DateTime.fromISO(timestamp),\n source,\n value,\n };\n }\n}\n","/**\n * This is a scaffold file meant for customization.\n * Delete the file and run the code generator again to have it reset\n */\nimport { DiffAnalyticsProcessor } from \"./diff-analytics/index.js\";\nexport const processorFactory = (module) => (driveId) => {\n return [\n {\n processor: new DiffAnalyticsProcessor(module.analyticsStore),\n filter: {\n branch: [\"main\"],\n documentId: [\"*\"],\n scope: [\"*\"],\n documentType: [\"*\"],\n },\n },\n ];\n};\n"],"names":["diffDocumentStates","doc1","doc2","changes","globalChanges","diffStateObjects","additions","c","removals","changesByScope","obj1","obj2","path","scope","index","element","elementChanges","diffStateStrings","obj1Record","obj2Record","obj1Keys","obj2Keys","key","nestedChanges","str1","str2","maxLen","i","DiffAnalyticsProcessor","analyticsStore","logger","childLogger","__publicField","strands","strand","firstOp","source","AnalyticsPath","CHUNK_SIZE","chunk","buffer","operation","inputs","runAsapAsync","change","batch","driveId","documentId","branch","revision","type","value","timestamp","dimensions","changePath","DateTime","processorFactory","module"],"mappings":"sgBAGO,SAASA,EAAmBC,EAAMC,EAAM,CAC3C,MAAMC,EAAU,CAAA,EAEVC,EAAgBC,EAAiBJ,EAAMC,EAAM,eAAgB,QAAQ,EAC3EC,EAAQ,KAAK,GAAGC,CAAa,EAE7B,MAAME,EAAYH,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AuB6B,EAAO,cAAc,EAC3D,OAAQ,CACJ,OAAQ,CAAC,MAAM,EACf,WAAY,CAAC,GAAG,EAChB,MAAO,CAAC,GAAG,EACX,aAAc,CAAC,GAAG,CAClC,CACA,CACA","x_google_ignoreList":[0,1,2]}
@@ -1,4 +1,4 @@
1
- import{jsx as Y,jsxs as Me}from"react/jsx-runtime";import*as Gt from"react";import Pu,{useState as Ms,useEffect as en,createContext as Z_,useContext as Y_,forwardRef as fh,useRef as Nt,useCallback as ve,useImperativeHandle as wb,useId as dh,memo as xb,useMemo as to}from"react";import{ar as z_,a_ as K_,o as Ci,a$ as ii,s as Ie,b0 as X_,b1 as kb,b as Ib,b2 as J_,d as eN,b3 as tN,w as Ln,b4 as Vf,b5 as jc,b6 as Rb,g as nN,b7 as iN,b8 as rN,l as sN,b9 as oN,ba as aN,bb as lN,bc as uN,bd as cN,be as fN,bf as dN,p as hN,bg as pN,bh as mN,bi as Db,bj as Cb,bk as Pb,bl as Ep,bm as gN,bn as vN,bo as yN,bp as bN,bq as ON,br as Ap,bs as SN,q as Gc,bt as TN,bu as EN,bv as AN,bw as _N,bx as NN,by as wN,bz as xN,bA as kN,bB as IN,bC as RN,bD as DN}from"./index.CW6hXWch.js";import{c2 as Mb,c3 as ie,c4 as On,c5 as Su,c6 as En,c7 as bc,c8 as Ht,c9 as tn,ca as Oc,cb as Lr,cc as Ls,cd as CN,ce as z,cf as PN,cg as MN,ch as Lb,ci as $b,cj as LN,ck as Qb,cl as _p,cm as Oi,cn as Np,co as wp,cp as xp,cq as $N,cr as ui,cs as Cn,ct as QN,cu as $r,cv as $s,cw as ot,cx as Qs,cy as hh,cz as Fb,cA as Vb,cB as Bb,cC as Ub,cD as Bf,cE as FN,cF as Mu,cG as VN,cH as ph,cI as mh,cJ as qb,cK as jb,cL as BN,cM as Uf,cN as qf,cO as jf,cP as gs,cQ as UN,cR as Gb,cS as qN,cT as jN,cU as it,cV as GN,cW as HN,cX as WN}from"./index.C0tp--nk.js";import"react-dom";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";const ZN=Object.freeze({major:16,minor:11,patch:0,preReleaseTag:null});function YN(n){return n instanceof Error?n:new zN(n)}class zN extends Error{constructor(e){super("Unexpected error value: "+Mb(e)),this.name="NonErrorThrown",this.thrownValue=e}}function KN(n,e,t){var i;const r=YN(n);return XN(r)?r:new ie(r.message,{nodes:(i=r.nodes)!==null&&i!==void 0?i:e,source:r.source,positions:r.positions,path:t,originalError:r})}function XN(n){return Array.isArray(n.path)}function JN(n){return{Field(e){const t=n.getFieldDef(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=n.getParentType();r!=null||Su(!1),n.reportError(new ie(`The field ${r.name}.${t.name} is deprecated. ${i}`,{nodes:e}))}},Argument(e){const t=n.getArgument(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=n.getDirective();if(r!=null)n.reportError(new ie(`Directive "@${r.name}" argument "${t.name}" is deprecated. ${i}`,{nodes:e}));else{const s=n.getParentType(),o=n.getFieldDef();s!=null&&o!=null||Su(!1),n.reportError(new ie(`Field "${s.name}.${o.name}" argument "${t.name}" is deprecated. ${i}`,{nodes:e}))}}},ObjectField(e){const t=On(n.getParentInputType());if(En(t)){const i=t.getFields()[e.name.value],r=i==null?void 0:i.deprecationReason;r!=null&&n.reportError(new ie(`The input field ${t.name}.${i.name} is deprecated. ${r}`,{nodes:e}))}},EnumValue(e){const t=n.getEnumValue(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=On(n.getInputType());r!=null||Su(!1),n.reportError(new ie(`The enum value "${r.name}.${t.name}" is deprecated. ${i}`,{nodes:e}))}}}}function gh(n){return tw(n,e=>!Lb(e),ew)}function ew(n){return!$b(n)&&!LN(n)}function tw(n,e,t){const i=n.getDirectives().filter(e),r=Object.values(n.getTypeMap()).filter(t);return[nw(n),...i.map(s=>fw(s)),...r.map(s=>rw(s))].filter(Boolean).join(`
1
+ import{jsx as Y,jsxs as Me}from"react/jsx-runtime";import*as Gt from"react";import Pu,{useState as Ms,useEffect as en,createContext as Z_,useContext as Y_,forwardRef as fh,useRef as Nt,useCallback as ve,useImperativeHandle as wb,useId as dh,memo as xb,useMemo as to}from"react";import{ar as z_,a_ as K_,o as Ci,a$ as ii,s as Ie,b0 as X_,b1 as kb,b as Ib,b2 as J_,d as eN,b3 as tN,w as Ln,b4 as Vf,b5 as jc,b6 as Rb,g as nN,b7 as iN,b8 as rN,l as sN,b9 as oN,ba as aN,bb as lN,bc as uN,bd as cN,be as fN,bf as dN,p as hN,bg as pN,bh as mN,bi as Db,bj as Cb,bk as Pb,bl as Ep,bm as gN,bn as vN,bo as yN,bp as bN,bq as ON,br as Ap,bs as SN,q as Gc,bt as TN,bu as EN,bv as AN,bw as _N,bx as NN,by as wN,bz as xN,bA as kN,bB as IN,bC as RN,bD as DN}from"./index.CW6hXWch.js";import{c2 as Mb,c3 as ie,c4 as On,c5 as Su,c6 as En,c7 as bc,c8 as Ht,c9 as tn,ca as Oc,cb as Lr,cc as Ls,cd as CN,ce as z,cf as PN,cg as MN,ch as Lb,ci as $b,cj as LN,ck as Qb,cl as _p,cm as Oi,cn as Np,co as wp,cp as xp,cq as $N,cr as ui,cs as Cn,ct as QN,cu as $r,cv as $s,cw as ot,cx as Qs,cy as hh,cz as Fb,cA as Vb,cB as Bb,cC as Ub,cD as Bf,cE as FN,cF as Mu,cG as VN,cH as ph,cI as mh,cJ as qb,cK as jb,cL as BN,cM as Uf,cN as qf,cO as jf,cP as gs,cQ as UN,cR as Gb,cS as qN,cT as jN,cU as it,cV as GN,cW as HN,cX as WN}from"./index.Ckf1F9xL.js";import"react-dom";import"react-dom/client";import"./browser.BkwNmV2Z.js";import"./app-skeleton.js";const ZN=Object.freeze({major:16,minor:11,patch:0,preReleaseTag:null});function YN(n){return n instanceof Error?n:new zN(n)}class zN extends Error{constructor(e){super("Unexpected error value: "+Mb(e)),this.name="NonErrorThrown",this.thrownValue=e}}function KN(n,e,t){var i;const r=YN(n);return XN(r)?r:new ie(r.message,{nodes:(i=r.nodes)!==null&&i!==void 0?i:e,source:r.source,positions:r.positions,path:t,originalError:r})}function XN(n){return Array.isArray(n.path)}function JN(n){return{Field(e){const t=n.getFieldDef(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=n.getParentType();r!=null||Su(!1),n.reportError(new ie(`The field ${r.name}.${t.name} is deprecated. ${i}`,{nodes:e}))}},Argument(e){const t=n.getArgument(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=n.getDirective();if(r!=null)n.reportError(new ie(`Directive "@${r.name}" argument "${t.name}" is deprecated. ${i}`,{nodes:e}));else{const s=n.getParentType(),o=n.getFieldDef();s!=null&&o!=null||Su(!1),n.reportError(new ie(`Field "${s.name}.${o.name}" argument "${t.name}" is deprecated. ${i}`,{nodes:e}))}}},ObjectField(e){const t=On(n.getParentInputType());if(En(t)){const i=t.getFields()[e.name.value],r=i==null?void 0:i.deprecationReason;r!=null&&n.reportError(new ie(`The input field ${t.name}.${i.name} is deprecated. ${r}`,{nodes:e}))}},EnumValue(e){const t=n.getEnumValue(),i=t==null?void 0:t.deprecationReason;if(t&&i!=null){const r=On(n.getInputType());r!=null||Su(!1),n.reportError(new ie(`The enum value "${r.name}.${t.name}" is deprecated. ${i}`,{nodes:e}))}}}}function gh(n){return tw(n,e=>!Lb(e),ew)}function ew(n){return!$b(n)&&!LN(n)}function tw(n,e,t){const i=n.getDirectives().filter(e),r=Object.values(n.getTypeMap()).filter(t);return[nw(n),...i.map(s=>fw(s)),...r.map(s=>rw(s))].filter(Boolean).join(`
2
2
 
3
3
  `)}function nw(n){if(n.description==null&&iw(n))return;const e=[],t=n.getQueryType();t&&e.push(` query: ${t.name}`);const i=n.getMutationType();i&&e.push(` mutation: ${i.name}`);const r=n.getSubscriptionType();return r&&e.push(` subscription: ${r.name}`),Wt(n)+`schema {
4
4
  ${e.join(`
@@ -111,4 +111,4 @@ In some cases, you need to provide options to alter GraphQL's execution behavior
111
111
  "errors editor"
112
112
  `,gridTemplateRows:"auto 1fr"},children:[Me("div",{className:"flex flex-col gap-2",style:{gridArea:"left"},children:[Y(HS,{operation:e,onAddOperationAndInitialSchema:s,updateOperationName:o,deleteOperation:a,module:t,allOperationNames:i}),Y(MQ,{operation:e,focusOnMount:e.id===r,setOperationDescription:u})]}),Y("div",{className:"relative top-8",style:{gridArea:"editor"},children:Y(ah,{doc:e.schema??"",updateDocumentInModel:h,customLinter:p})}),Me("div",{style:{gridArea:"errors"},children:[Y("h3",{className:"my-2 text-sm font-medium text-gray-700",children:"Reducer Exceptions"}),Y(LQ,{operation:e,addOperationError:f,deleteOperationError:c,setOperationErrorName:d})]})]})}function VQ({module:n,allOperations:e,shouldFocusNewOperation:t,updateOperationName:i,deleteOperation:r,addOperationAndInitialSchema:s,addOperationError:o,deleteOperationError:a,setOperationErrorName:l,updateOperationSchema:u,setOperationDescription:f}){const[c,d]=Ms(null),h=dh(),p=e.map(g=>g.name).filter(g=>g!==null),m=ve(async(g,v)=>{const y=await s(g,v);return y&&d(y),y},[s,d]);return Me("div",{children:[n.operations.map(g=>Y("div",{children:Y(FQ,{operation:g,module:n,lastCreatedOperationId:c,allOperationNames:p,addOperationError:o,deleteOperationError:a,setOperationErrorName:l,onAddOperationAndInitialSchema:m,updateOperationName:i,deleteOperation:r,updateOperationSchema:u,setOperationDescription:f})},g.id)),Y("div",{className:"mt-6 w-1/2 pr-6",children:Y(HS,{onAddOperationAndInitialSchema:m,updateOperationName:i,deleteOperation:r,module:n,allOperationNames:p,focusOnMount:t},h)})]})}function Eb(n){const{module:e,modules:t,allOperations:i,lastCreatedModuleId:r,onAddModule:s,updateModuleName:o,deleteModule:a,updateOperationName:l,deleteOperation:u,addOperationAndInitialSchema:f,updateOperationSchema:c,setOperationDescription:d,addOperationError:h,deleteOperationError:p,setOperationErrorName:m}=n;return Me("div",{className:"relative rounded-3xl bg-gray-100 p-6",children:[Me("div",{className:"mb-2 w-1/2 pr-6",children:[Y(IR,{modules:t,module:e,onAddModule:s,updateModuleName:o}),!!e&&Y("button",{"aria-label":"Delete module",tabIndex:-1,className:"absolute right-1 top-1 p-2 text-gray-800 transition-colors hover:text-gray-500",onClick:()=>{a(e.id)},children:Y("svg",{className:"size-6",viewBox:"0 0 24 24",fill:"currentcolor",children:Y("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M16.9993 8.51506L15.4844 7L11.9994 10.4852L8.51497 7.00057L7 8.51562L10.4844 12.0003L7.00056 15.4843L8.51552 16.9994L11.9994 13.5153L15.4838 17L16.9988 15.4849L13.5144 12.0003L16.9993 8.51506Z"})})})]}),!!e&&Y(VQ,{module:e,allOperations:i,shouldFocusNewOperation:e.id===r,updateOperationName:l,deleteOperation:u,addOperationAndInitialSchema:f,updateOperationSchema:c,setOperationDescription:d,addOperationError:h,deleteOperationError:p,setOperationErrorName:m})]})}function BQ({modules:n,allOperations:e,addModule:t,updateModuleName:i,deleteModule:r,updateOperationName:s,deleteOperation:o,addOperationAndInitialSchema:a,updateOperationSchema:l,setOperationDescription:u,addOperationError:f,deleteOperationError:c,setOperationErrorName:d}){const[h,p]=Ms(null),m=Nt(null),g=ve(async v=>{var O;const y=await t(v);return y&&(p(y),(O=m.current)==null||O.focus()),y},[t,p]);return Me("div",{className:"flex flex-col gap-2",children:[n.map(v=>Y(Eb,{module:v,modules:n,allOperations:e,lastCreatedModuleId:h,onAddModule:g,updateModuleName:i,deleteModule:r,updateOperationName:s,deleteOperation:o,addOperationAndInitialSchema:a,updateOperationSchema:l,setOperationDescription:u,addOperationError:f,deleteOperationError:c,setOperationErrorName:d},v.id)),Y(Eb,{modules:n,allOperations:e,lastCreatedModuleId:h,onAddModule:g,updateModuleName:i,deleteModule:r,updateOperationName:s,deleteOperation:o,addOperationAndInitialSchema:a,updateOperationSchema:l,setOperationDescription:u,addOperationError:f,deleteOperationError:c,setOperationErrorName:d},"add-module"),Y("div",{ref:m,tabIndex:0,className:"size-0 overflow-hidden","aria-hidden":"true"})]})}const lh=fh((n,e)=>{const{className:t,...i}=n;return Y("button",{ref:e,...i,className:Yt("h-10 whitespace-nowrap rounded-md border border-gray-200 bg-gray-50 px-4 py-2 text-sm font-medium text-gray-800 transition-colors hover:bg-gray-100 hover:text-gray-900 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",t)})}),UQ=Yh({String:Q.string,Number:Q.number,"True False":Q.bool,PropertyName:Q.propertyName,Null:Q.null,", :":Q.separator,"[ ]":Q.squareBracket,"{ }":Q.brace}),qQ=ks.deserialize({version:14,states:"$bOVQPOOOOQO'#Cb'#CbOnQPO'#CeOvQPO'#ClOOQO'#Cr'#CrQOQPOOOOQO'#Cg'#CgO}QPO'#CfO!SQPO'#CtOOQO,59P,59PO![QPO,59PO!aQPO'#CuOOQO,59W,59WO!iQPO,59WOVQPO,59QOqQPO'#CmO!nQPO,59`OOQO1G.k1G.kOVQPO'#CnO!vQPO,59aOOQO1G.r1G.rOOQO1G.l1G.lOOQO,59X,59XOOQO-E6k-E6kOOQO,59Y,59YOOQO-E6l-E6l",stateData:"#O~OeOS~OQSORSOSSOTSOWQO_ROgPO~OVXOgUO~O^[O~PVO[^O~O]_OVhX~OVaO~O]bO^iX~O^dO~O]_OVha~O]bO^ia~O",goto:"!kjPPPPPPkPPkqwPPPPk{!RPPP!XP!e!hXSOR^bQWQRf_TVQ_Q`WRg`QcZRicQTOQZRQe^RhbRYQR]R",nodeNames:"⚠ JsonText True False Null Number String } { Object Property PropertyName : , ] [ Array",maxTerm:25,nodeProps:[["isolate",-2,6,11,""],["openedBy",7,"{",14,"["],["closedBy",8,"}",15,"]"]],propSources:[UQ],skippedNodes:[0],repeatNodeCount:2,tokenData:"(|~RaXY!WYZ!W]^!Wpq!Wrs!]|}$u}!O$z!Q!R%T!R![&c![!]&t!}#O&y#P#Q'O#Y#Z'T#b#c'r#h#i(Z#o#p(r#q#r(w~!]Oe~~!`Wpq!]qr!]rs!xs#O!]#O#P!}#P;'S!];'S;=`$o<%lO!]~!}Og~~#QXrs!]!P!Q!]#O#P!]#U#V!]#Y#Z!]#b#c!]#f#g!]#h#i!]#i#j#m~#pR!Q![#y!c!i#y#T#Z#y~#|R!Q![$V!c!i$V#T#Z$V~$YR!Q![$c!c!i$c#T#Z$c~$fR!Q![!]!c!i!]#T#Z!]~$rP;=`<%l!]~$zO]~~$}Q!Q!R%T!R![&c~%YRT~!O!P%c!g!h%w#X#Y%w~%fP!Q![%i~%nRT~!Q![%i!g!h%w#X#Y%w~%zR{|&T}!O&T!Q![&Z~&WP!Q![&Z~&`PT~!Q![&Z~&hST~!O!P%c!Q![&c!g!h%w#X#Y%w~&yO[~~'OO_~~'TO^~~'WP#T#U'Z~'^P#`#a'a~'dP#g#h'g~'jP#X#Y'm~'rOR~~'uP#i#j'x~'{P#`#a(O~(RP#`#a(U~(ZOS~~(^P#f#g(a~(dP#i#j(g~(jP#X#Y(m~(rOQ~~(wOW~~(|OV~",tokenizers:[0],topRules:{JsonText:[0,1]},tokenPrec:0}),jQ=()=>n=>{try{JSON.parse(n.state.doc.toString())}catch(e){if(!(e instanceof SyntaxError))throw e;const t=GQ(e,n.state.doc);return[{from:t,message:e.message,severity:"error",to:t}]}return[]};function GQ(n,e){let t;return(t=n.message.match(/at position (\d+)/))?Math.min(+t[1],e.length):(t=n.message.match(/at line (\d+) column (\d+)/))?Math.min(e.line(+t[1]).from+ +t[2]-1,e.length):0}const S_=Is.define({name:"json",parser:qQ.configure({props:[Xh.add({Object:my({except:/^\s*\}/}),Array:my({except:/^\s*\]/})}),ep.add({"Object Array":GE})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function HQ(){return new UE(S_)}const WQ=xb(function(e){const{doc:t,readonly:i=!1,updateDocumentInModel:r}=e,{editorRef:s,viewRef:o,updateListenerCompartment:a,focusHandlerCompartment:l,pasteHandlerCompartment:u,timeoutRef:f}=h_();return en(()=>{o.current||(o.current=new ne({state:Ee.create({doc:t,extensions:[...v_,wc.of(y_),oA,S_,HQ(),Uh(jQ()),a.current.of(yp(i,f,r)),l.current.of(bp(i,f,r)),u.current.of(Op(i,f,r)),Ee.readOnly.of(i)]}),parent:s.current}),kr(o.current))},[]),p_(o),m_(o.current,i,f,r,{updateListener:a.current,focusHandler:l.current,pasteHandler:u.current}),g_(o.current,t),Y("div",{ref:s})}),ZQ=mN,T_=Gt.forwardRef(({className:n,...e},t)=>Y(Db,{ref:t,className:Yt("flex items-center justify-center rounded-xl bg-slate-50 p-1 shadow-[inset_0px_0px_2px_rgba(255,255,255,0.50)]",n),...e}));T_.displayName=Db.displayName;const uh=Gt.forwardRef(({className:n,...e},t)=>Y(Cb,{ref:t,className:Yt("flex w-full items-center justify-center whitespace-nowrap rounded-lg p-1 text-sm text-gray-500 transition-all disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-gray-50 data-[state=active]:text-gray-800 data-[state=active]:shadow-[0px_16px_16px_-4px_rgba(0,0,0,0.10)]",n),...e}));uh.displayName=Cb.displayName;const ch=Gt.forwardRef(({className:n,...e},t)=>Y(Pb,{ref:t,className:Yt("",n),...e}));ch.displayName=Pb.displayName;function Ab({modelName:n,stateSchema:e,initialValue:t,setStateSchema:i,setInitialState:r,scope:s}){const o=nS(),[a,l]=Ms(!1),u=ve(p=>$Q(p,n,s),[n,s]),f=ve(()=>{l(p=>!p)},[]),c=ve(p=>i(p,s),[i,s]),d=ve(p=>r(p,s),[r,s]),h=ve(()=>{const p=t||"{}",m=nn(o);if(!m)return;const g=nn(e);if(!g)return;const v=iS(n,s);if(!v)return;const y=g.definitions.find(S=>S.kind===z.OBJECT_TYPE_DEFINITION&&S.name.value===v);if(!y||y.kind!==z.OBJECT_TYPE_DEFINITION)return;const O=lk({sharedSchemaDocumentNode:m,stateTypeDefinitionNode:y,existingValue:p});r(O,s)},[o,t,r,s]);return Me("div",{className:"grid grid-cols-2 gap-4",children:[Me("div",{children:[Me("h3",{className:"mb-2 text-lg capitalize",children:[s," state schema"]}),Me(lh,{onClick:f,className:"mb-2 flex w-fit items-center gap-2",children:[a?"Hide":"Show"," standard library",Y("svg",{className:Yt("inline-block transition-transform",a?"rotate-180":"rotate-0"),xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:Y("path",{d:"M11.9883 6.01172C11.4363 6.01172 10.9883 6.45972 10.9883 7.01172V13.0117H6.98828L11.9883 18.0117L16.9883 13.0117H12.9883V7.01172C12.9883 6.45972 12.5403 6.01172 11.9883 6.01172Z",fill:"black"})})]}),a&&Y(ah,{doc:bh,readonly:!0}),Y(ah,{doc:e,updateDocumentInModel:c,customLinter:u})]}),Me("div",{children:[Me("div",{className:"flex flex-col items-end",children:[Me("h3",{className:"mb-2 text-right text-lg capitalize",children:[s," state initial value"]}),Me(lh,{onClick:h,className:"mb-2 flex w-fit items-center gap-2",children:["Sync with schema"," ",Y("svg",{className:"inline-block",xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:Y("path",{d:"M8.00521 1.99219C6.63588 1.99219 5.32788 2.45152 4.27588 3.28419C3.98721 3.51219 3.94321 3.93285 4.17188 4.22151C4.40054 4.51018 4.82055 4.55418 5.10921 4.32552C5.92721 3.67819 6.93921 3.32552 8.00521 3.32552C10.5825 3.32552 12.6719 5.41485 12.6719 7.99218H11.3385L13.3385 10.6588L15.3385 7.99218H14.0052C14.0052 4.67818 11.3192 1.99219 8.00521 1.99219ZM2.67188 5.32552L0.671875 7.99218H2.00521C2.00521 11.3062 4.69121 13.9922 8.00521 13.9922C9.37521 13.9922 10.6825 13.5335 11.7345 12.7002C12.0232 12.4722 12.0672 12.0515 11.8385 11.7628C11.6099 11.4742 11.1899 11.4302 10.9012 11.6588C10.0825 12.3068 9.07188 12.6588 8.00521 12.6588C5.42788 12.6588 3.33854 10.5695 3.33854 7.99218H4.67188L2.67188 5.32552Z",fill:"#343839"})})]})]}),Y(WQ,{doc:t,updateDocumentInModel:d})]})]})}function YQ({modelName:n,globalStateSchema:e,localStateSchema:t,globalStateInitialValue:i,localStateInitialValue:r,setStateSchema:s,setInitialState:o}){const a=ve(()=>{const l=Oh(n,"local");s(l,"local"),o("","local")},[n,s,o]);return Me(ZQ,{className:"pb-8",activationMode:"manual",defaultValue:"global",children:[Y("div",{className:"my-6",children:Me(T_,{className:"mx-auto flex max-w-sm",children:[Y(uh,{value:"global",children:"Global"}),Y(uh,{value:"local",children:"Local"})]})}),Y(ch,{value:"global",tabIndex:-1,children:Y(Ab,{modelName:n,stateSchema:e,initialValue:i,setStateSchema:s,setInitialState:o,scope:"global"})}),Y(ch,{value:"local",tabIndex:-1,children:t?Y(Ab,{modelName:n,stateSchema:t,initialValue:r,setStateSchema:s,setInitialState:o,scope:"local"}):Me("div",{className:"",children:[Y("h3",{className:"mb-2 text-lg capitalize",children:"local state schema"}),Y(lh,{onClick:a,children:"Add local state"})]})})]})}function zQ(n){const{document:e,documentNodeName:t,dispatch:i}=n,{name:r,id:s,extension:o,description:a,author:{name:l,website:u}}=to(()=>e.state.global,[e.state.global]),{state:{global:{schema:f,initialValue:c},local:{schema:d,initialValue:h}},modules:p}=to(()=>e.state.global.specifications[0],[e.state.global.specifications[0]]),m=to(()=>p.flatMap(B=>B.operations),[p]),g=Nt(!r&&!!t&&m.length===0);en(()=>{!g.current||!t||(i(Ep({name:t})),lS({modelName:t,setStateSchema:(B,ee)=>{i(Ap({schema:B,scope:ee}))}}),g.current=!1)},[t]);const v=to(()=>m.flatMap(B=>B.schema??[]).join(`
113
113
  `),[m]),y=ve(B=>{ct(B,s)||i(gN({id:B}))},[s]),O=ve(B=>{ct(B,a)||i(vN({description:B}))},[a]),S=ve(B=>{ct(B,o)||i(yN({extension:B}))},[o]),b=ve(B=>{ct(B,r)||i(Ep({name:B}))},[r]),T=ve(B=>{ct(B,l)||i(bN({authorName:B}))},[l]),w=ve(B=>{ct(B,u??"")||i(ON({authorWebsite:B}))},[u]),C=ve((B,ee)=>{ct(B,ee==="global"?f:d)||i(Ap({schema:B,scope:ee}))},[f,d]),D=ve((B,ee)=>{ct(B,ee==="global"?c:h)||i(SN({initialValue:B,scope:ee}))},[c,h]),k=ve(B=>new Promise(ee=>{try{if(p.some(pe=>ct(pe.name,B))){ee(void 0);return}const re=Gc();i(TN({id:re,name:B})),ee(re)}catch(re){console.error("Failed to add module:",re),ee(void 0)}}),[p]),$=ve((B,ee)=>{p.some(re=>ct(re.name,ee))||i(EN({id:B,name:ee}))},[p]),A=ve(B=>i(AN({id:B})),[]),_=ve((B,ee)=>new Promise(re=>{var pe;try{if((((pe=p.find(Ue=>Ue.id===B))==null?void 0:pe.operations.map(Ue=>Ue.name).filter(Boolean))??[]).some(Ue=>ct(Ue,ee))){re(void 0);return}const Le=Gc();i(_N({id:Le,moduleId:B,name:ee})),re(Le)}catch(xe){console.error("Failed to add operation:",xe),re(void 0)}}),[p]),I=ve((B,ee)=>{const re=p.find(xe=>xe.operations.some(Le=>Le.id===B));((re==null?void 0:re.operations.map(xe=>xe.name).filter(Boolean))??[]).some(xe=>ct(xe,ee))||i(NN({id:B,name:ee}))},[p]),R=ve((B,ee)=>{const re=m.find(pe=>pe.id===B);re!=null&&re.schema&&ct(ee,re.schema)||i(wN({id:B,schema:ee}))},[m]),F=ve((B,ee)=>{var pe;const re=((pe=m.find(xe=>xe.id===B))==null?void 0:pe.description)??"";ct(re,ee)||i(xN({id:B,description:ee}))},[m]),U=ve(B=>i(kN({id:B})),[]),X=ve((B,ee)=>new Promise(re=>{try{const pe=m.find(Ue=>Ue.id===B);if(((pe==null?void 0:pe.errors.map(Ue=>Ue.name).filter(Boolean))??[]).some(Ue=>ct(Ue,ee))){re(void 0);return}const Le=Gc();i(IN({id:Le,operationId:B,errorName:ee})),re(Le)}catch(pe){console.error("Failed to add operation error:",pe),re(void 0)}}),[m]),te=ve(B=>i(RN({id:B})),[]),ue=ve((B,ee,re)=>{const pe=m.find(Le=>Le.id===B);((pe==null?void 0:pe.errors.map(Le=>Le.name).filter(Boolean))??[]).some(Le=>ct(Le,re))||i(DN({id:ee,errorName:re}))},[m]),fe=ve(async(B,ee)=>{try{const re=await _(B,ee);if(!re)return;try{return R(re,ok(ee)),re}catch(pe){console.error("Failed to update operation schema:",pe);return}}catch(re){console.error("Failed to add operation and schema:",re);return}},[_,R]);return Y("main",{className:"min-h-dvh bg-gray-50",children:Y(sk,{globalStateSchemaSdl:f,localStateSchemaSdl:d,operationSchemasSdl:v,children:Me("div",{className:"mx-auto max-w-6xl px-4 pt-8",children:[Y(ER,{name:r,documentType:s,extension:o,description:a,authorName:l,authorWebsite:u??"",globalStateSchema:f,localStateSchema:d,setModelId:y,setModelDescription:O,setModelExtension:S,setModelName:b,setAuthorName:T,setAuthorWebsite:w,setStateSchema:C}),Y(kp,{}),Me("div",{children:[Y(YQ,{modelName:r,globalStateSchema:f,globalStateInitialValue:c,localStateSchema:d,localStateInitialValue:h,setStateSchema:C,setInitialState:D}),Y(kp,{}),Y("h3",{className:"mb-6 text-lg",children:"Global Operations"}),Y(BQ,{modules:p,allOperations:m,addModule:k,updateModuleName:$,deleteModule:A,updateOperationName:I,updateOperationSchema:R,setOperationDescription:F,deleteOperation:U,addOperationError:X,deleteOperationError:te,setOperationErrorName:ue,addOperationAndInitialSchema:fe})]})]})})})}const dF={Component:zQ,documentTypes:["powerhouse/document-model"],config:{id:"document-model-editor-v2",disableExternalControls:!0,documentToolbarEnabled:!0,timelineEnabled:!0}};export{zQ as DocumentModelEditor,dF as documentModelEditorModule};
114
- //# sourceMappingURL=index.Be3reTUB.js.map
114
+ //# sourceMappingURL=index.BYC0NBlt.js.map