useblocks 1.1.85-dev.9 → 1.1.102
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/CHANGELOG.md +91 -0
- package/README.md +74 -41
- package/compat-globals.js +1 -1
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/css/sandbox.css +35 -1
- package/iframe/{iframe.bb6d921f.html → iframe-eblock.1c4e77a0.html} +2 -2
- package/iframe/{iframe-eblock.bb6d921f.html → iframe.1c4e77a0.html} +2 -2
- package/iframe/js/discussHandlers.Xh4-JUcT.js +88 -0
- package/iframe/js/{iframe-eblock.body.js → iframe-eblock.body.1c4e77a0.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/iframe.body.1c4e77a0.js +319 -0
- package/iframe/js/iframe.js +2 -2
- package/package.json +8 -1
- package/runtime/THIRD_PARTY_LICENSES.txt +49 -42
- package/runtime/package.json +4 -1
- package/runtime/react/index.js +1 -1
- package/runtime/uuid/index.js +21 -0
- package/static/core/11b821ed.js +1 -0
- package/static/core/160bf060.js +104 -0
- package/static/core/1b68c0f0.js +1 -0
- package/static/core/1ed86ed3.js +1 -0
- package/static/core/26cc947d.js +1 -0
- package/static/core/{67f78cad.js → 3ec42945.js} +7 -7
- package/static/core/3fb172c7.js +1 -0
- package/static/core/448f03f8.js +1 -0
- package/static/core/44d2c046.js +1 -0
- package/static/core/{79749848.js → 4c8d0155.js} +5 -5
- package/static/core/53103851.js +4 -0
- package/static/core/{a767f327.js → 5d849eef.js} +1 -1
- package/static/core/5e7c221f.js +28 -0
- package/static/core/64be048b.js +27 -0
- package/static/core/{de07cade.js → 6a671446.js} +3 -3
- package/static/core/{db82c42b.js → 756874c6.js} +1 -1
- package/static/core/{4c3f5897.js → 847338a8.js} +2 -2
- package/static/core/91e07171.js +2 -0
- package/static/core/a2e57e5f.js +1 -0
- package/static/core/{a5996860.js → a6303cb2.js} +1 -1
- package/static/core/{9f137764.js → a98b6879.js} +1 -1
- package/static/core/ae22b7f6.js +93 -0
- package/static/core/{44a83e21.js → b653f9c5.js} +1 -1
- package/static/core/{cb46784e.js → b7aa9fec.js} +1 -1
- package/static/core/{d8bbcfbd.js → ca4dad9b.js} +2 -2
- package/static/core/{6faa23a1.js → cc180859.js} +1 -1
- package/static/core/d7666ad0.js +291 -0
- package/static/core/dcc37768.js +1 -0
- package/static/core/edf450a1.js +7 -0
- package/static/core/f1ee2bef.js +1 -0
- package/static/core/{1e3078da.js → f323e60e.js} +1 -1
- package/static/core/{175b5b0f.js → ff7d14e8.js} +1 -1
- package/static/esm/2490dab8.js +1 -0
- package/static/esm/668ee399.js +1 -0
- package/static/esm/971f1b2c.js +1 -0
- package/static/esm/f76c9d9d.js +1 -0
- package/static/umd/6639d610.js +1 -0
- package/static/umd-runtime/B7h7P1Np.js +1 -0
- package/static/umd-runtime/{DHIkHsbq.js → BAqQTgiL.js} +1 -1
- package/static/umd-runtime/{DiNHpyis.js → BB6AXfHj.js} +1 -1
- package/static/umd-runtime/{CnUGCoaH.js → BauvM4c_.js} +1 -1
- package/static/umd-runtime/{cL_ha9ef.js → CgVJ4rE0.js} +1 -1
- package/static/umd-runtime/Cvm7BS4_.js +341 -0
- package/static/umd-runtime/{BnE05QKl.js → D7DggGzi.js} +1 -1
- package/static/umd-runtime/{2iAslXEF.js → DBbch1O-.js} +1 -1
- package/static/umd-runtime/{Bcqtk2f7.js → Dqoi-pC_.js} +2 -2
- package/static/umd-runtime/{CDTBLHGd.js → G2k8ELiO.js} +3 -3
- package/static/umd-runtime/{CVtPwspX.js → SFp4nbvq.js} +1 -1
- package/static/umd-runtime/{DVB_-O4B.js → UsRzAWs2.js} +1 -1
- package/static/umd-runtime/runtime.2paN090q.js +1 -0
- package/static/umd-runtime/{ui-kit-icons.js → ui-kit-icons.DqlZwgBU.js} +1 -1
- package/static/umd-runtime/{ui-kit.js → ui-kit.CoVNet0I.js} +2 -2
- package/static/umd-runtime/{DP3QTW77.js → uk9LyZos.js} +1 -1
- package/ui-kit/icons.js +2 -0
- package/useblocks-core.1c4e77a0.js +859 -0
- package/useblocks-esm.js +11 -10
- package/{useblocks-po.bb6d921f.js → useblocks-po.1c4e77a0.js} +1 -1
- package/useblocks.d.ts +162 -28
- package/useblocks.js +39 -15
- package/vendor/@rc-component/cascader/package.json +1 -1
- package/vendor/@rc-component/dialog/es/Dialog/Content/Panel.js +3 -2
- package/vendor/@rc-component/dialog/package.json +1 -1
- package/vendor/@rc-component/image/es/Preview/index.js +3 -3
- package/vendor/@rc-component/image/package.json +1 -1
- package/vendor/@rc-component/input/es/BaseInput.js +3 -3
- package/vendor/@rc-component/input/es/Input.js +20 -27
- package/vendor/@rc-component/{textarea → input}/es/ResizableTextArea.js +5 -4
- package/vendor/@rc-component/{textarea → input}/es/TextArea.js +30 -40
- package/vendor/@rc-component/{textarea → input}/es/calculateNodeHeight.js +4 -4
- package/vendor/@rc-component/input/es/hooks/useCountDisplay.js +25 -0
- package/vendor/@rc-component/input/es/hooks/useCountExceed.js +25 -0
- package/vendor/@rc-component/input/es/hooks/useMergedValue.js +13 -0
- package/vendor/@rc-component/input/es/index.js +3 -1
- package/vendor/@rc-component/input/package.json +1 -1
- package/vendor/@rc-component/mentions/es/DropdownMenu.js +1 -1
- package/vendor/@rc-component/mentions/es/Mentions.js +35 -8
- package/vendor/@rc-component/mentions/package.json +1 -1
- package/vendor/@rc-component/menu/es/Menu.js +1 -0
- package/vendor/@rc-component/menu/es/MenuItem.js +1 -0
- package/vendor/@rc-component/menu/es/MenuItemGroup.js +1 -0
- package/vendor/@rc-component/menu/es/SubMenu/PopupTrigger.js +1 -0
- package/vendor/@rc-component/menu/es/SubMenu/index.js +1 -0
- package/vendor/@rc-component/menu/es/context/MenuContext.js +1 -0
- package/vendor/@rc-component/menu/es/hooks/useAccessibility.js +1 -0
- package/vendor/@rc-component/menu/es/hooks/useKeyRecords.js +1 -0
- package/vendor/@rc-component/menu/es/utils/commonUtil.js +1 -0
- package/vendor/@rc-component/menu/es/utils/nodeUtil.js +2 -1
- package/vendor/@rc-component/menu/es/utils/warnUtil.js +1 -0
- package/vendor/@rc-component/menu/package.json +1 -1
- package/vendor/@rc-component/notification/LICENSE +21 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/LICENSE +22 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Children/toArray.js +15 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/canUseDom.js +6 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/contains.js +13 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/dynamicCSS.js +94 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/findDOMNode.js +14 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/focus.js +99 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/isVisible.js +18 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/shadow.js +12 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Dom/styleChecker.js +2 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/KeyCode.js +499 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/Portal.js +28 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/React/isFragment.js +12 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/React/render.js +2 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/getScrollBarSize.js +2 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useControlledState.js +3 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useDelayState.js +4 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useEvent.js +9 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useId.js +23 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useLayoutEffect.js +26 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useMemo.js +12 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useMergedState.js +4 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useState.js +24 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/hooks/useSyncState.js +20 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/index.js +36 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/is.js +21 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/isEqual.js +35 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/isMobile.js +11 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/mergeProps.js +14 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/omit.js +1 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/pickAttrs.js +50 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/proxyObject.js +1 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/raf.js +36 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/ref.js +38 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/test/domHook.js +36 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/utils/get.js +11 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/utils/set.js +58 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/es/warning.js +46 -0
- package/vendor/@rc-component/notification/_/@rc-component/util/package.json +6 -0
- package/vendor/@rc-component/notification/es/Notification.js +129 -0
- package/vendor/@rc-component/notification/es/NotificationList/Content.js +33 -0
- package/vendor/@rc-component/notification/es/NotificationList/index.js +174 -0
- package/vendor/@rc-component/notification/es/NotificationProvider.js +4 -3
- package/vendor/@rc-component/notification/es/Notifications.js +28 -31
- package/vendor/@rc-component/notification/es/Progress.js +10 -0
- package/vendor/@rc-component/notification/es/hooks/useClosable.js +30 -0
- package/vendor/@rc-component/notification/es/hooks/useListPosition/index.js +50 -0
- package/vendor/@rc-component/notification/es/hooks/useListPosition/useSizes.js +33 -0
- package/vendor/@rc-component/notification/es/hooks/useNoticeTimer.js +58 -0
- package/vendor/@rc-component/notification/es/hooks/useNotification.js +27 -18
- package/vendor/@rc-component/notification/es/hooks/useStack.js +4 -4
- package/vendor/@rc-component/notification/es/index.js +4 -2
- package/vendor/@rc-component/notification/package.json +1 -1
- package/vendor/@rc-component/picker/es/PickerInput/Selector/SingleSelector/MultipleDates.js +13 -3
- package/vendor/@rc-component/picker/es/PickerInput/Selector/SingleSelector/index.js +3 -1
- package/vendor/@rc-component/picker/es/PickerInput/SinglePicker.js +2 -1
- package/vendor/@rc-component/picker/package.json +1 -1
- package/vendor/@rc-component/table/LICENSE +21 -0
- package/vendor/@rc-component/table/es/Body/MeasureCell.js +1 -0
- package/vendor/@rc-component/table/es/Body/MeasureRow.js +1 -0
- package/vendor/@rc-component/table/es/Cell/useCellRender.js +1 -0
- package/vendor/@rc-component/table/es/FixedHolder/index.js +1 -0
- package/vendor/@rc-component/table/es/Table.js +17 -9
- package/vendor/@rc-component/table/es/VirtualTable/BodyGrid.js +10 -4
- package/vendor/@rc-component/table/es/VirtualTable/BodyLine.js +13 -5
- package/vendor/@rc-component/table/es/hooks/useColumns/index.js +1 -0
- package/vendor/@rc-component/table/es/hooks/useExpand.js +1 -0
- package/vendor/@rc-component/table/es/hooks/useFixedInfo.js +1 -0
- package/vendor/@rc-component/table/es/hooks/useSticky.js +1 -0
- package/vendor/@rc-component/table/es/index.js +2 -1
- package/vendor/@rc-component/table/es/stickyScrollBar.js +1 -0
- package/vendor/@rc-component/table/es/utils/legacyUtil.js +1 -0
- package/vendor/@rc-component/table/es/utils/offsetUtil.js +1 -0
- package/vendor/@rc-component/table/package.json +1 -1
- package/vendor/@rc-component/tabs/es/TabNavList/OperationNode.js +4 -2
- package/vendor/@rc-component/tabs/es/TabNavList/TabNode.js +5 -4
- package/vendor/@rc-component/tabs/es/TabNavList/index.js +11 -4
- package/vendor/@rc-component/tabs/es/Tabs.js +1 -0
- package/vendor/@rc-component/tabs/es/hooks/useAnimateConfig.js +1 -0
- package/vendor/@rc-component/tabs/es/hooks/useIndicator.js +1 -0
- package/vendor/@rc-component/tabs/es/hooks/useUpdate.js +1 -0
- package/vendor/@rc-component/tabs/package.json +1 -1
- package/vendor/@rc-component/tour/es/TourStep/DefaultPanel.js +4 -1
- package/vendor/@rc-component/tour/package.json +1 -1
- package/vendor/@rc-component/tree/es/MotionTreeNode.js +1 -0
- package/vendor/@rc-component/tree/es/NodeList.js +2 -2
- package/vendor/@rc-component/tree/es/Tree.js +4 -5
- package/vendor/@rc-component/tree/es/TreeNode.js +7 -2
- package/vendor/@rc-component/tree/es/index.js +3 -0
- package/vendor/@rc-component/tree/es/useUnmount.js +1 -0
- package/vendor/@rc-component/tree/es/util.js +1 -0
- package/vendor/@rc-component/tree/es/utils/conductUtil.js +1 -0
- package/vendor/@rc-component/tree/es/utils/treeUtil.js +1 -0
- package/vendor/@rc-component/tree/package.json +1 -1
- package/vendor/@rc-component/tree-select/package.json +1 -1
- package/vendor/@rc-component/util/es/index.js +10 -10
- package/vendor/antd/es/_util/ActionButton.js +2 -3
- package/vendor/antd/es/_util/ContextIsolator.js +1 -1
- package/vendor/antd/es/_util/PurePanel.js +7 -4
- package/vendor/antd/es/_util/convertToTooltipProps.js +2 -2
- package/vendor/antd/es/_util/fallbackProp.js +15 -0
- package/vendor/antd/es/_util/gapSize.js +2 -1
- package/vendor/antd/es/_util/getRenderPropValue.js +2 -1
- package/vendor/antd/es/_util/getScroll.js +4 -4
- package/vendor/antd/es/_util/hooks/index.js +2 -2
- package/vendor/antd/es/_util/hooks/useAllowClear.js +25 -0
- package/vendor/antd/es/_util/hooks/useClosable.js +6 -5
- package/vendor/antd/es/_util/hooks/{useMergeSemantic.js → useMergeSemantic/index.js} +14 -24
- package/vendor/antd/es/_util/hooks/useMergeSemantic/utils.js +14 -0
- package/vendor/antd/es/_util/hooks/useMergedMask.js +2 -1
- package/vendor/antd/es/_util/is.js +27 -0
- package/vendor/antd/es/_util/motion.js +8 -8
- package/vendor/antd/es/_util/normalizeIcon.js +9 -0
- package/vendor/antd/es/_util/placements.js +2 -1
- package/vendor/antd/es/_util/reactNode.js +2 -1
- package/vendor/antd/es/_util/responsiveObserver.js +3 -2
- package/vendor/antd/es/_util/scrollTo.js +3 -1
- package/vendor/antd/es/_util/styleChecker.js +1 -0
- package/vendor/antd/es/_util/throttleByAnimationFrame.js +1 -0
- package/vendor/antd/es/_util/toList.js +1 -1
- package/vendor/antd/es/_util/wave/WaveEffect.js +3 -1
- package/vendor/antd/es/_util/wave/index.js +14 -4
- package/vendor/antd/es/_util/wave/util.js +5 -3
- package/vendor/antd/es/alert/Alert.js +12 -10
- package/vendor/antd/es/alert/ErrorBoundary.js +1 -1
- package/vendor/antd/es/alert/style/index.js +16 -10
- package/vendor/antd/es/anchor/Anchor.js +23 -16
- package/vendor/antd/es/anchor/AnchorLink.js +4 -4
- package/vendor/antd/es/app/App.js +7 -3
- package/vendor/antd/es/auto-complete/AutoComplete.js +7 -8
- package/vendor/antd/es/avatar/Avatar.js +5 -3
- package/vendor/antd/es/back-top/index.js +1 -0
- package/vendor/antd/es/badge/Badge.js +5 -6
- package/vendor/antd/es/badge/Ribbon.js +1 -2
- package/vendor/antd/es/badge/style/index.js +4 -3
- package/vendor/antd/es/border-beam/BorderBeam.js +42 -0
- package/vendor/antd/es/border-beam/BorderBeamEffect.js +24 -0
- package/vendor/antd/es/border-beam/hooks/useBorderSize.js +37 -0
- package/vendor/antd/es/border-beam/hooks/useChildDom.js +24 -0
- package/vendor/antd/es/border-beam/index.js +7 -0
- package/vendor/antd/es/border-beam/style/index.js +60 -0
- package/vendor/antd/es/border-beam/util.js +26 -0
- package/vendor/antd/es/breadcrumb/Breadcrumb.js +1 -2
- package/vendor/antd/es/breadcrumb/BreadcrumbItem.js +1 -1
- package/vendor/antd/es/breadcrumb/useItemRender.js +3 -2
- package/vendor/antd/es/button/Button.js +7 -6
- package/vendor/antd/es/button/buttonHelpers.js +4 -8
- package/vendor/antd/es/button/index.js +2 -2
- package/vendor/antd/es/button/style/index.js +5 -0
- package/vendor/antd/es/calendar/generateCalendar.js +20 -8
- package/vendor/antd/es/card/Card.js +5 -7
- package/vendor/antd/es/card/CardMeta.js +1 -2
- package/vendor/antd/es/carousel/index.js +2 -1
- package/vendor/antd/es/cascader/Panel.js +1 -1
- package/vendor/antd/es/cascader/index.js +23 -16
- package/vendor/antd/es/cascader/style/columns.js +6 -2
- package/vendor/antd/es/checkbox/Checkbox.js +2 -3
- package/vendor/antd/es/checkbox/Group.js +2 -1
- package/vendor/antd/es/checkbox/style/index.js +1 -5
- package/vendor/antd/es/checkbox/useBubbleLock.js +1 -0
- package/vendor/antd/es/collapse/Collapse.js +3 -3
- package/vendor/antd/es/collapse/style/index.js +1 -4
- package/vendor/antd/es/color-picker/ColorPicker.js +1 -2
- package/vendor/antd/es/color-picker/ColorPickerPanel.js +2 -1
- package/vendor/antd/es/color-picker/components/ColorTrigger.js +3 -1
- package/vendor/antd/es/color-picker/components/PanelPicker/index.js +1 -0
- package/vendor/antd/es/config-provider/hooks/useSize.js +3 -2
- package/vendor/antd/es/config-provider/hooks/useTheme.js +2 -0
- package/vendor/antd/es/config-provider/index.js +11 -3
- package/vendor/antd/es/date-picker/generatePicker/generateRangePicker.js +20 -10
- package/vendor/antd/es/date-picker/generatePicker/generateSinglePicker.js +17 -8
- package/vendor/antd/es/date-picker/generatePicker/useSuffixIcon.js +1 -1
- package/vendor/antd/es/date-picker/hooks/useMergedPickerSemantic.js +1 -2
- package/vendor/antd/es/date-picker/style/index.js +13 -3
- package/vendor/antd/es/date-picker/style/multiple.js +3 -4
- package/vendor/antd/es/date-picker/style/panel.js +5 -20
- package/vendor/antd/es/date-picker/util.js +14 -13
- package/vendor/antd/es/descriptions/Cell.js +2 -3
- package/vendor/antd/es/descriptions/hooks/useItems.js +2 -1
- package/vendor/antd/es/descriptions/index.js +3 -3
- package/vendor/antd/es/divider/index.js +3 -2
- package/vendor/antd/es/drawer/Drawer.js +10 -5
- package/vendor/antd/es/drawer/DrawerPanel.js +3 -2
- package/vendor/antd/es/dropdown/dropdown.js +11 -8
- package/vendor/antd/es/dropdown/style/index.js +2 -6
- package/vendor/antd/es/empty/index.js +1 -2
- package/vendor/antd/es/flex/index.js +2 -2
- package/vendor/antd/es/float-button/BackTop.js +1 -0
- package/vendor/antd/es/float-button/FloatButton.js +3 -3
- package/vendor/antd/es/float-button/FloatButtonGroup.js +2 -2
- package/vendor/antd/es/form/ErrorList.js +13 -6
- package/vendor/antd/es/form/Form.js +7 -6
- package/vendor/antd/es/form/FormItem/ItemHolder.js +1 -1
- package/vendor/antd/es/form/FormItem/index.js +6 -6
- package/vendor/antd/es/form/FormItemInput.js +5 -3
- package/vendor/antd/es/form/FormItemLabel.js +2 -1
- package/vendor/antd/es/form/FormList.js +1 -0
- package/vendor/antd/es/form/hooks/useChildren.js +4 -3
- package/vendor/antd/es/form/hooks/useForm.js +3 -1
- package/vendor/antd/es/form/hooks/useFrameState.js +1 -0
- package/vendor/antd/es/form/hooks/useItemRef.js +7 -5
- package/vendor/antd/es/form/style/index.js +1 -3
- package/vendor/antd/es/grid/col.js +5 -7
- package/vendor/antd/es/grid/hooks/useBreakpoint.js +1 -0
- package/vendor/antd/es/grid/hooks/useGutter.js +2 -1
- package/vendor/antd/es/grid/row.js +7 -6
- package/vendor/antd/es/image/PreviewGroup.js +1 -2
- package/vendor/antd/es/image/Progress.js +58 -0
- package/vendor/antd/es/image/hooks/useMergedPreviewConfig.js +3 -1
- package/vendor/antd/es/image/hooks/usePlaceholderConfig.js +15 -0
- package/vendor/antd/es/image/hooks/usePreviewConfig.js +3 -2
- package/vendor/antd/es/image/index.js +36 -5
- package/vendor/antd/es/image/style/index.js +114 -4
- package/vendor/antd/es/image/style/progressAnimation.js +26 -0
- package/vendor/antd/es/index.js +2 -1
- package/vendor/antd/es/input/Input.js +9 -4
- package/vendor/antd/es/input/OTP/OTPInput.js +1 -0
- package/vendor/antd/es/input/OTP/index.js +3 -3
- package/vendor/antd/es/input/Password.js +45 -26
- package/vendor/antd/es/input/Search.js +6 -5
- package/vendor/antd/es/input/TextArea.js +13 -7
- package/vendor/antd/es/input/style/index.js +17 -11
- package/vendor/antd/es/input/style/otp.js +2 -1
- package/vendor/antd/es/input/style/variants.js +16 -10
- package/vendor/antd/es/input-number/index.js +3 -3
- package/vendor/antd/es/input-number/style/index.js +9 -9
- package/vendor/antd/es/layout/Sider.js +3 -2
- package/vendor/antd/es/list/index.js +5 -3
- package/vendor/antd/es/locale/en_US.js +3 -1
- package/vendor/antd/es/locale/ru_RU.js +3 -1
- package/vendor/antd/es/locale/useLocale.js +2 -1
- package/vendor/antd/es/masonry/Masonry.js +4 -3
- package/vendor/antd/es/mentions/index.js +28 -14
- package/vendor/antd/es/menu/MenuItem.js +2 -1
- package/vendor/antd/es/menu/OverrideContext.js +1 -0
- package/vendor/antd/es/menu/SubMenu.js +1 -1
- package/vendor/antd/es/menu/menu.js +5 -5
- package/vendor/antd/es/menu/style/index.js +21 -36
- package/vendor/antd/es/menu/style/vertical.js +2 -1
- package/vendor/antd/es/message/PureList.js +49 -0
- package/vendor/antd/es/message/PurePanel.js +28 -36
- package/vendor/antd/es/message/index.js +6 -3
- package/vendor/antd/es/message/style/index.js +102 -99
- package/vendor/antd/es/message/useMessage.js +29 -33
- package/vendor/antd/es/message/util.js +1 -1
- package/vendor/antd/es/modal/ConfirmDialog.js +11 -9
- package/vendor/antd/es/modal/Modal.js +12 -7
- package/vendor/antd/es/modal/PurePanel.js +1 -2
- package/vendor/antd/es/modal/confirm.js +4 -3
- package/vendor/antd/es/modal/shared.js +3 -2
- package/vendor/antd/es/modal/useModal/HookModal.js +2 -1
- package/vendor/antd/es/notification/PureList.js +46 -0
- package/vendor/antd/es/notification/PurePanel.js +37 -56
- package/vendor/antd/es/notification/hooks/useStackConfig.js +13 -0
- package/vendor/antd/es/notification/index.js +3 -1
- package/vendor/antd/es/notification/style/index.js +103 -170
- package/vendor/antd/es/notification/style/notification.js +191 -0
- package/vendor/antd/es/notification/style/placement.js +117 -60
- package/vendor/antd/es/notification/useNotification.js +37 -40
- package/vendor/antd/es/notification/util.js +9 -50
- package/vendor/antd/es/pagination/Pagination.js +1 -2
- package/vendor/antd/es/pagination/useShowSizeChanger.js +2 -1
- package/vendor/antd/es/popconfirm/PurePanel.js +4 -1
- package/vendor/antd/es/popconfirm/index.js +1 -2
- package/vendor/antd/es/popover/PurePanel.js +1 -2
- package/vendor/antd/es/popover/index.js +1 -2
- package/vendor/antd/es/progress/Circle.js +2 -1
- package/vendor/antd/es/progress/progress.js +3 -3
- package/vendor/antd/es/progress/utils.js +4 -3
- package/vendor/antd/es/qr-code/index.js +4 -4
- package/vendor/antd/es/radio/group.js +4 -3
- package/vendor/antd/es/radio/radio.js +2 -2
- package/vendor/antd/es/radio/style/index.js +1 -1
- package/vendor/antd/es/rate/index.js +2 -4
- package/vendor/antd/es/result/index.js +6 -5
- package/vendor/antd/es/result/style/index.js +10 -6
- package/vendor/antd/es/segmented/index.js +5 -3
- package/vendor/antd/es/select/index.js +23 -12
- package/vendor/antd/es/select/style/dropdown.js +1 -1
- package/vendor/antd/es/select/style/select-input.js +23 -15
- package/vendor/antd/es/select/useIcons.js +43 -26
- package/vendor/antd/es/skeleton/Element.js +2 -1
- package/vendor/antd/es/skeleton/Skeleton.js +3 -3
- package/vendor/antd/es/slider/SliderTooltip.js +1 -0
- package/vendor/antd/es/slider/index.js +5 -3
- package/vendor/antd/es/slider/useRafLock.js +1 -0
- package/vendor/antd/es/space/Compact.js +1 -1
- package/vendor/antd/es/space/Item.js +1 -1
- package/vendor/antd/es/space/index.js +2 -2
- package/vendor/antd/es/space/style/addon.js +5 -2
- package/vendor/antd/es/spin/Indicator/Progress.js +2 -1
- package/vendor/antd/es/spin/index.js +1 -2
- package/vendor/antd/es/splitter/Panel.js +7 -3
- package/vendor/antd/es/splitter/SplitBar.js +5 -4
- package/vendor/antd/es/splitter/Splitter.js +9 -6
- package/vendor/antd/es/splitter/hooks/useItems.js +2 -1
- package/vendor/antd/es/splitter/hooks/useSizes.js +1 -1
- package/vendor/antd/es/splitter/style/index.js +8 -6
- package/vendor/antd/es/statistic/Number.js +8 -4
- package/vendor/antd/es/statistic/Statistic.js +14 -10
- package/vendor/antd/es/steps/index.js +4 -4
- package/vendor/antd/es/style/compact-item-vertical.js +2 -1
- package/vendor/antd/es/style/compact-item.js +6 -6
- package/vendor/antd/es/switch/index.js +1 -2
- package/vendor/antd/es/table/InternalTable.js +23 -14
- package/vendor/antd/es/table/hooks/useFilledColumns.js +23 -0
- package/vendor/antd/es/table/hooks/useFilter/FilterDropdown.js +22 -16
- package/vendor/antd/es/table/hooks/useFilter/FilterWrapper.js +1 -0
- package/vendor/antd/es/table/hooks/useFilter/index.js +34 -18
- package/vendor/antd/es/table/hooks/useLazyKVMap.js +2 -1
- package/vendor/antd/es/table/hooks/usePagination.js +7 -4
- package/vendor/antd/es/table/hooks/useSelection.js +32 -21
- package/vendor/antd/es/table/hooks/useSorter.js +10 -5
- package/vendor/antd/es/table/style/bordered.js +5 -27
- package/vendor/antd/es/table/style/empty.js +1 -4
- package/vendor/antd/es/table/style/index.js +1 -4
- package/vendor/antd/es/table/util.js +6 -6
- package/vendor/antd/es/tabs/hooks/useAnimateConfig.js +2 -1
- package/vendor/antd/es/tabs/index.js +1 -2
- package/vendor/antd/es/tag/CheckableTagGroup.js +8 -5
- package/vendor/antd/es/tag/hooks/useColor.js +4 -3
- package/vendor/antd/es/tag/index.js +13 -7
- package/vendor/antd/es/theme/themes/dark/colors.js +2 -1
- package/vendor/antd/es/theme/themes/default/colors.js +2 -1
- package/vendor/antd/es/theme/useToken.js +2 -2
- package/vendor/antd/es/theme/util/alias.js +34 -29
- package/vendor/antd/es/timeline/Timeline.js +3 -4
- package/vendor/antd/es/tooltip/PurePanel.js +1 -2
- package/vendor/antd/es/tooltip/UniqueProvider/index.js +2 -1
- package/vendor/antd/es/tooltip/index.js +9 -7
- package/vendor/antd/es/tour/PurePanel.js +2 -2
- package/vendor/antd/es/tour/index.js +1 -1
- package/vendor/antd/es/tour/panelRender.js +4 -2
- package/vendor/antd/es/transfer/ListBody.js +3 -1
- package/vendor/antd/es/transfer/ListItem.js +2 -1
- package/vendor/antd/es/transfer/Section.js +17 -8
- package/vendor/antd/es/transfer/index.js +51 -16
- package/vendor/antd/es/transfer/style/index.js +5 -1
- package/vendor/antd/es/tree/Tree.js +1 -2
- package/vendor/antd/es/tree/style/index.js +5 -1
- package/vendor/antd/es/tree/utils/iconUtil.js +5 -4
- package/vendor/antd/es/tree-select/index.js +3 -3
- package/vendor/antd/es/typography/Base/CopyBtn.js +3 -2
- package/vendor/antd/es/typography/Base/Ellipsis.js +3 -3
- package/vendor/antd/es/typography/Base/index.js +38 -31
- package/vendor/antd/es/typography/Editable.js +10 -4
- package/vendor/antd/es/typography/Link.js +1 -0
- package/vendor/antd/es/typography/Text.js +2 -1
- package/vendor/antd/es/typography/Typography.js +20 -10
- package/vendor/antd/es/typography/hooks/useCopyClick.js +2 -1
- package/vendor/antd/es/typography/hooks/useMergedConfig.js +13 -7
- package/vendor/antd/es/typography/hooks/useTooltipProps.js +2 -1
- package/vendor/antd/es/typography/hooks/useTypographySemantic.js +33 -0
- package/vendor/antd/es/typography/style/index.js +12 -27
- package/vendor/antd/es/typography/style/mixins.js +46 -13
- package/vendor/antd/es/upload/Upload.js +13 -7
- package/vendor/antd/es/upload/UploadList/ListItem.js +6 -5
- package/vendor/antd/es/upload/UploadList/index.js +4 -3
- package/vendor/antd/es/upload/utils.js +18 -1
- package/vendor/antd/es/version/version.js +1 -1
- package/vendor/antd/es/watermark/index.js +6 -4
- package/vendor/antd/es/watermark/useSingletonCache.js +1 -0
- package/vendor/antd/es/watermark/useWatermark.js +3 -3
- package/vendor/antd/package.json +1 -1
- package/vendor/useblocks-ui-kit/es/components/DataEntry/Input/index.js +1 -1
- package/vendor/useblocks-ui-kit/es/components/General/EmIcons/deprecationNotice.js +1 -1
- package/vendor/useblocks-ui-kit/package.json +1 -1
- package/vite/index.cjs +2 -2
- package/vite/index.js +2 -2
- package/iframe/js/discussHandlers.ozU2Hn_l.js +0 -87
- package/iframe/js/iframe.body.js +0 -319
- package/static/core/1c535081.js +0 -1
- package/static/core/1cee0d36.js +0 -1
- package/static/core/4fbdd8b6.js +0 -2
- package/static/core/55a38638.js +0 -93
- package/static/core/605c665e.js +0 -28
- package/static/core/68cbe23d.js +0 -1
- package/static/core/89431649.js +0 -7
- package/static/core/8b821a61.js +0 -1
- package/static/core/9718977a.js +0 -1
- package/static/core/b7e9202e.js +0 -27
- package/static/core/b877f7b4.js +0 -1
- package/static/core/baded0c1.js +0 -1
- package/static/core/c6cc104d.js +0 -4
- package/static/core/d70aac44.js +0 -291
- package/static/core/e0d71533.js +0 -100
- package/static/core/fb57f60b.js +0 -1
- package/static/core/fe756e4d.js +0 -1
- package/static/esm/349f9e2c.js +0 -1
- package/static/esm/50fbfdf6.js +0 -1
- package/static/media/icon-sets/lucide.json +0 -6275
- package/static/media/icon-sets/tabler.json +0 -19336
- package/static/umd-runtime/Cl8heeC3.js +0 -1
- package/static/umd-runtime/D0xo8o9c.js +0 -335
- package/static/umd-runtime/runtime.js +0 -1
- package/useblocks-core.bb6d921f.js +0 -859
- package/vendor/@rc-component/notification/es/Notice.js +0 -106
- package/vendor/@rc-component/notification/es/NoticeList.js +0 -98
- package/vendor/@rc-component/textarea/LICENSE.md +0 -9
- package/vendor/@rc-component/textarea/es/index.js +0 -6
- package/vendor/@rc-component/textarea/package.json +0 -6
- package/vendor/antd/es/_util/extendsObject.js +0 -12
- package/vendor/antd/es/_util/getAllowClear.js +0 -12
- package/vendor/antd/es/_util/isNonNullable.js +0 -6
- package/vendor/antd/es/_util/isPrimitive.js +0 -4
- package/vendor/antd/es/notification/style/pure-panel.js +0 -18
- package/vendor/antd/es/notification/style/stack.js +0 -85
- /package/static/monaco/{index.js → index.CO7s5UdA.js} +0 -0
- /package/static/umd-runtime/{delivery-libs.js → delivery-libs.3Svr0avG.js} +0 -0
package/useblocks.js
CHANGED
|
@@ -1014,7 +1014,7 @@ var __amdEnv = window.__useblocks__ || (window.__useblocks__ = {});
|
|
|
1014
1014
|
|
|
1015
1015
|
|
|
1016
1016
|
// Configure AMD loader
|
|
1017
|
-
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.
|
|
1017
|
+
__amdEnv.require.config({ baseUrl: "./", paths: {"core":"useblocks-core.1c4e77a0.js","monaco":"static/monaco/index.CO7s5UdA.js","po":"useblocks-po.1c4e77a0.js","static/umd-runtime/delivery-libs.js":"static/umd-runtime/delivery-libs.3Svr0avG.js","static/umd-runtime/runtime.js":"static/umd-runtime/runtime.2paN090q.js","static/umd-runtime/ui-kit-icons.js":"static/umd-runtime/ui-kit-icons.DqlZwgBU.js","static/umd-runtime/ui-kit.js":"static/umd-runtime/ui-kit.CoVNet0I.js"} });
|
|
1018
1018
|
|
|
1019
1019
|
// PublicPath (script detection: entry script lookup → document.currentScript)
|
|
1020
1020
|
if (!__useblocks__.publicPath) {
|
|
@@ -1362,7 +1362,7 @@ if (!ns.assetUrl) {
|
|
|
1362
1362
|
}
|
|
1363
1363
|
|
|
1364
1364
|
if (!ns.version) {
|
|
1365
|
-
ns.version = "1.1.
|
|
1365
|
+
ns.version = "1.1.102";
|
|
1366
1366
|
}
|
|
1367
1367
|
|
|
1368
1368
|
var modules = ns.modules = Object.create(null);
|
|
@@ -1408,7 +1408,7 @@ if (!ns.version) {
|
|
|
1408
1408
|
return m["UiKit"] !== undefined ? m["UiKit"] : m;
|
|
1409
1409
|
});
|
|
1410
1410
|
Object.defineProperty(modules, "UiKit", {
|
|
1411
|
-
value: barrelPromise, configurable: true, enumerable: true,
|
|
1411
|
+
value: barrelPromise, writable: true, configurable: true, enumerable: true,
|
|
1412
1412
|
});
|
|
1413
1413
|
return barrelPromise;
|
|
1414
1414
|
},
|
|
@@ -1419,7 +1419,7 @@ if (!ns.version) {
|
|
|
1419
1419
|
get: function() {
|
|
1420
1420
|
var iconsPromise = ns.require("static/umd-runtime/ui-kit-icons.js");
|
|
1421
1421
|
Object.defineProperty(modules, "UiKitIcons", {
|
|
1422
|
-
value: iconsPromise, configurable: true, enumerable: true,
|
|
1422
|
+
value: iconsPromise, writable: true, configurable: true, enumerable: true,
|
|
1423
1423
|
});
|
|
1424
1424
|
return iconsPromise;
|
|
1425
1425
|
},
|
|
@@ -1442,10 +1442,28 @@ if (!ns.version) {
|
|
|
1442
1442
|
return merged;
|
|
1443
1443
|
});
|
|
1444
1444
|
|
|
1445
|
+
// Снятые из контракта имена: внятная ошибка вместо "Cannot read properties of undefined".
|
|
1446
|
+
var __removedExports = {"Uuid":"the shared `uuid` package was removed from the editor runtime; bundle `uuid` into the plugin or use `crypto.randomUUID()`"};
|
|
1447
|
+
var __silentProps = ["then","toString","valueOf","constructor","inspect","$$typeof"];
|
|
1448
|
+
for (var __removedName in __removedExports) {
|
|
1449
|
+
if (!Object.prototype.hasOwnProperty.call(__removedExports, __removedName)) { continue; }
|
|
1450
|
+
if (modules[__removedName] !== undefined) { continue; }
|
|
1451
|
+
modules[__removedName] = (function(name, hint) {
|
|
1452
|
+
return new Proxy(Object.create(null), {
|
|
1453
|
+
get: function(_target, prop) {
|
|
1454
|
+
if (typeof prop === "symbol" || __silentProps.indexOf(prop) !== -1) { return undefined; }
|
|
1455
|
+
throw new Error(
|
|
1456
|
+
"[shared-runtime] " + name + "." + String(prop) + " is not available: " + hint + "."
|
|
1457
|
+
);
|
|
1458
|
+
},
|
|
1459
|
+
});
|
|
1460
|
+
})(__removedName, __removedExports[__removedName]);
|
|
1461
|
+
}
|
|
1462
|
+
|
|
1445
1463
|
var __compatDirect = {};
|
|
1446
1464
|
|
|
1447
1465
|
// Слой совместимости: предупреждаем того, кто пришёл за пакетом, а не всех подряд.
|
|
1448
|
-
var __compatLazy = {"AntDesignIcons":"[runtime] `@ant-design/icons` is served from the host runtime
|
|
1466
|
+
var __compatLazy = {"AntDesignIcons":"[runtime] `@ant-design/icons` is served to a plugin from the host runtime through the compatibility layer for global plugins. This layer is deprecated and may be removed in a future major version."};
|
|
1449
1467
|
for (var __compatName in __compatLazy) {
|
|
1450
1468
|
if (!Object.prototype.hasOwnProperty.call(__compatLazy, __compatName)) { continue; }
|
|
1451
1469
|
(function (name, message) {
|
|
@@ -2072,17 +2090,23 @@ if (typeof ns.define === 'function') {
|
|
|
2072
2090
|
})();
|
|
2073
2091
|
|
|
2074
2092
|
|
|
2075
|
-
__useblocks__.define("static/umd/993c2c90.js",["require","exports","module"],function(Dn,u,Nn){var I=class ct{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof ct&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function M(e){return`service_container_${e}`}var y=new Set,H;function ut(){if(!H)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,se.prototype.getInstanceAsync),e.stack}function V(e){y.delete(e)&&H?.end(e)}var se=class oe extends I{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){this._injectCallbacks.forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const i=this._injections[t];let o=typeof i=="function"?i():i;const s=this._injections[t]=()=>(o=r(this,o),o);n&&s(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new I){return n.addDisposable(this.onInject(i=>{t===i&&(n.dispose(),r(this.getInstance(i)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const i=r(this);return this.inject(t,i),i}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=ut();return new Promise((i,o)=>{const s={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};y.add(s),H?.start(s),this._onInject(t,()=>{V(s),i(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(y))r.container===this&&(V(r),r.reject(t))}pendingWaits(){return[...y].filter(t=>t.container===this)}addService(t,r){const n=M(t);this.injectFactory(n,(o,s=[])=>s.indexOf(r)<0?[...s,r]:s);const i=new I;return i.addDispose(()=>{this.injectFactory(n,(o,s=[])=>s.filter(a=>a!==r))}),i}addServiceFactory(t,r,n){const i=M(t);let o;this.injectFactory(i,(a,c=[])=>(o=r(a,o),o===void 0?c:c.indexOf(o)<0?[...c,o]:c),n);const s=new I;return s.addDispose(()=>{this.injectFactory(i,(a,c=[])=>o===void 0?c:c.filter(_=>_!==o))}),s}getServices(t){const r=M(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new oe(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new oe(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(y))t.container===this&&V(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function $(e){return e.startsWith("__")?e:`__${e}__`}function _t(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=$(e),r=globalThis;return r[t]??={}}function lt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function dt(e){if(e)return $(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return $(t)}function ae(e){const t=dt(e),r=_t(t);if(lt(r.container))return r.container;const n=new se(null);return r.container=n,n}function ft(e){return ae(e)}function Et(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Et()}function f(e=ce()){return e}function ue(){return"umd".trim()||"unknown"}function pt(e){if(typeof globalThis>"u")return;const t=ue(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},i=n.diModuleEval??={evalCount:0,records:[]};i.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),i.evalCount+=1}function ht(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Ot(e,t){if(pt(t),typeof globalThis>"u")return e;const r=ue(),n=globalThis,i=n[t]=n[t]||{},o=i.__diagnostics=i.__diagnostics||{},s=o.dependencyResolver=o.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var j;function At(){if(j)return j;const e=ht();return j=Ot(ae(e),e),j}var W=new Proxy({},{get(e,t,r){const n=At(),i=Reflect.get(n,t,r);return typeof i=="function"?i.bind(n):i}});function gt(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}function S(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function It(e){return e instanceof DOMException&&e.name==="AbortError"}function q(e){if(e?.aborted)throw S(e.reason)}function mt(e,t){return t?(t.aborted&&e.catch(()=>{}),q(t),new Promise((r,n)=>{const i=()=>{o(),n(S(t.reason))},o=()=>{t.removeEventListener("abort",i)};t.addEventListener("abort",i),e.then(s=>{o(),r(s)},s=>{o(),n(s)})})):e}var _e=class extends I{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,i=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,a])=>a<t),s=[e,t];return n.splice(o>=0?o:n.length,0,s),n.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const a=n.indexOf(s);a>=0&&(n.splice(a,1),!n.length&&i.onLastListenerRemove&&i.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...i)=>(n?.dispose(),r?e.call(r,...i):e(...i)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},b=class extends _e{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Tt=class extends b{execute([e],t){for(const r of t)try{r(e)}catch{}}},St=class extends b{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},B=class extends b{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function bt(e,t=0){const r=new _e,n=e(r,t);return n&&r.addDisposable(n),r.event}function Dt(e,t,r=0){const n=new b,i=e((...o)=>{if(t(...o))return n.fire(...o)},r);return i&&n.addDisposable(i),n.event}function Nt(e,t=0,r=0){const n=new b;let i,o;const s=e((...a)=>{o=a,i||(i=setTimeout(()=>{o&&n.fire(...o),i=void 0},t))},r);return s&&n.addDisposable(s),n.event}function Pt(e,t){return e.getOrCreateInstance(t,()=>new B)}function d(e){return f(e)}var K;(function(e){e.BEFORE_SAVE_EMAIL=d("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=d("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=d("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=d("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=d("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=d("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=d("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=d("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=d("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=d("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=d("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=d("events.ON_EMAIL_CHANGED_ID"),e.ON_HEADER_APPLIED_ID=d("events.ON_HEADER_APPLIED_ID"),e.ON_BLOCK_CHANGED_ID=d("events.ON_BLOCK_CHANGED_ID"),e.ON_CHUNKS_LOADED=d("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=d("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=d("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=d("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=d("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=d("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=d("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_NOTIFICATION=d("events.ON_NOTIFICATION"),e.READ_LOCALE=d("events.READ_LOCALE"),e.ON_TRANSLATE_ID=d("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=d("events.ON_CODE_VALIDATE_ID"),e.UPLOAD_EVENT_ID=d("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=d("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=d("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=d("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=d("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=d("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=d("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=d("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=d("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=d("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=d("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=d("events.AI_TEXT_STREAM_ID")})(K||(K={}));function yt(e,t){return e.getOrCreateInstance(t,()=>new B).event}function Ct(e,t){return e.getOrCreateInstance(t,()=>new B)}var Lt=f("plugin.app"),Rt=f("plugin.disposable"),vt=f("InitPipelineContext"),wt=f("plugin.instance"),Mt=f("plugin.lateSurfaceListeners"),le=f("plugin.optionsSource"),jt=f("plugin.store"),de=f("ConfigSource"),Bt=f("plugin.standalone.project"),fe=f("plugin.standalone.bootstrapToken"),Pn=f("plugin.element"),Ee=f("plugin.securityModule"),xt=f("plugin.standalone.activated"),Ft=f("plugin.standalone.fileProxyRegistered"),z=f("plugin.jwt.token"),C=f("plugin.jwt.error"),kt=f("PluginCollection"),Ut=d("APP_LOAD_EVENT"),Gt=d("CONFIG_CHANGED_EVENT"),Xt=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),Ht=class{baseUrl="https://api.emailmaker.ru/wp-json";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:c,proxyHandler:_,...l}){const E=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},h=this.mergeRequestParams(l,E);c&&(i=i?{...i,...c}:c);const p=i&&this.toQueryString(i),g=this.contentFormatters[n||"application/json"],O=o||h.format,G=`${s||this.baseUrl||""}${r}${p?`?${p}`:""}`,Sn=_?_(G,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:c,proxyHandler:_,...l}):G,st=new Request(Sn,{...h,headers:{...h.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(a?this.createAbortSignal(a):h.signal)||null,body:typeof e>"u"||e===null?null:g(e)});return this.customFetch(st).then(async at=>{const m=at;m.data=null,m.error=null,m.meta={request:st,response:m};const bn=O?await at[O]().then(X=>(m.ok?m.data=X:m.error={data:X},m)).catch(X=>(m.error=X,m)):m;return a&&this.abortControllers.delete(a),bn})}},Vt=f("prewarm.networkActivity");function $t(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function Wt(e){return e.getOrCreateInstance(Vt,()=>$t())}var pe=Symbol("rest.publicRequest"),x=f("rest.requestHandler"),qt=f("rest.responseHandler"),J=f("rest.customFetch"),Y=f("rest_transport"),Kt=e=>{e.inject(J,{execute:async(t,r={})=>{const n=e.getServices(x),i={public:r[pe]===!0},o=Wt(e).begin();try{let s=t instanceof Request?t:new Request(t,r);for(const _ of n){const l=await _.execute(s,i);l instanceof Request&&(s=l)}let a=await fetch(s);const c=e.getServices(qt);for(const _ of c)a=await _.execute(a);return a}finally{o()}}})};function zt(e,t){const r=e.getInstance(Y);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}function Jt(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=i=>{r({data:i.data,source:i.source,ports:i.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Yt(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=i=>{r({data:i.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function Qt(e){return e}function Zt(e){return e&&typeof e=="object"}function he(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",Oe="em:port-ready",er="em:window-drained",Q="";function Ae(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var tr=class extends I{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const i=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=i.findIndex(([a,c])=>r<=c),s=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,s),{dispose(){const a=i.indexOf(s);a>=0&&i.splice(a,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let i=0;i<r.length;i++){const o=r[i][0],s=n;n=a=>o(a,s)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,i)=>{try{t(n)}catch{}return i&&i(n)},r)},rr=class extends I{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_inited=!1;_emitter=this.addDisposable(new tr);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;constructor(e,t){super(),this._singleton=t,this._transport=Jt({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,i=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._drained.add(n);return}if(!(o&&n&&this._drained.has(n))){if(n&&n!==this._target&&this._greeted.has(n)&&he(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),i&&this.usePort(i,!0,n);return}if(Zt(r)&&(t.source===this.target||this._isCurrentPort(t.source))||this._singleton&&he(r,T)){if(i){const _=this._target;Promise.resolve().then(()=>this.usePort(i,!0,_))}const s=this._emitter.fireAsync(r.operationId||Q,r.operationId===void 0?t:r.data),a=r.result,c=r.error;a&&c&&Promise.resolve(s).then(_=>this._sendMessage(a,_),_=>this._sendMessage(c,_))}}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,data:{},port:!0},[t])}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:T,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=Yt(e),i=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:i}),t&&(n.send({operationId:Oe,data:{}}),this.drainWindow(r))}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)}hasPort(e){return this._ports.has(e)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:er,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const i=this._ports.get(e);if(i){i.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(i){if(i?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw i}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;const n=this.addDisposable(this.onInit(i=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(i,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(Q,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();const n=Ae(),i=Ae();return new Promise((o,s)=>{const a=this.addDisposable(new I);a.addDisposable(this.onInit(c=>{try{this._postMessage(c,{operationId:e,data:t,result:n,error:i})}catch(_){a.dispose(),s(_);return}a.addDisposable(this._onMessage(n,_=>{o(_),a.dispose()})),a.addDisposable(this._onMessage(i,_=>{s(_),a.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(Q,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,i)=>{const o=await t(n);return i?i(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new I);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function L(e){return f(e)}var nr=f("extensions.atomsHandlers"),ir=L("HANDLE_ATOM_INSERT"),or=f("extensions.sandboxExtensions"),sr="SANDBOX_EXTENSION_SCRIPT_STATUS",ar=f("MESSAGE_SERVICE"),cr=L("SETTINGS_PANEL_EVENT"),ur="advanced",_r=L("MODAL_SHOW_EVENT"),lr=L("MODAL_CLOSE_EVENT"),dr=L("MODAL_UPDATE_EVENT"),yn=f("client"),Cn=f("v2_client"),Ln=f("ai_client"),fr=f("app.cookieManager"),Rn=f("app.storageProvider"),vn=f("image-blob-resolver"),Er=f("template-directives"),pr="INJECTION";function hr(e){return e.getState}function Or(e){if(!hr(e)){e.dispose();return}const t=e.getState()[pr];t&&(W.getInstance(t)?.dispose(),W.remove(t))}function ge(e){return Object.assign({},...e)}var Ie=["generic","stockImages","emFiles","cdn"];function Z(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function me(e){return!Z(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>Ie.includes(t))}function Te(e){return e.length===0?[]:e.length===1?e[0]:e}function Se(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Te(r)}function Ar(e){return Z(e)&&("value"in e||"replace"in e)}function be(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function gr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(Ar(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=be(r,o.value),n=!0);continue}r=be(r,o),n=!0}const i=n?Te(r):void 0;if(!t)return i;if(i!==void 0)return{value:i}}function Ir(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>me(n)))return Se(t);const r={};for(const n of Ie){const i=gr(e.map(o=>{if(o!==void 0)return me(o)?o[n]:n==="generic"?o:void 0}));i!==void 0&&(r[n]=i)}return Object.keys(r).length>0?r:void 0}function mr(e){return Se(e)}function Tr(e){if(e!==void 0){if(Array.isArray(e))return{replace:!1,hosts:e};if(Z(e)&&Array.isArray(e.value))return{replace:!!e.replace,hosts:e.value}}}function Sr(e,t){const r=[...e],n=new Set(r.map(i=>i.toLowerCase()));for(const i of t){const o=i.trim().replace(/:\d+$/,"");if(!o)continue;const s=o.toLowerCase();n.has(s)||(n.add(s),r.push(o))}return r}function br(e){let t=[],r=!1;for(const n of e){const i=Tr(n);i&&(r=!0,i.replace&&(t=[]),t=Sr(t,i.hosts))}return r?t:void 0}function Dr(e){const t=e.filter(i=>i!==void 0);if(t.length===0)return;const r=ge(t.map(({directHosts:i,...o})=>o)),n=br(t.map(i=>i?.directHosts));return n!==void 0&&(r.directHosts=n),r}function ee(e){return e?.backendProxy}function R(e){return e.replace(/\/$/,"")}function De(e){return/^https?:\/\//i.test(e)}function Ne(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Nr(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function Pr(e){const t=ee(e);return t?[t]:[]}function yr(e){return{proxyEmFiles:!0,proxyAi:!1}}function Cr(e,t){const r=yr(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var Lr={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function Rr(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,i)=>(t.push(i),`(${Lr[i]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function vr(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function wr(e,t){if(vr(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function Mr(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),i=n.lastIndexOf("#"),o=n.lastIndexOf("?"),s=n.lastIndexOf("&"),a=n.lastIndexOf("=");return a>Math.max(o,s)&&a>i}function jr(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),i=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),s=o?`/${o}`:"/",a=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),c=a?.[1]||"",_=a?.[2]||"",l=a?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:i,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:s,rest_namespace:c,rest_version:_,rest_route:l,rest_route_with_slash:l?`/${l}`:"/"}}catch{return}}function te(e,t){if(!e)return{};if(Array.isArray(e)){for(const a of e){const c=te(a,t);if(c!==void 0)return c}return}if(e==="*")return{};const r=wr(t,e),{regex:n,tokens:i}=Rr(e),o=n.exec(r);if(!o)return;const s={};return i.forEach((a,c)=>{s[`matched_${a}`]=o[c+1]||""}),s}function F(e,t,r={}){const n=jr(t);if(!n)return t;const i={...n,...r};let o="",s=0;const a=/\{([a-z_]+)\}/gi;let c;for(;c=a.exec(e);){o+=e.slice(s,c.index);const _=i[c[1]]??"",l=Mr(e,c.index,c[1])?encodeURIComponent(_):_;o+=l,s=c.index+c[0].length}o+=e.slice(s);try{const _=new URL(o),l=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&l.search&&l.searchParams.forEach((E,h)=>{_.searchParams.has(h)||_.searchParams.append(h,E)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&l.hash&&!_.hash&&(_.hash=l.hash),_.toString()}catch{return o}}function Pe(e,t){try{const r=new URL(t);return`${R(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function ye(e,t){const r=R(e);return t?De(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function Ce(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>Ce({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,method:n,requestType:r}):i==="*"?!0:te(i,t)!==void 0:!0}function Br(e,t,r,n="generic"){if(e==null)return[];const i=Array.isArray(e)?e:[e],o=[];return i.forEach((s,a)=>{if(!s)return;if(typeof s=="string"){const E=s.includes("{")&&s.includes("}")?F(s,t):Pe(s,t);o.push({key:`backend:${a}`,url:E,source:"resource"});return}if(!Ne(s)||!("rewrite"in s))return;const c=s;if(!Ce(c,t,n,r))return;const _=typeof c.match=="string"||Array.isArray(c.match)?te(c.match,t)||{}:{},l=typeof c.proxyBase=="string"&&c.proxyBase.trim()?c.proxyBase.trim():void 0;(Array.isArray(c.rewrite)?c.rewrite:[c.rewrite]).filter(Boolean).forEach((E,h)=>{const p=typeof E=="function"?(()=>{const g=E({url:t,proxyBase:l,method:r,requestType:n,..._}),O=l&&!De(g)?ye(l,g):g;return O.includes("{")&&O.includes("}")?F(O,t,_):O})():l?F(ye(l,E),t,_):E.includes("{")&&E.includes("}")?F(E,t,_):Pe(E,t);o.push({key:`backend:${c.id||"rule"}:${a}:${h}`,url:p,source:"resource"})})}),Nr(o)}function xr(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function Fr(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(R(n));return}!Ne(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(R(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const i=n.split("{")[0]?.trim();i&&t.push(R(i))}))}}),t}function kr(e,t){return Pr(t).flatMap(r=>Fr(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function Ur(e,t){return!!ee(t)&&Cr(e,t)}function Gr(e,t={}){const r=t.requestType||xr(e);return Ur(r,t.config)?Br(ee(t.config),e,t.method,r):[]}function Xr(e,t={}){return kr(e,t.config)?[e]:Gr(e,t).map(r=>r.url)}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function Le(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,i=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>i(o),{once:!0});return n.signal}var Re=3e5,ve=15e3,A=null,we=!1;function Hr(){return!0}function Vr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return Re;const t=Number(e);return Number.isFinite(t)&&t>0?t:Re}function $r(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return ve;const t=Number(e);return Number.isFinite(t)&&t>0?t:ve}function Wr(){const e="https://app.useblocks.io/api".trim();return e?D(e):void 0}function qr(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return we||(we=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Kr(e){const t=new Set,r=[];for(const n of e){const i=D(n);t.has(i)||(t.add(i),r.push(i))}return r}function Me(e){const t=String(e||"").trim();return t?D(t):Wr()}function je(e,t=[]){return e?Kr([e,...t]).slice(0,3):[]}function Be(){return qr(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function zr(e=Date.now()){return A?e-A.switchedAt>=Vr():!0}function xe(e=Date.now()){A&&zr(e)&&(A=null)}function N(e){if(!Hr())return!1;const t=Me(e);if(!t)return!1;const r=Be();return r.length===0?!1:je(t,r).length>1}function v(e){const t=Me(e);if(!t)return[];const r=Be();return r.length===0?[t]:je(t,r)}function k(e){const t=v(e);if(t.length===0)return"";if(xe(),A){const r=t.indexOf(A.activeUrl);if(r>=0)return t[r]}return t[0]}function Fe(e){const t=v(e);if(t.length<=1||(xe(),!A||!t.includes(A.activeUrl)))return t;const r=A.activeUrl;return[r,...t.filter(n=>n!==r)]}function ke(e){return k(e)||void 0}function Ue(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=$r(),n=new AbortController;let i;const o=setTimeout(()=>{i=Jr(r),n.abort(i)},r);return{signal:Le(t,n.signal),timeoutError:()=>i,done:()=>clearTimeout(o)}}function Jr(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function Ge(e){return e===502||e===503||e===504}function Xe(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var He;function Yr(e){He=e}function U(e,t){if(!N(t))return;const r=v(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const i=n+1;if(i>=r.length)return;const o=r[i],s=A?.activeUrl;A={activeUrl:o,switchedAt:Date.now()},s!==o&&He?.()}function Ve(e,t){if(!N(t))return;const r=D(e),n=v(t);if(n.includes(r)){if(r===n[0]){A=null;return}A?.activeUrl!==r&&(A={activeUrl:r,switchedAt:Date.now()})}}function $e(){A=null}var Qr=e=>{const t=new FormData,r=(n,i,o)=>{if(i!=null){if(i instanceof Blob){n.append(o,i);return}if(Array.isArray(i)){i.forEach((s,a)=>{const c=o?`${o}[${a}]`:`${a}`;r(n,s,c)});return}if(typeof i=="object"){Object.keys(i).forEach(s=>{const a=i[s],c=o?`${o}[${s}]`:s;r(n,a,c)});return}n.append(o,String(i))}};return r(t,e),t},Zr={baseUrl:D("https://app.useblocks.io/api"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},P=new Map;function en(e){const t=e?.getInstance(de);return t?t.get()??t.bootstrap():void 0}var tn=class extends Ht{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:i}=e;n&&(i=i?{...i,...n}:n);const o=i&&this.toQueryString(i);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=en(this.container),n=this.container?.getInstance(Ee)!==void 0,i=Xr(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],s=this.buildRequestKey(e,t),a=P.get(s);return!a||!o.includes(a)?o:[a,...o.filter(c=>c!==a)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},i=this.buildRequestUrl(n),o=n.method||"GET",s=this.buildRequestKey(i,o),a=this.getBackendProxyCandidates(i,o);let c,_;for(const l of a){const E=p=>p===i?l:p,h=r?Ue(e.signal):void 0;try{const p=await super.request({...n,proxyHandler:E,...h?{signal:h.signal}:{}});if(!p.ok&&this.shouldRetryResponse(p)&&l!==a[a.length-1]){_=p,P.get(s)===l&&P.delete(s);continue}return P.set(s,l),p}catch(p){P.get(s)===l&&P.delete(s);const g=h?.timeoutError();if(g)throw g;if(c=p,(p instanceof DOMException||p instanceof Error)&&p.name==="AbortError")throw p}finally{h?.done()}}if(_)return _;throw c instanceof Error?c:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=N(r),i=e.failoverAttemptTimeout??n,o=n?Fe(r):r?[k(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let s,a;for(let c=0;c<o.length;c++){const _=o[c],l=c===o.length-1;try{const E=await this.requestOnOrigin(e,_,i);if(!E.ok&&Ge(E.status)){if(a=E,!l){U(_,r);continue}break}return E.ok&&Ve(_,r),E}catch(E){if(!Xe(E))throw E;s=E,l||U(_,r)}}if(n&&$e(),a)return a;throw s instanceof Error?s:new Error("API origin failover chain failed")}};function We(e={},t){const r=new tn({...Zr,...e},t);return r.contentFormatters["multipart/form-data"]=Qr,r}var qe=f("rest.clientFactory"),rn=e=>{Kt(e);const t=We({customFetch:e.getInstance(J)?.execute||fetch},e);e.inject(Y,t)},Ke;(function(e){const t="https://racs.rest/v3";function r(i,o){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${i}&dataset=${document.location.hostname}`,s)}e.post=r;async function n(i,o=0){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${i}&dataset=${document.location.hostname}`,s)).json()}e.getAll=n})(Ke||(Ke={}));function w(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const a=e.length;if(t.length!==a)return!1;for(let c=0;c<a;c++)if(!w(e[c],t[c]))return!1}else if(n)return!1;const i=Object.keys(e),o=Object.keys(t),s=i.length;if(s!==o.length)return!1;for(let a=0;a<s;a++){const c=i[a];if(!t.hasOwnProperty(c)||!w(e[c],t[c]))return!1}}return!0}function nn(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}function ze(e){const[t,r,n]=e.split("."),i=JSON.parse(nn(r));return{exp:i.exp,createdAt:i.iat,data:i}}var re=f("plugin.auth.token"),Je=new WeakMap,on=3e4;function sn(e){let t;try{t=ze(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+on}function an(e,t,r,n){const i=Je.get(e);i&&(i.stale=!0);const o={stale:!1};Je.set(e,o),e.injectFactory(re,async(s,a)=>{if(o.stale)return"";try{let c=await a||void 0;if(!c){const _=e.getInstance(fe);_&&(c=await _)}return t?!c||sn(c)?await t(r,n,c):c:""}catch{return""}},!0)}var Ye=f("auth.oauthProvided"),Qe=new WeakMap;function Ze(e,t){const r=Qe.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!w(r.user,t.user)||r.project!==t.project)&&(Qe.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),an(e,t.getAuthToken,t.user,t.project))}function et(e){if(e.getInstance(Ye))return;e.inject(Ye,!0);let t;e.getInstance(le)?.watch(r=>{t=r}),e.addService(x,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(re)===void 0&&Ze(e,t);const i=await e.getInstanceAsync(re);i&&r.headers.set("authorization",`Bearer ${i}`)}})}var cn={text:{fontFamily:["Google Fonts","Sans Serif","Mulish","Regular"],fontSize:16,fontSizeDim:"px",lineHeight:24,lineHeightDim:"px",color:"#595959",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Google Fonts","Sans Serif","Mulish","Bold"],fontSize:28,fontSizeDim:"px",lineHeight:34,lineHeightDim:"px",color:"#000000",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},links:{color:"#1890ff",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Google Fonts","Sans Serif","Mulish","Medium"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1890ff",bold:!1,italic:!1,backgroundColor:"#1890ff",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:6,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1890ff",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1890ff",contrastTextColor:"#ffffff",baseBackgroundColor:"#f8f8f8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},tt="ERROR",un="useblocks",_n={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},ln="light",dn="dark",fn="(prefers-color-scheme: dark)",En={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_PREVIEW:"update_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_WINDOW_CHARACTERISTIC:"sandbox_window-characteristic",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_ADD_MERGETAG:"sandbox_add_mergetag",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme"},rt=e=>{const t={current:Promise.resolve(),state:e,decorate:(r,n)=>(n&&(r=r.bind(n)),function(...i){const o=t.current.then(()=>r(...i));return t.current=o.then(s=>{t.state=s},s=>{}),o})};return t};function ne(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function pn(e){return t=>{const r={},n=[];for(const s of e)n.push(s(t));for(const s of n)Object.assign(r,s.instance);return{instance:r,setOptions:async s=>{for(const a of n)await a.setOptions(s)},dispose:()=>{for(const s of n)s.dispose()}}}}function hn(e=tt){const t=new Error(e);return t.name="AuthPipelineError",t}async function On(e,t,r,n){const i=n?.attemptTimeout??N(r),o=N(r)?Fe(r):v(r).length>0?[k(r)]:[];if(o.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let a,c;for(let _=0;_<o.length;_++){const l=o[_],E=_===o.length-1,h=i?Ue(t.signal):void 0;try{const p=await fetch(`${l}${s}`,{...t,...h?{signal:h.signal}:{}});if(!p.ok&&Ge(p.status)){if(a=p,!E){U(l,r);continue}break}return p.ok&&Ve(l,r),p}catch(p){const g=h?.timeoutError();if(!g&&!Xe(p))throw p;c=g||p,E||U(l,r)}finally{h?.done()}}if(N(r)&&$e(),a)return a;throw c instanceof Error?c:new Error("[apiOriginFailover] fetch chain failed")}function nt(e){e.inject(C,void 0),e.inject(z,void 0)}var An=ne(e=>{let t,r;const n=rt();return e.addService(x,{execute:n.decorate(async(i,o)=>{if(o?.public||!t)return;const s=String(e.getInstance(z)||"").trim();if(s){i.headers.append("authorization",`Bearer ${s}`);return}if(!e.getInstance(C))try{const a=e.getInstance(qe),c=String(a?.getOptions()?.baseUrl||"").trim(),_=ke(r||c||void 0);if(!_)throw new Error("JWT auth requires baseUrl");const l=await On("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},_);if(!l.ok)throw new Error(`JWT auth failed: ${l.status}`);const E=await l.json(),h=String(E.token||"").trim();if(!h)throw new Error("JWT auth failed: empty token");e.inject(C,void 0),e.inject(z,h),i.headers.append("authorization",`Bearer ${h}`)}catch{throw e.inject(C,tt),hn()}})}),{setOptions(i){const o=i.jwtAuth,s=String(i.baseUrl||"").trim()||void 0,a=!w(o,t),c=s!==r;if(t=o,r=s,!o){nt(e);return}a||c?nt(e):e.inject(C,void 0)}}}),gn=ne(e=>(et(e),{setOptions(t){Ze(e,t)}}));function In(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;if(!i)continue;const o=ie(e,i);if(o)return o}return null}function it(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;i&&(t.push(i),it(i,t))}return t}function mn(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?ot(`#${In(n)}`,t,r):Promise.reject(S("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function ot(e,t,r){if(q(r),typeof e<"u"){if(typeof e=="string"){const n=e,i=ie(n);if(i)return i;const o=t.addDisposable(new I);return new Promise((s,a)=>{const c=O=>{o.dispose(),O()},_=()=>{c(()=>a(S(r?.reason)))};if(r?.aborted){_();return}r?.addEventListener("abort",_),o.addDispose(()=>r?.removeEventListener("abort",_));const l=document.body??document.documentElement;if(!l){c(()=>a(S("Document is not ready to observe mount element")));return}const E=new Set,h=new MutationObserver(()=>{const O=ie(n);if(O){c(()=>s(O));return}g()}),p=O=>{E.has(O)||(E.add(O),h.observe(O,{attributes:!0,childList:!0,subtree:!0}))},g=()=>{const O=document.documentElement;if(O)for(const G of it(O))p(G)};p(l),g(),o.addDispose(()=>h.disconnect())})}return e instanceof Element?mn(e,t,r):e}return e}var Tn=new Map;Object.defineProperty(u,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return ur}}),Object.defineProperty(u,"APP_ID",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(u,"APP_LOAD_EVENT_ID",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(u,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(u,"AsyncEmitter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(u,"BaseEmitter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(u,"COMMON_STYLES",{enumerable:!0,get:function(){return cn}}),Object.defineProperty(u,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(u,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(u,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return fr}}),Object.defineProperty(u,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return J}}),Object.defineProperty(u,"ContentType",{enumerable:!0,get:function(){return Xt}}),Object.defineProperty(u,"DARK",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(u,"DISPOSABLE_ID",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(u,"DependencyResolver",{enumerable:!0,get:function(){return W}}),Object.defineProperty(u,"Disposable",{enumerable:!0,get:function(){return I}}),Object.defineProperty(u,"ELEMENT_MAP",{enumerable:!0,get:function(){return Tn}}),Object.defineProperty(u,"EVENT_TYPES",{enumerable:!0,get:function(){return En}}),Object.defineProperty(u,"Emitter",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(u,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(u,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(u,"INSTANCE_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(u,"JWTMixin",{enumerable:!0,get:function(){return An}}),Object.defineProperty(u,"LATE_SURFACE_LISTENERS_ID",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(u,"LIGHT",{enumerable:!0,get:function(){return ln}}),Object.defineProperty(u,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return _n}}),Object.defineProperty(u,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(u,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return lr}}),Object.defineProperty(u,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return _r}}),Object.defineProperty(u,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return dr}}),Object.defineProperty(u,"MessageService",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(u,"OAuthMixin",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(u,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(u,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(u,"PORT_READY",{enumerable:!0,get:function(){return Oe}}),Object.defineProperty(u,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(u,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return pe}}),Object.defineProperty(u,"REQUEST_HANDLER_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(u,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return qe}}),Object.defineProperty(u,"REST_TRANSPORT_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(u,"SANDBOX_EXTENSIONS_ID",{enumerable:!0,get:function(){return or}}),Object.defineProperty(u,"SANDBOX_EXTENSION_SCRIPT_STATUS_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(u,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(u,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(u,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(u,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(u,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(u,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(u,"STORE_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(u,"Signal",{enumerable:!0,get:function(){return St}}),Object.defineProperty(u,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return Er}}),Object.defineProperty(u,"USEBLOCKS",{enumerable:!0,get:function(){return un}}),Object.defineProperty(u,"combineMixins",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(u,"composeAbortSignals",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(u,"createAbortError",{enumerable:!0,get:function(){return S}}),Object.defineProperty(u,"createIdentifier",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(u,"createIdentifier$1",{enumerable:!0,get:function(){return f}}),Object.defineProperty(u,"createQueue",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(u,"createTransport",{enumerable:!0,get:function(){return We}}),Object.defineProperty(u,"debounce",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(u,"decodeJwt",{enumerable:!0,get:function(){return ze}}),Object.defineProperty(u,"deepEqual",{enumerable:!0,get:function(){return w}}),Object.defineProperty(u,"defineMixin",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(u,"events",{enumerable:!0,get:function(){return K}}),Object.defineProperty(u,"filter",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(u,"generateUUID",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(u,"getActiveBaseUrl",{enumerable:!0,get:function(){return k}}),Object.defineProperty(u,"getApi",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(u,"getEmitter",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(u,"getEmitter$1",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(u,"getEvent",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(u,"getServiceContainerId",{enumerable:!0,get:function(){return M}}),Object.defineProperty(u,"isAbortError",{enumerable:!0,get:function(){return It}}),Object.defineProperty(u,"mapHttpStatusToErrorCode",{enumerable:!0,get:function(){return gt}}),Object.defineProperty(u,"mergeBackendProxyLayers",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(u,"mergeResourceProxyLayers",{enumerable:!0,get:function(){return Ir}}),Object.defineProperty(u,"mergeResourceProxyPolicyLayers",{enumerable:!0,get:function(){return Dr}}),Object.defineProperty(u,"mergeShallowConfigLayers",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(u,"provideOAuth",{enumerable:!0,get:function(){return et}}),Object.defineProperty(u,"raceWithAbortSignal",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(u,"registerRestTransport",{enumerable:!0,get:function(){return rn}}),Object.defineProperty(u,"releaseContainer",{enumerable:!0,get:function(){return Or}}),Object.defineProperty(u,"resolveContainer",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(u,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(u,"setApiOriginFailoverHook",{enumerable:!0,get:function(){return Yr}}),Object.defineProperty(u,"snapshot",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(u,"throwIfAborted",{enumerable:!0,get:function(){return q}}),Object.defineProperty(u,"waitForElement",{enumerable:!0,get:function(){return ot}})});
|
|
2093
|
+
__useblocks__.define("static/umd/b11043e6.js",["require","exports","module"],function(y,l,w){var p=Object.create,_=Object.defineProperty,i=Object.getOwnPropertyDescriptor,b=Object.getOwnPropertyNames,f=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,O=(e,r)=>()=>(r||(e((r={exports:{}}).exports,r),e=null),r.exports),v=(e,r)=>{let t={};for(var u in e)_(t,u,{get:e[u],enumerable:!0});return r||_(t,Symbol.toStringTag,{value:"Module"}),t},P=(e,r,t,u)=>{if(r&&typeof r=="object"||typeof r=="function")for(var c=b(r),o=0,s=c.length,n;o<s;o++)n=c[o],!a.call(e,n)&&n!==t&&_(e,n,{get:(j=>r[j]).bind(null,n),enumerable:!(u=i(r,n))||u.enumerable});return e},g=(e,r,t)=>(t=e!=null?p(f(e)):{},P(r||!e||!e.__esModule||!a.call(e,"default")?_(t,"default",{value:e,enumerable:!0}):t,e));Object.defineProperty(l,"__commonJSMin",{enumerable:!0,get:function(){return O}}),Object.defineProperty(l,"__exportAll",{enumerable:!0,get:function(){return v}}),Object.defineProperty(l,"__toESM",{enumerable:!0,get:function(){return g}})});
|
|
2094
|
+
|
|
2095
|
+
|
|
2096
|
+
__useblocks__.define("static/umd/e8914784.js",["require","exports","module"],function(Ln,c,vn){var m=class ct{_inner;_isDisposed=!1;constructor(t=[]){this._inner=t}addDisposable(t){return this._inner.push(t),t instanceof ct&&t.addDispose(()=>{this.removeDisposable(t)}),t}addDispose(t){this.addDisposable({dispose:t})}removeDisposable(t){const r=this._inner.indexOf(t);r>=0&&this._inner.splice(r,1)}isDisposed(){return this._isDisposed}dispose(){if(!this._isDisposed){this._isDisposed=!0;for(const t of[...this._inner])t.dispose()}}};function M(e){return`service_container_${e}`}var y=new Set,X;function ut(){if(!X)return;const e=new Error("getInstanceAsync"),t=Error;return typeof t.captureStackTrace=="function"&&t.captureStackTrace(e,se.prototype.getInstanceAsync),e.stack}function V(e){y.delete(e)&&X?.end(e)}var se=class oe extends m{_parent;_injectCallbacks=[];_injections=Object.create(null);_runCallbacks(t){[...this._injectCallbacks].forEach(r=>r(t))}constructor(t=null){super(),this._parent=t,t&&this.addDisposable(t.onInject(r=>this._runCallbacks(r)))}onInject=t=>(this._injectCallbacks.push(t),{dispose:()=>{const r=this._injectCallbacks.indexOf(t);r>=0&&this._injectCallbacks.splice(r,1)}});inject(t,r){this._injections[t]=()=>r,this._runCallbacks(t)}injectFactory(t,r,n){const i=this._injections[t];let o=typeof i=="function"?i():i;const s=this._injections[t]=()=>(o=r(this,o),o);n&&s(),this._runCallbacks(t)}_find(t,r=!0){return this._injections[t]||r&&this._parent?._find(t)}_onInject(t,r,n=new m){return n.addDisposable(this.onInject(i=>{t===i&&!n.isDisposed()&&(n.dispose(),r(this.getInstance(i)))})),this._parent&&n.addDisposable(this._parent._onInject(t,r,n)),this.addDisposable(n),n}getInstance(t,r=!0){const n=this._find(t,r);if(typeof n=="function")return n()}getOrCreateInstance(t,r){const n=this._find(t);if(typeof n=="function")return n();const i=r(this);return this.inject(t,i),i}getInstanceAsync(t){const r=this._find(t);if(typeof r=="function")return Promise.resolve(r());const n=ut();return new Promise((i,o)=>{const s={id:String(t),startedAt:Date.now(),origin:n,container:this,reject:o};y.add(s),X?.start(s),this._onInject(t,()=>{V(s),i(this.getInstance(t))})})}failPendingWaits(t){for(const r of Array.from(y))r.container===this&&(V(r),r.reject(t))}pendingWaits(){return[...y].filter(t=>t.container===this)}addService(t,r){const n=M(t);this.injectFactory(n,(o,s=[])=>s.indexOf(r)<0?[...s,r]:s);const i=new m;return i.addDispose(()=>{this.injectFactory(n,(o,s=[])=>s.filter(a=>a!==r))}),i}addServiceFactory(t,r,n){const i=M(t);let o;this.injectFactory(i,(a,u=[])=>(o=r(a,o),o===void 0?u:u.indexOf(o)<0?[...u,o]:u),n);const s=new m;return s.addDispose(()=>{this.injectFactory(i,(a,u=[])=>o===void 0?u:u.filter(_=>_!==o))}),s}getServices(t){const r=M(t);return[...this.getInstance(r,!1)||[],...this._parent?.getServices(t)||[]]}createChild(){return new oe(this)}getOrCreateIsolatedContainer(t){return this.getOrCreateInstance(t,()=>{const r=this._parent?.getOrCreateIsolatedContainer(t);return new oe(r)})}remove(t){const r=this._injections;delete r[String(t)]}injectListenerCount(){return this._injectCallbacks.length}dispose(){for(const t of Array.from(y))t.container===this&&V(t);this._injections=Object.create(null),this._injectCallbacks=[],super.dispose()}};function W(e){return e.startsWith("__")?e:`__${e}__`}function _t(e){if(typeof globalThis>"u")throw new Error("[di] globalThis is required for namespace container access.");const t=W(e),r=globalThis;return r[t]??={}}function lt(e){return e!=null&&typeof e=="object"&&typeof e.inject=="function"&&typeof e.getInstance=="function"}function dt(e){if(e)return W(e);const t="useblocks".trim();if(!t)throw new Error("[di] REACT_APP_NAME is required for resolveContainer().");return W(t)}function ae(e){const t=dt(e),r=_t(t);if(lt(r.container))return r.container;const n=new se(null);return r.container=n,n}function ft(e){return ae(e)}function Et(){let e=new Date().getTime(),t=typeof performance<"u"&&performance.now&&performance.now()*1e3||0;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(r){let n=Math.random()*16;return e>0?(n=(e+n)%16|0,e=Math.floor(e/16)):(n=(t+n)%16|0,t=Math.floor(t/16)),(r==="x"?n:n&3|8).toString(16)})}function ce(){return typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():Et()}function d(e=ce()){return e}function ue(){return"umd".trim()||"unknown"}function pt(e){if(typeof globalThis>"u")return;const t=ue(),r=globalThis[e]??{};globalThis[e]=r;const n=r.__diagnostics??={},i=n.diModuleEval??={evalCount:0,records:[]};i.records.push({buildSource:t,timestamp:Date.now(),stack:new Error().stack}),i.evalCount+=1}function ht(){const e="useblocks".trim();if(!e)throw new Error("[di] REACT_APP_NAME is required for DependencyResolver diagnostics.");return`__${e}__`}function Ot(e,t){if(pt(t),typeof globalThis>"u")return e;const r=ue(),n=globalThis,i=n[t]=n[t]||{},o=i.__diagnostics=i.__diagnostics||{},s=o.dependencyResolver=o.dependencyResolver||{entries:[]},a={container:e,source:"packages/runtime-core/di/index.ts",buildSource:r,timestamp:Date.now(),stack:new Error().stack};return s.entries.push(a),e}var j;function gt(){if(j)return j;const e=ht();return j=Ot(ae(e),e),j}var $=new Proxy({},{get(e,t,r){const n=gt(),i=Reflect.get(n,t,r);return typeof i=="function"?i.bind(n):i}});function At(e,t="BackendError"){switch(e){case 400:return"ValidationError";case 401:return"AuthenticationFailed";case 403:return"AuthorizationFailed";case 404:return"FileNotFound";case 413:return"PayloadTooLarge";case 415:return"UnsupportedMediaType";case 429:return"RateLimitExceeded";case 500:return"BackendError";case 503:return"ServiceUnavailable";case 504:return"Timeout";default:return t}}function S(e){if(e instanceof DOMException&&e.name==="AbortError")return e;const t=e===void 0?"The operation was aborted.":typeof e=="string"?e:e instanceof Error?e.message:String(e);return new DOMException(t,"AbortError")}function mt(e){return e instanceof DOMException&&e.name==="AbortError"}function q(e){if(e?.aborted)throw S(e.reason)}function It(e,t){return t?(t.aborted&&e.catch(()=>{}),q(t),new Promise((r,n)=>{const i=()=>{o(),n(S(t.reason))},o=()=>{t.removeEventListener("abort",i)};t.addEventListener("abort",i),e.then(s=>{o(),r(s)},s=>{o(),n(s)})})):e}var _e=class extends m{_options;_listeners=[];constructor(e={}){super(),this._options=e}getListeners(e){return this._listeners.flatMap(([t])=>typeof t=="function"?t:t.getListeners(e))}hasListeners(){for(const[e]of this._listeners){if(typeof e=="function")return!0;const t=e;if(typeof t.hasListeners=="function"){if(t.hasListeners())return!0;continue}return!0}return!1}_addListener(e,t=0,r){if(this.isDisposed())return{dispose:()=>{}};const n=this._listeners,i=this._options;r&&typeof e=="function"&&(e=e.bind(r));const o=n.findIndex(([,a])=>a<t),s=[e,t];return n.splice(o>=0?o:n.length,0,s),n.length===1&&i.onFirstListenerAdd&&i.onFirstListenerAdd(),{dispose:()=>{const a=n.indexOf(s);a>=0&&(n.splice(a,1),!n.length&&i.onLastListenerRemove&&i.onLastListenerRemove())}}}on=this._addListener.bind(this);event=this._addListener.bind(this);once=(e,t=0,r)=>{const n=this._addListener((...i)=>(n?.dispose(),r?e.call(r,...i):e(...i)),t);return n};un=e=>{const t=this._listeners.findIndex(([r])=>r===e);t>=0&&(this._listeners.splice(t,1),this._listeners.length===0&&this._options.onLastListenerRemove&&this._options.onLastListenerRemove())};dispose(){this._listeners.splice(0,this._listeners.length),this._options.onLastListenerRemove&&this._options.onLastListenerRemove(),super.dispose()}},b=class extends _e{execute(e,t){for(const r of t)try{r(...e)}catch{}}fire(...e){if(!this.isDisposed()){const t=this.execute(e,this.getListeners(e));return t===void 0?void 0:t}}},Tt=class extends b{execute([e],t){for(const r of t)try{r(e)}catch{}}},St=class extends b{_suspendCounter=0;_wasFired=!1;execute([e],t){if(this._suspendCounter)this._wasFired=!0;else for(const r of t)try{r(e)}catch{}}suspend(){this._suspendCounter++}resume(){--this._suspendCounter===0&&this._wasFired&&(this.fire(),this._wasFired=!1)}},B=class extends b{async execute([e],t){const r=[];for(const n of t)try{r.push(await n(e))}catch{}return r}async fireSettled(e){const t={results:[],errors:[]};if(this.isDisposed())return t;for(const r of this.getListeners([e]))try{t.results.push(await r(e))}catch(n){t.errors.push(n)}return t}};function bt(e,t=0){const r=new _e,n=e(r,t);return n&&r.addDisposable(n),r.event}function Dt(e,t,r=0){const n=new b,i=e((...o)=>{if(t(...o))return n.fire(...o)},r);return i&&n.addDisposable(i),n.event}function Nt(e,t=0,r=0){const n=new b;let i,o;const s=e((...a)=>{o=a,i||(i=setTimeout(()=>{o&&n.fire(...o),i=void 0},t))},r);return s&&n.addDisposable(s),n.event}function Pt(e,t){return e.getOrCreateInstance(t,()=>new B)}function f(e){return d(e)}var K;(function(e){e.BEFORE_SAVE_EMAIL=f("events.BEFORE_SAVE_EMAIL"),e.ON_SAVEBUTTON_CLICK_ID=f("events.ON_SAVEBUTTON_CLICK_ID"),e.ON_NEXTBUTTON_CLICK_ID=f("events.ON_NEXTBUTTON_CLICK_ID"),e.ON_PREVIOUSBUTTON_CLICK_ID=f("events.ON_PREVIOUSBUTTON_CLICK_ID"),e.ON_DOCUMENT_SESSION_CHANGE=f("events.ON_DOCUMENT_SESSION_CHANGE"),e.WILL_EMAIL_INIT_ID=f("events.WILL_EMAIL_INIT_ID"),e.ON_EMAIL_INIT_ID=f("events.ON_EMAIL_INIT_ID"),e.ON_BLOCK_INIT_ID=f("events.ON_BLOCK_INIT_ID"),e.ON_CONTENT_CHANGED_ID=f("events.ON_CONTENT_CHANGED_ID"),e.ON_PREHEADER_CHANGED_ID=f("events.ON_PREHEADER_CHANGED_ID"),e.ON_SUBJECT_CHANGED_ID=f("events.ON_SUBJECT_CHANGED_ID"),e.ON_EMAIL_CHANGED_ID=f("events.ON_EMAIL_CHANGED_ID"),e.ON_HEADER_APPLIED_ID=f("events.ON_HEADER_APPLIED_ID"),e.ON_BLOCK_CHANGED_ID=f("events.ON_BLOCK_CHANGED_ID"),e.ON_CHUNKS_LOADED=f("events.ON_CHUNKS_LOADED"),e.ON_SEND_TESTEMAIL_ID=f("events.ON_SEND_TESTEMAIL_ID"),e.ON_SEND_LIVEPREVIEW_ID=f("events.ON_SEND_LIVEPREVIEW_ID"),e.ON_SHARE_ID=f("events.ON_SHARE_ID"),e.ON_SHOW_PREVIEW_ID=f("events.ON_SHOW_PREVIEW_ID"),e.ON_EMAIL_CLONE_ID=f("events.ON_EMAIL_CLONE_ID"),e.ON_SEND_EMAIL_MODAL_ID=f("events.ON_SEND_EMAIL_MODAL_ID"),e.ON_NOTIFICATION=f("events.ON_NOTIFICATION"),e.READ_LOCALE=f("events.READ_LOCALE"),e.ON_TRANSLATE_ID=f("events.ON_TRANSLATE_ID"),e.ON_CODE_VALIDATE_ID=f("events.ON_CODE_VALIDATE_ID"),e.UPLOAD_EVENT_ID=f("events.UPLOAD_EVENT_ID"),e.PROXY_URL_EVENT_ID=f("events.PROXY_URL_EVENT_ID"),e.FILE_PROXY_EVENT_ID=f("events.FILE_PROXY_EVENT_ID"),e.ON_LIMIT_ID=f("events.ON_LIMIT_ID"),e.ON_BROWSER_EXTENSION_DETECTED_ID=f("events.ON_BROWSER_EXTENSION_DETECTED_ID"),e.ON_LAYOUT_CONVERT_REQUEST_ID=f("events.ON_LAYOUT_CONVERT_REQUEST_ID"),e.ON_BROWSER_TRANSLATE_DETECTED_ID=f("events.ON_BROWSER_TRANSLATE_DETECTED_ID"),e.AI_TEXT_REQUEST_ID=f("events.AI_TEXT_REQUEST_ID"),e.AI_IMAGE_REQUEST_ID=f("events.AI_IMAGE_REQUEST_ID"),e.AI_TEXT_PROGRESS_ID=f("events.AI_TEXT_PROGRESS_ID"),e.AI_IMAGE_PROGRESS_ID=f("events.AI_IMAGE_PROGRESS_ID"),e.AI_TEXT_STREAM_ID=f("events.AI_TEXT_STREAM_ID")})(K||(K={}));function yt(e,t){return e.getOrCreateInstance(t,()=>new B).event}function Ct(e,t){return e.getOrCreateInstance(t,()=>new B)}var Lt=d("plugin.app"),vt=d("plugin.disposable"),Rt=d("InitPipelineContext"),wt=d("plugin.instance"),Mt=d("plugin.lateSurfaceListeners"),le=d("plugin.optionsSource"),jt=d("plugin.store"),de=d("ConfigSource"),Bt=d("plugin.standalone.project"),fe=d("plugin.standalone.bootstrapToken"),Rn=d("plugin.element"),Ee=d("plugin.securityModule"),xt=d("plugin.standalone.activated"),Ft=d("plugin.standalone.fileProxyRegistered"),z=d("plugin.jwt.token"),C=d("plugin.jwt.error"),kt=d("PluginCollection"),Ut=f("APP_LOAD_EVENT"),Gt=f("CONFIG_CHANGED_EVENT");function Ht(e,t=window){return{peer:e,send(r){e.postMessage(r,"*")},subscribe(r){const n=i=>{r({data:i.data,source:i.source,ports:i.ports})};return t.addEventListener("message",n),{dispose:()=>t.removeEventListener("message",n)}},close(){}}}function Xt(e){let t=!1;return{peer:e,send(r){e.postMessage(r)},subscribe(r){const n=i=>{r({data:i.data,source:e})};return e.addEventListener("message",n),t||(t=!0,e.start()),{dispose:()=>e.removeEventListener("message",n)}},close(){e.close()}}}function Vt(e){return e}function Wt(e){return e&&typeof e=="object"}function pe(e,t){return e&&typeof e=="object"&&e.operationId===t}var T="INIT_MESSAGE",he="em:port-ready",$t="em:window-drained",J="";function Oe(){return Math.random().toString(36).substring(2,15)+Math.random().toString(36).substring(2,15)}var qt=class extends m{_listeners=Object.create(null);addListenerAsync=(e,t,r=0,n)=>{const i=this._listeners[e]||(this._listeners[e]=[]);n&&typeof t=="function"&&(t=t.bind(n));const o=i.findIndex(([a,u])=>r<=u),s=[t,r];return this.isDisposed()||i.splice(o>=0?o:i.length,0,s),{dispose(){const a=i.indexOf(s);a>=0&&i.splice(a,1)}}};fireAsync=(e,t)=>{if(!this.isDisposed()){const r=this._listeners[e]||(this._listeners[e]=[]);let n;for(let i=0;i<r.length;i++){const o=r[i][0],s=n;n=a=>o(a,s)}if(n)return n(t)}};addListener=(e,t,r=0)=>this.addListenerAsync(e,(n,i)=>{try{t(n)}catch{}return i&&i(n)},r)},Kt=class extends m{_singleton;_target;_transport;_transportSubscription;_ports=new Map;_drained=new WeakSet;_portSendHeld=new WeakSet;_inited=!1;_emitter=this.addDisposable(new qt);_handshaken=new WeakSet;_greeted=new WeakSet;_outgoingFilter;_outgoingObservers=new Set;_offTargetListeners=new Map;constructor(e,t){super(),this._singleton=t,this._transport=Ht({postMessage:()=>{}},window),this._transportSubscription=this.addDisposable(this._transport.subscribe(this._onTransportMessage)),this.addListener(T,()=>{this._inited||(this._inited=!0,this._target&&this._handshaken.add(this._target),this.send(T))}),e&&this.setTarget(e)}_onTransportMessage=e=>{const t=e,r=t.data,n=t.source,i=r?.port===!0?t.ports?.[0]:void 0,o=!this._isPortSource(t.source);if(o&&n&&r?.operationId==="em:window-drained"){this._ports.has(n)&&this._drained.add(n);return}if(o&&n&&this._drained.has(n))return;if(n&&n!==this._target&&this._greeted.has(n)&&pe(r,T)){this._greeted.delete(n),this._handshaken.add(n),this._postMessage(n,{operationId:T,data:{}}),i&&this.usePort(i,!0,n);return}const s=t.source===this.target||this._isCurrentPort(t.source);if(s||this._notifyOffTarget(r?.operationId,t.source),Wt(r)&&s||this._singleton&&pe(r,T)){if(i&&s){const l=this._target;Promise.resolve().then(()=>this.usePort(i,!0,l))}const a=this._emitter.fireAsync(r.operationId||J,r.operationId===void 0?t:r.data),u=r.result,_=r.error;u&&_&&Promise.resolve(a).then(l=>this._sendMessage(u,l),l=>this._sendMessage(_,l))}};setTarget(e){if(this._target!==e){if(this._target=e,!e){this._inited=!1;return}if(this._handshaken.has(e)){this._inited=!0,this._emitter.fireAsync(T,void 0);return}this._inited=!1,this._postMessage(e,{operationId:T,data:{}})}}sendPort(e,t){this._postMessage(e,{operationId:T,data:{},port:!0},[t])}observeOutgoing(e){return this._outgoingObservers.add(e),{dispose:()=>{this._outgoingObservers.delete(e)}}}_notifyOutgoing(e,t){for(const r of Array.from(this._outgoingObservers))try{r(e,t)}catch{}}addOffTargetListener(e,t){let r=this._offTargetListeners.get(e);return r||(r=new Set,this._offTargetListeners.set(e,r)),r.add(t),{dispose:()=>{r.delete(t)}}}_notifyOffTarget(e,t){const r=typeof e=="string"?this._offTargetListeners.get(e):void 0,n=r?.size?this._knownPeer(t):void 0;if(!(!r||!n))for(const i of Array.from(r))try{i(n)}catch{}}_knownPeer(e){for(const[r,n]of this._ports)if(n.transport.peer===e)return r;const t=e;return typeof e=="object"&&e!==null&&(this._handshaken.has(t)||this._greeted.has(t))?t:void 0}setOutgoingFilter(e){return this._outgoingFilter=e,()=>{this._outgoingFilter===e&&(this._outgoingFilter=void 0)}}sendNow(e){const t=this._target;return!this._inited||!t?!1:(this._postMessage(t,e),!0)}greet(e){this._handshaken.has(e)||this._greeted.has(e)||this._target===e||(this._greeted.add(e),this._postMessage(e,{operationId:T,data:{}}))}forget(e){this._handshaken.delete(e),this._greeted.delete(e),this._closePort(e),this._drained.delete(e),this._target===e&&(this._inited=!1)}usePort(e,t=!1,r=this._target){if(!r||this._ports.has(r))return;const n=Xt(e),i=n.subscribe(this._onTransportMessage);this._ports.set(r,{transport:n,subscription:i}),t&&(n.send({operationId:he,data:{}}),this.drainWindow(r))}holdPort(e=this._target){!e||!this._ports.has(e)||(this._portSendHeld.add(e),this._drained.delete(e))}resumePort(e=this._target){e&&this._portSendHeld.delete(e)}useWindow(e=this._target){e&&(this._closePort(e),this._drained.delete(e))}get usesPort(){return this._target!==void 0&&this._ports.has(this._target)&&!this._portSendHeld.has(this._target)}hasPort(e,t){const r=this._ports.get(e);return r!==void 0&&(t===void 0||r.transport.peer===t)}_closePort(e){const t=this._ports.get(e);t&&(t.subscription.dispose(),t.transport.close(),this._ports.delete(e),this._portSendHeld.delete(e))}drainWindow(e){this._ports.has(e)&&e.postMessage({operationId:$t,data:{}},"*")}isWindowDrained(e){return this._drained.has(e)}_isPortSource(e){for(const t of this._ports.values())if(t.transport.peer===e)return!0;return!1}_isCurrentPort(e){return this._target!==void 0&&this._ports.get(this._target)?.transport.peer===e}getTarget(){return this._target}get target(){return this._target}_postMessage(e,t,r){let n=t;this._outgoingFilter&&!r?.length&&(n="data"in t?{...t,data:this._outgoingFilter(t.data)}:this._outgoingFilter(t));try{const i=this._ports.get(e);if(i&&!this._portSendHeld.has(e)){i.transport.send(n);return}if(r?.length){e.postMessage(n,"*",r);return}e.postMessage(n,"*")}catch(i){if(i?.name==="DataCloneError"){const o=typeof n?.data=="object"&&n?.data!==null?n.data:void 0}throw i}}_sendMessage(e,t,r=!0){if(!r&&!this.isInited())return;e&&this._notifyOutgoing(e,t);const n=this.addDisposable(this.onInit(i=>{const o=e?{operationId:e,data:t}:t;try{this._postMessage(i,{...o})}finally{n.dispose()}}))}send(e,t,r){return typeof e=="string"?this._sendMessage(e,t,r):this._sendMessage(J,e,t)}sendAsync(e,t,r=!0){if(!r&&!this.isInited())return Promise.resolve();this._notifyOutgoing(e,t);const n=Oe(),i=Oe();return new Promise((o,s)=>{const a=this.addDisposable(new m);a.addDisposable(this.onInit(u=>{try{this._postMessage(u,{operationId:e,data:t,result:n,error:i})}catch(_){a.dispose(),s(_);return}a.addDisposable(this._onMessage(n,_=>{o(_),a.dispose()})),a.addDisposable(this._onMessage(i,_=>{s(_),a.dispose()}))}))})}_onMessage(e,t,r=0){return this._emitter.addListener(e,t,r)}addListener(e,t,r){return t?this._onMessage(e,t,r):this._onMessage(J,e)}addListenerAsyncPipe(e,t,r=0){return this._emitter.addListenerAsync(e,t,r)}addListenerAsync(e,t,r=0){return this._emitter.addListenerAsync(e,async(n,i)=>{const o=await t(n);return i?i(n):o},r)}isInited(){return this._inited}get inited(){return this._inited}onInit(e,t=!0,r=0){const n=this.addDisposable(new m);return this._inited&&this._target?t&&Promise.resolve().then(()=>{!this._inited||!this._target?n.addDisposable(this.onInit(e,t,r)):e(this._target)}):n.addDisposable(this._onMessage(T,()=>{e(this._target)},r)),n}dispose(){for(const e of Array.from(this._ports.keys()))this._closePort(e);this._transport.close(),super.dispose()}};function L(e){return d(e)}var zt=d("extensions.atomsHandlers"),Jt=L("HANDLE_ATOM_INSERT"),Yt=d("HeadlessMode"),Qt=d("extensions.sandboxExtensions"),Zt="SANDBOX_EXTENSION_SCRIPT_STATUS",er=d("MESSAGE_SERVICE"),tr=L("SETTINGS_PANEL_EVENT"),rr="advanced",nr=L("MODAL_SHOW_EVENT"),ir=L("MODAL_CLOSE_EVENT"),or=L("MODAL_UPDATE_EVENT"),wn=d("client"),Mn=d("v2_client"),jn=d("ai_client"),sr=d("app.cookieManager"),Bn=d("app.storageProvider"),xn=d("image-blob-resolver"),ar=d("template-directives"),cr=(function(e){return e.Json="application/json",e.FormData="multipart/form-data",e.UrlEncoded="application/x-www-form-urlencoded",e.Text="text/plain",e})({}),ur=class{baseUrl="https://api.emailmaker.ru/wp-json";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(r=>this.encodeQueryParam(t,r)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(r=>typeof t[r]<"u").map(r=>Array.isArray(t[r])?this.addArrayQueryParam(t,r):this.addQueryParam(t,r)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>Object.keys(e||{}).reduce((t,r)=>{const n=e[r];return t.append(r,n instanceof Blob?n:typeof n=="object"&&n!==null?JSON.stringify(n):`${n}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const r=this.abortControllers.get(e);return r?r.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};async request({body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:u,proxyHandler:_,...l}){const E=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},h=this.mergeRequestParams(l,E);u&&(i=i?{...i,...u}:u);const p=i&&this.toQueryString(i),A=this.contentFormatters[n||"application/json"],O=o||h.format,G=`${s||this.baseUrl||""}${r}${p?`?${p}`:""}`,yn=_?_(G,{body:e,secure:t,path:r,type:n,query:i,format:o,baseUrl:s,cancelToken:a,extraQuery:u,proxyHandler:_,...l}):G,st=new Request(yn,{...h,headers:{...h.headers||{},...n&&n!=="multipart/form-data"?{"Content-Type":n}:{}},signal:(a?this.createAbortSignal(a):h.signal)||null,body:typeof e>"u"||e===null?null:A(e)});return this.customFetch(st).then(async at=>{const I=at;I.data=null,I.error=null,I.meta={request:st,response:I};const Cn=O?await at[O]().then(H=>(I.ok?I.data=H:I.error={data:H},I)).catch(H=>(I.error=H,I)):I;return a&&this.abortControllers.delete(a),Cn})}},_r=d("prewarm.networkActivity");function lr(){let e=0;const t=new Set,r=()=>{t.forEach(n=>n())};return{begin(){e+=1,r();let n=!1;return()=>{n||(n=!0,e-=1,r())}},inFlight:()=>e,watch(n){return t.add(n),()=>t.delete(n)}}}function dr(e){return e.getOrCreateInstance(_r,()=>lr())}var ge=Symbol("rest.publicRequest"),x=d("rest.requestHandler"),fr=d("rest.responseHandler"),Y=d("rest.customFetch"),Er=(e,t)=>fetch(e,t),Q=d("rest_transport"),pr=e=>{e.inject(Y,{execute:async(t,r={})=>{const n=e.getServices(x),i={public:r[ge]===!0},o=dr(e).begin();try{let s=t instanceof Request?t:new Request(t,r);for(const _ of n){const l=await _.execute(s,i);l instanceof Request&&(s=l)}let a=await fetch(s);const u=e.getServices(fr);for(const _ of u)a=await _.execute(a,s);return a}finally{o()}}})};function hr(e,t){const r=e.getInstance(Q);if(!r)throw new Error("[restApi] транспорт не зарегистрирован в контейнере");return Object.assign({},...t.map(n=>new n(r)))}var Or="INJECTION";function gr(e){return e.getState}function Ar(e){if(!gr(e)){e.dispose();return}const t=e.getState()[Or];t&&($.getInstance(t)?.dispose(),$.remove(t))}function mr(e,t){for(const r of e)if(r&&t in r)return r[t]}function Ae(e){return Object.assign({},...e)}var me=["generic","stockImages","emFiles","cdn"];function Z(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Ie(e){return!Z(e)||"match"in e||"rewrite"in e||"proxyBase"in e?!1:Object.keys(e).some(t=>me.includes(t))}function Te(e){return e.length===0?[]:e.length===1?e[0]:e}function Se(e){let t=!1,r=[];for(const n of e)if(n!==void 0){if(t=!0,Array.isArray(n)){r=[...n,...r];continue}r=[n,...r]}if(t)return Te(r)}function Ir(e){return Z(e)&&("value"in e||"replace"in e)}function be(e,t){return t===void 0?e:Array.isArray(t)?[...t,...e]:[t,...e]}function Tr(e){let t=!1,r=[],n=!1;for(const o of e)if(o!==void 0){if(Ir(o)){t=!0,o.replace&&(r=[],n=!0),o.value!==void 0&&(r=be(r,o.value),n=!0);continue}r=be(r,o),n=!0}const i=n?Te(r):void 0;if(!t)return i;if(i!==void 0)return{value:i}}function Sr(e){const t=e.filter(n=>n!==void 0);if(t.length===0)return;if(!t.some(n=>Ie(n)))return Se(t);const r={};for(const n of me){const i=Tr(e.map(o=>{if(o!==void 0)return Ie(o)?o[n]:n==="generic"?o:void 0}));i!==void 0&&(r[n]=i)}return Object.keys(r).length>0?r:void 0}function br(e){return Se(e)}function Dr(e){if(e!==void 0){if(Array.isArray(e))return{replace:!1,hosts:e};if(Z(e)&&Array.isArray(e.value))return{replace:!!e.replace,hosts:e.value}}}function Nr(e,t){const r=[...e],n=new Set(r.map(i=>i.toLowerCase()));for(const i of t){const o=i.trim().replace(/:\d+$/,"");if(!o)continue;const s=o.toLowerCase();n.has(s)||(n.add(s),r.push(o))}return r}function Pr(e){let t=[],r=!1;for(const n of e){const i=Dr(n);i&&(r=!0,i.replace&&(t=[]),t=Nr(t,i.hosts))}return r?t:void 0}function yr(e){const t=e.filter(i=>i!==void 0);if(t.length===0)return;const r=Ae(t.map(({directHosts:i,...o})=>o)),n=Pr(t.map(i=>i?.directHosts));return n!==void 0&&(r.directHosts=n),r}function ee(e){return e?.backendProxy}function v(e){return e.replace(/\/$/,"")}function De(e){return/^https?:\/\//i.test(e)}function Ne(e){return!!e&&typeof e=="object"&&!Array.isArray(e)}function Cr(e){const t=new Set;return e.filter(r=>!r.url||t.has(r.url)?!1:(t.add(r.url),!0))}function Lr(e){const t=ee(e);return t?[t]:[]}function vr(e){return{proxyEmFiles:!0,proxyAi:!1}}function Rr(e,t){const r=vr(t),n=t?.backendProxyPolicy;switch(e){case"emFiles":return n?.proxyEmFiles??r.proxyEmFiles;case"ai":return n?.proxyAi??r.proxyAi;default:return!0}}var wr={url:".+",url_encoded:".+",origin:"https?:\\/\\/[^\\/?#]+",origin_encoded:".+",proxy_url:"https?:\\/\\/[^\\/?#]+",proxy_url_encoded:".+",path:"[^?#]*",pathname:"[^?#]*",path_with_slash:"\\/[^?#]*",pathname_with_slash:"\\/[^?#]*",query:"[^#]*",search:"\\?[^#]*",hash:"#.*",fragment:".*",pathname_after_wp_json:"[^?#]*",pathname_after_wp_json_with_slash:"\\/[^?#]*",rest_namespace:"[^/?#]*",rest_version:"[^/?#]*",rest_route:"[^?#]*",rest_route_with_slash:"\\/[^?#]*"};function Mr(e){const t=[],r=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/\\\{([a-z_]+)\\\}/gi,(n,i)=>(t.push(i),`(${wr[i]||".+"})`));return{regex:new RegExp(`^${r}$`,"i"),tokens:t}}function jr(e){return/[?#]/.test(e)||/\{(?:url|url_encoded|query|search|hash|fragment)\}/i.test(e)}function Br(e,t){if(jr(t))return e;try{const r=new URL(e);return`${r.origin}${r.pathname}`}catch{return e.split(/[?#]/)[0]||e}}function xr(e,t,r){if(r.endsWith("_encoded"))return!0;const n=e.slice(0,t),i=n.lastIndexOf("#"),o=n.lastIndexOf("?"),s=n.lastIndexOf("&"),a=n.lastIndexOf("=");return a>Math.max(o,s)&&a>i}function Fr(e){try{const t=new URL(e),r=t.pathname.replace(/^\/+/,""),n=t.search.replace(/^\?/,""),i=t.hash.replace(/^#/,""),o=r.replace(/^wp-json\/?/i,""),s=o?`/${o}`:"/",a=o.match(/^([^/]+)(?:\/([^/]+))?(?:\/(.*))?$/),u=a?.[1]||"",_=a?.[2]||"",l=a?.[3]||"";return{url:e,url_encoded:encodeURIComponent(e),origin:t.origin,origin_encoded:encodeURIComponent(t.origin),proxy_url:t.origin,proxy_url_encoded:encodeURIComponent(t.origin),path:r,pathname:r,path_with_slash:t.pathname||"/",pathname_with_slash:t.pathname||"/",query:n,search:t.search,hash:t.hash,fragment:i,pathname_after_wp_json:o,pathname_after_wp_json_with_slash:s,rest_namespace:u,rest_version:_,rest_route:l,rest_route_with_slash:l?`/${l}`:"/"}}catch{return}}function te(e,t){if(!e)return{};if(Array.isArray(e)){for(const a of e){const u=te(a,t);if(u!==void 0)return u}return}if(e==="*")return{};const r=Br(t,e),{regex:n,tokens:i}=Mr(e),o=n.exec(r);if(!o)return;const s={};return i.forEach((a,u)=>{s[`matched_${a}`]=o[u+1]||""}),s}function F(e,t,r={}){const n=Fr(t);if(!n)return t;const i={...n,...r};let o="",s=0;const a=/\{([a-z_]+)\}/gi;let u;for(;u=a.exec(e);){o+=e.slice(s,u.index);const _=i[u[1]]??"",l=xr(e,u.index,u[1])?encodeURIComponent(_):_;o+=l,s=u.index+u[0].length}o+=e.slice(s);try{const _=new URL(o),l=new URL(t);return!o.includes("{search}")&&!o.includes("{query}")&&l.search&&l.searchParams.forEach((E,h)=>{_.searchParams.has(h)||_.searchParams.append(h,E)}),!o.includes("{hash}")&&!o.includes("{fragment}")&&l.hash&&!_.hash&&(_.hash=l.hash),_.toString()}catch{return o}}function Pe(e,t){try{const r=new URL(t);return`${v(e)}/${r.pathname.replace(/^\//,"")}${r.search}${r.hash}`}catch{return t}}function ye(e,t){const r=v(e);return t?De(t)?t:t.startsWith("?")||t.startsWith("#")?`${r}${t}`:`${r}${t.startsWith("/")?"":"/"}${t}`:r}function Ce(e,t,r,n){const i=e.match;return i?Array.isArray(i)?i.some(o=>Ce({...e,match:o},t,r,n)):typeof i=="function"?!!i({url:t,method:n,requestType:r}):i==="*"?!0:te(i,t)!==void 0:!0}function kr(e,t,r,n="generic"){if(e==null)return[];const i=Array.isArray(e)?e:[e],o=[];return i.forEach((s,a)=>{if(!s)return;if(typeof s=="string"){const E=s.includes("{")&&s.includes("}")?F(s,t):Pe(s,t);o.push({key:`backend:${a}`,url:E,source:"resource"});return}if(!Ne(s)||!("rewrite"in s))return;const u=s;if(!Ce(u,t,n,r))return;const _=typeof u.match=="string"||Array.isArray(u.match)?te(u.match,t)||{}:{},l=typeof u.proxyBase=="string"&&u.proxyBase.trim()?u.proxyBase.trim():void 0;(Array.isArray(u.rewrite)?u.rewrite:[u.rewrite]).filter(Boolean).forEach((E,h)=>{const p=typeof E=="function"?(()=>{const A=E({url:t,proxyBase:l,method:r,requestType:n,..._}),O=l&&!De(A)?ye(l,A):A;return O.includes("{")&&O.includes("}")?F(O,t,_):O})():l?F(ye(l,E),t,_):E.includes("{")&&E.includes("}")?F(E,t,_):Pe(E,t);o.push({key:`backend:${u.id||"rule"}:${a}:${h}`,url:p,source:"resource"})})}),Cr(o)}function Ur(e){try{const t=new URL(e);return/(?:^|\/)wp-json\/em-files\/v\d+(?:\/|$)/i.test(t.pathname)?"emFiles":/(?:^|\/)wp-json\/ai-generator\/v\d+(?:\/|$)/i.test(t.pathname)?"ai":"generic"}catch{return"generic"}}function Gr(e,t=[]){return e==null||(Array.isArray(e)?e:[e]).forEach(r=>{if(r){if(typeof r=="string"){const n=r.split("{")[0]?.trim();n&&t.push(v(n));return}!Ne(r)||!("rewrite"in r)||(typeof r.proxyBase=="string"&&r.proxyBase.trim()&&t.push(v(r.proxyBase.trim())),(Array.isArray(r.rewrite)?r.rewrite:[r.rewrite]).forEach(n=>{if(typeof n!="string")return;const i=n.split("{")[0]?.trim();i&&t.push(v(i))}))}}),t}function Hr(e,t){return Lr(t).flatMap(r=>Gr(r)).filter(Boolean).some(r=>r&&e.startsWith(r))}function Xr(e,t){return!!ee(t)&&Rr(e,t)}function Vr(e,t={}){const r=t.requestType||Ur(e);return Xr(r,t.config)?kr(ee(t.config),e,t.method,r):[]}function Wr(e,t={}){return Hr(e,t.config)?[e]:Vr(e,t).map(r=>r.url)}function D(e){for(;e.endsWith("/");)e=e.slice(0,e.length-1);return/\/wp-json$/i.test(e)?e:`${e}/wp-json`}function Le(...e){const t=e.filter(o=>o!=null);if(t.length===0)return;if(t.length===1)return t[0];const r=t.find(o=>o.aborted);if(r)return r;if(typeof AbortSignal<"u"&&typeof AbortSignal.any=="function")return AbortSignal.any(t);const n=new AbortController,i=o=>{n.signal.aborted||n.abort(o.reason)};for(const o of t)o.addEventListener("abort",()=>i(o),{once:!0});return n.signal}var ve=3e5,Re=15e3,g=null,we=!1;function $r(){return!0}function qr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_TTL_MS||"").trim();if(!e)return ve;const t=Number(e);return Number.isFinite(t)&&t>0?t:ve}function Kr(){const e=String({}.REACT_APP_OPENAPI_FAILOVER_ATTEMPT_TIMEOUT_MS||"").trim();if(!e)return Re;const t=Number(e);return Number.isFinite(t)&&t>0?t:Re}function zr(){const e="https://app.useblocks.io/api".trim();return e?D(e):void 0}function Jr(e){const t=e.trim();if(!t)return[];if(t.startsWith("["))try{const r=JSON.parse(t);if(!Array.isArray(r))throw new Error("expected JSON array");return r.map(n=>String(n).trim()).filter(Boolean)}catch{return we||(we=!0),[]}return t.split(",").map(r=>r.trim()).filter(Boolean)}function Yr(e){const t=new Set,r=[];for(const n of e){const i=D(n);t.has(i)||(t.add(i),r.push(i))}return r}function Me(e){const t=String(e||"").trim();return t?D(t):zr()}function je(e,t=[]){return e?Yr([e,...t]).slice(0,3):[]}function Be(){return Jr(String({}.REACT_APP_OPENAPI_FAILOVER_BASE_URLS||"").trim())}function Qr(e=Date.now()){return g?e-g.switchedAt>=qr():!0}function xe(e=Date.now()){g&&Qr(e)&&(g=null)}function N(e){if(!$r())return!1;const t=Me(e);if(!t)return!1;const r=Be();return r.length===0?!1:je(t,r).length>1}function R(e){const t=Me(e);if(!t)return[];const r=Be();return r.length===0?[t]:je(t,r)}function k(e){const t=R(e);if(t.length===0)return"";if(xe(),g){const r=t.indexOf(g.activeUrl);if(r>=0)return t[r]}return t[0]}function Fe(e){const t=R(e);if(t.length<=1||(xe(),!g||!t.includes(g.activeUrl)))return t;const r=g.activeUrl;return[r,...t.filter(n=>n!==r)]}function ke(e){return k(e)||void 0}function Ue(e){const t=e||void 0;if(typeof AbortController>"u")return{signal:t,timeoutError:()=>{},done:()=>{}};const r=Kr(),n=new AbortController;let i;const o=setTimeout(()=>{i=Zr(r),n.abort(i)},r);return{signal:Le(t,n.signal),timeoutError:()=>i,done:()=>clearTimeout(o)}}function Zr(e){const t=`[apiOriginFailover] origin attempt timed out after ${e}ms`;if(typeof DOMException=="function")return new DOMException(t,"TimeoutError");const r=new Error(t);return r.name="TimeoutError",r}function Ge(e){return e===502||e===503||e===504}function He(e){return!(e instanceof Error)&&!(e instanceof DOMException)?!1:e.name==="TimeoutError"?!0:e instanceof TypeError}var Xe;function en(e){Xe=e}function U(e,t){if(!N(t))return;const r=R(t);if(r.length<=1)return;const n=r.indexOf(D(e));if(n<0)return;const i=n+1;if(i>=r.length)return;const o=r[i],s=g?.activeUrl;g={activeUrl:o,switchedAt:Date.now()},s!==o&&Xe?.()}function Ve(e,t){if(!N(t))return;const r=D(e),n=R(t);if(n.includes(r)){if(r===n[0]){g=null;return}g?.activeUrl!==r&&(g={activeUrl:r,switchedAt:Date.now()})}}function We(){g=null}var tn=e=>{const t=new FormData,r=(n,i,o)=>{if(i!=null){if(i instanceof Blob){n.append(o,i);return}if(Array.isArray(i)){i.forEach((s,a)=>{const u=o?`${o}[${a}]`:`${a}`;r(n,s,u)});return}if(typeof i=="object"){Object.keys(i).forEach(s=>{const a=i[s],u=o?`${o}[${s}]`:s;r(n,a,u)});return}n.append(o,String(i))}};return r(t,e),t},rn={baseUrl:D("https://app.useblocks.io/api"),baseApiParams:{secure:!0,credentials:"same-origin",format:"json"},securityWorker:()=>({credentials:"same-origin"})},P=new Map;function nn(e){const t=e?.getInstance(de);return t?t.get()??t.bootstrap():void 0}var on=class extends ur{container;constructor(e={},t){super(e),this.container=t}buildRequestUrl(e){const{path:t,baseUrl:r,extraQuery:n}=e;let{query:i}=e;n&&(i=i?{...i,...n}:n);const o=i&&this.toQueryString(i);return`${r||this.baseUrl||""}${t}${o?`?${o}`:""}`}buildRequestKey(e,t){return`${t.toUpperCase()} ${e}`}getBackendProxyCandidates(e,t){const r=nn(this.container),n=this.container?.getInstance(Ee)!==void 0,i=Wr(e,{config:r,method:t,standalone:n}),o=i.length>0?i:[e],s=this.buildRequestKey(e,t),a=P.get(s);return!a||!o.includes(a)?o:[a,...o.filter(u=>u!==a)]}shouldRetryResponse(e){return e.status===502||e.status===503||e.status===504}resolveFailoverBaseUrl(){return String(this.baseUrl||"").trim()||void 0}async requestOnOrigin(e,t,r=!1){const n={...e,baseUrl:t},i=this.buildRequestUrl(n),o=n.method||"GET",s=this.buildRequestKey(i,o),a=this.getBackendProxyCandidates(i,o);let u,_;for(const l of a){const E=p=>p===i?l:p,h=r?Ue(e.signal):void 0;try{const p=await super.request({...n,proxyHandler:E,...h?{signal:h.signal}:{}});if(!p.ok&&this.shouldRetryResponse(p)&&l!==a[a.length-1]){_=p,P.get(s)===l&&P.delete(s);continue}return P.set(s,l),p}catch(p){P.get(s)===l&&P.delete(s);const A=h?.timeoutError();if(A)throw A;if(u=p,(p instanceof DOMException||p instanceof Error)&&p.name==="AbortError")throw p}finally{h?.done()}}if(_)return _;throw u instanceof Error?u:new Error("Backend proxy chain failed")}async request(e){const t=String(e.baseUrl||"").trim();if(t)return this.requestOnOrigin(e,t);const r=this.resolveFailoverBaseUrl(),n=N(r),i=e.failoverAttemptTimeout??n,o=n?Fe(r):r?[k(r)]:[this.baseUrl].filter(Boolean);if(o.length===0)return this.requestOnOrigin(e,this.baseUrl);let s,a;for(let u=0;u<o.length;u++){const _=o[u],l=u===o.length-1;try{const E=await this.requestOnOrigin(e,_,i);if(!E.ok&&Ge(E.status)){if(a=E,!l){U(_,r);continue}break}return E.ok&&Ve(_,r),E}catch(E){if(!He(E))throw E;s=E,l||U(_,r)}}if(n&&We(),a)return a;throw s instanceof Error?s:new Error("API origin failover chain failed")}};function sn(e={},t){const r=new on({...rn,...e},t);return r.contentFormatters["multipart/form-data"]=tn,r}var $e=d("rest.clientFactory"),an=e=>{pr(e);const t=sn({customFetch:e.getInstance(Y)?.execute??Er},e);e.inject(Q,t)},qe;(function(e){const t="https://racs.rest/v3";function r(i,o){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)};return fetch(`${t}?resource=${i}&dataset=${document.location.hostname}`,s)}e.post=r;async function n(i,o=0){const s={method:"POST",headers:{"Content-Type":"application/json",Accept:"application/json"},body:`{"filter":{},"limit":${o}}`};return await(await fetch(`${t}/get?resource=${i}&dataset=${document.location.hostname}`,s)).json()}e.getAll=n})(qe||(qe={}));function w(e,t){if(e!==t){if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const r=Array.isArray(e),n=Array.isArray(t);if(r){if(!n)return!1;const a=e.length;if(t.length!==a)return!1;for(let u=0;u<a;u++)if(!w(e[u],t[u]))return!1}else if(n)return!1;const i=Object.keys(e),o=Object.keys(t),s=i.length;if(s!==o.length)return!1;for(let a=0;a<s;a++){const u=i[a];if(!t.hasOwnProperty(u)||!w(e[u],t[u]))return!1}}return!0}function cn(e){const t=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),r=atob(t),n=new Uint8Array(r.length);for(let i=0;i<r.length;i++)n[i]=r.charCodeAt(i);return new TextDecoder().decode(n)}function Ke(e){const[t,r,n]=e.split("."),i=JSON.parse(cn(r));return{exp:i.exp,createdAt:i.iat,data:i}}var re=d("plugin.auth.token"),ze=new WeakMap,un=3e4;function _n(e){let t;try{t=Ke(e).exp}catch{return!0}return typeof t!="number"||!Number.isFinite(t)?!0:t*1e3<=Date.now()+un}function ln(e,t,r,n){const i=ze.get(e);i&&(i.stale=!0);const o={stale:!1};ze.set(e,o),e.injectFactory(re,async(s,a)=>{if(o.stale)return"";try{let u=await a||void 0;if(!u){const _=e.getInstance(fe);_&&(u=await _)}return t?!u||_n(u)?await t(r,n,u):u:""}catch{return""}},!0)}var Je=d("auth.oauthProvided"),Ye=new WeakMap;function Qe(e,t){const r=Ye.get(e)??{applied:!1};(!r.applied||r.getAuthToken!==t.getAuthToken||!w(r.user,t.user)||r.project!==t.project)&&(Ye.set(e,{applied:!0,getAuthToken:t.getAuthToken,user:t.user,project:t.project}),ln(e,t.getAuthToken,t.user,t.project))}function Ze(e){if(e.getInstance(Je))return;e.inject(Je,!0);let t;e.getInstance(le)?.watch(r=>{t=r}),e.addService(x,{execute:async(r,n)=>{if(n?.public||!t?.getAuthToken)return;e.getInstance(re)===void 0&&Qe(e,t);const i=await e.getInstanceAsync(re);i&&r.headers.set("authorization",`Bearer ${i}`)}})}var dn={text:{fontFamily:["Google Fonts","Sans Serif","Mulish","Regular"],fontSize:16,fontSizeDim:"px",lineHeight:24,lineHeightDim:"px",color:"#595959",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},headings:{fontFamily:["Google Fonts","Sans Serif","Mulish","Bold"],fontSize:28,fontSizeDim:"px",lineHeight:34,lineHeightDim:"px",color:"#000000",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},links:{color:"#1890ff",contrastColor:"#FFFFFF",underline:!0},buttons:{fontFamily:["Google Fonts","Sans Serif","Mulish","Medium"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1890ff",bold:!1,italic:!1,backgroundColor:"#1890ff",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:6,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},textAlign:"center",padding:{all:null,top:null,right:null,bottom:null,left:null}},block:{backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1890ff",padding:{all:null,top:null,right:null,bottom:null,left:null}},cards:{contrastBackgroundColor:"#1890ff",contrastTextColor:"#ffffff",baseBackgroundColor:"#f8f8f8",baseTextColor:"#333333",border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null}}},et="ERROR",fn="useblocks",En={em_token:"em_access_token",em_refresh_token:"em_refresh_token",em_admin_token:"em_admin_access_token",em_admin_refresh_token:"em_admin_refresh_token",em_impersonation:"em_impersonation",em_elements_view:"em_elements_view",em_new_block:"em_new_block",em_new_email:"em_new_email",em_id:"em_id",em_name:"em_name",em_email:"em_email",em_locale:"em_locale",em_carrotquest_hash:"em_carrotquest_hash",em_ducalis_hash:"em_ducalis_hash",em_email_subscription_consent:"em_email_subscription_consent",em_folder:"em_folder",promocode:"promocode",em_active_tab:"em_active_tab"},pn={em_color_scheme:"em_color_scheme",em_code_mode_pane_sizes:"em_code_mode_pane_sizes",em_preview_pane_sizes:"em_preview_pane_sizes",em_default_sizes:"em_default_sizes",em_pane_sizes:"em_pane_sizes",em_test_emails:"em_test_emails",em_menu_is_locked:"em_menu_is_locked",em_code_mode_settings:"em_code_mode_settings",em_folder_is_open:"em_folder_is_open",em_active_tab:"em_active_tab",em_ai_settings:"em_ai_settings",em_last_active_page:"em_last_active_page",em_layout_convert_never_suggest:"em_layout_convert_never_suggest",em_filemanager_v2:"em_filemanager_v2",em_projects_v2:"em_projects_v2",em_translations_v2:"em_translations_v2",em_defer_chrome:"em_defer_chrome",em_stripo_import:"em_stripo_import",em_guest_locale:"em_guest_locale"},hn="light",On="dark",gn="(prefers-color-scheme: dark)",An={MESSAGE:"message",INIT_PREVIEW:"init_preview",UPDATE_PREVIEW:"update_preview",UPDATE_EDITOR:"update_editor",UPDATE_EDITOR_POSITION:"update_editor_position",UPDATE_SIDE_MENU_EDITOR:"update_side_menu_editor",SAVE_EMAIL:"saveEmail",SANDBOX_ELEMENT_SETTINGS_SET:"sandbox_element_settings_set",SANDBOX_IMAGE_RESET:"sandbox_image_reset",SANDBOX_NATIVE_IMAGE_DROP_CLEAR:"sandbox_native-image-drop-clear",SANDBOX_EMAIL_SETTINGS_SET:"sandbox_email_settings_set",SANDBOX_BLOCK_SETTINGS_SET:"sandbox_block_settings_set",SANDBOX_ELEMENT_PARENT_GET:"sandbox_element_parent_get",SANDBOX_ELEMENT_PARENT_TABLE_GET:"sandbox_element_parent_table_get",SANDBOX_ELEMENT_PREV_GET:"sandbox_element_prev_get",SANDBOX_ELEMENT_NEXT_GET:"sandbox_element_next_get",SANDBOX_ELEMENT_REMOVE:"sandbox_element_remove",SANDBOX_ELEMENT_ACTIVE_RESET:"sandbox_element_active_reset",SANDBOX_ELEMENT_ACTIVE_SET:"sandbox_element_active_set",SANDBOX_ELEMENT_HOVER_SET:"sandbox_element_hover_set",SANDBOX_ELEMENT_IMG_LINK:"sandbox_element_img_link",SANDBOX_ELEMENT_TEXT:"sandbox_element_text",SANDBOX_EMAIL_CONTENT_GET:"sandbox_email_content_get",SANDBOX_SET_POSITION_TO_IMG:"sandbox_set_position_to_img",SANDBOX_SET_POSITION_TO_LINK:"sandbox_set_position_to_link",SANDBOX_ACCORDION_ADD_SECTION:"sandbox_accordion_add_section",SANDBOX_ACCORDION_REMOVE_SECTION:"sandbox_accordion_remove_section",APPLICATION_FOCUS_IN_IFRAME:"application_focus_in_iframe",APPLICATION_EMAIL_SETTINGS_SET:"application_email_settings_set",APPLICATION_BLOCK_SETTINGS_SET:"application_block_settings_set",APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",_APPLICATION_ELEMENT_SETTINGS_SET:"application_element_settings_set",APPLICATION_ELEMENT_SETTINGS_CLOSE:"application_element_settings_close",APPLICATION_ACTION:"application_action",APPLICATION_EBLOCK_ADD:"application_eblock_add",SANDBOX_EBLOCK_SET_EM_BLOCK_ID:"sandbox_eblock_set_em_block_id",SANDBOX_GLOBAL_BLOCK_REPLACE:"sandbox_global_block_replace",APPLICATION_SCROLL_TO:"application_scroll-to",APPLICATION_SCROLL_BLOCK_SHOW:"application_scroll-block-show",APPLICATION_SCROLL_BLOCK_HIDE:"application_scroll-block-hide",APPLICATION_DISCUSS_SET_ID:"application_discuss_set_id",APPLICATION_DISCUSS_GET_COMMENT:"application_discuss_get_comment",APPLICATION_DISCUSS_NO_COMMENT:"application_discuss_no_comment",APPLICATION_DISCUSS_SAVE_TARGET:"application_discuss_save_target",APPLICATION_IFRAME_SET_HEIGHT:"application_iframe_set_height",APPLICATION_COMMON_STYLES_UPDATE:"application_commonStyles_update",APPLICATION_EMAIL_CONTENT_GET:"application_email_content_get",APPLICATION_OPEN_IMAGE_AI_POPUP:"application_open-image-ai-popup",APPLICATION_OPEN_IMAGE_UPLOAD_POPUP:"application_open-image-upload-popup",APPLICATION_OPEN_IMAGE_EDIT_POPUP:"application_open-image-edit-popup",APPLICATION_OPEN_IMAGE_GIF_POPUP:"application_open-image-gif-popup",APPLICATION_OPEN_IMAGE_STOCK_POPUP:"application_open-image-stock-popup",APPLICATION_CLOSE_IMAGE_EDIT_POPUP:"application_close-image-edit-popup",APPLICATION_NATIVE_IMAGE_DROP:"application_native-image-drop",APPLICATION_SUBJECT_UPDATE:"application_subject_update",APPLICATION_PREHEADER_UPDATE:"application_preheader_update",APPLICATION_DOMPARSER_ERROR:"application_domparser_error",APPLICATION_SYNC_DRIFT:"application_sync_drift",APPLICATION_UPDATE_ENTITY:"application_update_entity",APPLICATION_IFRAME_DRAG_EVENT:"application_iframe_drag_event",APPLICATION_HAS_AMP:"application_has_amp",APPLICATION_CANVAS_IMAGE_GET:"application_canvas_image_get",APPLICATION_PREVIEW_ALERT_SHOW:"application_preview_alert_show",APPLICATION_ATOM_INSERTED:"application_atom_inserted",APPLICATION_TEMPLATE_NOT_EM_ALERT_SHOW:"application_template_not_em_alert_show",SANDBOX_WINDOW_CHARACTERISTIC:"sandbox_window-characteristic",SANDBOX_IFRAME_SETSIZE:"sandbox_iframe-setsize",SANDBOX_BLOCK_INSERT:"sandbox_block-insert",SANDBOX_ATOM_INSERT:"sandbox_atom-insert",SANDBOX_DRAG_CANCEL:"sandbox_drag-cancel",UPDATE_EDITOR_POSITION_FROM_EDITOR:"update_position_from_editor",UPDATE_EDITOR_POSITION_FROM_IFRAME:"update_position_from_iframe",SANDBOX_CHANGE_PREVIEW:"sandbox_change_preview",APPLICATION_CHANGE_PREVIEW:"application_change_preview",SANDBOX_LOCK_EDIT:"sandbox_lock_edit",SANDBOX_FLOATBLOCK_ADD:"sandbox_floatBlock_add",SANDBOX_FLOATBLOCK_REMOVE:"sandbox_floatBlock_remove",SANDBOX_FLOATBLOCK_COPY:"sandbox_floatBlock_copy",SANDBOX_FLOATBLOCK_SWAP:"sandbox_floatBlock_swap",EDITOR_CHANGE_FOCUS:"editor_change_focus",SANDBOX_RESIZED:"sandbox_resized",SANDBOX_LOCK_DISCUSS:"sandbox_lock_discuss",SANDBOX_DISCUSS_SET_TARGET:"sandbox_discuss_set_target",SANDBOX_DISCUSS_REMOVE_TARGET:"sandbox_discuss_remove_target",SANDBOX_DISCUSS_RESET:"sandbox_discuss_reset",SANDBOX_DISCUSS_GET_TARGET:"sandbox_discuss_get_target",SANDBOX_READY:"SANDBOX_READY",SANDBOX_FLOATBLOCK_WRAP:"sandbox_floatblock_wrap",SANDBOX_FLOATBLOCK_DIR:"sandbox_floatblock_dir",SANDBOX_SUBJECT_UPDATE:"sandbox_subject_update",SANDBOX_PREHEADER_UPDATE:"sandbox_preheader_update",SANDBOX_DRAG_EVENT:"sandbox_drag_event",SANDBOX_WHEEL:"sandbox_wheel",SANDBOX_ADD_MERGETAG:"sandbox_add_mergetag",SANDBOX_TRANSLATIONS:"sandbox_send_translations",SANDBOX_SET_THEME_VARIABLES:"sandbox_send_theme_variables",SANDBOX_SET_PROJECT_FONTS:"sandbox_set_project_fonts",SANDBOX_CANVAS_IMAGE_CACHE_SETUP:"sandbox_canvas_image_cache_setup",SANDBOX_SET_ENTITY:"sandbox_set_entity",SANDBOX_INIT_START:"sandbox_init_start",SANDBOX_INITED:"sandbox_inited",SANDBOX_UPDATE_ENTITY:"sandbox_update_entity",RELOAD:"reload",SANDBOX_ADD_EXTENSIONS:"sandbox_add_extensions",SANDBOX_REMOVE_EXTENSIONS:"sandbox_remove_extensions",SANDBOX_ADD_SCRIPT:"sandbox_add_script",SANDBOX_IS_EMAIL_EMPTY:"sandbox_is_email_empty",SANDBOX_SWITCH_THEME:"sandbox_switch_theme",SANDBOX_CANVAS_HEALTH:"sandbox_canvas_health"},mn={language:"html",detectIndentation:!1,wordWrap:"on",wrappingIndent:"same",smoothScrolling:!0,automaticLayout:!0,tabSize:2,indentSize:2},tt=e=>{const t={current:Promise.resolve(),state:e,decorate:(r,n)=>(n&&(r=r.bind(n)),function(...i){const o=t.current.then(()=>r(...i));return t.current=o.then(s=>{t.state=s},s=>{}),o})};return t};function ne(e){return function(t){return{setOptions:()=>{},instance:{},dispose:()=>{},...e(t)||{}}}}function In(e){return t=>{const r={},n=[];for(const s of e)n.push(s(t));for(const s of n)Object.assign(r,s.instance);return{instance:r,setOptions:async s=>{for(const a of n)await a.setOptions(s)},dispose:()=>{for(const s of n)s.dispose()}}}}function Tn(e=et){const t=new Error(e);return t.name="AuthPipelineError",t}async function rt(e,t,r,n){const i=n?.attemptTimeout??N(r),o=N(r)?Fe(r):R(r).length>0?[k(r)]:[];if(o.length===0)throw new Error("[apiOriginFailover] no API base URL configured");const s=e.startsWith("/")?e:`/${e}`;let a,u;for(let _=0;_<o.length;_++){const l=o[_],E=_===o.length-1,h=i?Ue(t.signal):void 0;try{const p=await fetch(`${l}${s}`,{...t,...h?{signal:h.signal}:{}});if(!p.ok&&Ge(p.status)){if(a=p,!E){U(l,r);continue}break}return p.ok&&Ve(l,r),p}catch(p){const A=h?.timeoutError();if(!A&&!He(p))throw p;u=A||p,E||U(l,r)}finally{h?.done()}}if(N(r)&&We(),a)return a;throw u instanceof Error?u:new Error("[apiOriginFailover] fetch chain failed")}function nt(e){e.inject(C,void 0),e.inject(z,void 0)}var Sn=ne(e=>{let t,r;const n=tt();return e.addService(x,{execute:n.decorate(async(i,o)=>{if(o?.public||!t)return;const s=String(e.getInstance(z)||"").trim();if(s){i.headers.append("authorization",`Bearer ${s}`);return}if(!e.getInstance(C))try{const a=e.getInstance($e),u=String(a?.getOptions()?.baseUrl||"").trim(),_=ke(r||u||void 0);if(!_)throw new Error("JWT auth requires baseUrl");const l=await rt("/jwt-auth/token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},_);if(!l.ok)throw new Error(`JWT auth failed: ${l.status}`);const E=await l.json(),h=String(E.token||"").trim();if(!h)throw new Error("JWT auth failed: empty token");e.inject(C,void 0),e.inject(z,h),i.headers.append("authorization",`Bearer ${h}`)}catch{throw e.inject(C,et),Tn()}})}),{setOptions(i){const o=i.jwtAuth,s=String(i.baseUrl||"").trim()||void 0,a=!w(o,t),u=s!==r;if(t=o,r=s,!o){nt(e);return}a||u?nt(e):e.inject(C,void 0)}}}),bn=ne(e=>(Ze(e),{setOptions(t){Qe(e,t)}}));function Dn(e){return typeof CSS<"u"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/([^a-zA-Z0-9_-])/g,"\\$1")}function ie(e,t=document){try{const n=t.querySelector(e);if(n)return n}catch{return null}const r=t.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;if(!i)continue;const o=ie(e,i);if(o)return o}return null}function it(e,t=[]){const r=e.querySelectorAll("*");for(let n=0;n<r.length;n++){const i=r[n]?.shadowRoot;i&&(t.push(i),it(i,t))}return t}function Nn(e,t,r){if(e.isConnected)return e;const n=e.id?.trim();return n?ot(`#${Dn(n)}`,t,r):Promise.reject(S("Editor mount element was disconnected and has no id — pass a CSS selector or call init() again after the host remounts the container."))}function ot(e,t,r){if(q(r),typeof e<"u"){if(typeof e=="string"){const n=e,i=ie(n);if(i)return i;const o=t.addDisposable(new m);return new Promise((s,a)=>{const u=O=>{o.dispose(),O()},_=()=>{u(()=>a(S(r?.reason)))};if(r?.aborted){_();return}r?.addEventListener("abort",_),o.addDispose(()=>r?.removeEventListener("abort",_));const l=document.body??document.documentElement;if(!l){u(()=>a(S("Document is not ready to observe mount element")));return}const E=new Set,h=new MutationObserver(()=>{const O=ie(n);if(O){u(()=>s(O));return}A()}),p=O=>{E.has(O)||(E.add(O),h.observe(O,{attributes:!0,childList:!0,subtree:!0}))},A=()=>{const O=document.documentElement;if(O)for(const G of it(O))p(G)};p(l),A(),o.addDispose(()=>h.disconnect())})}return e instanceof Element?Nn(e,t,r):e}return e}var Pn=new Map;Object.defineProperty(c,"ADVANCED_SETTINGS_PANEL",{enumerable:!0,get:function(){return rr}}),Object.defineProperty(c,"APP_COOKIES",{enumerable:!0,get:function(){return En}}),Object.defineProperty(c,"APP_ID",{enumerable:!0,get:function(){return Lt}}),Object.defineProperty(c,"APP_LOAD_EVENT_ID",{enumerable:!0,get:function(){return Ut}}),Object.defineProperty(c,"ATOMS_HANDLERS_ID",{enumerable:!0,get:function(){return zt}}),Object.defineProperty(c,"AsyncEmitter",{enumerable:!0,get:function(){return B}}),Object.defineProperty(c,"BaseEmitter",{enumerable:!0,get:function(){return b}}),Object.defineProperty(c,"COMMON_STYLES",{enumerable:!0,get:function(){return dn}}),Object.defineProperty(c,"CONFIG_CHANGED_EVENT_ID",{enumerable:!0,get:function(){return Gt}}),Object.defineProperty(c,"CONFIG_SOURCE_ID",{enumerable:!0,get:function(){return de}}),Object.defineProperty(c,"COOKIE_MANAGER_ID",{enumerable:!0,get:function(){return sr}}),Object.defineProperty(c,"CUSTOM_FETCH_ID",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(c,"ContentType",{enumerable:!0,get:function(){return cr}}),Object.defineProperty(c,"DARK",{enumerable:!0,get:function(){return On}}),Object.defineProperty(c,"DISPOSABLE_ID",{enumerable:!0,get:function(){return vt}}),Object.defineProperty(c,"DependencyResolver",{enumerable:!0,get:function(){return $}}),Object.defineProperty(c,"Disposable",{enumerable:!0,get:function(){return m}}),Object.defineProperty(c,"ELEMENT_MAP",{enumerable:!0,get:function(){return Pn}}),Object.defineProperty(c,"EVENT_TYPES",{enumerable:!0,get:function(){return An}}),Object.defineProperty(c,"Emitter",{enumerable:!0,get:function(){return Tt}}),Object.defineProperty(c,"HANDLE_ATOM_INSERT_ID",{enumerable:!0,get:function(){return Jt}}),Object.defineProperty(c,"HEADLESS_MODE_ID",{enumerable:!0,get:function(){return Yt}}),Object.defineProperty(c,"INIT_PIPELINE_ID",{enumerable:!0,get:function(){return Rt}}),Object.defineProperty(c,"INSTANCE_ID",{enumerable:!0,get:function(){return wt}}),Object.defineProperty(c,"JWTMixin",{enumerable:!0,get:function(){return Sn}}),Object.defineProperty(c,"LATE_SURFACE_LISTENERS_ID",{enumerable:!0,get:function(){return Mt}}),Object.defineProperty(c,"LIGHT",{enumerable:!0,get:function(){return hn}}),Object.defineProperty(c,"LOCAL_STORAGE_ITEMS",{enumerable:!0,get:function(){return pn}}),Object.defineProperty(c,"MESSAGE_SERVICE_ID",{enumerable:!0,get:function(){return er}}),Object.defineProperty(c,"MODAL_CLOSE_EVENT",{enumerable:!0,get:function(){return ir}}),Object.defineProperty(c,"MODAL_SHOW_EVENT",{enumerable:!0,get:function(){return nr}}),Object.defineProperty(c,"MODAL_UPDATE_EVENT",{enumerable:!0,get:function(){return or}}),Object.defineProperty(c,"MONACO_EDITOR_OPTIONS",{enumerable:!0,get:function(){return mn}}),Object.defineProperty(c,"MessageService",{enumerable:!0,get:function(){return Kt}}),Object.defineProperty(c,"OAuthMixin",{enumerable:!0,get:function(){return bn}}),Object.defineProperty(c,"OPTIONS_SOURCE_ID",{enumerable:!0,get:function(){return le}}),Object.defineProperty(c,"PLUGIN_COLLECTION_ID",{enumerable:!0,get:function(){return kt}}),Object.defineProperty(c,"PORT_READY",{enumerable:!0,get:function(){return he}}),Object.defineProperty(c,"PREFERS_COLOR_SCHEME_DARK",{enumerable:!0,get:function(){return gn}}),Object.defineProperty(c,"PUBLIC_REQUEST",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(c,"REQUEST_HANDLER_ID",{enumerable:!0,get:function(){return x}}),Object.defineProperty(c,"REST_CLIENT_FACTORY_ID",{enumerable:!0,get:function(){return $e}}),Object.defineProperty(c,"REST_TRANSPORT_ID",{enumerable:!0,get:function(){return Q}}),Object.defineProperty(c,"SANDBOX_EXTENSIONS_ID",{enumerable:!0,get:function(){return Qt}}),Object.defineProperty(c,"SANDBOX_EXTENSION_SCRIPT_STATUS_ID",{enumerable:!0,get:function(){return Zt}}),Object.defineProperty(c,"SECURITY_MODULE_ID",{enumerable:!0,get:function(){return Ee}}),Object.defineProperty(c,"SETTINGS_PANEL_EVENT",{enumerable:!0,get:function(){return tr}}),Object.defineProperty(c,"STANDALONE_ACTIVATED_ID",{enumerable:!0,get:function(){return xt}}),Object.defineProperty(c,"STANDALONE_BOOTSTRAP_TOKEN_ID",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(c,"STANDALONE_FILE_PROXY_REGISTERED_ID",{enumerable:!0,get:function(){return Ft}}),Object.defineProperty(c,"STANDALONE_PROJECT_ID",{enumerable:!0,get:function(){return Bt}}),Object.defineProperty(c,"STORE_ID",{enumerable:!0,get:function(){return jt}}),Object.defineProperty(c,"Signal",{enumerable:!0,get:function(){return St}}),Object.defineProperty(c,"TEMPLATE_DIRECTIVES_ID",{enumerable:!0,get:function(){return ar}}),Object.defineProperty(c,"USEBLOCKS",{enumerable:!0,get:function(){return fn}}),Object.defineProperty(c,"combineMixins",{enumerable:!0,get:function(){return In}}),Object.defineProperty(c,"composeAbortSignals",{enumerable:!0,get:function(){return Le}}),Object.defineProperty(c,"createAbortError",{enumerable:!0,get:function(){return S}}),Object.defineProperty(c,"createIdentifier",{enumerable:!0,get:function(){return Vt}}),Object.defineProperty(c,"createIdentifier$1",{enumerable:!0,get:function(){return d}}),Object.defineProperty(c,"createQueue",{enumerable:!0,get:function(){return tt}}),Object.defineProperty(c,"debounce",{enumerable:!0,get:function(){return Nt}}),Object.defineProperty(c,"decodeJwt",{enumerable:!0,get:function(){return Ke}}),Object.defineProperty(c,"deepEqual",{enumerable:!0,get:function(){return w}}),Object.defineProperty(c,"defineMixin",{enumerable:!0,get:function(){return ne}}),Object.defineProperty(c,"events",{enumerable:!0,get:function(){return K}}),Object.defineProperty(c,"fetchWithApiOriginFailover",{enumerable:!0,get:function(){return rt}}),Object.defineProperty(c,"filter",{enumerable:!0,get:function(){return Dt}}),Object.defineProperty(c,"generateUUID",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(c,"getActiveBaseUrl",{enumerable:!0,get:function(){return k}}),Object.defineProperty(c,"getApi",{enumerable:!0,get:function(){return hr}}),Object.defineProperty(c,"getEmitter",{enumerable:!0,get:function(){return Ct}}),Object.defineProperty(c,"getEmitter$1",{enumerable:!0,get:function(){return Pt}}),Object.defineProperty(c,"getEvent",{enumerable:!0,get:function(){return yt}}),Object.defineProperty(c,"getServiceContainerId",{enumerable:!0,get:function(){return M}}),Object.defineProperty(c,"isAbortError",{enumerable:!0,get:function(){return mt}}),Object.defineProperty(c,"mapHttpStatusToErrorCode",{enumerable:!0,get:function(){return At}}),Object.defineProperty(c,"mergeBackendProxyLayers",{enumerable:!0,get:function(){return br}}),Object.defineProperty(c,"mergeResourceProxyLayers",{enumerable:!0,get:function(){return Sr}}),Object.defineProperty(c,"mergeResourceProxyPolicyLayers",{enumerable:!0,get:function(){return yr}}),Object.defineProperty(c,"mergeShallowConfigLayers",{enumerable:!0,get:function(){return Ae}}),Object.defineProperty(c,"pickKey",{enumerable:!0,get:function(){return mr}}),Object.defineProperty(c,"provideOAuth",{enumerable:!0,get:function(){return Ze}}),Object.defineProperty(c,"raceWithAbortSignal",{enumerable:!0,get:function(){return It}}),Object.defineProperty(c,"registerRestTransport",{enumerable:!0,get:function(){return an}}),Object.defineProperty(c,"releaseContainer",{enumerable:!0,get:function(){return Ar}}),Object.defineProperty(c,"resolveContainer",{enumerable:!0,get:function(){return ft}}),Object.defineProperty(c,"resolveExplicitApiBaseUrl",{enumerable:!0,get:function(){return ke}}),Object.defineProperty(c,"setApiOriginFailoverHook",{enumerable:!0,get:function(){return en}}),Object.defineProperty(c,"snapshot",{enumerable:!0,get:function(){return bt}}),Object.defineProperty(c,"throwIfAborted",{enumerable:!0,get:function(){return q}}),Object.defineProperty(c,"waitForElement",{enumerable:!0,get:function(){return ot}})});
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
__useblocks__.define("static/umd/d786efbb.js",["require","exports","module"],function(f,l,m){var v=(function(){const e=typeof document<"u"&&document.createElement("link").relList;return e&&e.supports&&e.supports("modulepreload")?"modulepreload":"preload"})(),k=function(n,e){return new URL(n,e).href},h={},c=function(e,E,P){let p=Promise.resolve();if(0)var R,w;function i(r){const t=new Event("vite:preloadError",{cancelable:!0});if(t.payload=r,window.dispatchEvent(t),!t.defaultPrevented)throw r}return p.then(r=>{for(const t of r||[])t.status==="rejected"&&i(t.reason);return e().catch(i)})};Object.defineProperty(l,"__vitePreload",{enumerable:!0,get:function(){return c}})});
|
|
2076
2100
|
|
|
2077
2101
|
|
|
2078
|
-
__useblocks__.define("useblocks.js",["require","exports","module","static/umd/993c2c90.js"],function(qo,X,dh){Object.defineProperties(X,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var Gn=Object.defineProperty,Vn=(e,t)=>{let n={};for(var r in e)Gn(n,r,{get:e[r],enumerable:!0});return t||Gn(n,Symbol.toStringTag,{value:"Module"}),n};const a=qo("./static/umd/993c2c90.js");var zo=new Function("url","return import(url)");function Wo(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Ko(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Xo(e){return e.type==="umd"||e.resolve==="registry"}function uh(e){return e}var Jo=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(Ko(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Xo(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await zo(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,r.onload=()=>t(),r.onerror=()=>n(new Error(`Failed to load script: ${e}`)),document.head.appendChild(r)})}initSync(e){const t=[];for(const n of e){const r=this._getOrCreate(n,void 0);t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const{ctor:s,options:o}=await this._resolveEntry(r),i=this._getOrCreate(s,o);n.has(i)||(n.add(i),t.push(i))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const l=await this._resolveEntry(i);t.add(l.ctor),n.push(l)}const r=[];this._map.forEach((i,l)=>{t.has(l)||r.push({key:l,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:l,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(l),this._optionsMap.delete(l),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const s=[],o=new Set;for(const{ctor:i,options:l}of n){const c=this._getOrCreate(i,l);o.has(c)||(o.add(c),s.push(c))}this._activated&&await this._startPluginsBatch(s)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,s)=>{let o,i=!1;const l=()=>{i||(i=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,l),r())};this._pluginRegistry.on(e,l),n!==void 0&&n>0&&(o=setTimeout(()=>{i||(i=!0,this._pluginRegistry.off(e,l),s(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),s=this._createPluginInstance(e,r),o=s.constructor.name;this._emitLifecycle({type:"created",plugin:s,name:o}),s.required?.(),this._map.set(n,s),this._creationOrder.push(s),this._setupReadyPromise(s)}return this._map.get(n)}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);try{return Wo(e)?new e(this._context,t):e(this._context,t)||{}}finally{this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const s of t){if(this._initializedPlugins.has(s))continue;const o=this._initializingPlugins.get(s);if(o){n.add(o);continue}r.push(s)}if(r.length>0){const s=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,s);n.add(s),s.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===s&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(s){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:s})}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(s){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:s})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Qo=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const s of n)try{s.callback(t)}catch{}const r=n.filter(s=>!s.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(s=>(t.ctor=s,t.loading=void 0,this._notifyListeners(e,s),s));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!1};return r.push(s),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!0};return r.push(s),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(s=>s.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},Zo=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},Yn=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function ei(e,t){return t+e}function ti(){return typeof performance>"u"?Date.now():ei(performance.now(),performance.timeOrigin)}var ni="emailmaker:diagnostics",ri="diagnostics",si="diagnostics";function qn(e,t){return t?`${e}${e.includes("?")?"&":"?"}${si}=1`:e}var vt;function oi(){try{const e=new URLSearchParams(window.location.search).get(ri);return e===null?void 0:e!=="0"}catch{return}}function ii(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function ai(){try{const e=window.localStorage.getItem(ni);return e===null?void 0:e==="1"}catch{return}}function Te(){return vt===void 0&&(vt=typeof window>"u"?!1:oi()??ii()??ai()??!1),vt}function li(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var W={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},fh=Object.values(W),ph=[W.canvasPainted,W.canvasSettled,W.appVisible,W.editorVisible],ci=5e3,di=3e3,zn="diagnosticsStore",Ge,Ae;function Wn(){return{marks:new Yn(ci),resources:new Yn(di)}}function Kn(){if(Ae)return Ae;const e=bt();return e?(Ae=e[zn]??Ge??Wn(),e[zn]=Ae,Ge=void 0,Ae):(Ge??=Wn(),Ge)}function $(e,t){Te()&&Kn().marks.push({phase:e,at:ti(),...t})}function bt(){if(typeof __useblocks__<"u"&&__useblocks__)return __useblocks__;if(typeof window>"u")return;const e=window[li()];return e!==null&&typeof e=="object"?e:void 0}function ui(e){const t=e.length,n=Kn();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function fi(){const e=bt();return!e||!Array.isArray(e.diagnosticsBuffer)?0:ui(e.diagnosticsBuffer)}var pi="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function _t(){const e=new Error(pi);return e.name="DestroyedInstanceError",e}function mi(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function yt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,i=t;return o.length===i.length&&o.every((l,c)=>yt(l,i[c]))}const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&yt(e[o],t[o]))}function Xn(e,t){const n={watch(r){let s,o=!1;return e.watch(i=>{const l=t(i);o&&yt(s,l)||(s=l,o=!0,r(l))})},select(r){return Xn(n,r)}};return n}function ue(...e){let t=e[0],n=e.length>0;const r=new Set,s={get(){return n?t:void 0},set(o){t=o,n=!0;for(const i of Array.from(r))i(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return Xn(s,o)}};return s}var Jn=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:a.ContentType.UrlEncoded,...t})},Qn=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function hi(e){return String(e||"").trim()||void 0}var gi=class extends a.Disposable{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=hi(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},St=a.createIdentifier$1("AppInitService");function Ei(e){return async()=>{const t=await e();return(await new Jn(t).app_init_create({})).data}}function vi(e){e.injectFactory(St,(t,n)=>{if(n)return n;const r=new gi({options:e.getInstance(a.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(a.SECURITY_MODULE_ID),resolveRestBaseUrl:s=>s?a.getActiveBaseUrl(s):a.getActiveBaseUrl()||void 0,setRestBaseUrl:s=>{e.getInstance(a.REST_CLIENT_FACTORY_ID)?.setOptions(s?{baseUrl:s}:{})},fallbackAppInit:Ei(()=>e.getInstanceAsync(a.REST_TRANSPORT_ID)),publish:s=>{e.inject(a.APP_ID,s)}});return e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var wt=a.createIdentifier$1("documentSession.emailDocuments");function Ce(e){return e?.getInstance(wt)}var bi=a.createIdentifier$1("RevisionServiceFlag");function _i(e){return e.getOrCreateInstance(bi,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function Zn(e){return _i(e).isEnabled()}var yi=a.createIdentifier$1("EmailRightsResolver");function Si(e,t){const n=e.getInstance(yi);return n?n(t):!0}var er=a.createIdentifier$1("EmailHistoryAvailabilityResolver");function wi(e){return e.getInstance(er)!==void 0}async function Ii(e){const t=e.getInstance(er);if(!t)return!0;try{return await t()}catch{return!1}}var It={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},tr=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],nr=2e4,Ti=tr.reduce((e,t)=>e+It[t],0),rr=nr+Ti+3e3;function Ai(e){return tr.reduce((t,n)=>t+sr(n,e),0)}function sr(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:It[e]}function or(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:rr}function ir(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:nr}function Tt(e=rr){return e+3e3}var mh="[show-pipeline]";function ar(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function hh(e,t){}var Ci=()=>Tt();function Di(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Pi(e){return t=>Di(e.getOrCreateInstance(a.events.BEFORE_SAVE_EMAIL,()=>new a.AsyncEmitter).fire(t),Ci())}function Ri(e){return e!=null&&e!==""}var Oi;function Ve(e,t){return Oi?.capture(e,t)}function Li(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Ye(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ee=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${Ye(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Ye(this.oldText)}")`:`(replace@${this.oldPosition} "${Ye(this.oldText)}" with "${Ye(this.newText)}")`}};function lr(e,t){return e===null||e.length===0?t:new Mi(e,t).compress()}var Mi=class se{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),s=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(s===null)break;this._acceptCurr(s),s=this._getCurr(++n);continue}if(s===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldEnd<=r.newPosition){this._acceptCurr(s),s=this._getCurr(++n);continue}if(r.newEnd<=s.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldPosition<r.newPosition){const[c,d]=se._splitCurr(s,r.newPosition-s.oldPosition);this._acceptCurr(c),s=d;continue}if(r.newPosition<s.oldPosition){const[c,d]=se._splitPrev(r,s.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,l;if(s.oldEnd===r.newEnd)i=r,l=s,r=this._getPrev(++t),s=this._getCurr(++n);else if(s.oldEnd<r.newEnd){const[c,d]=se._splitPrev(r,s.oldLength);i=c,l=s,r=d,s=this._getCurr(++n)}else{const[c,d]=se._splitCurr(s,r.newLength);i=r,l=c,r=this._getPrev(++t),s=d}this._result[this._resultLen++]=new ee(i.oldPosition,i.oldText,l.newPosition,l.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=l.newLength-l.oldLength}const o=se._merge(this._result);return se._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=se._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=se._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ee(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ee(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),s=t.newText.substr(n);return[new ee(t.oldPosition,t.oldText,t.newPosition,r),new ee(t.oldEnd,"",t.newPosition+n,s)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),s=t.oldText.substr(n);return[new ee(t.oldPosition,r,t.newPosition,t.newText),new ee(t.oldPosition+n,s,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,s=t[0];for(let o=1;o<t.length;o++){const i=t[o];s.oldEnd===i.oldPosition?s=new ee(s.oldPosition,s.oldText+i.oldText,s.newPosition,s.newText+i.newText):(n[r++]=s,s=i)}return n[r++]=s,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let s=0;s<t.length;s++){const o=t[s];o.oldText!==o.newText&&(n[r++]=o)}return n}};function Ni(e){return new ee(e.newPosition,e.newText,e.oldPosition,e.oldText)}function xi(e){return e.map(Ni)}function cr(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function ki(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const s=t[r];n=n.slice(0,s.oldPosition)+s.newText+n.slice(s.oldEnd)}return n}function Fi(e,t,n){let r=0;const s=e.start===e.end;for(const o of t){const i=o.newLength-o.oldLength;if(o.oldLength===0){const l=o.oldPosition;if(s&&l===e.start)r+=n==="after"?i:0;else{if(e.start<l&&l<e.end)return null;l<=e.start&&(r+=i)}continue}if(s){if(e.start>=o.oldEnd)r+=i;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=i;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var qe=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},dr=0,Bi=Math.random().toString(36).slice(2,8);function ji(){return dr+=1,`doc-${Bi}-${dr}`}function Ui(e){const t=e.createBuffer(),n=e.docId??ji();let r=e.serverId??null,s=0,o=null,i=e.attributes??{};const l=new Set;let c=!1,d=!1,u;const p=new Set;let E=null;const m=()=>(E?.version!==s&&(E={version:s,value:t.read()}),E.value),b=v=>Object.entries(v).some(([h,_])=>i[h]!==_);return{get:()=>({docId:n,serverId:r,version:s,savedVersion:o,attributes:i}),getContent:m,mutate(v,{source:h}){if(c)return s;const _=v.changes?.length?v.changes:void 0,y=_?ki(m(),_):v.content!==void 0?v.content:void 0,S=y!==void 0&&y!==m(),A=v.attributes!==void 0&&b(v.attributes);if(!S&&!A)return s;const C=!(s>(o??-1)),g=A?Object.keys(v.attributes).filter(f=>i[f]!==v.attributes[f]):[];S&&t.write(y),A&&(i={...i,...v.attributes}),s+=1,h!=="user"&&C&&(o=s);const I={source:h,version:s,changes:_,...S?{content:!0}:{},...g.length>0?{attributes:g}:{}};return l.forEach(f=>f(I)),s},markSaved(v,h){const _={serverId:r,savedVersion:o};h!==void 0&&(r=h),(o===null||v>o)&&(o=v),(_.serverId!==r||_.savedVersion!==o)&&l.forEach(y=>y({source:"system",version:s}))},markUnsaved(){c||o===null||o<s||(o=s-1,l.forEach(v=>v({source:"system",version:s})))},markReady(){d||u!==void 0||(d=!0,p.forEach(v=>v.resolve()),p.clear(),l.forEach(v=>v({source:"system",version:s})))},isReady:()=>d,markFailed(v){d||u!==void 0||c||(u=v,p.forEach(h=>h.reject(new qe(v))),p.clear(),l.forEach(h=>h({source:"system",version:s})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new qe(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((v,h)=>{p.add({resolve:v,reject:h})})},subscribe(v){return l.add(v),()=>l.delete(v)},isNew:()=>r===null,isDirty:()=>s>(o??-1),isDisposed:()=>c,dispose(){c=!0,p.forEach(v=>v.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),p.clear(),l.clear(),t.dispose()}}}var Hi=500,$i=100,At=0;function Gi(e,t={}){const n=t.groupIntervalMs??Hi,r=t.maxSteps??$i,s=t.now??(()=>0);let o=[],i=0,l=At+=1,c=null,d=!1,u=!1,p=!1;const E=new Set,m=()=>E.forEach(g=>g()),b=(g,I)=>{if(g.length){u=!0;try{e.mutate({changes:g},{source:I})}finally{u=!1}}},v=g=>b(g,"user"),h=g=>{const I=s();d&&c!==null&&I-c<n?o[i-1]=lr(o[i-1],g):(o=o.slice(0,i),o.push(g),i=o.length,d=!0,o.length>r&&(o=o.slice(o.length-r),i=o.length,l=At+=1)),c=I,m()},_=()=>{d=!1,c=null},y=g=>{if(!g.length)return;const I=o.length>i;I&&(o=o.slice(0,i)),i>0&&(o[i-1]=lr(o[i-1],g)),_(),I&&m()},S=e.subscribe(({source:g,changes:I})=>{if(!(p||u||!I?.length)){if(g==="remote"){A();return}if(g!=="user"){y(I);return}h(I)}}),A=()=>{o=[],i=0,_(),l=At+=1,m()},C=()=>{if(i===0)return!1;const g=xi(o[i-1]);return cr(e.getContent(),g)?(v(g),i-=1,_(),!0):(o=o.slice(0,i-1),i=o.length,_(),m(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<o.length,undo(){C()&&m()},redo(){if(!(i>=o.length)){if(!cr(e.getContent(),o[i])){o=o.slice(0,i),_(),m();return}v(o[i]),i+=1,_(),m()}},clear:A,applyWithoutHistory(g){const I=e.get().version;if(b(g,"system"),e.get().version===I){_();return}y(g)},getPast:g=>o.slice(0,i).reverse().slice(0,g),getFuture:g=>o.slice(i).reverse().slice(0,g),createSnapshot:()=>({stackId:l,index:i}),restoreSnapshot(g){if(g.stackId!==l||g.index>i)return!1;for(;i>g.index;)if(!C())return m(),!1;return m(),!0},subscribe(g){return E.add(g),()=>E.delete(g)},dispose(){p=!0,S(),E.clear(),o=[],i=0}}}var Vi=["edit","move","resize","insert"];function Ct(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Yi(e){return typeof e=="string"?e:null}function qi(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function zi(e){return Vi.includes(e)?e:null}function Wi(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Yi(t.originId),changeId:Ct(t.changeId),rev:Ct(t.rev),baseRev:Ct(t.baseRev),expected:qi(t.expected),intent:zi(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var ur=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},fr="draft";function he(e){return e==null||e===""?fr:String(e)}function Ki(e){return e==null||e===""?`${Dt}${fr}`:`${Dt}${String(e)}`}var Dt="block:";function ne(e){return e?.startsWith(Dt)===!0}function De(e){return ne(e.sessionKey())?void 0:e.current()}function gh(e,t){}function Pe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return $(`show:gate:${e}`,{kind:"wait"}),t.then(s=>($(`show:gate:${e}:end`,{kind:"wait"}),s),s=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw a.isAbortError(s)?(`${e}`,{...n}):(`${e}`,{error:ar(s),...n},void 0),s})}var Eh=5e3;function ze(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Pt(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Xi(e,t={}){const n=ze((e??[]).filter(r=>r?.html?.trim()));return Pt(n,t)?n:null}function Ji(e,t){const n=Date.parse(ze(e)?.modified??""),r=Xi(e),s=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(s)&&s>t,i=[n,t??NaN].filter(l=>Number.isFinite(l));return{autosave:o?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function Qi(e,t){const n=ze((e??[]).filter(i=>i?.html?.trim())),r=Date.parse(n?.modified??""),s=n&&Number.isFinite(r)&&(t===void 0||r>t),o=[Date.parse(ze(e??[])?.modified??""),t??NaN].filter(i=>Number.isFinite(i));return{autosave:s&&Pt(n)?n:null,...o.length?{latestAt:Math.max(...o)}:{}}}function Zi({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var pr=e=>e.replace(/\r\n?/g,`
|
|
2079
|
-
`),mr=["recovery","plugin","rest"],ea=["subject","preheader"];function ta(e){let t={},n;for(let s=mr.length-1;s>=0;s--){const o=e.get(mr[s]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const s of ea){const o=r?.[s];typeof o=="string"&&o!==""&&(t={...t,[s]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function Rt(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?pr(t.content):void 0,s=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...s?{changes:[new ee(0,n,0,r)]}:{}},{source:"remote"})}var Ot=e=>typeof e=="string"?e.trim():"";function na(e,t,n){const{version:r,attributes:s}=e.get(),o=s,i=Ot(o.title)||Ot(o.subject)||Ot(t.fallbackTitle);return{version:r,payload:{html:e.getContent(),title:i,subject:o.subject,preheader:o.preheader,description:o.description,common_styles:o.common_styles||"",meta:o.meta,utm_parameters:o.utm_parameters,parent_email:o.parent_email,is_template:o.is_template||!1,is_inited:o.is_inited,tags:o.tags,emailtags:o.emailtags,group:o.group,renderGuid:e.get().docId,project:t.project??o.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source}}}async function ra(e,t,n,r,s){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(s);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,s):t.saveAutosave(r,s)}function oe(e,t=!1){const n={};for(const r of Object.keys(e)){let s=e[r];s!==void 0&&!(typeof s=="number"&&Number.isNaN(s))&&(t&&typeof s=="object"&&s!==null&&(s=oe(s)),n[r]=s)}return n}var sa=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function hr(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!sa.has(t))):{}}function We(e,t,n={}){e&&e.mutate({attributes:oa(e.get().attributes,t)},{source:n.source??"user"})}function oa(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Lt(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function ia(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function gr(e){if(!e)return null;const t=hr(e);return e.common_styles!==void 0&&(t.common_styles=ia(e.common_styles)),Lt(e.html,t)}function Er(e){return e?Lt(e.html,oe(hr(e))):null}var aa=["common_styles","subject","preheader","meta"];function vr(e){if(!e?.html?.trim())return null;const t={};for(const n of aa)la(n,e[n])&&(t[n]=e[n]);return Lt(e.html,t)}function la(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var ca=["modified","lock"];function da(e){if(!e)return null;const t={};for(const n of ca)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var ua=10,fa=(e,t)=>e.key===t.key&&pa(e.serverId,t.serverId),pa=(e,t)=>e==null||e===t;function ma(e){return typeof e?.then=="function"}var br=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},_r=e=>{e.request.serverId!=null&&!Mt(e)&&e.document.markSaved(e.document.get().version)},Mt=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),yr=(e,t)=>t?.content!==void 0&&Zi({hasUnsavedUserEdit:Mt(e)})==="skip",ha=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),ga=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.userTouched.clear(),e.document.get().docId))},Ea=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([s,o])=>e.attributes[s]!==o)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},va=e=>{const t=ta(e.reports),n=Ea(e.lastMerged,t);e.lastMerged=t,n&&(Rt(e.document,n),_r(e))},Nt=(e,t)=>{if(!e.ready&&!Mt(e)){va(e);return}Rt(e.document,t)},ba=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function _a(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:s,resolveTerms:o,canEdit:i,notifyBeforeSave:l,onAdapterError:c,onTimeout:d}=e;let u;const p=new Set,E=new Set,m=()=>p.forEach(f=>f()),b=(f,w)=>{if(!(f.closed||f.ready)){if(f.error!==void 0){f.document.markFailed(f.error),f.document.get().docId;return}_r(f),f.ready=!0,f.document.markReady(),f.document.get().docId,[...f.reports.keys()]}},v=(f,w,T)=>{c?.(w.id,T),!(!w.required||f.closed)&&(f.error=T,f.document.get().docId,w.id,m())},h=(f,w)=>{const T=new Set(w.map(x=>x.id));w.forEach(x=>{x.watch&&f.watchers.push(x.watch(P=>f.closed?!1:f.ready&&(yr(f,P)||f.contentShown===!0&&P?.content!==void 0)?(f.document.get().docId,x.id,!1):(P&&f.reports.set(x.id,P),Nt(f,P),!0)))});const L=(x,P)=>{if(!f.closed){if(!x.required&&yr(f,P)){f.document.get().docId,x.id,x.loaded?.(!1);return}P&&f.reports.set(x.id,P),Nt(f,P),x.loaded?.(P!==null)}},F=()=>{T.size>0||f.closed||(br(f),b(f,[]))},z=[];if(w.forEach(x=>{let P;try{P=x.load()}catch(k){v(f,x,k),T.delete(x.id);return}if(ma(P)){z.push({id:x.id,required:x.required,load:()=>P,...x.loaded?{loaded:k=>x.loaded?.(k)}:{}});return}L(x,P),T.delete(x.id)}),z.length===0){F();return}f.timer=setTimeout(()=>{f.timer=void 0,d?.([...T]),f.document.get().docId,[...T],b(f,[...T])},n),f.timer.unref?.(),z.forEach(x=>{x.load().then(P=>L(x,P)).catch(P=>{v(f,x,P)}).finally(()=>{T.delete(x.id),F()})})},_=async(f,w,T)=>{if(T==="snapshot"||T==="anchor")return;const L=o?.();if(L)return L.resolve({project:w.project??f.project,tags:(f.tags??[]).map(F=>({name:F}))})},y=f=>{if(f.lock===!0&&i?.(f)===!1)return new ur("locked");const w=f.tags?.length??0,T=f.emailtags?.length??0;if(Math.max(w,T)>ua)return new ur("too-many-tags")},S=async(f,w,T)=>{try{await f.document.whenReady()}catch(P){return f.saveError=P,f.saveFailures+=1,f.saveFailures,!1}if(f.closed)return!1;const L=y(f.document.get().attributes);if(L)return f.saveError=L,f.saveFailures+=1,L.reason,m(),!1;if(l&&(await l(ba(f)).catch(()=>{}),f.closed))return!1;let F;try{F=await _(f.document.get().attributes,T,w)}catch(P){return f.saveError=P,f.saveFailures+=1,f.saveFailures,m(),!1}if(f.closed)return!1;const{payload:z,version:x}=na(f.document,T,F);f.document.get().docId;try{const P=f.document.get().serverId!=null,k=await ra(r(),s(f.request.key),w,f.document.get().serverId,z);if(f.closed)return!0;let D;if(w==="snapshot"||w==="anchor"){const M=k?.modified!=null?Date.parse(k.modified):NaN;D=Number.isFinite(M)?M:Date.now(),f.snapshotVersion=x,f.lastRevisionAt=D}else f.document.markSaved(x,k?.id!=null?String(k.id):void 0);const R=f.document.get().serverId;!P&&R!=null&&(f.recoveryFacts={emailId:R,historyLoaded:!0,isRecovering:!1},ne(f.request.key)||(f.request={...f.request,key:he(R),serverId:R})),f.saveError=void 0,f.saveFailures=0,f.document.get().serverId,m();const B={intent:w,serverId:f.document.get().serverId,created:!P,...D!==void 0?{revisionAt:D}:{}};return E.forEach(M=>M(B)),!0}catch(P){return f.saveError=P,f.saveFailures+=1,f.saveFailures,m(),!1}},A=()=>{u&&(u.closed=!0,u.watchers.forEach(f=>f()),u.watchers=[],br(u),u.history.dispose(),u.document.dispose(),u=void 0)},C=(f,w,T)=>{let L=!1;w.show&&(f.show?.id!==w.show.id||f.show.token!==w.show.token)&&(f.show=w.show,L=!0,{docId:f.document.get().docId,...w.show});const F=T==="show"?Er(w.patch):null;F&&(f.reports.set("plugin",F),Nt(f,F),ga(f,F)),L&&m()},g=(f,w={})=>{const T=u;return!T||T.closed||f==="materialize"&&T.document.get().serverId!=null?Promise.resolve(!1):T.saving?f==="snapshot"||f==="materialize"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>g(f,w)):(T.saving=!0,m(),T.inFlight=S(T,f,w).finally(()=>{T.saving=!1,T.inFlight=void 0,u===T&&!T.closed&&m()}),T.inFlight)},I=(f,w="open")=>{if(u&&!u.closed&&w!=="new"&&fa(u.request,f))return C(u,f,w),u.document;A();const T=Ui({createBuffer:()=>Li(""),serverId:f.serverId??null}),L={request:f,show:f.show,document:T,history:Gi(T,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=L,L.watchers.push(ha(L)),T.get().docId,f.serverId,h(L,t(f,{publishRecoveryFacts(F){L.closed||(L.recoveryFacts=F,m())},readShownContent:()=>L.closed?null:L.document.getContent()})),m(),T};return{openWith:I,open:(f,w={})=>I({key:he(f),serverId:f,email:w.email,patch:w.patch,show:w.show},"open"),openDraft:(f,w={})=>I({key:he(void 0),serverId:null,email:f,patch:w.patch,show:w.show},"open"),startNewDraft:(f,w={})=>I({key:he(void 0),serverId:null,email:f,patch:w.patch,show:w.show},"new"),reload:(f,w={})=>I({key:he(f),serverId:f,email:w.email,patch:w.patch,show:w.show},"new"),openBlock:(f,w)=>I({key:ne(f)?f:Ki(f),serverId:w?.id!=null?String(w.id):null,email:w},"open"),show:(f,w)=>{const T=u;if(!(!T||T.closed))return I({...T.request,patch:f,show:w},"show")},current:()=>u?.document,noteServerFacts:({serverId:f,block:w},T)=>{const L=u;!L||L.closed||L.request.serverId!==f||ne(L.request.key??"")===w&&Rt(L.document,da(T))},save:g,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0}),revisionFacts(){if(!u)return;const f=u.revisionFactsSnapshot;return f&&f.snapshotVersion===u.snapshotVersion&&f.lastRevisionAt===u.lastRevisionAt?f:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(f){u&&!u.closed&&(u.forcedHeaders=f)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(f){return E.add(f),()=>E.delete(f)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(f){return p.add(f),()=>p.delete(f)},close(){u&&(A(),m())}}}var Sr=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function wr(e){if(e instanceof Sr)return e.reason;if(e instanceof qe)return wr(e.reason)}function ya(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new Sr("not-found");return gr(n)}}}var Ir=a.createIdentifier$1("EmailPort");function Sa(e){return e.getInstance(Ir)}function wa(e,t){e.inject(Ir,t)}var Tr=a.createIdentifier$1("documentSession.restEmailPortFactories");function Ar(e){return e.getInstance(Tr)!==void 0}function fe(e){const t=e.getInstance(Tr);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var Ia=a.createIdentifier$1("EmailTermsResolver");function Ta(e){return e.getInstance(Ia)}var Cr=a.createIdentifier$1("EmailHistoryPort"),Aa=a.createIdentifier$1("BlockHistoryPort");function Dr(e){return e.getInstance(Aa)}function Pr(e){return e.getInstance(Cr)}function Ca(e,t){e.inject(Cr,t)}var Da="em_autosave_pending",vh=6e4;function Ke(e){return`${Da}_${e}`}function Pa(e,t){try{sessionStorage.setItem(Ke(e),JSON.stringify(t))}catch{}}function Ra(e){try{const t=sessionStorage.getItem(Ke(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(Ke(e)),null):n}catch{return null}}function Xe(e){try{sessionStorage.removeItem(Ke(e))}catch{}}var Oa=2e3,La=5e3,Ma=5,Na=5e3,xa=4;function ka(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function Fa(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2102
|
+
__useblocks__.define("useblocks.js",["require","exports","module","static/umd/b11043e6.js","static/umd/e8914784.js","static/umd/d786efbb.js"],function(Et,ne,Xv){Object.defineProperties(ne,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const Kt=Et("./static/umd/b11043e6.js"),l=Et("./static/umd/e8914784.js"),Pa=Et("./static/umd/d786efbb.js");var Ra=new Function("url","return import(url)");function Oa(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Xt(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Br(e){return e.type==="umd"||e.resolve==="registry"}var Ma="If the plugin is built on globals, enable the compatibility layer: the `compatGlobals` option of the bundler plugin or `import '<package>/compat-globals'` before creating the editor.";function La(e){const t=Array.isArray(e)?e[0]:e;return Xt(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function Na(e,t){const n=La(e),r=Xt(e)?e:void 0,s=t instanceof Error?t.message:String(t),o=r&&Br(r)&&!/compat/iu.test(s)?` ${Ma}`:"",i=new Error(`Plugin "${n}" was skipped: it failed to load. ${s}${o}`);return i.cause=t,{name:n,url:r?.url,error:i}}function xa(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}function Jv(e){return e}var ka=class{_context;_pluginRegistry;_options;_map=new Map;_optionsMap=new Map;_readyMap=new Map;_resolveMap=new Map;_initializingPlugins=new Map;_creatingPlugins=new Set;_initializedPlugins=new Set;_creationOrder=[];_lifecycleListeners=new Set;_activated=!1;constructor(e,t,n={}){this._context=e,this._pluginRegistry=t,this._options=n}activate(){return this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}activateSync(){this._activated=!0,this._startPluginsBatch(Array.from(this._map.values()))}onLifecycle(e){return this._lifecycleListeners.add(e),{dispose:()=>this._lifecycleListeners.delete(e)}}_emitLifecycle(e){for(const t of Array.from(this._lifecycleListeners))try{t(e)}catch{}}async _resolveEntry(e){if(typeof e=="string"||typeof e=="symbol"){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);return{ctor:t}}if(typeof e=="function")return e.length===0?{ctor:await e()}:{ctor:e};if(Array.isArray(e)){const[t,n]=e;if(typeof t=="function")return{ctor:t,options:n};const r=await this._pluginRegistry.getAsync(t);if(!r)throw new Error(`Plugin "${String(t)}" not registered.`);return{ctor:r,options:n}}if(Xt(e))return this._resolveDescriptor(e);throw new Error(`Unknown plugin entry format: ${JSON.stringify(e)}`)}async _resolveDescriptor(e){const t=e.resolve??(e.type==="umd"?"window":"module");if(Br(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Ra(e.url);if(t==="module")return{ctor:n.default??n};if(t==="registry"&&e.name){const r=await this._pluginRegistry.getAsync(e.name);if(!r)throw new Error(`Plugin "${e.name}" not found in registry after ESM load`);return{ctor:r}}}if(e.type==="umd"){if(await this._loadScript(e.url),t==="window"&&e.name){const n=globalThis[e.name];if(!n)throw new Error(`Plugin "${e.name}" not found on window after script load`);return{ctor:n}}if(t==="registry"&&e.name){const n=await this._pluginRegistry.getAsync(e.name);if(!n)throw new Error(`Plugin "${e.name}" not found in registry after script load`);return{ctor:n}}}throw new Error(`Cannot resolve descriptor: type=${e.type}, resolve=${t}, name=${e.name??"none"}`)}_loadScript(e){return new Promise((t,n)=>{if(typeof document>"u"){n(new Error("Cannot load UMD script in non-browser environment"));return}const r=document.createElement("script");r.src=e,this._options.explainScriptFailure?.();let s;const o=a=>{s||(a.filename===r.src?s=this._scriptExecutionError(e,a.error??a.message):xa(a)&&(s=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},i=()=>window.removeEventListener("error",o);window.addEventListener("error",o),r.onload=()=>{if(i(),s){n(s);return}t()},r.onerror=()=>{i(),n(new Error(`Failed to load script: ${e}`))},document.head.appendChild(r)})}_scriptExecutionError(e,t){const n=t instanceof Error?t.message:String(t),r=new Error(`Plugin script "${e}" threw while executing: ${n}`);return r.cause=t,r}initSync(e){const t=[];for(const n of e){const r=this._createOrSkip(n,void 0);r&&t.push(r)}this._activated=!0,this._startPluginsBatch(t)}async init(e){const t=[],n=new Set;for(const r of e){const s=await this._resolveOrSkip(r);if(!s)continue;const o=this._createOrSkip(s.ctor,s.options);o&&!n.has(o)&&(n.add(o),t.push(o))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const i of e){const a=await this._resolveOrSkip(i);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((i,a)=>{t.has(a)||r.push({key:a,plugin:i})});for(let i=r.length-1;i>=0;i--){const{key:a,plugin:c}=r[i];await this._initializingPlugins.get(c),await this._disposePlugin(c,c.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(c),this._resolveMap.delete(c),this._initializingPlugins.delete(c),this._initializedPlugins.delete(c);const d=this._creationOrder.indexOf(c);d>=0&&this._creationOrder.splice(d,1)}const s=[],o=new Set;for(const{ctor:i,options:a}of n){const c=this._createOrSkip(i,a);c&&!o.has(c)&&(o.add(c),s.push(c))}this._activated&&await this._startPluginsBatch(s)}isReady(e){return this._initializedPlugins.has(e)}ready(e){return this._initializingPlugins.get(e)??this._readyMap.get(e)??Promise.resolve()}async waitFor(e,t){if(this._pluginRegistry.has(e))return this.useByKeyAsync(e);const{timeout:n}=t??{};return await new Promise((r,s)=>{let o,i=!1;const a=()=>{i||(i=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(o=setTimeout(()=>{i||(i=!0,this._pluginRegistry.off(e,a),s(new Error(`waitFor("${String(e)}") timed out after ${n}ms`)))},n))}),this.useByKeyAsync(e)}useByKey(e){const t=this._pluginRegistry.get(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered or not loaded yet. Use useByKeyAsync() for async plugins.`);const n=this._getOrCreate(t);return this._activated&&this._startPluginsBatch([n]),n}async useByKeyAsync(e){const t=await this._pluginRegistry.getAsync(e);if(!t)throw new Error(`Plugin "${String(e)}" not registered.`);const n=this._getOrCreate(t);return this._activated&&await this._startPluginsBatch([n]),n}useByCtor(e,t){const n=this._getOrCreate(e,t);return this._activated&&this._startPluginsBatch([n]),n}use(e){return typeof e=="function"?this.useByCtor(e):this.useByKey(e)}async useAsync(e){const{ctor:t,options:n}=await this._resolveEntry(e),r=this._getOrCreate(t,n);return this._activated&&await this._startPluginsBatch([r]),r}_getOrCreate(e,t){const n=e;if(!this._map.has(n)){t!==void 0&&this._optionsMap.set(n,t);const r=this._optionsMap.get(n),s=this._createPluginInstance(e,r),o=s.constructor.name;this._emitLifecycle({type:"created",plugin:s,name:o}),s.required?.(),this._map.set(n,s),this._creationOrder.push(s),this._setupReadyPromise(s)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=Na(e,t);try{this._options.reportLoadFailure?.(n)}catch{}return}}_createOrSkip(e,t){try{return this._getOrCreate(e,t)}catch(n){const r=e.name||"anonymous plugin";this._emitLifecycle({type:"create:error",ctor:e,name:r,error:n});return}}_createPluginInstance(e,t){const n=e;if(this._creatingPlugins.has(n))throw new Error(`Cyclic dependency for plugin ${e.name}`);this._creatingPlugins.add(n);const r=this._options.openEarlyWindow?.();try{return Oa(e)?new e(this._context,t):e(this._context,t)||{}}finally{r?.(),this._creatingPlugins.delete(n)}}_setupReadyPromise(e){const t=new Promise(n=>{this._resolveMap.set(e,n)});this._readyMap.set(e,t)}async _startPluginsBatch(e){const t=Array.from(new Set(e)),n=new Set,r=[];for(const s of t){if(this._initializedPlugins.has(s))continue;const o=this._initializingPlugins.get(s);if(o){n.add(o);continue}r.push(s)}if(r.length>0){const s=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,s);n.add(s),s.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===s&&this._initializingPlugins.delete(o)})}await Promise.all(n)}async _runBatchLifecycle(e){const t=[];for(const n of e){const r=n.constructor.name;this._emitLifecycle({type:"init:start",plugin:n,name:r});const s=this._options.openEarlyWindow?.();try{await n.init?.(),this._emitLifecycle({type:"init:success",plugin:n,name:r}),t.push(n)}catch(o){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:o})}finally{s?.()}}for(const n of t){const r=n.constructor.name;this._emitLifecycle({type:"afterInit:start",plugin:n,name:r});try{await n.afterInit?.(),this._emitLifecycle({type:"afterInit:success",plugin:n,name:r})}catch(s){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:s})}}for(const n of e)this._initializedPlugins.add(n),this._resolveMap.get(n)?.(),this._resolveMap.delete(n)}async _disposePlugin(e,t){this._emitLifecycle({type:"dispose:start",plugin:e,name:t});try{await e.dispose?.(),this._emitLifecycle({type:"dispose:success",plugin:e,name:t})}catch(n){this._emitLifecycle({type:"dispose:error",plugin:e,name:t,error:n})}}async dispose(){for(let e=this._creationOrder.length-1;e>=0;e--){const t=this._creationOrder[e];await this._initializingPlugins.get(t),await this._disposePlugin(t,t.constructor.name)}this._map.clear(),this._optionsMap.clear(),this._readyMap.clear(),this._resolveMap.clear(),this._initializingPlugins.clear(),this._initializedPlugins.clear(),this._creationOrder.length=0,this._lifecycleListeners.clear()}getStatus(){return Array.from(this._map.values()).map(e=>({name:e.constructor.name,initialized:this._initializedPlugins.has(e)}))}},Fa=class{_plugins=new Map;_listeners=new Map;_getOrCreateEntry(e){let t=this._plugins.get(e);return t||(t={overrides:[]},this._plugins.set(e,t)),t}_applyOverrides(e,t){const n=this._plugins.get(e);if(n?.overrides)for(const r of n.overrides)t=r(t)||t;return t}_notifyListeners(e,t){const n=this._listeners.get(e);if(!n||n.length===0)return;for(const s of n)try{s.callback(t)}catch{}const r=n.filter(s=>!s.once);r.length>0?this._listeners.set(e,r):this._listeners.delete(e)}get(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor)}async getAsync(e){const t=this._plugins.get(e);if(t?.ctor)return this._applyOverrides(e,t.ctor);if(t?.loading){const n=await t.loading;return this._applyOverrides(e,n)}if(t?.factory){const n=Promise.resolve(t.factory()).then(s=>(t.ctor=s,t.loading=void 0,this._notifyListeners(e,s),s));t.loading=n;const r=await n;return this._applyOverrides(e,r)}return new Promise(n=>{this.on(e,r=>n(this._applyOverrides(e,r)))})}add(e,t){const n=this._getOrCreateEntry(e);n.ctor=t,this._notifyListeners(e,t)}addAll(e){for(const t of Object.keys(e)){const n=e[t];n!==void 0&&this.add(t,n)}}addAsync(e,t){const n=this._getOrCreateEntry(e);return n.factory=t,{dispose:()=>{n.ctor||(n.factory=void 0)}}}has(e){const t=this._plugins.get(e);return!!(t?.ctor||t?.factory)}isLoaded(e){return!!this._plugins.get(e)?.ctor}override(e,t){const n=this._getOrCreateEntry(e);return n.overrides.push(t),{dispose:()=>{const r=n.overrides.indexOf(t);r>=0&&n.overrides.splice(r,1)}}}on(e,t){const n=this.get(e);n&&t(n);let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!1};return r.push(s),{dispose:()=>this._removeListener(e,t)}}once(e,t){const n=this.get(e);if(n)return t(n),{dispose:()=>{}};let r=this._listeners.get(e);r||(r=[],this._listeners.set(e,r));const s={callback:t,once:!0};return r.push(s),{dispose:()=>this._removeListener(e,t)}}off(e,t){this._removeListener(e,t)}_removeListener(e,t){const n=this._listeners.get(e);if(n){const r=n.findIndex(s=>s.callback===t);r>=0&&n.splice(r,1),n.length===0&&this._listeners.delete(e)}}keys(){return Array.from(this._plugins.keys())}forContext(){const e=this;return{add(t,n){e.add(t,n)}}}},Ba=class{resolveRegistry;constructor(e){this.resolveRegistry=e}target(){return this.resolveRegistry()}get(e){return this.target().get(e)}getAsync(e){return this.target().getAsync(e)}add(e,t){return this.target().add(e,t)}addAll(e){return this.target().addAll(e)}addAsync(e,t){return this.target().addAsync(e,t)}has(e){return this.target().has(e)}isLoaded(e){return this.target().isLoaded(e)}override(e,t){return this.target().override(e,t)}on(e,t){return this.target().on(e,t)}once(e,t){return this.target().once(e,t)}off(e,t){return this.target().off(e,t)}keys(){return this.target().keys()}forContext(){return this.target().forContext()}},jr=class{capacity;items=[];constructor(e){this.capacity=e}push(e){this.items.length>=this.capacity&&this.items.shift(),this.items.push(e)}snapshot(){return this.items.slice()}size(){return this.items.length}clear(){this.items=[]}};function ja(e,t){return t+e}function Ua(){return typeof performance>"u"?Date.now():ja(performance.now(),performance.timeOrigin)}var Ha="emailmaker:diagnostics",$a="diagnostics",Va="diagnostics";function Ur(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Va}=1`:e}var Jt;function Ga(){try{const e=new URLSearchParams(window.location.search).get($a);return e===null?void 0:e!=="0"}catch{return}}function Ya(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Wa(){try{const e=window.localStorage.getItem(Ha);return e===null?void 0:e==="1"}catch{return}}function He(){return Jt===void 0&&(Jt=typeof window>"u"?!1:Ga()??Ya()??Wa()??!1),Jt}function qa(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var te={initStart:"loader:init:start",coreReady:"loader:core:ready",initEnd:"loader:init:end",chunksLoaded:"app:chunks:loaded",showStart:"show:start",showEnd:"show:end",canvasCreated:"canvas:created",canvasLoaded:"canvas:loaded",canvasPainted:"canvas:painted",appVisible:"app:visible",editorVisible:"editor:visible",canvasSettled:"canvas:settled"},Qv=Object.values(te),Zv=[te.canvasPainted,te.canvasSettled,te.appVisible,te.editorVisible],za=5e3,Ka=3e3,Hr="diagnosticsStore",vt,$e;function $r(){return{marks:new jr(za),resources:new jr(Ka)}}function Vr(){if($e)return $e;const e=Qt();return e?($e=e[Hr]??vt??$r(),e[Hr]=$e,vt=void 0,$e):(vt??=$r(),vt)}function W(e,t){He()&&Vr().marks.push({phase:e,at:Ua(),...t})}function Qt(){if(typeof __useblocks__<"u"&&__useblocks__)return __useblocks__;if(typeof window>"u")return;const e=window[qa()];return e!==null&&typeof e=="object"?e:void 0}function Xa(e){const t=e.length,n=Vr();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function Ja(){const e=Qt();return!e||!Array.isArray(e.diagnosticsBuffer)?0:Xa(e.diagnosticsBuffer)}var Qa="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function me(){const e=new Error(Qa);return e.name="DestroyedInstanceError",e}function Za(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function Zt(e,t){if(e===t)return!0;if(!e||!t||typeof e!="object"||typeof t!="object")return!1;const n=Array.isArray(e);if(n!==Array.isArray(t))return!1;if(n){const o=e,i=t;return o.length===i.length&&o.every((a,c)=>Zt(a,i[c]))}const r=Object.keys(e),s=Object.keys(t);return r.length!==s.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Zt(e[o],t[o]))}function Gr(e,t){const n={watch(r){let s,o=!1;return e.watch(i=>{const a=t(i);o&&Zt(s,a)||(s=a,o=!0,r(a))})},select(r){return Gr(n,r)}};return n}function ce(...e){let t=e[0],n=e.length>0;const r=new Set,s={get(){return n?t:void 0},set(o){t=o,n=!0;for(const i of Array.from(r))i(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return Gr(s,o)}};return s}var el=class{http;constructor(e){this.http=e}app_init_create=(e,t={})=>this.http.request({path:"/app/v1/app_init",method:"POST",body:e,type:l.ContentType.UrlEncoded,...t})},Yr=class{http;constructor(e){this.http=e}get_translations2=({file:e,...t},n={})=>this.http.request({path:`/translations/v1/${e}`,method:"GET",...n});get_translations3=({id:e,file:t,...n},r={})=>this.http.request({path:`/translations/v1/${t}/${e}`,method:"GET",...r})};function tl(e){return String(e||"").trim()||void 0}var nl=class extends l.Disposable{deps;_app;_baseUrl;_appInit;_restBaseUrl;_prevApp;constructor(e){super(),this.deps=e,this.addDisposable(e.options.select(t=>this._slice(t)).watch(t=>this._start(t)))}get app(){return this._app}_slice(e){return Object.prototype.hasOwnProperty.call(e,"baseUrl")&&(this._baseUrl=tl(e.baseUrl)),Object.prototype.hasOwnProperty.call(e,"appInit")&&(this._appInit=e.appInit),{appInit:this._appInit,user:e.user,project:e.project,baseUrl:this._baseUrl,restBaseUrl:this.deps.resolveRestBaseUrl(this._baseUrl),standalone:this.deps.isStandalone()}}_start(e){if(this._restBaseUrl!==e.restBaseUrl&&(this._restBaseUrl=e.restBaseUrl,this.deps.setRestBaseUrl(e.restBaseUrl)),e.standalone)return;const t=e.appInit||this.deps.fallbackAppInit,n=Promise.resolve(t({baseUrl:e.baseUrl,user:e.user,project:e.project,prevApp:this._prevApp}));this._app=n,n.then(r=>{this._app===n&&(this._prevApp=r)},()=>{}),this.deps.publish(n)}},en=l.createIdentifier$1("AppInitService");function rl(e){return async()=>{const t=await e();return(await new el(t).app_init_create({})).data}}function sl(e){e.injectFactory(en,(t,n)=>{if(n)return n;const r=new nl({options:e.getInstance(l.OPTIONS_SOURCE_ID),isStandalone:()=>!!e.getInstance(l.SECURITY_MODULE_ID),resolveRestBaseUrl:s=>s?l.getActiveBaseUrl(s):l.getActiveBaseUrl()||void 0,setRestBaseUrl:s=>{e.getInstance(l.REST_CLIENT_FACTORY_ID)?.setOptions(s?{baseUrl:s}:{})},fallbackAppInit:rl(()=>e.getInstanceAsync(l.REST_TRANSPORT_ID)),publish:s=>{e.inject(l.APP_ID,s)}});return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var tn=l.createIdentifier$1("documentSession.emailDocuments");function Me(e){return e?.getInstance(tn)}var ol=l.createIdentifier$1("RevisionServiceFlag");function Wr(e){return e.getOrCreateInstance(ol,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function qr(e){return Wr(e).isEnabled()}var il=l.createIdentifier$1("EmailRightsResolver");function al(e,t){const n=e.getInstance(il);return n?n(t):!0}var zr=l.createIdentifier$1("EmailHistoryAvailabilityResolver");function ll(e){return e.getInstance(zr)!==void 0}async function cl(e){const t=e.getInstance(zr);if(!t)return!0;try{return await t()}catch{return!1}}var nn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Kr=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Xr=2e4,dl=Kr.reduce((e,t)=>e+nn[t],0),Jr=Xr+dl+3e3;function ul(e){return Kr.reduce((t,n)=>t+Qr(n,e),0)}function Qr(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:nn[e]}function Zr(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Jr}function es(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Xr}function rn(e=Jr){return e+3e3}var e_="[show-pipeline]";function ts(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}function t_(e,t){}var fl=()=>rn();function pl(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function hl(e){return t=>pl(e.getOrCreateInstance(l.events.BEFORE_SAVE_EMAIL,()=>new l.AsyncEmitter).fire(t),fl())}function ml(e){return e!=null&&e!==""}var ns;function Ve(e,t){return ns?.capture(e,t)}function gl(e,t){return ns?.captureMessage(e,t)}function El(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function _t(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var ae=class{oldPosition;oldText;newPosition;newText;get oldLength(){return this.oldText.length}get oldEnd(){return this.oldPosition+this.oldText.length}get newLength(){return this.newText.length}get newEnd(){return this.newPosition+this.newText.length}constructor(e,t,n,r){this.oldPosition=e,this.oldText=t,this.newPosition=n,this.newText=r}toString(){return this.oldText.length===0?`(insert@${this.oldPosition} "${_t(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${_t(this.oldText)}")`:`(replace@${this.oldPosition} "${_t(this.oldText)}" with "${_t(this.newText)}")`}};function rs(e,t){return e===null||e.length===0?t:new vl(e,t).compress()}var vl=class he{_prevEdits;_currEdits;_result;_resultLen;_prevLen;_prevDeltaOffset;_currLen;_currDeltaOffset;constructor(t,n){this._prevEdits=t,this._currEdits=n,this._result=[],this._resultLen=0,this._prevLen=this._prevEdits.length,this._prevDeltaOffset=0,this._currLen=this._currEdits.length,this._currDeltaOffset=0}compress(){let t=0,n=0,r=this._getPrev(t),s=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(s===null)break;this._acceptCurr(s),s=this._getCurr(++n);continue}if(s===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldEnd<=r.newPosition){this._acceptCurr(s),s=this._getCurr(++n);continue}if(r.newEnd<=s.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(s.oldPosition<r.newPosition){const[c,d]=he._splitCurr(s,r.newPosition-s.oldPosition);this._acceptCurr(c),s=d;continue}if(r.newPosition<s.oldPosition){const[c,d]=he._splitPrev(r,s.oldPosition-r.newPosition);this._acceptPrev(c),r=d;continue}let i,a;if(s.oldEnd===r.newEnd)i=r,a=s,r=this._getPrev(++t),s=this._getCurr(++n);else if(s.oldEnd<r.newEnd){const[c,d]=he._splitPrev(r,s.oldLength);i=c,a=s,r=d,s=this._getCurr(++n)}else{const[c,d]=he._splitCurr(s,r.newLength);i=r,a=c,r=this._getPrev(++t),s=d}this._result[this._resultLen++]=new ae(i.oldPosition,i.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=i.newLength-i.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const o=he._merge(this._result);return he._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=he._rebaseCurr(this._prevDeltaOffset,t),this._currDeltaOffset+=t.newLength-t.oldLength}_getCurr(t){return t<this._currLen?this._currEdits[t]:null}_acceptPrev(t){this._result[this._resultLen++]=he._rebasePrev(this._currDeltaOffset,t),this._prevDeltaOffset+=t.newLength-t.oldLength}_getPrev(t){return t<this._prevLen?this._prevEdits[t]:null}static _rebaseCurr(t,n){return new ae(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new ae(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),s=t.newText.substr(n);return[new ae(t.oldPosition,t.oldText,t.newPosition,r),new ae(t.oldEnd,"",t.newPosition+n,s)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),s=t.oldText.substr(n);return[new ae(t.oldPosition,r,t.newPosition,t.newText),new ae(t.oldPosition+n,s,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,s=t[0];for(let o=1;o<t.length;o++){const i=t[o];s.oldEnd===i.oldPosition?s=new ae(s.oldPosition,s.oldText+i.oldText,s.newPosition,s.newText+i.newText):(n[r++]=s,s=i)}return n[r++]=s,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let s=0;s<t.length;s++){const o=t[s];o.oldText!==o.newText&&(n[r++]=o)}return n}};function _l(e){return new ae(e.newPosition,e.newText,e.oldPosition,e.oldText)}function bl(e){return e.map(_l)}function ss(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function yl(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const s=t[r];n=n.slice(0,s.oldPosition)+s.newText+n.slice(s.oldEnd)}return n}function Sl(e,t,n){let r=0;const s=e.start===e.end;for(const o of t){const i=o.newLength-o.oldLength;if(o.oldLength===0){const a=o.oldPosition;if(s&&a===e.start)r+=n==="after"?i:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=i)}continue}if(s){if(e.start>=o.oldEnd)r+=i;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=i;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var Ge=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},os=0,Il=Math.random().toString(36).slice(2,8);function wl(){return os+=1,`doc-${Il}-${os}`}function Tl(e){const t=e.createBuffer(),n=e.docId??wl();let r=e.serverId??null,s=0,o=null,i=e.attributes??{};const a=new Set;let c=!1,d=!1,u;const f=new Set;let g=null;const E=()=>(g?.version!==s&&(g={version:s,value:t.read()}),g.value),S=b=>Object.entries(b).some(([h,y])=>i[h]!==y);return{get:()=>({docId:n,serverId:r,version:s,savedVersion:o,attributes:i}),getContent:E,mutate(b,{source:h}){if(c)return s;const y=b.changes?.length?b.changes:void 0,w=y?yl(E(),y):b.content!==void 0?b.content:void 0,A=w!==void 0&&w!==E(),D=b.attributes!==void 0&&S(b.attributes);if(!A&&!D)return s;const N=!(s>(o??-1)),m=D?Object.keys(b.attributes).filter(C=>i[C]!==b.attributes[C]):[];A&&t.write(w),D&&(i={...i,...b.attributes}),s+=1,h!=="user"&&N&&(o=s);const _={source:h,version:s,changes:y,...A?{content:!0}:{},...m.length>0?{attributes:m}:{}};return a.forEach(C=>C(_)),s},markSaved(b,h){const y={serverId:r,savedVersion:o};h!==void 0&&(r=h),(o===null||b>o)&&(o=b),(y.serverId!==r||y.savedVersion!==o)&&a.forEach(w=>w({source:"system",version:s}))},markUnsaved(){c||o===null||o<s||(o=s-1,a.forEach(b=>b({source:"system",version:s})))},markReady(){d||u!==void 0||(d=!0,f.forEach(b=>b.resolve()),f.clear(),a.forEach(b=>b({source:"system",version:s})))},isReady:()=>d,markFailed(b){d||u!==void 0||c||(u=b,f.forEach(h=>h.reject(new Ge(b))),f.clear(),a.forEach(h=>h({source:"system",version:s})))},failure:()=>u,whenReady(){return d?Promise.resolve():u!==void 0?Promise.reject(new Ge(u)):c?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((b,h)=>{f.add({resolve:b,reject:h})})},subscribe(b){return a.add(b),()=>a.delete(b)},isNew:()=>r===null,isDirty:()=>s>(o??-1),isDisposed:()=>c,dispose(){c=!0,f.forEach(b=>b.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),f.clear(),a.clear(),t.dispose()}}}var Cl=500,Al=100,sn=0;function Dl(e,t={}){const n=t.groupIntervalMs??Cl,r=t.maxSteps??Al,s=t.now??(()=>0);let o=[],i=0,a=sn+=1,c=null,d=!1,u=!1,f=!1;const g=new Set,E=()=>g.forEach(m=>m()),S=(m,_)=>{if(m.length){u=!0;try{e.mutate({changes:m},{source:_})}finally{u=!1}}},b=m=>S(m,"user"),h=m=>{const _=s();d&&c!==null&&_-c<n?o[i-1]=rs(o[i-1],m):(o=o.slice(0,i),o.push(m),i=o.length,d=!0,o.length>r&&(o=o.slice(o.length-r),i=o.length,a=sn+=1)),c=_,E()},y=()=>{d=!1,c=null},w=m=>{if(!m.length)return;const _=o.length>i;_&&(o=o.slice(0,i)),i>0&&(o[i-1]=rs(o[i-1],m)),y(),_&&E()},A=e.subscribe(({source:m,changes:_})=>{if(!(f||u||!_?.length)){if(m==="remote"){D();return}if(m!=="user"){w(_);return}h(_)}}),D=()=>{o=[],i=0,y(),a=sn+=1,E()},N=()=>{if(i===0)return!1;const m=bl(o[i-1]);return ss(e.getContent(),m)?(b(m),i-=1,y(),!0):(o=o.slice(0,i-1),i=o.length,y(),E(),!1)};return{canUndo:()=>i>0,canRedo:()=>i<o.length,undo(){N()&&E()},redo(){if(!(i>=o.length)){if(!ss(e.getContent(),o[i])){o=o.slice(0,i),y(),E();return}b(o[i]),i+=1,y(),E()}},clear:D,applyWithoutHistory(m){const _=e.get().version;if(S(m,"system"),e.get().version===_){y();return}w(m)},getPast:m=>o.slice(0,i).reverse().slice(0,m),getFuture:m=>o.slice(i).reverse().slice(0,m),createSnapshot:()=>({stackId:a,index:i}),restoreSnapshot(m){if(m.stackId!==a||m.index>i)return!1;for(;i>m.index;)if(!N())return E(),!1;return E(),!0},subscribe(m){return g.add(m),()=>g.delete(m)},dispose(){f=!0,A(),g.clear(),o=[],i=0}}}var Pl=["edit","move","resize","insert"];function on(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Rl(e){return typeof e=="string"?e:null}function Ol(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Ml(e){return Pl.includes(e)?e:null}function Ll(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Rl(t.originId),changeId:on(t.changeId),rev:on(t.rev),baseRev:on(t.baseRev),expected:Ol(t.expected),intent:Ml(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var Ye=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},is=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleEmailAutosave did not respond within ${e}ms — the autosave was not written`),this.timeoutMs=e,this.name="IntegratorAutosaveTimeoutError"}},an=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail did not respond within ${e}ms — the email was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}};function Nl(){return typeof navigator<"u"&&navigator.onLine===!1}function xl(e){if(e==null)return[];const t=[e];if(typeof e!="object")return t;const n=e;if(n.error!=null&&(t.push(n.error),typeof n.error=="object")){const r=n.error;r.data!=null&&t.push(r.data),r.error!=null&&t.push(r.error)}if(n.data!=null&&(t.push(n.data),typeof n.data=="object")){const r=n.data;r.error!=null&&t.push(r.error)}return n.innerException!=null&&t.push(n.innerException),t}function as(e){if(!e)return!1;if(typeof e=="string"){const n=e.toLowerCase();return n.includes("fetch")||n.includes("network")||n.includes("timeout")||n.includes("failed to fetch")||n.includes("load failed")||n.includes("networkerror")}if(e instanceof Error)return as(e.message);if(typeof e!="object")return!1;const t=e;return t.status==="FETCH_ERROR"||t.status==="TIMEOUT_ERROR"||t.status==="PARSING_ERROR"?!0:typeof t.status=="number"?t.status===0||t.status===408||t.status>=500:!1}function kl(e){return Nl()?!0:xl(e).some(as)}var ls=new WeakSet,cs=new WeakMap;function ds(e){typeof e=="object"&&e!==null&&ls.add(e)}function Fl(e,t){typeof e=="object"&&e!==null&&cs.set(e,t)}function Bl(e){return typeof e=="object"&&e!==null?cs.get(e):void 0}function jl(e){return e instanceof an||e instanceof is||typeof e=="object"&&e!==null&&ls.has(e)}function Ul(e){return e instanceof Ye||jl(e)}function Hl(e){return!Ul(e)&&kl(e)}var us="draft";function Le(e){return e==null||e===""?us:String(e)}function $l(e){return e==null||e===""?`${ln}${us}`:`${ln}${String(e)}`}var ln="block:";function de(e){return e?.startsWith(ln)===!0}function We(e){return de(e.sessionKey())?void 0:e.current()}function n_(e,t){}function qe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return W(`show:gate:${e}`,{kind:"wait"}),t.then(s=>(W(`show:gate:${e}:end`,{kind:"wait"}),s),s=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw l.isAbortError(s)?(`${e}`,{...n}):(`${e}`,{error:ts(s),...n},void 0),s})}var r_=5e3,Vl=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function Gl(e){const t=e?.trim()??"";if(!Vl.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function ze(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function cn(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Yl(e,t={}){const n=ze((e??[]).filter(r=>r?.html?.trim()));return cn(n,t)?n:null}function Wl(e,t){const n=Date.parse(ze(e)?.modified??""),r=Yl(e),s=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(s)&&s>t,i=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:o?r:null,...i.length?{latestAt:Math.max(...i)}:{}}}function fs(e,t,n){const r=ze((e??[]).filter(c=>c?.html?.trim())),s=Date.parse(r?.modified??""),o=Date.parse(ze((n??[]).filter(c=>c?.html?.trim()))?.modified??""),i=r&&Number.isFinite(s)&&(t===void 0||s>t)&&!(o>s),a=[Date.parse(ze(e??[])?.modified??""),t??NaN].filter(c=>Number.isFinite(c));return{autosave:i&&cn(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function ql({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var ps=e=>e.replace(/\r\n?/g,`
|
|
2103
|
+
`),hs=["recovery","plugin","rest"],zl=["subject","preheader"];function Kl(e){let t={},n;for(let s=hs.length-1;s>=0;s--){const o=e.get(hs[s]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const s of zl){const o=r?.[s];typeof o=="string"&&o!==""&&(t={...t,[s]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function dn(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?ps(t.content):void 0,s=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...s?{changes:[new ae(0,n,0,r)]}:{}},{source:"remote"})}var un=e=>typeof e=="string"?e.trim():"";function Xl(e,t,n,r){const{version:s,attributes:o}=e.get(),i=o,a=r==="snapshot"||r==="anchor",c=a?i.author:void 0,d=a?i.date_gmt:void 0,u=un(i.title)||un(i.subject)||un(t.fallbackTitle);return{version:s,payload:{html:e.getContent(),title:u,subject:i.subject,preheader:i.preheader,description:i.description,common_styles:i.common_styles||"",meta:i.meta,utm_parameters:i.utm_parameters,parent_email:i.parent_email,is_template:i.is_template||!1,is_inited:i.is_inited,tags:i.tags,emailtags:i.emailtags,group:i.group,renderGuid:e.get().docId,project:t.project??i.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...c!=null&&c!==""?{author:c}:{},...d?{excerpt:d}:{}}}}var Jl=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function Ql(e){const t={};for(const n of Jl)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function Zl(e,t,n,r,s){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(s);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,s):t.saveAutosave(r,s)}function ge(e,t=!1){const n={};for(const r of Object.keys(e)){let s=e[r];s!==void 0&&!(typeof s=="number"&&Number.isNaN(s))&&(t&&typeof s=="object"&&s!==null&&(s=ge(s)),n[r]=s)}return n}function ec(e){return typeof e=="string"&&e.includes("autosave")}var tc=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function ms(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!tc.has(t))):{}}function Ke(e,t,n={}){e&&e.mutate({attributes:nc(e.get().attributes,t)},{source:n.source??"user"})}function nc(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function fn(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function rc(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function gs(e){if(!e)return null;const t=ms(e);return e.common_styles!==void 0&&(t.common_styles=rc(e.common_styles)),fn(e.html,t)}function Es(e){return e?fn(e.html,ge(ms(e))):null}var sc=["common_styles","subject","preheader","meta"];function vs(e){if(!e?.html?.trim())return null;const t={};for(const n of sc)oc(n,e[n])&&(t[n]=e[n]);return fn(e.html,t)}function oc(e,t){return e==="common_styles"?typeof t=="string"&&t.startsWith("{"):e==="meta"?typeof t=="object"&&t!==null&&!Array.isArray(t):typeof t=="string"}var ic=["modified","lock"];function ac(e){if(!e)return null;const t={};for(const n of ic)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var lc=10,cc=(e,t)=>e.key===t.key&&dc(e.serverId,t.serverId),dc=(e,t)=>e==null||e===t;function uc(e){return typeof e?.then=="function"}var _s=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},bs=e=>{e.request.serverId!=null&&!pn(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},fc=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),pn=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),ys=(e,t)=>t?.content!==void 0&&ql({hasUnsavedUserEdit:pn(e)})==="skip",pc=e=>e.document.subscribe(t=>{t.source==="user"&&(t.content&&e.userTouched.add("content"),t.attributes?.forEach(n=>e.userTouched.add(n))),e.document.isDirty()||e.userTouched.clear()}),hc=(e,t)=>{!e.ready||t.content===void 0||e.document.get().serverId==null||(e.contentShown=!0,!(![...e.userTouched].every(n=>n==="content"||n in(t.attributes??{}))||!e.document.isDirty())&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent(),e.userTouched.clear(),e.document.get().docId))},mc=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([s,o])=>e.attributes[s]!==o)),r=t.content!==void 0&&t.content!==e.content?t.content:void 0;return r===void 0&&Object.keys(n).length===0?null:r===void 0?{attributes:n}:{content:r,attributes:n}},gc=e=>{const t=Kl(e.reports),n=mc(e.lastMerged,t);e.lastMerged=t,n&&(dn(e.document,n),bs(e))},hn=(e,t)=>{if(!e.ready&&!pn(e)){gc(e);return}dn(e.document,t)},Ec=e=>{const{attributes:t,serverId:n,docId:r}=e.document.get();return{...t,html:e.document.getContent(),id:n??void 0,isNew:n==null,renderGuid:r}};function vc(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:s,resolveTerms:o,canEdit:i,notifyBeforeSave:a,onAdapterError:c,onTimeout:d}=e;let u;const f=new Set,g=new Set,E=()=>f.forEach(p=>p()),S=(p,v)=>{if(!(p.closed||p.ready)){if(p.error!==void 0){p.document.markFailed(p.error),p.document.get().docId;return}bs(p),p.ready=!0,p.document.markReady(),p.document.get().docId,[...p.reports.keys()]}},b=(p,v,T)=>{c?.(v.id,T),!(!v.required||p.closed)&&(p.error=T,p.document.get().docId,v.id,E())},h=(p,v)=>{const T=new Set(v.map(I=>I.id));v.forEach(I=>{I.watch&&p.watchers.push(I.watch(P=>p.closed?!1:p.ready&&(ys(p,P)||p.contentShown===!0&&P?.content!==void 0)?(p.document.get().docId,I.id,!1):(P&&p.reports.set(I.id,P),hn(p,P),!0)))});const L=(I,P)=>{if(!p.closed){if(!I.required&&ys(p,P)){p.document.get().docId,I.id,I.loaded?.(!1);return}P&&p.reports.set(I.id,P),hn(p,P),I.loaded?.(P!==null)}},O=()=>{T.size>0||p.closed||(_s(p),S(p,[]))},F=[];if(v.forEach(I=>{let P;try{P=I.load()}catch(x){b(p,I,x),T.delete(I.id);return}if(uc(P)){F.push({id:I.id,required:I.required,load:()=>P,...I.loaded?{loaded:x=>I.loaded?.(x)}:{}});return}L(I,P),T.delete(I.id)}),F.length===0){O();return}p.timer=setTimeout(()=>{p.timer=void 0,d?.([...T]),p.document.get().docId,[...T],S(p,[...T])},n),p.timer.unref?.(),F.forEach(I=>{I.load().then(P=>L(I,P)).catch(P=>{b(p,I,P)}).finally(()=>{T.delete(I.id),O()})})},y=async(p,v,T)=>{if(T==="snapshot"||T==="anchor")return;const L=o?.();if(L)return L.resolve({project:v.project??p.project,tags:(p.tags??[]).map(O=>({name:O}))})},w=p=>{if(p.lock===!0&&i?.(p)===!1)return new Ye("locked");const v=p.tags?.length??0,T=p.emailtags?.length??0;if(Math.max(v,T)>lc)return new Ye("too-many-tags")},A=(p,v)=>{const T=p.document.get().serverId;v||T==null||(p.recoveryFacts={emailId:T,historyLoaded:!0,isRecovering:!1},de(p.request.key)||(p.request={...p.request,key:Le(T),serverId:T}))},D=(p,v,T)=>{if(p.closed||T?.id==null)return;const L=p.document.get().serverId,O=L!=null;O&&L!==String(T.id)||(p.document.markSaved(v,String(T.id)),A(p,O),p.document.get().serverId,E())},N=async(p,v,T)=>{try{await p.document.whenReady()}catch(P){return p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,!1}if(p.closed)return!1;const L=w(p.document.get().attributes);if(L)return p.saveError=L,p.saveFailures+=1,p.failedIntent=v,L.reason,E(),!1;if(a&&(await a(Ec(p)).catch(()=>{}),p.closed))return!1;if(fc(p))return v==="snapshot"||(p.saveError=new Ye("empty-content"),p.saveFailures+=1,p.failedIntent=v,E()),!1;let O;try{O=await y(p.document.get().attributes,T,v)}catch(P){return p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,E(),!1}if(p.closed)return!1;const{payload:F,version:I}=Xl(p.document,T,O,v);p.document.get().docId;try{const P=p.document.get().serverId!=null,x=await Zl(r(),s(p.request.key),v,p.document.get().serverId,F);if(p.closed)return!0;let J;if(v==="snapshot"||v==="anchor"){const z=x?.modified!=null?Date.parse(x.modified):NaN;J=Number.isFinite(z)?z:Date.now(),p.snapshotVersion=I,p.lastRevisionAt=J}else p.document.markSaved(I,x?.id!=null?String(x.id):void 0),p.savedContent=F.html;A(p,P),p.saveError=void 0,p.saveFailures=0,p.failedIntent=void 0,p.document.get().serverId,E();const re={intent:v,serverId:p.document.get().serverId,created:!P,...J!==void 0?{revisionAt:J}:{}};return g.forEach(z=>z(re)),!0}catch(P){return(v==="publish"||v==="materialize")&&Bl(P)?.then(x=>D(p,I,x)),p.saveError=P,p.saveFailures+=1,p.failedIntent=v,p.saveFailures,E(),!1}},m=()=>{u&&(u.closed=!0,u.watchers.forEach(p=>p()),u.watchers=[],_s(u),u.history.dispose(),u.document.dispose(),u=void 0)},_=(p,v,T)=>{let L=!1;v.show&&(p.show?.id!==v.show.id||p.show.token!==v.show.token)&&(p.show=v.show,L=!0,{docId:p.document.get().docId,...v.show});const O=T==="show"?Es(v.patch):null;O&&(p.reports.set("plugin",O),hn(p,O),hc(p,O)),L&&E()},C=(p,v={})=>{const T=u;return!T||T.closed||p==="materialize"&&T.document.get().serverId!=null?Promise.resolve(!1):T.saving?p==="snapshot"||p==="materialize"?Promise.resolve(!1):(T.inFlight??Promise.resolve(!1)).then(()=>C(p,v)):(T.saving=!0,E(),T.inFlight=N(T,p,v).finally(()=>{T.saving=!1,T.inFlight=void 0,u===T&&!T.closed&&E()}),T.inFlight)},M=(p,v="open")=>{if(u&&!u.closed&&v!=="new"&&cc(u.request,p))return _(u,p,v),u.document;m();const T=Tl({createBuffer:()=>El(""),serverId:p.serverId??null}),L={request:p,show:p.show,document:T,history:Dl(T,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return u=L,L.watchers.push(pc(L)),T.get().docId,p.serverId,h(L,t(p,{publishRecoveryFacts(O){L.closed||(L.recoveryFacts=O,E())},readShownContent:()=>L.closed?null:L.document.getContent()})),E(),T};return{openWith:M,open:(p,v={})=>M({key:Le(p),serverId:p,email:v.email,patch:v.patch,show:v.show},"open"),openDraft:(p,v={})=>M({key:Le(void 0),serverId:null,email:p,patch:v.patch,show:v.show},"open"),startNewDraft:(p,v={})=>M({key:Le(void 0),serverId:null,email:p,patch:v.patch,show:v.show},"new"),reload:(p,v={})=>M({key:Le(p),serverId:p,email:v.email,patch:v.patch,show:v.show},"new"),openBlock:(p,v)=>M({key:de(p)?p:$l(p),serverId:v?.id!=null?String(v.id):null,email:v},"open"),show:(p,v)=>{const T=u;if(!(!T||T.closed))return M({...T.request,patch:p,show:v},"show")},current:()=>u?.document,noteServerFacts:({serverId:p,block:v},T)=>{const L=u;!L||L.closed||L.request.serverId!==p||de(L.request.key??"")===v&&dn(L.document,ac(T))},save:C,saveState:()=>({error:u?.saveError,failures:u?.saveFailures??0,saving:u?.saving===!0,failedIntent:u?.failedIntent}),revisionFacts(){if(!u)return;const p=u.revisionFactsSnapshot;return p&&p.snapshotVersion===u.snapshotVersion&&p.lastRevisionAt===u.lastRevisionAt?p:(u.revisionFactsSnapshot={snapshotVersion:u.snapshotVersion,lastRevisionAt:u.lastRevisionAt},u.revisionFactsSnapshot)},recoveryFacts:()=>u?.recoveryFacts,history:()=>u?.history,forcedHeaders:()=>u?.forcedHeaders,beginForcedHeaders(p){u&&!u.closed&&(u.forcedHeaders=p)},endForcedHeaders(){u&&(u.forcedHeaders=void 0)},onSaved(p){return g.add(p),()=>g.delete(p)},showFacts:()=>u?.show,sessionKey:()=>u?.request.key,openError:()=>u?.error,subscribe(p){return f.add(p),()=>f.delete(p)},close(){u&&(m(),E())}}}var mn=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function gn(e){if(e instanceof mn)return e.reason;if(e instanceof Ge)return gn(e.reason)}function _c(e){const t=e instanceof Ge?e.reason:e;return t instanceof mn&&t.reason==="unavailable"&&t.cause instanceof TypeError}function bc(e){const t=gn(e);return t==="forbidden"||t==="not-found"}function yc(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new mn("not-found");return gs(n)}}}var Ss=l.createIdentifier$1("EmailPort");function Sc(e){return e.getInstance(Ss)}function Ic(e,t){e.inject(Ss,t)}var Is=l.createIdentifier$1("documentSession.restEmailPortFactories");function ws(e){return e.getInstance(Is)!==void 0}function Se(e){const t=e.getInstance(Is);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var wc=l.createIdentifier$1("EmailTermsResolver");function Tc(e){return e.getInstance(wc)}var Ts=l.createIdentifier$1("EmailHistoryPort"),Cc=l.createIdentifier$1("BlockHistoryPort");function Cs(e){return e.getInstance(Cc)}function As(e){return e.getInstance(Ts)}function Ac(e,t){e.inject(Ts,t)}var Dc="em_autosave_pending",s_=6e4;function bt(e){return`${Dc}_${e}`}function Pc(e,t){try{sessionStorage.setItem(bt(e),JSON.stringify(t))}catch{}}function Ds(e){try{const t=sessionStorage.getItem(bt(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(bt(e)),null):n}catch{return null}}function Xe(e){try{sessionStorage.removeItem(bt(e))}catch{}}var Rc=2e3,Oc=5e3,Mc=5,Lc=5e3,Nc=4;function xc(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function kc(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
2080
2104
|
`,`
|
|
2081
2105
|
`)===t.replaceAll(`\r
|
|
2082
2106
|
`,`
|
|
2083
|
-
`)}function Ba({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:l,pageLoadTs:c=ka()}){let d=null,u=!1,p=!1,E=0,m={emailId:e,historyLoaded:!1,isRecovering:!1},b=null;const v=new Promise(P=>{b=P}),h=P=>{m={...m,...P},o(m)};let _;const y=P=>{E+=1,h({applied:{phase:P,seq:E}})},S=()=>{d?.timer&&clearTimeout(d.timer),d=null},A=P=>{if(!p){if(b){const k=b;b=null,k(P),_=P.revision?P.phase:void 0;return}i(P)&&P.revision&&y(P.phase)}},C=()=>{if(!d||p)return;const P=d.phase==="fast",k=P?Oa:Na,D=P?Ma:xa;d.timer=setTimeout(()=>{const R=d;if(!(!R||p)){if(R.attempts+=1,T(),P&&R.attempts>=D){const{pending:B}=R;Xe(e),h({isRecovering:!1}),A({revision:{html:B.html,common_styles:B.common_styles,subject:B.subject,preheader:B.preheader},phase:"timeout"}),u=!0,R.phase="bg",R.attempts=0,C();return}if(!P&&R.attempts>=D){Xe(e),S(),h({isRecovering:!1}),u=!0;return}C()}},k),d.timer.unref?.()},g=P=>{d={phase:"fast",attempts:0,pending:P,timer:null},h({isRecovering:!0}),C()},I=(P,k)=>Pt(P.autosave,k===void 0?{}:{freshSince:k})?P.autosave:null,f=P=>{if(p)return;if(h({historyLoaded:!0,latestRevisionAt:P.latestAt!==void 0&&Number.isFinite(P.latestAt)?P.latestAt:void 0}),n&&d){const R=I(P,d.pending.sentAt);if(!R)return;const B=d.phase==="fast"?"found":"bg";Xe(e),S(),h({isRecovering:!1}),u=!0,A({revision:R,phase:B});return}if(u)return;const k=n?Ra(e):null,D=k&&(k.sentAt<c||!Fa(k.html,s()))?k:null;if(D){const R=I(P,D.sentAt);if(R){Xe(e),u=!0,A({revision:R,phase:"found"});return}g(D);return}u=!0,A({revision:I(P),phase:"normal"})},w=P=>{p||(l?.(P),m.historyLoaded||(h({historyLoaded:!1,latestRevisionAt:void 0}),z()),!d&&A({revision:null,phase:"normal"}))},T=()=>t(e).then(f).catch(w);let L,F=!1;const z=()=>{F||d||p||(F=!0,L=setTimeout(()=>{L=void 0,!p&&!m.historyLoaded&&T()},La))},x=()=>{p||(h({historyLoaded:!1,latestRevisionAt:void 0}),A({revision:null,phase:"normal"}))};return r?r().then(P=>P?T():x()):T(),{verdict:()=>v,confirmVerdict(P){const k=_;_=void 0,P&&k!==void 0&&!p&&y(k)},dispose(){p=!0,L!==void 0&&(clearTimeout(L),L=void 0),S()}}}function ja({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const l=Ba({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:c,phase:d})=>{const u=vr(c);return i?.(u)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>l.verdict().then(({revision:c})=>vr(c)),loaded(c){l.confirmVerdict(c)},watch(c){return i=c,()=>{i=null,l.dispose()}}}}function Rr(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Pa(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const s=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),s}}}function Ua(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=await t.updateEmail(n,r);return await e.updateEmail(n,r),s}}}var Or=a.createIdentifier$1("CurrentUser"),Lr={};function xt(e){return e.getOrCreateInstance(Or,()=>ue(Lr))}function Mr(e){return e?.getInstance(Or)?.get()??Lr}function Nr(e){return e?.getInstance(a.CONFIG_SOURCE_ID)?.get()??{}}var Ha=1.5;function $a(e){return!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Ha*e.autosaveTimeoutMs?"none":"revision"}var Ga=4;function Va(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=()=>n().autosaveTimeoutMs*2**Math.min(o(),Ga),l=()=>{const _=t();if(!_||_.isDisposed())return"none";const{latestRevisionAt:y,snapshotVersion:S,...A}=n();return $a({...A,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:y!=null?Date.now()-y:void 0,isSnapshotSent:S!=null&&S===_.get().version})},c=()=>{const _=t();if(!_||_.isDisposed())return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:y}=n();return!(y!=null&&y===_.get().version)};let d,u,p,E,m=!1;const b=()=>{u=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==d){v();return}const y=l();y==="create"?r():y==="revision"?s():c()&&(d=_.get().docId,u=setTimeout(b,i()))},v=()=>{const _=t();m||!_||u!==void 0||l()==="none"&&!c()||(d=_.get().docId,u=setTimeout(b,i()))},h=()=>{const _=t();_!==p&&(E?.(),p=_,E=_?.subscribe(v),u!==void 0&&(clearTimeout(u),u=void 0))};return h(),v(),{refresh:()=>{m||(h(),v())},stop:()=>{m=!0,E?.(),E=void 0,p=void 0,u!==void 0&&(clearTimeout(u),u=void 0)}}}var xr=a.createIdentifier$1("documentSession.autosaveUiFacts"),kr={isUserBusy:!1,saveContext:{}};function Ya(e){return e.getOrCreateInstance(xr,()=>ue(kr))}function Fr(e){return e?.getInstance(xr)?.get()??kr}var qa=1e4;function za(e,t){const n=()=>{const c=t.current(),d=c?.get().serverId??void 0,u=ne(t.sessionKey()),p=t.recoveryFacts(),E=p?.emailId===d?p:void 0,m=t.revisionFacts(),b=E?.latestRevisionAt,v=m?.lastRevisionAt,h=Mr(e).profile;return{isInited:u||c?.get().attributes.is_inited===!0,isEnabled:!!h?.autosaves,isHistoryLoaded:E?.historyLoaded===!0,isUserBusy:Fr(e).isUserBusy,autosaveTimeoutMs:Nr(e).autosaveTimeout||qa,latestRevisionAt:b!==void 0||v!==void 0?Math.max(b??0,v??0):void 0,snapshotVersion:m?.snapshotVersion}},r=()=>{const c=Fr(e).saveContext;return{...c,project:c.project??t.current()?.get().attributes.project}},s=Va({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{ne(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(s.refresh),i=xt(e).watch(()=>s.refresh()),l=Ya(e).watch(()=>s.refresh());return()=>{o(),i.dispose(),l.dispose(),s.stop()}}var Br=12e3;function ie(e){return e.getOrCreateInstance(wt,()=>{const t=_a({resolveAdapters:(r,s)=>Xa(r,e,s),resolveWritePort:()=>jr(e),resolveHistoryPort:r=>ne(r)?Hr(e):Ur(e),resolveTerms:()=>Ta(e),canEdit:r=>Si(e,r),notifyBeforeSave:Pi(e),timeoutMs:Br,onAdapterError:(r,s)=>{s instanceof Error&&s.message,Ve(s,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=za(e,t);return e.getInstance(a.DISPOSABLE_ID)?.addDispose(n),t})}function kt(e){return e?.getInstance(wt)}function jr(e){const t=Sa(e);return t?Ft(e)?Ua(t,fe(e).email(e)):t:fe(e).email(e)}function Wa(e){return Pr(e)!==void 0||Ar(e)}function Ur(e){const t=Pr(e);return t?Ft(e)?($("port:history:server-backed"),Rr(t,fe(e).history(e))):($("port:history:integrator"),t):($("port:history:rest (порт не зарегистрирован)"),fe(e).history(e))}function Hr(e){const t=Dr(e);return t?Ft(e)?($("port:block-history:server-backed"),Rr(t,fe(e).blockHistory(e))):($("port:block-history:integrator"),t):($("port:block-history:rest (порт не зарегистрирован)"),fe(e).blockHistory(e))}function Ka(e){return Dr(e)!==void 0||Ar(e)}function Ft(e){return Zn(e)}function Xa({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>gr(e),required:!0}):n&&i.push(ya(jr(s),n)),t&&i.push({id:"plugin",load:()=>Er(t)});const l=ne(r);return Ri(n)&&(l?Ka(s):Wa(s))&&i.push(ja({port:l?Hr(s):Ur(s),revisionServiceEnabled:Zn(s),...!l&&wi(s)?{isHistoryAvailable:()=>Ii(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),i}function K(e){return e.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}var $r=new WeakMap,Bt=new WeakMap;function ae(e){return $r.get(e)??0}function Gr(e,t){let n=Bt.get(e);return n||(n=new Set,Bt.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Ja(e){$r.set(e,ae(e)+1),Bt.get(e)?.forEach(t=>t())}function Qa(e){const t=ie(e),n=K(e).addListener(a.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{De(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function Za(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function el(e){const t=e.fetchImpl??((o,i)=>fetch(o,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,s=o=>{try{const i=new URL(o,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:s,async load(o){if(!s(o))return;const i=!r.has(o);r.add(o);try{const l=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!l.ok)return;const c=await l.blob();return Za(c)?c:void 0}catch{return}}}}var pe={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function tl(e){const t={maxBytes:e.maxBytes??pe.maxBytes,maxImageBytes:e.maxImageBytes??pe.maxImageBytes,ttlMs:e.ttlMs??pe.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const l=p=>{const E=r.get(p);E&&(i-=E.bytes,r.delete(p))},c=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const p=[...r.entries()].sort((E,m)=>E[1].usedAt-m[1].usedAt);for(const[E]of p){if(i<=t.maxBytes)return;l(E)}},u=(p,E)=>{E.size>t.maxImageBytes||(r.set(p,{blob:E,bytes:E.size,storedAt:n(),usedAt:n()}),i+=E.size,d())};return{async get(p){const E=r.get(p);if(E&&c(E))return E.usedAt=n(),o.hits+=1,E.blob;E&&l(p);const m=s.get(p);if(m!==void 0)return m;o.loads+=1;const b=(async()=>{try{const v=await e.load(p);return v?u(p,v):o.failures+=1,v}catch{o.failures+=1;return}finally{s.delete(p)}})();return s.set(p,b),b},forget(p){l(p),s.delete(p)},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var nl=["emcdn.ru","scr.emcdn.ru"];function rl(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function sl(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const l=rl(i);l&&o.add(l)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Vr(e){const t=e??{},n=t.isPlugin!==!0?nl:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...pe};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:sl(s.sourceHosts,n),maxBytes:s.maxBytes??pe.maxBytes,maxImageBytes:s.maxImageBytes??pe.maxImageBytes,ttlMs:s.ttlMs??pe.ttlMs}}function ol(e){const t=K(e),n=e.getInstance(a.CONFIG_SOURCE_ID);let r=Vr(n?.get());const s=el({sourceHosts:()=>r.sourceHosts}),o=tl({load:b=>s.load(b),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),i=()=>{t.send(a.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},l=t.onInit(()=>i()),c=n?.watch(()=>{const b=Vr(n.get()),v=JSON.stringify(b)!==JSON.stringify(r);r=b,b.enabled||o.clear(),v&&t.isInited()&&i()}),d={asked:0,served:0,refused:0},u=[],p=(b,v)=>(d.refused+=1,u.push({url:b,reason:v}),u.length>20&&u.shift(),{refused:!0}),E=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...d},refusals:[...u],store:o.stats()})}),m=t.addListenerAsync(a.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async b=>{const v=b?.url??"";if(d.asked+=1,!r.enabled||!v)return p(v,"disabled");if(!s.accepts(v))return p(v,"host");b.fresh&&o.forget(v);const h=await o.get(v);return h?(d.served+=1,{blob:h}):p(v,"load-failed")});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{l.dispose(),c?.dispose(),m.dispose(),o.clear(),delete E.__emmCanvasImages__})}var il=2e3;function al(e){const t=K(e),n=new Set,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;const l=new MessageChannel;let c=!1;const d=p=>{p.data?.operationId==="em:port-ready"&&(c=!0,l.port1.removeEventListener("message",d),t.drainWindow(i))};l.port1.addEventListener("message",d),t.sendPort(i,l.port2),t.usePort(l.port1,!1,i);const u=setTimeout(()=>{n.delete(u),!c&&(Ve(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),l.port1.removeEventListener("message",d),t.useWindow(i))},il);n.add(u)},s=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),o=t.onInit(()=>r());e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n)clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var ll=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function cl(e){return ll.test(e)||e.indexOf("//")===0}function Je(e){return e&&(e.endsWith("/")?e:`${e}/`)}function dl(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Yr(e,t){const n=e==null||e===""?"./":String(e);if(cl(n))return Je(n);const r=t??dl();if(!r)return Je(n);try{return Je(new URL(n,r).href)}catch{return Je(n)}}function ul(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?Yr(__useblocks__.publicPath):Yr("/")}var fl=()=>"",pl=()=>"bb6d921f";function qr(e){const t=e?"iframe-eblock":"iframe",n=fl();if(n){const o=n.replace(/\/?$/,"/");return qn(`${o}${t}.html`,Te())}const r=pl(),s=`${ul().replace(/\/?$/,"/")}iframe/`;return qn(`${s}${t}${r?`.${r}`:""}.html`,Te())}var zr="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function jt(e){return/^file:/i.test(String(e||"").trim())}function ml(e){return jt(e)?`${zr} allow-same-origin`:zr}var bh="em:module-body",hl="em:module-body-ack";function gl(e,t,n){try{const r=new URL("./",new URL(t,n)).href,s=new URL(e,r).href;return s.startsWith(r)?s:void 0}catch{return}}function Ut(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.[0-9a-f]{6,})?\.html$/.exec(t);return n?`js/${n[1]}.body.js`:void 0}function El(e,t){const n=Ut(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function vl(e,t){const n=Ut(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),s=[n],o=[];for(;s.length>0;)for(const i of e[s.shift()]??[])r.has(i)||(r.add(i),o.push(i),s.push(i));return o}async function bl(e,t){try{const n=await fetch(e,t?.priority?{priority:t.priority}:void 0);return n.ok?await n.blob():void 0}catch{return}}function _l(e){const t=new Map,n=(r,s)=>{const o=gl(r,e.canvasSrc,e.origin);if(!o)return;const i=t.get(o);if(i!==void 0)return i;const l=e.fetchBody(o,s);return t.set(o,l),l};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,s){for(const o of r)n(o,s)},reset(){t.clear()},get size(){return t.size}}}var le;function yl(e){try{return jt(new URL(e,window.location.href).href)}catch{return jt(window.location.href)}}function Wr(){const e=qr(!1);if(!yl(e))return(!le||le.canvasSrc!==e)&&(le={canvasSrc:e,store:_l({canvasSrc:e,origin:window.location.href,fetchBody:bl}),warmed:!1}),le.store}async function Sl(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n);if(!r.ok)return;const s=await r.json();t(El(s,e))}catch{}}function Ht(e){const t=Wr();if(!t||!le||le.warmed)return;le.warmed=!0;const{canvasSrc:n}=le,r=Ut(n);r&&t.warm([r],e);const s={"js/iframe-eblock.js":["js/discussHandlers.ozU2Hn_l.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.ozU2Hn_l.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.ozU2Hn_l.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};s?t.warm(vl(s,n),e):Sl(n,o=>t.warm(o,e))}function wl(e){const t=Wr();if(!t)return;Ht();const n=r=>{const s=r.data;if(!s||s.operationId!=="em:module-body"||!s.result)return;const o=r.source;o&&(o.postMessage({operationId:hl,for:s.result},"*"),t.take(s.data?.url??"").then(i=>{o.postMessage({operationId:s.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var ge=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,Il=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Ee=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Kr=/display:\s*none\s*!important/gi,Tl=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Al=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Cl=/height\s*:\s*100%\s*!important/i,Dl=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function Pl(e){return Kr.lastIndex=0,(e.match(Kr)||[]).length}function Xr(e){const t=e.trim(),n=Pl(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=Dl.filter(s=>t.includes(s)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function Rl(e){Ee.lastIndex=0;for(const t of e.matchAll(Ee))if(Xr(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function Ol(e){let t=!1;return Ee.lastIndex=0,{html:e.replace(Ee,n=>Xr(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Ll(e){return ge.lastIndex=0,ge.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||Rl(e)}function Ml(e){if(!Ll(e))return{html:e,found:!1};let t=!1,n=e;ge.lastIndex=0,ge.test(n)&&(ge.lastIndex=0,n=n.replace(ge,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Il,""),t=!0);const r=Ol(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Nl(e){return!e||!Cl.test(e)?e:(Ee.lastIndex=0,e.replace(Ee,t=>t.replace(Tl,(n,r,s,o)=>`${r}${s.replace(Al,"")}${o}`)))}function Jr(e){const t=Ml(e.replaceAll(`\r
|
|
2107
|
+
`)}function En(e,t){return cn(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function Fc({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:s,onFacts:o,onLate:i,onError:a,pageLoadTs:c=xc()}){let d=null,u=!1,f=!1,g=0,E={emailId:e,historyLoaded:!1,isRecovering:!1},S=null;const b=new Promise(O=>{S=O}),h=O=>{E={...E,...O},o(E)};let y;const w=O=>{g+=1,h({applied:{phase:O,seq:g}})},A=()=>{d?.timer&&clearTimeout(d.timer),d=null},D=O=>{if(!f){if(S){const F=S;S=null,F(O),y=O.revision?O.phase:void 0;return}i(O)&&O.revision&&w(O.phase)}},N=()=>{if(!d||f)return;const O=d.phase==="fast",F=O?Rc:Lc,I=O?Mc:Nc;d.timer=setTimeout(()=>{const P=d;if(!(!P||f)){if(P.attempts+=1,M(),O&&P.attempts>=I){const{pending:x}=P;Xe(e),h({isRecovering:!1}),D({revision:{html:x.html,common_styles:x.common_styles,subject:x.subject,preheader:x.preheader},phase:"timeout"}),u=!0,P.phase="bg",P.attempts=0,N();return}if(!O&&P.attempts>=I){Xe(e),A(),h({isRecovering:!1}),u=!0;return}N()}},F),d.timer.unref?.()},m=O=>{d={phase:"fast",attempts:0,pending:O,timer:null},h({isRecovering:!0}),N()},_=O=>{if(f)return;if(h({historyLoaded:!0,latestRevisionAt:O.latestAt!==void 0&&Number.isFinite(O.latestAt)?O.latestAt:void 0}),n&&d){const P=En(O,d.pending.sentAt);if(!P)return;const x=d.phase==="fast"?"found":"bg";Xe(e),A(),h({isRecovering:!1}),u=!0,D({revision:P,phase:x});return}if(u)return;const F=n?Ds(e):null,I=F&&(F.sentAt<c||!kc(F.html,s()))?F:null;if(I){const P=En(O,I.sentAt);if(P){Xe(e),u=!0,D({revision:P,phase:"found"});return}m(I);return}u=!0,D({revision:En(O),phase:"normal"})},C=O=>{f||(a?.(O),E.historyLoaded||(h({historyLoaded:!1,latestRevisionAt:void 0}),T()),!d&&D({revision:null,phase:"normal"}))},M=()=>t(e).then(_).catch(C);let p,v=!1;const T=()=>{v||d||f||(v=!0,p=setTimeout(()=>{p=void 0,!f&&!E.historyLoaded&&M()},Oc))},L=()=>{f||(h({historyLoaded:!1,latestRevisionAt:void 0}),D({revision:null,phase:"normal"}))};return r?r().then(O=>O?M():L()):M(),{verdict:()=>b,confirmVerdict(O){const F=y;y=void 0,O&&F!==void 0&&!f&&w(F)},dispose(){f=!0,p!==void 0&&(clearTimeout(p),p=void 0),A()}}}function Bc({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:s,onFacts:o}){let i=null;const a=Fc({emailId:r,readAutosave:c=>e.readAutosave(c),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:s,onFacts:o,onLate:({revision:c,phase:d})=>{const u=vs(c);return i?.(u)??!1},onError:c=>{c instanceof Error&&c.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:c})=>vs(c)),loaded(c){a.confirmVerdict(c)},watch(c){return i=c,()=>{i=null,a.dispose()}}}}function Ps(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Pc(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const s=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),s}}}function jc(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const s=Date.now(),o=await t.updateEmail(n,r);return await e.updateEmail(n,r),(Ds(n)?.sentAt??Number.POSITIVE_INFINITY)<=s&&Xe(n),o}}}var Rs=l.createIdentifier$1("CurrentUser"),Os={};function vn(e){return e.getOrCreateInstance(Rs,()=>ce(Os))}function Ms(e){return e?.getInstance(Rs)?.get()??Os}var Ls=l.createIdentifier$1("HeadlessMode");function Ns(e){return e.getOrCreateInstance(Ls,()=>ce(!1))}function Uc(e){return e?.getInstance(Ls)?.get()??!1}var Hc=l.createIdentifier$1("HiddenMount");function $c(e){return e.getOrCreateInstance(Hc,()=>ce(!1))}function Vc(e){if(!e)return!1;try{return!!l.decodeJwt(e).data?.act_as}catch{return!1}}function Gc(e){return Vc(e?.getInstance(l.COOKIE_MANAGER_ID)?.get(l.APP_COOKIES.em_token))}function xs(e){return e?.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function yt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function Yc(e,t){return t.modeDefaults(yt(e,t.fallbackMode))}function ks(e,t){const n=yt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Fs(e,t){const n=yt(e,t),r=e.user?.advancedConfigs?.[n],s=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...s}}function Wc(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function qc(e){return l.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function zc(e){return l.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function Kc(e){return l.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function Xc(e){return l.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function Jc(e,t){return[e.base,Yc(e,t),e.profile,e.serverSide,ks(e,t.fallbackMode),e.local,e.user,Fs(e,t.fallbackMode)]}function _n(e,t){const n=Jc(e,t),r=l.mergeShallowConfigLayers(n),s=Wc(n);s!==void 0&&(r.fileManager=s);const o=qc(n);o!==void 0&&(r.resourceProxy=o);const i=zc(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const a=Kc(n);a!==void 0&&(r.backendProxy=a);const c=Xc(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}function Qc(e,t,n){const r=ks(e,n),s=Fs(e,n);return l.pickKey([s,e.user,r,e.serverSide],t)}var Zc=1.5;function ed(e){return e.isHeadless||!e.isEnabled||e.isUserBusy||!e.isReady||!e.isInited?"none":e.isNew?"create":!e.isDirty||e.isSnapshotSent||!e.isHistoryLoaded||e.latestRevisionAgeMs!==void 0&&e.latestRevisionAgeMs<=Zc*e.autosaveTimeoutMs?"none":"revision"}var o_=5,i_=3;function td(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:s}=e,o=e.readFailures??(()=>0),i=e.readFailureRetryable??(()=>!0);let a;const c=_=>a!==void 0&&a.version===_.get().version?o()-a.failuresAtStart:0,d=_=>{const C=c(_);if(C<=0)return!1;const M=n().retryMaxAttempts??5;return!i()||C>M},u=()=>{const{autosaveTimeoutMs:_,retryIntervalMs:C}=n(),M=t();return M!==void 0&&c(M)>0&&C!==void 0&&C>0?C:_},f=_=>_.isNew()&&o()>=3,g=()=>{const _=t();if(!_||_.isDisposed()||d(_))return"none";const{latestRevisionAt:C,snapshotVersion:M,...p}=n(),v=Date.now(),T=ed({...p,isDirty:_.isDirty(),isNew:_.isNew(),isReady:_.isReady(),latestRevisionAgeMs:C!=null&&C<=v?v-C:void 0,isSnapshotSent:M!=null&&M===_.get().version});return T==="create"&&f(_)?"none":T},E=()=>{const _=t();if(!_||_.isDisposed()||f(_)||d(_)||n().isHeadless)return!1;if(!_.isDirty())return _.isNew();const{snapshotVersion:C}=n();return!(C!=null&&C===_.get().version)};let S,b,h,y,w=!1;const A=()=>{b=void 0;const _=t();if(!_||_.isDisposed())return;if(_.get().docId!==S){D();return}const C=g();C!=="none"&&a?.version!==_.get().version&&(a={version:_.get().version,failuresAtStart:o()}),C==="create"?r():C==="revision"?s():E()&&(S=_.get().docId,b=setTimeout(A,u()))},D=()=>{const _=t();w||!_||b!==void 0||g()==="none"&&!E()||(S=_.get().docId,b=setTimeout(A,u()))},N=_=>{_.source==="user"&&b!==void 0&&(clearTimeout(b),b=void 0),D()},m=()=>{const _=t();_!==h&&(y?.(),h=_,a=void 0,y=_?.subscribe(N),b!==void 0&&(clearTimeout(b),b=void 0))};return m(),D(),{refresh:()=>{w||(m(),D())},stop:()=>{w=!0,y?.(),y=void 0,h=void 0,b!==void 0&&(clearTimeout(b),b=void 0)}}}var Bs=l.createIdentifier$1("documentSession.autosaveUiFacts"),js={isUserBusy:!1,saveContext:{}};function nd(e){return e.getOrCreateInstance(Bs,()=>ce(js))}function bn(e){return e?.getInstance(Bs)?.get()??js}function Us(e){return bn(e).saveContext.fallbackTitle||"Untitled email."}var rd=1e4,sd=3e4;function od(e,t){const n=u=>{const f=e.getInstance(l.CONFIG_SOURCE_ID)?.layers?.(),g=f?Qc(f,u):void 0;return typeof g=="number"&&g>=0?g:void 0},r=()=>{const u=t.current(),f=u?.get().serverId??void 0,g=de(t.sessionKey()),E=t.recoveryFacts(),S=E?.emailId===f?E:void 0,b=t.revisionFacts(),h=S?.latestRevisionAt,y=b?.lastRevisionAt,w=Ms(e).profile;return{isInited:g||u?.get().attributes.is_inited===!0,isEnabled:!!w?.autosaves&&!Gc(e),isHistoryLoaded:S?.historyLoaded===!0,isUserBusy:bn(e).isUserBusy,isHeadless:Uc(e),autosaveTimeoutMs:xs(e).autosaveTimeout||rd,latestRevisionAt:h!==void 0||y!==void 0?Math.max(h??0,y??0):void 0,snapshotVersion:b?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??sd,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},s=()=>{const u=bn(e).saveContext;return{...u,project:u.project??t.current()?.get().attributes.project,fallbackTitle:Us(e)}},o=td({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>Hl(t.saveState().error),onCreate:()=>{de(t.sessionKey())||t.save("materialize",s())},onRevision:()=>{t.save("snapshot",{project:s().project})}}),i=t.subscribe(o.refresh),a=vn(e).watch(()=>o.refresh()),c=nd(e).watch(()=>o.refresh()),d=Ns(e).watch(()=>o.refresh());return()=>{i(),a.dispose(),c.dispose(),d.dispose(),o.stop()}}var Hs=12e3;function Ee(e){return e.getOrCreateInstance(tn,()=>{const t=vc({resolveAdapters:(r,s)=>ld(r,e,s),resolveWritePort:()=>$s(e),resolveHistoryPort:r=>de(r)?Gs(e):Vs(e),resolveTerms:()=>Tc(e),canEdit:r=>al(e,r),notifyBeforeSave:hl(e),timeoutMs:Hs,onAdapterError:(r,s)=>{s instanceof Error&&s.message;const o=bc(s),i=_c(s);Ve(s,{origin:"email-source-adapter",tags:{source:r,expected_refusal:String(o),network_failure:String(i)},level:o||i?"warning":"error"})},onTimeout:r=>{}}),n=od(e,t);return e.getInstance(l.DISPOSABLE_ID)?.addDispose(n),t})}function yn(e){return e?.getInstance(tn)}function $s(e){const t=Sc(e);return t?Sn(e)?jc(t,Se(e).email(e)):t:Se(e).email(e)}function id(e){return As(e)!==void 0||ws(e)}function Vs(e){const t=As(e);return t?Sn(e)?(W("port:history:server-backed"),Ps(t,Se(e).history(e))):(W("port:history:integrator"),t):(W("port:history:rest (порт не зарегистрирован)"),Se(e).history(e))}function Gs(e){const t=Cs(e);return t?Sn(e)?(W("port:block-history:server-backed"),Ps(t,Se(e).blockHistory(e))):(W("port:block-history:integrator"),t):(W("port:block-history:rest (порт не зарегистрирован)"),Se(e).blockHistory(e))}function ad(e){return Cs(e)!==void 0||ws(e)}function Sn(e){return qr(e)}function ld({email:e,patch:t,serverId:n,key:r},s,o){const i=[];e?i.push({id:"rest",load:()=>gs(e),required:!0}):n&&i.push(yc($s(s),n)),t&&i.push({id:"plugin",load:()=>Es(t)});const a=de(r);return ml(n)&&(a?ad(s):id(s))&&i.push(Bc({port:a?Gs(s):Vs(s),revisionServiceEnabled:qr(s),...!a&&ll(s)?{isHistoryAvailable:()=>cl(s)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:c=>o.publishRecoveryFacts(c)})),i}function Z(e){return e.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}var Ys=new WeakMap,In=new WeakMap;function ue(e){return Ys.get(e)??0}function wn(e,t){let n=In.get(e);return n||(n=new Set,In.set(e,n)),n.add(t),()=>{n?.delete(t)}}function cd(e){Ys.set(e,ue(e)+1),In.get(e)?.forEach(t=>t())}function dd(e){const t=Ee(e),n=Z(e).addListener(l.EVENT_TYPES.APPLICATION_HAS_AMP,r=>{We(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>n.dispose())}function ud(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function fd(e){const t=e.fetchImpl??((o,i)=>fetch(o,i)),n=e.pageHost??(()=>window.location.hostname),r=new Set,s=o=>{try{const i=new URL(o,window.location.href);return i.protocol!=="https:"&&i.protocol!=="http:"?!1:i.hostname===n()||e.sourceHosts().includes(i.hostname)}catch{return!1}};return{accepts:s,async load(o){if(!s(o))return;const i=!r.has(o);r.add(o);try{const a=await t(o,{mode:"cors",credentials:"omit",cache:i?"no-cache":"default"});if(!a.ok)return;const c=await a.blob();return ud(c)?c:void 0}catch{return}}}}var Ie={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function pd(e){const t={maxBytes:e.maxBytes??Ie.maxBytes,maxImageBytes:e.maxImageBytes??Ie.maxImageBytes,ttlMs:e.ttlMs??Ie.ttlMs},n=e.now??(()=>Date.now()),r=new Map,s=new Map,o={hits:0,loads:0,failures:0};let i=0;const a=f=>{const g=r.get(f);g&&(i-=g.bytes,r.delete(f))},c=f=>t.ttlMs<=0||n()-f.storedAt<t.ttlMs,d=()=>{if(i<=t.maxBytes)return;const f=[...r.entries()].sort((g,E)=>g[1].usedAt-E[1].usedAt);for(const[g]of f){if(i<=t.maxBytes)return;a(g)}},u=(f,g)=>{g.size>t.maxImageBytes||(r.set(f,{blob:g,bytes:g.size,storedAt:n(),usedAt:n()}),i+=g.size,d())};return{async get(f){const g=r.get(f);if(g&&c(g))return g.usedAt=n(),o.hits+=1,g.blob;g&&a(f);const E=s.get(f);if(E!==void 0)return E;o.loads+=1;const S=(async()=>{try{const b=await e.load(f);return b?u(f,b):o.failures+=1,b}catch{o.failures+=1;return}finally{s.delete(f)}})();return s.set(f,S),S},forget(f){a(f),s.delete(f)},configure(f){Object.assign(t,{maxBytes:f.maxBytes??t.maxBytes,maxImageBytes:f.maxImageBytes??t.maxImageBytes,ttlMs:f.ttlMs??t.ttlMs});for(const[g,E]of r)E.bytes>t.maxImageBytes&&a(g);d()},clear(){r.clear(),s.clear(),i=0},stats(){return{entries:r.size,bytes:i,...o}}}}var hd=["emcdn.ru","scr.emcdn.ru"];function md(e){const t=String(e??"").trim();if(!t)return"";try{return new URL(t.includes("//")?t:`https://${t}`).hostname}catch{return t.split("/")[0].split(":")[0]}}function gd(e,t){const n=(r,s)=>{const o=new Set(s?t:[]);for(const i of r){const a=md(i);a&&o.add(a)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Ed(e){const t=e??{},n=t.isPlugin!==!0?hd:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Ie};const s=r===!0||r===void 0?{}:r;return{enabled:s.enabled!==!1,sourceHosts:gd(s.sourceHosts,n),maxBytes:s.maxBytes??Ie.maxBytes,maxImageBytes:s.maxImageBytes??Ie.maxImageBytes,ttlMs:s.ttlMs??Ie.ttlMs}}function vd(e){const t=Z(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=()=>Ed({...n?.get(),isPlugin:!0});let s=r();const o=fd({sourceHosts:()=>s.sourceHosts}),i=pd({load:b=>o.load(b),maxBytes:s.maxBytes,maxImageBytes:s.maxImageBytes,ttlMs:s.ttlMs}),a=()=>{t.send(l.EVENT_TYPES.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:s.enabled,sourceHosts:[...s.sourceHosts]})},c=t.onInit(()=>a()),d=n?.watch(()=>{const b=r(),h=JSON.stringify(b)!==JSON.stringify(s);s=b,i.configure(b),b.enabled||i.clear(),h&&t.isInited()&&a()}),u={asked:0,served:0,refused:0},f=[],g=(b,h)=>(u.refused+=1,f.push({url:b,reason:h}),f.length>20&&f.shift(),{refused:!0}),E=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:s,counters:{...u},refusals:[...f],store:i.stats()})}),S=t.addListenerAsync(l.EVENT_TYPES.APPLICATION_CANVAS_IMAGE_GET,async b=>{const h=b?.url??"";if(u.asked+=1,!s.enabled||!h)return g(h,"disabled");if(!o.accepts(h))return g(h,"host");b.fresh&&i.forget(h);const y=await i.get(h);return y?(u.served+=1,{blob:y}):g(h,"load-failed")});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),d?.dispose(),S.dispose(),i.clear(),delete E.__emmCanvasImages__})}var _d=2e3;function bd(e){const t=Z(e),n=new Map,r=()=>{const i=t.getTarget();if(!i||t.hasPort(i))return;clearTimeout(n.get(i));const a=new MessageChannel;let c=!1,d=!1;const u=g=>{g.data?.operationId==="em:port-ready"&&(c=!0,a.port1.removeEventListener("message",u),d&&t.resumePort(i),t.drainWindow(i))};a.port1.addEventListener("message",u),t.sendPort(i,a.port2),t.usePort(a.port1,!1,i);const f=setTimeout(()=>{n.get(i)===f&&n.delete(i),!(c||!t.hasPort(i,a.port1))&&(Ve(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),d=!0,t.holdPort(i))},_d);n.set(i,f)},s=Object.assign(globalThis,{__emmCanvasPort__:()=>{const i=t.getTarget();return{usesPort:t.usesPort,windowDrained:i?t.isWindowDrained(i):!1}}}),o=t.onInit(()=>r());e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{for(const i of n.values())clearTimeout(i);o.dispose(),delete s.__emmCanvasPort__})}var yd=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Sd(e){return yd.test(e)||e.indexOf("//")===0}function St(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Id(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Ws(e,t){const n=e==null||e===""?"./":String(e);if(Sd(n))return St(n);const r=t??Id();if(!r)return St(n);try{return St(new URL(n,r).href)}catch{return St(n)}}function wd(){return typeof __useblocks__<"u"&&__useblocks__?.publicPath?Ws(__useblocks__.publicPath):Ws("/")}var Td=()=>"",Cd=()=>"1c4e77a0";function qs(e){const t=e?"iframe-eblock":"iframe",n=Td();if(n){const o=n.replace(/\/?$/,"/");return Ur(`${o}${t}.html`,He())}const r=Cd(),s=`${wd().replace(/\/?$/,"/")}iframe/`;return Ur(`${s}${t}${r?`.${r}`:""}.html`,He())}var zs="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Tn(e){return/^file:/i.test(String(e||"").trim())}function Ad(e){return Tn(e)?`${zs} allow-same-origin`:zs}var a_="em:module-body",Dd="em:module-body-ack";function Pd(e,t,n){try{const r=new URL("./",new URL(t,n)).href,s=new URL(e,r).href;return s.startsWith(r)?s:void 0}catch{return}}function Cn(e){const t=e.split(/[?#]/)[0].split("/").pop()??"",n=/^(.+?)(?:\.([0-9a-f]{6,}))?\.html$/.exec(t);return n?{name:n[1],hash:n[2]}:void 0}function Rd(e){const t=Cn(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Od(e,t){const n=Cn(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(s=>e[s]?.file).filter(s=>!!s):[]}function Md(e,t){const n=Cn(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const s=new Set([r]),o=[r],i=[];for(;o.length>0;)for(const a of e[o.shift()]??[])s.has(a)||(s.add(a),i.push(a),o.push(a));return i}var Ld=/^(?=[\w-]{8}$)(?:.*\d|(?=.*[a-z]).*[A-Z])/;function Nd(e){const t=(e.split(/[?#]/)[0].split("/").pop()??"").split(".");return t.length>=3&&Ld.test(t[t.length-2])}async function xd(e,t){const n=Nd(e)?{}:{cache:"no-cache"};t?.priority&&(n.priority=t.priority);try{const r=await fetch(e,n);return r.ok?await r.blob():void 0}catch{return}}function kd(e){const t=new Map,n=(r,s)=>{const o=Pd(r,e.canvasSrc,e.origin);if(!o)return;const i=t.get(o);if(i!==void 0)return i;const a=e.fetchBody(o,s);return t.set(o,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,s){for(const o of r)n(o,s)},reset(){t.clear()},get size(){return t.size}}}var fe;function Fd(e){try{return Tn(new URL(e,window.location.href).href)}catch{return Tn(window.location.href)}}function Ks(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof __useblocks__<"u"&&__useblocks__?.preload?.canvasCrossOrigin===!0}var Bd=()=>Promise.resolve(void 0);function Xs(){const e=qs(!1);if(!Fd(e)){if(!fe||fe.canvasSrc!==e){const t=Ks(e)?xd:Bd;fe={canvasSrc:e,store:kd({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return fe.store}}async function jd(e,t){try{const n=new URL(".vite/manifest.json",new URL("./",new URL(e,window.location.href))).href,r=await fetch(n,{cache:"no-cache"});if(!r.ok)return;const s=await r.json();t(Od(s,e))}catch{}}function An(e){const t=Xs();if(!t||!fe||fe.warmed||!Ks(fe.canvasSrc))return;fe.warmed=!0;const{canvasSrc:n}=fe,r=Rd(n);r&&t.warm([r],e);const s={"js/iframe-eblock.js":["js/discussHandlers.Xh4-JUcT.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.Xh4-JUcT.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.Xh4-JUcT.js":["js/rolldown-runtime.BRlIiq3h.js"],"js/rolldown-runtime.BRlIiq3h.js":[],"js/rules.CL_BitCE.js":[],"js/typograf.all.BbXdyfMT.js":["js/rolldown-runtime.BRlIiq3h.js"]};s?t.warm(Md(s,n),e):jd(n,o=>t.warm(o,e))}function Ud(e){const t=Xs();if(!t)return;An();const n=r=>{const s=r.data;if(!s||s.operationId!=="em:module-body"||!s.result)return;const o=r.source;o&&(o.postMessage({operationId:Dd,for:s.result},"*"),t.take(s.data?.url??"").then(i=>{o.postMessage({operationId:s.result,data:i??null},"*")}))};window.addEventListener("message",n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{window.removeEventListener("message",n)})}var Ne=/<script\b(?=[^>]*(?:\bbis_use(?:=|\s)|\bdata-bis-config(?:=|\s)|\bdata-dynamic-id(?:=|\s)|local\.adguard\.org|(?:chrome-extension|moz-extension|safari-extension):\/\/))[^>]*>[\s\S]*?<\/script>/gi,Hd=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,xe=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Js=/display:\s*none\s*!important/gi,$d=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,Vd=/\s*height\s*:\s*100%\s*!important\s*;?/gi,Gd=/height\s*:\s*100%\s*!important/i,Yd=[".socialshare,",".advertisment,",".adHolder,",".adsbygoogle-noablate","#ab_adblock","#popmechanic-snippet","filter_ads_by_classname","clever-core-ads","--gn-ov-ad-height","pub_728x90.text-ad.textAd","html-load.com/player","content-loader.com/player",".adblock","#advblock","body { overflow: visible!important; }"];function Wd(e){return Js.lastIndex=0,(e.match(Js)||[]).length}function Qs(e){const t=e.trim(),n=Wd(t);if(n===0)return!1;if(t.includes(".advertisment,")&&t.includes(".adHolder,")&&(t.includes(".socialshare,")||n>=3||t.length>2e3))return!0;const r=Yd.filter(s=>t.includes(s)).length;return r>=1&&(n>=3||t.length>2e3)||n>=5&&r>=1?!0:n>=20&&/\b(?:\.ad(?:s|vert|vertisment|Holder|banner|box|Container|Wrapper)?[,{]|#ad[-_]|ins\.adsbygoogle)/i.test(t)}function qd(e){xe.lastIndex=0;for(const t of e.matchAll(xe))if(Qs(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function zd(e){let t=!1;return xe.lastIndex=0,{html:e.replace(xe,n=>Qs(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function Kd(e){return Ne.lastIndex=0,Ne.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||qd(e)}function Xd(e){if(!Kd(e))return{html:e,found:!1};let t=!1,n=e;Ne.lastIndex=0,Ne.test(n)&&(Ne.lastIndex=0,n=n.replace(Ne,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(Hd,""),t=!0);const r=zd(n);return n=r.html,t=t||r.found,{html:n,found:t}}function Jd(e){return!e||!Gd.test(e)?e:(xe.lastIndex=0,e.replace(xe,t=>t.replace($d,(n,r,s,o)=>`${r}${s.replace(Vd,"")}${o}`)))}function Zs(e){const t=Xd(e.replaceAll(`\r
|
|
2084
2108
|
`,`
|
|
2085
|
-
`));return{html:Nl(t.html),hasBrowserExtensionArtifacts:t.found}}function $t(e){return e?.getContent()??""}function Qr(e,t){e?.mutate({content:pr(t)},{source:"remote"})}function Gt(e){return a.createIdentifier$1(e)}function J(e,t){return e.getOrCreateInstance(t,()=>new a.AsyncEmitter)}function G(e,t){return e.getOrCreateInstance(t,()=>new a.AsyncEmitter).event}function Vt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var xl=class extends Error{showId;constructor(e,t){super(`[useblocks] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},kl=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(a.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(a.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,s)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{s(new xl(e.showId,t))})},t);o.unref?.();const i=()=>{this._settle(e.showId,()=>{s(a.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const l=()=>{clearTimeout(o),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:s,timeoutId:o,dispose:l});for(const c of this._listeners)c(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function Fl(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function Bl(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=or(e),n=ir(e),r=Ai(e.sandbox);t<n+r}var Zr=class{_controller=new AbortController;_externalSignalDisposable=new a.Disposable;_sessionChangeListeners=new Set;_showRegistry=new kl;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return or(this._timeouts)}getSandboxTimeoutMs(e){return sr(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return ir(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=Fl(this._timeouts,e.timeouts),Bl(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??a.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new a.Disposable,this._showRegistry.rejectAll(a.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(a.createAbortError("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??a.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??a.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Yt=(()=>{const e=new Zr;return e.configure({}),e})(),jl=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function Ul(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function Hl(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(a.throwIfAborted(n),new Promise((r,s)=>{let o=!1,i,l;const c=u=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),l?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>s(a.createAbortError(n?.reason)))};if(l=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(i=setTimeout(()=>{c(()=>s(new jl(t)))},t)),n?.addEventListener("abort",d)}))}var $l=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function Gl(e,t,n){return t<=0?e:new Promise((r,s)=>{let o=!1,i;const l=c=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{l(()=>s(new $l(n,t)))},t),e.then(c=>{l(()=>r(c))},c=>{l(()=>s(c))})})}var Vl=2,Qe=Symbol("sandbox:frame-replaced");function re(e,t,n,r,s,o,i){const l=`sandbox:${t}`,c=o?.getSandboxTimeoutMs(t)??It[t],d=()=>{let b=Gl(e.sendAsync(n,r),c,l);return b=a.raceWithAbortSignal(b,o?.signal),Pe(l,b,s)};if(t==="INIT_START"&&Ul(e)){const b=o?.getSandboxReadyTimeoutMs()??2e4,v=e,h=_=>{const y=Hl(v,b,o?.signal);return Pe("sandbox:INIT_START:ready-wait",y,s).then(()=>{if(!i||_<=0)return d();const S=i.getGeneration();let A;const C=new Promise((I,f)=>{A=i.onChange(()=>{i.getGeneration()!==S&&f(Qe)})}),g=d();return g.catch(()=>{}),Promise.race([g,C]).finally(()=>A?.()).catch(I=>{if(I!==Qe)throw I;return{...s},h(_-1)})})};return h(Vl)}if(!i)return d();const u=i.getGeneration();let p;const E=new Promise((b,v)=>{p=i.onChange(()=>{i.getGeneration()!==u&&v(Qe)})}),m=d();return m.catch(()=>{}),Promise.race([m,E]).finally(()=>p?.()).catch(b=>{throw b===Qe&&{...s},b})}var Yl=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],ql=200;function zl(e=new Set){const t=new Set;return(n,r)=>{if(!Yl.some(([o,i])=>!e.has(o)&&i.test(n)))return;const s=r??`new:${n.length}:${n.slice(0,200)}`;t.has(s)||(t.size>=ql&&t.clear(),t.add(s))}}function Wl(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:zl()}}var Kl=Wl();function ve(e){return e?.getInstance(a.TEMPLATE_DIRECTIVES_ID)??Kl}function Xl(e){const t=ie(e),n=K(e),r=()=>e.getInstance(a.INIT_PIPELINE_ID)??Yt;let s,o,i=!1,l=!1;const c=async(y,S,A)=>{const C=A.generation,g=()=>A.generation!==C||A.signal.aborted||t.current()!==y||l,I=ae(n);i=!0;try{if(await re(n,"INIT_START",a.EVENT_TYPES.SANDBOX_INIT_START,{guid:S},void 0,A),g())return;const{html:f,hasBrowserExtensionArtifacts:w}=Jr($t(y));if(w&&J(e,a.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Qr(y,f),await re(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,Vt($t(y),S,ve(e).editorPolicy,y.get().version),void 0,A),g())return;await re(n,"INITED",a.EVENT_TYPES.SANDBOX_INITED,{guid:S},void 0,A),s=S,o=I}finally{i=!1}},d=()=>ne(t.sessionKey())?t.current():void 0,u=()=>{if(l||i)return;const y=d(),S=y?.get().docId;if(!y||!S||s===S&&o===ae(n)||!y.isReady())return;const A=r();A.signal.aborted||c(y,S,A).catch(()=>{})};let p=!1;const E=()=>{p||l||(p=!0,queueMicrotask(()=>{p=!1,u()}))};let m,b;const v=()=>{const y=d(),S=y?.get().docId;S!==b&&(m?.(),b=S,m=y?.subscribe(E)),E()},h=t.subscribe(v),_=Gr(n,E);v(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{l=!0,_(),m?.(),h()})}var Jl=200;function Ql({startVersion:e,limit:t=Jl}){let n=[],r=e;const s=o=>{n=n.filter(i=>i.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&s(n[n.length-t-1].version))},rebase(o,i){if(i<r)return null;const l=n.filter(d=>d.version>i);s(i);let c=o;for(const d of l){if(d.fromCanvas||d.contentReplaced||!d.changes)return null;const u=d.changes,p=[];for(const E of c){const m=Fi(E.range,u,"after");if(!m)return null;p.push({range:m,text:E.text})}c=p}return c}}}function Zl(e,t){let n=0;return e.map(({start:r,end:s,text:o})=>{const i=new ee(r,t.slice(r,s),r+n,o);return n+=o.length-(s-r),i})}function ec(e,t){const n=[...e].sort((r,s)=>r.range.start-s.range.start);return Zl(n.map(({range:r,text:s})=>({start:r.start,end:r.end,text:s})),t)}function tc(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var qt=a.createIdentifier$1("canvas.sandboxFill");function es(e){return e.getInstance(qt)?.pipeline.isEventsLocked()===!0}function zt(e){Ve(e,{origin:"canvas-channel"})}function nc(e){const t=ie(e),n=K(e);let r;const s=(c,d)=>{const u=c.get().docId;let p=!1,E=null,m=null;const b=Ql({startVersion:c.get().version});let v=c.getContent();const h=async(C,g)=>{if(m){m.push({edits:C,rev:g});return}m=[{edits:C,rev:g}];try{do{const I=m.splice(0,m.length);await n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:I.map(f=>f.edits),guid:u,rev:I[I.length-1].rev})}while(m.length)}finally{m=null}},_=(C,g)=>{const I=m?.splice(0,m.length)??[];I.length&&n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:I.map(f=>f.edits),guid:u,rev:I[I.length-1].rev}).catch(zt),n.sendAsync(a.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[C],guid:u,rev:c.get().version,...g!==null?{changeId:g}:{}}).catch(zt)},y=C=>{const{guid:g,pushUndoStop:I}=C;if(g!==u)return;const f=Wi(C);let{edits:w}=C;if(f.baseRev!==null){const L=b.rebase(w,f.baseRev);if(!L){Ve(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),_([],f.changeId);return}w=L}const T=c.get().version;try{p=!0,E=f.changeId;const L=ec(w,c.getContent());I===!1?d.applyWithoutHistory(L):c.mutate({changes:L},{source:es(e)?"system":"user"})}finally{p=!1,E=null}c.get().version===T&&f.baseRev!==null&&_([],f.changeId)},S=c.subscribe(({changes:C,version:g})=>{const I=c.getContent(),f=!C?.length&&I!==v;if(v=I,b.record({version:g,changes:C,contentReplaced:f,fromCanvas:p}),!C?.length)return;const w=tc(C);p?_(w,E):h(w,g).catch(zt)}),A=n.addListener(a.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,y);return()=>{S(),A.dispose()}};let o;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==o&&(r?.(),r=void 0,o=u,c&&d&&(r=s(c,d)))},l=t.subscribe(i);i(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r?.(),l()})}var ts=300,ns=15e3,rs="em-canvas-busy-style";function ss(){if(document.getElementById(rs))return;const e=document.createElement("style");e.id=rs,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}function rc(e){const t=e.getBoundingClientRect(),n=document.createElement("div");return n.setAttribute("aria-busy","true"),Object.assign(n.style,{position:"fixed",left:`${t.left}px`,top:`${t.top}px`,width:`${t.width}px`,height:`${t.height}px`,cursor:"progress",display:"flex",alignItems:"center",justifyContent:"center"}),e.appendChild(n),{showSpinner(){ss(),n.style.background="rgba(128, 128, 128, 0.15)";const r=document.createElement("div");Object.assign(r.style,{width:"32px",height:"32px",borderRadius:"50%",border:"3px solid rgba(128, 128, 128, 0.35)",borderTopColor:"rgba(80, 80, 80, 0.9)",animation:"em-canvas-busy-spin 0.8s linear infinite"}),n.appendChild(r)},remove:()=>n.remove()}}function os(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{ss();const s=document.createElement("div");Object.assign(s.style,{width:"32px",height:"32px",borderRadius:"50%",border:"3px solid rgba(128, 128, 128, 0.35)",borderTopColor:"rgba(80, 80, 80, 0.9)",animation:"em-canvas-busy-spin 0.8s linear infinite"}),t.appendChild(s)},ts);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var sc=8e3;function oc(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}var ic=e=>{for(let t=e?.parentElement??null;t;t=t.parentElement){const n=getComputedStyle(t).overflowY;if(n==="auto"||n==="scroll"||n==="hidden")return t}return null};function ac(e,t,n,r,s){const o=n.readyTimeoutMs??sc,i=document.createElement("div");i.dataset.canvasHost=e,r&&(i.dataset.canvasPlace=r),i.style.position="fixed",i.style.overflow="hidden",i.style.visibility="hidden";const l=n.resolveSrc(e),c=document.createElement("iframe");c.setAttribute("sandbox",n.resolveSandbox(l)),c.setAttribute("allow","clipboard-read; clipboard-write"),c.setAttribute("title","Email content"),c.style.width="100%",c.style.border="0",c.style.display="block",c.style.minHeight="600px",c.src=l,i.appendChild(c),t.appendChild(i),n.mark?.("created"),s||n.onCreated?.(c);const d=new a.Disposable;let u=!1,p=!1,E,m,b,v;const h=()=>{clearTimeout(v),v=setTimeout(()=>{p||(p=!0,m?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},_=()=>u?(b=Promise.resolve(),p=!0,b):(p=!1,b=new Promise((M,N)=>{E=M,m=N}),h(),b),y=()=>{if(clearTimeout(v),u=!0,p){b=Promise.resolve();return}p=!0,n.mark?.("loaded"),E?.()};c.addEventListener("load",y),d.addDispose(()=>{clearTimeout(v),c.removeEventListener("load",y)});let S;const A=()=>{S??=n.bindResizer?.(c)};let C=null,g=null,I;const f=()=>{if(!C){i.style.visibility="hidden",c.removeAttribute("id");return}n.elementId&&(c.id=n.elementId);const M=C.getBoundingClientRect(),N=g?.isConnected?g:ic(C),U=N?N.getBoundingClientRect():null,Y=U?Math.max(M.top,U.top):M.top,V=U?Math.min(M.bottom,U.bottom):M.bottom,de=Math.max(0,V-Y);i.style.visibility=de>0?"visible":"hidden",i.style.left=`${M.left}px`,i.style.top=`${Y}px`,i.style.width=`${M.width}px`,i.style.height=`${de}px`,c.style.transform=`translateY(${M.top-Y}px)`};let w="",T="",L=0,F;const z=()=>{if(!C){F=void 0;return}F=window.requestAnimationFrame(z);const M=C.getBoundingClientRect(),N=g?.isConnected?g.getBoundingClientRect():void 0,U=`${Math.round(M.left)}:${Math.round(M.top)}:${Math.round(M.width)}:${Math.round(M.height)}:${N?`${Math.round(N.top)}:${Math.round(N.height)}`:"-"}`;U!==w&&(w=U,f());const Y=c.getBoundingClientRect().height;Y>0&&Y!==L&&(L=Y,C.style.height=`${Y}px`);const V=getComputedStyle(C).pointerEvents;V!==T&&(T=V,i.style.pointerEvents=V)},x=()=>{F===void 0&&C&&(F=window.requestAnimationFrame(z))},P=()=>{F!==void 0&&(window.cancelAnimationFrame(F),F=void 0)},k=()=>f();let D=[];const R=(M,N)=>{if(g=N,M&&D.length>0){const U=D;D=[],U.forEach(Y=>Y())}if(M===C){f();return}if(I?.disconnect(),I=void 0,C&&C.style.removeProperty("height"),w="",L=0,T="",C=M,!M){P(),f();return}n.onShown?.(c);try{if(typeof ResizeObserver=="function"){const U=new ResizeObserver(f);typeof U.observe=="function"&&(I=U,I.observe(M))}}catch{I=void 0}f(),A(),x()};window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),d.addDispose(()=>{I?.disconnect(),F!==void 0&&window.cancelAnimationFrame(F),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k)});const B=M=>{u=!1,M&&n.onReload?.(c);let N;p||b===void 0?N=_():(h(),N=b);try{c.contentWindow?.location.reload()}catch{c.src=l}return N};return{element:c,ready(){return b??_()},reload:()=>B(!0),reloadQuietly:()=>B(!1),get shown(){return C!==null},whenShown(){return C!==null?Promise.resolve():new Promise(M=>{D.push(M)})},alignTo(M,N){R(M,N??null)},scrollBy(M,N){let U=M,Y=N;for(let V=C?.parentElement??null;V;V=V.parentElement){if(Math.abs(U)<1&&Math.abs(Y)<1)return;const de=getComputedStyle(V);if((de.overflowY==="auto"||de.overflowY==="scroll")&&V.scrollHeight>V.clientHeight){const $e=V.scrollTop,$n=V.scrollLeft;V.scrollBy({left:U,top:Y,behavior:"instant"}),U-=V.scrollLeft-$n,Y-=V.scrollTop-$e}}(Math.abs(U)>=1||Math.abs(Y)>=1)&&window.scrollBy({left:U,top:Y,behavior:"instant"})},resize(){S?.resize()},dispose(){R(null,null),S?.dispose(),d.dispose(),i.remove()}}}function lc(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",s=(m,b)=>m==="email"?`email:${b??n}`:m,o=new Map;let i,l=[],c=!1,d;const u=()=>{if(l.forEach(m=>clearTimeout(m)),l=[],i?.remove(),i=void 0,d?.remove(),d=void 0,c){c=!1;const m=o.get("email");t.get(s("email"))?.alignTo(m?.slot??null,m?.clip??null)}},p=(m,b,v)=>{const h=s(m,b),_=t.get(h);if(_)return _;const y=e.resolveMount();if(!y)return oc();const S=ac(m,y,e,m==="email"?b??n:void 0,v);return t.set(h,S),S},E={get:m=>p(m),current:m=>p(m),peek:m=>t.get(s(m)),spare:()=>t.get(s("email",r())),ensureSpare:()=>p("email",r(),!0),promote(){const m=t.get(s("email",r()));if(!m)return;const b=t.get(s("email"));n=r();const v=o.get("email");m.alignTo(v?.slot??null,v?.clip??null),b?.alignTo(null)},alignSurface(m,b,v){if(o.set(m,{slot:b,clip:v??null}),m==="email"&&c){d?.remove(),d=b?os(b):void 0;return}(b?p(m):t.get(s(m)))?.alignTo(b,v??null)},visible(){for(const m of t.values())if(m.shown)return m},byWindow(m){if(m){for(const b of t.values())if(b.element.contentWindow===m)return b}},busy(m){if(u(),!m)return;if(!E.visible()){c=!0;const h=o.get("email");h?.slot&&(d=os(h.slot)),l=[setTimeout(u,ns)];return}const b=e.resolveMount();if(!b)return;const v=rc(b);i=v,l=[setTimeout(()=>v.showSpinner(),ts),setTimeout(u,ns)]},dispose(){u(),t.forEach(m=>m.dispose()),t.clear(),o.clear(),n="a"}};return E}var cc=a.createIdentifier$1("canvas.resizerBinder"),Wt=a.createIdentifier$1("canvas.service"),dc={created:W.canvasCreated,loaded:W.canvasLoaded};function uc(e,t){if(e.getInstance(Wt))return;const n=lc({resolveMount:()=>t.resolveMount(),resolveSrc:s=>t.resolveSrc(s),resolveSandbox:ml,elementId:t.elementId,bindResizer:s=>e.getInstance(cc)?.(s),onCreated:s=>Ze(e,s,"fresh"),onReload:s=>Ze(e,s,"fresh"),onShown:s=>Ze(e,s,"switch"),mark:s=>t.mark?.(dc[s])}),r=K(e).addListener(a.EVENT_TYPES.SANDBOX_WHEEL,s=>{n.visible()?.scrollBy(s?.deltaX??0,s?.deltaY??0)});e.inject(Wt,n),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Ze(e,t,n){const r=K(e),s=t.contentWindow;if(!s)return;const o=r.getTarget()===s;o&&n==="switch"||(n==="fresh"&&(r.forget(s),o&&r.setTarget(void 0)),r.setTarget(s),Ja(r))}function fc(e,t){Ze(e,t,"promote")}function pc(e,t){const n=t.contentWindow;n&&K(e).greet(n)}function mc(e,t){const n=t.contentWindow;n&&K(e).forget(n)}function ce(e){return e.getInstance(Wt)}function hc(e){const t=K(e),n=()=>ce(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(a.EVENT_TYPES.RELOAD,async()=>{await n()?.reload()}),s=t.addListener(i=>{i.data?.operation===a.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),o=G(e,a.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),s.dispose(),o.dispose()})}var _h=a.createIdentifier$1("HeadlessMode"),gc=a.createIdentifier$1("HiddenMount");function Ec(e){return e.getOrCreateInstance(gc,()=>ue(!1))}function is(){const e=document.createElement("div");return e.dataset.canvasOffscreen="true",e.style.position="absolute",e.style.left="-10000px",e.style.top="-10000px",e.style.width="1600px",e.style.height="1000px",document.body.appendChild(e),e}function vc(e){const t=e.getInstance(a.OPTIONS_SOURCE_ID);let n,r;e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),uc(e,{resolveMount:()=>n,resolveSrc:o=>qr(o==="block"),elementId:"email_iframe",mark:o=>$(o)}),t?.watch(o=>{if(n)return;const i=o?.element;if(i instanceof HTMLElement)n=i;else if(o!==void 0)n=r??=is();else return;ce(e)?.get("email")});let s;e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{s?.remove(),s=void 0}),Ec(e).watch(o=>{const i=ce(e);if(i){if(o){s??=is(),i.alignSurface("email",s,s);return}s&&(i.alignSurface("email",null),s.remove(),s=void 0)}})}var as=a.createIdentifier$1("canvas.headerFlow"),ls=["subject","preheader"],bc=3e3,_c={subject:a.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:a.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function yc(e){const t=ie(e),n=K(e),r=h=>h?"remote":es(e)?"system":"user",s=(h,{guid:_,value:y,forced:S})=>{const A=De(t);if(!A||typeof y!="string"||_&&_!==A.get().docId)return;const C=t.forcedHeaders();if(C?.[h]&&!S&&y!==C[h])return;S&&(p.delete(h),p.size===0&&t.endForcedHeaders());const g=A.get().attributes[h]??"";l=!0;try{We(A,{[h]:y},{source:r(S)})}finally{l=!1}o[h]=y,J(e,a.events.ON_HEADER_APPLIED_ID).fire({field:h,value:y,forced:!!S,isGenerated:y!==g&&!!y})};let o={},i,l=!1,c=Promise.resolve();const d=(h,_,y,S=!1)=>{c=n.sendAsync(_c[h],{value:_,guid:De(t)?.get().docId,...y?{force:!0,echo:!0}:{},...S?{undoStep:!0}:{}}).catch(A=>{})};let u;const p=new Set;e.inject(as,{whenDelivered:async()=>{await c},reassert:h=>{const _=De(t),y=ls.filter(S=>h[S]);if(!(!_||y.length===0)){l=!0;try{We(_,Object.fromEntries(y.map(S=>[S,h[S]])),{source:"system"})}finally{l=!1}t.beginForcedHeaders({subject:h.subject??"",preheader:h.preheader??""}),clearTimeout(u),u=setTimeout(()=>{p.clear(),t.endForcedHeaders()},bc),p.clear();for(const S of y)p.add(S);for(const S of y)o[S]=h[S],d(S,h[S],!0)}}});const E=()=>{i?.(),i=void 0;const h=De(t);if(!h){o={};return}const _=h.get().attributes;o={subject:_.subject,preheader:_.preheader},i=h.subscribe(({source:y})=>{if(l)return;const S=h.get().attributes,A=t.forcedHeaders();for(const C of ls){const g=S[C];g!==o[C]&&(o[C]=g,d(C,g??"",y==="system"&&A?.[C]!==void 0,y==="user"))}})};E();const m=t.subscribe(E),b=n.addListenerAsync(a.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,h=>s("subject",h)),v=n.addListenerAsync(a.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,h=>s("preheader",h));e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{b.dispose(),v.dispose(),m(),i?.(),clearTimeout(u)})}function cs(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Kt(e,t){const n={...e};for(const r of Object.keys(t)){const s=t[r],o=e[r];cs(s)&&cs(o)?n[r]=Kt(o,s):s!==void 0&&(n[r]=s)}return n}function Sc(e,t){const n=a.COMMON_STYLES;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return Kt(n,s)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?Kt(n,t):n}function wc(){const e=window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?a.DARK:a.LIGHT;return e&&e!=="system"?e:t}function Ic(){const e=window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function Tc(e){const{config:t}=e;return{operation:a.EVENT_TYPES.UPDATE_PREVIEW,theme:e.theme,commonStyles:Sc(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}function Ac(e){const t=K(e),n=e.getInstance(a.CONFIG_SOURCE_ID),r=e.getInstance(a.OPTIONS_SOURCE_ID),s=ie(e);let o,i="";const l=()=>{const _=n?.get()??{},y=Tc({config:_,emailCommonStyles:s.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:wc(),codeMode:Ic(),appName:"useblocks"}),S=JSON.stringify(y);S!==i&&(i=S,t.send(y))},c=t.onInit(()=>{i="",l()}),d=()=>{t.isInited()&&l()},u=n?.watch(d),p=r?.watch(_=>{o=_?.commonStyles,d()});let E;const m=()=>{E?.(),E=s.current()?.subscribe(d),d()};m();const b=s.subscribe(m),v=matchMedia(a.PREFERS_COLOR_SCHEME_DARK),h=()=>d();v.addEventListener("change",h),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),u?.dispose(),p?.dispose(),E?.(),b(),v.removeEventListener("change",h)})}var Xt;(function(e){function t(s,o,i=(l,c)=>l===c){if(s===o)return!0;if(s.length!==o.length)return!1;for(let l=0;l<s.length;l++)if(!i(s[l],o[l]))return!1;return!0}e.isEqual=t;function n(s,o=i=>i){const i=new Set;return s.filter(l=>{const c=o(l);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(s=[],o=[],i=(l,c)=>l===c){const l=[],c=[],d=[];for(const u of s){const p=o.find(E=>i(u,E));p?d.push({prev:u,next:p}):c.push(u)}for(const u of o)s.find(p=>i(u,p))||l.push(u);return{added:l,removed:c,exists:d}}e.diff=r})(Xt||(Xt={}));function Cc(e,t){return e.type===t.type&&e.key===t.key}function Dc(e){const t=K(e),n=()=>e.getServices(a.SANDBOX_EXTENSIONS_ID)??[];let r=[];const s=t.onInit(()=>{r=n(),t.send(a.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),o=a.getServiceContainerId(a.SANDBOX_EXTENSIONS_ID),i=e.onInject(l=>{if(l!==o)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Xt.diff(r,c,Cc);if(r=c,u.length){if(u.some(p=>p.type==="script")){t.send(a.EVENT_TYPES.RELOAD);return}t.send(a.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(p=>p.key))}d.length&&t.send(a.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),i?.dispose()})}var Pc=a.createIdentifier$1("prewarm.editorVisible");function Rc(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Oc(e={}){const t=e.paint??Rc;let n=!1,r=!1,s=!1,o=!1,i=!1;const l=[],c=()=>{i||o||!n||!r||!s||(o=!0,t(()=>{i=!0,$(W.editorVisible);for(const d of l.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){s=!0,c()},whenVisible(d){if(i){d();return}l.push(d)},contentShown:()=>s}}function Lc(e){return e.getOrCreateInstance(Pc,()=>Oc())}var Mc=500,Nc=500,xc=5e3;function kc(e){const t=e.quietMs??Mc,n=e.floorMs??Nc,r=e.ceilingMs??xc;let s,o,i=0;const l=()=>{clearTimeout(s),clearTimeout(o),s=void 0,o=void 0},c=()=>{l(),e.run()},d=()=>{clearTimeout(s);const u=n-(Date.now()-i);s=setTimeout(c,Math.max(t,u))};return{start(){l(),i=Date.now(),o=setTimeout(c,r),d()},notify(){s!==void 0&&d()},cancel:l}}function Fc({attributes:e,readContent:t,docId:n,hasSession:r,serverId:s,show:o}){if(!r)return;const i={id:s??void 0,renderGuid:n,showId:o?.id,isNew:s==null,showToken:o?.token},l={...e,...i};return Object.defineProperty(l,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),l}var ds="self-init:";function Bc(e){return e.startsWith(ds)}function us(e,t){const n=e.getActiveShowRequest();return Bc(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function jc(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let s="";const o=()=>e.readDocument()?$t(e.readDocument()):s,i=()=>ve(e.container).editorPolicy,l=()=>e.readEmail(),c=()=>{const d=l();return{...d,id:e.isTemplate()||d.isNew?void 0:d.id,html:o()}};return{readContent:o,publicEmail:c,sendInitStart:()=>re(n,"INIT_START",a.EVENT_TYPES.SANDBOX_INIT_START,{guid:l().renderGuid},void 0,r()),sendInited:()=>re(n,"INITED",a.EVENT_TYPES.SANDBOX_INITED,{guid:l().renderGuid},void 0,r()),async sendContent(){const d=l(),{html:u,hasBrowserExtensionArtifacts:p}=Jr(d?.html||"");p&&e.events.browserExtensionDetected(),Qr(e.readDocument(),u),s=u,await re(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,Vt(o(),d.renderGuid,i(),e.readDocument()?.get().version),{guid:d.renderGuid,emailId:d.id??null},r())},refreshContent:()=>re(n,"SET_ENTITY",a.EVENT_TYPES.SANDBOX_SET_ENTITY,Vt(o(),l().renderGuid,i(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const d=l();if(d.preheader!==void 0)return re(n,"PREHEADER",a.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:d.preheader,guid:d.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const d=l();if(d.subject!==void 0)return re(n,"SUBJECT",a.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:d.subject,guid:d.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:d=>e.showFilled?.(d),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(c()),fireInit(d,u){if(!us(t(),d)){t().getActiveShowRequest()?.showId;return}const p=l();p.id,p.renderGuid,t().completeShow(d),We(e.readDocument(),{is_inited:!0},{source:"system"});const E=c();return u&&(E.reset=!0),e.events.inited(E)},fireEmailChanged(){e.events.emailChanged(c())},fireContentChanged(){e.events.contentChanged(o())}}}function Uc(e){const t=()=>e.initPipeline();let n=!1,r,s,o,i=0,l;const c=jc({...e,waitScope:()=>({getSandboxTimeoutMs:h=>t().getSandboxTimeoutMs(h),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:l?.signal??t().signal})});let d;const u=(h,_)=>{if(d===h)return;d=h;const y=i;setTimeout(()=>{i!==y||t().signal.aborted||b(h,_).catch(()=>{})},0)},p=()=>{l?.abort(),l=void 0};let E;const m=()=>{const h=t().signal;h!==E&&(E?.removeEventListener("abort",p),E=h,h.addEventListener("abort",p))};async function b(h,_){const y=++i;p(),l=new AbortController,m();const S=()=>i!==y,A=c.readTarget(),C=t().generation,g=()=>C===t().generation&&!t().signal.aborted,I=_?"init:reset-":"init:";if(!_){const T=c.publicEmail();T?.id,T?.renderGuid,T?.preheader}let f=!1,w=!1;try{n=!0,await c.sendInitStart(),c.fireWillInit(),await(_?c.refreshContent():c.sendContent()),f=!0,_||c.publicEmail()?.id;try{await c.sendPreheader()}catch(T){`${I}`,String(T)}try{await c.sendSubject()}catch(T){`${I}`,String(T)}if(S()||c.showFilled(A),await c.sendInited(),w=!0,s===h){const T=e.readSandboxGeneration?.()??o;T!==void 0&&(r=T)}await c.revealFilled()}catch(T){throw S()||(`${I}`,{...e.describeSurface?.(),error:String(T)},void 0),!S()&&us(t(),h)&&t().failShow(h,T),T}finally{v(h,_,I,{superseded:S(),sessionGeneration:C,contentApplied:f,sandboxInitedAcked:w,commit:g()})}}function v(h,_,y,S){const{superseded:A,contentApplied:C,sandboxInitedAcked:g}=S;if(A){`${y}`;return}g&&S.commit?c.fireInit(h,_||void 0):g?(`${y}`,S.sessionGeneration,t().generation,t().signal.aborted,void 0):C?(`${y}`,void 0):(`${y}`,void 0),n=!1,l=void 0,!g&&s===h&&(s=void 0,r===o&&(r=void 0)),!g&&C&&u(h,_)}return{channel:c,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:h=>{r=h},lastCorrelation:()=>s,markCorrelation:h=>{s=h},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:h=>{o=h},fill:h=>b(h,!1),refill:h=>b(h,!0),stop:()=>{i+=1,p(),n=!1,E?.removeEventListener("abort",p),E=void 0}}}function Hc(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const r=t.emailId??t.navId;return r!=null&&String(e.id??"")!==String(r)?!1:fs(e,n)}function fs(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function $c(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:s,readSandboxGeneration:o}=e,i=u=>{const p=n(),E=s();if(!Hc(p,u,E)){u.showId,u.navId,u.emailId,p?.id,p?.showId,p?.renderGuid;return}u.showId,p?.id,p?.renderGuid,t.markFilled(o()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{i(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&i(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=o();if(t.filledGeneration()===u)return;const p=n(),E=s();if(!p?.renderGuid||!fs(p,E))return;const m=`${ds}${p.renderGuid}`;t.markFilled(u),t.markCorrelation(m);const b=r()?.isReady()===!0;p.id,p.renderGuid,(b?v=>t.refill(v):v=>t.fill(v))(m).catch(()=>{t.lastCorrelation()===m&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}function Gc(e){return e??""}function Vc(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Yc(e){const t=ie(e),n=K(e),r=()=>ne(t.sessionKey())?void 0:t.current(),s=()=>{const O=r();return Fc({attributes:O?.get().attributes??{},readContent:()=>O?.getContent(),docId:O?.get().docId,hasSession:!!O,serverId:O?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(a.INIT_PIPELINE_ID)??Yt;let i={},l=!1;const c=e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(O=>{l=!!O?.element});let d=!1,u=!1,p=!1,E=0;const m=()=>{const O=ce(e);if(!O)return;const q=++E,H=O.spare();return H&&mc(e,H.element),(H?H.reloadQuietly():O.ensureSpare()?.ready())?.then(()=>{if(q!==E)return;d=!0;const te=O.spare();te&&pc(e,te.element),p&&(p=!1,T(),N())})},b=kc({run:()=>{p||m()?.catch(()=>{})}}),v=()=>{Lc(e).noteContentShown(),!d&&!p&&b.start()};let h=!1;const S=Uc({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:s,revealFilled:()=>{const O=ce(e);return h&&O&&(h=!1,b.start()),l?O?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:O=>{const q=ce(e),H=q?.spare()?.element.contentWindow;u&&q&&H&&O===H&&(u=!1,q.promote(),q.busy(!1),h=!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>ae(n),describeSurface:()=>({canvasPath:w,promoted:u,spareClean:d,handshake:n.isInited(),generation:ae(n)}),events:{willInit:O=>{J(e,a.events.WILL_EMAIL_INIT_ID).fire(O)},inited:O=>{v(),J(e,a.events.ON_EMAIL_INIT_ID).fire(O)},contentChanged:O=>{J(e,a.events.ON_CONTENT_CHANGED_ID).fire(O)},emailChanged:O=>{J(e,a.events.ON_EMAIL_CHANGED_ID).fire(O)},browserExtensionDetected:()=>{J(e,a.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),A=$c({pipeline:S,initPipeline:o,readEmail:s,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>ae(n)});let C="",g="",I="";const f=O=>O.length>0;let w="none";const T=()=>{const O=ce(e)?.spare();O&&(n.sendNow({operation:a.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0}),d=!1,u=!0,fc(e,O.element))},L=(O,q)=>{const H=ce(e);if(!H)return!0;const te=H.spare(),me=te&&d?"spare":"prepare";if(w=me,H.busy(!0),te&&d)return T(),!0;b.cancel(),n.sendNow({operation:a.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0});const we=m();if(we===void 0)return w="reload",H.busy(!1),H.peek("email")?.reload(),!0;p=!0;const Ie=E;return we.catch(()=>{!p||Ie!==E||(p=!1,w="reload",H.busy(!1),H.peek("email")?.reload())}),!1},F=()=>{$n(),S.noteSandboxGeneration(ae(n));const O=s(),q=Vc(O?.renderGuid,O?.showId,O?.id,i.emailId),H=Gc(O?.renderGuid);if(H!==g){const we=f(g),Ie=g;g=H,we&&L(Ie,H)}if(p)return;q!==C&&(C=q,A.showRequestIdentityChanged());const te=r(),me=`${q}|${te?.get().docId??""}|${ae(n)}`;me!==I&&te?.isReady()===!0&&(I=me,A.selfInitChanged()),A.saasChanged(),B()};let z=!1,x="",P="",k=!1,D=!1;const R=O=>{O.source==="user"?D=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(k=!0),N()},B=()=>{const O=s();if(!O?.renderGuid)return;const q=S.channel.readContent(),H=JSON.stringify([O.preheader,O.common_styles,O.meta,O.subject,O.utm_parameters?.utm_campaign??"",O.utm_parameters?.utm_content??"",O.utm_parameters?.utm_medium??"",O.utm_parameters?.utm_source??"",O.utm_parameters?.utm_term??""]),te=z&&q!==P,me=z&&H!==x;z=!0,P=q,x=H;const we=k&&!D;if(k=!1,D=!1,S.isEventsLocked()||we)return;const Ie={...O,id:i.isTemplate||O.isNew?void 0:O.id,html:q};if(te){J(e,a.events.ON_CONTENT_CHANGED_ID).fire(q),J(e,a.events.ON_EMAIL_CHANGED_ID).fire(Ie);return}me&&O.is_inited&&J(e,a.events.ON_EMAIL_CHANGED_ID).fire(Ie)};let M=!1;const N=()=>{M||(M=!0,queueMicrotask(()=>{M=!1,F()}))};e.inject(qt,{pipeline:S,setRoute:O=>{O.emailId===i.emailId&&!!O.isTemplate==!!i.isTemplate||(i=O,N())}});let U,Y;const V=()=>{const O=r()?.get().docId;O!==Y&&(U?.(),Y=O,U=r()?.subscribe(R)),N()};let de,$e;const $n=()=>{const O=e.getInstance(a.INIT_PIPELINE_ID);!O||O===de||($e?.(),de=O,$e=O.onShowRequested(q=>A.showRequested(q)))},ah=n.addListener(O=>{O.data?.operation===a.EVENT_TYPES.SANDBOX_RESIZED&&b.notify()}),lh=t.subscribe(V),ch=Gr(n,N);V(),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),$e?.(),ch(),lh(),U?.(),ah.dispose(),b.cancel(),S.stop()})}function qc(){return a.USEBLOCKS!=="useblocks"}var Jt={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},zc={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!0,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},ps=Jt,Wc=["freeUserBlocks","blocks"],ms={};function Kc(e){ms=e}var hs=e=>Wc.includes(e)?ps:ms[e]??ps,Qt={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},Xc={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!0,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Jc={...Qt,config:{...Qt.config,imageCenterFileManagerView:!1}};Kc({pro:zc,editor:Xc,simple:qc()?Qt:Jc,freeUserBlocks:Jt,blocks:Jt});var gs=a.createIdentifier$1("CodeMode");function Es(){let e;try{const t=window.localStorage?.getItem(a.LOCAL_STORAGE_ITEMS.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function Qc(e){try{window.localStorage?.setItem(a.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Zc(e){return e.getOrCreateInstance(gs,()=>{const t=ue(Es());return t.watch(Qc),t})}function ed(e){return e?.getInstance(gs)?.get()??Es()}function td(e,t){const n=Zc(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function nd(e,t,n=e.getInstance(a.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&ed(e).isCodeMode&&td(e,!1)}var vs=new Set;function rd(){return window.localStorage.getItem(a.LOCAL_STORAGE_ITEMS.em_color_scheme)??void 0}function sd(e){return vs.add(e),e(rd()),{dispose(){vs.delete(e)}}}function et(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function od(e,t){return t.modeDefaults(et(e,t.fallbackMode))}function id(e,t){const n=et(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function ad(e,t){const n=et(e,t),r=e.user?.advancedConfigs?.[n],s=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...s}}function ld(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function cd(e){return a.mergeResourceProxyLayers(e.map(t=>t?.resourceProxy))}function dd(e){return a.mergeResourceProxyPolicyLayers(e.map(t=>t?.resourceProxyPolicy))}function ud(e){return a.mergeBackendProxyLayers(e.map(t=>t?.backendProxy))}function fd(e){return a.mergeShallowConfigLayers(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function pd(e,t){return[e.base,od(e,t),e.profile,e.serverSide,id(e,t.fallbackMode),e.user,ad(e,t.fallbackMode),e.local]}function Zt(e,t){const n=pd(e,t),r=a.mergeShallowConfigLayers(n),s=ld(n);s!==void 0&&(r.fileManager=s);const o=cd(n);o!==void 0&&(r.resourceProxy=o);const i=dd(n);i&&Object.keys(i).length>0&&(r.resourceProxyPolicy=i);const l=ud(n);l!==void 0&&(r.backendProxy=l);const c=fd(n);return c&&Object.keys(c).length>0&&(r.backendProxyPolicy=c),r}var md=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function bs(e){return e==="server"?"serverSide":e}function hd({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},s=ue();let o={kind:"pending"},i;const l=new Promise(E=>{i=E}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){o.kind!=="pending"&&s.set(Zt(r,e))}function u(E){if(o.kind!=="pending")return;clearTimeout(c),o=E;const m=Zt(r,e);s.set(m),i(m)}function p(E,m){r[bs(E)]=m,E==="server"&&o.kind==="pending"?u({kind:"applied"}):d()}return{watch:E=>s.watch(E),select:E=>s.select(E),get:()=>s.get(),ready:()=>l,state:()=>o,layers:()=>({...r}),bootstrap(){const E=Zt(r,e);return Object.fromEntries(md.map(m=>[m,E[m]]))},merge(E,m){p(m,{...r[bs(m)],...E})},replace(E,m){p(m,E)},setMode(E){r.user={...r.user,mode:E},d()},setAdvancedConfigs(E){r.advancedConfigs=E,d()},serverAbsent(E){u({kind:"absent",reason:E})},applyServerResponse(E){o.kind==="pending"&&p("server",{...r.serverSide,...E})},dispose(){clearTimeout(c)}}}var gd=5e3,Ed="blocks";function vd(){return{...hs(Ed)?.config,mergeTags:void 0}}function bd(e,t){e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function _d(e,t){let n;xt(e).watch(({profile:r})=>{const s=`${r?.theme??""}|${r?.locale??""}`;if(s===n)return;n=s;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function yd(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function Sd(e,t){let n,r=!1,s;const o=l=>{s??=et(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==l&&nd(e,l,t)},i=xt(e).watch(({profile:l})=>{const c=l?.email_builder_config,d=yd(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&o(d)});e.getInstance(a.DISPOSABLE_ID)?.addDisposable(i),t.ready().then(l=>{if(!l.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?l.mode:s)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,o(c)})}function wd(e,t){let n=null;const r=sd(s=>{const o=typeof s=="string"&&s?s:void 0;o!==n&&(n=o,t.replace(o?{theme:o}:{},"local"))});e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r)}async function Id(e,t){if(e.getInstance(St)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(a.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function Td(e){e.injectFactory(a.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=hd({base:vd(),env:{modeDefaults:s=>hs(s)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:gd});return bd(e,r),_d(e,r),Sd(e,r),wd(e,r),Id(e,r),e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var be=class extends a.Disposable{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function j(e,t,n){const r=a.snapshot(e);return(s,o,i)=>{const l=r(async c=>{const d=t?t(c):c;i&&s.bind(i);const u=await s(d);return n?n(u):u},o,i);return()=>l.dispose()}}var Ad=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new a.Emitter;this.handleDestroy=j(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new be(this.handleDestroy));e.lifetime.addDisposable(t),e.lifetime.addDisposable(e.options.watch(({handleDestroy:r})=>n.setListener(r))),e.lifetime.addDispose(()=>e.release())}destroy(){if(!this.deps.lifetime.isDisposed())try{this.deps.lifetime.dispose()}catch{}}},en=a.createIdentifier$1("DestroyableService");function Cd(e){e.injectFactory(en,(t,n)=>{if(n)return n;const r=e.getInstance(a.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new Ad({lifetime:r,options:e.getInstance(a.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(a.INSTANCE_ID),release:()=>a.releaseContainer(e.getInstance(a.STORE_ID)??e)})},!0)}function Dd(e){const t=e.getInstance(en);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var Pd=1e3;function _s(e,t,n=Pd,r=0){if(r>n||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(const i of s)if(!_s(e[i],t[i],n,r+1))return!1;return!0}return!1}function Re(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const n={};for(const r of Object.keys(t)){const s=t[r],o=e[r];_s(s,o)||(n[r]=s)}return n}var Rd=class extends Error{timeoutMs;constructor(e){super(`[useblocks] handleSaveEmail did not respond within ${e}ms — the email was not saved`),this.timeoutMs=e,this.name="IntegratorSaveTimeoutError"}},Od=({source:e,emailtags:t,group:n,tags:r,...s})=>s;async function Ld({emails:e,saveTimeoutMs:t},n){const r=t?.()??Tt();let s;try{return await Promise.race([e.notifySave(n),new Promise((o,i)=>{s=setTimeout(()=>{const l=new Rd(r);n.value.id,i(l)},r)})])}finally{s!==void 0&&clearTimeout(s)}}function Md(e){const{emails:t}=e,n=async(r,s)=>{const o=Od(s),i=r===void 0?void 0:await t.cache.getIfPresent(r),l=i?{...i,...o}:o,c=await Ld(e,{prev:i,patch:i?Re(i,o):o,value:l,source:s.source??""}),d=String(c.id??r??a.generateUUID()),u=c.id===void 0?{...c,id:d}:c;return await t.cache.addOrUpdate(d,()=>u)};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const s=await n(void 0,r);return s?.renderGuid?s:{...s,renderGuid:a.generateUUID()}},async updateEmail(r,s){return await n(r,s)}}}var tn=20,Nd=({source:e,emailtags:t,group:n,tags:r,...s})=>s;function xd({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r}){const s=async(o,i)=>(t.clear(),await t.get(o,{page:i}),(await e.cache.values()??[]).filter(l=>String(l?.parent)===String(o)));return{async readRevisions(o,i=1){const l=await s(o,i);return{revisions:l.slice(tn*(i-1),tn*i),page:i,hasMore:l.length>tn*i}},async readAutosave(o){const i=await r?.(o)??NaN,l=Number.isFinite(i)?i:void 0,c=await n?.(o);if(c?.asked){const d=c.revision?[{...c.revision,parent:o,isAutosave:!0}]:[];return Qi(d,l)}return Ji(await s(o,1),l)},async saveAutosave(o,i){const l=Nd(i);return await e.create({...l,parent:o,isAutosave:!0,modified:new Date().toString()})}}}var kd=class extends a.BaseEmitter{async execute([e],t){for(const n of t){const r=await n(e);r&&(r.id===void 0&&(r.id=e.value.id),e.value=r)}return e.value}},Fd=class extends a.AsyncEmitter{};function yh(e){return e}var ys=class extends a.Disposable{_items=new Map;_onChangeEmitter=new a.Signal;async _getOrCreate(e,t){const n=this._items;let r;if(n.has(e))try{r=await n.get(e)}catch{t&&(r=await t())}else t&&(r=await t(),r&&this._onChangeEmitter.fire());return r}async _addOrUpdate(e,t){let n;const r=this._items;if(r.has(e))try{n=await r.get(e)}catch{}const s=await t(n);return a.deepEqual(n,s)||this._onChangeEmitter.fire(),s}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(n=>[e,n]))).then(e=>e.filter(([t,n])=>!!n))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const n=this._getOrCreate(e,()=>t(e));return this._items.set(e,n),n}addOrUpdate(e,t){const n=this._addOrUpdate(e,t);return this._items.set(e,n),n}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const n=Promise.resolve(t);return this._items.set(e,n),n}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],n=new Set(Array.from(e).map(([s,o])=>s)),r=(await this.entries()).filter(([s,o])=>!n.has(s));for(const[s,o]of e)t.push(this.addOrUpdate(s,()=>o)),n.add(s);for(const[s]of r)t.push(this.remove(s));return await Promise.all(t),r}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function Bd(e,{filter:t,order:n="asc",orderBy:r,page:s,pageSize:o=20}={}){const i=e.length;let l=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const u of c){const p=d[u],E=t[u];return u==="id"||typeof p!="string"?p===E:typeof E=="string"&&p.startsWith(E)}return!0}),l=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),s!==void 0&&(e=e.slice(o*(s-1),o*s)),{data:e,filteredTotal:l,total:i,totalPages:Math.ceil(l/o)}}function jd(e=[]){if(e=e.filter(n=>n),e.length<=1)return e[0];const t=new Map;for(const n of e)for(const r of n)if(r.id!==void 0){const s=t.get(r.id)||{};t.set(r.id,{...s,...r})}return[...t].map(([n,r])=>r)}function Ud(e,t){return Ss(e)&&Ss(t)?String(e)===String(t):e===t}function Ss(e){return typeof e=="string"||typeof e=="number"}var Hd=class extends a.Disposable{_cache=new ys;_readEmitter=new a.AsyncEmitter;_saveEmitter=this.addDisposable(new kd);_removeEmitter=this.addDisposable(new Fd);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new a.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new ys),s=n.addDisposable(new a.AsyncEmitter);t=this._foreignCache[e]={get:async(o,i={})=>{await r.getOrCreate(o,async()=>{try{const c=jd(await s.fire(o))||[];for(const d of c)d[e]=o,await this._cache.add(d.id,d);return c}catch{return[]}});const l=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||Ud(d,o)});return Bd(l,i)},first(o,i={}){return t.get(o,{...i,page:1,pageSize:1}).then(({data:l})=>l[0])},handleRead:s.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=a.generateUUID()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async s=>{const o=s?{...s,...t}:t;if(!r)return t=s?Re(s,t):t,await this._saveEmitter.fire({prev:s,patch:t,value:o,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function Oe(e){const t=a.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new Hd)}function $d(e){const t=e.getInstance(a.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function ws(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Gd(e,t,n){return e&&!ws(t)&&ws(e)?{...n,meta:e.meta}:n}var Is=Oe("plugin.dataSource.emails"),Ts=Oe("plugin.dataSource.emailRevisions"),As=Gt("plugin.readEmailAutosave"),Cs=a.createIdentifier$1("emailDocuments.provided");function Vd(e){const t=Is(e),n=Ts(e),r=n.byForeignKey("parent");return e.getInstance(Cs)?{emails:t,emailRevisions:n}:(e.inject(Cs,!0),wa(e,Md({emails:t,saveTimeoutMs:()=>Tt(e.getInstance(a.INIT_PIPELINE_ID)?.contentReadyTimeoutMs)})),Ca(e,xd({revisions:n,revisionsByEmail:r,readAutosave:async s=>{const o=await J(e,As).fire(s);return o.length===0?{asked:!1}:{asked:!0,revision:o[0]??null}},savedAt:async s=>Date.parse((await t.cache.getIfPresent(s))?.modified??"")})),$d(e).addDisposable(t.onSave(({prev:s,patch:o,value:i})=>Gd(s,o,i),Number.MIN_VALUE)),{emails:t,emailRevisions:n})}function Ds(e,t){return!e?.data||!t||e.id!==t.locale?!1:t.contentHash?e.hash===t.contentHash:t.updatedAt>0&&t.updatedAt<=e.time}function Yd(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var qd="po",tt=null;function zd(){const e=typeof __useblocks__<"u"?__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([qd],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Wd(){return tt===null&&(tt=zd().catch(e=>{throw tt=null,e})),tt}async function Ps(e){if(typeof e=="object")return nn(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Kd(t):Xd(t)}function nn(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Kd(e){try{return nn(JSON.parse(e))}catch{return}}var Rs=!1;async function Xd(e){try{return nn((await Wd()).parsePoCatalog(e))}catch{Rs||(Rs=!0);return}}var Jd="em_locale",Qd="em_ant_locale",Zd="locale",eu="ant_locale";function rn(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Os(e,t){const n=rn(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function tu(){return rn("em_locale")??Os(Zd,"em_locale")}function Ls(e){try{localStorage.setItem(Jd,JSON.stringify(e))}catch{}}function nu(){return rn("em_ant_locale")??Os(eu,"em_ant_locale")}function ru(e,t){try{localStorage.setItem(Qd,JSON.stringify({id:e,data:t}))}catch{}}var Sh="en_US",su=8e3;function ou(e,t){const n=e,r=t,s=Object.keys(n).filter(o=>o!=="");return s.length!==Object.keys(r).filter(o=>o!=="").length?!1:s.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function iu(e){const t=tu(),n=nu();let r={ready:!1},s;const o=ue(r);let i=0;const l=h=>{r={...r,...h},o.set(r)},c=()=>{r.ready||l({ready:!0})},d=setTimeout(c,e.unlockAfterMs??su),u=h=>h!==i;let p;async function E(h,_){if(n?.id===h&&n.data&&l({antd:n.data}),!p)return;const y=await p(h).catch(()=>{});!y||u(_)||(l({antd:y}),ru(h,y))}async function m(h,_){const y=await e.askHost(h).catch(()=>null);if(u(_))return!0;if(y==null)return!1;const S=await Ps(y);return u(_)||(S&&l({catalog:S}),c()),!0}async function b(h,_){const y=await e.readList();if(u(_))return;if("error"in y){l({failure:{kind:"GET_LOCALES_ERROR",error:y.error}}),c();return}const S=y.data.find(C=>C.locale===h);if(!S){Yd("em_locale")&&l({catalog:void 0}),c();return}if(Ds(t,S)&&(!s||s.catalog===t?.data)){c();return}if(s?.entry&&r.catalog===s.catalog&&Ds(s.entry,S)){Ls(s.entry),c();return}const A=await e.readCatalog(h);if(!u(_)){if("error"in A){l({failure:{kind:"GET_LOCALE_ERROR",error:A.error}}),c();return}A.data&&(s?.id===h&&r.catalog===s.catalog&&ou(s.catalog,A.data)||l({catalog:A.data}),Ls({id:h,time:S.updatedAt||Math.floor(Date.now()/1e3),hash:S.contentHash,data:A.data})),c()}}async function v(h,_){if(!await m(h,_)){if(!u(_)&&(s?.id===h&&r.catalog===s.catalog||h==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await b(h,_)}}return{set(h){if(!h||h===r.id)return;const _=i+=1;l({id:h,failure:void 0});const y=s?.id===h&&r.catalog===s.catalog;(s&&!y&&r.catalog===s.catalog||h==="en_US"&&r.catalog)&&l({catalog:void 0}),t?.id===h&&t.data&&(l({catalog:t.data}),c()),E(h,_),v(h,_)},prime(h,_,y){r.id&&r.id!==h||r.catalog||!_||(s=t?.id===h&&t.data&&(!y||t.time>=y.time)?{id:h,catalog:t.data}:{id:h,catalog:_,entry:y?{id:h,time:y.time,hash:y.hash,data:_}:void 0},l({catalog:s.catalog}))},useAntdLoader(h){p=h,r.id&&E(r.id,i)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var au=class{http;constructor(e){this.http=e}jsonList=({locale:e},t={})=>this.http.request({path:`/translations/${e}.json`,method:"GET",format:"json",...t});getTranslations=({locale:e},t={})=>this.http.request({path:`/translations/${e}.po`,method:"GET",...t});localesList=(e={})=>this.http.request({path:"/translations/locales",method:"GET",format:"json",...e})},lu=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(n=>this.encodeQueryParam(t,n)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(n=>typeof t[n]<"u").map(n=>Array.isArray(t[n])?this.addArrayQueryParam(t,n):this.addQueryParam(t,n)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{const r=e[n];return t.append(n,r instanceof Blob?r:typeof r=="object"&&r!==null?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const n=this.abortControllers.get(e);return n?n.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:s,format:o,baseUrl:i,cancelToken:l,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,d),p=s&&this.toQueryString(s),E=this.contentFormatters[r||"application/json"],m=o||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${p?`?${p}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(l?this.createAbortSignal(l):u.signal)||null,body:typeof e>"u"||e===null?null:E(e)}).then(async b=>{const v=b;v.data=null,v.error=null;const h=m?b.clone():b,_=m?await h[m]().then(y=>(v.ok?v.data=y:v.error=y,v)).catch(y=>(v.error=y,v)):v;return l&&this.abortControllers.delete(l),_})}},cu=a.createIdentifier$1("rest.v2.transport"),Ms=Symbol("rest.v2.secureRequest");function du(e){return e.getOrCreateInstance(cu,()=>{const t=e.getInstance(a.CUSTOM_FETCH_ID)?.execute||fetch;return new lu({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Ms]:!0}),customFetch:(n,r={})=>{const{[Ms]:s,...o}=r;return t(n,{...o,[a.PUBLIC_REQUEST]:s!==!0})}})})}function uu(e,t){const n=du(e);return Object.assign({},...t.map(r=>new r(n)))}function Ns(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function xs(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Ns(n.details,"wp_code")??n.code,message:Ns(n.details,"wp_message")??n.message,details:n.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}function ks(e){return!e.ok||!!e.error}function fu(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function Fs(){return fu(a.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function pu(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function mu(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function hu(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],s=r[0];return typeof s=="string"&&s!==""&&t.push({locale:s,updatedAt:pu(r[1])}),t},[]):[]}function gu(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:mu(n.updated_at),contentHash:n.content_hash}),t),[])}function Bs(e){return uu(e,[au])}function nt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function sn(e){return!e.ok||e.error!=null}function on(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function an(e){return{data:await Ps(e)??null}}async function Eu(e){if(Fs())try{const n=await Bs(e).localesList();return ks(n)?{error:xs(n)}:{data:gu(n.data)}}catch(n){return nt(n)}const t=a.getApi(e,[Qn]);try{const n=await t.get_translations2({file:"react_app"});return sn(n)?on(n):{data:hu(n.data)}}catch(n){return nt(n)}}async function vu(e,t){if(Fs())try{const r=await Bs(e).jsonList({locale:t});return ks(r)?{error:xs(r)}:an(r.data)}catch(r){return nt(r)}const n=a.getApi(e,[Qn]);try{const r=await n.get_translations3({id:t,file:"react_app"});return sn(r)?on(r):an(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return sn(r)?on(r):an(r.data)}catch(r){return nt(r)}}}var rt=new WeakMap;function bu(e){const t=rt.get(e);if(t!==void 0)return t;const n=Eu(e).then(r=>("error"in r&&rt.delete(e),r),r=>{throw rt.delete(e),r});return rt.set(e,n),n}var Le=a.createIdentifier$1("locale.service");function _u(e){if(e.getInstance(Le))return;const t=iu({readList:()=>bu(e),readCatalog:n=>vu(e,n),askHost:async n=>(await J(e,a.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(a.SECURITY_MODULE_ID)});e.inject(Le,t),e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function yu(e){const t=e.getInstance(a.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(Le);if(!n)return;const r=t.select(s=>s.locale).watch(s=>n.set(s||"en_US"));e.getInstance(a.DISPOSABLE_ID)?.addDisposable(r)}var Su="user_id",wu="project_id",js=a.createIdentifier$1("rest.identityHeadersProvided");function Iu(e){if(e.getInstance(js))return;e.inject(js,!0);let t;e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(a.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const s=t?.user?.id??Mr(e).profile?.id;s!=null&&s!==""&&n.headers.set(Su,String(s));const o=t?.project;o!=null&&o!==""&&n.headers.set(wu,String(o))}})}function Tu(e){if(!e)return!1;try{return e.getInstance(a.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var Au="Invalid standaloneKey.",wh=a.createIdentifier$1("StandaloneMockGuard");function Cu(){const e=new Error(Au);return e.name="InvalidStandaloneKeyError",e}function Du(e){e.addService(a.REQUEST_HANDLER_ID,{execute:()=>{if(Tu(e))throw Cu()}})}function Pu(e){a.registerRestTransport(e),Du(e)}function Ru(e){const t=new Zr;e.inject(a.INIT_PIPELINE_ID,t);const n=e.getInstance(a.OPTIONS_SOURCE_ID)?.watch(s=>{if(!s)return;const o=s.signal??t.externalSignal;t.configure({replaceSession:!0,...s.timeouts!==void 0?{timeouts:s.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(a.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var Ou=Oe("plugin.dataSource.blocks"),Lu=Oe("plugin.dataSource.blockRevisions"),Mu=Oe("plugin.dataSource.comments"),Nu=Gt(),xu=Gt(),Us=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2109
|
+
`));return{html:Jd(t.html),hasBrowserExtensionArtifacts:t.found}}function It(e){return e?.getContent()??""}function eo(e,t){e?.mutate({content:ps(t)},{source:"remote"})}function Dn(e){return l.createIdentifier$1(e)}function se(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter)}function X(e,t){return e.getOrCreateInstance(t,()=>new l.AsyncEmitter).event}function wt(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var Qd=class extends Error{showId;constructor(e,t){super(`[useblocks] show() timed out after ${t}ms waiting for editor init (showId=${e}). Check earlier console errors: wrong host-plugin publicPath (chunks return HTML), mount element removed without destroy(), or sandbox init never completed. Search for [show-pipeline] and [AMD] messages.`),this.name="ShowPipelineTimeoutError",this.showId=e}},Zd=class{_activeRequest=null;_pending=new Map;_listeners=new Set;getActiveShowRequest(){return this._activeRequest}onShowRequested(e){return this._listeners.add(e),()=>{this._listeners.delete(e)}}requestShow(e,t,n){return this._rejectPending(l.createAbortError("Superseded by newer show()")),n.aborted?Promise.reject(l.createAbortError(n.reason)):(this._activeRequest=e,new Promise((r,s)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{s(new Qd(e.showId,t))})},t);o.unref?.();const i=()=>{this._settle(e.showId,()=>{s(l.createAbortError(n.reason))})};n.addEventListener("abort",i,{once:!0});const a=()=>{clearTimeout(o),n.removeEventListener("abort",i)};this._pending.set(e.showId,{request:e,resolve:r,reject:s,timeoutId:o,dispose:a});for(const c of this._listeners)c(e)}))}completeShow(e){this._settle(e,t=>{t.resolve()})}hasPendingShow(e){return this._pending.has(e)}failShow(e,t){this._settle(e,n=>{n.reject(t)})}rejectAll(e){this._rejectPending(e),this._activeRequest=null}_settle(e,t){const n=this._pending.get(e);n&&(n.dispose(),this._pending.delete(e),this._activeRequest?.showId===e&&(this._activeRequest=null),t(n))}_rejectPending(e){for(const[,t]of this._pending)t.dispose(),t.reject(e);this._pending.clear()}};function eu(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function tu(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Zr(e),n=es(e),r=ul(e.sandbox);t<n+r}var to=class{_controller=new AbortController;_externalSignalDisposable=new l.Disposable;_sessionChangeListeners=new Set;_showRegistry=new Zd;_timeouts;_generation=0;_sessionStarted=!1;_externalSignal;get signal(){return this._controller.signal}get externalSignal(){return this._externalSignal}get generation(){return this._generation}get contentReadyTimeoutMs(){return Zr(this._timeouts)}getSandboxTimeoutMs(e){return Qr(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return es(this._timeouts)}bumpGeneration(){this._generation+=1}getActiveShowRequest(){return this._showRegistry.getActiveShowRequest()}onShowRequested(e){return this._showRegistry.onShowRequested(e)}requestShow(e){return this._showRegistry.requestShow(e,this.contentReadyTimeoutMs,this._controller.signal)}completeShow(e){this._showRegistry.completeShow(e)}hasPendingShow(e){return this._showRegistry.hasPendingShow(e)}failShow(e,t){this._showRegistry.failShow(e,t)}rejectAllPendingShows(e){this._showRegistry.rejectAll(e)}onSessionReplaced(e){return this._sessionChangeListeners.add(e),()=>{this._sessionChangeListeners.delete(e)}}configure(e){e.timeouts!==void 0&&(this._timeouts=eu(this._timeouts,e.timeouts),tu(this._timeouts));const t=e.replaceSession===!0||!this._sessionStarted||e.timeouts!==void 0||e.signal!==void 0;this._sessionStarted=!0,e.signal!==void 0&&(this._externalSignal=e.signal),t&&(this._replaceSessionController(),this.bumpGeneration()),(e.signal!==void 0||t)&&this._linkExternalSignal(e.signal)}relinkExternalSignal(e){this._externalSignal=e,this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._linkExternalSignal(e)}abort(e){const t=e??l.createAbortError("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new l.Disposable,this._showRegistry.rejectAll(l.createAbortError("Init session replaced")),this._controller.signal.aborted||this._controller.abort(l.createAbortError("Init session replaced")),this._controller=new AbortController,this._emitSessionReplaced()}_emitSessionReplaced(){for(const e of this._sessionChangeListeners)e()}_linkExternalSignal(e){if(!e)return;if(e.aborted){this._controller.signal.aborted||(this._controller.abort(e.reason??l.createAbortError()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??l.createAbortError()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},Pn=(()=>{const e=new to;return e.configure({}),e})(),nu=class extends Error{label;timeoutMs;constructor(e){super(`[sandbox:ready] iframe handshake timed out after ${e}ms`),this.name="SandboxReadyTimeoutError",this.label="sandbox:ready",this.timeoutMs=e}};function ru(e){if(!e||typeof e!="object")return!1;const t=e;return typeof t.isInited=="function"&&typeof t.getTarget=="function"&&typeof t.onInit=="function"}function su(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(l.throwIfAborted(n),new Promise((r,s)=>{let o=!1,i,a;const c=u=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),a?.dispose(),n?.removeEventListener("abort",d),u())},d=()=>{c(()=>s(l.createAbortError(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&c(()=>r())}),e.isInited()&&e.getTarget()){c(()=>r());return}t>0&&(i=setTimeout(()=>{c(()=>s(new nu(t)))},t)),n?.addEventListener("abort",d)}))}var ou=class extends Error{label;timeoutMs;constructor(e,t){super(`[${e}] timed out after ${t}ms`),this.name="OperationTimeoutError",this.label=e,this.timeoutMs=t}};function iu(e,t,n){return t<=0?e:new Promise((r,s)=>{let o=!1,i;const a=c=>{o||(o=!0,i!==void 0&&(clearTimeout(i),i=void 0),c())};i=setTimeout(()=>{a(()=>s(new ou(n,t)))},t),e.then(c=>{a(()=>r(c))},c=>{a(()=>s(c))})})}var au=2,Je=Symbol("sandbox:frame-replaced");function no(e){return e===Je}function pe(e,t,n,r,s,o,i){const a=`sandbox:${t}`,c=o?.getSandboxTimeoutMs(t)??nn[t],d=()=>{let S=iu(e.sendAsync(n,r),c,a);return S=l.raceWithAbortSignal(S,o?.signal),qe(a,S,s)};if(t==="INIT_START"&&ru(e)){const S=o?.getSandboxReadyTimeoutMs()??2e4,b=e,h=y=>{const w=su(b,S,o?.signal);return qe("sandbox:INIT_START:ready-wait",w,s).then(()=>{if(!i||y<=0)return d();const A=i.getGeneration();let D;const N=new Promise((_,C)=>{D=i.onChange(()=>{i.getGeneration()!==A&&C(Je)})}),m=d();return m.catch(()=>{}),Promise.race([m,N]).finally(()=>D?.()).catch(_=>{if(_!==Je)throw _;return{...s},h(y-1)})})};return h(au)}if(!i)return d();const u=i.getGeneration();let f;const g=new Promise((S,b)=>{f=i.onChange(()=>{i.getGeneration()!==u&&b(Je)})}),E=d();return E.catch(()=>{}),Promise.race([E,g]).finally(()=>f?.()).catch(S=>{throw S===Je&&{...s},S})}var lu=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],cu=200;function ro(e=new Set){const t=new Set;return(n,r)=>{if(!lu.some(([o,i])=>!e.has(o)&&i.test(n)))return;const s=r??`new:${n.length}:${n.slice(0,200)}`;t.has(s)||(t.size>=cu&&t.clear(),t.add(s))}}function so(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:ro()}}var du=so();function we(e){return e?.getInstance(l.TEMPLATE_DIRECTIVES_ID)??du}function uu(e){const t=Ee(e),n=Z(e),r=()=>e.getInstance(l.INIT_PIPELINE_ID)??Pn;let s,o,i=!1,a=!1;const c=async(w,A,D)=>{const N=D.generation,m=()=>D.generation!==N||D.signal.aborted||t.current()!==w||a,_=ue(n);i=!0;try{if(await pe(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:A},void 0,D),m())return;const{html:C,hasBrowserExtensionArtifacts:M}=Zs(It(w));if(M&&se(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),eo(w,C),await pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(It(w),A,we(e).editorPolicy,w.get().version),void 0,D),m())return;await pe(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:A},void 0,D),s=A,o=_}finally{i=!1}},d=()=>de(t.sessionKey())?t.current():void 0,u=()=>{if(a||i)return;const w=d(),A=w?.get().docId;if(!w||!A||s===A&&o===ue(n)||!w.isReady())return;const D=r();D.signal.aborted||c(w,A,D).catch(()=>{})};let f=!1;const g=()=>{f||a||(f=!0,queueMicrotask(()=>{f=!1,u()}))};let E,S;const b=()=>{const w=d(),A=w?.get().docId;A!==S&&(E?.(),S=A,E=w?.subscribe(g)),g()},h=t.subscribe(b),y=wn(n,g);b(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a=!0,y(),E?.(),h()})}var fu=200;function pu({startVersion:e,limit:t=fu}){let n=[],r=e;const s=o=>{n=n.filter(i=>i.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&s(n[n.length-t-1].version))},rebase(o,i){if(i<r)return null;const a=n.filter(d=>d.version>i);s(i);let c=o;for(const d of a){if(d.contentReplaced||!d.changes)return null;const u=d.changes,f=[];for(const g of c){if(d.fromCanvas&&u.some(S=>g.range.start<=S.oldEnd&&g.range.end>=S.oldPosition))return null;const E=Sl(g.range,u,"after");if(!E)return null;f.push({range:E,text:g.text})}c=f}return c}}}function hu(e,t){let n=0;return e.map(({start:r,end:s,text:o})=>{const i=new ae(r,t.slice(r,s),r+n,o);return n+=o.length-(s-r),i})}function mu(e,t){const n=[...e].sort((r,s)=>r.range.start-s.range.start);return hu(n.map(({range:r,text:s})=>({start:r.start,end:r.end,text:s})),t)}function gu(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Rn=l.createIdentifier$1("canvas.sandboxFill");function oo(e){return e.getInstance(Rn)?.pipeline.isEventsLocked()===!0}function Tt(e){Ve(e,{origin:"canvas-channel"})}function Eu(e){const t=Ee(e),n=Z(e);let r;const s=(c,d)=>{const u=c.get().docId;let f=!1,g=null,E=null;const S=pu({startVersion:c.get().version});let b=c.getContent(),h=!0;const y=(_,C)=>{!h||t.current()!==c||(Ve(C,{origin:"canvas-channel"}),n.sendAsync(l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(It(c),u,we(e).editorPolicy,c.get().version)).catch(Tt))},w=async(_,C)=>{if(E){E.push({edits:_,rev:C});return}E=[{edits:_,rev:C}];try{do{const M=E.splice(0,E.length);await n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:M.map(p=>p.edits),guid:u,rev:M[M.length-1].rev})}while(E.length)}catch(M){y("app edits failed to reach the canvas",M)}finally{E=null}},A=(_,C)=>{const M=E?.splice(0,E.length)??[];M.length&&n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:M.map(p=>p.edits),guid:u,rev:M[M.length-1].rev}).catch(Tt),n.sendAsync(l.EVENT_TYPES.SANDBOX_UPDATE_ENTITY,{edits:[_],guid:u,rev:c.get().version,...C!==null?{changeId:C}:{}}).catch(Tt)},D=_=>{const{guid:C,pushUndoStop:M}=_;if(C!==u)return;const p=Ll(_);let{edits:v}=_;if(p.baseRev!==null){const L=S.rebase(v,p.baseRev);if(!L){Ve(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),A([],p.changeId);return}v=L}const T=c.get().version;try{f=!0,g=p.changeId;const L=mu(v,c.getContent());M===!1?d.applyWithoutHistory(L):c.mutate({changes:L},{source:oo(e)?"system":"user"})}catch(L){y("canvas batch failed to apply",L);return}finally{f=!1,g=null}c.get().version===T&&p.baseRev!==null&&A([],p.changeId)},N=c.subscribe(({changes:_,version:C})=>{const M=c.getContent(),p=!_?.length&&M!==b;if(b=M,S.record({version:C,changes:_,contentReplaced:p,fromCanvas:f}),!_?.length)return;const v=gu(_);f?A(v,g):w(v,C).catch(Tt)}),m=n.addListener(l.EVENT_TYPES.APPLICATION_UPDATE_ENTITY,D);return()=>{h=!1,N(),m.dispose()}};let o;const i=()=>{const c=t.current(),d=t.history(),u=c?.get().docId;u!==o&&(r?.(),r=void 0,o=u,c&&d&&(r=s(c,d)))},a=t.subscribe(i);i(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.(),a()})}var vu=/^(?:ant|vscode|monaco|docs)-/;function _u(e){return vu.test(e)}function bu(){const e="ub".trim();if(!/^[a-z][a-z0-9]*$/i.test(e))throw new Error(`[cssVars] REACT_APP_CSS_VAR_PREFIX="${e}" is not a valid CSS identifier fragment.`);return e}var yu=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Su(){return yu}var Iu=new Set;function wu(e,t,n=Iu){return e.startsWith(`${t}-`)?!1:!_u(e)&&!n.has(e)}function Tu(e,t){return`--${t}-${e}`}function io(e){const t=bu();return wu(e,t,Su())?Tu(e,t):`--${e}`}function Cu(e,t){const n=io(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function Au(e,t){return Cu(e,t)}function Te(e){const t=e.assignedSlot;if(t)return t;if(e.parentElement)return e.parentElement;const n=e.parentNode;return n instanceof ShadowRoot&&n.host instanceof HTMLElement?n.host:null}function Ce(e){return!e||e==="none"}function Du(e){const t=e.contain??"",n=e.willChange??"";return!Ce(e.transform)||!Ce(e.perspective)||!Ce(e.filter)||!Ce(e.backdropFilter)||!Ce(e.translate)||!Ce(e.rotate)||!Ce(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function ao(e){const t=/paint|strict|content/.test(e.contain??"");return{x:t||!!e.overflowX&&e.overflowX!=="visible",y:t||!!e.overflowY&&e.overflowY!=="visible"}}function Pu(e){const t=[],n=document.documentElement,r=ao(getComputedStyle(n)),s=r.x||r.y;let o="none";const i=getComputedStyle(e).position;(i==="absolute"||i==="fixed")&&(o=i);for(let a=Te(e);a&&a!==n;a=Te(a)){const c=getComputedStyle(a),d=o==="none"||Du(c)||o==="absolute"&&!!c.position&&c.position!=="static",u=a===document.body&&!s;if(d){o="none";const f=u?{x:!1,y:!1}:ao(c);(f.x||f.y)&&t.push({node:a,...f})}(c.position==="absolute"||c.position==="fixed")&&(o==="none"||c.position==="fixed")&&(o=c.position==="fixed"?"fixed":"absolute")}return t}function lo(e){const t=e.getBoundingClientRect(),n=e.offsetWidth>0&&t.width>0?t.width/e.offsetWidth:1;return{x:n,y:e.offsetHeight>0&&t.height>0?t.height/e.offsetHeight:n}}function Ct(e){return Number.parseFloat(e)||0}function On(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=lo(e),s=Ct(n.borderLeftWidth),o=Ct(n.borderTopWidth),i=Ct(n.borderRightWidth),a=Ct(n.borderBottomWidth),c=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-s-i):0,d=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-o-a):0;return{left:t.left+s*r.x,top:t.top+o*r.y,right:t.right-(i+c)*r.x,bottom:t.bottom-(a+d)*r.y}}function Ru(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},s=(o,i,a)=>{i&&(r.left=Math.max(r.left,o.left),r.right=Math.min(r.right,o.right)),a&&(r.top=Math.max(r.top,o.top),r.bottom=Math.min(r.bottom,o.bottom))};return t.forEach(o=>s(On(o.node),o.x,o.y)),n&&s(On(n),!0,!0),r}var Mn={originX:0,originY:0,scaleX:1,scaleY:1};function At(e,t){return{left:(e.left-t.originX)/t.scaleX,top:(e.top-t.originY)/t.scaleY,width:Math.max(0,e.right-e.left)/t.scaleX,height:Math.max(0,e.bottom-e.top)/t.scaleY}}function co(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,s=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*s,scaleX:r,scaleY:s}}function uo(e,t){return Math.abs(e.left-t.left)<=.5&&Math.abs(e.top-t.top)<=.5&&Math.abs(e.width-(t.right-t.left))<=.5&&Math.abs(e.height-(t.bottom-t.top))<=.5}var Ou=1e3;function Mu(e){const{slot:t,own:n}=e;let r,s=0,o=!1;const i=()=>{if(r=void 0,!o){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<s)&&(r=window.requestAnimationFrame(i))}},a=()=>{!o&&r===void 0&&(r=window.requestAnimationFrame(i))},c=()=>{s=performance.now()+Ou,a()},d=[window],u=[document.documentElement];for(let h=t;h;h=Te(h)){const y=h.getRootNode();y instanceof ShadowRoot&&!d.includes(y)&&(d.push(y),u.push(y))}const f=[["scroll",a],["load",a],["transitionrun",c],["transitionend",a],["transitioncancel",a],["animationstart",c],["animationend",a],["animationcancel",a]];d.forEach(h=>f.forEach(([y,w])=>h.addEventListener(y,w,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const g=typeof MutationObserver=="function"?new MutationObserver(h=>{h.some(y=>!n.contains(y.target))&&a()}):void 0;u.forEach(h=>g?.observe(h,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let E;try{if(typeof ResizeObserver=="function"){const h=new ResizeObserver(a);typeof h.observe=="function"&&(E=h)}}catch{E=void 0}let S=[];return{schedule:a,observe:h=>{!E||h.length===S.length&&h.every((y,w)=>y===S[w])||(E.disconnect(),S=h,h.forEach(y=>E?.observe(y)))},dispose(){o=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),d.forEach(h=>f.forEach(([y,w])=>h.removeEventListener(y,w,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),g?.disconnect(),E?.disconnect()}}}var fo=300,po=15e3,Lu=5e3,ho="em-canvas-busy-style";function Nu(){if(document.getElementById(ho))return;const e=document.createElement("style");e.id=ho,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var xu="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z";function ku(e){const t=Au("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(io("colorPrimary")).trim()||t}function mo(e){Nu();const t="http://www.w3.org/2000/svg",n=document.createElementNS(t,"svg");n.setAttribute("viewBox","0 0 1024 1024"),n.setAttribute("width","48"),n.setAttribute("height","48"),n.setAttribute("fill","currentColor"),n.setAttribute("aria-hidden","true");const r=document.createElementNS(t,"path");r.setAttribute("d",xu),n.appendChild(r);const s=document.createElement("span");return s.setAttribute("role","img"),s.setAttribute("aria-label","loading"),s.setAttribute("style",`display:inline-flex;color:${ku(e)};animation:em-canvas-busy-spin 1s linear infinite`),s.appendChild(n),s}function Fu(e,t,n){const r=t??e,s=Math.max(r.left,e.left,0),o=Math.min(r.right,e.right,n.width),i=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return o<=s||a<=i?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(s+o)/2-e.left,y:(i+a)/2-e.top}}function Bu(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");r.setAttribute("aria-busy","true"),Object.assign(r.style,{position:"fixed",left:`${n.left}px`,top:`${n.top}px`,width:`${n.width}px`,height:`${n.height}px`,cursor:"progress"}),e.appendChild(r);const s={left:n.left,top:n.top,right:n.right,bottom:n.bottom},o=r.getBoundingClientRect();if(o.width>0&&!uo({left:o.left,top:o.top,width:o.width,height:o.height},s)){const i=At(s,co(o,At(s,Mn),Mn));Object.assign(r.style,{left:`${i.left}px`,top:`${i.top}px`,width:`${i.width}px`,height:`${i.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const i=Fu(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${i.x}px`,top:`${i.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(mo(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function Ln(e){const t=document.createElement("div");t.setAttribute("aria-busy","true"),Object.assign(t.style,{position:"absolute",inset:"0",display:"flex",alignItems:"center",justifyContent:"center",cursor:"progress"});const n=getComputedStyle(e).position!=="static";n||(e.style.position="relative"),e.appendChild(t);const r=setTimeout(()=>{t.appendChild(mo(e))},fo);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var ju=8e3;function Uu(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),followReload:()=>{},moveTo:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,slot:null,whenShown:()=>Promise.resolve(),filled:void 0,noteFilled:()=>{},alignTo:()=>{},resize:()=>{},dispose:()=>{}}}function Hu(e,t){for(let n=Te(e);n;n=Te(n)){const r=getComputedStyle(n),s=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(i=>ke(i)>0);if(s&&o)return n;if(n===t)return null}return null}function ke(e){return Number.parseFloat(e)||0}function Dt(e,t){return Math.abs(e-t)<=1}function $u(e){const t=getComputedStyle(e),n=ke(t.borderTopWidth),r=ke(t.borderRightWidth),s=ke(t.borderBottomWidth),o=ke(t.borderLeftWidth),i=(a,c,d)=>Math.max(0,ke(a)-Math.max(c,d));return{...On(e),radii:[i(t.borderTopLeftRadius,n,o),i(t.borderTopRightRadius,n,r),i(t.borderBottomRightRadius,s,r),i(t.borderBottomLeftRadius,s,o)]}}function Vu(e,t){const n=Dt(t.top,e.top),r=Dt(t.bottom,e.bottom),s=Dt(t.left,e.left),o=Dt(t.right,e.right),i=[n&&s?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&s?e.radii[3]:0];return i.every(a=>a===0)?"":i.map(a=>`${a}px`).join(" ")}function Gu(e,t,n,r,s,o){const i=n.readyTimeoutMs??ju,a=document.createElement("div");a.dataset.canvasHost=e,r&&(a.dataset.canvasPlace=r),a.style.position="fixed",a.style.overflow="hidden",a.style.visibility="hidden";const c=n.resolveSrc(e),d=document.createElement("iframe");d.setAttribute("sandbox",n.resolveSandbox(c)),d.setAttribute("allow","clipboard-read; clipboard-write"),d.setAttribute("title","Email content"),d.style.width="100%",d.style.border="0",d.style.display="block",d.style.minHeight="600px",d.src=c,a.appendChild(d),t.appendChild(a),n.mark?.("created"),s||n.onCreated?.(d);const u=new l.Disposable;let f=!1,g,E=!1,S,b,h,y;const w=()=>{clearTimeout(y),y=setTimeout(()=>{E||(E=!0,b?.(new Error(`[canvas] ${e}: документ не загрузился за ${i} мс`)))},i)},A=()=>f?(h=Promise.resolve(),E=!0,h):(E=!1,h=new Promise((k,j)=>{S=k,b=j}),w(),h),D=()=>{if(clearTimeout(y),f=!0,E){h=Promise.resolve();return}E=!0,n.mark?.("loaded"),S?.()};d.addEventListener("load",D),u.addDispose(()=>{clearTimeout(y),d.removeEventListener("load",D)});let N;const m=()=>{N??=n.bindResizer?.(d)},_=()=>{N?.dispose(),N=void 0};let C=null,M=null,p,v=Mn,T="",L="",O=0;const F=k=>{const j=JSON.stringify(k);return j===T?!1:(T=j,a.style.visibility=k.visibility,a.style.left=`${k.css.left}px`,a.style.top=`${k.css.top}px`,a.style.width=`${k.css.width}px`,a.style.height=`${k.css.height}px`,a.style.borderRadius=k.radius,d.style.width=k.elementWidth>0?`${k.elementWidth}px`:"100%",d.style.transform=k.shiftX!==0?`translate(${k.shiftX}px, ${k.shiftY}px)`:`translateY(${k.shiftY}px)`,!0)},I=()=>{if(!C)return T="",a.style.visibility="hidden",d.removeAttribute("id"),!1;n.elementId&&(d.id=n.elementId);const k=C.getBoundingClientRect(),j=Pu(C),G=M?.isConnected?M:null;p?.observe([C,d,...j.map($=>$.node),...G?[G]:[]]);const V=Ru(k,j,G),Q=Math.max(0,V.right-V.left),_e=Math.max(0,V.bottom-V.top),gt=getComputedStyle(C).visibility==="visible",Pe=Q<=0||_e<=0,be=Pe?{left:V.left,top:V.top,right:V.left,bottom:V.top}:V,zt=Pe?null:Hu(C,G??j[0]?.node??null),R=zt?Vu($u(zt),be):"",H=$=>F({visibility:gt?"":"hidden",css:At(be,$),elementWidth:k.width/$.scaleX,shiftX:(k.left-be.left)/$.scaleX,shiftY:(k.top-be.top)/$.scaleY,radius:R});let U=H(v);if(!Pe){const $=a.getBoundingClientRect();$.width>0&&!uo({left:$.left,top:$.top,width:$.width,height:$.height},be)&&(v=co($,At(be,v),v),U=H(v)||U)}return U},P=()=>{if(!C)return!1;let k=I();const j=d.getBoundingClientRect().height;j>0&&j!==O&&(O=j,C.style.height=`${j/lo(C).y}px`,k=!0);const G=getComputedStyle(C).pointerEvents;return G!==L&&(L=G,a.style.pointerEvents=G),k},x=()=>{p?.dispose(),p=void 0},J=k=>{p=Mu({slot:k,own:a,measure:P,onDetached:x})};let re=[];const z=(k,j)=>{if(M=j,k&&re.length>0){const G=re;re=[],G.forEach(V=>V())}if(k===C){k&&!p&&J(k),P();return}if(x(),C&&C.style.removeProperty("height"),T="",O=0,L="",C=k,!k){I(),_();return}n.onShown?.(d),J(k),P(),m()};u.addDispose(x);const K=k=>{f=!1,g=void 0,o?.(),k&&n.onReload?.(d);let j;E||h===void 0?j=A():(w(),j=h);try{d.contentWindow?.location.reload()}catch{d.src=c}return j};return{element:d,ready(){return h??A()},reload:()=>K(!0),reloadQuietly:()=>K(!1),followReload:()=>{g=void 0,o?.(),n.onReload?.(d)},moveTo(k){if(a.parentNode===k)return h??A();f=!1,g=void 0,o?.();let j;return E||h===void 0?j=A():(w(),j=h),k.appendChild(a),n.onReload?.(d),T="",p?.schedule(),j},get shown(){return C!==null},get slot(){return C},whenShown(){return C!==null?Promise.resolve():new Promise(k=>{re.push(k)})},get filled(){return g},noteFilled(k){g=k},alignTo(k,j){z(k,j??null)},scrollBy(k,j){let G=k,V=j;for(let Q=C?Te(C):null;Q;Q=Te(Q)){if(Math.abs(G)<1&&Math.abs(V)<1)return;const _e=getComputedStyle(Q);if((_e.overflowY==="auto"||_e.overflowY==="scroll")&&Q.scrollHeight>Q.clientHeight){const gt=Q.scrollTop,Pe=Q.scrollLeft;Q.scrollBy({left:G,top:V,behavior:"instant"}),G-=Q.scrollLeft-Pe,V-=Q.scrollTop-gt}}(Math.abs(G)>=1||Math.abs(V)>=1)&&window.scrollBy({left:G,top:V,behavior:"instant"})},resize(){N?.resize()},dispose(){z(null,null),_(),u.dispose(),a.remove()}}}function Yu(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",s=(v,T)=>v==="email"?`email:${T??n}`:v,o=new Map;let i,a=[],c=!1,d,u,f=!1,g,E,S="shown",b=0,h,y,w;const A=v=>u!==void 0&&v.filled!==void 0&&v.filled!==u,D=()=>{h=void 0;const v=g;!f||!v||u===void 0||y===u||!A(v)||(y=u,e.onForeignDocument?.({wanted:u,filled:v.filled,role:S,heldMs:Date.now()-b}))},N=()=>{f=!1,g=void 0,E=void 0,clearTimeout(h),h=void 0},m=(v,T)=>{const L=o.get("email"),O=L?.slot??null;return v&&O&&A(v)?(v.alignTo(null),f||(f=!0,b=Date.now(),h=setTimeout(D,Lu)),S=T,g=v,!(i!==void 0||c)&&E!==v&&(E=v,e.onShown?.(v.element)),!d&&!i&&(d=Ln(O)),!1):(f&&(N(),d?.remove(),d=void 0),v?.alignTo(O,L?.clip??null),!0)},_=()=>{f&&!c&&m(t.get(s("email")),"shown")},C=()=>{a.forEach(v=>clearTimeout(v)),a=[],i?.remove(),i=void 0,d?.remove(),d=void 0,(c||f)&&(c=!1,m(t.get(s("email")),"shown"))},M=(v,T,L)=>{const O=s(v,T),F=t.get(O);if(F)return F;const I=e.resolveMount();if(!I)return Uu();const P=Gu(v,I,e,v==="email"?T??n:void 0,L,v==="email"?()=>_():void 0);return t.set(O,P),P},p={get:v=>M(v),current:v=>M(v),peek:v=>t.get(s(v)),spare:()=>t.get(s("email",r())),ensureSpare:()=>M("email",r(),!0),promote(){const v=t.get(s("email",r()));if(!v)return;const T=t.get(s("email"));n=r(),w=void 0,m(v,"spare"),T?.alignTo(null)},alignSurface(v,T,L){const O=o.get(v);if(o.set(v,{slot:T,clip:L??null}),v==="email"&&c){d?.remove(),d=T?Ln(T):void 0;return}const F=T?M(v):t.get(s(v));if(v!=="email"){F?.alignTo(T,L??null);return}if(!T){w=O?.slot&&F?.shown?{slot:O.slot,handle:F}:void 0,f&&(N(),d?.remove(),d=void 0),F?.alignTo(null);return}const I=w?.slot===T&&w.handle===F;if(w=void 0,O?.slot===T&&F?.shown||I){F?.alignTo(T,L??null);return}m(F,"shown")},want(v){u=v,v!==void 0&&_()},noteFilled(v,T){const L=p.byWindow(v);L&&(L.noteFilled(T),L===t.get(s("email"))&&_())},visible(){for(const v of t.values())if(v.shown)return v},byWindow(v){if(v){for(const T of t.values())if(T.element.contentWindow===v)return T}},busy(v){if(C(),!v)return;if(!p.visible()){c=!0,d?.remove(),d=void 0;const O=o.get("email");O?.slot&&(d=Ln(O.slot)),a=[setTimeout(C,po)];return}const T=e.resolveMount();if(!T)return;const L=Bu(T,()=>p.visible()?.element.parentElement?.getBoundingClientRect()??null);i=L,a=[setTimeout(()=>L.showSpinner(),fo),setTimeout(C,po)]},remount(v){C();const T=s("email");t.forEach((L,O)=>{if(O===T){L.moveTo(v).catch(()=>{});return}L.dispose(),t.delete(O)})},dispose(){u=void 0,c=!1,N(),w=void 0,C(),t.forEach(v=>v.dispose()),t.clear(),o.clear(),n="a",u=void 0,y=void 0}};return p}var Wu=l.createIdentifier$1("canvas.resizerBinder"),Nn=l.createIdentifier$1("canvas.service"),qu={created:te.canvasCreated,loaded:te.canvasLoaded},go=new WeakMap;function xn(e){return go.get(e)??0}function zu(e,t){if(e.getInstance(Nn))return;const n=Yu({resolveMount:()=>t.resolveMount(),resolveSrc:s=>t.resolveSrc(s),resolveSandbox:Ad,elementId:t.elementId,bindResizer:s=>e.getInstance(Wu)?.(s),onCreated:s=>Pt(e,s,"fresh"),onReload:s=>{go.set(s,xn(s)+1),Pt(e,s,"fresh")},onShown:s=>Pt(e,s,"switch"),mark:s=>t.mark?.(qu[s]),onForeignDocument:s=>{({...s},gl("canvas identity: place held, frame has another document",{origin:"canvas-identity",level:"warning",tags:{role:s.role},contexts:{canvasIdentity:{...s,path:window.location.pathname}}}))}}),r=Z(e).addListener(l.EVENT_TYPES.SANDBOX_WHEEL,s=>{n.visible()?.scrollBy(s?.deltaX??0,s?.deltaY??0)});e.inject(Nn,n),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),n.dispose()})}function Pt(e,t,n){const r=Z(e),s=t.contentWindow;if(!s)return;const o=r.getTarget()===s;o&&n==="switch"||(n==="fresh"&&(r.forget(s),o&&r.setTarget(void 0)),r.setTarget(s),cd(r))}function Ku(e,t){Pt(e,t,"promote")}function Xu(e,t){const n=t.contentWindow;n&&Z(e).greet(n)}function Eo(e,t){const n=t.contentWindow;n&&Z(e).forget(n)}function Ju(e,t){const n=ee(e)?.byWindow(t)?.element;if(!n)return;const r=xn(n);return()=>xn(n)!==r}function ee(e){return e.getInstance(Nn)}function Qu(e){const t=Z(e),n=()=>ee(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(l.EVENT_TYPES.RELOAD,()=>{n()?.followReload()}),s=t.addOffTargetListener(l.EVENT_TYPES.RELOAD,a=>{const c=ee(e)?.byWindow(a);c&&Eo(e,c.element)}),o=t.addListener(a=>{a.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&n()?.resize()}),i=X(e,l.events.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r.dispose(),s.dispose(),o.dispose(),i.dispose()})}function vo(){const e=document.createElement("div");return e.dataset.canvasOffscreen="true",e.style.position="absolute",e.style.left="-10000px",e.style.top="-10000px",e.style.width="1600px",e.style.height="1000px",document.body.appendChild(e),e}function Zu(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);let n,r;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{r?.remove(),r=void 0}),zu(e,{resolveMount:()=>n,resolveSrc:o=>qs(o==="block"),elementId:"email_iframe",mark:o=>W(o)}),t?.watch(o=>{const i=o?.element;if(n&&i instanceof HTMLElement&&i!==n){n=i,ee(e)?.remount(i),r?.remove(),r=void 0;return}if(!n){if(i instanceof HTMLElement)n=i;else if(o!==void 0){n=r??=vo(),ee(e)?.alignSurface("email",r,r);return}else return;ee(e)?.get("email")}});let s;e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s?.remove(),s=void 0}),$c(e).watch(o=>{const i=ee(e);if(i){if(o){s??=vo(),i.alignSurface("email",s,s);return}s&&(i.alignSurface("email",null),s.remove(),s=void 0)}})}var _o=l.createIdentifier$1("canvas.headerFlow"),bo=["subject","preheader"],ef=3e3,tf={subject:l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,preheader:l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE};function nf(e){const t=Ee(e),n=Z(e),r=h=>h?"remote":oo(e)?"system":"user",s=(h,{guid:y,value:w,forced:A})=>{const D=We(t);if(!D||typeof w!="string"||y&&y!==D.get().docId)return;const N=t.forcedHeaders();if(N?.[h]&&!A&&w!==N[h])return;A&&(f.delete(h),f.size===0&&t.endForcedHeaders());const m=D.get().attributes[h]??"";a=!0;try{Ke(D,{[h]:w},{source:r(A)})}finally{a=!1}o[h]=w,se(e,l.events.ON_HEADER_APPLIED_ID).fire({field:h,value:w,forced:!!A,isGenerated:w!==m&&!!w})};let o={},i,a=!1,c=Promise.resolve();const d=(h,y,w,A=!1)=>{c=n.sendAsync(tf[h],{value:y,guid:We(t)?.get().docId,...w?{force:!0,echo:!0}:{},...A?{undoStep:!0}:{}}).catch(D=>{})};let u;const f=new Set;e.inject(_o,{whenDelivered:async()=>{await c},reassert:h=>{const y=We(t),w=bo.filter(A=>h[A]);if(!(!y||w.length===0)){a=!0;try{Ke(y,Object.fromEntries(w.map(A=>[A,h[A]])),{source:"system"})}finally{a=!1}t.beginForcedHeaders({subject:h.subject??"",preheader:h.preheader??""}),clearTimeout(u),u=setTimeout(()=>{f.clear(),t.endForcedHeaders()},ef),f.clear();for(const A of w)f.add(A);for(const A of w)o[A]=h[A],d(A,h[A],!0)}}});const g=()=>{i?.(),i=void 0;const h=We(t);if(!h){o={};return}const y=h.get().attributes;o={subject:y.subject,preheader:y.preheader},i=h.subscribe(({source:w})=>{if(a)return;const A=h.get().attributes,D=t.forcedHeaders();for(const N of bo){const m=A[N];m!==o[N]&&(o[N]=m,d(N,m??"",w==="system"&&D?.[N]!==void 0,w==="user"))}})};g();const E=t.subscribe(g),S=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_SUBJECT_UPDATE,h=>s("subject",h)),b=n.addListenerAsync(l.EVENT_TYPES.APPLICATION_PREHEADER_UPDATE,h=>s("preheader",h));e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{S.dispose(),b.dispose(),E(),i?.(),clearTimeout(u)})}function yo(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function kn(e,t){const n={...e};for(const r of Object.keys(t)){const s=t[r],o=e[r];yo(s)&&yo(o)?n[r]=kn(o,s):s!==void 0&&(n[r]=s)}return n}function rf(e,t){const n=l.COMMON_STYLES;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const s=JSON.parse(r);if(s&&typeof s=="object"&&!Array.isArray(s)&&Object.keys(s).length>0)return kn(n,s)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?kn(n,t):n}function sf(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?l.DARK:l.LIGHT;return e&&e!=="system"?e:t}function of(){const e=window.localStorage.getItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings);if(!e)return!1;try{const t=JSON.parse(e);return!!(t?.isCodeMode&&(t.codeModeDirection==="left"||t.codeModeDirection==="right"))}catch{return!1}}function af(e){const{config:t}=e;return{operation:l.EVENT_TYPES.UPDATE_PREVIEW,theme:e.theme,commonStyles:rf(e.emailCommonStyles,e.defaultCommonStyles),pathEnabled:t.pathEnabled,copyPasteEnabled:t.copyPasteEnabled,saveBlockEnabled:t.saveBlockEnabled,editImageControlEnabled:t.editImageControlEnabled,codeMode:e.codeMode,elementAIimageEnabled:t.elementAIimageEnabled,imageCenterStockEnabled:t.imageCenterStockEnabled,imageCenterGifEnabled:t.imageCenterGifEnabled,imageCenterEditorEnabled:t.imageCenterEditorEnabled,blocksAddPanelEnabled:t.blocksAddPanelEnabled!==!1&&t.blocksSectionsShow!==!1,lockEditor:t.lockEditor,appName:e.appName}}var lf=l.createIdentifier$1("DefaultCommonStyles");function So(e){return e.getOrCreateInstance(lf,()=>ce(void 0))}function cf(e,t){So(e).set(t)}function df(e){const t=Z(e),n=e.getInstance(l.CONFIG_SOURCE_ID),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=Ee(e);let o,i="";const a=()=>{const w=n?.get()??{},A=af({config:w,emailCommonStyles:s.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:sf(),codeMode:of(),appName:"useblocks"}),D=JSON.stringify(A);D!==i&&(i=D,t.send(A))},c=t.onInit(()=>{i="",a()}),d=()=>{t.isInited()&&a()},u=n?.watch(d),f=So(e).watch(w=>{o=w,d()}),g=r?.watch(w=>{w&&"commonStyles"in w&&(o=w.commonStyles),d()});let E;const S=()=>{E?.(),E=s.current()?.subscribe(d),d()};S();const b=s.subscribe(S),h=matchMedia(l.PREFERS_COLOR_SCHEME_DARK),y=()=>d();h.addEventListener("change",y),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c.dispose(),u?.dispose(),f.dispose(),g?.dispose(),E?.(),b(),h.removeEventListener("change",y)})}var Fn;(function(e){function t(s,o,i=(a,c)=>a===c){if(s===o)return!0;if(s.length!==o.length)return!1;for(let a=0;a<s.length;a++)if(!i(s[a],o[a]))return!1;return!0}e.isEqual=t;function n(s,o=i=>i){const i=new Set;return s.filter(a=>{const c=o(a);return i.has(c)?!1:(i.add(c),!0)})}e.unique=n;function r(s=[],o=[],i=(a,c)=>a===c){const a=[],c=[],d=[];for(const u of s){const f=o.find(g=>i(u,g));f?d.push({prev:u,next:f}):c.push(u)}for(const u of o)s.find(f=>i(u,f))||a.push(u);return{added:a,removed:c,exists:d}}e.diff=r})(Fn||(Fn={}));function uf(e,t){return e.type===t.type&&e.key===t.key}function ff(e){const t=Z(e),n=()=>e.getServices(l.SANDBOX_EXTENSIONS_ID)??[];let r=[];const s=t.onInit(()=>{r=n(),t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,r)}),o=l.getServiceContainerId(l.SANDBOX_EXTENSIONS_ID),i=e.onInject(a=>{if(a!==o)return;const c=n();if(!t.isInited()){r=c;return}const{added:d,removed:u}=Fn.diff(r,c,uf);if(r=c,u.length){if(u.some(f=>f.type==="script")){t.send(l.EVENT_TYPES.RELOAD);return}t.send(l.EVENT_TYPES.SANDBOX_REMOVE_EXTENSIONS,u.map(f=>f.key))}d.length&&t.send(l.EVENT_TYPES.SANDBOX_ADD_EXTENSIONS,d)});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{s.dispose(),i?.dispose()})}var pf=new Set([...Object.values(l.EVENT_TYPES).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID)]);function hf(e){return e.length>0&&!e.startsWith("em:")&&!pf.has(e)}function mf(e){const t=Z(e),n=new Map;let r=!1,s=-1,o=new Set;const i=d=>(d!==s&&(s=d,o=new Set),o),a=t.observeOutgoing((d,u)=>{if(!r||!hf(d))return;const f=ue(t);n.set(d,{data:u,generation:f,scripts:new Set(i(f))})}),c=t.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,d=>{if(d.phase!=="ready"||d.status!=="success")return;r=!0;const u=ue(t),f=i(u);f.add(d.key);for(const[g,E]of n)E.generation===u||![...E.scripts].every(S=>f.has(S))||(E.generation=u,t.send(l.createIdentifier(g),E.data))});e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{a.dispose(),c.dispose()})}var gf=l.createIdentifier$1("prewarm.editorVisible");function Ef(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function vf(e={}){const t=e.paint??Ef;let n=!1,r=!1,s=!1,o=!1,i=!1;const a=[],c=()=>{i||o||!n||!r||!s||(o=!0,t(()=>{i=!0,W(te.editorVisible);for(const d of a.splice(0))d()}))};return{noteShellVisible(){n=!0,c()},notePagePainted(){r=!0,c()},noteContentShown(){s=!0,c()},whenVisible(d){if(i){d();return}a.push(d)},contentShown:()=>s}}function _f(e){return e.getOrCreateInstance(gf,()=>vf())}var bf=500,yf=500,Sf=5e3;function If(e){const t=e.quietMs??bf,n=e.floorMs??yf,r=e.ceilingMs??Sf;let s,o,i=0;const a=()=>{clearTimeout(s),clearTimeout(o),s=void 0,o=void 0},c=()=>{a(),e.run()},d=()=>{clearTimeout(s);const u=n-(Date.now()-i);s=setTimeout(c,Math.max(t,u))};return{start(){a(),i=Date.now(),o=setTimeout(c,r),d()},notify(){s!==void 0&&d()},cancel:a}}function wf({attributes:e,readContent:t,docId:n,hasSession:r,serverId:s,show:o}){if(!r)return;const i={id:s??void 0,renderGuid:n,showId:o?.id,isNew:s==null,showToken:o?.token},a={...e,...i};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}var Io="self-init:";function Tf(e){return e.startsWith(Io)}function wo(e,t){const n=e.getActiveShowRequest();return Tf(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Cf(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t(),s=()=>e.frameWatch?.();let o="",i;const a=S=>{i={target:e.readTarget?.(),docId:S}},c=()=>e.readDocument()?It(e.readDocument()):o,d=()=>we(e.container).editorPolicy,u=()=>e.readEmail(),f=()=>{const S=u();return{...S,id:e.isTemplate()||S.isNew?void 0:S.id,html:c()}};let g=!1;const E={readContent:c,publicEmail:f,sendInitStart:()=>pe(n,"INIT_START",l.EVENT_TYPES.SANDBOX_INIT_START,{guid:u().renderGuid},void 0,r()),sendInited:()=>pe(n,"INITED",l.EVENT_TYPES.SANDBOX_INITED,{guid:u().renderGuid},void 0,r(),s()),async sendContent(){const S=u(),{html:b,hasBrowserExtensionArtifacts:h}=Zs(S?.html||"");h&&e.events.browserExtensionDetected(),eo(e.readDocument(),b),o=b,a(S.renderGuid),await pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(c(),S.renderGuid,d(),e.readDocument()?.get().version),{guid:S.renderGuid,emailId:S.id??null},r(),s())},refreshContent:()=>(a(u().renderGuid),pe(n,"SET_ENTITY",l.EVENT_TYPES.SANDBOX_SET_ENTITY,wt(c(),u().renderGuid,d(),e.readDocument()?.get().version),void 0,r(),s())),sendPreheader:async()=>{const S=u();if(S.preheader!==void 0)return pe(n,"PREHEADER",l.EVENT_TYPES.SANDBOX_PREHEADER_UPDATE,{value:S.preheader,guid:S.renderGuid,force:!0},void 0,r(),s())},sendSubject:async()=>{const S=u();if(S.subject!==void 0)return pe(n,"SUBJECT",l.EVENT_TYPES.SANDBOX_SUBJECT_UPDATE,{value:S.subject,guid:S.renderGuid,force:!0},void 0,r(),s())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:S=>e.showFilled?.(S),noteFilled:(S,b)=>e.noteFilled?.(S,b),contentSent:()=>i,readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(f()),fireInit(S,b){if(!wo(t(),S)){t().getActiveShowRequest()?.showId;return}const h=u();h.id,h.renderGuid,t().completeShow(S);const y=e.readDocument();Ke(y,{is_inited:!0},{source:"system"});const w=()=>{const D=f();b&&(D.reset=!0);const N=e.events.inited(D);return b||(g&&E.fireEmailChanged(),g=!0),N};if(!y||y.isReady())return w();const{docId:A}=y.get();return y.whenReady().then(()=>e.readDocument()?.get().docId===A?w():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(f())},fireContentChanged(){e.events.contentChanged(c())}};return E}var Af=2;function To(){return new Error("[sandbox] document reloaded during fill")}function Df(e,t,n){return{showId:e,reset:t,emailId:n?.id,renderGuid:n?.renderGuid}}function Bn(e){try{e()}catch{}}function Pf(e){let t;return Bn(()=>{t=e()}),{stage:n=>Bn(()=>t?.stage(n)),end:(n,r)=>Bn(()=>t?.end(n,r))}}function Rf(e){const t=()=>e.initPipeline();let n=!1,r,s,o,i=0,a,c;const d=()=>{const m=e.readTarget?.(),_=e.readSandboxGeneration?.();return m===void 0||_===void 0?void 0:{target:m,generation:_}},u=()=>{const m=d();return m&&{...m,canvasReplaced:e.trackDocument?.(m.target)}},f=m=>{if(m?.canvasReplaced?.())return!0;const _=d();return m!==void 0&&_?.target===m.target&&_.generation!==m.generation},E=Cf({...e,waitScope:()=>({getSandboxTimeoutMs:m=>t().getSandboxTimeoutMs(m),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal}),frameWatch:()=>{const m=c;if(!(!m||!e.onSandboxGenerationChange))return{getGeneration:()=>d()?.generation??m.generation,onChange:_=>e.onSandboxGenerationChange?.(()=>{(e.readTarget?.()===m.target||m.canvasReplaced?.())&&_()})??(()=>{})}}});let S;const b=(m,_)=>{if(S===m)return;S=m;const C=i;setTimeout(()=>{i!==C||t().signal.aborted||A(m,_).catch(()=>{})},0)},h=()=>{a?.abort(),a=void 0};let y;const w=()=>{const m=t().signal;m!==y&&(y?.removeEventListener("abort",h),y=m,m.addEventListener("abort",h))};async function A(m,_,C=0){const M=++i;h(),a=new AbortController,c=void 0,w();const p=()=>i!==M,v=E.readTarget(),T=t().generation,L=()=>T===t().generation&&!t().signal.aborted,O=_?"init:reset-":"init:",F=Pf(()=>e.observeShow?.(Df(m,_,e.readEmail())));if(!_){const z=E.publicEmail();z?.id,z?.renderGuid,z?.preheader}let I=!1,P=!1,x,J=!1;const re=()=>{if(f(x))throw To()};try{n=!0,await E.sendInitStart(),p()||(x=u(),c=x),C===0&&E.fireWillInit(),await(_||C>0?E.refreshContent():E.sendContent()),I=!0,re();const z=E.contentSent();E.noteFilled(z?.target,z?.docId),F.stage("content"),_||E.publicEmail()?.id;try{await E.sendPreheader()}catch(K){if(no(K))throw K;`${O}`,String(K)}try{await E.sendSubject()}catch(K){if(no(K))throw K;`${O}`,String(K)}if(re(),p()||E.showFilled(v),await E.sendInited(),re(),P=!0,s===m){const K=e.readSandboxGeneration?.()??o;K!==void 0&&(r=K)}F.stage("reveal"),await E.revealFilled(),re(),F.end("revealed")}catch(z){const K=!p()&&L()&&f(x),k=K?To():void 0,j=k??z,G=K&&C<Af?N(m,_,C+1):void 0;J=K&&G===void 0;const V=p()?void 0:{showId:m,contentApplied:I,sandboxInitedAcked:P,superseded:!1,...e.describeSurface?.(),error:String(k??z)};V&&(`${O}`,void 0);const Q=!p()&&e.recoverFailedFill?.(v)===!0;if(F.end(p()?"superseded":Q?"recovered":l.isAbortError(j)||!L()?"aborted":"failed",V),!Q&&!p()&&wo(t(),m)&&t().failShow(m,j),G!==void 0)return G;throw j}finally{D(m,_,O,{superseded:p(),sessionGeneration:T,contentApplied:I,sandboxInitedAcked:P&&!J,retry:!J,commit:L()})}}function D(m,_,C,M){const{superseded:p,contentApplied:v,sandboxInitedAcked:T}=M;if(p){`${C}`;return}T&&M.commit?E.fireInit(m,_||void 0):T?(`${C}`,M.sessionGeneration,t().generation,t().signal.aborted,void 0):v?(`${C}`,void 0):(`${C}`,void 0),n=!1,a=void 0,!T&&s===m&&(s=void 0,r===o&&(r=void 0)),!T&&v&&M.retry&&b(m,_)}function N(m,_,C){return A(m,_,C)}return{channel:E,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:m=>{r=m},lastCorrelation:()=>s,markCorrelation:m=>{s=m},bumpRunSeq:()=>{i+=1},noteSandboxGeneration:m=>{o=m},fill:m=>A(m,!1),refill:m=>A(m,!0),stop:()=>{i+=1,h(),n=!1,y?.removeEventListener("abort",h),y=void 0}}}function Of(e,t,n){if(!e?.renderGuid||!e.showId||e.showId!==t.showId)return!1;if(t.isNew)return e.id==null;const r=t.emailId??t.navId;return r!=null&&String(e.id??"")!==String(r)?!1:Co(e,n)}function Co(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Mf(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:s,readSandboxGeneration:o}=e,i=u=>{const f=n(),g=s();if(!Of(f,u,g)){u.showId,u.navId,u.emailId,f?.id,f?.showId,f?.renderGuid;return}u.showId,f?.id,f?.renderGuid,t.markFilled(o()),t.markCorrelation(u.showId),t.fill(u.showId).catch(()=>{})};return{showRequested:u=>{i(u)},showRequestIdentityChanged:()=>{const u=e.initPipeline().getActiveShowRequest();u&&i(u)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const u=o();if(t.filledGeneration()===u)return;const f=n(),g=s();if(!f?.renderGuid||!Co(f,g))return;const E=`${Io}${f.renderGuid}`;t.markFilled(u),t.markCorrelation(E);const S=r()?.isReady()===!0;f.id,f.renderGuid,(S?b=>t.refill(b):b=>t.fill(b))(E).catch(()=>{t.lastCorrelation()===E&&t.markFilled(void 0)})},saasChanged:()=>{const u=n();u?.renderGuid,u?.showToken,u?.id,r()}}}var Lf=l.createIdentifier$1("canvas.health");function Nf(e){return e??""}function xf(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Ao(e){return e.length>0}function kf(e){const t=Ee(e),n=Z(e),r=()=>de(t.sessionKey())?void 0:t.current(),s=()=>{const R=r();return wf({attributes:R?.get().attributes??{},readContent:()=>R?.getContent(),docId:R?.get().docId,hasSession:!!R,serverId:R?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(l.INIT_PIPELINE_ID)??Pn;let i={},a=!1;const c=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(R=>{a=!!R?.element});let d=!1,u=!1,f=!1,g=0;const E=()=>{const R=ee(e);if(!R)return;const H=++g,U=R.spare();return U&&Eo(e,U.element),(U?U.reloadQuietly():R.ensureSpare()?.ready())?.then(()=>{if(H!==g)return;d=!0;const $=R.spare();$&&Xu(e,$.element),f&&(f=!1,T(),k())})},S=If({run:()=>{f||E()?.catch(()=>{})}}),b=()=>{_f(e).noteContentShown(),!d&&!f&&S.start()};let h=!1;const y=R=>{const H=ee(e),U=H?.spare()?.element.contentWindow;u&&H&&U&&R===U&&(u=!1,H.promote(),H.busy(!1),h=!0)};let w=!1;const N=Rf({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:s,revealFilled:()=>{const R=ee(e);return h&&R&&(h=!1,S.start()),a?R?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:y,noteFilled:(R,H)=>ee(e)?.noteFilled(R,H),recoverFailedFill:R=>{const H=ee(e),U=H?.spare()?.element.contentWindow;return!u||!H||!U||R!==U?!1:(u=!1,d=!1,p="reload",H.busy(!1),H.peek("email")?.reload(),w=!0,k(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!i.isTemplate,readSandboxGeneration:()=>ue(n),onSandboxGenerationChange:R=>wn(n,R),trackDocument:R=>Ju(e,R),observeShow:R=>e.getInstance(Lf)?.begin(R),describeSurface:()=>({canvasPath:p,promoted:u,spareClean:d,handshake:n.isInited(),generation:ue(n)}),events:{willInit:R=>{se(e,l.events.WILL_EMAIL_INIT_ID).fire(R)},inited:R=>{b(),se(e,l.events.ON_EMAIL_INIT_ID).fire(R)},contentChanged:R=>{se(e,l.events.ON_CONTENT_CHANGED_ID).fire(R)},emailChanged:R=>{se(e,l.events.ON_EMAIL_CHANGED_ID).fire(R)},browserExtensionDetected:()=>{se(e,l.events.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),m=Mf({pipeline:N,initPipeline:o,readEmail:s,readDocument:r,readRouteEmailId:()=>i.emailId,readSandboxGeneration:()=>ue(n)});let _="",C="",M="",p="none";const v=()=>{const R=ee(e)?.spare()?.element.contentWindow;R&&n.getTarget()===R||n.sendNow({operation:l.EVENT_TYPES.SANDBOX_LOCK_EDIT,data:!0})},T=()=>{const R=ee(e)?.spare();R&&(v(),d=!1,u=!0,Ku(e,R.element))},L=(R,H)=>{const U=ee(e);if(!U)return!0;const $=U.spare(),Re=$&&d?"spare":"prepare";if(p=Re,U.busy(!0),$&&d)return T(),!0;S.cancel(),v();const Oe=E();if(Oe===void 0)return p="reload",U.busy(!1),U.peek("email")?.reload(),!0;f=!0;const ye=g;return Oe.catch(()=>{!f||ye!==g||(f=!1,p="reload",U.busy(!1),U.peek("email")?.reload())}),!1},O=()=>{gt(),N.noteSandboxGeneration(ue(n));const R=s(),H=xf(R?.renderGuid,R?.showId,R?.id,i.emailId),U=Nf(R?.renderGuid);if(U!==C){const Oe=C;C=U;const ye=ee(e)?.peek("email")?.filled,Kv=ye!==void 0&&ye!==U;Ao(U)&&(Ao(Oe)||Kv)&&L(Oe||(ye??""),U)}if(f)return;(H!==_||w)&&(w=!1,_=H,m.showRequestIdentityChanged());const $=r(),Re=`${H}|${$?.get().docId??""}|${ue(n)}`;Re!==M&&$?.isReady()===!0&&(M=Re,m.selfInitChanged()),m.saasChanged(),z()};let F=!1,I="",P="",x=!1,J=!1;const re=R=>{R.source==="user"?J=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(x=!0),k()},z=()=>{const R=s();if(!R?.renderGuid)return;const H=N.channel.readContent(),U=JSON.stringify([R.preheader,R.common_styles,R.meta,R.subject,R.utm_parameters?.utm_campaign??"",R.utm_parameters?.utm_content??"",R.utm_parameters?.utm_medium??"",R.utm_parameters?.utm_source??"",R.utm_parameters?.utm_term??""]),$=F&&H!==P,Re=F&&U!==I;F=!0,P=H,I=U;const Oe=x&&!J;if(x=!1,J=!1,N.isEventsLocked()||Oe)return;const ye={...R,id:i.isTemplate||R.isNew?void 0:R.id,html:H};if($){se(e,l.events.ON_CONTENT_CHANGED_ID).fire(H),se(e,l.events.ON_EMAIL_CHANGED_ID).fire(ye);return}Re&&R.is_inited&&se(e,l.events.ON_EMAIL_CHANGED_ID).fire(ye)};let K=!1;const k=()=>{K||(K=!0,queueMicrotask(()=>{K=!1,O()}))};e.inject(Rn,{pipeline:N,setRoute:R=>{R.emailId===i.emailId&&!!R.isTemplate==!!i.isTemplate||(i=R,k())}});let j,G;const V=()=>{const R=r()?.get().docId;R!==G&&(j?.(),G=R,j=r()?.subscribe(re)),k()};let Q,_e;const gt=()=>{const R=e.getInstance(l.INIT_PIPELINE_ID);!R||R===Q||(_e?.(),Q=R,_e=R.onShowRequested(H=>m.showRequested(H)))},Pe=n.addListener(R=>{R.data?.operation===l.EVENT_TYPES.SANDBOX_RESIZED&&S.notify()}),be=t.subscribe(V),zt=wn(n,k);V(),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{c?.dispose(),_e?.(),zt(),be(),j?.(),Pe.dispose(),S.cancel(),N.stop()})}function Ff(){return l.USEBLOCKS!=="useblocks"}var Do={config:{mode:"freeUserBlocks",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formButtonFieldReplacerEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!1,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},Bf={config:{mode:"pro",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!0,styles:"",revisionService:!1,headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!0,commonStylesEnabled:!0,emailResponsiveControlEnabled:!0,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!0,annotationsEnabled:!0,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!0,formFieldBorderRadiusEnabled:!0,formFieldBoxShadowEnabled:!0,formFieldVisibilityEnabled:!0,formFieldExportAsPictureEnabled:!0,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!0,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!0,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!0,formImageFieldReplacerEnabled:!0,formImageFieldHeightEnabled:!0,formTextFieldTypografEnabled:!0,formTextFieldReplacerEnabled:!0,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!0,elementAIimageEnabled:!0,elementAItextEnabled:!0,elementCarouselEnabled:!0,elementAccordionEnabled:!0,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!0,formFieldAmpVisibilityEnabled:!0,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0,enableCopyFile:!0}},project:void 0,page:{isNew:!0,type:"email",project:0,id:"",showToken:0}},Po=Do,jf=["freeUserBlocks","blocks"],jn={};function Uf(e){jn=e}var Ro=e=>jf.includes(e)?Po:jn[e]??jn.editor??Po,Un={config:{mode:"simple",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!0,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!0,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!1,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!0,emailDropdownMenuClone:!0,emailDropdownMenuImport:!0,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportZipEnabled:!0,exportTextEnabled:!0,exportMarkdownEnabled:!0,exportClipboardEnabled:!0,exportWebHookEnabled:!0,exportOutlookEnabled:!1,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!0,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!0,aiAssistentEnabled:!0,optimizeEnabled:!0,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!0,tagsEnabled:!0,isTemplateEnabled:!0,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!0,deleteButtonEnabled:!0,toggleSidePanel:!0,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!0,formFieldImageTitleEnabled:!0,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!0,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!0,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!0,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!0,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!1,elementCountdownEnabled:!1,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4,fileManager:{defaultFolderName:"",enableMoveFolder:!0,enableEdit:!0,enableTrash:!0}},project:void 0},Hf={config:{mode:"editor",autosaveTimeout:5e3,autosaveRetryMaxAttempts:5,autosaveRetryIntervalMs:3e4,theme:"",themes:{},mergeTagsShow:!1,styles:"",headerShow:!0,headerTitleVisible:!0,headerPreheaderVisible:!0,headerArrowBackVisible:!0,historyEnabled:!0,codeEnabled:!1,codeSideEnabled:!0,previewIconEnabled:!0,previewModeEnabled:!0,livePreviewEnabled:!0,sendTestEnabled:!0,sharePreviewEnabled:!1,webversionEnabled:!1,commonStylesEnabled:!1,emailResponsiveControlEnabled:!1,templateNotEmAlertShow:!1,beeFreeConverterEnabled:!0,stripoConverterEnabled:!0,aiLayoutConverterEnabled:!1,emailDropdownMenuEnabled:!1,emailDropdownMenuClone:!0,emailDropdownMenuImport:!1,emailDropdownMenuImportButton:!1,emailDropdownMenuConvert:!0,emailDropdownMenuLock:!0,emailDropdownMenuRemove:!0,emailExportEnabled:!0,exportHtmlEnabled:!0,exportTextEnabled:!1,exportMarkdownEnabled:!1,exportZipEnabled:!0,exportClipboardEnabled:!1,exportWebHookEnabled:!1,exportOutlookEnabled:!0,exportPdfEnabled:!0,exportPngEnabled:!0,nextButtonEnabled:!1,nextButtonText:"",saveButtonEnabled:!0,saveButtonText:"",commandButtonsEnabled:!0,emailIdShow:!1,sidePanelFloating:!0,desktopMobileSwitchRule:!0,desktopMobileSwitchPanel:!1,onlyCodeModeInMobile:!1,pathEnabled:!0,copyPasteEnabled:!1,saveBlockEnabled:!0,globalBlockCheckboxEnabled:!0,editImageControlEnabled:!0,lockEditor:!1,lockPreheaderAndTitle:!1,disableSideMenu:!1,menuDirection:"right",defaultBuildPanel:"",commentsEnabled:!1,aiAssistentEnabled:!1,optimizeEnabled:!1,optimizeLinksEnabled:!0,optimizeImagesEnabled:!0,optimizeSpamAssassinEnabled:!0,optimizeCheckCodeEnabled:!0,settingsEnabled:!0,settingsTabEnabled:!0,UTMEnabled:!1,annotationsEnabled:!1,subjectEnabled:!0,preheaderEnabled:!0,descriptionEnabled:!1,tagsEnabled:!0,isTemplateEnabled:!1,switchDesktopMobilePropsEnabled:!0,stepToOtherElementEnabled:!1,deleteButtonEnabled:!0,toggleSidePanel:!1,blocksSectionsShow:!0,blocksEmptyEnabled:!0,blocksSavedEnabled:!0,blocksCommonEnabled:!0,blocksTemplateEnabled:!0,blocksSearchEnabled:!0,blocksAddPanelEnabled:!0,imagePathDropdownEnabled:!1,formFieldImageTitleEnabled:!1,formFieldBorderEnabled:!1,formFieldBorderRadiusEnabled:!1,formFieldBoxShadowEnabled:!1,formFieldVisibilityEnabled:!1,formFieldExportAsPictureEnabled:!1,emailPaneDesktopSize:0,formButtonFieldInsertImageEnabled:!1,formButtonFieldVerticalAlignEnabled:!0,formButtonFieldTextAlignEnabled:!1,formButtonFieldBackgroundImageEnabled:!0,formButtonFieldPaddingsEnabled:!1,formButtonFieldReplacerEnabled:!1,formCellFieldVerticalAlignEnabled:!1,formCellFieldBackgroundImageEnabled:!0,formCellFieldPaddingsEnabled:!0,formCellFieldSizeEnabled:!1,formLinkFieldInsertImageEnabled:!0,formTableFieldBackgroundImageEnabled:!0,formDivFieldBackgroundImageEnabled:!0,formImageFieldVerticalAlignEnabled:!1,formImageFieldReplacerEnabled:!1,formImageFieldHeightEnabled:!1,formTextFieldTypografEnabled:!1,formTextFieldReplacerEnabled:!1,formEmailFieldBackgroundImageEnabled:!0,elementImageEnabled:!0,elementTextEnabled:!0,elementHeaderEnabled:!0,elementButtonEnabled:!0,elementListULEnabled:!0,elementListOLEnabled:!0,elementDividerEnabled:!0,elementSpacerEnabled:!0,elementSocialEnabled:!0,elementTableEnabled:!0,elementCountdownEnabled:!0,elementVideoEnabled:!1,elementAIimageEnabled:!0,elementAItextEnabled:!1,elementCarouselEnabled:!1,elementAccordionEnabled:!1,elementFormEnabled:!1,preventSendDataToEM:!1,imageInfoToolUrl:"",resourceProxy:void 0,resourceProxyPolicy:void 0,imageCenterFileManagerView:!0,imageCenterLocalUploadEnabled:!0,imageCenterStockEnabled:!0,imageCenterGifEnabled:!0,imageCenterIconStockEnabled:!0,imageCenterEditorEnabled:!0,compressMaxSize:1,compressMaxWidthOrHeight:2e3,ampExportEnabled:!1,formFieldAmpVisibilityEnabled:!1,testEmails:[],pushToGTM:!0,activeNextButton:!0,iconStrokeWidth:1.4},project:void 0},$f={...Un,config:{...Un.config,imageCenterFileManagerView:!1}};Uf({pro:Bf,editor:Hf,simple:Ff()?Un:$f,blocks:Do});var Oo=l.createIdentifier$1("CodeMode");function Mo(){let e;try{const t=window.localStorage?.getItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings);e=t?JSON.parse(t):void 0}catch{e=void 0}return{isCodeMode:!!(e?.isCodeMode||e?.isCodeMode===void 0),direction:e?.codeModeDirection||"left"}}function Vf(e){try{window.localStorage?.setItem(l.LOCAL_STORAGE_ITEMS.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Lo(e){return e.getOrCreateInstance(Oo,()=>{const t=ce(Mo());return t.watch(Vf),t})}function No(e){return e?.getInstance(Oo)?.get()??Mo()}function Hn(e,t){const n=Lo(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Gf(e,t){const n=Lo(e);n.set({...n.get(),direction:t})}function Yf(e,t,n=e.getInstance(l.CONFIG_SOURCE_ID)){n?.setMode(t),n?.get()?.codeEnabled===!1&&No(e).isCodeMode&&Hn(e,!1)}function Wf(e){e.getInstance(l.STANDALONE_ACTIVATED_ID)||e.inject(l.SECURITY_MODULE_ID,void 0)}function Rt(e){return String(e.standaloneKey||"").trim()||void 0}function qf(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function $n(e){return qf(e)?!!Rt(e):!1}function Qe(e){return!!Rt(e)&&!$n(e)}var zf=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function xo(e){return e==="server"?"serverSide":e}function Kf({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},s=ce();let o={kind:"pending"},i;const a=new Promise(g=>{i=g}),c=n===void 0?void 0:setTimeout(()=>{u({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function d(){o.kind!=="pending"&&s.set(_n(r,e))}function u(g){if(o.kind!=="pending")return;clearTimeout(c),o=g;const E=_n(r,e);s.set(E),i(E)}function f(g,E){r[xo(g)]=E,g==="server"&&o.kind==="pending"?u({kind:"applied"}):d()}return{watch:g=>s.watch(g),select:g=>s.select(g),get:()=>s.get(),ready:()=>a,state:()=>o,layers:()=>({...r}),bootstrap(){const g=_n(r,e);return Object.fromEntries(zf.map(E=>[E,g[E]]))},merge(g,E){f(E,{...r[xo(E)],...g})},replace(g,E){f(E,g)},setMode(g){r.user={...r.user,mode:g},d()},setAdvancedConfigs(g){r.advancedConfigs=g,d()},serverAbsent(g){u({kind:"absent",reason:g})},applyServerResponse(g){o.kind==="pending"&&f("server",{...r.serverSide,...g})},dispose(){clearTimeout(c)}}}var Xf=5e3,Jf="blocks";function Qf(){return{...Ro(Jf)?.config,mergeTags:void 0}}function Zf(e,t){e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function ep(e,t){let n;vn(e).watch(({profile:r})=>{const s=`${r?.theme??""}|${r?.locale??""}`;if(s===n)return;n=s;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function tp(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function np(e,t){let n,r=!1,s;const o=a=>{s??=yt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&Yf(e,a,t)},i=vn(e).watch(({profile:a})=>{const c=a?.email_builder_config,d=tp(c);if(d===void 0||c===n)return;const u=n===void 0;n=c,!(u&&r)&&o(d)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(i),t.ready().then(a=>{if(!a.configSwither)return;const c=localStorage.getItem("configSwither")||(n===void 0?a.mode:s)||"editor";localStorage.setItem("configSwither",c),r=n===void 0,o(c)})}var ko="замкнутый контур: app_init не выполняется";function rp(e,t){if(e.getInstance(l.SECURITY_MODULE_ID)){t.serverAbsent(ko);return}const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(r=>{Qe(r)&&t.serverAbsent(ko)});n&&e.getInstance(l.DISPOSABLE_ID)?.addDisposable(n)}async function sp(e,t){if(e.getInstance(en)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(l.APP_ID);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function op(e){e.injectFactory(l.CONFIG_SOURCE_ID,(t,n)=>{if(n)return n;const r=Kf({base:Qf(),env:{modeDefaults:s=>Ro(s)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:Xf});return Zf(e,r),ep(e,r),np(e,r),rp(e,r),sp(e,r),e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r),r},!0)}var Fe=class extends l.Disposable{_event;_listener;_disposeEvent;constructor(e){super(),this._event=e}setListener(e){this._listener!==e&&(this._listener=e,this._disposeEvent&&this._disposeEvent(),e?this._disposeEvent=this._event(e):this._disposeEvent=void 0)}dispose(){this._disposeEvent&&this._disposeEvent(),super.dispose()}};function B(e,t,n){const r=l.snapshot(e);return(s,o,i)=>{const a=r(async c=>{const d=t?t(c):c;i&&s.bind(i);const u=await s(d);return n?n(u):u},o,i);return()=>a.dispose()}}var ip=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new l.Emitter;this.handleDestroy=B(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Fe(this.handleDestroy));e.lifetime.addDisposable(t),e.lifetime.addDisposable(e.options.watch(({handleDestroy:r})=>n.setListener(r))),e.lifetime.addDispose(()=>e.release())}destroy(){if(!this.deps.lifetime.isDisposed())try{this.deps.lifetime.dispose()}catch{}}},Vn=l.createIdentifier$1("DestroyableService");function ap(e){e.injectFactory(Vn,(t,n)=>{if(n)return n;const r=e.getInstance(l.DISPOSABLE_ID);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new ip({lifetime:r,options:e.getInstance(l.OPTIONS_SOURCE_ID),getInstance:()=>e.getInstance(l.INSTANCE_ID),release:()=>l.releaseContainer(e.getInstance(l.STORE_ID)??e)})},!0)}function lp(e){const t=e.getInstance(Vn);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var cp=1e3;function Fo(e,t,n=cp,r=0){if(r>n||e===t)return!0;if(typeof e!=typeof t||e===null||t===null)return!1;if(typeof e=="object"&&typeof t=="object"){if(Object.getPrototypeOf(e)!==Object.getPrototypeOf(t))return!1;const s=Object.keys(e),o=Object.keys(t);if(s.length!==o.length)return!1;for(const i of s)if(!Fo(e[i],t[i],n,r+1))return!1;return!0}return!1}function Ze(e,t){if(!e||typeof e!="object")return t;if(!t||typeof t!="object")return{};const n={};for(const r of Object.keys(t)){const s=t[r],o=e[r];Fo(s,o)||(n[r]=s)}return n}var dp=({source:e,emailtags:t,group:n,tags:r,...s})=>s;async function up(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function fp({emails:e,saveTimeoutMs:t},n,r){const s=t?.()??rn();let o;try{const i=e.notifySave(n);return await Promise.race([i,new Promise((a,c)=>{o=setTimeout(()=>{const d=new an(s);n.value.id,Fl(d,up(i,r)),c(d)},s)})])}catch(i){throw ds(i),i}finally{o!==void 0&&clearTimeout(o)}}function pp(e){const{emails:t}=e,n=async(r,s)=>{const o=dp(s),i=r===void 0?void 0:await t.cache.getIfPresent(r),a=i?{...i,...o}:o,c=i?Ze(i,o):o,d=u=>{const f=String(u.id??r??l.generateUUID()),g=u.id===void 0?{...u,id:f}:u;return t.cache.addOrUpdate(f,()=>g)};return await d(await fp(e,{prev:i,patch:c,value:a,source:s.source??""},d))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const s=await n(void 0,r);return s?.renderGuid?s:{...s,renderGuid:l.generateUUID()}},async updateEmail(r,s){return await n(r,s)}}}var Gn=20;function hp(e){const t=mp(e);return e.saveTimeoutMs?gp(t,e.saveTimeoutMs):t}function mp({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:s,integratorProject:o}){const i=async(a,c)=>(t.clear(),await t.get(a,{page:c}),(await e.cache.values()??[]).filter(d=>String(d?.parent)===String(a)));return{async readRevisions(a,c=1){const d=await i(a,c);return{revisions:d.slice(Gn*(c-1),Gn*c),page:c,hasMore:d.length>Gn*c}},async readAutosave(a){const c=await r?.(a)??NaN,d=Number.isFinite(c)?c:void 0,u=await n?.(a);if(!u?.asked)return Wl(await i(a,1),d);if(!u.revision)return fs([],d);const f={...u.revision,parent:a,isAutosave:!0};return fs([f],d,await i(a,1))},async saveAutosave(a,c){const d=await s?.(a),u=o?.();return await e.create({...Ql(c),...d!==void 0?{author:d}:{},...u!==void 0?{project:u}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function gp(e,t){return{...e,async saveAutosave(n,r){const s=t();let o;try{return await Promise.race([e.saveAutosave(n,r),new Promise((i,a)=>{o=setTimeout(()=>a(new is(s)),s)})])}catch(i){throw ds(i),i}finally{o!==void 0&&clearTimeout(o)}}}}var Ep=class extends l.BaseEmitter{async execute([e],t){for(const n of t){const r=await n(e);r&&(r.id===void 0&&(r.id=e.value.id),e.value=r)}return e.value}},vp=class extends l.AsyncEmitter{};function l_(e){return e}var Bo=class extends l.Disposable{_items=new Map;_onChangeEmitter=new l.Signal;async _getOrCreate(e,t){const n=this._items;let r;if(n.has(e))try{r=await n.get(e)}catch{t&&(r=await t())}else t&&(r=await t(),r&&this._onChangeEmitter.fire());return r}async _addOrUpdate(e,t){let n;const r=this._items;if(r.has(e))try{n=await r.get(e)}catch{}const s=await t(n);return l.deepEqual(n,s)||this._onChangeEmitter.fire(),s}entries(){return Promise.all([...this._items.entries()].map(([e,t])=>t.then(n=>[e,n]))).then(e=>e.filter(([t,n])=>!!n))}values(){return Promise.all([...this._items.values()].map(e=>e).filter(e=>!!e))}getOrCreate(e,t){const n=this._getOrCreate(e,()=>t(e));return this._items.set(e,n),n}addOrUpdate(e,t){const n=this._addOrUpdate(e,t);return this._items.set(e,n),n}async getIfPresent(e){if(this._items.has(e))try{return await this._items.get(e)}catch{return}}add(e,t){const n=Promise.resolve(t);return this._items.set(e,n),n}remove(e){if(this._items.has(e)){const t=this._items.get(e);return this._items.delete(e),this._onChangeEmitter.fire(),t}return Promise.resolve(void 0)}async setAll(e){try{this.suspendChange();const t=[],n=new Set(Array.from(e).map(([s,o])=>s)),r=(await this.entries()).filter(([s,o])=>!n.has(s));for(const[s,o]of e)t.push(this.addOrUpdate(s,()=>o)),n.add(s);for(const[s]of r)t.push(this.remove(s));return await Promise.all(t),r}finally{this.resumeChange()}}clear(){this._items.clear(),this._onChangeEmitter.fire()}suspendChange(){this._onChangeEmitter.suspend()}resumeChange(){this._onChangeEmitter.resume()}onChange=this._onChangeEmitter.event};function _p(e,{filter:t,order:n="asc",orderBy:r,page:s,pageSize:o=20}={}){const i=e.length;let a=e.length;if(t!==void 0){const c=Object.keys(t);e=e.filter(d=>{for(const u of c){const f=d[u],g=t[u];return u==="id"||typeof f!="string"?f===g:typeof g=="string"&&f.startsWith(g)}return!0}),a=e.length}return r&&(e=e.sort((c,d)=>(c[r]>d[r]?1:d[r]>c[r]?-1:0)*(n==="asc"?1:-1))),s!==void 0&&(e=e.slice(o*(s-1),o*s)),{data:e,filteredTotal:a,total:i,totalPages:Math.ceil(a/o)}}function bp(e=[]){if(e=e.filter(n=>n),e.length<=1)return e[0];const t=new Map;for(const n of e)for(const r of n)if(r.id!==void 0){const s=t.get(r.id)||{};t.set(r.id,{...s,...r})}return[...t].map(([n,r])=>r)}function yp(e,t){return jo(e)&&jo(t)?String(e)===String(t):e===t}function jo(e){return typeof e=="string"||typeof e=="number"}var Sp=class extends l.Disposable{_cache=new Bo;_readEmitter=new l.AsyncEmitter;_saveEmitter=this.addDisposable(new Ep);_removeEmitter=this.addDisposable(new vp);_foreignCache=Object.create(null);async get(e){return this._cache.getOrCreate(e,async t=>Object.assign({id:e},...(await this._readEmitter.fire(e)).filter(n=>!!n)))}get cache(){return this._cache}byForeignKey(e){let t=this._foreignCache[e];if(!t){const n=this.addDisposable(new l.Disposable);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Bo),s=n.addDisposable(new l.AsyncEmitter);t=this._foreignCache[e]={get:async(o,i={})=>{await r.getOrCreate(o,async()=>{try{const c=bp(await s.fire(o))||[];for(const d of c)d[e]=o,await this._cache.add(d.id,d);return c}catch{return[]}});const a=(await this._cache.values()||[]).filter(c=>{const d=c[e];return d==null||yp(d,o)});return _p(a,i)},first(o,i={}){return t.get(o,{...i,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:s.event,clear(){r.clear()},dispose(){n.dispose()}}}return t}async create(e,{source:t="",silent:n}={}){let r=e;return n||(r=await this._saveEmitter.fire({prev:void 0,patch:e,value:r,source:t})),r.id===void 0&&(r.id=l.generateUUID()),await this._cache.addOrUpdate(r.id,()=>r)}notifySave(e){return this._saveEmitter.fire(e)}async update(e,t,{source:n="",silent:r}={}){return this._cache.addOrUpdate(e,async s=>{const o=s?{...s,...t}:t;if(!r)return t=s?Ze(s,t):t,await this._saveEmitter.fire({prev:s,patch:t,value:o,source:n})})}async remove(e,{source:t="",silent:n}={}){const r=await this._cache.remove(e);return n||await this._removeEmitter.fire({value:r,source:t}),r}refresh(){this._cache.clear();for(const e of Object.values(this._foreignCache))e.clear()}suspendChange(){this._cache.suspendChange()}resumeChange(){this._cache.resumeChange()}handlerRead=this._readEmitter.event;onSave=this._saveEmitter.event;onRemove=this._removeEmitter.event;onChange=this._cache.onChange};function et(e){const t=l.createIdentifier$1(e);return n=>n.getOrCreateInstance(t,()=>new Sp)}function Uo(e){const t=e.getInstance(l.DISPOSABLE_ID);if(!t)throw new Error("Failed");return t}function Ho(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Yn(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function Ip(e,t,n){return e&&!Ho(t)&&Ho(e)?{...n,meta:e.meta}:n}var wp=l.createIdentifier$1("CurrentProject"),Tp={};function tt(e){return e?.getInstance(wp)?.get()??Tp}function Wn(e){const t=tt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var $o=et("plugin.dataSource.emails"),Vo=et("plugin.dataSource.emailRevisions"),Go=Dn("plugin.readEmailAutosave"),Yo=l.createIdentifier$1("emailDocuments.provided");function Cp(e){const t=$o(e),n=Vo(e),r=n.byForeignKey("parent");if(e.getInstance(Yo))return{emails:t,emailRevisions:n};e.inject(Yo,!0);const s=()=>rn(e.getInstance(l.INIT_PIPELINE_ID)?.contentReadyTimeoutMs),o=pp({emails:t,saveTimeoutMs:s}),i=new Map,a=(c,d)=>u=>{const f=u?.id??d;return(typeof f=="string"||typeof f=="number")&&i.set(String(f),c),u};return Ic(e,{...o,createEmail:c=>o.createEmail(c).then(a(Date.now())),updateEmail:(c,d)=>o.updateEmail(c,d).then(a(Date.now(),c))}),Ac(e,hp({revisions:n,revisionsByEmail:r,readAutosave:async c=>{const d=await se(e,Go).fire(c);return d.length===0?{asked:!1}:{asked:!0,revision:d[0]??null}},savedAt:async c=>{const d=Gl((await t.cache.getIfPresent(c))?.modified),u=i.get(String(c))??NaN;return Number.isFinite(u)&&!(d>=u)?u:d},emailAuthor:async c=>(await t.cache.getIfPresent(c))?.author,saveTimeoutMs:s,integratorProject:()=>tt(e).requested})),Uo(e).addDisposable(t.onSave(({prev:c,patch:d,value:u})=>Ip(c,d,u),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Wo(e,t){return!e?.data||!t||e.id!==t.locale?!1:t.contentHash?e.hash===t.contentHash:t.updatedAt>0&&t.updatedAt<=e.time}function Ap(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var Dp="po",Ot=null;function Pp(){const e=typeof __useblocks__<"u"?__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([Dp],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Rp(){return Ot===null&&(Ot=Pp().catch(e=>{throw Ot=null,e})),Ot}async function qo(e){if(typeof e=="object")return qn(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Op(t):Mp(t)}function qn(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Op(e){try{return qn(JSON.parse(e))}catch{return}}var zo=!1;async function Mp(e){try{return qn((await Rp()).parsePoCatalog(e))}catch{zo||(zo=!0);return}}var Lp="em_locale",Np="em_ant_locale",xp="locale",kp="ant_locale";function zn(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function Ko(e,t){const n=zn(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Fp(){return zn("em_locale")??Ko(xp,"em_locale")}function Xo(e){try{localStorage.setItem(Lp,JSON.stringify(e))}catch{}}function Bp(){return zn("em_ant_locale")??Ko(kp,"em_ant_locale")}function jp(e,t){try{localStorage.setItem(Np,JSON.stringify({id:e,data:t}))}catch{}}var c_="en_US",Up=8e3;function Hp(e,t){const n=e,r=t,s=Object.keys(n).filter(o=>o!=="");return s.length!==Object.keys(r).filter(o=>o!=="").length?!1:s.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function $p(e){const t=Fp(),n=Bp();let r={ready:!1},s;const o=ce(r);let i=0;const a=h=>{r={...r,...h},o.set(r)},c=()=>{r.ready||a({ready:!0})},d=setTimeout(c,e.unlockAfterMs??Up),u=h=>h!==i;let f;async function g(h,y){if(n?.id===h&&n.data&&a({antd:n.data}),!f)return;const w=await f(h).catch(()=>{});!w||u(y)||(a({antd:w}),jp(h,w))}async function E(h,y){const w=await e.askHost(h).catch(()=>null);if(u(y))return!0;if(w==null)return!1;const A=await qo(w);return u(y)||(A&&a({catalog:A}),c()),!0}async function S(h,y){const w=await e.readList();if(u(y))return;if("error"in w){a({failure:{kind:"GET_LOCALES_ERROR",error:w.error}}),c();return}const A=w.data.find(N=>N.locale===h);if(!A){Ap("em_locale")&&a({catalog:void 0}),c();return}if(Wo(t,A)&&(!s||s.catalog===t?.data)){c();return}if(s?.entry&&r.catalog===s.catalog&&Wo(s.entry,A)){Xo(s.entry),c();return}const D=await e.readCatalog(h);if(!u(y)){if("error"in D){a({failure:{kind:"GET_LOCALE_ERROR",error:D.error}}),c();return}D.data&&(s?.id===h&&r.catalog===s.catalog&&Hp(s.catalog,D.data)||a({catalog:D.data}),Xo({id:h,time:A.updatedAt||Math.floor(Date.now()/1e3),hash:A.contentHash,data:D.data})),c()}}async function b(h,y){if(!await E(h,y)){if(!u(y)&&(s?.id===h&&r.catalog===s.catalog||h==="en_US")&&c(),e.canUseNetwork&&!e.canUseNetwork()){c();return}await S(h,y)}}return{set(h){if(!h||h===r.id)return;const y=i+=1;a({id:h,failure:void 0});const w=s?.id===h&&r.catalog===s.catalog;(s&&!w&&r.catalog===s.catalog||h==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===h&&t.data&&(a({catalog:t.data}),c()),g(h,y),b(h,y)},prime(h,y,w){r.id&&r.id!==h||r.catalog||!y||(s=t?.id===h&&t.data&&(!w||t.time>=w.time)?{id:h,catalog:t.data}:{id:h,catalog:y,entry:w?{id:h,time:w.time,hash:w.hash,data:y}:void 0},a({catalog:s.catalog}))},useAntdLoader(h){f=h,r.id&&g(r.id,i)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(d)}}var Vp=class{http;constructor(e){this.http=e}jsonList=({locale:e},t={})=>this.http.request({path:`/translations/${e}.json`,method:"GET",format:"json",...t});getTranslations=({locale:e},t={})=>this.http.request({path:`/translations/${e}.po`,method:"GET",...t});localesList=(e={})=>this.http.request({path:"/translations/locales",method:"GET",format:"json",...e})},Gp=class{baseUrl="/api/v2";securityData=null;securityWorker;abortControllers=new Map;customFetch=(...e)=>fetch(...e);baseApiParams={credentials:"same-origin",headers:{},redirect:"follow",referrerPolicy:"no-referrer"};constructor(e={}){Object.assign(this,e)}setSecurityData=e=>{this.securityData=e};encodeQueryParam(e,t){return`${encodeURIComponent(e)}=${encodeURIComponent(typeof t=="number"?t:`${t}`)}`}addQueryParam(e,t){return this.encodeQueryParam(t,e[t])}addArrayQueryParam(e,t){return e[t].map(n=>this.encodeQueryParam(t,n)).join("&")}toQueryString(e){const t=e||{};return Object.keys(t).filter(n=>typeof t[n]<"u").map(n=>Array.isArray(t[n])?this.addArrayQueryParam(t,n):this.addQueryParam(t,n)).join("&")}addQueryParams(e){const t=this.toQueryString(e);return t?`?${t}`:""}contentFormatters={"application/json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"application/vnd.api+json":e=>e!==null&&(typeof e=="object"||typeof e=="string")?JSON.stringify(e):e,"text/plain":e=>e!==null&&typeof e!="string"?JSON.stringify(e):e,"multipart/form-data":e=>e instanceof FormData?e:Object.keys(e||{}).reduce((t,n)=>{const r=e[n];return t.append(n,r instanceof Blob?r:typeof r=="object"&&r!==null?JSON.stringify(r):`${r}`),t},new FormData),"application/x-www-form-urlencoded":e=>this.toQueryString(e)};mergeRequestParams(e,t){return{...this.baseApiParams,...e,...t||{},headers:{...this.baseApiParams.headers||{},...e.headers||{},...t&&t.headers||{}}}}createAbortSignal=e=>{if(this.abortControllers.has(e)){const n=this.abortControllers.get(e);return n?n.signal:void 0}const t=new AbortController;return this.abortControllers.set(e,t),t.signal};abortRequest=e=>{const t=this.abortControllers.get(e);t&&(t.abort(),this.abortControllers.delete(e))};request=async({body:e,secure:t,path:n,type:r,query:s,format:o,baseUrl:i,cancelToken:a,...c})=>{const d=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},u=this.mergeRequestParams(c,d),f=s&&this.toQueryString(s),g=this.contentFormatters[r||"application/json"],E=o||u.format;return this.customFetch(`${i||this.baseUrl||""}${n}${f?`?${f}`:""}`,{...u,headers:{...u.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):u.signal)||null,body:typeof e>"u"||e===null?null:g(e)}).then(async S=>{const b=S;b.data=null,b.error=null;const h=E?S.clone():S,y=E?await h[E]().then(w=>(b.ok?b.data=w:b.error=w,b)).catch(w=>(b.error=w,b)):b;return a&&this.abortControllers.delete(a),y})}},Yp=l.createIdentifier$1("rest.v2.transport"),Jo=Symbol("rest.v2.secureRequest");function Wp(e){return e.getOrCreateInstance(Yp,()=>{const t=e.getInstance(l.CUSTOM_FETCH_ID)?.execute||fetch;return new Gp({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[Jo]:!0}),customFetch:(n,r={})=>{const{[Jo]:s,...o}=r;return t(n,{...o,[l.PUBLIC_REQUEST]:s!==!0})}})})}function qp(e,t){const n=Wp(e);return Object.assign({},...t.map(r=>new r(n)))}function Qo(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function Zo(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Qo(n.details,"wp_code")??n.code,message:Qo(n.details,"wp_message")??n.message,details:n.details}}:t&&typeof t=="object"?{status:e.status,data:t}:{status:e.status,data:{message:e.statusText||"request failed"}}}function ei(e){return!e.ok||!!e.error}function zp(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function ti(){return zp(l.LOCAL_STORAGE_ITEMS.em_translations_v2)??!0}function Kp(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function Xp(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function Jp(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],s=r[0];return typeof s=="string"&&s!==""&&t.push({locale:s,updatedAt:Kp(r[1])}),t},[]):[]}function Qp(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:Xp(n.updated_at),contentHash:n.content_hash}),t),[])}function ni(e){return qp(e,[Vp])}function Mt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function Kn(e){return!e.ok||e.error!=null}function Xn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Jn(e){return{data:await qo(e)??null}}async function Zp(e){if(ti())try{const n=await ni(e).localesList();return ei(n)?{error:Zo(n)}:{data:Qp(n.data)}}catch(n){return Mt(n)}const t=l.getApi(e,[Yr]);try{const n=await t.get_translations2({file:"react_app"});return Kn(n)?Xn(n):{data:Jp(n.data)}}catch(n){return Mt(n)}}async function eh(e,t){if(ti())try{const r=await ni(e).jsonList({locale:t});return ei(r)?{error:Zo(r)}:Jn(r.data)}catch(r){return Mt(r)}const n=l.getApi(e,[Yr]);try{const r=await n.get_translations3({id:t,file:"react_app"});return Kn(r)?Xn(r):Jn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return Kn(r)?Xn(r):Jn(r.data)}catch(r){return Mt(r)}}}var Lt=new WeakMap;function th(e){const t=Lt.get(e);if(t!==void 0)return t;const n=Zp(e).then(r=>("error"in r&&Lt.delete(e),r),r=>{throw Lt.delete(e),r});return Lt.set(e,n),n}var nt=l.createIdentifier$1("locale.service");function nh(e){if(e.getInstance(nt))return;const t=$p({readList:()=>th(e),readCatalog:n=>eh(e,n),askHost:async n=>(await se(e,l.events.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(l.SECURITY_MODULE_ID)});e.inject(nt,t),e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t.dispose())}function rh(e){const t=e.getInstance(l.CONFIG_SOURCE_ID);if(!t)return;const n=e.getInstance(nt);if(!n)return;const r=t.select(s=>s.locale).watch(s=>n.set(s||"en_US"));e.getInstance(l.DISPOSABLE_ID)?.addDisposable(r)}var sh="user_id",oh="project_id",ri=l.createIdentifier$1("rest.identityHeadersProvided");function ih(e){if(e.getInstance(ri))return;e.inject(ri,!0);let t;e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(n=>{t=n}),e.addService(l.REQUEST_HANDLER_ID,{execute(n,r){if(r?.public)return;const s=t?.user?.id??Ms(e).profile?.id;s!=null&&s!==""&&n.headers.set(sh,String(s));const o=t?.project;o!=null&&o!==""&&n.headers.set(oh,String(o))}})}function ah(e){if(!e)return!1;try{return e.getInstance(l.SECURITY_MODULE_ID)!==void 0}catch{return!1}}var lh="Invalid standaloneKey.",d_=l.createIdentifier$1("StandaloneMockGuard");function ch(){const e=new Error(lh);return e.name="InvalidStandaloneKeyError",e}function dh(e){e.addService(l.REQUEST_HANDLER_ID,{execute:()=>{if(ah(e))throw ch()}})}function uh(e){l.registerRestTransport(e),dh(e)}function fh(e){const t=new to;e.inject(l.INIT_PIPELINE_ID,t);const n=e.getInstance(l.OPTIONS_SOURCE_ID)?.watch(s=>{if(!s)return;const o=s.signal??t.externalSignal;t.configure({replaceSession:!0,...s.timeouts!==void 0?{timeouts:s.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(l.DISPOSABLE_ID);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var ph=et("plugin.dataSource.blocks"),hh=et("plugin.dataSource.blockRevisions"),mh=et("plugin.dataSource.comments"),gh=Dn(),Eh=Dn(),si=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
2086
2110
|
<html>
|
|
2087
2111
|
<head>
|
|
2088
2112
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
@@ -2123,10 +2147,10 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/99
|
|
|
2123
2147
|
</tr>
|
|
2124
2148
|
</table>
|
|
2125
2149
|
</body>
|
|
2126
|
-
</html>`;function
|
|
2150
|
+
</html>`;function vh(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:si,project:e?.id,project_title:e?.title??"",tags:[],utm_parameters:{utm_source:"",utm_medium:"",utm_campaign:"",utm_term:"",utm_content:""},parent_email:null,common_styles:"{}",title:"",emailtags:[],isAmp:!1}}var oi=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function _h(e){return!Object.keys(e).some(t=>oi.has(t))}function bh(e){const t={},n={};for(const[r,s]of Object.entries(e))oi.has(r)?t[r]=s:n[r]=s;return{showOptions:t,misplacedEmailFields:n}}function ii(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function u_(e){}function rt(e){return{emails:$o(e),blocks:ph(e),emailRevisions:Vo(e),blocksRevision:hh(e),comments:mh(e)}}function yh(e){const t=Object.values(rt(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function Nt(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(_h(e))return{email:ii(e)};{const{showOptions:n,misplacedEmailFields:r}=bh(e),s=Object.keys(r);t&&s.length>0&&void 0;const o=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:ii({...r,...o})}}}function Qn(e){return yn(e)?.current()}function xt(e){return Qn(e)?.getContent()}function ai(e,t){const n=t??vh(),r=Qn(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:xt(e)??n.html}:n}async function kt(e){return(await e.getInstanceAsync(l.APP_ID))?.project}async function Sh(e){return Wn(e)??await kt(e)}function li(e){if(!e)return;const t=Nt(e,!1).email.id;return t==null?void 0:String(t)}function Ih(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function wh(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}function Be({code:e,project:t,...n},r){const s=ge(n),o=Wn(r),i=we(r);return e&&i.warnAboutUnconfiguredInput(e,n.id),{...s,...e?{html:i.toEditorForm(e)}:{},...o===void 0?{}:{project:o},..."utm_parameters"in s?{utm_parameters:s.utm_parameters||{}}:{},_embedded:void 0}}function oe({html:e,renderGuid:t,showToken:n,showId:r,...s},o){const{requested:i}=tt(o),a=xs(o);return ge({...s,code:we(o).toOutputForm(e),project:i===void 0?s.project:i,utm_parameters:a.UTMEnabled?s.utm_parameters:void 0,tags:void 0,template:void 0,guid:void 0,emailtags:void 0,project_title:void 0,project_author:void 0,is_template:void 0,is_inited:void 0})}function Zn(e){return e==null?"":e.replaceAll(`\r
|
|
2127
2151
|
`,`
|
|
2128
|
-
`)}function qs(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Yu(e,t,n,r){const s=qu(e,t,n,r);return s===void 0}function qu(e,t,n,r){const{email:s}=it(t,!1),o=_e(s,e),i=o.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const l=kt(e)?.current();if(!l)return"no-session";const c=l.get(),d=c.attributes;if(c.serverId!==i)return"document-id";if(d.is_inited!==!0)return"not-inited";const u=qs(cn(n??l.getContent()));if(o.html!==void 0&&qs(cn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==d.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==d.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==d.common_styles)return"common_styles"}function zs(e,t){const{email:n}=it(t,!1),r=_e(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:cn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function zu(e,t){const n={...e};return delete n.id,{...n,...t}}function Wu(e){return e.html?e:{...e,html:Us}}function Me({code:e,project:t,...n},r,s){const o=s??Hs(r);return{...n,...e?{html:ve(r).toEditorForm(e)}:{},renderGuid:a.generateUUID(),...o===void 0?{}:{project:o}}}function lt({html:e,renderGuid:t,...n},r){const{requested:s}=st(r);return oe({...n,code:ve(r).toOutputForm(e),project:s===void 0?n.project:s,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function Ws(e){return kt(e)?.current()?.get().serverId??void 0}function dn(e,t,n){return n===void 0&&(n=e.post===void 0?Ws(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function ct(e,t){return oe({...e,link:void 0,comment_status:void 0})}function dt({code:e,autosave:t,...n},r,s){return s===void 0&&(s=n.parent===void 0?Ws(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0,parent:s}}function Ks({html:e,isAutosave:t,...n},r){return oe({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:oe({html:e,ampHtml:e&&""})})}var un=a.createIdentifier$1("NotificationService"),Ku=a.createIdentifier$1("emailTemplate.reads");async function Xu(e,t){try{return await fe(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Qu(e,t,n);return}}var Ju=a.createIdentifier$1("emailTemplate.notifiedFailures");function Qu(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Ju,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(un).then(()=>{a.getEmitter(e,a.events.ON_NOTIFICATION).fire({type:"error",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Zu(e,t){const n=e.getOrCreateInstance(Ku,()=>new Map),r=n.get(t);if(r!==void 0)return r;const s=Xu(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,s),s}var ef="EXTERNAL";function tf(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var nf="email_id",rf=class extends a.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_dataSources;_eventLock;_queue=a.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=ot(t),this._eventLock=Hu(t);const n=G(e,a.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(a.REQUEST_HANDLER_ID,{execute:(r,s)=>{!s?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(nf,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(a.INIT_PIPELINE_ID)??Yt}_throwIfDestroyed(){if(this.isDisposed())throw _t()}async getTemplateEmail(e){const t=await Zu(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await ln(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,Me(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,dt(s,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,dn(s,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,s){const o=this._dataSources.emails,i=o.cache,l=await ln(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=_e(e,this._container);const u=d.id;let p=u;if(u!==void 0){const E=await o.get(u);d={...E??{},...d,utm_parameters:d.utm_parameters??E?.utm_parameters??{},renderGuid:E?.renderGuid??a.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:l}}else{p=n??a.generateUUID();const E=await o.get(p);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:E?.renderGuid??a.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:l},delete d.project}if(t){const E=await this.getTemplateEmail(String(t));E&&(d=zu(E,d))}return u===void 0&&(d=Wu(d)),await i.addOrUpdate(p,()=>d),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==zs(this._container,e))return!1;const n=at(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=zs(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:at(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&Gu({ticket:t,emailId:Ys(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId})){this._showRequests;return}if(!e)return;const n=this._getInitPipeline();a.throwIfAborted(n.signal);const r=Vu(e);if(!r&&Yu(this._container,e,at(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const s=it(e);s.email.id,this._prevCommand?.id;let o,i="",l=0,c=!1,d,u=Promise.resolve(),p,E=!1;try{this._eventLock.suspendChange();const{email:m,blocks:b,autosaves:v,comments:h,templateId:_,reload:y}=s;o=m.id;const S=_e(m,this._container),A=S.id,C=A??a.generateUUID(),g=await Pe("getProject",ln(this._container));a.throwIfAborted(n.signal),i=a.generateUUID();const I={isNew:A===void 0,id:String(C),project:g},f=y===!0&&A!==void 0;f&&(await this._dataSources.emails.remove(String(A),{silent:!0}),String(A)),l=++this._showToken,String(C);const w=[];w.push(this.setBlocks(b)),m.id!==void 0&&(w.push(this.setComments(h)),w.push(this.setEmailRevisions(v,String(m.id)))),w.push(this.setEmail(m,Number(_),A===void 0?String(C):void 0,l,i)),await Pe("setEmail+blocks+revisions",Promise.all(w),{emailId:A??String(C),showId:i,targetShowToken:l}),a.throwIfAborted(n.signal);const T=await this._dataSources.emails.get(String(C)),L=ie(this._container),F={id:i,token:l};A===void 0?p=L.startNewDraft(T??S,{patch:S,show:F}):f?p=L.reload(A,{email:T??S,patch:S,show:F}):L.sessionKey()===he(A)?p=L.show(S,F):p=L.open(A,{email:T??S,patch:S,show:F});const z=!!this._prevCommand&&a.deepEqual(this._prevCommand,I);I.id,!this._prevCommand||a.deepEqual(this._prevCommand,I),this._prevCommand?.id,this._rememberShow(I),u=n.requestShow({showId:i,navId:String(C),emailId:A,isNew:A===void 0}),E=!0,String(C),c=!0}catch(m){d=m,E&&i&&n.failShow(i,m),a.isAbortError(m)||(ar(m),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[useblocks] show() setup failed: ${String(d??"unknown error")}`);return Pe("show-init-deferred",Promise.all([u,p?.whenReady().catch(m=>{if(m instanceof qe){const b=wr(m);throw b?new Error(`[useblocks] show(): email open failed (${b})`,{cause:m}):m}})??Promise.resolve()]).then(()=>{}),{showId:i,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();a.throwIfAborted(e.signal);const t=ie(this._container),n=await t.save("publish",{source:ef});if(a.throwIfAborted(e.signal),!n)throw tf(t.saveState().error);return Q($u(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;return this._latestShowEmailId=Ys(e),this._queuedShow(e,t)};save=this._queue.decorate(this._save,this)};function sf(e){return String(e).replace(/"/g,""")}function of(e=new Date){const t=n=>String(n).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function af(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let n;for(;(n=t.exec(e))!==null;){const r=n[2]??"";if(/\bem\s*=\s*["']block["']/i.test(r))return{full:n[0],index:n.index}}return null}function Xs(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),s=sf(n);return r.test(e)?e.replace(r,`${t}="${s}"`):e.replace(/>$/,` ${t}="${s}">`)}function lf(e,t,n){if(!e?.trim()||!t)return e;const r=af(e);if(!r)return e;const s=String(t),o=of(n??new Date);let{full:i,index:l}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=Xs(i,"em-block-id",s)),i=Xs(i,"em-block-version",o),e.slice(0,l)+i+e.slice(l+c)}function cf(e){if(e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object")return e.meta;const t=e.catalogExtra?.meta;if(t!=null&&typeof t=="object")return t}function df(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),s=t?.project??(e.project!==void 0&&e.project!==null?String(e.project):void 0);return{type:t?.type??n,insertFrom:n,name:t?.name??e.name,blockId:r,project:s,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:cf(e)}}function fn(e,t){return t?df(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Js=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],uf=[...Js,"html","id","project","password"],Th=new Set(["html",...Js,"global_block","project"]);function ff(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set(uf),r={};for(const s of Object.keys(e))n.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function pf(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...ff(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var pn=new WeakMap;function mf(e){let t=pn.get(e);return t||(t={byId:new Map,fallback:[]},pn.set(e,t)),t}function hf(e){pn.delete(e)}function gf(e,t){const{byId:n,fallback:r}=mf(t);if(e.blockId){const s=n.get(e.blockId);if(s){n.delete(e.blockId);const o=r.indexOf(s);return o>=0&&r.splice(o,1),s}return}for(let s=r.length-1;s>=0;s--){const o=r[s],i=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,l=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(i&&l)return r.splice(s,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Ef(e,t){const{blocks:n}=ot(e);return await n.cache.getIfPresent(t)??void 0}async function vf(e,t){if(!t.blockId)return;const n=await Ef(e,t.blockId);if(n)return pf(n,t)}async function bf(e,t){const n=gf(e,t);if(n)return fn(e,n);const r=await vf(t,e);return r?fn(e,r):fn(e,void 0)}var _f=a.createIdentifier("application_block_inserted"),yf=-1e3,Qs=new WeakSet;function Sf(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function wf(e){if(!e||Qs.has(e))return;Qs.add(e);const t=new a.Disposable,n=K(e);return t.addDisposable(n.addListenerAsyncPipe(_f,async(r,s)=>{const o=Sf(r)?await bf(r,e):r;return s?s(o):o},yf)),t.addDisposable({dispose:()=>{hf(e)}}),t}var Zs=100,If=class extends a.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=wf(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:s}=ot(e),o=G(e,a.events.ON_SHARE_ID),i=G(e,a.events.ON_SHOW_PREVIEW_ID),l=G(e,a.events.ON_EMAIL_CLONE_ID),c=G(e,a.events.ON_CODE_VALIDATE_ID),d=G(e,a.events.ON_SUBJECT_CHANGED_ID),u=G(e,a.events.ON_EMAIL_CHANGED_ID),p=G(e,a.events.ON_PREHEADER_CHANGED_ID),E=G(e,a.events.ON_SAVEBUTTON_CLICK_ID),m=G(e,a.events.ON_NEXTBUTTON_CLICK_ID),b=G(e,a.events.ON_SEND_LIVEPREVIEW_ID),v=G(e,a.events.ON_SEND_TESTEMAIL_ID),h=G(e,xu),_=G(e,a.events.ON_CONTENT_CHANGED_ID),y=G(e,Nu),S=G(e,a.events.ON_PREVIOUSBUTTON_CLICK_ID),A=G(e,a.events.ON_SEND_EMAIL_MODAL_ID),C=a.filter(G(e,a.events.ON_EMAIL_INIT_ID),g=>!g.reset);return{handlePreheaderChanged:j(p),handleSubjectChanged:j(d),handleValidate:j(c),handleReadEmail:j(n.handlerRead,g=>g,g=>g&&_e(g,e)),handleSaveEmail:j(n.onSave,function({prev:g,patch:I,value:f,source:w}){const T=g?Q(g,e):void 0;return{prev:T,patch:Re(T,Q(I,e)),value:Q(f,e),source:w}},g=>g?_e(g,e):void 0),handleRemoveEmail:j(n.onRemove,({value:g,source:I})=>({value:Q(g,e),source:I}),()=>{}),handleReadCommonBlocks:j(h,g=>g.project,g=>g?.map(I=>Me(I,e))),handleReadTemplateBlocks:j(y,g=>g,g=>g?.map(I=>Me(I,e))),handleReadBlocks:j(t.byForeignKey("project").handleRead,g=>st(e).requested||String(g),g=>g?.map(I=>Me(I,e))),handleSaveBlock:j(t.onSave,function({prev:g,patch:I,value:f,source:w}){const T=f.global_block===!0&&f.id&&typeof f.html=="string"?{...f,html:lf(f.html,String(f.id))}:f,L=g?lt(g,e):void 0;return{prev:L,patch:Re(L,lt(I,e)),value:lt(T,e),source:w}},g=>g?Me(g,e):void 0),handleRemoveBlock:j(t.onRemove,({value:g,source:I})=>({value:lt(g,e),source:I}),()=>{}),handleReadComments:j(r.byForeignKey("post").handleRead,g=>g,g=>g?.map(I=>dn(I,e))),handleSaveComment:j(r.onSave,function({prev:g,patch:I,value:f,source:w}){const T=g?ct(g,e):void 0;return{prev:T,patch:Re(T,ct(I,e)),value:ct(f,e),source:w}},g=>g?dn(g,e):void 0),handleRemoveComment:j(r.onRemove,({value:g,source:I})=>({value:ct(g,e),source:I}),()=>{}),handleReadEmailRevisions:j(s.byForeignKey("parent").handleRead,g=>g,g=>g?.map(I=>dt(I,e))),handleReadEmailAutosave:j(G(e,As),g=>g,g=>g?dt(g,e):null),handleEmailAutosave:j(s.onSave,function({prev:g,patch:I,value:f,source:w}){return{value:Ks(f,e),source:w}},g=>g?dt(g,e):void 0),handleRemoveEmailAutoSave:j(s.onRemove,({value:g,source:I})=>({value:Ks(g,e),source:I}),()=>{}),handleEmailChanged:j(a.debounce(u,Zs),g=>Q(g,e)),handleEmailInit:j(C,g=>Q(g,e)),handlePreviousButtonClick:j(S,g=>Q(g,e)),handleNextButtonClick:j(m,g=>Q(g,e)),handleSaveButtonClick:j(E,g=>Q(g,e)),handleHtmlChanged:j(a.debounce(_,Zs)),handleTestEmailSend:j(v,({html:g,...I})=>({...I,code:g,compiled:{html:g,ampHtml:""}})),handleTestEmailModal:j(A,g=>Q(g,e)),handleCloneEmail:j(l,g=>Q(g,e)),handleShareEmail:j(o),handlePreviewEmail:j(i),handleLivePreviewEmail:j(b)}}get(){return this._events||(this._events=this._get())}_listenersUpdaters;setOptions(e={}){const t=this.get();let n=this._listenersUpdaters;if(!n){n=this._listenersUpdaters={};for(const r of Object.keys(t))n[r]=this.addDisposable(new be(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},Tf=a.createIdentifier$1("DataController"),Af=a.createIdentifier$1("DataEvents");function eo(e){return e.getOrCreateInstance(Tf,()=>{const t=new rf(e);return e.getInstance(a.DISPOSABLE_ID)?.addDisposable(t),t})}function to(e){return e.getOrCreateInstance(Af,()=>new If(e))}var Cf=a.createIdentifier$1("plugin.startupShow");function Df(e){const t=eo(e),n=to(e),r=e.getInstance(a.OPTIONS_SOURCE_ID),s=e.getInstance(a.DISPOSABLE_ID),o={current:Promise.resolve()};e.inject(Cf,o);const i=r?.watch(c=>{c&&n.setOptions(c),o.current=o.current.catch(()=>{})}),l=r?.select(c=>c?.content).watch(c=>{if(c===void 0)return;$(W.showStart);const d=t.show(c).finally(()=>$(W.showEnd));d.catch(()=>{}),o.current=d});i&&s?.addDisposable(i),l&&s?.addDisposable(l)}function Pf(e){const t=eo(e);return{...to(e).get(),show(n){return $(W.showStart),t.show(n).finally(()=>$(W.showEnd))},save(){return t.save()}}}function Ah(e){return e}var Rf=[{name:"rest.client",setup:Pu},{name:"auth.oauth",setup:a.provideOAuth},{name:"rest.identityHeaders",setup:Iu},{name:"lifetime.destroyable",provides:[en],setup:Cd},{name:"appInit",provides:[a.APP_ID,St],setup:vi},{name:"config",provides:[a.CONFIG_SOURCE_ID],setup:Td},{name:"email.documents",setup:Vd},{name:"show.initPipeline",provides:[a.INIT_PIPELINE_ID],setup:Ru},{name:"show",setup:Df},{name:"locale.service",provides:[Le],setup:_u},{name:"locale.fromConfig",awaits:{services:[a.CONFIG_SOURCE_ID,Le]},setup:yu},{name:"canvas.early",setup:vc},{name:"canvas.previewSettings",setup:Ac},{name:"canvas.sandboxExtensions",setup:Dc},{name:"canvas.headerSync",provides:[as],setup:yc},{name:"canvas.ampSync",setup:Qa},{name:"canvas.moduleBridge",setup:wl},{name:"canvas.port",setup:al},{name:"canvas.images",setup:ol},{name:"canvas.edits",setup:nc},{name:"canvas.blockContent",setup:Xl},{name:"canvas.sandboxFill",provides:[qt],setup:Yc},{name:"canvas.reactions",setup:hc}],Of=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Lf(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const s=t.get(r)??[];s.push(n),t.set(r,s)}return t}function Mf(e,t){const n=[];for(const r of e.awaits?.services??[])for(const s of t.get(r)??[])s!==e&&n.push(s);return n}function no(e){const t=Lf(e),n=[],r=new Set,s=[],o=new Set,i=l=>{if(!r.has(l)){if(o.has(l)){const c=s.indexOf(l);throw new Of([...s.slice(c),l].map(d=>d.name))}o.add(l),s.push(l);for(const c of Mf(l,t))i(c);s.pop(),o.delete(l),r.add(l),n.push(l)}};for(const l of e)i(l);return n}var ro;function mn(e){const t=e.getInstance(a.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(a.DISPOSABLE_ID)||e.inject(a.DISPOSABLE_ID,new a.Disposable);const n=ue();e.inject(a.OPTIONS_SOURCE_ID,n),ro??=no(Rf);for(const r of ro)r.setup(e);return n}function Nf(e){}var xf=[{name:"save.previewFollow",setup:Nf}],so=a.createIdentifier$1("plugin.lateUnitsInstalled");function kf(e){if(!e.getInstance(so)){e.inject(so,!0);for(const t of no(xf))t.setup(e)}}function Ff(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Bf(e){if(!e)return;const t=a.decodeJwt(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(r=>typeof r=="string"?r.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(r=>/^project_\d+$/.test(r))?.replace(/^project_/,"")||void 0}var jf=a.defineMixin(e=>{let t,n,r;return{async setOptions(s){const o=r!==s.getAuthToken,i=!a.deepEqual(t,s.user),l=n!==s.project;if(r=s.getAuthToken,t=s.user,n=s.project,!(!e.getInstance(a.SECURITY_MODULE_ID)||!s.getAuthToken)&&!(!o&&!i&&!l))try{const c=await s.getAuthToken(s.user,s.project);e.inject(a.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=Bf(c);if(!d)return;e.inject(a.STANDALONE_PROJECT_ID,d);const u=e.getInstance(a.APP_ID),p=u?await u.catch(()=>{}):void 0;e.inject(a.APP_ID,Promise.resolve(Ff(d,p)))}catch{}}}});function Uf(e,t){if(e.getInstance(a.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(a.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=a.getEvent(e,a.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}function Hf(e){e.getInstance(a.STANDALONE_ACTIVATED_ID)||e.inject(a.SECURITY_MODULE_ID,void 0)}function ut(e){return String(e.standaloneKey||"").trim()||void 0}function $f(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function hn(e){return $f(e)?!!ut(e):!1}function ft(e){return!!ut(e)&&!hn(e)}var Gf=a.defineMixin(e=>{let t,n=!1;return{setOptions(r){const s=n;if(n=!0,!ft(r)){t&&(Hf(e),hn(r)),t=void 0;return}const o=ut(r);if(!o||t===o&&e.getInstance(a.SECURITY_MODULE_ID))return;t=o,e.inject(a.SECURITY_MODULE_ID,o);const i=e.getInstance(a.DISPOSABLE_ID);i&&Uf(e,i)}}}),Vf=a.defineMixin(e=>{const t=e.getInstance(a.DISPOSABLE_ID),n=a.getEvent(e,a.APP_LOAD_EVENT_ID),r=j(n),s=t.addDisposable(new be(r));return{setOptions({handleLoad:o}){s.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}}),Yf=a.defineMixin(e=>{const t=e.getInstance(a.DISPOSABLE_ID),n=t.addDisposable(new a.AsyncEmitter),r=t.addDisposable(new a.AsyncEmitter),s=a.getEmitter(e,a.CONFIG_CHANGED_EVENT_ID),o=j(n.event),i=j(r.event),l=j(s.event),c=t.addDisposable(new be(o)),d=t.addDisposable(new be(i)),u=t.addDisposable(new be(l));return{instance:{handleSetOptions:o,handleOptionsChanged:i,handleConfigChanged:l},async setOptions(p){c.setListener(p.handleSetOptions),d.setListener(p.handleOptionsChanged),u.setListener(p.handleConfigChanged),await n.fire(p),await r.fire(p)},dispose(){}}}),gn,oo="core";function qf(){const e=__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([oo],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function zf(e){const t=__useblocks__?.require?.warm;return typeof t!="function"?Ne().then(()=>{}):t([oo],e)}function Ne(){return gn===void 0&&(gn=qf().then(e=>(Te()&&e.installDiagnostics().catch(t=>{}),e))),gn}var En=null,vn=null;async function Wf(e){typeof e?.prefetch=="function"&&await e.prefetch()}function bn(){return En||(En=Ne().then(()=>{})),En}function io(e){return vn||(vn=Wf(e)),vn}function Kf(){return io(typeof __useblocks__<"u"?__useblocks__:void 0)}function Xf(e){return Promise.all([bn(),io(e)]).then(()=>{})}function Jf(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function ao(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>zf(t?{priority:t}:void 0)).then(()=>(Ht(t?{priority:t}:void 0),n?bn():void 0)).catch(()=>{})}function Qf(e){const t=Jf(e);if(t==="eager")ao(e);else if(t==="idle"){const n=()=>ao(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var lo="PluginRegistry";function Zf(e=a.resolveContainer()){return e.getOrCreateInstance(lo,()=>new Qo)}var co=new Zo(()=>Zf()),ep=a.defineMixin(e=>{let t;function n(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(r){const s=e.getInstance(a.INSTANCE_ID),o=e.getInstance(lo);t||(t=new Jo(s,o,{ensureHostRuntimeReady:Kf}),e.inject(a.PLUGIN_COLLECTION_ID,t));const i=r?.plugins||[];s&&await t.setPlugins(i)},instance:{use(r){return typeof r=="function"?n().useByCtor(r):n().useByKey(r)},useAsync(r){return n().useAsync(r)},waitPlugin(r){return n().waitFor(r)}},dispose(){t?.dispose(),t=void 0}}}),uo=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const s=this._listeners.indexOf(r);s>=0&&this._listeners.splice(s,1)}}}async run(e){const t=[...this._listeners].sort((n,r)=>r.priority-n.priority);for(const{fn:n}of t){const r=await n(e);r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)&&Object.assign(e,r)}return e}},tp=a.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),np=a.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),rp="application_block_inserted",sp=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(np,()=>new uo).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService),s=n?e.bind(n):e;return r.addListener(rp,s,t)}},op=a.createIdentifier$1("ComponentRegistry"),fo;function xe(e,t=op){const n=a.DependencyResolver.getInstance(t);if(n)return n;if(!fo)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return a.DependencyResolver.getOrCreateInstance(t,fo)}var ip=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=this._container.addService(a.ATOMS_HANDLERS_ID,{execute:n=>{t.dispose(),e(n.value.map(r=>({name:r.name,html:r.html})))}})})}update(e,t){const n=this._container,r=xe(n);return n.addService(a.ATOMS_HANDLERS_ID,{execute:s=>{const o=s.value.find(i=>i.name===e);if(o){const{icon:i,title:l,fallbackTooltip:c,...d}=t;i&&(o.icon=r.getReactNode(i)),l&&(o.title=r.getReactNode(l)),c&&(o.fallbackTooltip=r.getReactNode(c)),Object.assign(o,d)}}})}delete(e){this._container.addService(a.ATOMS_HANDLERS_ID,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container,r=xe(n);return n.addService(a.ATOMS_HANDLERS_ID,{execute:s=>{s.value.splice(t??s.value.length,0,{...e,title:r.getReactNode(e.title),icon:r.getReactNode(e.icon),fallbackTooltip:r.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(tp,()=>new uo).add(e,t??0,n)}handleInject(e,t,n){return a.getEmitter$1(this._container,a.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},ap=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}send(e,t,n){this._messageService.send(e,t,n)}sendAsync(e,t,n=!0){return this._messageService.sendAsync(e,t,n)}addListener(e,t,n){return this._messageService.addListener(e,t,n)}addListenerAsync(e,t,n=0){return this._messageService.addListenerAsync(e,t,n)}onInit(e,t=!0,n=0){return this._messageService.onInit(e,t,n)}isInited(){return this._messageService.isInited()}};function lp(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var cp=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=a.getEmitter$1(t,a.MODAL_SHOW_EVENT),this._closeModalEmitter=a.getEmitter$1(t,a.MODAL_CLOSE_EVENT),this._updateModalEmitter=a.getEmitter$1(t,a.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=xe(this._container),n=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,r=e.modalProps;return this._showModalEmitter.fire({...e,content:t.getReactNode(e.content),title:t.getReactNode(e.title),id:n,modalProps:r?{...r,footer:t.getReactNode(r.footer),okText:t.getReactNode(r.okText),cancelText:t.getReactNode(r.cancelText),closeIcon:t.getReactNode(r.closeIcon)}:void 0}),n}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=xe(this._container),r=t.modalProps;this._updateModalEmitter.fire(lp({...t,content:n.getReactNode(t.content),title:n.getReactNode(t.title),id:e,modalProps:r?{...r,footer:n.getReactNode(r.footer),okText:n.getReactNode(r.okText),cancelText:n.getReactNode(r.cancelText),closeIcon:n.getReactNode(r.closeIcon)}:void 0}))}},dp=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{const s=()=>this._loadedDisposable.dispose(),o=()=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&s(),n())},i=l=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&s(),r(l))};this._resolveLoaded=o,this._rejectLoaded=i}),this.ready=new Promise((n,r)=>{const s=()=>this._loadedDisposable.dispose(),o=()=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&s(),n())},i=l=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&s(),r(l))};this._resolveReady=o,this._rejectReady=i})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady()}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},up=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(a.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,s=>{if(s.key===e){if(s.phase==="load"&&s.status==="success"){r.resolveLoaded();return}if(s.phase==="ready"&&s.status==="success"){r.resolveReady();return}if(s.phase==="load"){r.rejectLoad(new Error(s.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(s.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new dp(t,n);return r}registerSandboxCSS(e){return this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(a.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},fp=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function _n(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&fp.has(t)}function po(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}return`nohwcrypto-${Date.now()}`}function yn(){return`__settingsPanel:${po()}`}function Sn(e,t){return{type:e,props:t}}function pp(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!_n(e)}function mo(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(_n(t)){const r=yn();return n(e.add(r,t)),Sn(r,{})}if(typeof t=="function"){const r=yn();return n(e.add(r,t)),Sn(r,{})}if(pp(t)){const r=t.type;if(typeof r=="string")return t;if(_n(r)||typeof r=="function"){const s=yn();return n(e.add(s,r)),Sn(s,t.props)}return t}return t}var mp=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=xe(this._container),n=i=>this._trackRegistration(i),r=mo(t,e.content,n),s=e.advancedTabs?.map(i=>({...i,content:mo(t,i.content,n)})),o=e.instanceKey??po();a.getEmitter$1(this._container,a.SETTINGS_PANEL_EVENT).fire({...e,content:r,advancedTabs:s,instanceKey:o,type:a.ADVANCED_SETTINGS_PANEL})}closeSettingsPanel(){this._clearPanelRegistrations(),a.getEmitter$1(this._container,a.SETTINGS_PANEL_EVENT).fire(null)}},ho={SandboxScriptApi:up,ElementsApi:ip,BlocksApi:sp,MessageService:ap,SettingsPanelApi:mp,ModalApi:cp};function wn(e,t,n,r={}){const s=Object.assign({},e);for(const[o,i]of Object.entries(t))if(i!==void 0)if(n.includes(o)&&typeof i=="object"&&i!==null){const l=s[o],c=r[o]??{};s[o]=Object.assign({},typeof l=="object"&&l!==null?l:c,i)}else s[o]=i;return s}var Z={border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},borderRadiusCards:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},padding:{all:null,top:null,right:null,bottom:null,left:null}},hp={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},In={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:24,fontSizeDim:"px",lineHeight:32,lineHeightDim:"px",color:"#333333",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},go={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},ye={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1C52DC",bold:!1,italic:!1,backgroundColor:"#1C52DC",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:Z.border,borderRadius:Z.borderRadius,textAlign:"center",padding:Z.padding},Eo={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:Z.padding},Tn={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:Z.border,borderRadius:Z.borderRadiusCards};function gp(e){return{...hp,...e}}function Ep(e){return{...In,...e,bold:e?.bold??In.bold,italic:e?.italic??In.italic}}function vp(e){return{...go,...e,underline:e?.underline??go.underline}}function bp(e){return{...ye,...e,bold:e?.bold??ye.bold,italic:e?.italic??ye.italic,border:{...ye.border,...e?.border},borderRadius:{...ye.borderRadius,...e?.borderRadius},padding:{...ye.padding,...e?.padding}}}function _p(e){return{...Eo,...e,padding:{...Eo.padding,...e?.padding}}}function yp(e){return{...Tn,...e,border:{...Tn.border,...e?.border},borderRadius:{...Tn.borderRadius,...e?.borderRadius}}}function An(e={}){return{backgroundColor:e.backgroundColor||"",backgroundImage:(e.backgroundImage||[]).map(t=>({type:"url",value:t?.value||""})),backgroundPositionX:e.backgroundPositionX||"",backgroundPositionY:e.backgroundPositionY||"",backgroundRepeat:e.backgroundRepeat||"",backgroundSize:e.backgroundSize||"",backgroundColorContent:e.backgroundColorContent||"",textStrong:e.textStrong||!1,textItalic:e.textItalic||!1,textUnderline:e.textUnderline||!1,width:e.width,responsive:e.responsive}}function vo(e){let t={...a.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Cn(e){return{text:gp(e.text),headings:Ep(e.headings),links:vp(e.links),buttons:bp(e.buttons),block:_p(e.block),cards:yp(e.cards)}}var bo=a.createIdentifier$1("EmailSettingsPort"),Sp=1e4,_o=class{_editor;_layoutSettingsChanged=new a.Emitter;_contentStylesChanged=new a.Emitter;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(bo);if(!t)throw new Error("[extensions] настройки письма ещё не загружены — работа с UI начинается с init()");return t}_getCurrentLayoutSettings(){return An(this._settings().read())}_getCurrentContentStyles(){const e=Ce(this._editor.container)?.current()?.get().attributes.common_styles;return Cn(vo(e))}_getLayoutSnapshot(e){return JSON.stringify(e)}_getContentSnapshot(e){return JSON.stringify(e)}async _ensureMessageSubscription(){if(!this._messageSubscription){if(this._messageSubscriptionPromise)return this._messageSubscriptionPromise;this._messageSubscriptionPromise=(async()=>{if(await this._editor.container.getInstanceAsync(bo),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(a.MESSAGE_SERVICE_ID,()=>new a.MessageService),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const s=r?.data,o=s?.operation;if(o===a.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=An(s?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(o!==a.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=Cn(r.data?.settings?.commonStyles??{...a.COMMON_STYLES}),l=this._getContentSnapshot(i);l!==this._prevContentSnapshot&&(this._prevContentSnapshot=l,this._contentStylesChanged.fire(i))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=An(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Sp){const t=Ce(this._editor.container)?.current()?.get().attributes.is_inited,n=this._settings().read();if(t&&n&&Object.keys(n).length>0&&(n.backgroundColor||n.backgroundImage?.[0]?.value||n.width?.value||n.responsive!==void 0)||t)return;const r=this._editor.container,s=a.getEvent(r,a.events.ON_EMAIL_INIT_ID);return new Promise(o=>{let i=!1,l;const c=()=>{l&&(clearTimeout(l),l=void 0)},d=s(()=>{i||(i=!0,c(),d.dispose(),o())});l=setTimeout(()=>{i||(i=!0,d.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Ce(this._editor.container)?.current();if(!t)return;const n=vo(t.get().attributes.common_styles);e.text!==void 0&&(n.text={...n.text||{},...e.text}),e.headings!==void 0&&(n.headings={...n.headings||{},...e.headings}),e.links!==void 0&&(n.links={...n.links||{},...e.links}),e.buttons!==void 0&&(n.buttons=wn(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:Z.border,borderRadius:Z.borderRadius,padding:Z.padding})),e.block!==void 0&&(n.block=wn(n.block||{},e.block,["padding"],{padding:Z.padding})),e.cards!==void 0&&(n.cards=wn(n.cards||{},e.cards,["border","borderRadius"],{border:Z.border,borderRadius:Z.borderRadiusCards}));const r=JSON.stringify(n);We(t,{common_styles:r}),this._settings().markAppearanceChanged();const s=Cn(n);this._prevContentSnapshot=this._getContentSnapshot(s),this._contentStylesChanged.fire(s)}},wp={...ho,EmailSettingsApi:_o},Ip={...ho},Ch={...Ip,EmailSettingsApi:_o},Tp={...wp};function Ap(){co.addAll(Tp)}var Cp=[a.defineMixin(()=>{Ap()}),Vf,Yf,Gf,a.JWTMixin,jf,a.OAuthMixin];async function Dp(){return(await Ne()).asyncMixins}var Pp=ep,Rp=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let s;try{s=await Dp()}catch(i){throw e.failPendingWaits(i),i}t=s(e);const o=await e.getInstanceAsync(a.INSTANCE_ID);Object.assign(o,t.instance||{});for(const i of e.getInstance(a.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Op=a.combineMixins([...Cp]);function Dn(){let e,t=!1;const n=new Map,r=new Map;function s(){for(const o of r.values())o();r.clear()}return{event(o,i,l){const c=Symbol("subscription");return t||(n.set(c,{listener:o,priority:i,thisArg:l}),e&&r.set(c,e(o,i,l))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(o){s(),e=o;for(const[i,{listener:l,priority:c,thisArg:d}]of n)r.set(i,o(l,c,d))},dispose(){t=!0,s(),n.clear(),e=void 0}}}function Lp(e){const t=Dn(),n=Dn(),r=Dn();return e.getInstance(a.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(un).then(s=>{t.attach(s.onNotify),n.attach(s.onError),r.attach(s.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(s){const o=e.getInstance(un);if(!o)throw new Error("[plugin] notify() вызван до загрузки редактора");o.notify(s)}}}var Mp=[Dd,Pf,Lp];function Np(e,t=Mp){const n=mn(e);kf(e);const r=Op(e),s=Pp(e),o=Rp(e),i={...r.instance,...s.instance,...o.instance};for(const c of t)Object.assign(i,c(e));let l=!0;return{instance:i,async setOptions(c){await r.setOptions(c);const d=l&&n.get()===c;l=!1,d||n.set(c),await s.setOptions(c),await o.setOptions(c)}}}var xp=class{_storage=Object.create(null);get(e){const t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:""}set(e,t,n){this._storage[e]={value:t,expires:n.expires?n.expires*1e3+Date.now():void 0}}remove(e){delete this._storage[e]}},kp="editor-runtime.react.copies",Pn=8;function ke(e){return e&&typeof e=="object"?e:void 0}function yo(e){const t=ke(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=ke(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function Fp(e){const t=ke(e),n=t&&typeof t.version=="string"?t.version:void 0,r=ke(t?.default),s=r&&typeof r.version=="string"?r.version:void 0;return n??s??"unknown"}function Bp(e,t,n){return e.package===t&&e.version===n}function jp({ourReact:e,entries:t,packageName:n,version:r}){const s=yo(e);if(!s||!Array.isArray(t))return[];const o=[],i=new Set;for(const l of t){const c=ke(l);if(!c||!Bp(c,n,r))continue;const d=yo(c.react);!d||d===s||i.has(d)||(i.add(d),o.push({package:n,version:r,reactVersion:Fp(c.react),react:c.react}))}return o}function Up({packageName:e,copies:t}){const n=[`[${e}] A second copy of React is on this page (singleton invariant broken).`,`The editor runs on its own React, the plugin got another one from ${e}/runtime/react.`,`This shows up as "Cannot read properties of null (reading 'useState')" and takes down the whole`,"editor, not just the plugin panel: plugin components render inside the editor tree.","","Found:"];for(const r of t.slice(0,Pn))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Pn&&n.push(` …and ${t.length-Pn} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
|
|
2129
|
-
`)}var
|
|
2152
|
+
`)}function ci(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Th(e,t,n,r){const s=Ch(e,t,n,r);return s===void 0}function Ch(e,t,n,r){const{email:s}=Nt(t,!1),o=Be(s,e),i=o.id;if(i===void 0)return"no-id";if(r!==void 0&&r!==i)return"other-id-shown";const a=yn(e)?.current();if(!a)return"no-session";const c=a.get(),d=c.attributes;if(c.serverId!==i)return"document-id";if(d.is_inited!==!0)return"not-inited";const u=ci(Zn(n??a.getContent()));if(o.html!==void 0&&ci(Zn(o.html))!==u)return"html";if(o.subject!==void 0&&o.subject!==d.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==d.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==d.common_styles)return"common_styles"}function di(e,t){const{email:n}=Nt(t,!1),r=Be(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Zn(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Ah(e,t){const n={...e};return delete n.id,{...n,...t}}function Dh(e){return e.html?e:{...e,html:si}}function st({code:e,project:t,...n},r,s){const o=s??Wn(r);return{...n,...e?{html:we(r).toEditorForm(e)}:{},renderGuid:l.generateUUID(),...o===void 0?{}:{project:o}}}function ot({html:e,renderGuid:t,...n},r){const{requested:s}=tt(r);return ge({...n,code:we(r).toOutputForm(e),project:s===void 0?n.project:s,guid:void 0,link:void 0,status:void 0,slug:void 0,password:void 0,comment_status:void 0,template:void 0,blocktags:void 0,project_title:void 0,ping_status:void 0,lock:void 0,tag:void 0,is_template:void 0})}function ui(e){return yn(e)?.current()?.get().serverId??void 0}function er(e,t,n){return n===void 0&&(n=e.post===void 0?ui(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function it(e,t){return ge({...e,link:void 0,comment_status:void 0})}function Ft({code:e,autosave:t,...n},r,s){return s===void 0&&(s=n.parent===void 0?ui(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||ec(n.slug),parent:s}}function tr({html:e,isAutosave:t,...n},r){return ge({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:ge({html:e,ampHtml:e&&""})})}var je=l.createIdentifier$1("NotificationService"),Ph=l.createIdentifier$1("emailTemplate.reads");async function Rh(e,t){try{return await Se(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Mh(e,t,n);return}}var Oh=l.createIdentifier$1("emailTemplate.notifiedFailures");function Mh(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Oh,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Lh(e,t){const n=e.getOrCreateInstance(Ph,()=>new Map),r=n.get(t);if(r!==void 0)return r;const s=Rh(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,s),s}var Nh="EXTERNAL",fi=Symbol("supersededShow");function xh(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var kh="email_id",Fh=class extends l.Disposable{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=l.createQueue();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=rt(t),this._eventLock=yh(t);const n=X(e,l.events.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(l.REQUEST_HANDLER_ID,{execute:(r,s)=>{!s?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(kh,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(l.INIT_PIPELINE_ID)??Pn}_throwIfDestroyed(){if(this.isDisposed())throw me()}async getTemplateEmail(e){const t=await Lh(this._container,String(e));if(!t)return;const n={...t,lock:!1,parent_email:String(e)};return delete n.id,n}async setBlocks(e=[]){const{cache:t}=this._dataSources.blocks,n=await kt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,st(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,Ft(s,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(s=>s.id!==void 0).map(s=>[s.id,er(s,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,s){const o=this._dataSources.emails,i=o.cache,a=await kt(this._container),c=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let d=Be(e,this._container);const u=d.id;let f=u;if(u!==void 0){const g=await o.get(u);d={...g??{},...d,utm_parameters:d.utm_parameters??g?.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a}}else{f=n??l.generateUUID();const g=await o.get(f);d={...d,utm_parameters:d.utm_parameters??{},renderGuid:g?.renderGuid??l.generateUUID(),...c>0?{showToken:c}:{},...s?{showId:s}:{},project:a},delete d.project}if(t){const g=await this.getTemplateEmail(String(t));g&&(d=Ah(g,d))}return u===void 0&&(d=Dh(d)),await i.setAll([[f,d]]),d}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==di(this._container,e))return!1;const n=xt(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=di(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:xt(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&Ih({ticket:t,emailId:li(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,fi;if(!e)return;const n=this._getInitPipeline();l.throwIfAborted(n.signal);const r=wh(e);if(!r&&Th(this._container,e,xt(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const s=Nt(e);s.email.id,this._prevCommand?.id;let o,i="",a=0,c=!1,d,u=Promise.resolve(),f,g=!1;try{this._eventLock.suspendChange();const{email:E,blocks:S,autosaves:b,comments:h,templateId:y,reload:w}=s;o=E.id;const A=Be(E,this._container),D=A.id,N=D??l.generateUUID(),m=await qe("getProject",kt(this._container));l.throwIfAborted(n.signal),i=l.generateUUID();const _={isNew:D===void 0,id:String(N),project:m},C=w===!0&&D!==void 0;C&&(await this._dataSources.emails.remove(String(D),{silent:!0}),String(D)),a=++this._showToken,String(N);const M=[];M.push(this.setBlocks(S)),E.id!==void 0&&(M.push(this.setComments(h)),M.push(this.setEmailRevisions(b,String(E.id)))),M.push(this.setEmail(E,Number(y),D===void 0?String(N):void 0,a,i)),await qe("setEmail+blocks+revisions",Promise.all(M),{emailId:D??String(N),showId:i,targetShowToken:a}),l.throwIfAborted(n.signal);const p=await this._dataSources.emails.get(String(N)),v=Ee(this._container),T={id:i,token:a};D===void 0?f=v.startNewDraft(p??A,{patch:A,show:T}):C?f=v.reload(D,{email:p??A,patch:A,show:T}):v.sessionKey()===Le(D)?f=v.show(A,T):f=v.open(D,{email:p??A,patch:A,show:T});const L=!!this._prevCommand&&l.deepEqual(this._prevCommand,_);_.id,!this._prevCommand||l.deepEqual(this._prevCommand,_),this._prevCommand?.id,this._rememberShow(_),u=n.requestShow({showId:i,navId:String(N),emailId:D,isNew:D===void 0}),g=!0,String(N),c=!0}catch(E){d=E,g&&i&&n.failShow(i,E),l.isAbortError(E)||(ts(E),void 0)}finally{this._eventLock.resumeChange()}if(!c)throw d instanceof Error?d:new Error(`[useblocks] show() setup failed: ${String(d??"unknown error")}`);return qe("show-init-deferred",Promise.all([u,f?.whenReady().catch(E=>{if(E instanceof Ge){const S=gn(E);throw S?new Error(`[useblocks] show(): email open failed (${S})`,{cause:E}):E}})??Promise.resolve()]).then(()=>{}),{showId:i,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();l.throwIfAborted(e.signal);const t=Ee(this._container),n=await t.save("publish",{source:Nh,fallbackTitle:Us(this._container)});if(l.throwIfAborted(e.signal),!n)throw xh(t.saveState().error);return oe(ai(this._container,this._currentEmail),this._container)}_queuedShow=this._queue.decorate((e,t)=>this._show(e,t),this);show=e=>{const t=this._showRequests+=1;this._latestShowEmailId=li(e);const n=this._queuedShow(e,t).then(r=>r===fi?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};save=this._queue.decorate(this._save,this)};function Bh(e){return String(e).replace(/"/g,""")}function jh(e=new Date){const t=n=>String(n).padStart(2,"0");return String(e.getFullYear())+t(e.getMonth()+1)+t(e.getDate())+t(e.getHours())+t(e.getMinutes())+t(e.getSeconds())}function Uh(e){const t=/<(table|tr|div)(\s[^>]*)>/gi;let n;for(;(n=t.exec(e))!==null;){const r=n[2]??"";if(/\bem\s*=\s*["']block["']/i.test(r))return{full:n[0],index:n.index}}return null}function pi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),s=Bh(n);return r.test(e)?e.replace(r,`${t}="${s}"`):e.replace(/>$/,` ${t}="${s}">`)}function Hh(e,t,n){if(!e?.trim()||!t)return e;const r=Uh(e);if(!r)return e;const s=String(t),o=jh(n??new Date);let{full:i,index:a}=r;const c=i.length;return/\bem-block-id\s*=/.test(i)||(i=pi(i,"em-block-id",s)),i=pi(i,"em-block-version",o),e.slice(0,a)+i+e.slice(a+c)}function $h(e){if(e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object")return e.meta;const t=e.catalogExtra?.meta;if(t!=null&&typeof t=="object")return t}function Vh(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),s=t?.project??(e.project!==void 0&&e.project!==null?String(e.project):void 0);return{type:t?.type??n,insertFrom:n,name:t?.name??e.name,blockId:r,project:s,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:$h(e)}}function nr(e,t){return t?Vh(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var hi=["title","slug","type","tags","blocktags","modified","author","lock","subject","description","excerpt","status","is_template","link","renderGuid","date","date_gmt","modified_gmt","comment_status","ping_status","template","related_email","project_title","project_author","isAmp","meta"],Gh=[...hi,"html","id","project","password"],f_=new Set(["html",...hi,"global_block","project"]);function Yh(e){if(!e||typeof e!="object")return{};const t={};e.id!=null&&e.id!==""&&(t.id=String(e.id)),e.title!=null&&e.title!==""&&(t.title=e.title),e.slug!=null&&e.slug!==""&&(t.slug=e.slug),e.type!=null&&e.type!==""&&(t.type=e.type),e.tags!=null&&(t.tags=e.tags),e.blocktags!=null&&(t.blocktags=e.blocktags),e.modified!=null&&e.modified!==""&&(t.modified=e.modified),e.author!=null&&e.author!==""&&(t.author=String(e.author)),e.lock!=null&&(t.lock=e.lock),e.subject!=null&&e.subject!==""&&(t.subject=e.subject),e.description!=null&&e.description!==""&&(t.description=e.description),e.excerpt!=null&&e.excerpt!==""&&(t.excerpt=e.excerpt),e.status!=null&&e.status!==""&&(t.status=e.status),e.is_template!=null&&(t.is_template=e.is_template),e.link!=null&&e.link!==""&&(t.link=e.link),e.renderGuid!=null&&e.renderGuid!==""&&(t.renderGuid=e.renderGuid),e.date!=null&&e.date!==""&&(t.date=e.date),e.date_gmt!=null&&e.date_gmt!==""&&(t.date_gmt=e.date_gmt),e.modified_gmt!=null&&e.modified_gmt!==""&&(t.modified_gmt=e.modified_gmt),e.comment_status!=null&&e.comment_status!==""&&(t.comment_status=e.comment_status),e.ping_status!=null&&e.ping_status!==""&&(t.ping_status=e.ping_status),e.template!=null&&e.template!==""&&(t.template=e.template),e.related_email!=null&&e.related_email!==""&&(t.related_email=e.related_email),e.project_title!=null&&e.project_title!==""&&(t.project_title=e.project_title),e.project_author!=null&&e.project_author!==""&&(t.project_author=e.project_author),e.isAmp!=null&&(t.isAmp=e.isAmp),e.meta!==void 0&&e.meta!==null&&typeof e.meta=="object"&&(t.meta=e.meta);const n=new Set(Gh),r={};for(const s of Object.keys(e))n.has(s)||(r[s]=e[s]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function Wh(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...Yh(e),html:typeof e.html=="string"?e.html:"",insertFrom:t.type,name:t.name,project:t.project??e.project,id:e.id!=null&&e.id!==""?String(e.id):t.blockId}}var rr=new WeakMap;function qh(e){let t=rr.get(e);return t||(t={byId:new Map,fallback:[]},rr.set(e,t)),t}function zh(e){rr.delete(e)}function Kh(e,t){const{byId:n,fallback:r}=qh(t);if(e.blockId){const s=n.get(e.blockId);if(s){n.delete(e.blockId);const o=r.indexOf(s);return o>=0&&r.splice(o,1),s}return}for(let s=r.length-1;s>=0;s--){const o=r[s],i=e.name!=null&&e.name!==""&&o.name!=null&&o.name!==""&&o.name===e.name,a=e.type!=null&&e.type!==""&&o.insertFrom===e.type;if(i&&a)return r.splice(s,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function Xh(e,t){const{blocks:n}=rt(e);return await n.cache.getIfPresent(t)??void 0}async function Jh(e,t){if(!t.blockId)return;const n=await Xh(e,t.blockId);if(n)return Wh(n,t)}async function Qh(e,t){const n=Kh(e,t);if(n)return nr(e,n);const r=await Jh(t,e);return r?nr(e,r):nr(e,void 0)}var Zh=l.createIdentifier("application_block_inserted"),em=-1e3,mi=new WeakSet;function tm(e){if(e===null||typeof e!="object")return!1;const t=e;return typeof t.type=="string"||typeof t.name=="string"||typeof t.blockId=="string"||typeof t.project=="string"||typeof t.project=="number"}function nm(e){if(!e||mi.has(e))return;mi.add(e);const t=new l.Disposable,n=Z(e);return t.addDisposable(n.addListenerAsyncPipe(Zh,async(r,s)=>{const o=tm(r)?await Qh(r,e):r;return s?s(o):o},em)),t.addDisposable({dispose:()=>{zh(e)}}),t}var gi=l.createIdentifier$1("plugin.earlyWindow");function rm(e){return e.getOrCreateInstance(gi,()=>({depth:0}))}function sm(e){const t=rm(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function Ei(e){return(e?.getInstance(gi)?.depth??0)>0}function vi(e,t){let n,r=!1;return e(s=>{n=s,r=!0}),(s,o,i)=>{const a=e(s,o,i);if(r&&Ei(t)){const c=n;queueMicrotask(()=>{s.call(i,c)})}return a}}var _i=100,om=class extends l.Disposable{_container;_events;constructor(e){super(),this._container=e;const t=nm(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:s}=rt(e),o=X(e,l.events.ON_SHARE_ID),i=X(e,l.events.ON_SHOW_PREVIEW_ID),a=X(e,l.events.ON_EMAIL_CLONE_ID),c=X(e,l.events.ON_CODE_VALIDATE_ID),d=X(e,l.events.ON_SUBJECT_CHANGED_ID),u=X(e,l.events.ON_EMAIL_CHANGED_ID),f=X(e,l.events.ON_PREHEADER_CHANGED_ID),g=X(e,l.events.ON_SAVEBUTTON_CLICK_ID),E=X(e,l.events.ON_NEXTBUTTON_CLICK_ID),S=X(e,l.events.ON_SEND_LIVEPREVIEW_ID),b=X(e,l.events.ON_SEND_TESTEMAIL_ID),h=X(e,Eh),y=X(e,l.events.ON_CONTENT_CHANGED_ID),w=X(e,gh),A=X(e,l.events.ON_PREVIOUSBUTTON_CLICK_ID),D=X(e,l.events.ON_SEND_EMAIL_MODAL_ID),N=l.filter(X(e,l.events.ON_EMAIL_INIT_ID),m=>!m.reset);return{handlePreheaderChanged:B(f),handleSubjectChanged:B(d),handleValidate:B(c),handleReadEmail:B(n.handlerRead,m=>m,m=>m&&Be(m,e)),handleSaveEmail:B(n.onSave,function({prev:m,patch:_,value:C,source:M}){const p=m?oe(m,e):void 0;return{prev:p,patch:Ze(p,oe(_,e)),value:oe(C,e),source:M}},m=>m?Be(m,e):void 0),handleRemoveEmail:B(n.onRemove,({value:m,source:_})=>({value:oe(m,e),source:_}),()=>{}),handleReadCommonBlocks:B(h,m=>m.project,m=>m?.map(_=>st(_,e))),handleReadTemplateBlocks:B(w,m=>m,m=>m?.map(_=>st(_,e))),handleReadBlocks:B(t.byForeignKey("project").handleRead,m=>tt(e).requested||String(m),m=>m?.map(_=>st(_,e))),handleSaveBlock:B(t.onSave,function({prev:m,patch:_,value:C,source:M}){const p=C.global_block===!0&&C.id&&typeof C.html=="string"?{...C,html:Hh(C.html,String(C.id))}:C,v=m?ot(m,e):void 0;return{prev:v,patch:Ze(v,ot(_,e)),value:ot(p,e),source:M}},m=>m?st(m,e):void 0),handleRemoveBlock:B(t.onRemove,({value:m,source:_})=>({value:ot(m,e),source:_}),()=>{}),handleReadComments:B(r.byForeignKey("post").handleRead,m=>m,m=>m?.map(_=>er(_,e))),handleSaveComment:B(r.onSave,function({prev:m,patch:_,value:C,source:M}){const p=m?it(m,e):void 0;return{prev:p,patch:Ze(p,it(_,e)),value:it(C,e),source:M}},m=>m?er(m,e):void 0),handleRemoveComment:B(r.onRemove,({value:m,source:_})=>({value:it(m,e),source:_}),()=>{}),handleReadEmailRevisions:B(s.byForeignKey("parent").handleRead,m=>m,m=>m?.map(_=>Ft(_,e))),handleReadEmailAutosave:B(X(e,Go),m=>m,m=>m?Ft(m,e):null),handleEmailAutosave:B(s.onSave,function({prev:m,patch:_,value:C,source:M}){return{value:tr(C,e),source:M}},m=>m?Ft(m,e):void 0),handleRemoveEmailAutoSave:B(s.onRemove,({value:m,source:_})=>({value:tr(m,e),source:_}),()=>{}),handleEmailChanged:B(l.debounce(u,_i),m=>oe(m,e)),handleEmailInit:vi(B(N,m=>oe(m,e)),e),handlePreviousButtonClick:B(A,m=>oe(m,e)),handleNextButtonClick:B(E,m=>oe(m,e)),handleSaveButtonClick:B(g,m=>oe(m,e)),handleHtmlChanged:B(l.debounce(y,_i)),handleTestEmailSend:B(b,({html:m,..._})=>({..._,code:m,compiled:{html:m,ampHtml:""}})),handleTestEmailModal:B(D,m=>oe(m,e)),handleCloneEmail:B(a,m=>oe(m,e)),handleShareEmail:B(o),handlePreviewEmail:B(i),handleLivePreviewEmail:B(S)}}get(){return this._events||(this._events=this._get())}_listenersUpdaters;setOptions(e={}){const t=this.get();let n=this._listenersUpdaters;if(!n){n=this._listenersUpdaters={};for(const r of Object.keys(t))n[r]=this.addDisposable(new Fe(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},im=l.createIdentifier$1("DataController"),am=l.createIdentifier$1("DataEvents");function bi(e){return e.getOrCreateInstance(im,()=>{const t=new Fh(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function yi(e){return e.getOrCreateInstance(am,()=>new om(e))}var lm=l.createIdentifier$1("plugin.pluginStart");function Si(e){return e.getOrCreateInstance(lm,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>t()),{done:n,finish:t}})}function cm(e){return Si(e).done}function dm(e){const t=Si(e);return t.run===void 0&&(t.run=(e.getInstance(l.PLUGIN_COLLECTION_ID)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var um=l.createIdentifier$1("plugin.startupShow");function fm(e){const t=bi(e),n=yi(e),r=e.getInstance(l.OPTIONS_SOURCE_ID),s=e.getInstance(l.DISPOSABLE_ID),o={current:Promise.resolve()};e.inject(um,o);let i=!1;const a=r?.watch(d=>{d&&n.setOptions(d),i=(d?.plugins?.length??0)>0,o.current=o.current.catch(()=>{})}),c=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;const u=()=>(W(te.showStart),t.show(d).finally(()=>W(te.showEnd))),f=i?cm(e).then(u):u();f.catch(()=>{}),o.current=f});a&&s?.addDisposable(a),c&&s?.addDisposable(c)}function pm(e){const t=bi(e);return{...yi(e).get(),show(n){return W(te.showStart),t.show(n).finally(()=>W(te.showEnd))},save(){return t.save()}}}function Ii(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function Bt(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",s=!1;for(let o=t;o<e.length;o++){const i=e[o];if(s){s=!1;continue}if(i==="\\"){s=!0;continue}if(r){i===r&&(r="");continue}if(i==='"'||i==="'"){r=i;continue}if(i==="("){n++;continue}if(i===")"&&(n--,n<0))return!1}return n===0}function hm(e){return(t,n,r)=>Bt(t)?e(t,n,r):!1}function mm(e){return t=>Bt(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function gm(e){return(t,n,r)=>Bt(t)?Ii(t)?e(t,n,r):t:!1}function Em(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return Bt(n)?Ii(n)?e(t):t:!1}}function vm(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function sr(e,t){const n=e.length;for(let r=0;r<n;r++){const s=e.charCodeAt(r);if(s===0||t==='"'&&s===34||t==="'"&&s===39||t===""&&(s===32||s===9||s===10||s===13||s===12||s===34||s===39||s===60||s===62||s===61||s===96))return!1}return!0}function _m(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let s="";for(let o=0;o<e;o++){const i=r[o]%62;s+=t.charAt(i)}return s}var bm=8,ym=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=_m(bm),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},jt=new ym;function wi(e,t){return t!==void 0&&!sr(e,t)?`%|{${jt.getOrCreateByKey(e)}}|%`:e}function Sm(e){const t=jt.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function q(e,t,n){return t!==void 0?sr(e,t)?e:`%|{${jt.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function Im(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function Y(e){return e.startsWith("<!--")&&e.endsWith("-->")?Im(e.slice(4,-3)):e}function wm(e){const t=/^(IF|ELSE|ELSIF|ELSEIF|END|FOREACH|WHILE|NEXT|LAST|BREAK|DO|UNLESS|CONTINUE|SET|UNSET|DEFINE|INCLUDE)\b/i,n=/\w+\s*\(/;let r=e;const s=e.match(/\[%\s*([^%]*?)\s*%\]/);s&&(r=s[1]);const o=r.trim();return t.test(o)||n.test(o)}function Tm(e,t,n){return t!==void 0?sr(e,t)?e:`%|{${jt.getOrCreateByKey(e)}}|%`:n||vm(e)||wm(e)?`<!--${e}-->`:e}var Ae=hm(q),De=mm(Y),Cm=gm(q),Am=Em(Y),Ti=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",Sm),e.escape("@{","}",q,!0).unescape("<!--@{","}-->",Y,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",wi,!0),e.escape("{{","}}",wi,!0),e.createSyntax("brace-percent").escape("{%","%}",q).unescape("<!--{%","%}-->",Y),e.createSyntax("brace-hash").escape("{#","#}",q).unescape("<!--{#","#}-->",Y),e.createSyntax("proscript").escape("[%","%]",Tm,!0).unescape("<!--[%","%]-->",Y,!0),e.createSyntax("getresponse").escape("[[IF","]]",q).escape("[[if","]]",q).escape("[[ELSE]]","",q).escape("[[else]]","",q).escape("[[ENDIF]]","",q).escape("[[endif]]","",q).unescape("<!--[[IF","]]-->",Y).unescape("<!--[[if","]]-->",Y).unescape("<!--[[ELSE]]","-->",Y).unescape("<!--[[else]]","-->",Y).unescape("<!--[[ENDIF]]","-->",Y).unescape("<!--[[endif]]","-->",Y),e.createSyntax("expert-sender").escape("<if",">",q).escape("</if",">",q).escape("<else",">",q).escape("</else",">",q).escape("<var ",">",q,!0).unescape("<!--<if ",">-->",Y).unescape("<!--</if",">-->",Y).unescape("<!--<else ",">-->",Y).unescape("<!--</else",">-->",Y).unescape("<!--<var",">-->",Y,!0),e.createSyntax("velocity").escape("#if",")",Ae).escape("#elseif",")",Ae).escape("#else","",q).escape("#foreach",")",Ae).escape("#macro",")",Ae).escape("#set",")",Cm,!0).escape("#parse",")",Ae).escape("#include",")",Ae).escape("#evaluate",")",Ae).escape("#end","",q).escape("#break","",q).escape("#stop","",q).unescape("<!--#macro","-->",De).unescape("<!--#if","-->",De).unescape("<!--#elseif","-->",De).unescape("<!--#else","-->",Y).unescape("<!--#foreach","-->",De).unescape("<!--#parse","-->",De).unescape("<!--#include","-->",De).unescape("<!--#evaluate","-->",De).unescape("<!--#end","-->",Y).unescape("<!--#break","-->",Y).unescape("<!--#stop","-->",Y).unescape("<!--#set","-->",Am,!0),e.createSyntax("mailchimp").escape("*|","|*",q).unescape("<!--*|","|*-->",Y)},or="bare",Dm=new Map;function Pm(e){return e?Dm.get(e)??or:or}var Ci=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function Ai(e){return Ci.includes(e)}function at(e){return e==="bare"||e==="html-comment"}function ir(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Rm(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!at(e))return t(`templateDirectives: unknown form "${String(e)}", falling back to the default ("bare").`),n;r={output:e}}else if(typeof e=="object"&&!Array.isArray(e))r=e;else return t(`templateDirectives: expected a string or an object, got ${typeof e}. Ignored.`),n;for(const[d,u]of[["output",r.output],["editor",r.editor]])if(u!==void 0&&!at(u))return t(`templateDirectives.${d}: unknown form "${String(u)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!ir(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[d,u]of Object.entries(r.syntaxes))if(!(!Ai(d)||u===void 0||at(u))){if(!ir(u))return t(`templateDirectives.syntaxes.${d}: expected a form or an object, configuration ignored.`),n;for(const f of["output","editor"]){const g=u[f];if(g!==void 0&&!at(g))return t(`templateDirectives.syntaxes.${d}.${f}: unknown form "${String(g)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const s=r.output??or;let o=r.editor;s==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const i=[];if(r.syntaxes)for(const d of Object.keys(r.syntaxes)){if(!Ai(d)){t(`templateDirectives.syntaxes: unknown syntax id "${d}", entry ignored.`);continue}i.push(d)}else i.push(...Ci);const a={},c={};for(const d of i){const u=r.syntaxes?.[d],f=ir(u)?u:void 0,g=(at(u)?u:f?.output)??s;let E=f?.editor??o??g;g==="bare"&&E==="html-comment"&&(t(`templateDirectives.syntaxes.${d}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),E="bare"),a[d]=g,c[d]=E}return{output:a,editor:c}}function Di(e,t,n,r){for(let s=t;s<n;s++){const o=e[s];r.insideAttributeValue?r.attributeQuoteChar==='"'||r.attributeQuoteChar==="'"?o===r.attributeQuoteChar&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0):r.unquotedAttr&&/[\s>]/.test(o)&&(r.insideAttributeValue=!1,r.attributeQuoteChar=void 0,r.unquotedAttr=!1):o==="<"?r.insideTag=!0:o===">"?r.insideTag=!1:r.insideTag&&(o==='"'||o==="'")?(r.insideAttributeValue=!0,r.attributeQuoteChar=o,r.unquotedAttr=!1):r.insideTag&&/\S/.test(o)&&r.attributeQuoteChar===void 0&&e[s-1]==="="&&!['"',"'","`"].includes(o)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function lt(e,t){return e.start<t.end&&t.start<e.end}function Pi(e,t,n,r,s=[]){if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return[];const o=t.flatMap(u=>u.match(e).flatMap(f=>!Number.isInteger(f.start)||!Number.isInteger(f.end)||f.start<0||f.end>e.length||f.start>=f.end?[]:[{range:f,mapFn:u.mapFn,overrideBuiltins:u.overrideBuiltins,syntax:u.syntax,isVariable:u.isVariable}])).sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end),i=[],a=s.slice().sort((u,f)=>u.start-f.start),c={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let d=0;for(const{range:u,mapFn:f,overrideBuiltins:g,syntax:E,isVariable:S}of o){if(r?(c.insideAttributeValue=!0,c.attributeQuoteChar='"'):Di(e,d,u.start,c),d=u.end,a.some(w=>lt(w,u)))continue;const b=c.insideAttributeValue?c.attributeQuoteChar??"":void 0,h=e.substring(u.start,u.end),y=f(h,b,c.insideTag);y!==!1&&y!==h&&(i.push({range:u,text:y,overrideBuiltins:g,syntax:E,isVariable:S}),a.push(u))}return i.sort((u,f)=>u.range.start-f.range.start||u.range.end-f.range.end)}function Om(e,t){const n=t.reduce((a,{mapFn:c,start:d,end:u,syntax:f,isVariable:g})=>(a[d]||(a[d]=[]),a[d].push({value:u,mapFn:c,syntax:f,isVariable:g}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),s=new RegExp(r,"g"),o=[];let i;for(;(i=s.exec(e))!==null;){const a=i[0];o.push({start:i.index,startToken:a,endTokens:n[a]})}return o}function ar(e,t,n,r,s=!1){const o=[];if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return o;const i=Om(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let c=0;for(let d=0;d<i.length;d++){const{start:u,startToken:f,endTokens:g}=i[d];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):Di(e,c,u,a),c=u;const E=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let S=!1;for(const{mapFn:b,value:h,syntax:y,isVariable:w}of g){let A=u+f.length,D=e.indexOf(h,A);for(;D!==-1;){let N=D,m=u+f.length,_=0;for(;N!==-1;){const T=e.indexOf(f,m);if(T!==-1&&T<N)_++,m=T+f.length,N=e.indexOf(h,m);else if(_>0)_--,m=N+h.length,N=e.indexOf(h,m);else break}if(N<0)break;const C=N+h.length,M=e.substring(u,C),p=b(M,E,a.insideTag);if(p===!1){A=D+Math.max(h.length,1),D=e.indexOf(h,A);continue}(s||p!==M)&&o.push({range:{start:u,end:C},text:s?M:p,syntax:y,isVariable:w});const v=i.findIndex(({start:T})=>T>=C);v>d?d=v-1:d=i.length,S=!0;break}if(S)break}}return o}function Ut(e,t){if(!t.length)return e;const n=t.slice().sort((s,o)=>o.range.start-s.range.start);let r=e;for(const{text:s,range:o}of n)r=r.slice(0,o.start)+s+r.slice(o.end);return r}var Mm=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=Ti){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,s,o,i){return t.push({start:r,end:s,mapFn:o,isVariable:i,syntax:this.syntax||r}),this},unescape(r,s,o,i){return n.push({start:r,end:s,mapFn:o,isVariable:i,syntax:this.syntax||r}),this}})}registerMatcherPair(e){const t=e.syntax||"matcher",n={syntax:t,match:e.escape.match,mapFn:e.escape.mapFn,isVariable:e.escape.isVariable,overrideBuiltins:e.escape.overrideBuiltins},r={syntax:t,match:e.unescape.match,mapFn:e.unescape.mapFn,isVariable:e.unescape.isVariable,overrideBuiltins:e.unescape.overrideBuiltins};this._escapeMatchers.push(n),this._unescapeMatchers.push(r);let s=!1;const o={dispose:()=>{s||(s=!0,this._escapeMatchers=this._escapeMatchers.filter(i=>i!==n),this._unescapeMatchers=this._unescapeMatchers.filter(i=>i!==r))}};return this.addDisposable(o),o}_collectMappings(e,t,n){const r=ar(e,this._escapes,t,n),s=Pi(e,this._escapeMatchers,t,n),o=s.filter(c=>c.overrideBuiltins).map(c=>c.range),i=r.filter(c=>!o.some(d=>lt(d,c.range))),a=s.filter(c=>c.overrideBuiltins||!i.some(d=>lt(c.range,d.range)));return[...i,...a].sort((c,d)=>c.range.start-d.range.start||c.range.end-d.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=ar(e,this._unescapes,t),r=Pi(e,this._unescapeMatchers,t,!1),s=r.filter(a=>a.overrideBuiltins).map(a=>a.range),o=n.filter(a=>!s.some(c=>lt(c,a.range))),i=r.filter(a=>a.overrideBuiltins||!o.some(c=>lt(a.range,c.range)));return[...o,...i].sort((a,c)=>a.range.start-c.range.start||a.range.end-c.range.end)}getRevertMappings(e,t,n){const r=n?s=>s!==void 0&&n.has(s):s=>Pm(s)==="html-comment";return this._collectRevertMappings(e,t).filter(s=>s.isVariable||!r(s.syntax))}getDetectedMappings(e,t,n){return ar(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Ut(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Ut(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=o=>o===void 0?void 0:t[o],r=Object.values(t);let s=e;return r.includes("bare")&&(s=Ut(s,this._collectRevertMappings(s).filter(o=>n(o.syntax)==="bare"))),r.includes("html-comment")&&(s=Ut(s,this._collectMappings(s).filter(o=>!o.isVariable&&n(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),s}hasDetectedMappings(e,t,n){return this.getDetectedMappings(e,t,n).length>0}addDisposable(e){this._disposables.push(e)}dispose(){for(const e of this._disposables)e.dispose()}};function Ri(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var Oi=new Mm(e=>{e.escape("<script","<\/script>",t=>Ri(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>Ri(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),Ti(e)});function Lm(e){const t=Rm(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return so();const n=new Set(Object.keys(t.output).filter(s=>t.output[s]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:s=>Oi.normalizeToPolicy(s,t.editor),toOutputForm:s=>Oi.normalizeToPolicy(s,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:ro(r)}}function Nm(e){let t;e.injectFactory(l.TEMPLATE_DIRECTIVES_ID,()=>{const n=e.getInstance(l.CONFIG_SOURCE_ID)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:Lm(n)}),t.policy})}function p_(e){return e}var xm=[{name:"rest.client",setup:uh},{name:"auth.oauth",setup:l.provideOAuth},{name:"rest.identityHeaders",setup:ih},{name:"lifetime.destroyable",provides:[Vn],setup:ap},{name:"appInit",provides:[l.APP_ID,en],setup:sl},{name:"config",provides:[l.CONFIG_SOURCE_ID],setup:op},{name:"templateDirectives",provides:[l.TEMPLATE_DIRECTIVES_ID],setup:Nm},{name:"email.documents",setup:Cp},{name:"show.initPipeline",provides:[l.INIT_PIPELINE_ID],setup:fh},{name:"show",setup:fm},{name:"locale.service",provides:[nt],setup:nh},{name:"locale.fromConfig",awaits:{services:[l.CONFIG_SOURCE_ID,nt]},setup:rh},{name:"canvas.early",setup:Zu},{name:"canvas.previewSettings",setup:df},{name:"canvas.sandboxExtensions",setup:ff},{name:"canvas.sandboxScriptRelay",setup:mf},{name:"canvas.headerSync",provides:[_o],setup:nf},{name:"canvas.ampSync",setup:dd},{name:"canvas.moduleBridge",setup:Ud},{name:"canvas.port",setup:bd},{name:"canvas.images",setup:vd},{name:"canvas.edits",setup:Eu},{name:"canvas.blockContent",setup:uu},{name:"canvas.sandboxFill",provides:[Rn],setup:kf},{name:"canvas.reactions",setup:Qu}],km=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Fm(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const s=t.get(r)??[];s.push(n),t.set(r,s)}return t}function Bm(e,t){const n=[];for(const r of e.awaits?.services??[])for(const s of t.get(r)??[])s!==e&&n.push(s);return n}function Mi(e){const t=Fm(e),n=[],r=new Set,s=[],o=new Set,i=a=>{if(!r.has(a)){if(o.has(a)){const c=s.indexOf(a);throw new km([...s.slice(c),a].map(d=>d.name))}o.add(a),s.push(a);for(const c of Bm(a,t))i(c);s.pop(),o.delete(a),r.add(a),n.push(a)}};for(const a of e)i(a);return n}var Li;function lr(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID);if(t)return t;e.getInstance(l.DISPOSABLE_ID)||e.inject(l.DISPOSABLE_ID,new l.Disposable);const n=ce();e.inject(l.OPTIONS_SOURCE_ID,n),Li??=Mi(xm);for(const r of Li)r.setup(e);return n}function jm(e){}var Um=[{name:"save.previewFollow",setup:jm}],Ni=l.createIdentifier$1("plugin.lateUnitsInstalled");function Hm(e){if(!e.getInstance(Ni)){e.inject(Ni,!0);for(const t of Mi(Um))t.setup(e)}}function $m(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Vm(e){if(!e)return;const t=l.decodeJwt(e)?.data,n=t?.data?.scope??t?.scope;return(Array.isArray(n)?n.flatMap(r=>typeof r=="string"?r.split(/\s+/):[]):typeof n=="string"?n.split(/\s+/):[]).find(r=>/^project_\d+$/.test(r))?.replace(/^project_/,"")||void 0}var Gm=l.defineMixin(e=>{let t,n,r;return{async setOptions(s){const o=r!==s.getAuthToken,i=!l.deepEqual(t,s.user),a=n!==s.project;if(r=s.getAuthToken,t=s.user,n=s.project,!(!e.getInstance(l.SECURITY_MODULE_ID)||!s.getAuthToken)&&!(!o&&!i&&!a))try{const c=await s.getAuthToken(s.user,s.project);e.inject(l.STANDALONE_BOOTSTRAP_TOKEN_ID,Promise.resolve(c||""));const d=Vm(c);if(!d)return;e.inject(l.STANDALONE_PROJECT_ID,d);const u=e.getInstance(l.APP_ID),f=u?await u.catch(()=>{}):void 0;e.inject(l.APP_ID,Promise.resolve($m(d,f)))}catch{}}}});function Ym(e,t){if(e.getInstance(l.STANDALONE_FILE_PROXY_REGISTERED_ID))return;e.inject(l.STANDALONE_FILE_PROXY_REGISTERED_ID,!0);const n=l.getEvent(e,l.events.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var Wm=l.defineMixin(e=>{let t,n=!1;return{setOptions(r){const s=n;if(n=!0,!Qe(r)){t&&(Wf(e),$n(r)),t=void 0;return}const o=Rt(r);if(!o||t===o&&e.getInstance(l.SECURITY_MODULE_ID))return;t=o,e.inject(l.SECURITY_MODULE_ID,o);const i=e.getInstance(l.DISPOSABLE_ID);i&&Ym(e,i)}}}),qm=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=l.getEvent(e,l.APP_LOAD_EVENT_ID),r=B(n),s=t.addDisposable(new Fe(r));return{setOptions({handleLoad:o}){s.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function xi(e,t,n=!0){const r=e,s=t;for(const o of Object.keys(s)){const i=s[o];i!=null&&(n&&typeof i=="object"?r[o]=xi(r[o]||{},i,!0):r[o]=i)}return e}async function zm(e){const t=(await Pa.__vitePreload(()=>Promise.resolve().then(()=>Kt.__toESM(Et("./static/umd/6639d610.js").default)),void 0,{}.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var ki=l.createIdentifier$1("EditorOptions"),cr=l.MONACO_EDITOR_OPTIONS;function Km(e){const t=typeof e.font_family=="string"?`${e.font_family}, sans-serif`:void 0,n=e.word_wrap===void 0?void 0:e.word_wrap?"on":"off";return{tabSize:e.tab_size,fontFamily:t,fontSize:e.font_size,wordWrap:n,insertSpaces:e.insert_spaces,minimap:{enabled:e.minimap}}}function Xm(e){return e.getOrCreateInstance(ki,()=>{const t=ce(cr);let n=cr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(zm(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function Jm(e){return e?.getInstance(ki)?.get()??cr}function Qm(e,t={}){const n=Xm(e);n.set(xi({...n.get()},Km(t)))}function Zm(e){return{font_size:e.fontSize,font_family:e.fontFamily,tab_size:e.tabSize,word_wrap:e.wordWrap,minimap:e.minimap,insert_spaces:e.insertSpaces}}function eg(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var tg=l.createIdentifier$1("plugin.publicConfig");function dr(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()??{}}function Fi(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function Bi(e){const t=No(e),n=dr(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:eg(Jm(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function ji(e){return e.getInstance(l.CONFIG_SOURCE_ID)?.get()!==void 0}function ng(e){const t=l.createQueue(),n=se(e,l.CONFIG_CHANGED_EVENT_ID);let r,s,o=!1;const i=async()=>{try{return e.getInstance(l.APP_ID)===void 0?{}:(await e.getInstanceAsync(l.APP_ID))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:f=!1}={})=>{await e.getInstance(l.CONFIG_SOURCE_ID)?.ready(),Wr(e).set(dr(e).revisionService===!0);const{codeModeDirection:g,editor:E}=dr(e);E&&Qm(e,Zm(E)),g!==void 0&&!(f&&g===s)&&(s=g,g==="none"?Hn(e,!1):(Hn(e,!0),Gf(e,g)))},c=async()=>{if(!ji(e))return;const f=Bi(e),g=JSON.stringify(f);g!==r&&(r=g,await n.fire(f))},d=async f=>{const g=e.getInstance(l.CONFIG_SOURCE_ID),E={advancedConfigs:Fi(e).advancedConfigs,serverSide:await i(),user:f};g?.setAdvancedConfigs({...E.advancedConfigs,...E.user?.advancedConfigs}),g?.replace(E.user,"user"),g?.replace(E.serverSide,"server"),await a(),await c()},u=f=>{const{commonStyles:g,...E}=f;return"commonStyles"in f&&cf(e,g===void 0?void 0:g),E};return{queue:t,reactToConfig:a,emitConfigChanged:c,resolveServerSideConfig:i,getConfig:()=>ji(e)?Bi(e):{},setConfig:t.decorate(async f=>{await d(u(f))}),updateConfig:t.decorate(async f=>{const g=u(f);await d({...Fi(e).user,...g})}),announceAssembled(){o||(o=!0,e.getInstance(l.CONFIG_SOURCE_ID)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await c()})))}}}function Ui(e){return e.getOrCreateInstance(tg,()=>ng(e))}function rg(e){const t=Ui(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var sg=l.defineMixin(e=>{const t=e.getInstance(l.DISPOSABLE_ID),n=t.addDisposable(new l.AsyncEmitter),r=t.addDisposable(new l.AsyncEmitter),s=l.getEmitter(e,l.CONFIG_CHANGED_EVENT_ID),o=B(n.event),i=B(r.event),a=vi(B(s.event),e),c=t.addDisposable(new Fe(o)),d=t.addDisposable(new Fe(i)),u=t.addDisposable(new Fe(a));return{instance:{handleSetOptions:o,handleOptionsChanged:i,handleConfigChanged:a},async setOptions(f){c.setListener(f.handleSetOptions),d.setListener(f.handleOptionsChanged),u.setListener(f.handleConfigChanged),Ui(e).announceAssembled(),await n.fire(f),await r.fire(f)},dispose(){}}}),ur,Hi="core";function og(){const e=__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Hi],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function ig(e){const t=__useblocks__?.require?.warm;return typeof t!="function"?ct().then(()=>{}):t([Hi],e)}function ct(){return ur===void 0&&(ur=og().then(e=>(He()&&e.installDiagnostics().catch(t=>{}),e))),ur}var fr=null,pr=null;async function ag(e){typeof e?.prefetch=="function"&&await e.prefetch()}function hr(){return fr||(fr=ct().then(()=>{})),fr}function $i(e){return pr||(pr=ag(e)),pr}function lg(){return $i(typeof __useblocks__<"u"?__useblocks__:void 0)}function cg(){const e=typeof __useblocks__<"u"?__useblocks__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function dg(e){return Promise.all([hr(),$i(e)]).then(()=>{})}function ug(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function Vi(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>ig(t?{priority:t}:void 0)).then(()=>(An(t?{priority:t}:void 0),n?hr():void 0)).catch(()=>{})}function fg(e){const t=ug(e);if(t==="eager")Vi(e);else if(t==="idle"){const n=()=>Vi(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var Gi="PluginRegistry";function pg(e=l.resolveContainer()){return e.getOrCreateInstance(Gi,()=>new Fa)}var Yi=new Ba(()=>pg()),hg=["handleAIImageRequest","handleAITextRequest","handleCloneEmail","handleConfigChanged","handleDestroy","handleEmailAutosave","handleEmailChanged","handleEmailInit","handleError","handleFileProxy","handleHtmlChanged","handleLimitUsage","handleLivePreviewEmail","handleLoad","handleLoadImage","handleNextButtonClick","handleNotify","handleOptionsChanged","handlePreheaderChanged","handlePreviewEmail","handlePreviousButtonClick","handleReadBlocks","handleReadComments","handleReadCommonBlocks","handleReadEmail","handleReadEmailAutosave","handleReadEmailRevisions","handleReadLocale","handleReadTemplateBlocks","handleRemoveBlock","handleRemoveComment","handleRemoveEmail","handleRemoveEmailAutoSave","handleSaveBlock","handleSaveButtonClick","handleSaveComment","handleSaveEmail","handleSetOptions","handleShareEmail","handleSubjectChanged","handleSuccess","handleTestEmailModal","handleTestEmailSend","handleTranslate","handleUrlProxy","handleValidate"],mg=["compileEmail","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","save","setConfig","show","updateConfig","useAsync","validateCode","waitPlugin"],Ht=new Map([...hg.map(e=>[e,"event"]),...mg.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),gg=new Map([["use","use `useAsync()` or await `ready` first"]]);function Eg(e){return gg.get(e)??"await `ready` first"}var vg=new Set(["async","queued"]),_g=Symbol.for("emailmaker.earlyCtxPlaceholder");function Wi(e){return e[_g]=!0,e}function bg(e){return new Error(`[emailmaker] ${e}() is not available in a plugin constructor: the editor core is still loading. Call it from init() or later (${Eg(e)}).`)}function yg(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function Sg(e){return[...Ht].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function Ig(e,t){for(const n of Sg(e)){const r=Ht.get(n);if(r!==void 0&&vg.has(r)){const s=async(...o)=>{await t;const i=e[n];if(typeof i!="function"||i===s)throw yg(n);return i.apply(e,o)};e[n]=Wi(s);continue}e[n]=Wi(()=>{throw bg(n)})}}function wg(e,t,n){e.getInstanceAsync(je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function Tg(e,t){e.getInstanceAsync(je).then(()=>{l.getEmitter(e,l.events.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var Cg=l.defineMixin(e=>{let t;function n(){return new Promise(s=>{const o=e.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),i=()=>{o.delete(i),s()};o.add(i)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(s){const o=e.getInstance(l.INSTANCE_ID),i=e.getInstance(Gi);if(!t){t=new ka(o,i,{ensureHostRuntimeReady:lg,explainScriptFailure:cg,openEarlyWindow:()=>sm(e),reportLoadFailure:d=>Tg(e,d)}),e.inject(l.PLUGIN_COLLECTION_ID,t);const c=t.onLifecycle(d=>{d.type==="create:error"&&wg(e,d.name,d.error)});e.getInstance(l.DISPOSABLE_ID)?.addDisposable(c)}const a=s?.plugins||[];o&&(Ns(e),a.length>0&&Ig(o,n()),await t.setPlugins(a))},instance:{use(s){return typeof s=="function"?r().useByCtor(s):r().useByKey(s)},useAsync(s){return r().useAsync(s)},waitPlugin(s){return r().waitFor(s)}},dispose(){t?.dispose(),t=void 0}}}),qi=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const s=this._listeners.indexOf(r);s>=0&&this._listeners.splice(s,1)}}}async run(e){const t=[...this._listeners].sort((n,r)=>r.priority-n.priority);for(const{fn:n}of t){const r=await n(e);r!==null&&typeof r=="object"&&!Array.isArray(r)&&!(r instanceof Date)&&!(r instanceof RegExp)&&Object.assign(e,r)}return e}},Ag=l.createIdentifier$1("ELEMENT_INSERT_HTML_PIPELINE"),Dg=l.createIdentifier$1("BLOCK_INSERT_HTML_PIPELINE"),Pg="application_block_inserted",Rg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Dg,()=>new qi).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),s=n?e.bind(n):e;return r.addListener(Pg,s,t)}},mr=l.createIdentifier$1("ComponentRegistry"),Og=l.createIdentifier$1("ComponentRegistryGate");function gr(){return l.DependencyResolver.getOrCreateInstance(Og,()=>({pending:[]}))}function Mg(e=mr){return gr().factory!==void 0||l.DependencyResolver.getInstance(e)!==void 0}function Er(e,t,n=mr){if(Mg(n)){t($t(e,n));return}gr().pending.push(()=>t($t(e,n)))}function $t(e,t=mr){const n=l.DependencyResolver.getInstance(t);if(n)return n;const r=gr().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return l.DependencyResolver.getOrCreateInstance(t,r)}var Lg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=[];let n=!1;const r=o=>{if(!n){n=!0;for(const i of t)i.dispose();e(o)}};t.push(this._container.addService(l.ATOMS_HANDLERS_ID,{execute:o=>{r(o.value.map(i=>({name:i.name,html:i.html})))}}));const s=this._container.getInstance(l.HEADLESS_MODE_ID)?.watch(o=>{o&&r([])});s&&(n?s.dispose():t.push(s))})}update(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const s=$t(n),o=r.value.find(i=>i.name===e);if(o){const{icon:i,title:a,fallbackTooltip:c,...d}=t;i&&(o.icon=s.getReactNode(i)),a&&(o.title=s.getReactNode(a)),c&&(o.fallbackTooltip=s.getReactNode(c)),Object.assign(o,d)}}})}delete(e){this._container.addService(l.ATOMS_HANDLERS_ID,{execute:t=>{const n=t.value.findIndex(r=>r.name===e);n>=0&&t.value.splice(n,1)}})}insert(e,t){const n=this._container;return n.addService(l.ATOMS_HANDLERS_ID,{execute:r=>{const s=$t(n);r.value.splice(t??r.value.length,0,{...e,title:s.getReactNode(e.title),icon:s.getReactNode(e.icon),fallbackTooltip:s.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Ag,()=>new qi).add(e,t??0,n)}handleInject(e,t,n){return l.getEmitter$1(this._container,l.HANDLE_ATOM_INSERT_ID).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},Ng=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}send(e,t,n){this._messageService.send(e,t,n)}sendAsync(e,t,n=!0){return this._messageService.sendAsync(e,t,n)}addListener(e,t,n){return this._messageService.addListener(e,t,n)}addListenerAsync(e,t,n=0){return this._messageService.addListenerAsync(e,t,n)}onInit(e,t=!0,n=0){return this._messageService.onInit(e,t,n)}isInited(){return this._messageService.isInited()}};function xg(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}function zi(e,t){if(!t)return;const n=r=>r===void 0?void 0:e.getReactNode(r);return{...t,footer:n(t.footer),okText:n(t.okText),cancelText:n(t.cancelText),closeIcon:n(t.closeIcon)}}var kg=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=l.getEmitter$1(t,l.MODAL_SHOW_EVENT),this._closeModalEmitter=l.getEmitter$1(t,l.MODAL_CLOSE_EVENT),this._updateModalEmitter=l.getEmitter$1(t,l.MODAL_UPDATE_EVENT)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return Er(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:zi(r,n)})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;Er(this._container,r=>{this._updateModalEmitter.fire(xg({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:zi(r,n)}))})}},Fg=class{_registration;_loadedDisposable;loaded;ready;_loadedSettled=!1;_readySettled=!1;_readyListeners=new Set;constructor(e,t){this._registration=e,this._loadedDisposable=t,this.loaded=new Promise((n,r)=>{this._resolveLoaded=()=>{this._loadedSettled||(this._loadedSettled=!0,n())},this._rejectLoaded=s=>{this._loadedSettled||(this._loadedSettled=!0,r(s))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=s=>{this._readySettled||(this._readySettled=!0,r(s))}})}_resolveLoaded=()=>{};_rejectLoaded=()=>{};_resolveReady=()=>{};_rejectReady=()=>{};resolveLoaded(){this._resolveLoaded()}resolveReady(){this._resolveReady();for(const e of Array.from(this._readyListeners))try{e()}catch{}}onReady(e){return this._readyListeners.add(e),this._readySettled&&e(),{dispose:()=>{this._readyListeners.delete(e)}}}rejectLoad(e){this._rejectLoaded(e),this._rejectReady(e)}rejectReady(e){this._rejectReady(e)}dispose(){this._registration.dispose(),this._loadedDisposable.dispose(),this._readyListeners.clear();const e=new Error("Sandbox script registration disposed before completion.");this.rejectLoad(e),this.rejectReady(e)}},Bg=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService)}_createScriptHandle(e,t){const n=this._messageService.addListener(l.SANDBOX_EXTENSION_SCRIPT_STATUS_ID,s=>{if(s.key===e){if(s.phase==="load"&&s.status==="success"){r.resolveLoaded();return}if(s.phase==="ready"&&s.status==="success"){r.resolveReady();return}if(s.phase==="load"){r.rejectLoad(new Error(s.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(s.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Fg(t,n);return r}registerSandboxCSS(e){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{src:e,type:"text/javascript"}});return this._createScriptHandle(e,t)}registerSandboxScriptCode(e,t){const n=this._container.addService(l.SANDBOX_EXTENSIONS_ID,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},jg=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function vr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&jg.has(t)}function Ki(){const e=globalThis.crypto;if(e&&typeof e.randomUUID=="function")return e.randomUUID();if(e&&typeof e.getRandomValues=="function"){const t=new Uint8Array(16);return e.getRandomValues(t),Array.from(t,n=>n.toString(16).padStart(2,"0")).join("")}return`nohwcrypto-${Date.now()}`}function _r(){return`__settingsPanel:${Ki()}`}function br(e,t){return{type:e,props:t}}function Ug(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!vr(e)}function Xi(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(vr(t)){const r=_r();return n(e.add(r,t)),br(r,{})}if(typeof t=="function"){const r=_r();return n(e.add(r,t)),br(r,{})}if(Ug(t)){const r=t.type;if(typeof r=="string")return t;if(vr(r)||typeof r=="function"){const s=_r();return n(e.add(s,r)),br(s,t.props)}return t}return t}var Hg=class{_context;_panelRegistrationDisposables=[];constructor(e){this._context=e}get _container(){return this._context.container}_clearPanelRegistrations(){for(const e of this._panelRegistrationDisposables)e.dispose();this._panelRegistrationDisposables.length=0}_trackRegistration(e){this._panelRegistrationDisposables.push(e)}showSettingsPanel(e){this._clearPanelRegistrations();const t=e.instanceKey??Ki();Er(this._container,n=>{const r=i=>this._trackRegistration(i),s=Xi(n,e.content,r),o=e.advancedTabs?.map(i=>({...i,content:Xi(n,i.content,r)}));l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire({...e,content:s,advancedTabs:o,instanceKey:t,type:l.ADVANCED_SETTINGS_PANEL})})}closeSettingsPanel(){this._clearPanelRegistrations(),l.getEmitter$1(this._container,l.SETTINGS_PANEL_EVENT).fire(null)}},Ji={SandboxScriptApi:Bg,ElementsApi:Lg,BlocksApi:Rg,MessageService:Ng,SettingsPanelApi:Hg,ModalApi:kg};function yr(e,t,n,r={}){const s=Object.assign({},e);for(const[o,i]of Object.entries(t))if(i!==void 0)if(n.includes(o)&&typeof i=="object"&&i!==null){const a=s[o],c=r[o]??{};s[o]=Object.assign({},typeof a=="object"&&a!==null?a:c,i)}else s[o]=i;return s}var ie={border:{all:null,top:null,right:null,bottom:null,left:null},borderRadius:{all:5,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},borderRadiusCards:{all:10,topLeft:null,topRight:null,bottomRight:null,bottomLeft:null},padding:{all:null,top:null,right:null,bottom:null,left:null}},$g={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",lineHeight:21,lineHeightDim:"px",color:"#5a5a5a",contrastColor:"#FFFFFF",textAlign:"left",paddingBottom:10,paddingBottomDim:"px"},Sr={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:24,fontSizeDim:"px",lineHeight:32,lineHeightDim:"px",color:"#333333",contrastColor:"#FFFFFF",textAlign:"left",paddingTop:20,paddingTopDim:"px",paddingBottom:20,paddingBottomDim:"px",letterSpacing:0,letterSpacingDim:"px",bold:!0,italic:!1},Qi={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},Ue={fontFamily:["Safe Fonts","-apple-system, 'Segoe UI', 'Helvetica Neue', Helvetica, Roboto, Arial, sans-serif"],fontSize:16,fontSizeDim:"px",letterSpacing:0,letterSpacingDim:"px",color:"#FFFFFF",contrastColor:"#1C52DC",bold:!1,italic:!1,backgroundColor:"#1C52DC",contrastBackgroundColor:"#FFFFFF",marginTop:10,marginTopDim:"px",marginBottom:10,marginBottomDim:"px",border:ie.border,borderRadius:ie.borderRadius,textAlign:"center",padding:ie.padding},Zi={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ie.padding},Ir={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ie.border,borderRadius:ie.borderRadiusCards};function Vg(e){return{...$g,...e}}function Gg(e){return{...Sr,...e,bold:e?.bold??Sr.bold,italic:e?.italic??Sr.italic}}function Yg(e){return{...Qi,...e,underline:e?.underline??Qi.underline}}function Wg(e){return{...Ue,...e,bold:e?.bold??Ue.bold,italic:e?.italic??Ue.italic,border:{...Ue.border,...e?.border},borderRadius:{...Ue.borderRadius,...e?.borderRadius},padding:{...Ue.padding,...e?.padding}}}function qg(e){return{...Zi,...e,padding:{...Zi.padding,...e?.padding}}}function zg(e){return{...Ir,...e,border:{...Ir.border,...e?.border},borderRadius:{...Ir.borderRadius,...e?.borderRadius}}}function wr(e={}){return{backgroundColor:e.backgroundColor||"",backgroundImage:(e.backgroundImage||[]).map(t=>({type:"url",value:t?.value||""})),backgroundPositionX:e.backgroundPositionX||"",backgroundPositionY:e.backgroundPositionY||"",backgroundRepeat:e.backgroundRepeat||"",backgroundSize:e.backgroundSize||"",backgroundColorContent:e.backgroundColorContent||"",textStrong:e.textStrong||!1,textItalic:e.textItalic||!1,textUnderline:e.textUnderline||!1,width:e.width,responsive:e.responsive}}function ea(e){let t={...l.COMMON_STYLES};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function Tr(e){return{text:Vg(e.text),headings:Gg(e.headings),links:Yg(e.links),buttons:Wg(e.buttons),block:qg(e.block),cards:zg(e.cards)}}var ta=l.createIdentifier$1("EmailSettingsPort"),Kg=1e4,na=class{_editor;_layoutSettingsChanged=new l.Emitter;_contentStylesChanged=new l.Emitter;_messageSubscription;_messageSubscriptionPromise;_prevLayoutSnapshot;_prevContentSnapshot;constructor(e){this._editor=e}onChangeEmailLayoutSettings(e){const t=this._layoutSettingsChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentLayoutSettings()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}onChangeEmailContentStyles(e){const t=this._contentStylesChanged.event(e);return this._ensureMessageSubscription(),this._replayToEarlyPlugin(e,()=>this._getCurrentContentStyles()),{dispose:()=>{t.dispose(),this._disposeMessageSubscriptionIfUnused()}}}_replayToEarlyPlugin(e,t){if(!Ei(this._editor.container)||!Me(this._editor.container)?.current()?.get().attributes.is_inited)return;const n=t();queueMicrotask(()=>e(n))}_disposeMessageSubscriptionIfUnused(){this._layoutSettingsChanged.hasListeners()||this._contentStylesChanged.hasListeners()||(this._messageSubscription?.dispose(),this._messageSubscription=void 0)}_settings(e=this._editor.container){const t=e.getInstance(ta);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return wr(this._settings().read())}_getCurrentContentStyles(){const e=Me(this._editor.container)?.current()?.get().attributes.common_styles;return Tr(ea(e))}_getLayoutSnapshot(e){return JSON.stringify(e)}_getContentSnapshot(e){return JSON.stringify(e)}async _ensureMessageSubscription(){if(!this._messageSubscription){if(this._messageSubscriptionPromise)return this._messageSubscriptionPromise;this._messageSubscriptionPromise=(async()=>{if(await this._editor.container.getInstanceAsync(ta),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(l.MESSAGE_SERVICE_ID,()=>new l.MessageService),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const s=r?.data,o=s?.operation;if(o===l.EVENT_TYPES.APPLICATION_EMAIL_SETTINGS_SET){const c=wr(s?.settings),d=this._getLayoutSnapshot(c);d!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=d,this._layoutSettingsChanged.fire(c));return}if(o!==l.EVENT_TYPES.APPLICATION_COMMON_STYLES_UPDATE)return;const i=Tr(r.data?.settings?.commonStyles??{...l.COMMON_STYLES}),a=this._getContentSnapshot(i);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(i))})})();try{await this._messageSubscriptionPromise}finally{this._messageSubscriptionPromise=void 0}}}async getEmailLayoutSettings(){return await this._waitForEmailSettingsFromIframe(),this._getCurrentLayoutSettings()}async setEmailLayoutSettings(e){await this._waitForEmailSettingsFromIframe();const t=this._settings(),n={...t.read(),...e};t.write(n);const r=wr(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=Kg){const t=Me(this._editor.container)?.current()?.get().attributes.is_inited,n=this._settings().read();if(t&&n&&Object.keys(n).length>0&&(n.backgroundColor||n.backgroundImage?.[0]?.value||n.width?.value||n.responsive!==void 0)||t)return;const r=this._editor.container,s=l.getEvent(r,l.events.ON_EMAIL_INIT_ID);return new Promise(o=>{let i=!1,a;const c=()=>{a&&(clearTimeout(a),a=void 0)},d=s(()=>{i||(i=!0,c(),d.dispose(),o())});a=setTimeout(()=>{i||(i=!0,d.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Me(this._editor.container)?.current();if(!t)return;const n=ea(t.get().attributes.common_styles);e.text!==void 0&&(n.text={...n.text||{},...e.text}),e.headings!==void 0&&(n.headings={...n.headings||{},...e.headings}),e.links!==void 0&&(n.links={...n.links||{},...e.links}),e.buttons!==void 0&&(n.buttons=yr(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ie.border,borderRadius:ie.borderRadius,padding:ie.padding})),e.block!==void 0&&(n.block=yr(n.block||{},e.block,["padding"],{padding:ie.padding})),e.cards!==void 0&&(n.cards=yr(n.cards||{},e.cards,["border","borderRadius"],{border:ie.border,borderRadius:ie.borderRadiusCards}));const r=JSON.stringify(n);Ke(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const s=Tr(n);this._prevContentSnapshot=this._getContentSnapshot(s),this._contentStylesChanged.fire(s)}},Xg={...Ji,EmailSettingsApi:na},Jg={...Ji},h_={...Jg,EmailSettingsApi:na},Qg={...Xg};function Zg(){Yi.addAll(Qg)}var eE=[l.defineMixin(()=>{Zg()}),qm,sg,Wm,l.JWTMixin,Gm,l.OAuthMixin];async function tE(){return(await ct()).asyncMixins}var nE=Cg,rE=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let s;try{s=await tE()}catch(i){throw e.failPendingWaits(i),i}t=s(e);const o=await e.getInstanceAsync(l.INSTANCE_ID);Object.assign(o,t.instance||{});for(const i of e.getInstance(l.LATE_SURFACE_LISTENERS_ID)??[])i()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},sE=l.combineMixins([...eE]);function Cr(){let e,t=!1;const n=new Map,r=new Map;function s(){for(const o of r.values())o();r.clear()}return{event(o,i,a){const c=Symbol("subscription");return t||(n.set(c,{listener:o,priority:i,thisArg:a}),e&&r.set(c,e(o,i,a))),()=>{n.delete(c),r.get(c)?.(),r.delete(c)}},attach(o){s(),e=o;for(const[i,{listener:a,priority:c,thisArg:d}]of n)r.set(i,o(a,c,d))},dispose(){t=!0,s(),n.clear(),e=void 0}}}function oE(e){const t=Cr(),n=Cr(),r=Cr();return e.getInstance(l.DISPOSABLE_ID)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(je).then(s=>{t.attach(s.onNotify),n.attach(s.onError),r.attach(s.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(s){const o=e.getInstance(je);if(o){o.notify(s);return}e.getInstanceAsync(je).then(i=>i.notify(s),()=>{})}}}var ra=l.createIdentifier$1("CodeErrors"),iE=[];function aE(e){return e?.getInstance(ra)?.get()??iE}function lE(e){return e?.getInstance(ra)!==void 0}var cE=class extends l.Disposable{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=rt(e),this.addDisposable(l.getEvent(e,l.events.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){return ai(this._container,this._currentEmail)}async getBlocks(){const e=await this._readProjectBlocks();return await this._blockMetaWrites,(await this._dataSources.blocks.cache.values()).filter(t=>String(t.project)===String(e)).map(t=>ot(t,this._container))}async _readProjectBlocks(){const e=await Sh(this._container);return await this._dataSources.blocks.byForeignKey("project").get(e),e}async getComments(){const{cache:e}=this._dataSources.comments,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.post===t.id).map(n=>it(n,this._container))}async getEmailRevisions(){const{cache:e}=this._dataSources.emailRevisions,t=await this.getEmailSnapshot();return(await e.values()).filter(n=>n.parent===t.id).map(n=>tr(n,this._container))}async getEmailSnapshot(){return oe(this.openEmail(),this._container)}setEmailMeta(e){const t=Qn(this._container);if(!t)return;const n=t.get().attributes.meta;Ke(t,{meta:Yn({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,s=>s&&Yn(s,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:r}=this._dataSources.blocks;await r.getIfPresent(e)&&await r.addOrUpdate(e,s=>s&&Yn(s,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){return lE(this._container)?aE(this._container):void 0}},dE=l.createIdentifier$1("EmailDataController");function uE(e){return e.getOrCreateInstance(dE,()=>{const t=new cE(e);return e.getInstance(l.DISPOSABLE_ID)?.addDisposable(t),t})}function fE(e){const t=uE(e);return{getEmailSnapshot:()=>t.getEmailSnapshot(),getCodeErrors:()=>t.getCodeErrors(),getBlocks:()=>t.getBlocks(),getComments:()=>t.getComments(),getEmailRevisions:()=>t.getEmailRevisions(),setEmailMeta:n=>t.setEmailMeta(n),setBlockMeta:(n,r)=>t.setBlockMeta(n,r)}}function pE(e){return{undo:()=>e.undo(),redo:()=>e.redo(),clear:()=>e.clear(),canUndo:()=>e.canUndo(),canRedo:()=>e.canRedo(),createSnapshot:()=>e.createSnapshot(),restoreSnapshot:t=>{e.restoreSnapshot(t)},getPast:t=>e.getPast(t).map(n=>({changes:n})),getFuture:t=>e.getFuture(t).map(n=>({changes:n}))}}function hE(e){let t;const n=Uo(e),r=l.getEvent(e,l.events.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:o})=>{t=o}));const s=()=>t?pE(t):void 0;return{undoRedoService:{undo:()=>s()?.undo(),redo:()=>s()?.redo(),clear:()=>s()?.clear(),getPast:o=>s()?.getPast(o)??[],getFuture:o=>s()?.getFuture(o)??[],canUndo:()=>s()?.canUndo()??!1,canRedo:()=>s()?.canRedo()??!1,createSnapshot:()=>s()?.createSnapshot(),restoreSnapshot:o=>s()?.restoreSnapshot(o)}}}var mE=l.createIdentifier$1("plugin.mountElement");function gE(e){const t=e.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function EE(e){return e.getOrCreateInstance(mE,()=>{let t=!1,n;return{get:()=>t?n:gE(e),set(r){t=!0,n=r}}})}function vE(e){const t=EE(e);return{getElement:()=>t.get()}}function _E(e){return{handleLoadImage:B(l.getEvent(e,l.events.UPLOAD_EVENT_ID)),handleFileProxy:B(l.getEvent(e,l.events.FILE_PROXY_EVENT_ID)),handleUrlProxy:B(l.getEvent(e,l.events.PROXY_URL_EVENT_ID)),handleAITextRequest:B(l.getEvent(e,l.events.AI_TEXT_REQUEST_ID)),handleAIImageRequest:B(l.getEvent(e,l.events.AI_IMAGE_REQUEST_ID)),handleReadLocale:B(l.getEvent(e,l.events.READ_LOCALE)),handleLimitUsage:B(l.getEvent(e,l.events.ON_LIMIT_ID)),handleTranslate:B(l.getEvent(e,l.events.ON_TRANSLATE_ID))}}var bE=[lp,pm,oE,rg,fE,hE,vE,_E];function yE(e,t=bE){const n=lr(e);Hm(e);const r=sE(e),s=nE(e),o=rE(e),i={...r.instance,...s.instance,...o.instance};for(const c of t)Object.assign(i,c(e));let a=!0;return{instance:i,async setOptions(c){await r.setOptions(c);const d=a&&n.get()===c;a=!1,d||n.set(c),await s.setOptions(c),await o.setOptions(c)}}}function SE(e){return{get:t=>e.get(t),remove:(t,n)=>e.remove(t,n),set:(t,n,r)=>{if(n==null){e.get(t),e.remove(t,r);return}e.set(t,n,r)}}}var IE=class{_storage=Object.create(null);get(e){const t=this._storage[e];return t&&(!t.expires||t.expires<Date.now())?t.value:""}set(e,t,n){this._storage[e]={value:t,expires:n.expires?n.expires*1e3+Date.now():void 0}}remove(e){delete this._storage[e]}},wE="editor-runtime.react.copies",Ar=8;function dt(e){return e&&typeof e=="object"?e:void 0}function sa(e){const t=dt(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=dt(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function TE(e){const t=dt(e),n=t&&typeof t.version=="string"?t.version:void 0,r=dt(t?.default),s=r&&typeof r.version=="string"?r.version:void 0;return n??s??"unknown"}function CE(e,t,n){return e.package===t&&e.version===n}function AE({ourReact:e,entries:t,packageName:n,version:r}){const s=sa(e);if(!s||!Array.isArray(t))return[];const o=[],i=new Set;for(const a of t){const c=dt(a);if(!c||!CE(c,n,r))continue;const d=sa(c.react);!d||d===s||i.has(d)||(i.add(d),o.push({package:n,version:r,reactVersion:TE(c.react),react:c.react}))}return o}function DE({packageName:e,copies:t}){const n=[`[${e}] A second copy of React is on this page (singleton invariant broken).`,`The editor runs on its own React, the plugin got another one from ${e}/runtime/react.`,`This shows up as "Cannot read properties of null (reading 'useState')" and takes down the whole`,"editor, not just the plugin panel: plugin components render inside the editor tree.","","Found:"];for(const r of t.slice(0,Ar))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>Ar&&n.push(` …and ${t.length-Ar} more`),n.push("","Likely root cause: the editor is loaded from its UMD entry (a <script> on the page), while the","plugin was built as an ESM package by the host bundler. Those two never share a React.","","Fix it either way:"," • build the plugin on globals — it then takes React from the page registry, or"," • load the editor from its ESM entry and build both with the same bundler."),n.join(`
|
|
2153
|
+
`)}var oa=new Set;function PE({packageName:e="useblocks",version:t="1.1.102",log:n=r=>{}}={}){const r=s=>{try{const o=globalThis[Symbol.for(wE)],i=AE({ourReact:s,entries:o,packageName:e,version:t}).filter(a=>!oa.has(a.react));if(!i.length)return;i.forEach(a=>oa.add(a.react)),n(DE({packageName:e,copies:i}))}catch{}};try{const s=Qt()?.modules?.React;if(s&&typeof s.then=="function"){s.then(r,()=>{});return}r(s)}catch{}}async function RE(e,t,n){l.throwIfAborted(e.signal);const r=t??l.DependencyResolver.createChild();lr(r);const s=r.getInstance(l.DISPOSABLE_ID);let o;async function i(){r.inject(l.COOKIE_MANAGER_ID,SE(new IE)),PE();const a=yE(r),c={...a.instance,container:r,get ready(){return o??Promise.resolve(c)},async reset(d){if(l.throwIfAborted(d.signal),s.isDisposed())throw me();return await a.setOptions(d),c}};r.inject(l.INSTANCE_ID,c);try{if(n?.onInstance?.(c),await a.setOptions(e),l.throwIfAborted(e.signal),s.isDisposed()||await dm(r),e.devTools)try{const d=r.getInstance(l.PLUGIN_COLLECTION_ID);d&&await(await ct()).initDevTools(r,d)}catch{}return l.throwIfAborted(e.signal),l.getEmitter(r,l.APP_LOAD_EVENT_ID).fire(c),c}catch(d){throw s.dispose(),d}}try{return o=l.raceWithAbortSignal(i(),e.signal),o.catch(()=>{}),await o}catch(a){throw s.isDisposed()||s.dispose(),a}}var ut=new WeakMap;function OE(e){return e?ut.get(e):void 0}function ia(e){try{e.getInstance(l.DISPOSABLE_ID)?.dispose()}catch{}try{e.dispose()}catch{}}function ME(e,t){if(!e)return;const n=ut.get(e);n&&n!==t&&ia(n),ut.set(e,t)}function LE(e,t){e&&ut.get(e)===t&&ut.delete(e)}function NE(e){const t=l.DependencyResolver.createChild();return Qe(e)&&t.inject(l.SECURITY_MODULE_ID,Rt(e)),t}var ft=new WeakMap,xE="data-useblocks-config-styles";function kE(e){return typeof e=="string"?e.trim():""}function aa(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function FE(e,t,n){if(!e||typeof document>"u")return null;const r=kE(t),s=ft.get(e),o=n||e;if(!r)return s&&(s.remove(),ft.delete(e)),null;if(s)return s.textContent!==r&&(s.textContent=r),(s.parentNode!==o||s!==o.firstChild)&&aa(o,s),s;const i=document.createElement("style");return i.setAttribute(xE,"true"),i.textContent=r,aa(o,i),ft.set(e,i),i}function BE(e){if(!e)return;const t=ft.get(e);t&&(t.remove(),ft.delete(e))}var m_=!1;function la(){return!1}var g_=28,jE=`
|
|
2130
2154
|
.blocks-app-initial-spinner-wrapper {
|
|
2131
2155
|
width: 100%;
|
|
2132
2156
|
height: 100%;
|
|
@@ -2155,11 +2179,11 @@ __useblocks__.define("useblocks.js",["require","exports","module","static/umd/99
|
|
|
2155
2179
|
100% {
|
|
2156
2180
|
transform: rotate(360deg);
|
|
2157
2181
|
}
|
|
2158
|
-
}`;function Qp(){return()=>{}}function Zp(e,t){if(!To()||!e||typeof document>"u")return Qp();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const s=document.createElement("style");s.setAttribute(t,"true"),s.textContent=Jp,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function em(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function tm({report:e}={}){const t=new Map,n=new Set,r=e??(s=>{});return{run(s,o){const i=t.get(s);if(i!==void 0)return i;const l=o().catch(c=>{throw n.has(s)||(n.add(s),r(c)),em(c)||t.delete(s),c});return t.set(s,l),l},clear(){t.clear(),n.clear()},size(){return t.size}}}var Rn=tm();function Ao(){Rn.clear()}a.setApiOriginFailoverHook(()=>Rn.clear());var Co=new WeakMap,Do=new WeakMap;function nm(e,t){let n=Do.get(t);n||(n=new Map,Do.set(t,n));const r=n.get(e);if(r!==void 0)return r;const s=t.getInstance(a.CUSTOM_FETCH_ID),o=a.createTransport({baseUrl:e,customFetch:s?.execute??fetch},t);return n.set(e,o),o}function On(e){return a.resolveExplicitApiBaseUrl(e)}function rm(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function sm(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function om(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}var Ln=new WeakMap;function Mn(e,t){Ln.set(e,t)}function im(e){return Ln.get(e)}function am(e,t){return async({baseUrl:n})=>{const r=t();if(!r)throw new Error("[Loader] appInit requires the instance container");const s=Ln.get(r)??e,o=On(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json"});if(s.getAuthToken&&!await om(s))throw sm();const l=new Jn(nm(o,r)),c={headers:Object.fromEntries(i.entries()),credentials:"same-origin",failoverAttemptTimeout:hn(s)||void 0},d=await l.app_init_create({},c);if(!d.ok)throw rm(d.status,d.statusText);return d.data}}function lm(e){return JSON.stringify({baseUrl:On(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function cm(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function dm(e){return t=>Rn.run(lm(t),()=>($("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>$("appInit:end",{kind:"network"}))))}function um(e,t){if(ft(e)||!e.appInit&&!On(e.baseUrl)||!cm(e))return e;const n=e.appInit??am(e,t);let r=Co.get(n);return r||(r=dm(n),Co.set(n,r)),{...e,appInit:r}}var Po=0;function fm(){return Po}function pm(){Po+=1,Ao()}var Ro=new WeakMap,Oo=new WeakMap,mm=3e4;function hm(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function gm(e,t){try{const n=a.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+mm}function Em(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=hm(r,s);if(o)return n.delete(i),t.delete(i),Ao(),e(r,s,o);const l=n.get(i);if(l&&!t.has(i)){if(l.expiresAtMs>Date.now())return l.token;n.delete(i)}let c=t.get(i);return c===void 0&&($("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,s,o)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:gm(u,Date.now())}),d}).finally(()=>{$("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function vm(e){if(ft(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Ro.get(t);const r=fm();return(!n||Oo.get(t)!==r)&&(n=Em(t),Ro.set(t,n),Oo.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var bm="[emailmaker] This editor instance was taken over by a later init()/create() into the same element. Get the current one with getInstance(element).";function _m(){const e=new Error(bm);return e.name="EditorReleasedError",e}var ym="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function Sm(e){const t=new Error(ym,{cause:e});return t.name="EditorStartFailedError",t}var Se=new WeakMap,pt=new WeakMap;function Lo(e,t){Se.set(e,t),pt.get(e)?.forEach(n=>n())}function wm(e,t){const n=pt.get(e)??new Set;return n.add(t),pt.set(e,n),()=>n.delete(t)}function Nn(e){const t=(Se.get(e)??0)+1;return Lo(e,t),t}var mt=new WeakMap;function Im(e,t){const n=mt.get(e)??new Set;n.add(t),mt.set(e,n)}function Tm(e,t,n){return Se.get(e)!==t?!0:mt.get(e)?.has(n)?!1:(Lo(e,n),!0)}function Mo(e,t){return mt.get(e)?.has(t)===!0}var No=new WeakMap;function Am(e,t){No.set(e,{reason:t}),pt.get(e)?.forEach(n=>n())}function xn(e){return No.get(e)}function ht(e,t){return Se.get(e)===t}var kn=new WeakMap;function Cm(e,t){const n=kn.get(e)??new Set;n.add(t),kn.set(e,n)}function Dm(e,t){const n=Se.get(e);return n!==void 0&&n!==t&&kn.get(e)?.has(n)===!0}function xo(e){return Se.get(e)??0}var Pm=new Set(["setConfig","updateConfig","show","save","getEmailSnapshot","getEmail","compileEmail","getBlocks","getEmailRevisions","getComments","validateCode","reset","useAsync"]),Rm=new Set(["setEmailMeta","setBlockMeta","notify"]),ko=new Map([["getConfig","await `ready` first"],["use","use `useAsync()` or await `ready` first"],["container","await `ready` first"],["undoRedoService","await `ready` first"]]);function Fo(e){if(/^handle[A-Z]/.test(e))return"event";if(Pm.has(e))return"async";if(Rm.has(e))return"queued";if(e==="getElement")return"element";if(e==="getCodeErrors")return"codeErrors";if(ko.has(e))return"notReady"}function Om(e){return ko.get(e)??"await `ready` first"}function Bo(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}function Lm(e,t){let n,r=0,s,o,i="pending",l,c,d,u;const p=new Set,E=[];let m,b;const v=new Promise((D,R)=>{m=D,b=R});v.catch(()=>{});const h=D=>n?.[D],_=()=>i==="pending"||n!==void 0&&ht(n,r)&&xn(n)===void 0,y=D=>{const R=h(D.name);D.dispose||typeof R!="function"||!_()||(D.dispose=R(...D.args))},S=()=>p.forEach(y),A=()=>{for(const D of p)D.dispose?.(),D.dispose=void 0},C=()=>S(),g=()=>{i==="ready"&&(_()?S():A())},I=()=>{d?.delete(C),d=void 0},f=()=>{u?.(),u=void 0,A(),p.clear(),I(),E.length=0,n=void 0},w=()=>i==="failed"?l:_t(),T=()=>{if(i!=="ready"||n===void 0)return;if(Dm(n,r))return _m();const D=xn(n);return D?Sm(D.reason):void 0},L=(D,R,B)=>{if(i==="failed"||i==="destroyed")throw w();const M=T();if(M)throw M;const N=h(D);if(typeof N!="function")throw Bo(D);return N.apply(B,R)},F=()=>i==="ready"?Promise.resolve():i==="pending"?v:Promise.reject(w()),z=(D,R)=>{if(i==="failed"||i==="destroyed")throw w();if(i==="ready"&&typeof h(D)!="function")throw Bo(D);const B={name:D,args:R};return p.add(B),y(B),()=>{p.delete(B),B.dispose?.(),B.dispose=void 0}},x=()=>{const D=e.element;return D!==void 0&&typeof D!="string"?D:void 0},P=new Proxy({},{get(D,R,B){if(typeof R!="string"||R==="then")return;const M=Fo(R);if(M==="event")return(...N)=>z(R,N);if(R==="reset")return(...N)=>F().then(()=>L(R,N,B)).then(()=>k);if(i==="pending"&&(M==="queued"||M==="codeErrors"))return M==="codeErrors"?()=>[]:(...N)=>{E.push({name:R,args:N})};if(n&&R in n){const N=T();if(N){if(typeof h(R)!="function")throw N;return M==="async"?()=>Promise.reject(N):()=>{throw N}}return Reflect.get(n,R,B)}switch(M){case"async":return(...N)=>F().then(()=>L(R,N,B));case"queued":return(...N)=>{if(i!=="pending")return L(R,N,B);E.push({name:R,args:N})};case"element":return x;case"codeErrors":return()=>[];case"notReady":throw new Error(`[emailmaker] \`${R}\` is not available before the editor is ready: ${Om(R)}`);default:return R in Object.prototype?Reflect.get(Object.prototype,R,B):void 0}},has(D,R){return typeof R!="string"?!1:n!==void 0&&R in n||Fo(R)!==void 0}}),k=Object.create(P);return Object.defineProperty(k,"ready",{get:()=>c,enumerable:!0}),Object.defineProperty(k,"destroy",{enumerable:!0,value:()=>{if(i==="destroyed"||i==="failed")return;if(i==="pending"){const M=s!==void 0&&n!==void 0&&ht(n,r),N=n;i="destroyed",c?.catch(()=>{}),t(a.createAbortError("[emailmaker] editor was destroyed before it was ready")),M&&(f(),N?.destroy());return}const D=n!==void 0&&ht(n,r),R=n,B=R!==void 0&&xn(R)!==void 0;i="destroyed",f(),!B&&(D?R?.destroy():R&&Im(R,r))}}),{handle:k,bind:(D,R)=>{R?.adopt&&i==="pending"&&s===void 0?(s=xo(D),o=D,r=Nn(D)):!R?.adopt&&n!==D&&(s=void 0,o=void 0),n!==D&&(A(),I(),n=D,S(),i==="pending"&&(d=D.container.getOrCreateInstance(a.LATE_SURFACE_LISTENERS_ID,()=>new Set),d.add(C)))},settle:()=>{const D=n;if(i==="destroyed"){f(),D&&(Nn(D),D.destroy());const R=a.createAbortError("[emailmaker] editor was destroyed before it was ready");throw l=R,b(R),R}D&&s===void 0&&xo(D)===0&&(r=Nn(D)),i="ready",D&&(Cm(D,r),u=wm(D,g),g()),I();for(const R of E.splice(0))try{L(R.name,R.args,k)}catch(B){queueMicrotask(()=>{throw B})}m()},fail:D=>{i!=="destroyed"&&(i="failed",l=D),f(),b(D)},canHandBack:()=>o!==void 0&&s!==void 0&&i!=="destroyed"&&ht(o,r)&&!Mo(o,s),finishAdoption:(D,R)=>{const B=o,M=s;if(o=void 0,s=void 0,!B||M===void 0||i==="destroyed")return;const N=!D||Mo(B,M);if(N&&Am(B,R),!Tm(B,r,M)||N)try{B.destroy()}catch{}},setReady:D=>{c=D},isCurrent:()=>i==="pending"||i==="ready"&&T()===void 0}}var Fn="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function Mm(){return a.createAbortError(Fn)}function jo(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Fn}function Nm(e,t,n){if(typeof document>"u")return;let r=!1,s;const o=()=>{r=!0,s?.disconnect(),s=void 0},i=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(i);return}s=new MutationObserver(()=>{e.isConnected||i()});let l=e.parentNode;for(;l;)s.observe(l,{childList:!0}),l=l.parentNode}function xm(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:s}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return Nm(n,()=>{n.id,o.abort(Mm())},s),a.composeAbortSignals(r,o.signal)}var Bn="Superseded by newer init() on the same mount element";function km(){return a.createAbortError(Bn)}function Uo(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Bn}var je=new Map,gt=new WeakMap;function Fm(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Bm(e){if(!e)return{previous:Promise.resolve(),release:()=>{}};const t=Fm(e);(t?je.get(t):void 0)?.forEach(c=>{c.element!==e&&c.controller.abort(km())});const n=gt.get(e)??Promise.resolve();let r;const s=new Promise(c=>{r=c}),o=n.then(()=>s);gt.set(e,o),o.then(()=>{gt.get(e)===o&>.delete(e)});const i=new AbortController,l={element:e,controller:i};if(t){const c=je.get(t)??new Set;c.add(l),je.set(t,c)}return{signal:i.signal,previous:n,release:()=>{r();const c=t?je.get(t):void 0;t&&c?.delete(l)&&c.size===0&&je.delete(t)}}}var Et=new WeakMap;function Ho(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function jn(e){return Object.entries(e).filter(([t,n])=>Ho(t,n)).map(([t])=>t).sort()}function $o(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Ho(n,r)&&(t[n]=r);return t}function Un(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Et.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Et.set(e,r));const{current:s,trampolines:o}=r;s.clear();const i={...t};for(const l of jn(t)){s.set(l,t[l]);let c=o.get(l);c||(c=(...d)=>s.get(l)?.(...d),o.set(l,c)),i[l]=c}return r.lastOptions=t,i}function jm(e){const t=e?Et.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((s,o)=>t.current.set(o,s)),t.lastOptions=r}}function Um(e,t,n){const r=e?Et.get(e):void 0;if(!r||!n)return!1;const s=jn(t),o=a.deepEqual(s,jn(r.lastOptions)),i=s.every(l=>l==="getAuthToken"||n[l]===r.trampolines.get(l));return!o||!i||!a.deepEqual($o(t),$o(r.lastOptions))?!1:(Un(e,t),!0)}var Ue=new WeakMap;function Hm(e,t){const n=Ue.get(e)??[];n.push(t),Ue.set(e,n)}function $m(e){const t=Ue.get(e);if(!t)return;const n=t.filter(r=>r.isCurrent());if(n.length===0){Ue.delete(e);return}return Ue.set(e,n),n[n.length-1].handle}var Gm=Vn({FileManagerApiError:()=>Vm}),Vm=class Yo extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,s){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,Yo)}},Ym=Vn({mapHttpStatusToErrorCode:()=>a.mapHttpStatusToErrorCode});function qm(e,t){return{...e,element:t}}function Hn(){return()=>{}}function zm(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Hn():(Kp(t,e.config?.styles,t),()=>{Xp(t)})}function Wm(e){if(!To()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Hn()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Hn()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=Zp(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Km(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function Go(e){try{e.destroy()}catch{}}function He(e,...t){const n=a.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&a.ELEMENT_MAP.delete(e)}var Xm="1.1.85-dev.9";async function Jm(e){Ht(),await Xf(typeof __useblocks__<"u"?__useblocks__:void 0)}async function Qm(e){return Vo(e).ready}function Vo(e){$(W.initStart);const t=new AbortController,n=a.composeAbortSignals(e.signal,t.signal),r=Lm(e,i=>t.abort(i)),s=i=>Hm(i,r),o=sh({...e,signal:n},r,s).then(()=>($(W.initEnd),r.settle(),r.handle),i=>{throw r.fail(i),i});return r.setReady(o),r.handle}function Zm(e){const t=typeof e=="string"?document.querySelector(e):e;return t?$m(t):void 0}function eh(e){let t,n,r=!1;try{t=e.container.getInstance(a.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(a.INIT_PIPELINE_ID)?.externalSignal;const s=Ce(e.container)?.current();r=s!==void 0&&s.get().savedVersion!==null&&s.isDirty()}catch{t=void 0}return{options:t,signal:n,email:th(e),dirty:r}}async function th(e){try{return await e.getEmailSnapshot()}catch{return}}function nh(e){const t=Ce(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}async function rh(e,t,n,r,s){if(r.fail(s),Uo(s)||jo(s)||!r.canHandBack()){r.finishAdoption(!0,s);return}const{options:o}=n;if(!o){He(t,e),r.finishAdoption(!1,s);return}const i=await n.email,l=i&&(o.content!==void 0||i.id!==void 0)?i:void 0,c=typeof o.content=="object"&&"email"in o.content?o.content:void 0;try{await e.reset({...o,signal:o.signal??n.signal,content:l?{...c,email:l}:o.content}),n.dirty&&l&&nh(e),r.canHandBack()&&a.ELEMENT_MAP.set(t,e),r.finishAdoption(!0,s)}catch{He(t,e),r.finishAdoption(!1,s)}}async function sh(e,t,n){a.throwIfAborted(e.signal);const r=new a.Disposable;let s,o;try{const i=await a.waitForElement(e.element,r,e.signal);i&&n(i);const l=xm({hostElementOption:e.element,resolvedElement:i,externalSignal:e.signal,disposable:r}),c=Bm(i);s=c.release;const d=a.composeAbortSignals(l,c.signal);return a.throwIfAborted(d),await a.raceWithAbortSignal(c.previous,d),o=oh(e,i,t,d),await a.raceWithAbortSignal(o,d)}finally{const i=s;o!==void 0&&i?o.then(i,i):i?.(),r.dispose()}}async function oh(e,t,n,r){const{bind:s}=n;a.throwIfAborted(r);let o;const i=m=>{pm();const b=vm(qm(m,t)),v=um(b,()=>o);return{preparedOptions:v,preparedOptionsWithSignal:r!=null?{...v,signal:r}:v}};let l;if(t){const m=a.ELEMENT_MAP.get(t);if(m){let b;try{b=await m,a.throwIfAborted(r)}catch{a.throwIfAborted(r),He(t,m),b=void 0}if(b)if(b.getElement()===t){const v=Gp(t);o=v;const h=b.container.getInstance(a.OPTIONS_SOURCE_ID)?.get();if(Um(t,e,h))return s(b,{adopt:!0}),r&&b.container.getInstance(a.INIT_PIPELINE_ID)?.relinkExternalSignal(r),a.ELEMENT_MAP.set(t,b),b;const _=jm(t);l=i(Un(t,e));const{preparedOptions:y,preparedOptionsWithSignal:S}=l,A=v&&im(v),C=eh(b);try{v&&Mn(v,y),s(b,{adopt:!0});const g=await b.reset(Km(e,S));return a.throwIfAborted(r),a.ELEMENT_MAP.set(t,b),g}catch(g){if(v&&A&&Mn(v,A),!mi(g))throw _(),await rh(b,t,C,n,g),g;n.finishAdoption(!1,g),He(t,m,b),Go(b),a.throwIfAborted(r)}}else He(t,m,b),Go(b)}}a.throwIfAborted(r),l??=i(Un(t,e,{fresh:!0}));const{preparedOptions:c}=l,d=zm(c),u=Wm(c),p=r!=null?{...u.options,signal:r}:u.options;let E;try{o=qp(p),Vp(t,o),Mn(o,c),mn(o).set(p),await bn(),$(W.coreReady),a.throwIfAborted(r),a.throwIfAborted(r),E=$p(p,o,{onInstance:s}),t&&a.ELEMENT_MAP.set(t,E);const m=await E;if(r?.aborted&&(m.destroy(),a.throwIfAborted(r)),t)if(a.ELEMENT_MAP.get(t)===E)a.ELEMENT_MAP.set(t,m);else throw m.destroy(),a.throwIfAborted(r),a.createAbortError(r?.reason);return m}catch(m){throw d(),u.cleanup(),o&&(wo(o),Yp(t,o)),t&&E&&a.ELEMENT_MAP.get(t)===E&&a.ELEMENT_MAP.delete(t),m}}async function ih(e){return(await Ne()).parseAMP(e)}typeof window<"u"&&(Te()&&fi(),Qf(typeof __useblocks__<"u"?__useblocks__:void 0)),X.ELEMENT_DETACHED_ABORT_MESSAGE=Fn,X.SUPERSEDED_INIT_ABORT_MESSAGE=Bn,X.create=Vo,Object.defineProperty(X,"errors",{enumerable:!0,get:function(){return Gm}}),X.getInstance=Zm,Object.defineProperty(X,"helpers",{enumerable:!0,get:function(){return Ym}}),X.init=Qm,X.isElementDetachedError=jo,X.isSupersededInitError=Uo,X.parseAMP=ih,X.pluginRegistry=co,X.preload=Jm,X.version=Xm});
|
|
2182
|
+
}`;function UE(){return()=>{}}function HE(e,t){if(!la()||!e||typeof document>"u")return UE();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=document.createElement("div");n.classList.add("blocks-app-initial-spinner-wrapper");const r=document.createElement("div");r.classList.add("blocks-app-initial-spinner"),n.appendChild(r);const s=document.createElement("style");s.setAttribute(t,"true"),s.textContent=jE,document.head?.appendChild(s),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),s.remove())}}function $E(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function VE({report:e}={}){const t=new Map,n=new Set,r=e??(s=>{});return{run(s,o){const i=t.get(s);if(i!==void 0)return i;const a=o().catch(c=>{throw n.has(s)||(n.add(s),r(c)),$E(c)||t.delete(s),c});return t.set(s,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var Dr=VE();function ca(){Dr.clear()}l.setApiOriginFailoverHook(()=>Dr.clear());var da=new WeakMap;function Pr(e){return l.resolveExplicitApiBaseUrl(e)}function GE(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function YE(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function WE(e){if(!e.getAuthToken)return;const t=await e.getAuthToken(e.user,e.project,void 0),n=String(t||"").trim();return n?`Bearer ${n}`:void 0}var Rr=new WeakMap;function Or(e,t){Rr.set(e,t)}function qE(e){return Rr.get(e)}function zE(e,t){return async({baseUrl:n})=>{const r=t(),s=r&&Rr.get(r)||e,o=Pr(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const i=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await WE(s);if(s.getAuthToken&&!a)throw YE();a&&i.set("authorization",a);const c=await l.fetchWithApiOriginFailover("/app/v1/app_init",{method:"POST",headers:i,body:new URLSearchParams,credentials:"same-origin"},o,{attemptTimeout:$n(s)||void 0});if(!c.ok)throw GE(c.status,c.statusText);return await c.json()}}function KE(e){return JSON.stringify({baseUrl:Pr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function XE(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function JE(e){return t=>Dr.run(KE(t),()=>(W("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>W("appInit:end",{kind:"network"}))))}function QE(e,t){if(Qe(e)||!e.appInit&&!Pr(e.baseUrl)||!XE(e))return e;const n=e.appInit??zE(e,t);let r=da.get(n);return r||(r=JE(n),da.set(n,r)),{...e,appInit:r}}var ua=0;function ZE(){return ua}function ev(){ua+=1,ca()}var fa=new WeakMap,pa=new WeakMap,tv=3e4;function nv(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function rv(e,t){try{const n=l.decodeJwt(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+tv}function sv(e){const t=new Map,n=new Map;return async(r,s,o)=>{const i=nv(r,s);if(o)return n.delete(i),t.delete(i),ca(),e(r,s,o);const a=n.get(i);if(a&&!t.has(i)){if(a.expiresAtMs>Date.now())return a.token;n.delete(i)}let c=t.get(i);return c===void 0&&(W("authToken:start",{kind:"network"}),c=Promise.resolve(e(r,s,o)).then(d=>{const u=String(d||"").trim();return u&&n.set(i,{token:d,expiresAtMs:rv(u,Date.now())}),d}).finally(()=>{W("authToken:end",{kind:"network"}),t.delete(i)}),t.set(i,c)),c}}function ov(e){if(Qe(e))return e;const t=e.getAuthToken;if(!t)return e;let n=fa.get(t);const r=ZE();return(!n||pa.get(t)!==r)&&(n=sv(t),fa.set(t,n),pa.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(s=>{}),{...e,getAuthToken:n}}var iv="[emailmaker] This editor was destroyed: a later init()/create() into the same element failed to start, and the editor could not be handed back. Call init() again; the reason is in `cause`.";function av(e){const t=new Error(iv,{cause:e});return t.name="EditorStartFailedError",t}var lv={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function ha(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var ma=["handleLoad","handleDestroy"];function ga(e,t){let n=e;for(const r of ma){const s=e?.[r];typeof s=="function"&&(n={...n,[r]:(o,...i)=>s(t,...i)})}return n}function cv(e){let t,n="pending",r,s,o,i;const a=new Set,c=[],d=new Set;let u,f;const g=new Promise((I,P)=>{u=I,f=P});g.catch(()=>{});const E={},S=I=>t?.[I],b=()=>r??me(),h=(I,P)=>{const x=S(I);if(typeof x!="function")throw ha(I);return x.apply(t,P)},y=(I,P)=>{try{return Promise.resolve(h(I,P))}catch(x){return Promise.reject(x)}},w=()=>{const I=t?.container?.getInstance?.(l.DISPOSABLE_ID);if(!(n!=="ready"||I?.isDisposed()||typeof S("getConfig")!="function"))try{i=h("getConfig",[])}catch{}},A=()=>n==="dead"?Promise.reject(b()):n==="ready"?Promise.resolve():g,D=()=>{for(const[I,P]of Ht)P==="field"&&(E[I]=S(I))},N=I=>{const P=S(I.name);I.dispose||typeof P!="function"||n==="dead"||(I.dispose=P.apply(t,I.args))},m=()=>a.forEach(N),_=()=>{for(const I of a){try{I.dispose?.()}catch{}I.dispose=void 0}},C=()=>{D(),m()},M=()=>{o?.delete(C),o=void 0},p=(I,P)=>{const[x,...J]=P;return!ma.includes(I)||typeof x!="function"?P:[(re,...z)=>x(E,...z),...J]},v=(I,P)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof S(I)!="function")throw ha(I);const x={name:I,args:p(I,P)};return a.add(x),N(x),()=>{a.delete(x),x.dispose?.(),x.dispose=void 0}},T=()=>t?.container?.getInstance(l.OPTIONS_SOURCE_ID)?.get()?.content,L=()=>{const I=e.element();return I!==void 0&&typeof I!="string"?I:void 0},O=(I,P)=>{switch(P){case"event":return(...x)=>v(I,x);case"async":return(...x)=>(I==="show"&&x[0]!==void 0&&e.shown?.(x[0]),n!=="dead"&&typeof S(I)=="function"?y(I,x):A().then(()=>h(I,x)));case"queued":return(...x)=>{if(n==="dead"){if(I==="notify")return;throw b()}if(n==="pending"){c.push({name:I,args:x});return}return h(I,x)};case"sync":return(...x)=>{if(n==="dead"){if(I==="getConfig")return i;throw b()}if(typeof S(I)!="function")throw new Error(`[emailmaker] \`${I}\` is not available before the editor is ready: ${lv[I]??"await `ready` first"}`);const J=h(I,x);return I==="getConfig"&&(i=J),J};case"element":return()=>{if(typeof S(I)!="function")return L();try{return h(I,[])}catch{return L()}};case"codeErrors":return()=>n==="ready"&&typeof S(I)=="function"?h(I,[]):[];case"field":return}};for(const[I,P]of Ht)E[I]=O(I,P);E.reset=I=>(I?.content!==void 0&&e.shown?.(I.content),A().then(async()=>{const P=I?.content!==void 0&&l.deepEqual(I.content,T());await h("reset",[ga(I,F)]),P&&await h("show",[I.content])}).then(()=>E)),E.destroy=()=>{if(n==="dead")return;const I=l.createAbortError("[emailmaker] editor was destroyed before it was ready");s?.catch(()=>{}),d.forEach(P=>P(I)),w(),e.destroy()},Object.defineProperty(E,"ready",{get:()=>s,enumerable:!0,configurable:!0});const F=E;return{object:F,get state(){return n},get editor(){return t},bind:I=>{n==="dead"||t===I||(_(),M(),t=I,D(),m(),n==="pending"&&(o=I.container.getOrCreateInstance(l.LATE_SURFACE_LISTENERS_ID,()=>new Set),o.add(C)))},settle:()=>{if(n==="pending"){n="ready",M(),D(),m();for(const I of c.splice(0))try{h(I.name,I.args)}catch(P){queueMicrotask(()=>{throw P})}u()}},kill:(I,P)=>{n!=="dead"&&(w(),n="dead",r=I,c.length=0,d.forEach(x=>x(I)),M(),P?.keepSubscriptions||(_(),a.clear()),f(I))},detach:()=>{_(),a.clear()},setReady:I=>{s=I},trackCall:I=>(d.add(I),()=>d.delete(I)),hasCalls:()=>d.size>0}}var Mr="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function dv(){return l.createAbortError(Mr)}function Ea(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Mr}function uv(e,t,n){if(typeof document>"u")return;let r=!1,s;const o=()=>{r=!0,s?.disconnect(),s=void 0},i=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(i);return}s=new MutationObserver(()=>{e.isConnected||i()});let a=e.parentNode;for(;a;)s.observe(a,{childList:!0}),a=a.parentNode}function fv(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:s}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return uv(n,()=>{n.id,o.abort(dv())},s),l.composeAbortSignals(r,o.signal)}var Lr="Superseded by newer init() on the same mount element";function va(){return l.createAbortError(Lr)}function _a(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Lr}var pt=new Map,ba=new WeakMap,Vt=new WeakMap;function pv(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function hv(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=pv(e);(n?pt.get(n):void 0)?.forEach(u=>{u.element!==e&&u.controller.abort(va())});const r=ba.get(e)??new Set;t&&r.forEach(u=>{u.supersedable&&u.controller.abort(va())});const s=Vt.get(e)??Promise.resolve();let o;const i=new Promise(u=>{o=u}),a=s.then(()=>i);Vt.set(e,a),a.then(()=>{Vt.get(e)===a&&Vt.delete(e)});const c=new AbortController,d={element:e,controller:c,supersedable:t};if(r.add(d),ba.set(e,r),n){const u=pt.get(n)??new Set;u.add(d),pt.set(n,u)}return{signal:c.signal,previous:s,release:()=>{o(),r.delete(d);const u=n?pt.get(n):void 0;n&&u?.delete(d)&&u.size===0&&pt.delete(n)}}}var ht=new WeakMap;function Nr(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function xr(e){return Object.entries(e).filter(([t,n])=>Nr(t,n)).map(([t])=>t).sort()}function ya(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!Nr(n,r)&&(t[n]=r);return t}function kr(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:ht.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},ht.set(e,r));const{current:s,trampolines:o}=r;s.clear();const i={...t};for(const a of xr(t)){s.set(a,t[a]);let c=o.get(a);c||(c=(...d)=>s.get(a)?.(...d),o.set(a,c)),i[a]=c}return r.lastOptions=t,i}function Sa(e,t){const n=e?ht.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const s=t[r];Nr(r,s)?n.current.set(r,s):n.current.delete(r)}}function mv(e){const t=e?ht.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((s,o)=>t.current.set(o,s)),t.lastOptions=r}}function gv(e,t,n){const r=e?ht.get(e):void 0;if(!r||!n)return!1;const s=xr(t),o=l.deepEqual(s,xr(r.lastOptions)),i=s.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!o||!i||!l.deepEqual(ya(t),ya(r.lastOptions))?!1:(kr(e,t),!0)}var le=new WeakMap,E_=0;function Gt(e){let t=le.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},le.set(e,t)),t}var ve=e=>e!==void 0&&e.state!=="dead";function Ev(e){const t=le.get(e)?.shared;return ve(t)?t:void 0}function vv(e,t){Gt(e).shared=t}function _v(e,t){!(ve(e.shared)&&[...e.counted].some(ve))||e.warned||!t.devTools||(e.warned=!0)}function bv(e,t,n,r){const s=Gt(e);return s.latestCall+=1,s.releaseTimer!==void 0&&(clearTimeout(s.releaseTimer),s.releaseTimer=void 0),s.leaving.forEach(o=>o.detach()),s.leaving.clear(),n==="single"?s.shared=t:s.counted.add(t),s.options.set(t,r),s.order=[...s.order.filter(o=>o!==t&&ve(o)),t],_v(s,r),s.latestCall}function yv(e,t){return le.get(e)?.latestCall===t}function Sv(e){const t=le.get(e);if(t)return t.order=t.order.filter(ve),t.order.at(-1)?.object}function mt(e,t){const n=le.get(e);return n?ve(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&ve(r)):!1}function Iv(e,t){const n=le.get(e),r=n?.order.filter(s=>s!==t&&ve(s)).at(-1);return r?n?.options.get(r):void 0}function Ia(e,t){Gt(e).content={value:t}}function wv(e){return le.get(e)?.content}function Tv(e,t,n,r){const s=Gt(e);if(s.counted.delete(t),s.options.delete(t),mt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),s.leaving.add(t),wa(e,r)}function wa(e,t){const n=le.get(e);!n||mt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!mt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function Cv(e,t){const n=le.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);le.delete(e)}}var Av=Kt.__exportAll({FileManagerApiError:()=>Dv,IntegratorSaveTimeoutError:()=>an,SaveRefusedError:()=>Ye}),Dv=class Da extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,s){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=s,Error.captureStackTrace&&Error.captureStackTrace(this,Da)}},Pv=Kt.__exportAll({mapHttpStatusToErrorCode:()=>l.mapHttpStatusToErrorCode});function Rv(e,t){return{...e,element:t}}function Fr(){return()=>{}}function Ov(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?Fr():(FE(t,e.config?.styles,t),()=>{BE(t)})}function Mv(e){if(!la()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:Fr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:Fr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.remove()});const n=HE(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Lv(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function Yt(e){try{e.destroy()}catch{}}function Wt(e,...t){const n=l.ELEMENT_MAP.get(e);t.some(r=>r!==void 0&&r===n)&&l.ELEMENT_MAP.delete(e)}var Nv="1.1.102";async function xv(e){An(),await dg(typeof __useblocks__<"u"?__useblocks__:void 0)}async function kv(e){return Ta(e).ready}function Fv(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function Bv(e){const t=l.ELEMENT_MAP.get(e);return t&&!(t instanceof Promise)?t:void 0}function qt(e,t,n){const r=t??Bv(e);r&&(Wt(e,r),Yt(r)),Cv(e,n)}function jv(e){const{control:t,mode:n,ref:r}=e,s=r.host;if(!s){const i=t.editor;Uv(i),t.kill(me());return}if(n==="single"){qt(s,t.editor,me());return}const o=Iv(s,t);Tv(s,t,me(),()=>qt(s,t.editor,me())),o&&mt(s)&&Sa(s,o)}function Uv(e){e&&Yt(e)}function Ta(e){W(te.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=l.composeAbortSignals(e.signal,n.signal),s=t==="single"?Fv(e.element):void 0,o=s?Ev(s):void 0;let i;if(o)i={control:o,mode:t,ref:{host:s}};else{const u={},f=cv({element:()=>u.host??e.element,destroy:()=>jv(i),shown:g=>{u.host&&Ia(u.host,g)}});i={control:f,mode:t,ref:u},s&&vv(s,f)}const{control:a}=i,c=a.trackCall(u=>n.abort(u)),d=Wv(ga({...e,signal:r},a.object),i).then(()=>(c(),W(te.initEnd),a.settle(),a.object),u=>{c(),a.state==="pending"&&!a.hasCalls()&&a.kill(u);const f=i.ref.host;throw f&&wa(f,()=>qt(f,void 0,me())),u});return a.setReady(d),a.object}function Hv(e){const t=typeof e=="string"?document.querySelector(e):e;return t?Sv(t):void 0}function $v(e){let t,n,r=!1;try{t=e.container.getInstance(l.OPTIONS_SOURCE_ID)?.get(),n=e.container.getInstance(l.INIT_PIPELINE_ID)?.externalSignal;const s=Me(e.container)?.current();r=s!==void 0&&s.get().savedVersion!==null&&s.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Vv(e),dirty:r}}async function Vv(e){try{return await e.getEmailSnapshot()}catch{return}}function Gv(e){const t=Me(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Ca(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||mt(e,n)}async function Yv(e,t,n,r,s){if(r.mode==="counted"&&r.control.detach(),_a(s)||Ea(s))return;const o=()=>qt(t,e,av(s)),{options:i}=n;if(!i||!Ca(t,r)){o();return}const a=await n.email,c=a&&(i.content!==void 0||a.id!==void 0)?a:void 0,d=typeof i.content=="object"&&"email"in i.content?i.content:void 0;try{await e.reset({...i,signal:i.signal??n.signal,content:c?{...d,email:c}:i.content}),n.dirty&&c&&Gv(e),Ca(t,r)?l.ELEMENT_MAP.set(t,e):o()}catch{o()}}async function Wv(e,t){l.throwIfAborted(e.signal);const n=new l.Disposable;let r,s,o,i,a=0;try{const c=await l.waitForElement(e.element,n,e.signal);c&&(i=c,t.ref.host=c,a=bv(c,t.control,t.mode,e));const d=fv({hostElementOption:e.element,resolvedElement:c,externalSignal:e.signal,disposable:n}),u=hv(c,{supersede:t.mode==="single"});r=u.release;const f=l.composeAbortSignals(d,u.signal);l.throwIfAborted(f),o=mv(c),Sa(c,e),await l.raceWithAbortSignal(u.previous,f),s=qv(e,c,t,f,o);const g=await l.raceWithAbortSignal(s,f);return c&&e.content!==void 0&&Ia(c,e.content),g}catch(c){throw i&&o&&yv(i,a)&&o(),c}finally{const c=r;s!==void 0&&c?s.then(c,c):c?.(),n.dispose()}}async function Aa(e,t,n,r){const s=wv(t);n===void 0||r||!s||l.deepEqual(n,s.value)||await e.show(n)}async function qv(e,t,n,r,s){const{control:o}=n,i=b=>o.bind(b);l.throwIfAborted(r);let a;const c=b=>{ev();const h=ov(Rv(b,t)),y=QE(h,()=>a);return{preparedOptions:y,preparedOptionsWithSignal:r!=null?{...y,signal:r}:y}};let d;if(t){const b=l.ELEMENT_MAP.get(t);if(b){let h;try{h=await b,l.throwIfAborted(r)}catch{l.throwIfAborted(r),Wt(t,b),h=void 0}if(h)if(h.getElement()===t){const y=OE(t);a=y;const w=h.container.getInstance(l.OPTIONS_SOURCE_ID)?.get();if(gv(t,e,w))return i(h),r&&h.container.getInstance(l.INIT_PIPELINE_ID)?.relinkExternalSignal(r),l.ELEMENT_MAP.set(t,h),await Aa(h,t,e.content,!1),h;const A=!l.deepEqual(e.content,w?.content);d=c(kr(t,e));const{preparedOptions:D,preparedOptionsWithSignal:N}=d,m=y&&qE(y),_=$v(h);try{y&&Or(y,D),i(h);const C=await h.reset(Lv(e,N));return l.throwIfAborted(r),l.ELEMENT_MAP.set(t,h),await Aa(h,t,e.content,A),C}catch(C){if(y&&m&&Or(y,m),!Za(C))throw s(),await Yv(h,t,_,n,C),C;Wt(t,b,h),Yt(h),l.throwIfAborted(r)}}else Wt(t,b,h),Yt(h)}}l.throwIfAborted(r),d??=c(kr(t,e,{fresh:!0}));const{preparedOptions:u}=d,f=Ov(u),g=Mv(u),E=r!=null?{...g.options,signal:r}:g.options;let S;try{a=NE(E),ME(t,a),Or(a,u),lr(a).set(E),await hr(),W(te.coreReady),l.throwIfAborted(r),l.throwIfAborted(r),S=RE(E,a,{onInstance:i}),t&&l.ELEMENT_MAP.set(t,S);const b=await S;if(r?.aborted&&(b.destroy(),l.throwIfAborted(r)),t)if(l.ELEMENT_MAP.get(t)===S)l.ELEMENT_MAP.set(t,b);else throw b.destroy(),l.throwIfAborted(r),l.createAbortError(r?.reason);return b}catch(b){throw f(),g.cleanup(),a&&(ia(a),LE(t,a)),t&&S&&l.ELEMENT_MAP.get(t)===S&&l.ELEMENT_MAP.delete(t),b}}async function zv(e){return(await ct()).parseAMP(e)}typeof window<"u"&&(He()&&Ja(),fg(typeof __useblocks__<"u"?__useblocks__:void 0)),ne.ELEMENT_DETACHED_ABORT_MESSAGE=Mr,ne.SUPERSEDED_INIT_ABORT_MESSAGE=Lr,ne.create=Ta,Object.defineProperty(ne,"errors",{enumerable:!0,get:function(){return Av}}),ne.getInstance=Hv,Object.defineProperty(ne,"helpers",{enumerable:!0,get:function(){return Pv}}),ne.init=kv,ne.isElementDetachedError=Ea,ne.isSupersededInitError=_a,ne.parseAMP=zv,ne.pluginRegistry=Yi,ne.preload=xv,ne.version=Nv});
|
|
2159
2183
|
|
|
2160
2184
|
|
|
2161
2185
|
// Возвращаем API из entry модуля
|
|
2162
2186
|
return __useblocks__.syncRequire("useblocks.js");
|
|
2163
2187
|
});
|
|
2164
2188
|
|
|
2165
|
-
__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/
|
|
2189
|
+
__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/11b821ed.js":[],"static/core/160bf060.js":[],"static/core/1b68c0f0.js":[],"static/core/1ed86ed3.js":[],"static/core/26cc947d.js":[],"static/core/3ec42945.js":[],"static/core/3fb172c7.js":[],"static/core/3fd50a29.js":[],"static/core/448f03f8.js":[],"static/core/44d2c046.js":[],"static/core/48da14fd.js":[],"static/core/4c8d0155.js":[],"static/core/53103851.js":["static/core/ae22b7f6.js","__delivery__/libs"],"static/core/5d849eef.js":[],"static/core/5e7c221f.js":["__delivery__/libs"],"static/core/64be048b.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/6561b34a.js":[],"static/core/6a671446.js":["static/core/5d849eef.js"],"static/core/756874c6.js":[],"static/core/7b850506.js":[],"static/core/847338a8.js":["static/core/ae22b7f6.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/91e07171.js":["static/core/ae22b7f6.js","static/core/53103851.js","static/core/d7666ad0.js","static/core/edf450a1.js","__delivery__/libs"],"static/core/a2e57e5f.js":[],"static/core/a6303cb2.js":["static/core/ff7d14e8.js"],"static/core/a98b6879.js":["static/core/b653f9c5.js"],"static/core/ae22b7f6.js":["static/core/e7620593.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/b653f9c5.js":[],"static/core/b7aa9fec.js":["static/core/5d849eef.js","static/core/b653f9c5.js","static/core/a98b6879.js"],"static/core/ca4dad9b.js":["static/core/53103851.js","static/core/5e7c221f.js","__delivery__/libs","static/core/ae22b7f6.js"],"static/core/cc180859.js":[],"static/core/d7666ad0.js":["static/core/ae22b7f6.js","__delivery__/libs"],"static/core/dcc37768.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/e7620593.js":[],"static/core/edf450a1.js":["static/core/5e7c221f.js","__delivery__/libs"],"static/core/f1ee2bef.js":[],"static/core/f323e60e.js":["static/core/b653f9c5.js"],"static/core/fb2fe2db.js":[],"static/core/ff7d14e8.js":[],"static/monaco/editor.api-C9c1WLns.js":[],"monaco":["static/monaco/editor.api-C9c1WLns.js","static/monaco/lspLanguageFeatures-DY3n8M13.js"],"static/monaco/lspLanguageFeatures-DY3n8M13.js":["static/monaco/editor.api-C9c1WLns.js"],"useblocks.js":[],"static/umd/6639d610.js":["static/umd/b11043e6.js"],"static/umd/b11043e6.js":[],"static/umd/d786efbb.js":[],"static/umd/e8914784.js":[]},"bundles":{"static/core/5e7c221f.js":["static/core/c57eb9c3.js","static/core/9242dd6e.js","static/core/9977c164.js"],"static/core/6a671446.js":["static/core/a71c4cd8.js"],"static/core/847338a8.js":["static/core/8daf15a4.js"],"static/core/edf450a1.js":["static/core/a73da823.js"],"static/core/ca4dad9b.js":["static/core/56ce0894.js"],"core":["static/core/2ff39ddf.js","static/core/c1dc75d5.js","static/core/d68c5a64.js","static/core/c75aa9c7.js","static/core/3c41f519.js"]}});
|