useblocks 1.1.85-dev.10 → 1.1.85-dev.11
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/README.md +70 -40
- package/compat-globals.js +1 -1
- package/iframe/.vite/manifest.json +4 -4
- package/iframe/js/discussHandlers.sDXLf5I7.js +88 -0
- package/iframe/js/{iframe-eblock.body.js → iframe-eblock.body.714faf8a.js} +1 -1
- package/iframe/js/iframe-eblock.js +2 -2
- package/iframe/js/{iframe.body.js → iframe.body.714faf8a.js} +35 -35
- package/iframe/js/iframe.js +2 -2
- package/package.json +4 -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/11bc33e0.js +1 -0
- package/static/core/1ed86ed3.js +1 -0
- package/static/core/248de796.js +1 -0
- package/static/core/{e50b6f57.js → 274b5d7a.js} +1 -1
- package/static/core/4067c5be.js +1 -0
- package/static/core/453596ac.js +27 -0
- package/static/core/4b12ae50.js +1 -0
- package/static/core/{db82c42b.js → 50d547f6.js} +1 -1
- package/static/core/549c0ef1.js +1 -0
- package/static/core/{b29146b3.js → 563a690f.js} +5 -5
- package/static/core/{c1bf6439.js → 5c62f38b.js} +1 -1
- package/static/core/5f949f39.js +1 -0
- package/static/core/{e0d71533.js → 60aa31a3.js} +6 -6
- package/static/core/{79749848.js → 66619f08.js} +7 -7
- package/static/core/7052d050.js +28 -0
- package/static/core/{984e936f.js → 7555e955.js} +1 -1
- package/static/core/{55a38638.js → 7c89682e.js} +7 -7
- package/static/core/83c17079.js +2 -0
- package/static/core/{4c83d06a.js → 8c5284f6.js} +1 -1
- package/static/core/{e0e5c9b9.js → 958fe93e.js} +2 -2
- package/static/core/{6fcb3c31.js → a3f7b4c9.js} +1 -1
- package/static/core/{9560f31a.js → a494cc9f.js} +1 -1
- package/static/core/{a5996860.js → a6303cb2.js} +1 -1
- package/static/core/b8a0f663.js +1 -0
- package/static/core/bb65f553.js +1 -0
- package/static/core/{4c3f5897.js → c2f990cf.js} +2 -2
- package/static/core/{72d350ea.js → c8d6258e.js} +1 -1
- package/static/core/{3ece766f.js → d58ae4ac.js} +2 -2
- package/static/core/d61988e0.js +7 -0
- package/static/core/d887672a.js +1 -0
- package/static/core/dcc37768.js +1 -0
- package/static/core/{30841c46.js → e50f64f6.js} +1 -1
- package/static/core/{175b5b0f.js → ff7d14e8.js} +1 -1
- package/static/esm/2490dab8.js +1 -0
- package/static/esm/971f1b2c.js +1 -0
- package/static/esm/ad8c16a9.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.js +1 -1
- package/static/umd-runtime/ui-kit-icons.js +1 -1
- package/static/umd-runtime/ui-kit.js +2 -2
- package/static/umd-runtime/{DP3QTW77.js → uk9LyZos.js} +1 -1
- package/useblocks-core.714faf8a.js +859 -0
- package/useblocks-esm.js +11 -11
- package/{useblocks-po.8098d114.js → useblocks-po.714faf8a.js} +1 -1
- package/useblocks.d.ts +109 -25
- 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/package.json +1 -1
- package/iframe/js/discussHandlers.CCCXIEaO.js +0 -88
- package/static/core/1f101241.js +0 -1
- package/static/core/1fa93ad8.js +0 -28
- package/static/core/2007bc93.js +0 -1
- package/static/core/30ab7b1d.js +0 -1
- package/static/core/440a91be.js +0 -1
- package/static/core/44e96a78.js +0 -1
- package/static/core/823aedee.js +0 -1
- package/static/core/828583e1.js +0 -2
- package/static/core/8cc6e392.js +0 -1
- package/static/core/9aefcefb.js +0 -1
- package/static/core/a4f90443.js +0 -27
- package/static/core/a7ac37cd.js +0 -1
- package/static/core/df41de18.js +0 -7
- 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/useblocks-core.8098d114.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/iframe/{iframe-eblock.8098d114.html → iframe-eblock.714faf8a.html} +0 -0
- /package/iframe/{iframe.8098d114.html → iframe.714faf8a.html} +0 -0
package/useblocks-esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{n as Oo,r as sl}from"./static/esm/971f1b2c.js";import{$ as xo,A as al,At as z,B as ll,C as cl,Ct as ul,D as dl,Dt as le,E as fl,Et as pl,F as hl,Ft as ml,G as gl,H as vl,I as Mo,It as bl,J as Ye,K as yl,L as El,Lt as Z,M as _l,Mt as tt,N as wl,Nt as N,O as Sl,Ot as Lo,P as Er,Pt as Ee,R as Il,S as ai,St as zn,T as _r,Tt as Cl,U as Tl,V as Ft,W as At,X as li,Y as wr,Z as Rt,_ as Al,_t as Pt,a as Rl,at as we,b as Pl,bt as Ae,c as ko,ct as te,d as Dl,dt as Ol,et as Re,f as Dt,ft as xl,g as Sr,gt as F,h as Ml,ht as Ll,i as kl,it as H,j as Nl,jt as Fl,k as No,kt as en,l as jl,lt as Ir,m as Bl,mt as Ul,n as Hl,nt as Fo,o as $l,ot as fn,p as Vl,pt as ci,q as ql,r as Gl,rt as ee,s as it,st as Cr,t as ce,tt as jo,u as $,ut as Se,v as Bo,vt as se,w as zl,wt as ui,x as Wl,xt as Kl,y as Ie,yt as Qe,z as Tr}from"./static/esm/ad8c16a9.js";import{t as Yl}from"./static/esm/f76c9d9d.js";(function(){"use strict";var e=window.__useblocks__=window.__useblocks__||{};e.__facadeSentinel="@shared-runtime:init-complete",e.publicPath||(e.publicPath=(function(){var m=(function(){if(typeof document<"u"&&document.querySelector)try{var D=document.querySelector('script[src*="useblocks-esm.js"]')||document.querySelector('script[src*="useblocks.js"]');if(D&&D.src)return D.src.substring(0,D.src.lastIndexOf("/")+1)}catch{}try{var B=import.meta.url;if(B)return B.substring(0,B.lastIndexOf("/")+1)}catch{}return"./"})();m||(m="./");try{var c=String(m);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(c)||c.indexOf("//")===0)return c.charAt(c.length-1)==="/"?c:c+"/";var f=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",g=f?new URL(c,f).href:c;return g.charAt(g.length-1)==="/"?g:g+"/"}catch{var P=String(m);return P.charAt(P.length-1)==="/"?P:P+"/"}})()),typeof e.setPublicPath!="function"&&(e.setPublicPath=function(m){return e.publicPath=(function(){var c=m==null?"":String(m);c||(c="./");try{var f=String(c);if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(f)||f.indexOf("//")===0)return f.charAt(f.length-1)==="/"?f:f+"/";var g=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"",P=g?new URL(f,g).href:f;return P.charAt(P.length-1)==="/"?P:P+"/"}catch{var D=String(c);return D.charAt(D.length-1)==="/"?D:D+"/"}})(),e.publicPath}),e.__publicPathDiagnosticsLogged||(e.__publicPathDiagnosticsLogged=!0,(function(){var m=String(e.publicPath||"");if(m.indexOf("file:")!==0&&!(m&&m!=="./")){var c="";try{if(typeof window<"u"){for(var f in window)if(!(f==="__useblocks__"||!/^__[^_].*__$/.test(f))){var g;try{g=window[f]}catch{continue}if(g&&typeof g=="object"&&g.publicPath){c=" Another product namespace ("+f+") has publicPath set — verify the host bundler plugin matches the installed npm brand.";break}}}}catch{}}})()),e.assetUrl||(e.assetUrl=function(m){function c(T){try{var O=typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:"";return O?new URL(String(T||""),O).href:String(T||"")}catch{return String(T||"")}}var f=String(m||"");if(!f)return"";if(/^(?:data:|blob:)/.test(f))return f;if(/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(f)||f.indexOf("//")===0||f.charAt(0)==="/")return c(f);var g=f.replace(/^\.\/+/,"").replace(/^\/+/,""),P="static/media".replace(/^\.\/+/,"").replace(/^\/+/,"").replace(/\/+$/,""),D=P&&g.indexOf(P+"/")!==0?P+"/"+g:g,B=e.publicPath||"./";try{return new URL(D,B).href}catch{return B.slice(-1)!=="/"&&(B+="/"),c(B+D)}}),e.version||(e.version="1.1.85-dev.11");var t=e.modules=Object.create(null);if(typeof e.define!="function"){var n=`/**
|
|
2
2
|
* Async AMD Loader (IIFE version for injection)
|
|
3
3
|
*
|
|
4
4
|
* This file is injected at the beginning of iframe entry points.
|
|
@@ -993,15 +993,15 @@ import{t as Bi}from"./static/esm/50fbfdf6.js";import{$ as Ns,A as Fs,At as N,B a
|
|
|
993
993
|
__amdEnv.syncRequire = syncRequire;
|
|
994
994
|
__amdEnv.diagnosticsBuffer = diagBuffer;
|
|
995
995
|
})();
|
|
996
|
-
`,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"useblocks-core.
|
|
997
|
-
`),c="",p=0;p<a.length;p+=1){var A=/((?:https?|file|blob):\/\/[^\s()]+?)(?::\d+){1,2}\)?\s*$/.exec(a[p]);if(A){if(!c){c=A[1];continue}if(A[1]!==c)return A[1]}}return""},b=function(f){var a=E(new Error(f));return a?f+" Requested by: "+a+".":f};if(e.registerCompat=function(f){if(!(!f||typeof f!="object"))for(var a in f)Object.prototype.hasOwnProperty.call(f,a)&&(g[a]=f[a])},e.__compatPending){for(var w=0;w<e.__compatPending.length;w+=1)e.registerCompat(e.__compatPending[w]);e.__compatPending=void 0}for(var _ in d)Object.prototype.hasOwnProperty.call(d,_)&&(function(f,a,c,p){var A=!1,x=!1,j=function(){if(!(f in g))throw new Error(b(a));return g[f]};Object.defineProperty(t,f,{configurable:!0,enumerable:!0,get:function(){if(p&&!(f in g)){x||(x=!0);return}var C=j();return A||(A=!0),C},set:function(C){g[f]=C}}),Object.defineProperty(l,f,{configurable:!0,enumerable:!0,get:j,set:function(C){g[f]=C}})})(_,d[_],u[_],h[_]);var m=t;for(var S in l)Object.prototype.hasOwnProperty.call(l,S)&&(m===t&&(m=Object.create(t)),Object.defineProperty(m,S,Object.getOwnPropertyDescriptor(l,S)));var y=s,I=[],T=function(){for(var f=[],a=0;a<I.length;a+=1)(function(c){var p=t[c];p&&typeof p.then=="function"&&f.push(Promise.resolve(p).then(function(A){t[c]=A}))})(I[a]);return Promise.all(f)},R=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(T).then(function(){if(typeof R=="function")return R.call(e)})},typeof e.define=="function"){let f=function(a){if(!a||typeof a!="object"&&typeof a!="function"||a.__esModule)return a;if(v){var c=v.get(a);if(c)return c}var p=Object.create(null);Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var A=Reflect.ownKeys(a),x=0;x<A.length;x++){var j=A[x];if(j!=="__esModule"){var C=Object.getOwnPropertyDescriptor(a,j);C&&Object.defineProperty(p,j,C)}}return Object.prototype.hasOwnProperty.call(p,"default")||Object.defineProperty(p,"default",{enumerable:!0,value:a,writable:!1}),v&&v.set(a,p),p};var v=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var a=m.React;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.React)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.React;return f(p)})}),e.define("useblocks/runtime/react",[],function(){var a=m.React;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.React)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.React;return f(p)})}),e.define("react-dom",[],function(){var a=m.ReactDom;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactDom)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactDom;return f(p)})}),e.define("useblocks/runtime/react-dom",[],function(){var a=m.ReactDom;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactDom)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactDom;return f(p)})}),e.define("react-dom/client",[],function(){var a=m.ReactDomClient;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactDomClient)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactDomClient;return f(p)})}),e.define("useblocks/runtime/react-dom/client",[],function(){var a=m.ReactDomClient;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactDomClient)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactDomClient;return f(p)})}),e.define("react/jsx-runtime",[],function(){var a=m.ReactJsxRuntime;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactJsxRuntime)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactJsxRuntime;return f(p)})}),e.define("useblocks/runtime/react/jsx-runtime",[],function(){var a=m.ReactJsxRuntime;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactJsxRuntime)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactJsxRuntime;return f(p)})}),e.define("react/jsx-dev-runtime",[],function(){var a=m.ReactJsxDevRuntime;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactJsxDevRuntime)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactJsxDevRuntime;return f(p)})}),e.define("useblocks/runtime/react/jsx-dev-runtime",[],function(){var a=m.ReactJsxDevRuntime;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.ReactJsxDevRuntime)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.ReactJsxDevRuntime;return f(p)})}),e.define("antd",[],function(){var a=m.Antd;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.Antd)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.Antd;return f(p)})}),e.define("useblocks/runtime/antd",[],function(){var a=m.Antd;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.Antd)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.Antd;return f(p)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var a=m.AntDesignIconBase;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.AntDesignIconBase)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.AntDesignIconBase;return f(p)})}),e.define("useblocks/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var a=m.AntDesignIconBase;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.AntDesignIconBase)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.AntDesignIconBase;return f(p)})}),e.define("@ant-design/icons",[],function(){var a=m.AntDesignIcons;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.AntDesignIcons)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.AntDesignIcons;return f(p)})}),e.define("useblocks/runtime/@ant-design/icons",[],function(){var a=m.AntDesignIcons;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.AntDesignIcons)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.AntDesignIcons;return f(p)})}),e.define("@ant-design/cssinjs",[],function(){var a=m.AntDesignCssinjs;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.AntDesignCssinjs)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.AntDesignCssinjs;return f(p)})}),e.define("useblocks/runtime/@ant-design/cssinjs",[],function(){var a=m.AntDesignCssinjs;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.AntDesignCssinjs)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.AntDesignCssinjs;return f(p)})}),e.define("classnames",[],function(){var a=m.Classnames;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.Classnames)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.Classnames;return f(p)})}),e.define("useblocks/runtime/classnames",[],function(){var a=m.Classnames;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.Classnames)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.Classnames;return f(p)})}),e.define("dayjs",[],function(){var a=m.Dayjs;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.Dayjs)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.Dayjs;return f(p)})}),e.define("useblocks/runtime/dayjs",[],function(){var a=m.Dayjs;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.Dayjs)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.Dayjs;return f(p)})}),e.define("useblocks-ui-kit",[],function(){var a=m.UiKit;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.UiKit)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.UiKit;return f(p)})}),e.define("useblocks/ui-kit",[],function(){var a=m.UiKit;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.UiKit)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.UiKit;return f(p)})}),e.define("useblocks/ui-kit/icons",[],function(){var a=m.UiKitIcons;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.UiKitIcons)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.UiKitIcons;return f(p)})}),e.define("useblocks-ui-kit/icons",[],function(){var a=m.UiKitIcons;return a&&typeof a.then=="function"?a.then(function(c){return c===void 0?y.then(function(p){return f(p.UiKitIcons)}):f(c)}):a!==void 0?f(a):y.then(function(c){var p=c.UiKitIcons;return f(p)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Aa=new Function("url","return import(url)");function Ca(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Ta(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Ra(e){return e.type==="umd"||e.resolve==="registry"}var Pa=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(Ta(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(Ra(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Aa(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:i,options:o}=await this._resolveEntry(r),s=this._getOrCreate(i,o);n.has(s)||(n.add(s),t.push(s))}this._activated=!0,await this._startPluginsBatch(t)}async setPlugins(e){const t=new Set,n=[];for(const s of e){const l=await this._resolveEntry(s);t.add(l.ctor),n.push(l)}const r=[];this._map.forEach((s,l)=>{t.has(l)||r.push({key:l,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:l,plugin:d}=r[s];await this._initializingPlugins.get(d),await this._disposePlugin(d,d.constructor.name),this._map.delete(l),this._optionsMap.delete(l),this._readyMap.delete(d),this._resolveMap.delete(d),this._initializingPlugins.delete(d),this._initializedPlugins.delete(d);const u=this._creationOrder.indexOf(d);u>=0&&this._creationOrder.splice(u,1)}const i=[],o=new Set;for(const{ctor:s,options:l}of n){const d=this._getOrCreate(s,l);o.has(d)||(o.add(d),i.push(d))}this._activated&&await this._startPluginsBatch(i)}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,i)=>{let o,s=!1;const l=()=>{s||(s=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,l),r())};this._pluginRegistry.on(e,l),n!==void 0&&n>0&&(o=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,l),i(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),i=this._createPluginInstance(e,r),o=i.constructor.name;this._emitLifecycle({type:"created",plugin:i,name:o}),i.required?.(),this._map.set(n,i),this._creationOrder.push(i),this._setupReadyPromise(i)}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 Ca(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 i of t){if(this._initializedPlugins.has(i))continue;const o=this._initializingPlugins.get(i);if(o){n.add(o);continue}r.push(i)}if(r.length>0){const i=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,i);n.add(i),i.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===i&&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(i){this._emitLifecycle({type:"init:error",plugin:n,name:r,error:i})}}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(i){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:i})}}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)}))}},Da=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 i of n)try{i.callback(t)}catch{}const r=n.filter(i=>!i.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(i=>(t.ctor=i,t.loading=void 0,this._notifyListeners(e,i),i));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 i={callback:t,once:!1};return r.push(i),{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 i={callback:t,once:!0};return r.push(i),{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(i=>i.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)}}}},Oa=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()}},Ar=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 xa(e,t){return t+e}function Ma(){return typeof performance>"u"?Date.now():xa(performance.now(),performance.timeOrigin)}var La="emailmaker:diagnostics",ka="diagnostics",Na="diagnostics";function Cr(e,t){return t?`${e}${e.includes("?")?"&":"?"}${Na}=1`:e}var zt;function Fa(){try{const e=new URLSearchParams(window.location.search).get(ka);return e===null?void 0:e!=="0"}catch{return}}function ja(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function Ba(){try{const e=window.localStorage.getItem(La);return e===null?void 0:e==="1"}catch{return}}function tt(){return zt===void 0&&(zt=typeof window>"u"?!1:Fa()??ja()??Ba()??!1),zt}function Ua(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var Z={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"},nv=Object.values(Z),rv=[Z.canvasPainted,Z.canvasSettled,Z.appVisible,Z.editorVisible],Ha=5e3,$a=3e3,Tr="diagnosticsStore",ut,ze;function Rr(){return{marks:new Ar(Ha),resources:new Ar($a)}}function Ki(){if(ze)return ze;const e=Wn();return e?(ze=e[Tr]??ut??Rr(),e[Tr]=ze,ut=void 0,ze):(ut??=Rr(),ut)}function W(e,t){tt()&&Ki().marks.push({phase:e,at:Ma(),...t})}function Wn(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[Ua()];return e!==null&&typeof e=="object"?e:void 0}function Ga(e){const t=e.length,n=Ki();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function qa(){const e=Wn();return!e||!Array.isArray(e.diagnosticsBuffer)?0:Ga(e.diagnosticsBuffer)}var za="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function Yn(){const e=new Error(za);return e.name="DestroyedInstanceError",e}function Va(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function _n(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,s=t;return o.length===s.length&&o.every((l,d)=>_n(l,s[d]))}const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&_n(e[o],t[o]))}function Wi(e,t){const n={watch(r){let i,o=!1;return e.watch(s=>{const l=t(s);o&&_n(i,l)||(i=l,o=!0,r(l))})},select(r){return Wi(n,r)}};return n}function Ce(...e){let t=e[0],n=e.length>0;const r=new Set,i={get(){return n?t:void 0},set(o){t=o,n=!0;for(const s of Array.from(r))s(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return Wi(i,o)}};return i}var Yi=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:ra.UrlEncoded,...t})},Xi=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 Ka(e){return String(e||"").trim()||void 0}var Wa=class extends Q{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=Ka(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)}},Xn=N("AppInitService");function Ya(e){return async()=>{const t=await e();return(await new Yi(t).app_init_create({})).data}}function Xa(e){e.injectFactory(Xn,(t,n)=>{if(n)return n;const r=new Wa({options:e.getInstance(ne),isStandalone:()=>!!e.getInstance(Ee),resolveRestBaseUrl:i=>i?Sr(i):Sr()||void 0,setRestBaseUrl:i=>{e.getInstance(wa)?.setOptions(i?{baseUrl:i}:{})},fallbackAppInit:Ya(()=>e.getInstanceAsync(qs)),publish:i=>{e.inject(Fe,i)}});return e.getInstance(B)?.addDisposable(r),r},!0)}var Jn=N("documentSession.emailDocuments");function Ye(e){return e?.getInstance(Jn)}var Ja=N("RevisionServiceFlag");function Qa(e){return e.getOrCreateInstance(Ja,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function Ji(e){return Qa(e).isEnabled()}var Za=N("EmailRightsResolver");function el(e,t){const n=e.getInstance(Za);return n?n(t):!0}var Qi=N("EmailHistoryAvailabilityResolver");function tl(e){return e.getInstance(Qi)!==void 0}async function nl(e){const t=e.getInstance(Qi);if(!t)return!0;try{return await t()}catch{return!1}}var Qn={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Zi=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],eo=2e4,rl=Zi.reduce((e,t)=>e+Qn[t],0),to=eo+rl+3e3;function il(e){return Zi.reduce((t,n)=>t+no(n,e),0)}function no(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:Qn[e]}function ro(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:to}function io(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:eo}function Zn(e=to){return e+3e3}function oo(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}var ol=()=>Zn();function sl(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function al(e){return t=>sl(e.getOrCreateInstance($.BEFORE_SAVE_EMAIL,()=>new be).fire(t),ol())}function ll(e){return e!=null&&e!==""}var dl;function Ft(e,t){return dl?.capture(e,t)}function cl(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function ft(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var le=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} "${ft(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${ft(this.oldText)}")`:`(replace@${this.oldPosition} "${ft(this.oldText)}" with "${ft(this.newText)}")`}};function Pr(e,t){return e===null||e.length===0?t:new ul(e,t).compress()}var ul=class ue{_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),i=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(i===null)break;this._acceptCurr(i),i=this._getCurr(++n);continue}if(i===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldEnd<=r.newPosition){this._acceptCurr(i),i=this._getCurr(++n);continue}if(r.newEnd<=i.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldPosition<r.newPosition){const[d,u]=ue._splitCurr(i,r.newPosition-i.oldPosition);this._acceptCurr(d),i=u;continue}if(r.newPosition<i.oldPosition){const[d,u]=ue._splitPrev(r,i.oldPosition-r.newPosition);this._acceptPrev(d),r=u;continue}let s,l;if(i.oldEnd===r.newEnd)s=r,l=i,r=this._getPrev(++t),i=this._getCurr(++n);else if(i.oldEnd<r.newEnd){const[d,u]=ue._splitPrev(r,i.oldLength);s=d,l=i,r=u,i=this._getCurr(++n)}else{const[d,u]=ue._splitCurr(i,r.newLength);s=r,l=d,r=this._getPrev(++t),i=u}this._result[this._resultLen++]=new le(s.oldPosition,s.oldText,l.newPosition,l.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=l.newLength-l.oldLength}const o=ue._merge(this._result);return ue._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=ue._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++]=ue._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 le(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new le(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),i=t.newText.substr(n);return[new le(t.oldPosition,t.oldText,t.newPosition,r),new le(t.oldEnd,"",t.newPosition+n,i)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),i=t.oldText.substr(n);return[new le(t.oldPosition,r,t.newPosition,t.newText),new le(t.oldPosition+n,i,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,i=t[0];for(let o=1;o<t.length;o++){const s=t[o];i.oldEnd===s.oldPosition?i=new le(i.oldPosition,i.oldText+s.oldText,i.newPosition,i.newText+s.newText):(n[r++]=i,i=s)}return n[r++]=i,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let i=0;i<t.length;i++){const o=t[i];o.oldText!==o.newText&&(n[r++]=o)}return n}};function fl(e){return new le(e.newPosition,e.newText,e.oldPosition,e.oldText)}function pl(e){return e.map(fl)}function Dr(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function hl(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const i=t[r];n=n.slice(0,i.oldPosition)+i.newText+n.slice(i.oldEnd)}return n}function ml(e,t,n){let r=0;const i=e.start===e.end;for(const o of t){const s=o.newLength-o.oldLength;if(o.oldLength===0){const l=o.oldPosition;if(i&&l===e.start)r+=n==="after"?s:0;else{if(e.start<l&&l<e.end)return null;l<=e.start&&(r+=s)}continue}if(i){if(e.start>=o.oldEnd)r+=s;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=s;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var Rt=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},Or=0,gl=Math.random().toString(36).slice(2,8);function vl(){return Or+=1,`doc-${gl}-${Or}`}function bl(e){const t=e.createBuffer(),n=e.docId??vl();let r=e.serverId??null,i=0,o=null,s=e.attributes??{};const l=new Set;let d=!1,u=!1,h;const g=new Set;let E=null;const b=()=>(E?.version!==i&&(E={version:i,value:t.read()}),E.value),w=_=>Object.entries(_).some(([m,S])=>s[m]!==S);return{get:()=>({docId:n,serverId:r,version:i,savedVersion:o,attributes:s}),getContent:b,mutate(_,{source:m}){if(d)return i;const S=_.changes?.length?_.changes:void 0,y=S?hl(b(),S):_.content!==void 0?_.content:void 0,I=y!==void 0&&y!==b(),T=_.attributes!==void 0&&w(_.attributes);if(!I&&!T)return i;const R=!(i>(o??-1)),v=T?Object.keys(_.attributes).filter(a=>s[a]!==_.attributes[a]):[];I&&t.write(y),T&&(s={...s,..._.attributes}),i+=1,m!=="user"&&R&&(o=i);const f={source:m,version:i,changes:S,...I?{content:!0}:{},...v.length>0?{attributes:v}:{}};return l.forEach(a=>a(f)),i},markSaved(_,m){const S={serverId:r,savedVersion:o};m!==void 0&&(r=m),(o===null||_>o)&&(o=_),(S.serverId!==r||S.savedVersion!==o)&&l.forEach(y=>y({source:"system",version:i}))},markUnsaved(){d||o===null||o<i||(o=i-1,l.forEach(_=>_({source:"system",version:i})))},markReady(){u||h!==void 0||(u=!0,g.forEach(_=>_.resolve()),g.clear(),l.forEach(_=>_({source:"system",version:i})))},isReady:()=>u,markFailed(_){u||h!==void 0||d||(h=_,g.forEach(m=>m.reject(new Rt(_))),g.clear(),l.forEach(m=>m({source:"system",version:i})))},failure:()=>h,whenReady(){return u?Promise.resolve():h!==void 0?Promise.reject(new Rt(h)):d?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((_,m)=>{g.add({resolve:_,reject:m})})},subscribe(_){return l.add(_),()=>l.delete(_)},isNew:()=>r===null,isDirty:()=>i>(o??-1),isDisposed:()=>d,dispose(){d=!0,g.forEach(_=>_.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),g.clear(),l.clear(),t.dispose()}}}var yl=500,El=100,Vt=0;function _l(e,t={}){const n=t.groupIntervalMs??yl,r=t.maxSteps??El,i=t.now??(()=>0);let o=[],s=0,l=Vt+=1,d=null,u=!1,h=!1,g=!1;const E=new Set,b=()=>E.forEach(v=>v()),w=(v,f)=>{if(v.length){h=!0;try{e.mutate({changes:v},{source:f})}finally{h=!1}}},_=v=>w(v,"user"),m=v=>{const f=i();u&&d!==null&&f-d<n?o[s-1]=Pr(o[s-1],v):(o=o.slice(0,s),o.push(v),s=o.length,u=!0,o.length>r&&(o=o.slice(o.length-r),s=o.length,l=Vt+=1)),d=f,b()},S=()=>{u=!1,d=null},y=v=>{if(!v.length)return;const f=o.length>s;f&&(o=o.slice(0,s)),s>0&&(o[s-1]=Pr(o[s-1],v)),S(),f&&b()},I=e.subscribe(({source:v,changes:f})=>{if(!(g||h||!f?.length)){if(v==="remote"){T();return}if(v!=="user"){y(f);return}m(f)}}),T=()=>{o=[],s=0,S(),l=Vt+=1,b()},R=()=>{if(s===0)return!1;const v=pl(o[s-1]);return Dr(e.getContent(),v)?(_(v),s-=1,S(),!0):(o=o.slice(0,s-1),s=o.length,S(),b(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<o.length,undo(){R()&&b()},redo(){if(!(s>=o.length)){if(!Dr(e.getContent(),o[s])){o=o.slice(0,s),S(),b();return}_(o[s]),s+=1,S(),b()}},clear:T,applyWithoutHistory(v){const f=e.get().version;if(w(v,"system"),e.get().version===f){S();return}y(v)},getPast:v=>o.slice(0,s).reverse().slice(0,v),getFuture:v=>o.slice(s).reverse().slice(0,v),createSnapshot:()=>({stackId:l,index:s}),restoreSnapshot(v){if(v.stackId!==l||v.index>s)return!1;for(;s>v.index;)if(!R())return b(),!1;return b(),!0},subscribe(v){return E.add(v),()=>E.delete(v)},dispose(){g=!0,I(),E.clear(),o=[],s=0}}}var wl=["edit","move","resize","insert"];function Kt(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Sl(e){return typeof e=="string"?e:null}function Il(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Al(e){return wl.includes(e)?e:null}function Cl(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Sl(t.originId),changeId:Kt(t.changeId),rev:Kt(t.rev),baseRev:Kt(t.baseRev),expected:Il(t.expected),intent:Al(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var xr=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},so="draft";function Oe(e){return e==null||e===""?so:String(e)}function Tl(e){return e==null||e===""?`${wn}${so}`:`${wn}${String(e)}`}var wn="block:";function de(e){return e?.startsWith(wn)===!0}function Ke(e){return de(e.sessionKey())?void 0:e.current()}function Xe(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return W(`show:gate:${e}`,{kind:"wait"}),t.then(i=>(W(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw Gi(i)?(`${e}`,{...n}):(`${e}`,{error:oo(i),...n},void 0),i})}function Pt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function er(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function Rl(e,t={}){const n=Pt((e??[]).filter(r=>r?.html?.trim()));return er(n,t)?n:null}function Pl(e,t){const n=Date.parse(Pt(e)?.modified??""),r=Rl(e),i=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(i)&&i>t,s=[n,t??NaN].filter(l=>Number.isFinite(l));return{autosave:o?r:null,...s.length?{latestAt:Math.max(...s)}:{}}}function Dl(e,t){const n=Pt((e??[]).filter(s=>s?.html?.trim())),r=Date.parse(n?.modified??""),i=n&&Number.isFinite(r)&&(t===void 0||r>t),o=[Date.parse(Pt(e??[])?.modified??""),t??NaN].filter(s=>Number.isFinite(s));return{autosave:i&&er(n)?n:null,...o.length?{latestAt:Math.max(...o)}:{}}}function Ol({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var ao=e=>e.replace(/\r\n?/g,`
|
|
998
|
-
`),Mr=["recovery","plugin","rest"],xl=["subject","preheader"];function Ml(e){let t={},n;for(let i=Mr.length-1;i>=0;i--){const o=e.get(Mr[i]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const i of xl){const o=r?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function tr(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?ao(t.content):void 0,i=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...i?{changes:[new le(0,n,0,r)]}:{}},{source:"remote"})}var Wt=e=>typeof e=="string"?e.trim():"";function Ll(e,t,n){const{version:r,attributes:i}=e.get(),o=i,s=Wt(o.title)||Wt(o.subject)||Wt(t.fallbackTitle);return{version:r,payload:{html:e.getContent(),title:s,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 kl(e,t,n,r,i){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(i);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,i):t.saveAutosave(r,i)}function _e(e,t=!1){const n={};for(const r of Object.keys(e)){let i=e[r];i!==void 0&&!(typeof i=="number"&&Number.isNaN(i))&&(t&&typeof i=="object"&&i!==null&&(i=_e(i)),n[r]=i)}return n}var Nl=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function lo(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!Nl.has(t))):{}}function Dt(e,t,n={}){e&&e.mutate({attributes:Fl(e.get().attributes,t)},{source:n.source??"user"})}function Fl(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function nr(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function jl(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function co(e){if(!e)return null;const t=lo(e);return e.common_styles!==void 0&&(t.common_styles=jl(e.common_styles)),nr(e.html,t)}function uo(e){return e?nr(e.html,_e(lo(e))):null}var Bl=["common_styles","subject","preheader","meta"];function Lr(e){if(!e?.html?.trim())return null;const t={};for(const n of Bl)Ul(n,e[n])&&(t[n]=e[n]);return nr(e.html,t)}function Ul(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 Hl=["modified","lock"];function $l(e){if(!e)return null;const t={};for(const n of Hl)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var Gl=10,ql=(e,t)=>e.key===t.key&&zl(e.serverId,t.serverId),zl=(e,t)=>e==null||e===t;function Vl(e){return typeof e?.then=="function"}var kr=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},fo=e=>{e.request.serverId!=null&&!rr(e)&&e.document.markSaved(e.document.get().version)},rr=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),Nr=(e,t)=>t?.content!==void 0&&Ol({hasUnsavedUserEdit:rr(e)})==="skip",Kl=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()}),Wl=(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))},Yl=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([i,o])=>e.attributes[i]!==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}},Xl=e=>{const t=Ml(e.reports),n=Yl(e.lastMerged,t);e.lastMerged=t,n&&(tr(e.document,n),fo(e))},Yt=(e,t)=>{if(!e.ready&&!rr(e)){Xl(e);return}tr(e.document,t)},Jl=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 Ql(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:i,resolveTerms:o,canEdit:s,notifyBeforeSave:l,onAdapterError:d,onTimeout:u}=e;let h;const g=new Set,E=new Set,b=()=>g.forEach(a=>a()),w=(a,c)=>{if(!(a.closed||a.ready)){if(a.error!==void 0){a.document.markFailed(a.error),a.document.get().docId;return}fo(a),a.ready=!0,a.document.markReady(),a.document.get().docId,[...a.reports.keys()]}},_=(a,c,p)=>{d?.(c.id,p),!(!c.required||a.closed)&&(a.error=p,a.document.get().docId,c.id,b())},m=(a,c)=>{const p=new Set(c.map(C=>C.id));c.forEach(C=>{C.watch&&a.watchers.push(C.watch(L=>a.closed?!1:a.ready&&(Nr(a,L)||a.contentShown===!0&&L?.content!==void 0)?(a.document.get().docId,C.id,!1):(L&&a.reports.set(C.id,L),Yt(a,L),!0)))});const A=(C,L)=>{if(!a.closed){if(!C.required&&Nr(a,L)){a.document.get().docId,C.id,C.loaded?.(!1);return}L&&a.reports.set(C.id,L),Yt(a,L),C.loaded?.(L!==null)}},x=()=>{p.size>0||a.closed||(kr(a),w(a,[]))},j=[];if(c.forEach(C=>{let L;try{L=C.load()}catch(G){_(a,C,G),p.delete(C.id);return}if(Vl(L)){j.push({id:C.id,required:C.required,load:()=>L,...C.loaded?{loaded:G=>C.loaded?.(G)}:{}});return}A(C,L),p.delete(C.id)}),j.length===0){x();return}a.timer=setTimeout(()=>{a.timer=void 0,u?.([...p]),a.document.get().docId,[...p],w(a,[...p])},n),a.timer.unref?.(),j.forEach(C=>{C.load().then(L=>A(C,L)).catch(L=>{_(a,C,L)}).finally(()=>{p.delete(C.id),x()})})},S=async(a,c,p)=>{if(p==="snapshot"||p==="anchor")return;const A=o?.();if(A)return A.resolve({project:c.project??a.project,tags:(a.tags??[]).map(x=>({name:x}))})},y=a=>{if(a.lock===!0&&s?.(a)===!1)return new xr("locked");const c=a.tags?.length??0,p=a.emailtags?.length??0;if(Math.max(c,p)>Gl)return new xr("too-many-tags")},I=async(a,c,p)=>{try{await a.document.whenReady()}catch(L){return a.saveError=L,a.saveFailures+=1,a.saveFailures,!1}if(a.closed)return!1;const A=y(a.document.get().attributes);if(A)return a.saveError=A,a.saveFailures+=1,A.reason,b(),!1;if(l&&(await l(Jl(a)).catch(()=>{}),a.closed))return!1;let x;try{x=await S(a.document.get().attributes,p,c)}catch(L){return a.saveError=L,a.saveFailures+=1,a.saveFailures,b(),!1}if(a.closed)return!1;const{payload:j,version:C}=Ll(a.document,p,x);a.document.get().docId;try{const L=a.document.get().serverId!=null,G=await kl(r(),i(a.request.key),c,a.document.get().serverId,j);if(a.closed)return!0;let P;if(c==="snapshot"||c==="anchor"){const M=G?.modified!=null?Date.parse(G.modified):NaN;P=Number.isFinite(M)?M:Date.now(),a.snapshotVersion=C,a.lastRevisionAt=P}else a.document.markSaved(C,G?.id!=null?String(G.id):void 0);const O=a.document.get().serverId;!L&&O!=null&&(a.recoveryFacts={emailId:O,historyLoaded:!0,isRecovering:!1},de(a.request.key)||(a.request={...a.request,key:Oe(O),serverId:O})),a.saveError=void 0,a.saveFailures=0,a.document.get().serverId,b();const H={intent:c,serverId:a.document.get().serverId,created:!L,...P!==void 0?{revisionAt:P}:{}};return E.forEach(M=>M(H)),!0}catch(L){return a.saveError=L,a.saveFailures+=1,a.saveFailures,b(),!1}},T=()=>{h&&(h.closed=!0,h.watchers.forEach(a=>a()),h.watchers=[],kr(h),h.history.dispose(),h.document.dispose(),h=void 0)},R=(a,c,p)=>{let A=!1;c.show&&(a.show?.id!==c.show.id||a.show.token!==c.show.token)&&(a.show=c.show,A=!0,{docId:a.document.get().docId,...c.show});const x=p==="show"?uo(c.patch):null;x&&(a.reports.set("plugin",x),Yt(a,x),Wl(a,x)),A&&b()},v=(a,c={})=>{const p=h;return!p||p.closed||a==="materialize"&&p.document.get().serverId!=null?Promise.resolve(!1):p.saving?a==="snapshot"||a==="materialize"?Promise.resolve(!1):(p.inFlight??Promise.resolve(!1)).then(()=>v(a,c)):(p.saving=!0,b(),p.inFlight=I(p,a,c).finally(()=>{p.saving=!1,p.inFlight=void 0,h===p&&!p.closed&&b()}),p.inFlight)},f=(a,c="open")=>{if(h&&!h.closed&&c!=="new"&&ql(h.request,a))return R(h,a,c),h.document;T();const p=bl({createBuffer:()=>cl(""),serverId:a.serverId??null}),A={request:a,show:a.show,document:p,history:_l(p,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return h=A,A.watchers.push(Kl(A)),p.get().docId,a.serverId,m(A,t(a,{publishRecoveryFacts(x){A.closed||(A.recoveryFacts=x,b())},readShownContent:()=>A.closed?null:A.document.getContent()})),b(),p};return{openWith:f,open:(a,c={})=>f({key:Oe(a),serverId:a,email:c.email,patch:c.patch,show:c.show},"open"),openDraft:(a,c={})=>f({key:Oe(void 0),serverId:null,email:a,patch:c.patch,show:c.show},"open"),startNewDraft:(a,c={})=>f({key:Oe(void 0),serverId:null,email:a,patch:c.patch,show:c.show},"new"),reload:(a,c={})=>f({key:Oe(a),serverId:a,email:c.email,patch:c.patch,show:c.show},"new"),openBlock:(a,c)=>f({key:de(a)?a:Tl(a),serverId:c?.id!=null?String(c.id):null,email:c},"open"),show:(a,c)=>{const p=h;if(!(!p||p.closed))return f({...p.request,patch:a,show:c},"show")},current:()=>h?.document,noteServerFacts:({serverId:a,block:c},p)=>{const A=h;!A||A.closed||A.request.serverId!==a||de(A.request.key??"")===c&&tr(A.document,$l(p))},save:v,saveState:()=>({error:h?.saveError,failures:h?.saveFailures??0,saving:h?.saving===!0}),revisionFacts(){if(!h)return;const a=h.revisionFactsSnapshot;return a&&a.snapshotVersion===h.snapshotVersion&&a.lastRevisionAt===h.lastRevisionAt?a:(h.revisionFactsSnapshot={snapshotVersion:h.snapshotVersion,lastRevisionAt:h.lastRevisionAt},h.revisionFactsSnapshot)},recoveryFacts:()=>h?.recoveryFacts,history:()=>h?.history,forcedHeaders:()=>h?.forcedHeaders,beginForcedHeaders(a){h&&!h.closed&&(h.forcedHeaders=a)},endForcedHeaders(){h&&(h.forcedHeaders=void 0)},onSaved(a){return E.add(a),()=>E.delete(a)},showFacts:()=>h?.show,sessionKey:()=>h?.request.key,openError:()=>h?.error,subscribe(a){return g.add(a),()=>g.delete(a)},close(){h&&(T(),b())}}}var po=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function ho(e){if(e instanceof po)return e.reason;if(e instanceof Rt)return ho(e.reason)}function Zl(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new po("not-found");return co(n)}}}var mo=N("EmailPort");function ed(e){return e.getInstance(mo)}function td(e,t){e.inject(mo,t)}var go=N("documentSession.restEmailPortFactories");function vo(e){return e.getInstance(go)!==void 0}function Ae(e){const t=e.getInstance(go);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var nd=N("EmailTermsResolver");function rd(e){return e.getInstance(nd)}var bo=N("EmailHistoryPort"),id=N("BlockHistoryPort");function yo(e){return e.getInstance(id)}function Eo(e){return e.getInstance(bo)}function od(e,t){e.inject(bo,t)}var sd="em_autosave_pending";function Ot(e){return`${sd}_${e}`}function ad(e,t){try{sessionStorage.setItem(Ot(e),JSON.stringify(t))}catch{}}function ld(e){try{const t=sessionStorage.getItem(Ot(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(Ot(e)),null):n}catch{return null}}function pt(e){try{sessionStorage.removeItem(Ot(e))}catch{}}var dd=2e3,cd=5e3,ud=5,fd=5e3,pd=4;function hd(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function md(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
996
|
+
`,r=new Function("__amdEnv",n);r(e),typeof e.require=="function"&&typeof e.require.config=="function"&&e.require.config({baseUrl:"./",paths:{core:"useblocks-core.714faf8a.js",po:"useblocks-po.714faf8a.js",monaco:"static/monaco/index.js"}})}e.define("__delivery__/libs",[],function(){return import("./static/esm/delivery-libs.js")});var i=function(m){var c,f=function(){return c||(c=Promise.resolve().then(m))};return{then:function(g,P){return f().then(g,P)},catch:function(g){return f().catch(g)},finally:function(g){return f().finally(g)}}},o=i(function(){return e.require(["__delivery__/libs"]).then(function(m){return m[0]})});t.React=i(function(){return o.then(function(m){return m.React})}),t.ReactDom=i(function(){return o.then(function(m){return m.ReactDom})}),t.ReactDomClient=i(function(){return o.then(function(m){return m.ReactDomClient})}),t.ReactJsxRuntime=i(function(){return o.then(function(m){return m.ReactJsxRuntime})}),t.ReactJsxDevRuntime=i(function(){return o.then(function(m){return m.ReactJsxDevRuntime})}),t.AntDesignIconBase=i(function(){return o.then(function(m){return m.AntDesignIconBase})}),t.AntDesignCssinjs=i(function(){return o.then(function(m){return m.AntDesignCssinjs})}),t.Classnames=i(function(){return o.then(function(m){return m.Classnames})}),t.Dayjs=i(function(){return o.then(function(m){return m.Dayjs})});var s=i(function(){return Promise.all([o]).then(function(m){var c=m[0]||Object.create(null),f=Object.create(null);for(var g in c)Object.prototype.hasOwnProperty.call(c,g)&&(f[g]=c[g]);for(var P in f)Object.prototype.hasOwnProperty.call(f,P)&&(t[P]=f[P]);return f})}),a={Uuid:"the shared `uuid` package was removed from the editor runtime; bundle `uuid` into the plugin or use `crypto.randomUUID()`"},l=["then","toString","valueOf","constructor","inspect","$$typeof"];for(var u in a)Object.prototype.hasOwnProperty.call(a,u)&&t[u]===void 0&&(t[u]=(function(m,c){return new Proxy(Object.create(null),{get:function(f,g){if(!(typeof g=="symbol"||l.indexOf(g)!==-1))throw new Error("[shared-runtime] "+m+"."+String(g)+" is not available: "+c+".")}})})(u,a[u]));var d={},p={Antd:"[runtime] `antd` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",AntDesignIcons:"[runtime] `@ant-design/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",UiKit:"[runtime] `useblocks-ui-kit` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator.",UiKitIcons:"[runtime] `useblocks-ui-kit/icons` is not available: the compatibility layer for global plugins is not enabled. Add `import 'useblocks/compat-globals';` before creating the editor, or turn on the `compatGlobals` option of the bundler plugin. ESM builds omit this layer by default so that plugin compatibility is not paid for by every integrator."},b={Antd:"[runtime] `antd` 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.",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.",UiKit:"[runtime] `useblocks-ui-kit` 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.",UiKitIcons:"[runtime] `useblocks-ui-kit/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."},v=Object.create(null),S=function(m){for(var c=String(m&&m.stack||"").split(`
|
|
997
|
+
`),f="",g=0;g<c.length;g+=1){var P=/((?:https?|file|blob):\/\/[^\s()]+?)(?::\d+){1,2}\)?\s*$/.exec(c[g]);if(P){if(!f){f=P[1];continue}if(P[1]!==f)return P[1]}}return""},E=function(m){var c=S(new Error(m)),f=c?m+" Requested by: "+c+".":m;return e.__compatMissingReason=f,f};if(e.registerCompat=function(m){if(!(!m||typeof m!="object"))for(var c in m)Object.prototype.hasOwnProperty.call(m,c)&&(v[c]=m[c])},e.__compatPending){for(var h=0;h<e.__compatPending.length;h+=1)e.registerCompat(e.__compatPending[h]);e.__compatPending=void 0}for(var w in p)Object.prototype.hasOwnProperty.call(p,w)&&(function(m,c,f){var g=!1,P=function(){if(!(m in v))throw new Error(E(c));return v[m]};Object.defineProperty(t,m,{configurable:!0,enumerable:!0,get:function(){var D=P();return g||(g=!0),D},set:function(D){v[m]=D}}),Object.defineProperty(d,m,{configurable:!0,enumerable:!0,get:P,set:function(D){v[m]=D}})})(w,p[w],b[w]);var _=t;for(var A in d)Object.prototype.hasOwnProperty.call(d,A)&&(_===t&&(_=Object.create(t)),Object.defineProperty(_,A,Object.getOwnPropertyDescriptor(d,A)));var I=s,x=[],y=function(){for(var m=[],c=0;c<x.length;c+=1)(function(f){var g=t[f];g&&typeof g.then=="function"&&m.push(Promise.resolve(g).then(function(P){t[f]=P}))})(x[c]);return Promise.all(m)},C=typeof e.prefetch=="function"?e.prefetch:void 0;if(e.prefetch=function(){return s.then(y).then(function(){if(typeof C=="function")return C.call(e)})},typeof e.define=="function"){let m=function(c){if(!c||typeof c!="object"&&typeof c!="function"||c.__esModule)return c;if(R){var f=R.get(c);if(f)return f}var g=Object.create(null);Object.defineProperties(g,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});for(var P=Reflect.ownKeys(c),D=0;D<P.length;D++){var B=P[D];if(B!=="__esModule"){var T=Object.getOwnPropertyDescriptor(c,B);T&&Object.defineProperty(g,B,T)}}return Object.prototype.hasOwnProperty.call(g,"default")||Object.defineProperty(g,"default",{enumerable:!0,value:c,writable:!1}),R&&R.set(c,g),g};var R=typeof WeakMap<"u"?new WeakMap:null;e.define("react",[],function(){var c=_.React;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.React)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.React;return m(g)})}),e.define("useblocks/runtime/react",[],function(){var c=_.React;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.React)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.React;return m(g)})}),e.define("react-dom",[],function(){var c=_.ReactDom;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactDom)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactDom;return m(g)})}),e.define("useblocks/runtime/react-dom",[],function(){var c=_.ReactDom;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactDom)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactDom;return m(g)})}),e.define("react-dom/client",[],function(){var c=_.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactDomClient)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactDomClient;return m(g)})}),e.define("useblocks/runtime/react-dom/client",[],function(){var c=_.ReactDomClient;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactDomClient)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactDomClient;return m(g)})}),e.define("react/jsx-runtime",[],function(){var c=_.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactJsxRuntime)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactJsxRuntime;return m(g)})}),e.define("useblocks/runtime/react/jsx-runtime",[],function(){var c=_.ReactJsxRuntime;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactJsxRuntime)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactJsxRuntime;return m(g)})}),e.define("react/jsx-dev-runtime",[],function(){var c=_.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactJsxDevRuntime)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactJsxDevRuntime;return m(g)})}),e.define("useblocks/runtime/react/jsx-dev-runtime",[],function(){var c=_.ReactJsxDevRuntime;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.ReactJsxDevRuntime)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.ReactJsxDevRuntime;return m(g)})}),e.define("antd",[],function(){var c=_.Antd;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.Antd)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.Antd;return m(g)})}),e.define("useblocks/runtime/antd",[],function(){var c=_.Antd;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.Antd)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.Antd;return m(g)})}),e.define("@ant-design/icons/es/components/AntdIcon",[],function(){var c=_.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.AntDesignIconBase)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.AntDesignIconBase;return m(g)})}),e.define("useblocks/runtime/@ant-design/icons/es/components/AntdIcon",[],function(){var c=_.AntDesignIconBase;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.AntDesignIconBase)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.AntDesignIconBase;return m(g)})}),e.define("@ant-design/icons",[],function(){var c=_.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.AntDesignIcons)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.AntDesignIcons;return m(g)})}),e.define("useblocks/runtime/@ant-design/icons",[],function(){var c=_.AntDesignIcons;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.AntDesignIcons)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.AntDesignIcons;return m(g)})}),e.define("@ant-design/cssinjs",[],function(){var c=_.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.AntDesignCssinjs)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.AntDesignCssinjs;return m(g)})}),e.define("useblocks/runtime/@ant-design/cssinjs",[],function(){var c=_.AntDesignCssinjs;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.AntDesignCssinjs)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.AntDesignCssinjs;return m(g)})}),e.define("classnames",[],function(){var c=_.Classnames;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.Classnames)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.Classnames;return m(g)})}),e.define("useblocks/runtime/classnames",[],function(){var c=_.Classnames;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.Classnames)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.Classnames;return m(g)})}),e.define("dayjs",[],function(){var c=_.Dayjs;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.Dayjs)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.Dayjs;return m(g)})}),e.define("useblocks/runtime/dayjs",[],function(){var c=_.Dayjs;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.Dayjs)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.Dayjs;return m(g)})}),e.define("useblocks-ui-kit",[],function(){var c=_.UiKit;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.UiKit)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.UiKit;return m(g)})}),e.define("useblocks/ui-kit",[],function(){var c=_.UiKit;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.UiKit)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.UiKit;return m(g)})}),e.define("useblocks/ui-kit/icons",[],function(){var c=_.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.UiKitIcons)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.UiKitIcons;return m(g)})}),e.define("useblocks-ui-kit/icons",[],function(){var c=_.UiKitIcons;return c&&typeof c.then=="function"?c.then(function(f){return f===void 0?I.then(function(g){return m(g.UiKitIcons)}):m(f)}):c!==void 0?m(c):I.then(function(f){var g=f.UiKitIcons;return m(g)})})}globalThis.__SHARED_RUNTIME_INIT_SENTINEL__="@shared-runtime:init-complete"})();var Xl=new Function("url","return import(url)");function Jl(e){if(typeof e!="function")return!1;try{return Reflect.construct(String,[],e),!0}catch{return!1}}function Ar(e){return typeof e=="object"&&e!==null&&"type"in e&&"url"in e}function Uo(e){return e.type==="umd"||e.resolve==="registry"}var Ql="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 Zl(e){const t=Array.isArray(e)?e[0]:e;return Ar(t)?t.name??t.url:typeof t=="function"?t.name||"anonymous plugin":String(t)}function ec(e,t){const n=Zl(e),r=Ar(e)?e:void 0,i=t instanceof Error?t.message:String(t),o=r&&Uo(r)&&!/compat/iu.test(i)?` ${Ql}`:"",s=new Error(`Plugin "${n}" was skipped: it failed to load. ${i}${o}`);return s.cause=t,{name:n,url:r?.url,error:s}}function tc(e){return!e.filename&&!e.error&&/^Script error\.?$/.test(e.message)}var nc=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(Ar(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(Uo(e)&&await this._options.ensureHostRuntimeReady?.(e),e.type==="esm"){const n=await Xl(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 i;const o=a=>{i||(a.filename===r.src?i=this._scriptExecutionError(e,a.error??a.message):tc(a)&&(i=this._scriptExecutionError(e,this._options.explainScriptFailure?.()??a.message)))},s=()=>window.removeEventListener("error",o);window.addEventListener("error",o),r.onload=()=>{if(s(),i){n(i);return}t()},r.onerror=()=>{s(),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 i=await this._resolveOrSkip(r);if(!i)continue;const o=this._createOrSkip(i.ctor,i.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 s of e){const a=await this._resolveOrSkip(s);a&&(t.add(a.ctor),n.push(a))}const r=[];this._map.forEach((s,a)=>{t.has(a)||r.push({key:a,plugin:s})});for(let s=r.length-1;s>=0;s--){const{key:a,plugin:l}=r[s];await this._initializingPlugins.get(l),await this._disposePlugin(l,l.constructor.name),this._map.delete(a),this._optionsMap.delete(a),this._readyMap.delete(l),this._resolveMap.delete(l),this._initializingPlugins.delete(l),this._initializedPlugins.delete(l);const u=this._creationOrder.indexOf(l);u>=0&&this._creationOrder.splice(u,1)}const i=[],o=new Set;for(const{ctor:s,options:a}of n){const l=this._createOrSkip(s,a);l&&!o.has(l)&&(o.add(l),i.push(l))}this._activated&&await this._startPluginsBatch(i)}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,i)=>{let o,s=!1;const a=()=>{s||(s=!0,o&&clearTimeout(o),this._pluginRegistry.off(e,a),r())};this._pluginRegistry.on(e,a),n!==void 0&&n>0&&(o=setTimeout(()=>{s||(s=!0,this._pluginRegistry.off(e,a),i(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),i=this._createPluginInstance(e,r),o=i.constructor.name;this._emitLifecycle({type:"created",plugin:i,name:o}),i.required?.(),this._map.set(n,i),this._creationOrder.push(i),this._setupReadyPromise(i)}return this._map.get(n)}async _resolveOrSkip(e){try{return await this._resolveEntry(e)}catch(t){const n=ec(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 Jl(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 i of t){if(this._initializedPlugins.has(i))continue;const o=this._initializingPlugins.get(i);if(o){n.add(o);continue}r.push(i)}if(r.length>0){const i=this._runBatchLifecycle(r);for(const o of r)this._initializingPlugins.set(o,i);n.add(i),i.finally(()=>{for(const o of r)this._initializingPlugins.get(o)===i&&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 i=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{i?.()}}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(i){this._emitLifecycle({type:"afterInit:error",plugin:n,name:r,error:i})}}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)}))}},rc=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 i of n)try{i.callback(t)}catch{}const r=n.filter(i=>!i.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(i=>(t.ctor=i,t.loading=void 0,this._notifyListeners(e,i),i));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 i={callback:t,once:!1};return r.push(i),{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 i={callback:t,once:!0};return r.push(i),{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(i=>i.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)}}}},ic=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()}},di=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 oc(e,t){return t+e}function sc(){return typeof performance>"u"?Date.now():oc(performance.now(),performance.timeOrigin)}var ac="emailmaker:diagnostics",lc="diagnostics",cc="diagnostics";function fi(e,t){return t?`${e}${e.includes("?")?"&":"?"}${cc}=1`:e}var En;function uc(){try{const e=new URLSearchParams(window.location.search).get(lc);return e===null?void 0:e!=="0"}catch{return}}function dc(){const e=window.__DIAGNOSTICS__;return typeof e=="boolean"?e:void 0}function fc(){try{const e=window.localStorage.getItem(ac);return e===null?void 0:e==="1"}catch{return}}function yt(){return En===void 0&&(En=typeof window>"u"?!1:uc()??dc()??fc()??!1),En}function pc(e){return`__${(e||"useblocks").toLowerCase().replaceAll("-","")}__`}var re={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"},oE=Object.values(re),sE=[re.canvasPainted,re.canvasSettled,re.appVisible,re.editorVisible],hc=5e3,mc=3e3,pi="diagnosticsStore",jt,ot;function hi(){return{marks:new di(hc),resources:new di(mc)}}function Ho(){if(ot)return ot;const e=Rr();return e?(ot=e[pi]??jt??hi(),e[pi]=ot,jt=void 0,ot):(jt??=hi(),jt)}function K(e,t){yt()&&Ho().marks.push({phase:e,at:sc(),...t})}function Rr(){if(typeof window.__useblocks__<"u"&&window.__useblocks__)return window.__useblocks__;if(typeof window>"u")return;const e=window[pc()];return e!==null&&typeof e=="object"?e:void 0}function gc(e){const t=e.length,n=Ho();return e.forEach(r=>n.marks.push(r)),e.length=0,t}function vc(){const e=Rr();return!e||!Array.isArray(e.diagnosticsBuffer)?0:gc(e.diagnosticsBuffer)}var bc="Editor instance was destroyed and cannot be reused. A fresh instance will be created instead.";function Te(){const e=new Error(bc);return e.name="DestroyedInstanceError",e}function yc(e){return e instanceof Error&&e.name==="DestroyedInstanceError"}function Wn(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,s=t;return o.length===s.length&&o.every((a,l)=>Wn(a,s[l]))}const r=Object.keys(e),i=Object.keys(t);return r.length!==i.length?!1:r.every(o=>Object.prototype.hasOwnProperty.call(t,o)&&Wn(e[o],t[o]))}function $o(e,t){const n={watch(r){let i,o=!1;return e.watch(s=>{const a=t(s);o&&Wn(i,a)||(i=a,o=!0,r(a))})},select(r){return $o(n,r)}};return n}function ve(...e){let t=e[0],n=e.length>0;const r=new Set,i={get(){return n?t:void 0},set(o){t=o,n=!0;for(const s of Array.from(r))s(o)},watch(o){return r.add(o),n&&o(t),{dispose:()=>r.delete(o)}},select(o){return $o(i,o)}};return i}var Ec=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:El.UrlEncoded,...t})},Vo=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 _c(e){return String(e||"").trim()||void 0}var wc=class extends Z{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=_c(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)}},Pr=N("AppInitService");function Sc(e){return async()=>{const t=await e();return(await new Ec(t).app_init_create({})).data}}function Ic(e){e.injectFactory(Pr,(t,n)=>{if(n)return n;const r=new wc({options:e.getInstance(te),isStandalone:()=>!!e.getInstance(Se),resolveRestBaseUrl:i=>i?ai(i):ai()||void 0,setRestBaseUrl:i=>{e.getInstance(Pl)?.setOptions(i?{baseUrl:i}:{})},fallbackAppInit:Sc(()=>e.getInstanceAsync(hl)),publish:i=>{e.inject(Re,i)}});return e.getInstance(H)?.addDisposable(r),r},!0)}var Dr=N("documentSession.emailDocuments");function Xe(e){return e?.getInstance(Dr)}var Cc=N("RevisionServiceFlag");function qo(e){return e.getOrCreateInstance(Cc,()=>{let t=!1;return{isEnabled:()=>t,set:n=>{t=n}}})}function Go(e){return qo(e).isEnabled()}var Tc=N("EmailRightsResolver");function Ac(e,t){const n=e.getInstance(Tc);return n?n(t):!0}var zo=N("EmailHistoryAvailabilityResolver");function Rc(e){return e.getInstance(zo)!==void 0}async function Pc(e){const t=e.getInstance(zo);if(!t)return!0;try{return await t()}catch{return!1}}var Or={INIT_START:5e3,SET_ENTITY:12e3,PREHEADER:5e3,SUBJECT:5e3,INITED:5e3,UPDATE_ENTITY:5e3},Wo=["INIT_START","SET_ENTITY","PREHEADER","SUBJECT","INITED"],Ko=2e4,Dc=Wo.reduce((e,t)=>e+Or[t],0),Yo=Ko+Dc+3e3;function Oc(e){return Wo.reduce((t,n)=>t+Xo(n,e),0)}function Xo(e,t){const n=t?.[e];return typeof n=="number"&&n>0?n:Or[e]}function Jo(e){const t=e?.contentReady;return typeof t=="number"&&t>0?t:Yo}function Qo(e){const t=e?.sandboxReady;return typeof t=="number"&&t>0?t:Ko}function xr(e=Yo){return e+3e3}function Zo(e){return e instanceof Error?`${e.name}: ${e.message}`:typeof e=="string"?e:JSON.stringify(e)??"undefined"}var xc=()=>xr();function Mc(e,t){let n;return Promise.race([e,new Promise(r=>{n=setTimeout(()=>{r()},t)})]).finally(()=>{n!==void 0&&clearTimeout(n)})}function Lc(e){return t=>Mc(e.getOrCreateInstance(F.BEFORE_SAVE_EMAIL,()=>new Ae).fire(t),xc())}function kc(e){return e!=null&&e!==""}var Nc;function Et(e,t){return Nc?.capture(e,t)}function Fc(e=""){let t=e;return{read:()=>t,write:n=>{t=n},dispose:()=>{t=""}}}function Bt(e){return e.replace(/\n/g,"\\n").replace(/\r/g,"\\r")}var fe=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} "${Bt(this.newText)}")`:this.newText.length===0?`(delete@${this.oldPosition} "${Bt(this.oldText)}")`:`(replace@${this.oldPosition} "${Bt(this.oldText)}" with "${Bt(this.newText)}")`}};function mi(e,t){return e===null||e.length===0?t:new jc(e,t).compress()}var jc=class be{_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),i=this._getCurr(n);for(;t<this._prevLen||n<this._currLen;){if(r===null){if(i===null)break;this._acceptCurr(i),i=this._getCurr(++n);continue}if(i===null){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldEnd<=r.newPosition){this._acceptCurr(i),i=this._getCurr(++n);continue}if(r.newEnd<=i.oldPosition){this._acceptPrev(r),r=this._getPrev(++t);continue}if(i.oldPosition<r.newPosition){const[l,u]=be._splitCurr(i,r.newPosition-i.oldPosition);this._acceptCurr(l),i=u;continue}if(r.newPosition<i.oldPosition){const[l,u]=be._splitPrev(r,i.oldPosition-r.newPosition);this._acceptPrev(l),r=u;continue}let s,a;if(i.oldEnd===r.newEnd)s=r,a=i,r=this._getPrev(++t),i=this._getCurr(++n);else if(i.oldEnd<r.newEnd){const[l,u]=be._splitPrev(r,i.oldLength);s=l,a=i,r=u,i=this._getCurr(++n)}else{const[l,u]=be._splitCurr(i,r.newLength);s=r,a=l,r=this._getPrev(++t),i=u}this._result[this._resultLen++]=new fe(s.oldPosition,s.oldText,a.newPosition,a.newText),this._prevDeltaOffset+=s.newLength-s.oldLength,this._currDeltaOffset+=a.newLength-a.oldLength}const o=be._merge(this._result);return be._removeNoOps(o)}_acceptCurr(t){this._result[this._resultLen++]=be._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++]=be._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 fe(n.oldPosition-t,n.oldText,n.newPosition,n.newText)}static _rebasePrev(t,n){return new fe(n.oldPosition,n.oldText,n.newPosition+t,n.newText)}static _splitPrev(t,n){const r=t.newText.substr(0,n),i=t.newText.substr(n);return[new fe(t.oldPosition,t.oldText,t.newPosition,r),new fe(t.oldEnd,"",t.newPosition+n,i)]}static _splitCurr(t,n){const r=t.oldText.substr(0,n),i=t.oldText.substr(n);return[new fe(t.oldPosition,r,t.newPosition,t.newText),new fe(t.oldPosition+n,i,t.newEnd,"")]}static _merge(t){if(t.length===0)return t;const n=[];let r=0,i=t[0];for(let o=1;o<t.length;o++){const s=t[o];i.oldEnd===s.oldPosition?i=new fe(i.oldPosition,i.oldText+s.oldText,i.newPosition,i.newText+s.newText):(n[r++]=i,i=s)}return n[r++]=i,n}static _removeNoOps(t){if(t.length===0)return t;const n=[];let r=0;for(let i=0;i<t.length;i++){const o=t[i];o.oldText!==o.newText&&(n[r++]=o)}return n}};function Bc(e){return new fe(e.newPosition,e.newText,e.oldPosition,e.oldText)}function Uc(e){return e.map(Bc)}function gi(e,t){return t.every(n=>e.slice(n.oldPosition,n.oldEnd)===n.oldText)}function Hc(e,t){let n=e;for(let r=t.length-1;r>=0;r-=1){const i=t[r];n=n.slice(0,i.oldPosition)+i.newText+n.slice(i.oldEnd)}return n}function $c(e,t,n){let r=0;const i=e.start===e.end;for(const o of t){const s=o.newLength-o.oldLength;if(o.oldLength===0){const a=o.oldPosition;if(i&&a===e.start)r+=n==="after"?s:0;else{if(e.start<a&&a<e.end)return null;a<=e.start&&(r+=s)}continue}if(i){if(e.start>=o.oldEnd)r+=s;else if(e.start>o.oldPosition)return null;continue}if(e.start>=o.oldEnd)r+=s;else if(e.end>o.oldPosition)return null}return{start:e.start+r,end:e.end+r}}var tn=class extends Error{reason;constructor(e){super("Открытие документа не удалось"),this.reason=e,this.name="DocumentOpenFailedError"}},vi=0,Vc=Math.random().toString(36).slice(2,8);function qc(){return vi+=1,`doc-${Vc}-${vi}`}function Gc(e){const t=e.createBuffer(),n=e.docId??qc();let r=e.serverId??null,i=0,o=null,s=e.attributes??{};const a=new Set;let l=!1,u=!1,d;const p=new Set;let b=null;const v=()=>(b?.version!==i&&(b={version:i,value:t.read()}),b.value),S=E=>Object.entries(E).some(([h,w])=>s[h]!==w);return{get:()=>({docId:n,serverId:r,version:i,savedVersion:o,attributes:s}),getContent:v,mutate(E,{source:h}){if(l)return i;const w=E.changes?.length?E.changes:void 0,_=w?Hc(v(),w):E.content!==void 0?E.content:void 0,A=_!==void 0&&_!==v(),I=E.attributes!==void 0&&S(E.attributes);if(!A&&!I)return i;const x=!(i>(o??-1)),y=I?Object.keys(E.attributes).filter(R=>s[R]!==E.attributes[R]):[];A&&t.write(_),I&&(s={...s,...E.attributes}),i+=1,h!=="user"&&x&&(o=i);const C={source:h,version:i,changes:w,...A?{content:!0}:{},...y.length>0?{attributes:y}:{}};return a.forEach(R=>R(C)),i},markSaved(E,h){const w={serverId:r,savedVersion:o};h!==void 0&&(r=h),(o===null||E>o)&&(o=E),(w.serverId!==r||w.savedVersion!==o)&&a.forEach(_=>_({source:"system",version:i}))},markUnsaved(){l||o===null||o<i||(o=i-1,a.forEach(E=>E({source:"system",version:i})))},markReady(){u||d!==void 0||(u=!0,p.forEach(E=>E.resolve()),p.clear(),a.forEach(E=>E({source:"system",version:i})))},isReady:()=>u,markFailed(E){u||d!==void 0||l||(d=E,p.forEach(h=>h.reject(new tn(E))),p.clear(),a.forEach(h=>h({source:"system",version:i})))},failure:()=>d,whenReady(){return u?Promise.resolve():d!==void 0?Promise.reject(new tn(d)):l?Promise.reject(new Error("Документ закрыт до того, как наполнение закончилось")):new Promise((E,h)=>{p.add({resolve:E,reject:h})})},subscribe(E){return a.add(E),()=>a.delete(E)},isNew:()=>r===null,isDirty:()=>i>(o??-1),isDisposed:()=>l,dispose(){l=!0,p.forEach(E=>E.reject(new Error("Документ закрыт до того, как наполнение закончилось"))),p.clear(),a.clear(),t.dispose()}}}var zc=500,Wc=100,_n=0;function Kc(e,t={}){const n=t.groupIntervalMs??zc,r=t.maxSteps??Wc,i=t.now??(()=>0);let o=[],s=0,a=_n+=1,l=null,u=!1,d=!1,p=!1;const b=new Set,v=()=>b.forEach(y=>y()),S=(y,C)=>{if(y.length){d=!0;try{e.mutate({changes:y},{source:C})}finally{d=!1}}},E=y=>S(y,"user"),h=y=>{const C=i();u&&l!==null&&C-l<n?o[s-1]=mi(o[s-1],y):(o=o.slice(0,s),o.push(y),s=o.length,u=!0,o.length>r&&(o=o.slice(o.length-r),s=o.length,a=_n+=1)),l=C,v()},w=()=>{u=!1,l=null},_=y=>{if(!y.length)return;const C=o.length>s;C&&(o=o.slice(0,s)),s>0&&(o[s-1]=mi(o[s-1],y)),w(),C&&v()},A=e.subscribe(({source:y,changes:C})=>{if(!(p||d||!C?.length)){if(y==="remote"){I();return}if(y!=="user"){_(C);return}h(C)}}),I=()=>{o=[],s=0,w(),a=_n+=1,v()},x=()=>{if(s===0)return!1;const y=Uc(o[s-1]);return gi(e.getContent(),y)?(E(y),s-=1,w(),!0):(o=o.slice(0,s-1),s=o.length,w(),v(),!1)};return{canUndo:()=>s>0,canRedo:()=>s<o.length,undo(){x()&&v()},redo(){if(!(s>=o.length)){if(!gi(e.getContent(),o[s])){o=o.slice(0,s),w(),v();return}E(o[s]),s+=1,w(),v()}},clear:I,applyWithoutHistory(y){const C=e.get().version;if(S(y,"system"),e.get().version===C){w();return}_(y)},getPast:y=>o.slice(0,s).reverse().slice(0,y),getFuture:y=>o.slice(s).reverse().slice(0,y),createSnapshot:()=>({stackId:a,index:s}),restoreSnapshot(y){if(y.stackId!==a||y.index>s)return!1;for(;s>y.index;)if(!x())return v(),!1;return v(),!0},subscribe(y){return b.add(y),()=>b.delete(y)},dispose(){p=!0,A(),b.clear(),o=[],s=0}}}var Yc=["edit","move","resize","insert"];function wn(e){return typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}function Xc(e){return typeof e=="string"?e:null}function Jc(e){return!Array.isArray(e)||!e.every(t=>typeof t=="string")?null:e}function Qc(e){return Yc.includes(e)?e:null}function Zc(e){const t=typeof e=="object"&&e!==null?e:{},n={originId:Xc(t.originId),changeId:wn(t.changeId),rev:wn(t.rev),baseRev:wn(t.baseRev),expected:Jc(t.expected),intent:Qc(t.intent)};return{...n,legacy:Object.values(n).every(r=>r===null)}}var ht=class extends Error{reason;constructor(e){super(`[emailmaker] save refused: ${e}`),this.name="SaveRefusedError",this.reason=e}},es=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"}},Mr=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 eu(){return typeof navigator<"u"&&navigator.onLine===!1}function tu(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 ts(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 ts(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 nu(e){return eu()?!0:tu(e).some(ts)}var ns=new WeakSet,rs=new WeakMap;function is(e){typeof e=="object"&&e!==null&&ns.add(e)}function ru(e,t){typeof e=="object"&&e!==null&&rs.set(e,t)}function iu(e){return typeof e=="object"&&e!==null?rs.get(e):void 0}function ou(e){return e instanceof Mr||e instanceof es||typeof e=="object"&&e!==null&&ns.has(e)}function su(e){return e instanceof ht||ou(e)}function au(e){return!su(e)&&nu(e)}var os="draft";function We(e){return e==null||e===""?os:String(e)}function lu(e){return e==null||e===""?`${Kn}${os}`:`${Kn}${String(e)}`}var Kn="block:";function ge(e){return e?.startsWith(Kn)===!0}function lt(e){return ge(e.sessionKey())?void 0:e.current()}function mt(e,t,n){const r=typeof performance<"u"?performance.now():Date.now();return K(`show:gate:${e}`,{kind:"wait"}),t.then(i=>(K(`show:gate:${e}:end`,{kind:"wait"}),i),i=>{const o=Math.round((typeof performance<"u"?performance.now():Date.now())-r);throw Lo(i)?(`${e}`,{...n}):(`${e}`,{error:Zo(i),...n},void 0),i})}var cu=/^\d{4}-\d{2}-\d{2}[T ]\d{2}:\d{2}(:\d{2}(\.\d+)?)?$/;function uu(e){const t=e?.trim()??"";if(!cu.test(t))return Date.parse(t);const n=t.replace(" ","T");return Math.max(Date.parse(n),Date.parse(`${n}Z`))}function gt(e){return e?.length?[...e].sort((t,n)=>Date.parse(n.modified)-Date.parse(t.modified))[0]:null}function Lr(e,{freshSince:t}={}){return!(e?.isAutosave!==!0||!e?.html?.trim()||t!==void 0&&Date.parse(e.modified)<t-5e3)}function du(e,t={}){const n=gt((e??[]).filter(r=>r?.html?.trim()));return Lr(n,t)?n:null}function fu(e,t){const n=Date.parse(gt(e)?.modified??""),r=du(e),i=Date.parse(r?.modified??""),o=t===void 0||Number.isFinite(i)&&i>t,s=[n,t??NaN].filter(a=>Number.isFinite(a));return{autosave:o?r:null,...s.length?{latestAt:Math.max(...s)}:{}}}function bi(e,t,n){const r=gt((e??[]).filter(l=>l?.html?.trim())),i=Date.parse(r?.modified??""),o=Date.parse(gt((n??[]).filter(l=>l?.html?.trim()))?.modified??""),s=r&&Number.isFinite(i)&&(t===void 0||i>t)&&!(o>i),a=[Date.parse(gt(e??[])?.modified??""),t??NaN].filter(l=>Number.isFinite(l));return{autosave:s&&Lr(r)?r:null,...a.length?{latestAt:Math.max(...a)}:{}}}function pu({hasUnsavedUserEdit:e}){return e?"skip":"apply"}var ss=e=>e.replace(/\r\n?/g,`
|
|
998
|
+
`),yi=["recovery","plugin","rest"],hu=["subject","preheader"];function mu(e){let t={},n;for(let i=yi.length-1;i>=0;i--){const o=e.get(yi[i]);o&&(o.attributes&&(t={...t,...o.attributes}),o.content!==void 0&&(n=o.content))}const r=e.get("plugin")?.attributes;for(const i of hu){const o=r?.[i];typeof o=="string"&&o!==""&&(t={...t,[i]:o})}return n!==void 0?{content:n,attributes:t}:{attributes:t}}function kr(e,t){if(!e||!t)return;const n=e.getContent(),r=t.content!==void 0?ss(t.content):void 0,i=r!==void 0&&r!==n;e.get().docId,Object.keys(t.attributes??{}),e.mutate({attributes:t.attributes??{},...i?{changes:[new fe(0,n,0,r)]}:{}},{source:"remote"})}var Sn=e=>typeof e=="string"?e.trim():"";function gu(e,t,n,r){const{version:i,attributes:o}=e.get(),s=o,a=r==="snapshot"||r==="anchor",l=a?s.author:void 0,u=a?s.date_gmt:void 0,d=Sn(s.title)||Sn(s.subject)||Sn(t.fallbackTitle);return{version:i,payload:{html:e.getContent(),title:d,subject:s.subject,preheader:s.preheader,description:s.description,common_styles:s.common_styles||"",meta:s.meta,utm_parameters:s.utm_parameters,parent_email:s.parent_email,is_template:s.is_template||!1,is_inited:s.is_inited,tags:s.tags,emailtags:s.emailtags,group:s.group,renderGuid:e.get().docId,project:t.project??s.project,folder:t.folder,...n?.emailtags?{emailtags:n.emailtags}:{},...n?.group?{group:n.group}:{},source:t.source,...l!=null&&l!==""?{author:l}:{},...u?{excerpt:u}:{}}}}var vu=["meta","title","author","project","html","excerpt","subject","preheader","common_styles","parent_email"];function bu(e){const t={};for(const n of vu)e[n]!==void 0&&(t[n]=e[n]);return t.excerpt||(t.excerpt=new Date().toISOString()),t}async function yu(e,t,n,r,i){if(n==="materialize"&&r!=null)throw new Error("Письмо уже создано на сервере");if(n==="materialize"||n==="publish"&&r==null)return e.createEmail(i);if(r==null)throw new Error("Письмо ещё не создано на сервере");return n==="publish"?e.updateEmail(r,i):t.saveAutosave(r,i)}function Pe(e,t=!1){const n={};for(const r of Object.keys(e)){let i=e[r];i!==void 0&&!(typeof i=="number"&&Number.isNaN(i))&&(t&&typeof i=="object"&&i!==null&&(i=Pe(i)),n[r]=i)}return n}function Eu(e){return typeof e=="string"&&e.includes("autosave")}var _u=new Set(["html","id","renderGuid","showToken","showId","isNew"]);function as(e){return e?Object.fromEntries(Object.entries(e).filter(([t])=>!_u.has(t))):{}}function _t(e,t,n={}){e&&e.mutate({attributes:wu(e.get().attributes,t)},{source:n.source??"user"})}function wu(e,t){return t.subject===void 0||t.title!==void 0?t:(e.title??"")===(e.subject??"")?{...t,title:t.subject}:t}function Nr(e,t){return e===void 0&&Object.keys(t).length===0?null:{...e!==void 0?{content:e}:{},attributes:t}}function Su(e){return typeof e=="string"&&e.startsWith("{")?e:"{}"}function ls(e){if(!e)return null;const t=as(e);return e.common_styles!==void 0&&(t.common_styles=Su(e.common_styles)),Nr(e.html,t)}function cs(e){return e?Nr(e.html,Pe(as(e))):null}var Iu=["common_styles","subject","preheader","meta"];function Ei(e){if(!e?.html?.trim())return null;const t={};for(const n of Iu)Cu(n,e[n])&&(t[n]=e[n]);return Nr(e.html,t)}function Cu(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 Tu=["modified","lock"];function Au(e){if(!e)return null;const t={};for(const n of Tu)e[n]!==void 0&&(t[n]=e[n]);return Object.keys(t).length===0?null:{attributes:t}}var Ru=10,Pu=(e,t)=>e.key===t.key&&Du(e.serverId,t.serverId),Du=(e,t)=>e==null||e===t;function Ou(e){return typeof e?.then=="function"}var _i=e=>{e.timer!==void 0&&(clearTimeout(e.timer),e.timer=void 0)},us=e=>{e.request.serverId!=null&&!Fr(e)&&(e.document.markSaved(e.document.get().version),e.savedContent=e.document.getContent())},xu=e=>e.document.get().serverId!=null&&!e.document.getContent().trim()&&!!(e.savedContent??e.lastMerged?.content??"").trim(),Fr=e=>e.document.get().savedVersion!==null&&e.document.isDirty(),wi=(e,t)=>t?.content!==void 0&&pu({hasUnsavedUserEdit:Fr(e)})==="skip",Mu=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()}),Lu=(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))},ku=(e,t)=>{if(!e)return t;const n=Object.fromEntries(Object.entries(t.attributes).filter(([i,o])=>e.attributes[i]!==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}},Nu=e=>{const t=mu(e.reports),n=ku(e.lastMerged,t);e.lastMerged=t,n&&(kr(e.document,n),us(e))},In=(e,t)=>{if(!e.ready&&!Fr(e)){Nu(e);return}kr(e.document,t)},Fu=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 ju(e){const{resolveAdapters:t,timeoutMs:n,resolveWritePort:r,resolveHistoryPort:i,resolveTerms:o,canEdit:s,notifyBeforeSave:a,onAdapterError:l,onTimeout:u}=e;let d;const p=new Set,b=new Set,v=()=>p.forEach(c=>c()),S=(c,f)=>{if(!(c.closed||c.ready)){if(c.error!==void 0){c.document.markFailed(c.error),c.document.get().docId;return}us(c),c.ready=!0,c.document.markReady(),c.document.get().docId,[...c.reports.keys()]}},E=(c,f,g)=>{l?.(f.id,g),!(!f.required||c.closed)&&(c.error=g,c.document.get().docId,f.id,v())},h=(c,f)=>{const g=new Set(f.map(T=>T.id));f.forEach(T=>{T.watch&&c.watchers.push(T.watch(O=>c.closed?!1:c.ready&&(wi(c,O)||c.contentShown===!0&&O?.content!==void 0)?(c.document.get().docId,T.id,!1):(O&&c.reports.set(T.id,O),In(c,O),!0)))});const P=(T,O)=>{if(!c.closed){if(!T.required&&wi(c,O)){c.document.get().docId,T.id,T.loaded?.(!1);return}O&&c.reports.set(T.id,O),In(c,O),T.loaded?.(O!==null)}},D=()=>{g.size>0||c.closed||(_i(c),S(c,[]))},B=[];if(f.forEach(T=>{let O;try{O=T.load()}catch(L){E(c,T,L),g.delete(T.id);return}if(Ou(O)){B.push({id:T.id,required:T.required,load:()=>O,...T.loaded?{loaded:L=>T.loaded?.(L)}:{}});return}P(T,O),g.delete(T.id)}),B.length===0){D();return}c.timer=setTimeout(()=>{c.timer=void 0,u?.([...g]),c.document.get().docId,[...g],S(c,[...g])},n),c.timer.unref?.(),B.forEach(T=>{T.load().then(O=>P(T,O)).catch(O=>{E(c,T,O)}).finally(()=>{g.delete(T.id),D()})})},w=async(c,f,g)=>{if(g==="snapshot"||g==="anchor")return;const P=o?.();if(P)return P.resolve({project:f.project??c.project,tags:(c.tags??[]).map(D=>({name:D}))})},_=c=>{if(c.lock===!0&&s?.(c)===!1)return new ht("locked");const f=c.tags?.length??0,g=c.emailtags?.length??0;if(Math.max(f,g)>Ru)return new ht("too-many-tags")},A=(c,f)=>{const g=c.document.get().serverId;f||g==null||(c.recoveryFacts={emailId:g,historyLoaded:!0,isRecovering:!1},ge(c.request.key)||(c.request={...c.request,key:We(g),serverId:g}))},I=(c,f,g)=>{if(c.closed||g?.id==null)return;const P=c.document.get().serverId,D=P!=null;D&&P!==String(g.id)||(c.document.markSaved(f,String(g.id)),A(c,D),c.document.get().serverId,v())},x=async(c,f,g)=>{try{await c.document.whenReady()}catch(O){return c.saveError=O,c.saveFailures+=1,c.failedIntent=f,c.saveFailures,!1}if(c.closed)return!1;const P=_(c.document.get().attributes);if(P)return c.saveError=P,c.saveFailures+=1,c.failedIntent=f,P.reason,v(),!1;if(a&&(await a(Fu(c)).catch(()=>{}),c.closed))return!1;if(xu(c))return f==="snapshot"||(c.saveError=new ht("empty-content"),c.saveFailures+=1,c.failedIntent=f,v()),!1;let D;try{D=await w(c.document.get().attributes,g,f)}catch(O){return c.saveError=O,c.saveFailures+=1,c.failedIntent=f,c.saveFailures,v(),!1}if(c.closed)return!1;const{payload:B,version:T}=gu(c.document,g,D,f);c.document.get().docId;try{const O=c.document.get().serverId!=null,L=await yu(r(),i(c.request.key),f,c.document.get().serverId,B);if(c.closed)return!0;let ie;if(f==="snapshot"||f==="anchor"){const k=L?.modified!=null?Date.parse(L.modified):NaN;ie=Number.isFinite(k)?k:Date.now(),c.snapshotVersion=T,c.lastRevisionAt=ie}else c.document.markSaved(T,L?.id!=null?String(L.id):void 0),c.savedContent=B.html;A(c,O),c.saveError=void 0,c.saveFailures=0,c.failedIntent=void 0,c.document.get().serverId,v();const xe={intent:f,serverId:c.document.get().serverId,created:!O,...ie!==void 0?{revisionAt:ie}:{}};return b.forEach(k=>k(xe)),!0}catch(O){return(f==="publish"||f==="materialize")&&iu(O)?.then(L=>I(c,T,L)),c.saveError=O,c.saveFailures+=1,c.failedIntent=f,c.saveFailures,v(),!1}},y=()=>{d&&(d.closed=!0,d.watchers.forEach(c=>c()),d.watchers=[],_i(d),d.history.dispose(),d.document.dispose(),d=void 0)},C=(c,f,g)=>{let P=!1;f.show&&(c.show?.id!==f.show.id||c.show.token!==f.show.token)&&(c.show=f.show,P=!0,{docId:c.document.get().docId,...f.show});const D=g==="show"?cs(f.patch):null;D&&(c.reports.set("plugin",D),In(c,D),Lu(c,D)),P&&v()},R=(c,f={})=>{const g=d;return!g||g.closed||c==="materialize"&&g.document.get().serverId!=null?Promise.resolve(!1):g.saving?c==="snapshot"||c==="materialize"?Promise.resolve(!1):(g.inFlight??Promise.resolve(!1)).then(()=>R(c,f)):(g.saving=!0,v(),g.inFlight=x(g,c,f).finally(()=>{g.saving=!1,g.inFlight=void 0,d===g&&!g.closed&&v()}),g.inFlight)},m=(c,f="open")=>{if(d&&!d.closed&&f!=="new"&&Pu(d.request,c))return C(d,c,f),d.document;y();const g=Gc({createBuffer:()=>Fc(""),serverId:c.serverId??null}),P={request:c,show:c.show,document:g,history:Kc(g,{now:Date.now}),watchers:[],userTouched:new Set,saveFailures:0,saving:!1,reports:new Map,ready:!1,closed:!1};return d=P,P.watchers.push(Mu(P)),g.get().docId,c.serverId,h(P,t(c,{publishRecoveryFacts(D){P.closed||(P.recoveryFacts=D,v())},readShownContent:()=>P.closed?null:P.document.getContent()})),v(),g};return{openWith:m,open:(c,f={})=>m({key:We(c),serverId:c,email:f.email,patch:f.patch,show:f.show},"open"),openDraft:(c,f={})=>m({key:We(void 0),serverId:null,email:c,patch:f.patch,show:f.show},"open"),startNewDraft:(c,f={})=>m({key:We(void 0),serverId:null,email:c,patch:f.patch,show:f.show},"new"),reload:(c,f={})=>m({key:We(c),serverId:c,email:f.email,patch:f.patch,show:f.show},"new"),openBlock:(c,f)=>m({key:ge(c)?c:lu(c),serverId:f?.id!=null?String(f.id):null,email:f},"open"),show:(c,f)=>{const g=d;if(!(!g||g.closed))return m({...g.request,patch:c,show:f},"show")},current:()=>d?.document,noteServerFacts:({serverId:c,block:f},g)=>{const P=d;!P||P.closed||P.request.serverId!==c||ge(P.request.key??"")===f&&kr(P.document,Au(g))},save:R,saveState:()=>({error:d?.saveError,failures:d?.saveFailures??0,saving:d?.saving===!0,failedIntent:d?.failedIntent}),revisionFacts(){if(!d)return;const c=d.revisionFactsSnapshot;return c&&c.snapshotVersion===d.snapshotVersion&&c.lastRevisionAt===d.lastRevisionAt?c:(d.revisionFactsSnapshot={snapshotVersion:d.snapshotVersion,lastRevisionAt:d.lastRevisionAt},d.revisionFactsSnapshot)},recoveryFacts:()=>d?.recoveryFacts,history:()=>d?.history,forcedHeaders:()=>d?.forcedHeaders,beginForcedHeaders(c){d&&!d.closed&&(d.forcedHeaders=c)},endForcedHeaders(){d&&(d.forcedHeaders=void 0)},onSaved(c){return b.add(c),()=>b.delete(c)},showFacts:()=>d?.show,sessionKey:()=>d?.request.key,openError:()=>d?.error,subscribe(c){return p.add(c),()=>p.delete(c)},close(){d&&(y(),v())}}}var ds=class extends Error{reason;constructor(e,t){super(`письмо не открылось: ${e}`),this.name="EmailOpenFailedError",this.reason=e,this.cause=t}};function fs(e){if(e instanceof ds)return e.reason;if(e instanceof tn)return fs(e.reason)}function Bu(e,t){return{id:"rest",required:!0,load:async()=>{const n=await e.readEmail(t);if(!n)throw new ds("not-found");return ls(n)}}}var ps=N("EmailPort");function Uu(e){return e.getInstance(ps)}function Hu(e,t){e.inject(ps,t)}var hs=N("documentSession.restEmailPortFactories");function ms(e){return e.getInstance(hs)!==void 0}function He(e){const t=e.getInstance(hs);if(!t)throw new Error("[documentSession] порты поверх REST ещё не загружены — работа с сервером начинается с init()");return t}var $u=N("EmailTermsResolver");function Vu(e){return e.getInstance($u)}var gs=N("EmailHistoryPort"),qu=N("BlockHistoryPort");function vs(e){return e.getInstance(qu)}function bs(e){return e.getInstance(gs)}function Gu(e,t){e.inject(gs,t)}var zu="em_autosave_pending";function nn(e){return`${zu}_${e}`}function Wu(e,t){try{sessionStorage.setItem(nn(e),JSON.stringify(t))}catch{}}function ys(e){try{const t=sessionStorage.getItem(nn(e));if(!t)return null;const n=JSON.parse(t);return Date.now()-n.sentAt>6e4?(sessionStorage.removeItem(nn(e)),null):n}catch{return null}}function ct(e){try{sessionStorage.removeItem(nn(e))}catch{}}var Ku=2e3,Yu=5e3,Xu=5,Ju=5e3,Qu=4;function Zu(){return typeof performance<"u"&&typeof performance.timeOrigin=="number"?performance.timeOrigin:Date.now()}function ed(e,t){return e==null||t==null?!1:e.replaceAll(`\r
|
|
999
999
|
`,`
|
|
1000
1000
|
`)===t.replaceAll(`\r
|
|
1001
1001
|
`,`
|
|
1002
|
-
`)}function Xt(e,t){return er(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function gd({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:l,pageLoadTs:d=hd()}){let u=null,h=!1,g=!1,E=0,b={emailId:e,historyLoaded:!1,isRecovering:!1},w=null;const _=new Promise(C=>{w=C}),m=C=>{b={...b,...C},o(b)};let S;const y=C=>{E+=1,m({applied:{phase:C,seq:E}})},I=()=>{u?.timer&&clearTimeout(u.timer),u=null},T=C=>{if(!g){if(w){const L=w;w=null,L(C),S=C.revision?C.phase:void 0;return}s(C)&&C.revision&&y(C.phase)}},R=()=>{if(!u||g)return;const C=u.phase==="fast",L=C?dd:fd,G=C?ud:pd;u.timer=setTimeout(()=>{const P=u;if(!(!P||g)){if(P.attempts+=1,c(),C&&P.attempts>=G){const{pending:O}=P;pt(e),m({isRecovering:!1}),T({revision:{html:O.html,common_styles:O.common_styles,subject:O.subject,preheader:O.preheader},phase:"timeout"}),h=!0,P.phase="bg",P.attempts=0,R();return}if(!C&&P.attempts>=G){pt(e),I(),m({isRecovering:!1}),h=!0;return}R()}},L),u.timer.unref?.()},v=C=>{u={phase:"fast",attempts:0,pending:C,timer:null},m({isRecovering:!0}),R()},f=C=>{if(g)return;if(m({historyLoaded:!0,latestRevisionAt:C.latestAt!==void 0&&Number.isFinite(C.latestAt)?C.latestAt:void 0}),n&&u){const P=Xt(C,u.pending.sentAt);if(!P)return;const O=u.phase==="fast"?"found":"bg";pt(e),I(),m({isRecovering:!1}),h=!0,T({revision:P,phase:O});return}if(h)return;const L=n?ld(e):null,G=L&&(L.sentAt<d||!md(L.html,i()))?L:null;if(G){const P=Xt(C,G.sentAt);if(P){pt(e),h=!0,T({revision:P,phase:"found"});return}v(G);return}h=!0,T({revision:Xt(C),phase:"normal"})},a=C=>{g||(l?.(C),b.historyLoaded||(m({historyLoaded:!1,latestRevisionAt:void 0}),x()),!u&&T({revision:null,phase:"normal"}))},c=()=>t(e).then(f).catch(a);let p,A=!1;const x=()=>{A||u||g||(A=!0,p=setTimeout(()=>{p=void 0,!g&&!b.historyLoaded&&c()},cd))},j=()=>{g||(m({historyLoaded:!1,latestRevisionAt:void 0}),T({revision:null,phase:"normal"}))};return r?r().then(C=>C?c():j()):c(),{verdict:()=>_,confirmVerdict(C){const L=S;S=void 0,C&&L!==void 0&&!g&&y(L)},dispose(){g=!0,p!==void 0&&(clearTimeout(p),p=void 0),I()}}}function vd({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const l=gd({emailId:r,readAutosave:d=>e.readAutosave(d),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:d,phase:u})=>{const h=Lr(d);return s?.(h)??!1},onError:d=>{d instanceof Error&&d.message}});return{id:"recovery",load:()=>l.verdict().then(({revision:d})=>Lr(d)),loaded(d){l.confirmVerdict(d)},watch(d){return s=d,()=>{s=null,l.dispose()}}}}function _o(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){ad(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const i=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),i}}}function bd(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=await t.updateEmail(n,r);return await e.updateEmail(n,r),i}}}var wo=N("CurrentUser"),So={};function ir(e){return e.getOrCreateInstance(wo,()=>Ce(So))}function Io(e){return e?.getInstance(wo)?.get()??So}function Ao(e){return e?.getInstance(ye)?.get()??{}}var yd=1.5;function Ed(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<=yd*e.autosaveTimeoutMs?"none":"revision"}var _d=4;function wd(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=()=>n().autosaveTimeoutMs*2**Math.min(o(),_d),l=()=>{const S=t();if(!S||S.isDisposed())return"none";const{latestRevisionAt:y,snapshotVersion:I,...T}=n();return Ed({...T,isDirty:S.isDirty(),isNew:S.isNew(),isReady:S.isReady(),latestRevisionAgeMs:y!=null?Date.now()-y:void 0,isSnapshotSent:I!=null&&I===S.get().version})},d=()=>{const S=t();if(!S||S.isDisposed())return!1;if(!S.isDirty())return S.isNew();const{snapshotVersion:y}=n();return!(y!=null&&y===S.get().version)};let u,h,g,E,b=!1;const w=()=>{h=void 0;const S=t();if(!S||S.isDisposed())return;if(S.get().docId!==u){_();return}const y=l();y==="create"?r():y==="revision"?i():d()&&(u=S.get().docId,h=setTimeout(w,s()))},_=()=>{const S=t();b||!S||h!==void 0||l()==="none"&&!d()||(u=S.get().docId,h=setTimeout(w,s()))},m=()=>{const S=t();S!==g&&(E?.(),g=S,E=S?.subscribe(_),h!==void 0&&(clearTimeout(h),h=void 0))};return m(),_(),{refresh:()=>{b||(m(),_())},stop:()=>{b=!0,E?.(),E=void 0,g=void 0,h!==void 0&&(clearTimeout(h),h=void 0)}}}var Co=N("documentSession.autosaveUiFacts"),To={isUserBusy:!1,saveContext:{}};function Sd(e){return e.getOrCreateInstance(Co,()=>Ce(To))}function Fr(e){return e?.getInstance(Co)?.get()??To}var Id=1e4;function Ad(e,t){const n=()=>{const d=t.current(),u=d?.get().serverId??void 0,h=de(t.sessionKey()),g=t.recoveryFacts(),E=g?.emailId===u?g:void 0,b=t.revisionFacts(),w=E?.latestRevisionAt,_=b?.lastRevisionAt,m=Io(e).profile;return{isInited:h||d?.get().attributes.is_inited===!0,isEnabled:!!m?.autosaves,isHistoryLoaded:E?.historyLoaded===!0,isUserBusy:Fr(e).isUserBusy,autosaveTimeoutMs:Ao(e).autosaveTimeout||Id,latestRevisionAt:w!==void 0||_!==void 0?Math.max(w??0,_??0):void 0,snapshotVersion:b?.snapshotVersion}},r=()=>{const d=Fr(e).saveContext;return{...d,project:d.project??t.current()?.get().attributes.project}},i=wd({readDocument:()=>t.current(),readEnvironment:n,readFailures:()=>t.saveState().failures,onCreate:()=>{de(t.sessionKey())||t.save("materialize",r())},onRevision:()=>{t.save("snapshot",{project:r().project})}}),o=t.subscribe(i.refresh),s=ir(e).watch(()=>i.refresh()),l=Sd(e).watch(()=>i.refresh());return()=>{o(),s.dispose(),l.dispose(),i.stop()}}var jr=12e3;function we(e){return e.getOrCreateInstance(Jn,()=>{const t=Ql({resolveAdapters:(r,i)=>Rd(r,e,i),resolveWritePort:()=>Ro(e),resolveHistoryPort:r=>de(r)?Do(e):Po(e),resolveTerms:()=>rd(e),canEdit:r=>el(e,r),notifyBeforeSave:al(e),timeoutMs:jr,onAdapterError:(r,i)=>{i instanceof Error&&i.message,Ft(i,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=Ad(e,t);return e.getInstance(B)?.addDispose(n),t})}function or(e){return e?.getInstance(Jn)}function Ro(e){const t=ed(e);return t?sr(e)?bd(t,Ae(e).email(e)):t:Ae(e).email(e)}function Cd(e){return Eo(e)!==void 0||vo(e)}function Po(e){const t=Eo(e);return t?sr(e)?(W("port:history:server-backed"),_o(t,Ae(e).history(e))):(W("port:history:integrator"),t):(W("port:history:rest (порт не зарегистрирован)"),Ae(e).history(e))}function Do(e){const t=yo(e);return t?sr(e)?(W("port:block-history:server-backed"),_o(t,Ae(e).blockHistory(e))):(W("port:block-history:integrator"),t):(W("port:block-history:rest (порт не зарегистрирован)"),Ae(e).blockHistory(e))}function Td(e){return yo(e)!==void 0||vo(e)}function sr(e){return Ji(e)}function Rd({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>co(e),required:!0}):n&&s.push(Zl(Ro(i),n)),t&&s.push({id:"plugin",load:()=>uo(t)});const l=de(r);return ll(n)&&(l?Td(i):Cd(i))&&s.push(vd({port:l?Do(i):Po(i),revisionServiceEnabled:Ji(i),...!l&&tl(i)?{isHistoryAvailable:()=>nl(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:d=>o.publishRecoveryFacts(d)})),s}function ee(e){return e.getOrCreateInstance(st,()=>new at)}var Oo=new WeakMap,Sn=new WeakMap;function me(e){return Oo.get(e)??0}function xo(e,t){let n=Sn.get(e);return n||(n=new Set,Sn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Pd(e){Oo.set(e,me(e)+1),Sn.get(e)?.forEach(t=>t())}function Dd(e){const t=we(e),n=ee(e).addListener(U.APPLICATION_HAS_AMP,r=>{Ke(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(B)?.addDispose(()=>n.dispose())}function Od(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function xd(e){const t=e.fetchImpl??((o,s)=>fetch(o,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,i=o=>{try{const s=new URL(o,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:i,async load(o){if(!i(o))return;const s=!r.has(o);r.add(o);try{const l=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!l.ok)return;const d=await l.blob();return Od(d)?d:void 0}catch{return}}}}var Ie={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Md(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,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const l=g=>{const E=r.get(g);E&&(s-=E.bytes,r.delete(g))},d=g=>t.ttlMs<=0||n()-g.storedAt<t.ttlMs,u=()=>{if(s<=t.maxBytes)return;const g=[...r.entries()].sort((E,b)=>E[1].usedAt-b[1].usedAt);for(const[E]of g){if(s<=t.maxBytes)return;l(E)}},h=(g,E)=>{E.size>t.maxImageBytes||(r.set(g,{blob:E,bytes:E.size,storedAt:n(),usedAt:n()}),s+=E.size,u())};return{async get(g){const E=r.get(g);if(E&&d(E))return E.usedAt=n(),o.hits+=1,E.blob;E&&l(g);const b=i.get(g);if(b!==void 0)return b;o.loads+=1;const w=(async()=>{try{const _=await e.load(g);return _?h(g,_):o.failures+=1,_}catch{o.failures+=1;return}finally{i.delete(g)}})();return i.set(g,w),w},forget(g){l(g),i.delete(g)},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var Ld=["emcdn.ru","scr.emcdn.ru"];function kd(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 Nd(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const l=kd(s);l&&o.add(l)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Br(e){const t=e??{},n=t.isPlugin!==!0?Ld:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Ie};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:Nd(i.sourceHosts,n),maxBytes:i.maxBytes??Ie.maxBytes,maxImageBytes:i.maxImageBytes??Ie.maxImageBytes,ttlMs:i.ttlMs??Ie.ttlMs}}function Fd(e){const t=ee(e),n=e.getInstance(ye);let r=Br(n?.get());const i=xd({sourceHosts:()=>r.sourceHosts}),o=Md({load:w=>i.load(w),maxBytes:r.maxBytes,maxImageBytes:r.maxImageBytes,ttlMs:r.ttlMs}),s=()=>{t.send(U.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:r.enabled,sourceHosts:[...r.sourceHosts]})},l=t.onInit(()=>s()),d=n?.watch(()=>{const w=Br(n.get()),_=JSON.stringify(w)!==JSON.stringify(r);r=w,w.enabled||o.clear(),_&&t.isInited()&&s()}),u={asked:0,served:0,refused:0},h=[],g=(w,_)=>(u.refused+=1,h.push({url:w,reason:_}),h.length>20&&h.shift(),{refused:!0}),E=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:r,counters:{...u},refusals:[...h],store:o.stats()})}),b=t.addListenerAsync(U.APPLICATION_CANVAS_IMAGE_GET,async w=>{const _=w?.url??"";if(u.asked+=1,!r.enabled||!_)return g(_,"disabled");if(!i.accepts(_))return g(_,"host");w.fresh&&o.forget(_);const m=await o.get(_);return m?(u.served+=1,{blob:m}):g(_,"load-failed")});e.getInstance(B)?.addDispose(()=>{l.dispose(),d?.dispose(),b.dispose(),o.clear(),delete E.__emmCanvasImages__})}var jd=2e3;function Bd(e){const t=ee(e),n=new Set,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;const l=new MessageChannel;let d=!1;const u=g=>{g.data?.operationId==="em:port-ready"&&(d=!0,l.port1.removeEventListener("message",u),t.drainWindow(s))};l.port1.addEventListener("message",u),t.sendPort(s,l.port2),t.usePort(l.port1,!1,s);const h=setTimeout(()=>{n.delete(h),!d&&(Ft(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),l.port1.removeEventListener("message",u),t.useWindow(s))},jd);n.add(h)},i=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),o=t.onInit(()=>r());e.getInstance(B)?.addDispose(()=>{for(const s of n)clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var Ud=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function Hd(e){return Ud.test(e)||e.indexOf("//")===0}function ht(e){return e&&(e.endsWith("/")?e:`${e}/`)}function $d(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Ur(e,t){const n=e==null||e===""?"./":String(e);if(Hd(n))return ht(n);const r=t??$d();if(!r)return ht(n);try{return ht(new URL(n,r).href)}catch{return ht(n)}}function Gd(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?Ur(window.__useblocks__.publicPath):Ur("/")}var qd=()=>"",zd=()=>"8098d114";function Mo(e){const t=e?"iframe-eblock":"iframe",n=qd();if(n){const o=n.replace(/\/?$/,"/");return Cr(`${o}${t}.html`,tt())}const r=zd(),i=`${Gd().replace(/\/?$/,"/")}iframe/`;return Cr(`${i}${t}${r?`.${r}`:""}.html`,tt())}var Hr="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function In(e){return/^file:/i.test(String(e||"").trim())}function Vd(e){return In(e)?`${Hr} allow-same-origin`:Hr}var Kd="em:module-body-ack";function Wd(e,t,n){try{const r=new URL("./",new URL(t,n)).href,i=new URL(e,r).href;return i.startsWith(r)?i:void 0}catch{return}}function ar(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 Yd(e,t){const n=ar(t)?.replace(/^js\/|\.body\.js$/g,""),r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function Xd(e,t){const n=ar(t)?.replace(/\.body\.js$/,".js");if(!n||!(n in e))return[];const r=new Set([n]),i=[n],o=[];for(;i.length>0;)for(const s of e[i.shift()]??[])r.has(s)||(r.add(s),o.push(s),i.push(s));return o}async function Jd(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 Qd(e){const t=new Map,n=(r,i)=>{const o=Wd(r,e.canvasSrc,e.origin);if(!o)return;const s=t.get(o);if(s!==void 0)return s;const l=e.fetchBody(o,i);return t.set(o,l),l};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,i){for(const o of r)n(o,i)},reset(){t.clear()},get size(){return t.size}}}var ve;function Zd(e){try{return In(new URL(e,window.location.href).href)}catch{return In(window.location.href)}}function Lo(){const e=Mo(!1);if(!Zd(e))return(!ve||ve.canvasSrc!==e)&&(ve={canvasSrc:e,store:Qd({canvasSrc:e,origin:window.location.href,fetchBody:Jd}),warmed:!1}),ve.store}async function ec(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 i=await r.json();t(Yd(i,e))}catch{}}function lr(e){const t=Lo();if(!t||!ve||ve.warmed)return;ve.warmed=!0;const{canvasSrc:n}=ve,r=ar(n);r&&t.warm([r],e);const i={"js/iframe-eblock.js":["js/discussHandlers.CCCXIEaO.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.CCCXIEaO.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.CCCXIEaO.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"]};i?t.warm(Xd(i,n),e):ec(n,o=>t.warm(o,e))}function tc(e){const t=Lo();if(!t)return;lr();const n=r=>{const i=r.data;if(!i||i.operationId!=="em:module-body"||!i.result)return;const o=r.source;o&&(o.postMessage({operationId:Kd,for:i.result},"*"),t.take(i.data?.url??"").then(s=>{o.postMessage({operationId:i.result,data:s??null},"*")}))};window.addEventListener("message",n),e.getInstance(B)?.addDispose(()=>{window.removeEventListener("message",n)})}var Le=/<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,nc=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,Be=/<style\b[^>]*>[\s\S]*?<\/style>/gi,$r=/display:\s*none\s*!important/gi,rc=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,ic=/\s*height\s*:\s*100%\s*!important\s*;?/gi,oc=/height\s*:\s*100%\s*!important/i,sc=[".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 ac(e){return $r.lastIndex=0,(e.match($r)||[]).length}function ko(e){const t=e.trim(),n=ac(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=sc.filter(i=>t.includes(i)).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 lc(e){Be.lastIndex=0;for(const t of e.matchAll(Be))if(ko(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function dc(e){let t=!1;return Be.lastIndex=0,{html:e.replace(Be,n=>ko(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function cc(e){return Le.lastIndex=0,Le.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||lc(e)}function uc(e){if(!cc(e))return{html:e,found:!1};let t=!1,n=e;Le.lastIndex=0,Le.test(n)&&(Le.lastIndex=0,n=n.replace(Le,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(nc,""),t=!0);const r=dc(n);return n=r.html,t=t||r.found,{html:n,found:t}}function fc(e){return!e||!oc.test(e)?e:(Be.lastIndex=0,e.replace(Be,t=>t.replace(rc,(n,r,i,o)=>`${r}${i.replace(ic,"")}${o}`)))}function No(e){const t=uc(e.replaceAll(`\r
|
|
1002
|
+
`)}function Cn(e,t){return Lr(e.autosave,t===void 0?{}:{freshSince:t})?e.autosave:null}function td({emailId:e,readAutosave:t,revisionServiceEnabled:n,isHistoryAvailable:r,readShownContent:i,onFacts:o,onLate:s,onError:a,pageLoadTs:l=Zu()}){let u=null,d=!1,p=!1,b=0,v={emailId:e,historyLoaded:!1,isRecovering:!1},S=null;const E=new Promise(D=>{S=D}),h=D=>{v={...v,...D},o(v)};let w;const _=D=>{b+=1,h({applied:{phase:D,seq:b}})},A=()=>{u?.timer&&clearTimeout(u.timer),u=null},I=D=>{if(!p){if(S){const B=S;S=null,B(D),w=D.revision?D.phase:void 0;return}s(D)&&D.revision&&_(D.phase)}},x=()=>{if(!u||p)return;const D=u.phase==="fast",B=D?Ku:Ju,T=D?Xu:Qu;u.timer=setTimeout(()=>{const O=u;if(!(!O||p)){if(O.attempts+=1,m(),D&&O.attempts>=T){const{pending:L}=O;ct(e),h({isRecovering:!1}),I({revision:{html:L.html,common_styles:L.common_styles,subject:L.subject,preheader:L.preheader},phase:"timeout"}),d=!0,O.phase="bg",O.attempts=0,x();return}if(!D&&O.attempts>=T){ct(e),A(),h({isRecovering:!1}),d=!0;return}x()}},B),u.timer.unref?.()},y=D=>{u={phase:"fast",attempts:0,pending:D,timer:null},h({isRecovering:!0}),x()},C=D=>{if(p)return;if(h({historyLoaded:!0,latestRevisionAt:D.latestAt!==void 0&&Number.isFinite(D.latestAt)?D.latestAt:void 0}),n&&u){const O=Cn(D,u.pending.sentAt);if(!O)return;const L=u.phase==="fast"?"found":"bg";ct(e),A(),h({isRecovering:!1}),d=!0,I({revision:O,phase:L});return}if(d)return;const B=n?ys(e):null,T=B&&(B.sentAt<l||!ed(B.html,i()))?B:null;if(T){const O=Cn(D,T.sentAt);if(O){ct(e),d=!0,I({revision:O,phase:"found"});return}y(T);return}d=!0,I({revision:Cn(D),phase:"normal"})},R=D=>{p||(a?.(D),v.historyLoaded||(h({historyLoaded:!1,latestRevisionAt:void 0}),g()),!u&&I({revision:null,phase:"normal"}))},m=()=>t(e).then(C).catch(R);let c,f=!1;const g=()=>{f||u||p||(f=!0,c=setTimeout(()=>{c=void 0,!p&&!v.historyLoaded&&m()},Yu))},P=()=>{p||(h({historyLoaded:!1,latestRevisionAt:void 0}),I({revision:null,phase:"normal"}))};return r?r().then(D=>D?m():P()):m(),{verdict:()=>E,confirmVerdict(D){const B=w;w=void 0,D&&B!==void 0&&!p&&_(B)},dispose(){p=!0,c!==void 0&&(clearTimeout(c),c=void 0),A()}}}function nd({port:e,revisionServiceEnabled:t,isHistoryAvailable:n,emailId:r,readShownContent:i,onFacts:o}){let s=null;const a=td({emailId:r,readAutosave:l=>e.readAutosave(l),revisionServiceEnabled:t,...n?{isHistoryAvailable:n}:{},readShownContent:i,onFacts:o,onLate:({revision:l,phase:u})=>{const d=Ei(l);return s?.(d)??!1},onError:l=>{l instanceof Error&&l.message}});return{id:"recovery",load:()=>a.verdict().then(({revision:l})=>Ei(l)),loaded(l){a.confirmVerdict(l)},watch(l){return s=l,()=>{s=null,a.dispose()}}}}function Es(e,t){return{readRevisions:(n,r)=>t.readRevisions(n,r),readAutosave:n=>t.readAutosave(n),async saveAutosave(n,r){Wu(n,{sentAt:Date.now(),html:r.html??"",common_styles:r.common_styles??"",subject:r.subject,preheader:r.preheader});const i=await t.saveAutosave(n,r);return await e.saveAutosave(n,r),i}}}function rd(e,t){return{readEmail:n=>e.readEmail(n),createEmail:n=>e.createEmail(n),async updateEmail(n,r){const i=Date.now(),o=await t.updateEmail(n,r);return await e.updateEmail(n,r),(ys(n)?.sentAt??Number.POSITIVE_INFINITY)<=i&&ct(n),o}}}var _s=N("CurrentUser"),ws={};function jr(e){return e.getOrCreateInstance(_s,()=>ve(ws))}function Ss(e){return e?.getInstance(_s)?.get()??ws}var Is=N("HeadlessMode");function Cs(e){return e.getOrCreateInstance(Is,()=>ve(!1))}function id(e){return e?.getInstance(Is)?.get()??!1}var od=N("HiddenMount");function sd(e){return e.getOrCreateInstance(od,()=>ve(!1))}function Ts(e){return e?.getInstance(ee)?.get()??{}}function pn(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function ad(e,t){return t.modeDefaults(pn(e,t.fallbackMode))}function As(e,t){const n=pn(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function Rs(e,t){const n=pn(e,t),r=e.user?.advancedConfigs?.[n],i=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...i}}function ld(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function cd(e){return dl(e.map(t=>t?.resourceProxy))}function ud(e){return Sl(e.map(t=>t?.resourceProxyPolicy))}function dd(e){return fl(e.map(t=>t?.backendProxy))}function fd(e){return No(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function pd(e,t){return[e.base,ad(e,t),e.profile,e.serverSide,As(e,t.fallbackMode),e.local,e.user,Rs(e,t.fallbackMode)]}function Tn(e,t){const n=pd(e,t),r=No(n),i=ld(n);i!==void 0&&(r.fileManager=i);const o=cd(n);o!==void 0&&(r.resourceProxy=o);const s=ud(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const a=dd(n);a!==void 0&&(r.backendProxy=a);const l=fd(n);return l&&Object.keys(l).length>0&&(r.backendProxyPolicy=l),r}function hd(e,t,n){const r=As(e,n),i=Rs(e,n);return al([i,e.user,r,e.serverSide],t)}var md=1.5;function gd(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<=md*e.autosaveTimeoutMs?"none":"revision"}function vd(e){const{readDocument:t,readEnvironment:n,onCreate:r,onRevision:i}=e,o=e.readFailures??(()=>0),s=e.readFailureRetryable??(()=>!0);let a;const l=C=>a!==void 0&&a.version===C.get().version?o()-a.failuresAtStart:0,u=C=>{const R=l(C);if(R<=0)return!1;const m=n().retryMaxAttempts??5;return!s()||R>m},d=()=>{const{autosaveTimeoutMs:C,retryIntervalMs:R}=n(),m=t();return m!==void 0&&l(m)>0&&R!==void 0&&R>0?R:C},p=C=>C.isNew()&&o()>=3,b=()=>{const C=t();if(!C||C.isDisposed()||u(C))return"none";const{latestRevisionAt:R,snapshotVersion:m,...c}=n(),f=Date.now(),g=gd({...c,isDirty:C.isDirty(),isNew:C.isNew(),isReady:C.isReady(),latestRevisionAgeMs:R!=null&&R<=f?f-R:void 0,isSnapshotSent:m!=null&&m===C.get().version});return g==="create"&&p(C)?"none":g},v=()=>{const C=t();if(!C||C.isDisposed()||p(C)||u(C)||n().isHeadless)return!1;if(!C.isDirty())return C.isNew();const{snapshotVersion:R}=n();return!(R!=null&&R===C.get().version)};let S,E,h,w,_=!1;const A=()=>{E=void 0;const C=t();if(!C||C.isDisposed())return;if(C.get().docId!==S){I();return}const R=b();R!=="none"&&a?.version!==C.get().version&&(a={version:C.get().version,failuresAtStart:o()}),R==="create"?r():R==="revision"?i():v()&&(S=C.get().docId,E=setTimeout(A,d()))},I=()=>{const C=t();_||!C||E!==void 0||b()==="none"&&!v()||(S=C.get().docId,E=setTimeout(A,d()))},x=C=>{C.source==="user"&&E!==void 0&&(clearTimeout(E),E=void 0),I()},y=()=>{const C=t();C!==h&&(w?.(),h=C,a=void 0,w=C?.subscribe(x),E!==void 0&&(clearTimeout(E),E=void 0))};return y(),I(),{refresh:()=>{_||(y(),I())},stop:()=>{_=!0,w?.(),w=void 0,h=void 0,E!==void 0&&(clearTimeout(E),E=void 0)}}}var Ps=N("documentSession.autosaveUiFacts"),Ds={isUserBusy:!1,saveContext:{}};function bd(e){return e.getOrCreateInstance(Ps,()=>ve(Ds))}function Yn(e){return e?.getInstance(Ps)?.get()??Ds}function Os(e){return Yn(e).saveContext.fallbackTitle||"Untitled email."}var yd=1e4,Ed=3e4;function _d(e,t){const n=d=>{const p=e.getInstance(ee)?.layers?.(),b=p?hd(p,d):void 0;return typeof b=="number"&&b>=0?b:void 0},r=()=>{const d=t.current(),p=d?.get().serverId??void 0,b=ge(t.sessionKey()),v=t.recoveryFacts(),S=v?.emailId===p?v:void 0,E=t.revisionFacts(),h=S?.latestRevisionAt,w=E?.lastRevisionAt,_=Ss(e).profile;return{isInited:b||d?.get().attributes.is_inited===!0,isEnabled:!!_?.autosaves,isHistoryLoaded:S?.historyLoaded===!0,isUserBusy:Yn(e).isUserBusy,isHeadless:id(e),autosaveTimeoutMs:Ts(e).autosaveTimeout||yd,latestRevisionAt:h!==void 0||w!==void 0?Math.max(h??0,w??0):void 0,snapshotVersion:E?.snapshotVersion,retryIntervalMs:n("autosaveRetryIntervalMs")??Ed,retryMaxAttempts:n("autosaveRetryMaxAttempts")}},i=()=>{const d=Yn(e).saveContext;return{...d,project:d.project??t.current()?.get().attributes.project,fallbackTitle:Os(e)}},o=vd({readDocument:()=>t.current(),readEnvironment:r,readFailures:()=>t.saveState().failures,readFailureRetryable:()=>au(t.saveState().error),onCreate:()=>{ge(t.sessionKey())||t.save("materialize",i())},onRevision:()=>{t.save("snapshot",{project:i().project})}}),s=t.subscribe(o.refresh),a=jr(e).watch(()=>o.refresh()),l=bd(e).watch(()=>o.refresh()),u=Cs(e).watch(()=>o.refresh());return()=>{s(),a.dispose(),l.dispose(),u.dispose(),o.stop()}}var Si=12e3;function De(e){return e.getOrCreateInstance(Dr,()=>{const t=ju({resolveAdapters:(r,i)=>Id(r,e,i),resolveWritePort:()=>xs(e),resolveHistoryPort:r=>ge(r)?Ls(e):Ms(e),resolveTerms:()=>Vu(e),canEdit:r=>Ac(e,r),notifyBeforeSave:Lc(e),timeoutMs:Si,onAdapterError:(r,i)=>{i instanceof Error&&i.message,Et(i,{origin:"email-source-adapter",tags:{source:r}})},onTimeout:r=>{}}),n=_d(e,t);return e.getInstance(H)?.addDispose(n),t})}function Br(e){return e?.getInstance(Dr)}function xs(e){const t=Uu(e);return t?Ur(e)?rd(t,He(e).email(e)):t:He(e).email(e)}function wd(e){return bs(e)!==void 0||ms(e)}function Ms(e){const t=bs(e);return t?Ur(e)?(K("port:history:server-backed"),Es(t,He(e).history(e))):(K("port:history:integrator"),t):(K("port:history:rest (порт не зарегистрирован)"),He(e).history(e))}function Ls(e){const t=vs(e);return t?Ur(e)?(K("port:block-history:server-backed"),Es(t,He(e).blockHistory(e))):(K("port:block-history:integrator"),t):(K("port:block-history:rest (порт не зарегистрирован)"),He(e).blockHistory(e))}function Sd(e){return vs(e)!==void 0||ms(e)}function Ur(e){return Go(e)}function Id({email:e,patch:t,serverId:n,key:r},i,o){const s=[];e?s.push({id:"rest",load:()=>ls(e),required:!0}):n&&s.push(Bu(xs(i),n)),t&&s.push({id:"plugin",load:()=>cs(t)});const a=ge(r);return kc(n)&&(a?Sd(i):wd(i))&&s.push(nd({port:a?Ls(i):Ms(i),revisionServiceEnabled:Go(i),...!a&&Rc(i)?{isHistoryAvailable:()=>Pc(i)}:{},emailId:n,readShownContent:()=>o.readShownContent(),onFacts:l=>o.publishRecoveryFacts(l)})),s}function ne(e){return e.getOrCreateInstance(At,()=>new Rt)}var ks=new WeakMap,Xn=new WeakMap;function me(e){return ks.get(e)??0}function Ns(e,t){let n=Xn.get(e);return n||(n=new Set,Xn.set(e,n)),n.add(t),()=>{n?.delete(t)}}function Cd(e){ks.set(e,me(e)+1),Xn.get(e)?.forEach(t=>t())}function Td(e){const t=De(e),n=ne(e).addListener($.APPLICATION_HAS_AMP,r=>{lt(t)?.mutate({attributes:{isAmp:r}},{source:"remote"})});e.getInstance(H)?.addDispose(()=>n.dispose())}function Ad(e){return e.size>0&&(e.type===""||e.type.startsWith("image/"))}function Rd(e){const t=e.fetchImpl??((o,s)=>fetch(o,s)),n=e.pageHost??(()=>window.location.hostname),r=new Set,i=o=>{try{const s=new URL(o,window.location.href);return s.protocol!=="https:"&&s.protocol!=="http:"?!1:s.hostname===n()||e.sourceHosts().includes(s.hostname)}catch{return!1}};return{accepts:i,async load(o){if(!i(o))return;const s=!r.has(o);r.add(o);try{const a=await t(o,{mode:"cors",credentials:"omit",cache:s?"no-cache":"default"});if(!a.ok)return;const l=await a.blob();return Ad(l)?l:void 0}catch{return}}}}var Ue={maxBytes:67108864,maxImageBytes:4194304,ttlMs:18e5};function Pd(e){const t={maxBytes:e.maxBytes??Ue.maxBytes,maxImageBytes:e.maxImageBytes??Ue.maxImageBytes,ttlMs:e.ttlMs??Ue.ttlMs},n=e.now??(()=>Date.now()),r=new Map,i=new Map,o={hits:0,loads:0,failures:0};let s=0;const a=p=>{const b=r.get(p);b&&(s-=b.bytes,r.delete(p))},l=p=>t.ttlMs<=0||n()-p.storedAt<t.ttlMs,u=()=>{if(s<=t.maxBytes)return;const p=[...r.entries()].sort((b,v)=>b[1].usedAt-v[1].usedAt);for(const[b]of p){if(s<=t.maxBytes)return;a(b)}},d=(p,b)=>{b.size>t.maxImageBytes||(r.set(p,{blob:b,bytes:b.size,storedAt:n(),usedAt:n()}),s+=b.size,u())};return{async get(p){const b=r.get(p);if(b&&l(b))return b.usedAt=n(),o.hits+=1,b.blob;b&&a(p);const v=i.get(p);if(v!==void 0)return v;o.loads+=1;const S=(async()=>{try{const E=await e.load(p);return E?d(p,E):o.failures+=1,E}catch{o.failures+=1;return}finally{i.delete(p)}})();return i.set(p,S),S},forget(p){a(p),i.delete(p)},configure(p){Object.assign(t,{maxBytes:p.maxBytes??t.maxBytes,maxImageBytes:p.maxImageBytes??t.maxImageBytes,ttlMs:p.ttlMs??t.ttlMs});for(const[b,v]of r)v.bytes>t.maxImageBytes&&a(b);u()},clear(){r.clear(),i.clear(),s=0},stats(){return{entries:r.size,bytes:s,...o}}}}var Dd=["emcdn.ru","scr.emcdn.ru"];function Od(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 xd(e,t){const n=(r,i)=>{const o=new Set(i?t:[]);for(const s of r){const a=Od(s);a&&o.add(a)}return[...o]};return e?Array.isArray(e)?n(e,!0):n(e.value??[],e.replace!==!0):[...t]}function Md(e){const t=e??{},n=t.isPlugin!==!0?Dd:[],r=t.canvasImageCache;if(r===!1)return{enabled:!1,sourceHosts:[],...Ue};const i=r===!0||r===void 0?{}:r;return{enabled:i.enabled!==!1,sourceHosts:xd(i.sourceHosts,n),maxBytes:i.maxBytes??Ue.maxBytes,maxImageBytes:i.maxImageBytes??Ue.maxImageBytes,ttlMs:i.ttlMs??Ue.ttlMs}}function Ld(e){const t=ne(e),n=e.getInstance(ee),r=()=>Md({...n?.get(),isPlugin:!0});let i=r();const o=Rd({sourceHosts:()=>i.sourceHosts}),s=Pd({load:E=>o.load(E),maxBytes:i.maxBytes,maxImageBytes:i.maxImageBytes,ttlMs:i.ttlMs}),a=()=>{t.send($.SANDBOX_CANVAS_IMAGE_CACHE_SETUP,{enabled:i.enabled,sourceHosts:[...i.sourceHosts]})},l=t.onInit(()=>a()),u=n?.watch(()=>{const E=r(),h=JSON.stringify(E)!==JSON.stringify(i);i=E,s.configure(E),E.enabled||s.clear(),h&&t.isInited()&&a()}),d={asked:0,served:0,refused:0},p=[],b=(E,h)=>(d.refused+=1,p.push({url:E,reason:h}),p.length>20&&p.shift(),{refused:!0}),v=Object.assign(globalThis,{__emmCanvasImages__:()=>({settings:i,counters:{...d},refusals:[...p],store:s.stats()})}),S=t.addListenerAsync($.APPLICATION_CANVAS_IMAGE_GET,async E=>{const h=E?.url??"";if(d.asked+=1,!i.enabled||!h)return b(h,"disabled");if(!o.accepts(h))return b(h,"host");E.fresh&&s.forget(h);const w=await s.get(h);return w?(d.served+=1,{blob:w}):b(h,"load-failed")});e.getInstance(H)?.addDispose(()=>{l.dispose(),u?.dispose(),S.dispose(),s.clear(),delete v.__emmCanvasImages__})}var kd=2e3;function Nd(e){const t=ne(e),n=new Set,r=()=>{const s=t.getTarget();if(!s||t.hasPort(s))return;const a=new MessageChannel;let l=!1;const u=p=>{p.data?.operationId==="em:port-ready"&&(l=!0,a.port1.removeEventListener("message",u),t.drainWindow(s))};a.port1.addEventListener("message",u),t.sendPort(s,a.port2),t.usePort(a.port1,!1,s);const d=setTimeout(()=>{n.delete(d),!l&&(Et(new Error("canvas port did not come up, staying on window messaging"),{origin:"canvas-channel"}),a.port1.removeEventListener("message",u),t.useWindow(s))},kd);n.add(d)},i=Object.assign(globalThis,{__emmCanvasPort__:()=>{const s=t.getTarget();return{usesPort:t.usesPort,windowDrained:s?t.isWindowDrained(s):!1}}}),o=t.onInit(()=>r());e.getInstance(H)?.addDispose(()=>{for(const s of n)clearTimeout(s);o.dispose(),delete i.__emmCanvasPort__})}var Fd=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function jd(e){return Fd.test(e)||e.indexOf("//")===0}function Ut(e){return e&&(e.endsWith("/")?e:`${e}/`)}function Bd(){return typeof document<"u"&&document.baseURI?document.baseURI:typeof window<"u"&&window.location?window.location.href:""}function Ii(e,t){const n=e==null||e===""?"./":String(e);if(jd(n))return Ut(n);const r=t??Bd();if(!r)return Ut(n);try{return Ut(new URL(n,r).href)}catch{return Ut(n)}}function Ud(){return typeof window.__useblocks__<"u"&&window.__useblocks__?.publicPath?Ii(window.__useblocks__.publicPath):Ii("/")}var Hd=()=>"",$d=()=>"714faf8a";function Fs(e){const t=e?"iframe-eblock":"iframe",n=Hd();if(n){const o=n.replace(/\/?$/,"/");return fi(`${o}${t}.html`,yt())}const r=$d(),i=`${Ud().replace(/\/?$/,"/")}iframe/`;return fi(`${i}${t}${r?`.${r}`:""}.html`,yt())}var Ci="allow-top-navigation allow-scripts allow-popups allow-popups-to-escape-sandbox";function Jn(e){return/^file:/i.test(String(e||"").trim())}function Vd(e){return Jn(e)?`${Ci} allow-same-origin`:Ci}var qd="em:module-body-ack";function Gd(e,t,n){try{const r=new URL("./",new URL(t,n)).href,i=new URL(e,r).href;return i.startsWith(r)?i:void 0}catch{return}}function Hr(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 zd(e){const t=Hr(e);if(t)return t.hash?`js/${t.name}.body.${t.hash}.js`:`js/${t.name}.body.js`}function Wd(e,t){const n=Hr(t)?.name,r=n?e[`${n}.html`]:void 0;return r?(r.imports??[]).map(i=>e[i]?.file).filter(i=>!!i):[]}function Kd(e,t){const n=Hr(t)?.name,r=n?`js/${n}.js`:void 0;if(!r||!(r in e))return[];const i=new Set([r]),o=[r],s=[];for(;o.length>0;)for(const a of e[o.shift()]??[])i.has(a)||(i.add(a),s.push(a),o.push(a));return s}async function Yd(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 Xd(e){const t=new Map,n=(r,i)=>{const o=Gd(r,e.canvasSrc,e.origin);if(!o)return;const s=t.get(o);if(s!==void 0)return s;const a=e.fetchBody(o,i);return t.set(o,a),a};return{take(r){return n(r)??Promise.resolve(void 0)},warm(r,i){for(const o of r)n(o,i)},reset(){t.clear()},get size(){return t.size}}}var _e;function Jd(e){try{return Jn(new URL(e,window.location.href).href)}catch{return Jn(window.location.href)}}function js(e){try{if(new URL(e,window.location.href).origin===window.location.origin)return!0}catch{return!1}return typeof window.__useblocks__<"u"&&window.__useblocks__?.preload?.canvasCrossOrigin===!0}var Qd=()=>Promise.resolve(void 0);function Bs(){const e=Fs(!1);if(!Jd(e)){if(!_e||_e.canvasSrc!==e){const t=js(e)?Yd:Qd;_e={canvasSrc:e,store:Xd({canvasSrc:e,origin:window.location.href,fetchBody:t}),warmed:!1}}return _e.store}}async function Zd(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 i=await r.json();t(Wd(i,e))}catch{}}function $r(e){const t=Bs();if(!t||!_e||_e.warmed||!js(_e.canvasSrc))return;_e.warmed=!0;const{canvasSrc:n}=_e,r=zd(n);r&&t.warm([r],e);const i={"js/iframe-eblock.js":["js/discussHandlers.sDXLf5I7.js","js/typograf.all.BbXdyfMT.js"],"js/iframe.js":["js/rolldown-runtime.BRlIiq3h.js","js/discussHandlers.sDXLf5I7.js"],"js/darkreader.CyLMh7_H.js":[],"js/discussHandlers.sDXLf5I7.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"]};i?t.warm(Kd(i,n),e):Zd(n,o=>t.warm(o,e))}function ef(e){const t=Bs();if(!t)return;$r();const n=r=>{const i=r.data;if(!i||i.operationId!=="em:module-body"||!i.result)return;const o=r.source;o&&(o.postMessage({operationId:qd,for:i.result},"*"),t.take(i.data?.url??"").then(s=>{o.postMessage({operationId:i.result,data:s??null},"*")}))};window.addEventListener("message",n),e.getInstance(H)?.addDispose(()=>{window.removeEventListener("message",n)})}var Je=/<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,tf=/\s(?:bis_[a-z0-9_-]+|data-bis-config|data-dynamic-id)=(["'])(?:(?!\1).)*\1/gi,nt=/<style\b[^>]*>[\s\S]*?<\/style>/gi,Ti=/display:\s*none\s*!important/gi,nf=/((?:html\s*,\s*body|body\s*,\s*html)\s*\{)([^}]*)(\})/gi,rf=/\s*height\s*:\s*100%\s*!important\s*;?/gi,of=/height\s*:\s*100%\s*!important/i,sf=[".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 af(e){return Ti.lastIndex=0,(e.match(Ti)||[]).length}function Us(e){const t=e.trim(),n=af(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=sf.filter(i=>t.includes(i)).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 lf(e){nt.lastIndex=0;for(const t of e.matchAll(nt))if(Us(t[0].replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,"")))return!0;return!1}function cf(e){let t=!1;return nt.lastIndex=0,{html:e.replace(nt,n=>Us(n.replace(/^<style\b[^>]*>/i,"").replace(/<\/style>$/i,""))?(t=!0,""):n),found:t}}function uf(e){return Je.lastIndex=0,Je.test(e)||/\sbis_[a-z0-9_-]+\s*=/.test(e)||/\sdata-bis-config\s*=/.test(e)||lf(e)}function df(e){if(!uf(e))return{html:e,found:!1};let t=!1,n=e;Je.lastIndex=0,Je.test(n)&&(Je.lastIndex=0,n=n.replace(Je,""),t=!0),(/\sbis_[a-z0-9_-]+\s*=/.test(n)||/\sdata-bis-config\s*=/.test(n))&&(n=n.replace(tf,""),t=!0);const r=cf(n);return n=r.html,t=t||r.found,{html:n,found:t}}function ff(e){return!e||!of.test(e)?e:(nt.lastIndex=0,e.replace(nt,t=>t.replace(nf,(n,r,i,o)=>`${r}${i.replace(rf,"")}${o}`)))}function Hs(e){const t=df(e.replaceAll(`\r
|
|
1003
1003
|
`,`
|
|
1004
|
-
`));return{html:fc(t.html),hasBrowserExtensionArtifacts:t.found}}function An(e){return e?.getContent()??""}function Fo(e,t){e?.mutate({content:ao(t)},{source:"remote"})}function dr(e){return N(e)}function ie(e,t){return e.getOrCreateInstance(t,()=>new be)}function X(e,t){return e.getOrCreateInstance(t,()=>new be).event}function Cn(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var pc=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}},hc=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(te("Superseded by newer show()")),n.aborted?Promise.reject(te(n.reason)):(this._activeRequest=e,new Promise((r,i)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{i(new pc(e.showId,t))})},t);o.unref?.();const s=()=>{this._settle(e.showId,()=>{i(te(n.reason))})};n.addEventListener("abort",s,{once:!0});const l=()=>{clearTimeout(o),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:i,timeoutId:o,dispose:l});for(const d of this._listeners)d(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 mc(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function gc(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=ro(e),n=io(e),r=il(e.sandbox);t<n+r}var jo=class{_controller=new AbortController;_externalSignalDisposable=new Q;_sessionChangeListeners=new Set;_showRegistry=new hc;_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 ro(this._timeouts)}getSandboxTimeoutMs(e){return no(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return io(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=mc(this._timeouts,e.timeouts),gc(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 Q,this._linkExternalSignal(e)}abort(e){const t=e??te("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Q}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Q,this._showRegistry.rejectAll(te("Init session replaced")),this._controller.signal.aborted||this._controller.abort(te("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??te()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??te()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},cr=(()=>{const e=new jo;return e.configure({}),e})(),vc=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 bc(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 yc(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(z(n),new Promise((r,i)=>{let o=!1,s,l;const d=h=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),l?.dispose(),n?.removeEventListener("abort",u),h())},u=()=>{d(()=>i(te(n?.reason)))};if(l=e.onInit(()=>{e.isInited()&&e.getTarget()&&d(()=>r())}),e.isInited()&&e.getTarget()){d(()=>r());return}t>0&&(s=setTimeout(()=>{d(()=>i(new vc(t)))},t)),n?.addEventListener("abort",u)}))}var Ec=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 _c(e,t,n){return t<=0?e:new Promise((r,i)=>{let o=!1,s;const l=d=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),d())};s=setTimeout(()=>{l(()=>i(new Ec(n,t)))},t),e.then(d=>{l(()=>r(d))},d=>{l(()=>i(d))})})}var wc=2,mt=Symbol("sandbox:frame-replaced");function fe(e,t,n,r,i,o,s){const l=`sandbox:${t}`,d=o?.getSandboxTimeoutMs(t)??Qn[t],u=()=>{let w=_c(e.sendAsync(n,r),d,l);return w=Ct(w,o?.signal),Xe(l,w,i)};if(t==="INIT_START"&&bc(e)){const w=o?.getSandboxReadyTimeoutMs()??2e4,_=e,m=S=>{const y=yc(_,w,o?.signal);return Xe("sandbox:INIT_START:ready-wait",y,i).then(()=>{if(!s||S<=0)return u();const I=s.getGeneration();let T;const R=new Promise((f,a)=>{T=s.onChange(()=>{s.getGeneration()!==I&&a(mt)})}),v=u();return v.catch(()=>{}),Promise.race([v,R]).finally(()=>T?.()).catch(f=>{if(f!==mt)throw f;return{...i},m(S-1)})})};return m(wc)}if(!s)return u();const h=s.getGeneration();let g;const E=new Promise((w,_)=>{g=s.onChange(()=>{s.getGeneration()!==h&&_(mt)})}),b=u();return b.catch(()=>{}),Promise.race([b,E]).finally(()=>g?.()).catch(w=>{throw w===mt&&{...i},w})}var Sc=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],Ic=200;function Ac(e=new Set){const t=new Set;return(n,r)=>{if(!Sc.some(([o,s])=>!e.has(o)&&s.test(n)))return;const i=r??`new:${n.length}:${n.slice(0,200)}`;t.has(i)||(t.size>=Ic&&t.clear(),t.add(i))}}function Cc(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:Ac()}}var Tc=Cc();function Ge(e){return e?.getInstance(ha)??Tc}function Rc(e){const t=we(e),n=ee(e),r=()=>e.getInstance(he)??cr;let i,o,s=!1,l=!1;const d=async(y,I,T)=>{const R=T.generation,v=()=>T.generation!==R||T.signal.aborted||t.current()!==y||l,f=me(n);s=!0;try{if(await fe(n,"INIT_START",U.SANDBOX_INIT_START,{guid:I},void 0,T),v())return;const{html:a,hasBrowserExtensionArtifacts:c}=No(An(y));if(c&&ie(e,$.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),Fo(y,a),await fe(n,"SET_ENTITY",U.SANDBOX_SET_ENTITY,Cn(An(y),I,Ge(e).editorPolicy,y.get().version),void 0,T),v())return;await fe(n,"INITED",U.SANDBOX_INITED,{guid:I},void 0,T),i=I,o=f}finally{s=!1}},u=()=>de(t.sessionKey())?t.current():void 0,h=()=>{if(l||s)return;const y=u(),I=y?.get().docId;if(!y||!I||i===I&&o===me(n)||!y.isReady())return;const T=r();T.signal.aborted||d(y,I,T).catch(()=>{})};let g=!1;const E=()=>{g||l||(g=!0,queueMicrotask(()=>{g=!1,h()}))};let b,w;const _=()=>{const y=u(),I=y?.get().docId;I!==w&&(b?.(),w=I,b=y?.subscribe(E)),E()},m=t.subscribe(_),S=xo(n,E);_(),e.getInstance(B)?.addDispose(()=>{l=!0,S(),b?.(),m()})}var Pc=200;function Dc({startVersion:e,limit:t=Pc}){let n=[],r=e;const i=o=>{n=n.filter(s=>s.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&i(n[n.length-t-1].version))},rebase(o,s){if(s<r)return null;const l=n.filter(u=>u.version>s);i(s);let d=o;for(const u of l){if(u.fromCanvas||u.contentReplaced||!u.changes)return null;const h=u.changes,g=[];for(const E of d){const b=ml(E.range,h,"after");if(!b)return null;g.push({range:b,text:E.text})}d=g}return d}}}function Oc(e,t){let n=0;return e.map(({start:r,end:i,text:o})=>{const s=new le(r,t.slice(r,i),r+n,o);return n+=o.length-(i-r),s})}function xc(e,t){const n=[...e].sort((r,i)=>r.range.start-i.range.start);return Oc(n.map(({range:r,text:i})=>({start:r.start,end:r.end,text:i})),t)}function Mc(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var ur=N("canvas.sandboxFill");function Bo(e){return e.getInstance(ur)?.pipeline.isEventsLocked()===!0}function Jt(e){Ft(e,{origin:"canvas-channel"})}function Lc(e){const t=we(e),n=ee(e);let r;const i=(d,u)=>{const h=d.get().docId;let g=!1,E=null,b=null;const w=Dc({startVersion:d.get().version});let _=d.getContent();const m=async(R,v)=>{if(b){b.push({edits:R,rev:v});return}b=[{edits:R,rev:v}];try{do{const f=b.splice(0,b.length);await n.sendAsync(U.SANDBOX_UPDATE_ENTITY,{edits:f.map(a=>a.edits),guid:h,rev:f[f.length-1].rev})}while(b.length)}finally{b=null}},S=(R,v)=>{const f=b?.splice(0,b.length)??[];f.length&&n.sendAsync(U.SANDBOX_UPDATE_ENTITY,{edits:f.map(a=>a.edits),guid:h,rev:f[f.length-1].rev}).catch(Jt),n.sendAsync(U.SANDBOX_UPDATE_ENTITY,{edits:[R],guid:h,rev:d.get().version,...v!==null?{changeId:v}:{}}).catch(Jt)},y=R=>{const{guid:v,pushUndoStop:f}=R;if(v!==h)return;const a=Cl(R);let{edits:c}=R;if(a.baseRev!==null){const A=w.rebase(c,a.baseRev);if(!A){Ft(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),S([],a.changeId);return}c=A}const p=d.get().version;try{g=!0,E=a.changeId;const A=xc(c,d.getContent());f===!1?u.applyWithoutHistory(A):d.mutate({changes:A},{source:Bo(e)?"system":"user"})}finally{g=!1,E=null}d.get().version===p&&a.baseRev!==null&&S([],a.changeId)},I=d.subscribe(({changes:R,version:v})=>{const f=d.getContent(),a=!R?.length&&f!==_;if(_=f,w.record({version:v,changes:R,contentReplaced:a,fromCanvas:g}),!R?.length)return;const c=Mc(R);g?S(c,E):m(c,v).catch(Jt)}),T=n.addListener(U.APPLICATION_UPDATE_ENTITY,y);return()=>{I(),T.dispose()}};let o;const s=()=>{const d=t.current(),u=t.history(),h=d?.get().docId;h!==o&&(r?.(),r=void 0,o=h,d&&u&&(r=i(d,u)))},l=t.subscribe(s);s(),e.getInstance(B)?.addDispose(()=>{r?.(),l()})}var kc=/^(?:ant|vscode|monaco|docs)-/;function Nc(e){return kc.test(e)}function Fc(){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 jc=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Bc(){return jc}var Uc=new Set;function Hc(e,t,n=Uc){return e.startsWith(`${t}-`)?!1:!Nc(e)&&!n.has(e)}function $c(e,t){return`--${t}-${e}`}function Uo(e){const t=Fc();return Hc(e,t,Bc())?$c(e,t):`--${e}`}function Gc(e,t){const n=Uo(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function qc(e,t){return Gc(e,t)}var Ho=300,Gr=15e3,qr="em-canvas-busy-style";function zc(){if(document.getElementById(qr))return;const e=document.createElement("style");e.id=qr,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var Vc="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 Kc(e){const t=qc("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(Uo("colorPrimary")).trim()||t}function $o(e){zc();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",Vc),n.appendChild(r);const i=document.createElement("span");return i.setAttribute("role","img"),i.setAttribute("aria-label","loading"),i.setAttribute("style",`display:inline-flex;color:${Kc(e)};animation:em-canvas-busy-spin 1s linear infinite`),i.appendChild(n),i}function Wc(e,t,n){const r=t??e,i=Math.max(r.left,e.left,0),o=Math.min(r.right,e.right,n.width),s=Math.max(r.top,e.top,0),l=Math.min(r.bottom,e.bottom,n.height);return o<=i||l<=s?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(i+o)/2-e.left,y:(s+l)/2-e.top}}function Yc(e,t){const n=e.getBoundingClientRect(),r=document.createElement("div");return 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),{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const i=Wc(n,t(),{width:window.innerWidth,height:window.innerHeight}),o=document.createElement("div");Object.assign(o.style,{position:"absolute",left:`${i.x}px`,top:`${i.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),o.appendChild($o(e.querySelector(".ant-app")??e)),r.appendChild(o)},remove:()=>r.remove()}}function zr(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($o(e))},Ho);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var Xc=8e3;function Jc(){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 Qc=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 Zc(e,t){for(let n=e.parentElement;n;n=n.parentElement){const r=getComputedStyle(n),i=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(s=>xe(s)>0);if(i&&o)return n;if(n===t)return null}return null}function xe(e){return Number.parseFloat(e)||0}function gt(e,t){return Math.abs(e-t)<=1}function Vr(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=xe(n.borderTopWidth),i=xe(n.borderRightWidth),o=xe(n.borderBottomWidth),s=xe(n.borderLeftWidth),l=(d,u,h)=>Math.max(0,xe(d)-Math.max(u,h));return{top:t.top+r,bottom:t.bottom-o,left:t.left+s,right:t.right-i,radii:[l(n.borderTopLeftRadius,r,s),l(n.borderTopRightRadius,r,i),l(n.borderBottomRightRadius,o,i),l(n.borderBottomLeftRadius,o,s)]}}function eu(e,t){const n=gt(t.top,e.top),r=gt(t.bottom,e.bottom),i=gt(t.left,e.left),o=gt(t.right,e.right),s=[n&&i?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&i?e.radii[3]:0];return s.every(l=>l===0)?"":s.map(l=>`${l}px`).join(" ")}function tu(e,t,n,r,i){const o=n.readyTimeoutMs??Xc,s=document.createElement("div");s.dataset.canvasHost=e,r&&(s.dataset.canvasPlace=r),s.style.position="fixed",s.style.overflow="hidden",s.style.visibility="hidden";const l=n.resolveSrc(e),d=document.createElement("iframe");d.setAttribute("sandbox",n.resolveSandbox(l)),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=l,s.appendChild(d),t.appendChild(s),n.mark?.("created"),i||n.onCreated?.(d);const u=new Q;let h=!1,g=!1,E,b,w,_;const m=()=>{clearTimeout(_),_=setTimeout(()=>{g||(g=!0,b?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},S=()=>h?(w=Promise.resolve(),g=!0,w):(g=!1,w=new Promise((M,k)=>{E=M,b=k}),m(),w),y=()=>{if(clearTimeout(_),h=!0,g){w=Promise.resolve();return}g=!0,n.mark?.("loaded"),E?.()};d.addEventListener("load",y),u.addDispose(()=>{clearTimeout(_),d.removeEventListener("load",y)});let I;const T=()=>{I??=n.bindResizer?.(d)};let R=null,v=null,f;const a=()=>{if(!R){s.style.visibility="hidden",d.removeAttribute("id");return}n.elementId&&(d.id=n.elementId);const M=R.getBoundingClientRect(),k=v?.isConnected?v:Qc(R),V=k?Vr(k):null,Y=V?Math.max(M.top,V.top):M.top,K=V?Math.min(M.bottom,V.bottom):M.bottom,ce=Math.max(0,K-Y);s.style.visibility=ce>0?"visible":"hidden",s.style.left=`${M.left}px`,s.style.top=`${Y}px`,s.style.width=`${M.width}px`,s.style.height=`${ce}px`,d.style.transform=`translateY(${M.top-Y}px)`;const Te=Zc(R,k);s.style.borderRadius=Te?eu(Vr(Te),{top:Y,bottom:K,left:M.left,right:M.right}):""};let c="",p="",A=0,x;const j=()=>{if(!R){x=void 0;return}x=window.requestAnimationFrame(j);const M=R.getBoundingClientRect(),k=v?.isConnected?v.getBoundingClientRect():void 0,V=`${Math.round(M.left)}:${Math.round(M.top)}:${Math.round(M.width)}:${Math.round(M.height)}:${k?`${Math.round(k.top)}:${Math.round(k.height)}`:"-"}`;V!==c&&(c=V,a());const Y=d.getBoundingClientRect().height;Y>0&&Y!==A&&(A=Y,R.style.height=`${Y}px`);const K=getComputedStyle(R).pointerEvents;K!==p&&(p=K,s.style.pointerEvents=K)},C=()=>{x===void 0&&R&&(x=window.requestAnimationFrame(j))},L=()=>{x!==void 0&&(window.cancelAnimationFrame(x),x=void 0)},G=()=>a();let P=[];const O=(M,k)=>{if(v=k,M&&P.length>0){const V=P;P=[],V.forEach(Y=>Y())}if(M===R){a();return}if(f?.disconnect(),f=void 0,R&&R.style.removeProperty("height"),c="",A=0,p="",R=M,!M){L(),a();return}n.onShown?.(d);try{if(typeof ResizeObserver=="function"){const V=new ResizeObserver(a);typeof V.observe=="function"&&(f=V,f.observe(M))}}catch{f=void 0}a(),T(),C()};window.addEventListener("scroll",G,!0),window.addEventListener("resize",G),u.addDispose(()=>{f?.disconnect(),x!==void 0&&window.cancelAnimationFrame(x),window.removeEventListener("scroll",G,!0),window.removeEventListener("resize",G)});const H=M=>{h=!1,M&&n.onReload?.(d);let k;g||w===void 0?k=S():(m(),k=w);try{d.contentWindow?.location.reload()}catch{d.src=l}return k};return{element:d,ready(){return w??S()},reload:()=>H(!0),reloadQuietly:()=>H(!1),get shown(){return R!==null},whenShown(){return R!==null?Promise.resolve():new Promise(M=>{P.push(M)})},alignTo(M,k){O(M,k??null)},scrollBy(M,k){let V=M,Y=k;for(let K=R?.parentElement??null;K;K=K.parentElement){if(Math.abs(V)<1&&Math.abs(Y)<1)return;const ce=getComputedStyle(K);if((ce.overflowY==="auto"||ce.overflowY==="scroll")&&K.scrollHeight>K.clientHeight){const Te=K.scrollTop,qt=K.scrollLeft;K.scrollBy({left:V,top:Y,behavior:"instant"}),V-=K.scrollLeft-qt,Y-=K.scrollTop-Te}}(Math.abs(V)>=1||Math.abs(Y)>=1)&&window.scrollBy({left:V,top:Y,behavior:"instant"})},resize(){I?.resize()},dispose(){O(null,null),I?.dispose(),u.dispose(),s.remove()}}}function nu(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",i=(b,w)=>b==="email"?`email:${w??n}`:b,o=new Map;let s,l=[],d=!1,u;const h=()=>{if(l.forEach(b=>clearTimeout(b)),l=[],s?.remove(),s=void 0,u?.remove(),u=void 0,d){d=!1;const b=o.get("email");t.get(i("email"))?.alignTo(b?.slot??null,b?.clip??null)}},g=(b,w,_)=>{const m=i(b,w),S=t.get(m);if(S)return S;const y=e.resolveMount();if(!y)return Jc();const I=tu(b,y,e,b==="email"?w??n:void 0,_);return t.set(m,I),I},E={get:b=>g(b),current:b=>g(b),peek:b=>t.get(i(b)),spare:()=>t.get(i("email",r())),ensureSpare:()=>g("email",r(),!0),promote(){const b=t.get(i("email",r()));if(!b)return;const w=t.get(i("email"));n=r();const _=o.get("email");b.alignTo(_?.slot??null,_?.clip??null),w?.alignTo(null)},alignSurface(b,w,_){if(o.set(b,{slot:w,clip:_??null}),b==="email"&&d){u?.remove(),u=w?zr(w):void 0;return}(w?g(b):t.get(i(b)))?.alignTo(w,_??null)},visible(){for(const b of t.values())if(b.shown)return b},byWindow(b){if(b){for(const w of t.values())if(w.element.contentWindow===b)return w}},busy(b){if(h(),!b)return;if(!E.visible()){d=!0;const m=o.get("email");m?.slot&&(u=zr(m.slot)),l=[setTimeout(h,Gr)];return}const w=e.resolveMount();if(!w)return;const _=Yc(w,()=>E.visible()?.element.parentElement?.getBoundingClientRect()??null);s=_,l=[setTimeout(()=>_.showSpinner(),Ho),setTimeout(h,Gr)]},dispose(){h(),t.forEach(b=>b.dispose()),t.clear(),o.clear(),n="a"}};return E}var ru=N("canvas.resizerBinder"),Tn=N("canvas.service"),iu={created:Z.canvasCreated,loaded:Z.canvasLoaded};function ou(e,t){if(e.getInstance(Tn))return;const n=nu({resolveMount:()=>t.resolveMount(),resolveSrc:i=>t.resolveSrc(i),resolveSandbox:Vd,elementId:t.elementId,bindResizer:i=>e.getInstance(ru)?.(i),onCreated:i=>St(e,i,"fresh"),onReload:i=>St(e,i,"fresh"),onShown:i=>St(e,i,"switch"),mark:i=>t.mark?.(iu[i])}),r=ee(e).addListener(U.SANDBOX_WHEEL,i=>{n.visible()?.scrollBy(i?.deltaX??0,i?.deltaY??0)});e.inject(Tn,n),e.getInstance(B)?.addDispose(()=>{r.dispose(),n.dispose()})}function St(e,t,n){const r=ee(e),i=t.contentWindow;if(!i)return;const o=r.getTarget()===i;o&&n==="switch"||(n==="fresh"&&(r.forget(i),o&&r.setTarget(void 0)),r.setTarget(i),Pd(r))}function su(e,t){St(e,t,"promote")}function au(e,t){const n=t.contentWindow;n&&ee(e).greet(n)}function lu(e,t){const n=t.contentWindow;n&&ee(e).forget(n)}function ge(e){return e.getInstance(Tn)}function du(e){const t=ee(e),n=()=>ge(e)?.byWindow(t.getTarget()),r=t.addListenerAsync(U.RELOAD,async()=>{await n()?.reload()}),i=t.addListener(s=>{s.data?.operation===U.SANDBOX_RESIZED&&n()?.resize()}),o=X(e,$.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(B)?.addDispose(()=>{r.dispose(),i.dispose(),o.dispose()})}var iv=N("HeadlessMode"),cu=N("HiddenMount");function uu(e){return e.getOrCreateInstance(cu,()=>Ce(!1))}function Kr(){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 fu(e){const t=e.getInstance(ne);let n,r;e.getInstance(B)?.addDispose(()=>{r?.remove(),r=void 0}),ou(e,{resolveMount:()=>n,resolveSrc:o=>Mo(o==="block"),elementId:"email_iframe",mark:o=>W(o)}),t?.watch(o=>{if(n)return;const s=o?.element;if(s instanceof HTMLElement)n=s;else if(o!==void 0)n=r??=Kr();else return;ge(e)?.get("email")});let i;e.getInstance(B)?.addDispose(()=>{i?.remove(),i=void 0}),uu(e).watch(o=>{const s=ge(e);if(s){if(o){i??=Kr(),s.alignSurface("email",i,i);return}i&&(s.alignSurface("email",null),i.remove(),i=void 0)}})}var Go=N("canvas.headerFlow"),Wr=["subject","preheader"],pu=3e3,hu={subject:U.SANDBOX_SUBJECT_UPDATE,preheader:U.SANDBOX_PREHEADER_UPDATE};function mu(e){const t=we(e),n=ee(e),r=m=>m?"remote":Bo(e)?"system":"user",i=(m,{guid:S,value:y,forced:I})=>{const T=Ke(t);if(!T||typeof y!="string"||S&&S!==T.get().docId)return;const R=t.forcedHeaders();if(R?.[m]&&!I&&y!==R[m])return;I&&(g.delete(m),g.size===0&&t.endForcedHeaders());const v=T.get().attributes[m]??"";l=!0;try{Dt(T,{[m]:y},{source:r(I)})}finally{l=!1}o[m]=y,ie(e,$.ON_HEADER_APPLIED_ID).fire({field:m,value:y,forced:!!I,isGenerated:y!==v&&!!y})};let o={},s,l=!1,d=Promise.resolve();const u=(m,S,y,I=!1)=>{d=n.sendAsync(hu[m],{value:S,guid:Ke(t)?.get().docId,...y?{force:!0,echo:!0}:{},...I?{undoStep:!0}:{}}).catch(T=>{})};let h;const g=new Set;e.inject(Go,{whenDelivered:async()=>{await d},reassert:m=>{const S=Ke(t),y=Wr.filter(I=>m[I]);if(!(!S||y.length===0)){l=!0;try{Dt(S,Object.fromEntries(y.map(I=>[I,m[I]])),{source:"system"})}finally{l=!1}t.beginForcedHeaders({subject:m.subject??"",preheader:m.preheader??""}),clearTimeout(h),h=setTimeout(()=>{g.clear(),t.endForcedHeaders()},pu),g.clear();for(const I of y)g.add(I);for(const I of y)o[I]=m[I],u(I,m[I],!0)}}});const E=()=>{s?.(),s=void 0;const m=Ke(t);if(!m){o={};return}const S=m.get().attributes;o={subject:S.subject,preheader:S.preheader},s=m.subscribe(({source:y})=>{if(l)return;const I=m.get().attributes,T=t.forcedHeaders();for(const R of Wr){const v=I[R];v!==o[R]&&(o[R]=v,u(R,v??"",y==="system"&&T?.[R]!==void 0,y==="user"))}})};E();const b=t.subscribe(E),w=n.addListenerAsync(U.APPLICATION_SUBJECT_UPDATE,m=>i("subject",m)),_=n.addListenerAsync(U.APPLICATION_PREHEADER_UPDATE,m=>i("preheader",m));e.getInstance(B)?.addDispose(()=>{w.dispose(),_.dispose(),b(),s?.(),clearTimeout(h)})}function Yr(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function Rn(e,t){const n={...e};for(const r of Object.keys(t)){const i=t[r],o=e[r];Yr(i)&&Yr(o)?n[r]=Rn(o,i):i!==void 0&&(n[r]=i)}return n}function gu(e,t){const n=qn;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const i=JSON.parse(r);if(i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length>0)return Rn(n,i)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?Rn(n,t):n}function vu(){const e=window.localStorage.getItem(He.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?aa:_a;return e&&e!=="system"?e:t}function bu(){const e=window.localStorage.getItem(He.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 yu(e){const{config:t}=e;return{operation:U.UPDATE_PREVIEW,theme:e.theme,commonStyles:gu(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 Eu(e){const t=ee(e),n=e.getInstance(ye),r=e.getInstance(ne),i=we(e);let o,s="";const l=()=>{const S=n?.get()??{},y=yu({config:S,emailCommonStyles:i.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:vu(),codeMode:bu(),appName:"useblocks"}),I=JSON.stringify(y);I!==s&&(s=I,t.send(y))},d=t.onInit(()=>{s="",l()}),u=()=>{t.isInited()&&l()},h=n?.watch(u),g=r?.watch(S=>{o=S?.commonStyles,u()});let E;const b=()=>{E?.(),E=i.current()?.subscribe(u),u()};b();const w=i.subscribe(b),_=matchMedia(ca),m=()=>u();_.addEventListener("change",m),e.getInstance(B)?.addDispose(()=>{d.dispose(),h?.dispose(),g?.dispose(),E?.(),w(),_.removeEventListener("change",m)})}var Pn;(function(e){function t(i,o,s=(l,d)=>l===d){if(i===o)return!0;if(i.length!==o.length)return!1;for(let l=0;l<i.length;l++)if(!s(i[l],o[l]))return!1;return!0}e.isEqual=t;function n(i,o=s=>s){const s=new Set;return i.filter(l=>{const d=o(l);return s.has(d)?!1:(s.add(d),!0)})}e.unique=n;function r(i=[],o=[],s=(l,d)=>l===d){const l=[],d=[],u=[];for(const h of i){const g=o.find(E=>s(h,E));g?u.push({prev:h,next:g}):d.push(h)}for(const h of o)i.find(g=>s(h,g))||l.push(h);return{added:l,removed:d,exists:u}}e.diff=r})(Pn||(Pn={}));function _u(e,t){return e.type===t.type&&e.key===t.key}function wu(e){const t=ee(e),n=()=>e.getServices(Me)??[];let r=[];const i=t.onInit(()=>{r=n(),t.send(U.SANDBOX_ADD_EXTENSIONS,r)}),o=Ys(Me),s=e.onInject(l=>{if(l!==o)return;const d=n();if(!t.isInited()){r=d;return}const{added:u,removed:h}=Pn.diff(r,d,_u);if(r=d,h.length){if(h.some(g=>g.type==="script")){t.send(U.RELOAD);return}t.send(U.SANDBOX_REMOVE_EXTENSIONS,h.map(g=>g.key))}u.length&&t.send(U.SANDBOX_ADD_EXTENSIONS,u)});e.getInstance(B)?.addDispose(()=>{i.dispose(),s?.dispose()})}var Su=N("prewarm.editorVisible");function Iu(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Au(e={}){const t=e.paint??Iu;let n=!1,r=!1,i=!1,o=!1,s=!1;const l=[],d=()=>{s||o||!n||!r||!i||(o=!0,t(()=>{s=!0,W(Z.editorVisible);for(const u of l.splice(0))u()}))};return{noteShellVisible(){n=!0,d()},notePagePainted(){r=!0,d()},noteContentShown(){i=!0,d()},whenVisible(u){if(s){u();return}l.push(u)},contentShown:()=>i}}function Cu(e){return e.getOrCreateInstance(Su,()=>Au())}var Tu=500,Ru=500,Pu=5e3;function Du(e){const t=e.quietMs??Tu,n=e.floorMs??Ru,r=e.ceilingMs??Pu;let i,o,s=0;const l=()=>{clearTimeout(i),clearTimeout(o),i=void 0,o=void 0},d=()=>{l(),e.run()},u=()=>{clearTimeout(i);const h=n-(Date.now()-s);i=setTimeout(d,Math.max(t,h))};return{start(){l(),s=Date.now(),o=setTimeout(d,r),u()},notify(){i!==void 0&&u()},cancel:l}}function Ou({attributes:e,readContent:t,docId:n,hasSession:r,serverId:i,show:o}){if(!r)return;const s={id:i??void 0,renderGuid:n,showId:o?.id,isNew:i==null,showToken:o?.token},l={...e,...s};return Object.defineProperty(l,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),l}var qo="self-init:";function xu(e){return e.startsWith(qo)}function zo(e,t){const n=e.getActiveShowRequest();return xu(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Mu(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let i="";const o=()=>e.readDocument()?An(e.readDocument()):i,s=()=>Ge(e.container).editorPolicy,l=()=>e.readEmail(),d=()=>{const u=l();return{...u,id:e.isTemplate()||u.isNew?void 0:u.id,html:o()}};return{readContent:o,publicEmail:d,sendInitStart:()=>fe(n,"INIT_START",U.SANDBOX_INIT_START,{guid:l().renderGuid},void 0,r()),sendInited:()=>fe(n,"INITED",U.SANDBOX_INITED,{guid:l().renderGuid},void 0,r()),async sendContent(){const u=l(),{html:h,hasBrowserExtensionArtifacts:g}=No(u?.html||"");g&&e.events.browserExtensionDetected(),Fo(e.readDocument(),h),i=h,await fe(n,"SET_ENTITY",U.SANDBOX_SET_ENTITY,Cn(o(),u.renderGuid,s(),e.readDocument()?.get().version),{guid:u.renderGuid,emailId:u.id??null},r())},refreshContent:()=>fe(n,"SET_ENTITY",U.SANDBOX_SET_ENTITY,Cn(o(),l().renderGuid,s(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const u=l();if(u.preheader!==void 0)return fe(n,"PREHEADER",U.SANDBOX_PREHEADER_UPDATE,{value:u.preheader,guid:u.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const u=l();if(u.subject!==void 0)return fe(n,"SUBJECT",U.SANDBOX_SUBJECT_UPDATE,{value:u.subject,guid:u.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:u=>e.showFilled?.(u),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(d()),fireInit(u,h){if(!zo(t(),u)){t().getActiveShowRequest()?.showId;return}const g=l();g.id,g.renderGuid,t().completeShow(u),Dt(e.readDocument(),{is_inited:!0},{source:"system"});const E=d();return h&&(E.reset=!0),e.events.inited(E)},fireEmailChanged(){e.events.emailChanged(d())},fireContentChanged(){e.events.contentChanged(o())}}}function Lu(e){const t=()=>e.initPipeline();let n=!1,r,i,o,s=0,l;const d=Mu({...e,waitScope:()=>({getSandboxTimeoutMs:m=>t().getSandboxTimeoutMs(m),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:l?.signal??t().signal})});let u;const h=(m,S)=>{if(u===m)return;u=m;const y=s;setTimeout(()=>{s!==y||t().signal.aborted||w(m,S).catch(()=>{})},0)},g=()=>{l?.abort(),l=void 0};let E;const b=()=>{const m=t().signal;m!==E&&(E?.removeEventListener("abort",g),E=m,m.addEventListener("abort",g))};async function w(m,S){const y=++s;g(),l=new AbortController,b();const I=()=>s!==y,T=d.readTarget(),R=t().generation,v=()=>R===t().generation&&!t().signal.aborted,f=S?"init:reset-":"init:";if(!S){const p=d.publicEmail();p?.id,p?.renderGuid,p?.preheader}let a=!1,c=!1;try{n=!0,await d.sendInitStart(),d.fireWillInit(),await(S?d.refreshContent():d.sendContent()),a=!0,S||d.publicEmail()?.id;try{await d.sendPreheader()}catch(p){`${f}`,String(p)}try{await d.sendSubject()}catch(p){`${f}`,String(p)}if(I()||d.showFilled(T),await d.sendInited(),c=!0,i===m){const p=e.readSandboxGeneration?.()??o;p!==void 0&&(r=p)}await d.revealFilled()}catch(p){throw I()||(`${f}`,{...e.describeSurface?.(),error:String(p)},void 0),!I()&&zo(t(),m)&&t().failShow(m,p),p}finally{_(m,S,f,{superseded:I(),sessionGeneration:R,contentApplied:a,sandboxInitedAcked:c,commit:v()})}}function _(m,S,y,I){const{superseded:T,contentApplied:R,sandboxInitedAcked:v}=I;if(T){`${y}`;return}v&&I.commit?d.fireInit(m,S||void 0):v?(`${y}`,I.sessionGeneration,t().generation,t().signal.aborted,void 0):R?(`${y}`,void 0):(`${y}`,void 0),n=!1,l=void 0,!v&&i===m&&(i=void 0,r===o&&(r=void 0)),!v&&R&&h(m,S)}return{channel:d,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:m=>{r=m},lastCorrelation:()=>i,markCorrelation:m=>{i=m},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:m=>{o=m},fill:m=>w(m,!1),refill:m=>w(m,!0),stop:()=>{s+=1,g(),n=!1,E?.removeEventListener("abort",g),E=void 0}}}function ku(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:Vo(e,n)}function Vo(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function Nu(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:i,readSandboxGeneration:o}=e,s=h=>{const g=n(),E=i();if(!ku(g,h,E)){h.showId,h.navId,h.emailId,g?.id,g?.showId,g?.renderGuid;return}h.showId,g?.id,g?.renderGuid,t.markFilled(o()),t.markCorrelation(h.showId),t.fill(h.showId).catch(()=>{})};return{showRequested:h=>{s(h)},showRequestIdentityChanged:()=>{const h=e.initPipeline().getActiveShowRequest();h&&s(h)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const h=o();if(t.filledGeneration()===h)return;const g=n(),E=i();if(!g?.renderGuid||!Vo(g,E))return;const b=`${qo}${g.renderGuid}`;t.markFilled(h),t.markCorrelation(b);const w=r()?.isReady()===!0;g.id,g.renderGuid,(w?_=>t.refill(_):_=>t.fill(_))(b).catch(()=>{t.lastCorrelation()===b&&t.markFilled(void 0)})},saasChanged:()=>{const h=n();h?.renderGuid,h?.showToken,h?.id,r()}}}function Fu(e){return e??""}function ju(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Bu(e){return e.length>0}function Uu(e){const t=we(e),n=ee(e),r=()=>de(t.sessionKey())?void 0:t.current(),i=()=>{const D=r();return Ou({attributes:D?.get().attributes??{},readContent:()=>D?.getContent(),docId:D?.get().docId,hasSession:!!D,serverId:D?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(he)??cr;let s={},l=!1;const d=e.getInstance(ne)?.watch(D=>{l=!!D?.element});let u=!1,h=!1,g=!1,E=0;const b=()=>{const D=ge(e);if(!D)return;const J=++E,q=D.spare();return q&&lu(e,q.element),(q?q.reloadQuietly():D.ensureSpare()?.ready())?.then(()=>{if(J!==E)return;u=!0;const se=D.spare();se&&au(e,se.element),g&&(g=!1,c(),M())})},w=Du({run:()=>{g||b()?.catch(()=>{})}}),_=()=>{Cu(e).noteContentShown(),!u&&!g&&w.start()};let m=!1;const I=Lu({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:i,revealFilled:()=>{const D=ge(e);return m&&D&&(m=!1,w.start()),l?D?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:D=>{const J=ge(e),q=J?.spare()?.element.contentWindow;h&&J&&q&&D===q&&(h=!1,J.promote(),J.busy(!1),m=!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>me(n),describeSurface:()=>({canvasPath:a,promoted:h,spareClean:u,handshake:n.isInited(),generation:me(n)}),events:{willInit:D=>{ie(e,$.WILL_EMAIL_INIT_ID).fire(D)},inited:D=>{_(),ie(e,$.ON_EMAIL_INIT_ID).fire(D)},contentChanged:D=>{ie(e,$.ON_CONTENT_CHANGED_ID).fire(D)},emailChanged:D=>{ie(e,$.ON_EMAIL_CHANGED_ID).fire(D)},browserExtensionDetected:()=>{ie(e,$.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),T=Nu({pipeline:I,initPipeline:o,readEmail:i,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>me(n)});let R="",v="",f="",a="none";const c=()=>{const D=ge(e)?.spare();D&&(n.sendNow({operation:U.SANDBOX_LOCK_EDIT,data:!0}),u=!1,h=!0,su(e,D.element))},p=(D,J)=>{const q=ge(e);if(!q)return!0;const se=q.spare(),Se=se&&u?"spare":"prepare";if(a=Se,q.busy(!0),se&&u)return c(),!0;w.cancel(),n.sendNow({operation:U.SANDBOX_LOCK_EDIT,data:!0});const Re=b();if(Re===void 0)return a="reload",q.busy(!1),q.peek("email")?.reload(),!0;g=!0;const Pe=E;return Re.catch(()=>{!g||Pe!==E||(g=!1,a="reload",q.busy(!1),q.peek("email")?.reload())}),!1},A=()=>{Te(),I.noteSandboxGeneration(me(n));const D=i(),J=ju(D?.renderGuid,D?.showId,D?.id,s.emailId),q=Fu(D?.renderGuid);if(q!==v){const Re=Bu(v),Pe=v;v=q,Re&&p(Pe,q)}if(g)return;J!==R&&(R=J,T.showRequestIdentityChanged());const se=r(),Se=`${J}|${se?.get().docId??""}|${me(n)}`;Se!==f&&se?.isReady()===!0&&(f=Se,T.selfInitChanged()),T.saasChanged(),O()};let x=!1,j="",C="",L=!1,G=!1;const P=D=>{D.source==="user"?G=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(L=!0),M()},O=()=>{const D=i();if(!D?.renderGuid)return;const J=I.channel.readContent(),q=JSON.stringify([D.preheader,D.common_styles,D.meta,D.subject,D.utm_parameters?.utm_campaign??"",D.utm_parameters?.utm_content??"",D.utm_parameters?.utm_medium??"",D.utm_parameters?.utm_source??"",D.utm_parameters?.utm_term??""]),se=x&&J!==C,Se=x&&q!==j;x=!0,C=J,j=q;const Re=L&&!G;if(L=!1,G=!1,I.isEventsLocked()||Re)return;const Pe={...D,id:s.isTemplate||D.isNew?void 0:D.id,html:J};if(se){ie(e,$.ON_CONTENT_CHANGED_ID).fire(J),ie(e,$.ON_EMAIL_CHANGED_ID).fire(Pe);return}Se&&D.is_inited&&ie(e,$.ON_EMAIL_CHANGED_ID).fire(Pe)};let H=!1;const M=()=>{H||(H=!0,queueMicrotask(()=>{H=!1,A()}))};e.inject(ur,{pipeline:I,setRoute:D=>{D.emailId===s.emailId&&!!D.isTemplate==!!s.isTemplate||(s=D,M())}});let k,V;const Y=()=>{const D=r()?.get().docId;D!==V&&(k?.(),V=D,k=r()?.subscribe(P)),M()};let K,ce;const Te=()=>{const D=e.getInstance(he);!D||D===K||(ce?.(),K=D,ce=D.onShowRequested(J=>T.showRequested(J)))},qt=n.addListener(D=>{D.data?.operation===U.SANDBOX_RESIZED&&w.notify()}),Ls=t.subscribe(Y),ks=xo(n,M);Y(),e.getInstance(B)?.addDispose(()=>{d?.dispose(),ce?.(),ks(),Ls(),k?.(),qt.dispose(),w.cancel(),I.stop()})}function Hu(){return ba!=="useblocks"}var Dn={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},$u={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}},Xr=Dn,Gu=["freeUserBlocks","blocks"],Ko={};function qu(e){Ko=e}var Wo=e=>Gu.includes(e)?Xr:Ko[e]??Xr,On={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},zu={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},Vu={...On,config:{...On.config,imageCenterFileManagerView:!1}};qu({pro:$u,editor:zu,simple:Hu()?On:Vu,freeUserBlocks:Dn,blocks:Dn});var Yo=N("CodeMode");function Xo(){let e;try{const t=window.localStorage?.getItem(He.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 Ku(e){try{window.localStorage?.setItem(He.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function Wu(e){return e.getOrCreateInstance(Yo,()=>{const t=Ce(Xo());return t.watch(Ku),t})}function Yu(e){return e?.getInstance(Yo)?.get()??Xo()}function Xu(e,t){const n=Wu(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function Ju(e,t,n=e.getInstance(ye)){n?.setMode(t),n?.get()?.codeEnabled===!1&&Yu(e).isCodeMode&&Xu(e,!1)}var Jr=new Set;function Qu(){return window.localStorage.getItem(He.em_color_scheme)??void 0}function Zu(e){return Jr.add(e),e(Qu()),{dispose(){Jr.delete(e)}}}function jt(e,t){return e.user.mode||e.serverSide.mode||t||"pro"}function ef(e,t){return t.modeDefaults(jt(e,t.fallbackMode))}function tf(e,t){const n=jt(e,t);return e.serverSide.advancedConfigs?.[n]||{}}function nf(e,t){const n=jt(e,t),r=e.user?.advancedConfigs?.[n],i=r!==void 0?r:e.user?.advancedConfigs?.pro;return{...e.advancedConfigs?.[n],...i}}function rf(e){let t;for(const n of e)n?.fileManager&&(t={...t,...n.fileManager});return t}function of(e){return $s(e.map(t=>t?.resourceProxy))}function sf(e){return Hs(e.map(t=>t?.resourceProxyPolicy))}function af(e){return ta(e.map(t=>t?.backendProxy))}function lf(e){return Hi(e.map(t=>t?.backendProxyPolicy||{}).filter(Boolean))}function df(e,t){return[e.base,ef(e,t),e.profile,e.serverSide,tf(e,t.fallbackMode),e.user,nf(e,t.fallbackMode),e.local]}function Qt(e,t){const n=df(e,t),r=Hi(n),i=rf(n);i!==void 0&&(r.fileManager=i);const o=of(n);o!==void 0&&(r.resourceProxy=o);const s=sf(n);s&&Object.keys(s).length>0&&(r.resourceProxyPolicy=s);const l=af(n);l!==void 0&&(r.backendProxy=l);const d=lf(n);return d&&Object.keys(d).length>0&&(r.backendProxyPolicy=d),r}var cf=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function Qr(e){return e==="server"?"serverSide":e}function uf({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},i=Ce();let o={kind:"pending"},s;const l=new Promise(E=>{s=E}),d=n===void 0?void 0:setTimeout(()=>{h({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function u(){o.kind!=="pending"&&i.set(Qt(r,e))}function h(E){if(o.kind!=="pending")return;clearTimeout(d),o=E;const b=Qt(r,e);i.set(b),s(b)}function g(E,b){r[Qr(E)]=b,E==="server"&&o.kind==="pending"?h({kind:"applied"}):u()}return{watch:E=>i.watch(E),select:E=>i.select(E),get:()=>i.get(),ready:()=>l,state:()=>o,layers:()=>({...r}),bootstrap(){const E=Qt(r,e);return Object.fromEntries(cf.map(b=>[b,E[b]]))},merge(E,b){g(b,{...r[Qr(b)],...E})},replace(E,b){g(b,E)},setMode(E){r.user={...r.user,mode:E},u()},setAdvancedConfigs(E){r.advancedConfigs=E,u()},serverAbsent(E){h({kind:"absent",reason:E})},applyServerResponse(E){o.kind==="pending"&&g("server",{...r.serverSide,...E})},dispose(){clearTimeout(d)}}}var ff=5e3,pf="blocks";function hf(){return{...Wo(pf)?.config,mergeTags:void 0}}function mf(e,t){e.getInstance(ne)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function gf(e,t){let n;ir(e).watch(({profile:r})=>{const i=`${r?.theme??""}|${r?.locale??""}`;if(i===n)return;n=i;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function vf(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function bf(e,t){let n,r=!1,i;const o=l=>{i??=jt(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==l&&Ju(e,l,t)},s=ir(e).watch(({profile:l})=>{const d=l?.email_builder_config,u=vf(d);if(u===void 0||d===n)return;const h=n===void 0;n=d,!(h&&r)&&o(u)});e.getInstance(B)?.addDisposable(s),t.ready().then(l=>{if(!l.configSwither)return;const d=localStorage.getItem("configSwither")||(n===void 0?l.mode:i)||"editor";localStorage.setItem("configSwither",d),r=n===void 0,o(d)})}function yf(e,t){let n=null;const r=Zu(i=>{const o=typeof i=="string"&&i?i:void 0;o!==n&&(n=o,t.replace(o?{theme:o}:{},"local"))});e.getInstance(B)?.addDisposable(r)}async function Ef(e,t){if(e.getInstance(Xn)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(Fe);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function _f(e){e.injectFactory(ye,(t,n)=>{if(n)return n;const r=uf({base:hf(),env:{modeDefaults:i=>Wo(i)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:ff});return mf(e,r),gf(e,r),bf(e,r),yf(e,r),Ef(e,r),e.getInstance(B)?.addDisposable(r),r},!0)}var Ne=class extends Q{_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 F(e,t,n){const r=Us(e);return(i,o,s)=>{const l=r(async d=>{const u=t?t(d):d;s&&i.bind(s);const h=await i(u);return n?n(h):h},o,s);return()=>l.dispose()}}var wf=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new En;this.handleDestroy=F(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Ne(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{}}},fr=N("DestroyableService");function Sf(e){e.injectFactory(fr,(t,n)=>{if(n)return n;const r=e.getInstance(B);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new wf({lifetime:r,options:e.getInstance(ne),getInstance:()=>e.getInstance(Nt),release:()=>ma(e.getInstance(ua)??e)})},!0)}function If(e){const t=e.getInstance(fr);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var Af=1e3;function Jo(e,t,n=Af,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 i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(const s of i)if(!Jo(e[s],t[s],n,r+1))return!1;return!0}return!1}function Je(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 i=t[r],o=e[r];Jo(i,o)||(n[r]=i)}return n}var Cf=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"}},Tf=({source:e,emailtags:t,group:n,tags:r,...i})=>i;async function Rf({emails:e,saveTimeoutMs:t},n){const r=t?.()??Zn();let i;try{return await Promise.race([e.notifySave(n),new Promise((o,s)=>{i=setTimeout(()=>{const l=new Cf(r);n.value.id,s(l)},r)})])}finally{i!==void 0&&clearTimeout(i)}}function Pf(e){const{emails:t}=e,n=async(r,i)=>{const o=Tf(i),s=r===void 0?void 0:await t.cache.getIfPresent(r),l=s?{...s,...o}:o,d=await Rf(e,{prev:s,patch:s?Je(s,o):o,value:l,source:i.source??""}),u=String(d.id??r??pe()),h=d.id===void 0?{...d,id:u}:d;return await t.cache.addOrUpdate(u,()=>h)};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const i=await n(void 0,r);return i?.renderGuid?i:{...i,renderGuid:pe()}},async updateEmail(r,i){return await n(r,i)}}}var Zt=20,Df=({source:e,emailtags:t,group:n,tags:r,...i})=>i;function Of({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r}){const i=async(o,s)=>(t.clear(),await t.get(o,{page:s}),(await e.cache.values()??[]).filter(l=>String(l?.parent)===String(o)));return{async readRevisions(o,s=1){const l=await i(o,s);return{revisions:l.slice(Zt*(s-1),Zt*s),page:s,hasMore:l.length>Zt*s}},async readAutosave(o){const s=await r?.(o)??NaN,l=Number.isFinite(s)?s:void 0,d=await n?.(o);if(d?.asked){const u=d.revision?[{...d.revision,parent:o,isAutosave:!0}]:[];return Dl(u,l)}return Pl(await i(o,1),l)},async saveAutosave(o,s){const l=Df(s);return await e.create({...l,parent:o,isAutosave:!0,modified:new Date().toString()})}}}var xf=class extends Sa{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}},Mf=class extends be{};var Zr=class extends Q{_items=new Map;_onChangeEmitter=new sa;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 i=await t(n);return je(n,i)||this._onChangeEmitter.fire(),i}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(([i,o])=>i)),r=(await this.entries()).filter(([i,o])=>!n.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),n.add(i);for(const[i]of r)t.push(this.remove(i));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 Lf(e,{filter:t,order:n="asc",orderBy:r,page:i,pageSize:o=20}={}){const s=e.length;let l=e.length;if(t!==void 0){const d=Object.keys(t);e=e.filter(u=>{for(const h of d){const g=u[h],E=t[h];return h==="id"||typeof g!="string"?g===E:typeof E=="string"&&g.startsWith(E)}return!0}),l=e.length}return r&&(e=e.sort((d,u)=>(d[r]>u[r]?1:u[r]>d[r]?-1:0)*(n==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:l,total:s,totalPages:Math.ceil(l/o)}}function kf(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 i=t.get(r.id)||{};t.set(r.id,{...i,...r})}return[...t].map(([n,r])=>r)}function Nf(e,t){return ei(e)&&ei(t)?String(e)===String(t):e===t}function ei(e){return typeof e=="string"||typeof e=="number"}var Ff=class extends Q{_cache=new Zr;_readEmitter=new be;_saveEmitter=this.addDisposable(new xf);_removeEmitter=this.addDisposable(new Mf);_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 Q);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Zr),i=n.addDisposable(new be);t=this._foreignCache[e]={get:async(o,s={})=>{await r.getOrCreate(o,async()=>{try{const d=kf(await i.fire(o))||[];for(const u of d)u[e]=o,await this._cache.add(u.id,u);return d}catch{return[]}});const l=(await this._cache.values()||[]).filter(d=>{const u=d[e];return u==null||Nf(u,o)});return Lf(l,s)},first(o,s={}){return t.get(o,{...s,page:1,pageSize:1}).then(({data:l})=>l[0])},handleRead:i.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=pe()),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 i=>{const o=i?{...i,...t}:t;if(!r)return t=i?Je(i,t):t,await this._saveEmitter.fire({prev:i,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 lt(e){const t=N(e);return n=>n.getOrCreateInstance(t,()=>new Ff)}function jf(e){const t=e.getInstance(B);if(!t)throw new Error("Failed");return t}function ti(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Bf(e,t,n){return e&&!ti(t)&&ti(e)?{...n,meta:e.meta}:n}var Qo=lt("plugin.dataSource.emails"),Zo=lt("plugin.dataSource.emailRevisions"),es=dr("plugin.readEmailAutosave"),ni=N("emailDocuments.provided");function Uf(e){const t=Qo(e),n=Zo(e),r=n.byForeignKey("parent");return e.getInstance(ni)?{emails:t,emailRevisions:n}:(e.inject(ni,!0),td(e,Pf({emails:t,saveTimeoutMs:()=>Zn(e.getInstance(he)?.contentReadyTimeoutMs)})),od(e,Of({revisions:n,revisionsByEmail:r,readAutosave:async i=>{const o=await ie(e,es).fire(i);return o.length===0?{asked:!1}:{asked:!0,revision:o[0]??null}},savedAt:async i=>Date.parse((await t.cache.getIfPresent(i))?.modified??"")})),jf(e).addDisposable(t.onSave(({prev:i,patch:o,value:s})=>Bf(i,o,s),Number.MIN_VALUE)),{emails:t,emailRevisions:n})}function ri(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 Hf(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var $f="po",vt=null;function Gf(){const e=typeof window.__useblocks__<"u"?window.__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([$f],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function qf(){return vt===null&&(vt=Gf().catch(e=>{throw vt=null,e})),vt}async function ts(e){if(typeof e=="object")return pr(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?zf(t):Vf(t)}function pr(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function zf(e){try{return pr(JSON.parse(e))}catch{return}}var ii=!1;async function Vf(e){try{return pr((await qf()).parsePoCatalog(e))}catch{ii||(ii=!0);return}}var Kf="em_locale",Wf="em_ant_locale",Yf="locale",Xf="ant_locale";function hr(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function ns(e,t){const n=hr(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Jf(){return hr("em_locale")??ns(Yf,"em_locale")}function oi(e){try{localStorage.setItem(Kf,JSON.stringify(e))}catch{}}function Qf(){return hr("em_ant_locale")??ns(Xf,"em_ant_locale")}function Zf(e,t){try{localStorage.setItem(Wf,JSON.stringify({id:e,data:t}))}catch{}}var ep=8e3;function tp(e,t){const n=e,r=t,i=Object.keys(n).filter(o=>o!=="");return i.length!==Object.keys(r).filter(o=>o!=="").length?!1:i.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function np(e){const t=Jf(),n=Qf();let r={ready:!1},i;const o=Ce(r);let s=0;const l=m=>{r={...r,...m},o.set(r)},d=()=>{r.ready||l({ready:!0})},u=setTimeout(d,e.unlockAfterMs??ep),h=m=>m!==s;let g;async function E(m,S){if(n?.id===m&&n.data&&l({antd:n.data}),!g)return;const y=await g(m).catch(()=>{});!y||h(S)||(l({antd:y}),Zf(m,y))}async function b(m,S){const y=await e.askHost(m).catch(()=>null);if(h(S))return!0;if(y==null)return!1;const I=await ts(y);return h(S)||(I&&l({catalog:I}),d()),!0}async function w(m,S){const y=await e.readList();if(h(S))return;if("error"in y){l({failure:{kind:"GET_LOCALES_ERROR",error:y.error}}),d();return}const I=y.data.find(R=>R.locale===m);if(!I){Hf("em_locale")&&l({catalog:void 0}),d();return}if(ri(t,I)&&(!i||i.catalog===t?.data)){d();return}if(i?.entry&&r.catalog===i.catalog&&ri(i.entry,I)){oi(i.entry),d();return}const T=await e.readCatalog(m);if(!h(S)){if("error"in T){l({failure:{kind:"GET_LOCALE_ERROR",error:T.error}}),d();return}T.data&&(i?.id===m&&r.catalog===i.catalog&&tp(i.catalog,T.data)||l({catalog:T.data}),oi({id:m,time:I.updatedAt||Math.floor(Date.now()/1e3),hash:I.contentHash,data:T.data})),d()}}async function _(m,S){if(!await b(m,S)){if(!h(S)&&(i?.id===m&&r.catalog===i.catalog||m==="en_US")&&d(),e.canUseNetwork&&!e.canUseNetwork()){d();return}await w(m,S)}}return{set(m){if(!m||m===r.id)return;const S=s+=1;l({id:m,failure:void 0});const y=i?.id===m&&r.catalog===i.catalog;(i&&!y&&r.catalog===i.catalog||m==="en_US"&&r.catalog)&&l({catalog:void 0}),t?.id===m&&t.data&&(l({catalog:t.data}),d()),E(m,S),_(m,S)},prime(m,S,y){r.id&&r.id!==m||r.catalog||!S||(i=t?.id===m&&t.data&&(!y||t.time>=y.time)?{id:m,catalog:t.data}:{id:m,catalog:S,entry:y?{id:m,time:y.time,hash:y.hash,data:S}:void 0},l({catalog:i.catalog}))},useAntdLoader(m){g=m,r.id&&E(r.id,s)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(u)}}var rp=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})},ip=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:i,format:o,baseUrl:s,cancelToken:l,...d})=>{const u=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},h=this.mergeRequestParams(d,u),g=i&&this.toQueryString(i),E=this.contentFormatters[r||"application/json"],b=o||h.format;return this.customFetch(`${s||this.baseUrl||""}${n}${g?`?${g}`:""}`,{...h,headers:{...h.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(l?this.createAbortSignal(l):h.signal)||null,body:typeof e>"u"||e===null?null:E(e)}).then(async w=>{const _=w;_.data=null,_.error=null;const m=b?w.clone():w,S=b?await m[b]().then(y=>(_.ok?_.data=y:_.error=y,_)).catch(y=>(_.error=y,_)):_;return l&&this.abortControllers.delete(l),S})}},op=N("rest.v2.transport"),si=Symbol("rest.v2.secureRequest");function sp(e){return e.getOrCreateInstance(op,()=>{const t=e.getInstance(Ui)?.execute||fetch;return new ip({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[si]:!0}),customFetch:(n,r={})=>{const{[si]:i,...o}=r;return t(n,{...o,[zs]:i!==!0})}})})}function ap(e,t){const n=sp(e);return Object.assign({},...t.map(r=>new r(n)))}function ai(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function rs(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:ai(n.details,"wp_code")??n.code,message:ai(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 is(e){return!e.ok||!!e.error}function lp(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function os(){return lp(He.em_translations_v2)??!0}function dp(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function cp(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function up(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],i=r[0];return typeof i=="string"&&i!==""&&t.push({locale:i,updatedAt:dp(r[1])}),t},[]):[]}function fp(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:cp(n.updated_at),contentHash:n.content_hash}),t),[])}function ss(e){return ap(e,[rp])}function xt(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function xn(e){return!e.ok||e.error!=null}function Mn(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function en(e){return{data:await ts(e)??null}}async function pp(e){if(os())try{const n=await ss(e).localesList();return is(n)?{error:rs(n)}:{data:fp(n.data)}}catch(n){return xt(n)}const t=qi(e,[Xi]);try{const n=await t.get_translations2({file:"react_app"});return xn(n)?Mn(n):{data:up(n.data)}}catch(n){return xt(n)}}async function hp(e,t){if(os())try{const r=await ss(e).jsonList({locale:t});return is(r)?{error:rs(r)}:en(r.data)}catch(r){return xt(r)}const n=qi(e,[Xi]);try{const r=await n.get_translations3({id:t,file:"react_app"});return xn(r)?Mn(r):en(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return xn(r)?Mn(r):en(r.data)}catch(r){return xt(r)}}}var bt=new WeakMap;function mp(e){const t=bt.get(e);if(t!==void 0)return t;const n=pp(e).then(r=>("error"in r&&bt.delete(e),r),r=>{throw bt.delete(e),r});return bt.set(e,n),n}var nt=N("locale.service");function gp(e){if(e.getInstance(nt))return;const t=np({readList:()=>mp(e),readCatalog:n=>hp(e,n),askHost:async n=>(await ie(e,$.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(Ee)});e.inject(nt,t),e.getInstance(B)?.addDispose(()=>t.dispose())}function vp(e){const t=e.getInstance(ye);if(!t)return;const n=e.getInstance(nt);if(!n)return;const r=t.select(i=>i.locale).watch(i=>n.set(i||"en_US"));e.getInstance(B)?.addDisposable(r)}var bp="user_id",yp="project_id",li=N("rest.identityHeadersProvided");function Ep(e){if(e.getInstance(li))return;e.inject(li,!0);let t;e.getInstance(ne)?.watch(n=>{t=n}),e.addService(Vn,{execute(n,r){if(r?.public)return;const i=t?.user?.id??Io(e).profile?.id;i!=null&&i!==""&&n.headers.set(bp,String(i));const o=t?.project;o!=null&&o!==""&&n.headers.set(yp,String(o))}})}function _p(e){if(!e)return!1;try{return e.getInstance(Ee)!==void 0}catch{return!1}}var wp="Invalid standaloneKey.",ov=N("StandaloneMockGuard");function Sp(){const e=new Error(wp);return e.name="InvalidStandaloneKeyError",e}function Ip(e){e.addService(Vn,{execute:()=>{if(_p(e))throw Sp()}})}function Ap(e){oa(e),Ip(e)}function Cp(e){const t=new jo;e.inject(he,t);const n=e.getInstance(ne)?.watch(i=>{if(!i)return;const o=i.signal??t.externalSignal;t.configure({replaceSession:!0,...i.timeouts!==void 0?{timeouts:i.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(B);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var Tp=lt("plugin.dataSource.blocks"),Rp=lt("plugin.dataSource.blockRevisions"),Pp=lt("plugin.dataSource.comments"),Dp=dr(),Op=dr(),as=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
1004
|
+
`));return{html:ff(t.html),hasBrowserExtensionArtifacts:t.found}}function rn(e){return e?.getContent()??""}function $s(e,t){e?.mutate({content:ss(t)},{source:"remote"})}function Vr(e){return N(e)}function ae(e,t){return e.getOrCreateInstance(t,()=>new Ae)}function J(e,t){return e.getOrCreateInstance(t,()=>new Ae).event}function on(e,t,n,r){return{html:e,guid:t,...Object.keys(n).length>0?{templateDirectivesPolicy:n}:{},...r!==void 0?{rev:r}:{}}}var pf=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}},hf=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(le("Superseded by newer show()")),n.aborted?Promise.reject(le(n.reason)):(this._activeRequest=e,new Promise((r,i)=>{const o=setTimeout(()=>{this._settle(e.showId,()=>{i(new pf(e.showId,t))})},t);o.unref?.();const s=()=>{this._settle(e.showId,()=>{i(le(n.reason))})};n.addEventListener("abort",s,{once:!0});const a=()=>{clearTimeout(o),n.removeEventListener("abort",s)};this._pending.set(e.showId,{request:e,resolve:r,reject:i,timeoutId:o,dispose:a});for(const l of this._listeners)l(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 mf(e,t){return{contentReady:t.contentReady??e?.contentReady,sandboxReady:t.sandboxReady??e?.sandboxReady,sandbox:t.sandbox?{...e?.sandbox,...t.sandbox}:e?.sandbox}}function gf(e){if(!e||!(e.contentReady!==void 0||e.sandboxReady!==void 0||e.sandbox!==void 0))return;const t=Jo(e),n=Qo(e),r=Oc(e.sandbox);t<n+r}var Vs=class{_controller=new AbortController;_externalSignalDisposable=new Z;_sessionChangeListeners=new Set;_showRegistry=new hf;_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 Jo(this._timeouts)}getSandboxTimeoutMs(e){return Xo(e,this._timeouts?.sandbox)}getSandboxReadyTimeoutMs(){return Qo(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=mf(this._timeouts,e.timeouts),gf(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 Z,this._linkExternalSignal(e)}abort(e){const t=e??le("Editor instance destroyed");this._showRegistry.rejectAll(t),this._controller.signal.aborted||(this._controller.abort(t),this.bumpGeneration()),this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Z}_replaceSessionController(){this._externalSignalDisposable.dispose(),this._externalSignalDisposable=new Z,this._showRegistry.rejectAll(le("Init session replaced")),this._controller.signal.aborted||this._controller.abort(le("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??le()),this.bumpGeneration());return}const t=()=>{this._controller.signal.aborted||(this._controller.abort(e.reason??le()),this.bumpGeneration())};e.addEventListener("abort",t),this._externalSignalDisposable.addDispose(()=>{e.removeEventListener("abort",t)})}},qr=(()=>{const e=new Vs;return e.configure({}),e})(),vf=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 bf(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 yf(e,t,n){return e.isInited()&&e.getTarget()?Promise.resolve():(z(n),new Promise((r,i)=>{let o=!1,s,a;const l=d=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),a?.dispose(),n?.removeEventListener("abort",u),d())},u=()=>{l(()=>i(le(n?.reason)))};if(a=e.onInit(()=>{e.isInited()&&e.getTarget()&&l(()=>r())}),e.isInited()&&e.getTarget()){l(()=>r());return}t>0&&(s=setTimeout(()=>{l(()=>i(new vf(t)))},t)),n?.addEventListener("abort",u)}))}var Ef=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 _f(e,t,n){return t<=0?e:new Promise((r,i)=>{let o=!1,s;const a=l=>{o||(o=!0,s!==void 0&&(clearTimeout(s),s=void 0),l())};s=setTimeout(()=>{a(()=>i(new Ef(n,t)))},t),e.then(l=>{a(()=>r(l))},l=>{a(()=>i(l))})})}var wf=2,Ht=Symbol("sandbox:frame-replaced");function ye(e,t,n,r,i,o,s){const a=`sandbox:${t}`,l=o?.getSandboxTimeoutMs(t)??Or[t],u=()=>{let S=_f(e.sendAsync(n,r),l,a);return S=en(S,o?.signal),mt(a,S,i)};if(t==="INIT_START"&&bf(e)){const S=o?.getSandboxReadyTimeoutMs()??2e4,E=e,h=w=>{const _=yf(E,S,o?.signal);return mt("sandbox:INIT_START:ready-wait",_,i).then(()=>{if(!s||w<=0)return u();const A=s.getGeneration();let I;const x=new Promise((C,R)=>{I=s.onChange(()=>{s.getGeneration()!==A&&R(Ht)})}),y=u();return y.catch(()=>{}),Promise.race([y,x]).finally(()=>I?.()).catch(C=>{if(C!==Ht)throw C;return{...i},h(w-1)})})};return h(wf)}if(!s)return u();const d=s.getGeneration();let p;const b=new Promise((S,E)=>{p=s.onChange(()=>{s.getGeneration()!==d&&E(Ht)})}),v=u();return v.catch(()=>{}),Promise.race([v,b]).finally(()=>p?.()).catch(S=>{throw S===Ht&&{...i},S})}var Sf=[["brace-percent",/<!--\{%/],["brace-hash",/<!--\{#/],["proscript",/<!--\[%/],["getresponse",/<!--\[\[(?:if|else\]\]|endif\]\])/i],["mailchimp",/<!--\*\|/],["expert-sender",/<!--<\/?(?:if|else|var)/i]],If=200;function qs(e=new Set){const t=new Set;return(n,r)=>{if(!Sf.some(([o,s])=>!e.has(o)&&s.test(n)))return;const i=r??`new:${n.length}:${n.slice(0,200)}`;t.has(i)||(t.size>=If&&t.clear(),t.add(i))}}function Gs(){return{isConfigured:()=>!1,toEditorForm:e=>e,toOutputForm:e=>e,keepWrappedOnOutput:new Set,editorPolicy:{},warnAboutUnconfiguredInput:qs()}}var Cf=Gs();function Ve(e){return e?.getInstance(Tr)??Cf}function Tf(e){const t=De(e),n=ne(e),r=()=>e.getInstance(we)??qr;let i,o,s=!1,a=!1;const l=async(_,A,I)=>{const x=I.generation,y=()=>I.generation!==x||I.signal.aborted||t.current()!==_||a,C=me(n);s=!0;try{if(await ye(n,"INIT_START",$.SANDBOX_INIT_START,{guid:A},void 0,I),y())return;const{html:R,hasBrowserExtensionArtifacts:m}=Hs(rn(_));if(m&&ae(e,F.ON_BROWSER_EXTENSION_DETECTED_ID).fire(),$s(_,R),await ye(n,"SET_ENTITY",$.SANDBOX_SET_ENTITY,on(rn(_),A,Ve(e).editorPolicy,_.get().version),void 0,I),y())return;await ye(n,"INITED",$.SANDBOX_INITED,{guid:A},void 0,I),i=A,o=C}finally{s=!1}},u=()=>ge(t.sessionKey())?t.current():void 0,d=()=>{if(a||s)return;const _=u(),A=_?.get().docId;if(!_||!A||i===A&&o===me(n)||!_.isReady())return;const I=r();I.signal.aborted||l(_,A,I).catch(()=>{})};let p=!1;const b=()=>{p||a||(p=!0,queueMicrotask(()=>{p=!1,d()}))};let v,S;const E=()=>{const _=u(),A=_?.get().docId;A!==S&&(v?.(),S=A,v=_?.subscribe(b)),b()},h=t.subscribe(E),w=Ns(n,b);E(),e.getInstance(H)?.addDispose(()=>{a=!0,w(),v?.(),h()})}var Af=200;function Rf({startVersion:e,limit:t=Af}){let n=[],r=e;const i=o=>{n=n.filter(s=>s.version>o),r=Math.max(r,o)};return{record(o){!o.changes?.length&&!o.contentReplaced||(n.push(o),n.length>t&&i(n[n.length-t-1].version))},rebase(o,s){if(s<r)return null;const a=n.filter(u=>u.version>s);i(s);let l=o;for(const u of a){if(u.contentReplaced||!u.changes)return null;const d=u.changes,p=[];for(const b of l){if(u.fromCanvas&&d.some(S=>b.range.start<=S.oldEnd&&b.range.end>=S.oldPosition))return null;const v=$c(b.range,d,"after");if(!v)return null;p.push({range:v,text:b.text})}l=p}return l}}}function Pf(e,t){let n=0;return e.map(({start:r,end:i,text:o})=>{const s=new fe(r,t.slice(r,i),r+n,o);return n+=o.length-(i-r),s})}function Df(e,t){const n=[...e].sort((r,i)=>r.range.start-i.range.start);return Pf(n.map(({range:r,text:i})=>({start:r.start,end:r.end,text:i})),t)}function Of(e){return[...e].sort((t,n)=>n.oldPosition-t.oldPosition).map(t=>({range:{start:t.oldPosition,end:t.oldEnd},text:t.newText}))}var Gr=N("canvas.sandboxFill");function zs(e){return e.getInstance(Gr)?.pipeline.isEventsLocked()===!0}function $t(e){Et(e,{origin:"canvas-channel"})}function xf(e){const t=De(e),n=ne(e);let r;const i=(l,u)=>{const d=l.get().docId;let p=!1,b=null,v=null;const S=Rf({startVersion:l.get().version});let E=l.getContent(),h=!0;const w=(C,R)=>{!h||t.current()!==l||(Et(R,{origin:"canvas-channel"}),n.sendAsync($.SANDBOX_SET_ENTITY,on(rn(l),d,Ve(e).editorPolicy,l.get().version)).catch($t))},_=async(C,R)=>{if(v){v.push({edits:C,rev:R});return}v=[{edits:C,rev:R}];try{do{const m=v.splice(0,v.length);await n.sendAsync($.SANDBOX_UPDATE_ENTITY,{edits:m.map(c=>c.edits),guid:d,rev:m[m.length-1].rev})}while(v.length)}catch(m){w("app edits failed to reach the canvas",m)}finally{v=null}},A=(C,R)=>{const m=v?.splice(0,v.length)??[];m.length&&n.sendAsync($.SANDBOX_UPDATE_ENTITY,{edits:m.map(c=>c.edits),guid:d,rev:m[m.length-1].rev}).catch($t),n.sendAsync($.SANDBOX_UPDATE_ENTITY,{edits:[C],guid:d,rev:l.get().version,...R!==null?{changeId:R}:{}}).catch($t)},I=C=>{const{guid:R,pushUndoStop:m}=C;if(R!==d)return;const c=Zc(C);let{edits:f}=C;if(c.baseRev!==null){const P=S.rebase(f,c.baseRev);if(!P){Et(new Error("canvas batch conflicts with newer document changes"),{origin:"canvas-channel"}),A([],c.changeId);return}f=P}const g=l.get().version;try{p=!0,b=c.changeId;const P=Df(f,l.getContent());m===!1?u.applyWithoutHistory(P):l.mutate({changes:P},{source:zs(e)?"system":"user"})}catch(P){w("canvas batch failed to apply",P);return}finally{p=!1,b=null}l.get().version===g&&c.baseRev!==null&&A([],c.changeId)},x=l.subscribe(({changes:C,version:R})=>{const m=l.getContent(),c=!C?.length&&m!==E;if(E=m,S.record({version:R,changes:C,contentReplaced:c,fromCanvas:p}),!C?.length)return;const f=Of(C);p?A(f,b):_(f,R).catch($t)}),y=n.addListener($.APPLICATION_UPDATE_ENTITY,I);return()=>{h=!1,x(),y.dispose()}};let o;const s=()=>{const l=t.current(),u=t.history(),d=l?.get().docId;d!==o&&(r?.(),r=void 0,o=d,l&&u&&(r=i(l,u)))},a=t.subscribe(s);s(),e.getInstance(H)?.addDispose(()=>{r?.(),a()})}var Mf=/^(?:ant|vscode|monaco|docs)-/;function Lf(e){return Mf.test(e)}function kf(){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 Nf=new Set(["animation-opacity","inline-edit-border-radius","separator-border","text-link-decoration"]);function Ff(){return Nf}var jf=new Set;function Bf(e,t,n=jf){return e.startsWith(`${t}-`)?!1:!Lf(e)&&!n.has(e)}function Uf(e,t){return`--${t}-${e}`}function Ws(e){const t=kf();return Bf(e,t,Ff())?Uf(e,t):`--${e}`}function Hf(e,t){const n=Ws(e);return t!==void 0?`var(${n}, ${t})`:`var(${n})`}function $f(e,t){return Hf(e,t)}function $e(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 Fe(e){return!e||e==="none"}function Vf(e){const t=e.contain??"",n=e.willChange??"";return!Fe(e.transform)||!Fe(e.perspective)||!Fe(e.filter)||!Fe(e.backdropFilter)||!Fe(e.translate)||!Fe(e.rotate)||!Fe(e.scale)||/transform|perspective|filter/.test(n)||/paint|layout|strict|content/.test(t)||!!e.containerType&&e.containerType!=="normal"}function Ai(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 qf(e){const t=[],n=document.documentElement,r=Ai(getComputedStyle(n)),i=r.x||r.y;let o="none";const s=getComputedStyle(e).position;(s==="absolute"||s==="fixed")&&(o=s);for(let a=$e(e);a&&a!==n;a=$e(a)){const l=getComputedStyle(a),u=o==="none"||Vf(l)||o==="absolute"&&!!l.position&&l.position!=="static",d=a===document.body&&!i;if(u){o="none";const p=d?{x:!1,y:!1}:Ai(l);(p.x||p.y)&&t.push({node:a,...p})}(l.position==="absolute"||l.position==="fixed")&&(o==="none"||l.position==="fixed")&&(o=l.position==="fixed"?"fixed":"absolute")}return t}function Ks(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 Vt(e){return Number.parseFloat(e)||0}function Qn(e){const t=e.getBoundingClientRect(),n=getComputedStyle(e),r=Ks(e),i=Vt(n.borderLeftWidth),o=Vt(n.borderTopWidth),s=Vt(n.borderRightWidth),a=Vt(n.borderBottomWidth),l=e.offsetWidth>0?Math.max(0,e.offsetWidth-e.clientWidth-i-s):0,u=e.offsetHeight>0?Math.max(0,e.offsetHeight-e.clientHeight-o-a):0;return{left:t.left+i*r.x,top:t.top+o*r.y,right:t.right-(s+l)*r.x,bottom:t.bottom-(a+u)*r.y}}function Gf(e,t,n){const r={left:e.left,top:e.top,right:e.right,bottom:e.bottom},i=(o,s,a)=>{s&&(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=>i(Qn(o.node),o.x,o.y)),n&&i(Qn(n),!0,!0),r}var Zn={originX:0,originY:0,scaleX:1,scaleY:1};function sn(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 Ys(e,t,n){const r=t.width>0&&e.width>0?e.width/t.width:n.scaleX,i=t.height>0&&e.height>0?e.height/t.height:r;return{originX:e.left-t.left*r,originY:e.top-t.top*i,scaleX:r,scaleY:i}}function Xs(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 zf=1e3;function Wf(e){const{slot:t,own:n}=e;let r,i=0,o=!1;const s=()=>{if(r=void 0,!o){if(!t.isConnected||!n.isConnected){e.onDetached();return}(e.measure()||performance.now()<i)&&(r=window.requestAnimationFrame(s))}},a=()=>{!o&&r===void 0&&(r=window.requestAnimationFrame(s))},l=()=>{i=performance.now()+zf,a()},u=[window],d=[document.documentElement];for(let h=t;h;h=$e(h)){const w=h.getRootNode();w instanceof ShadowRoot&&!u.includes(w)&&(u.push(w),d.push(w))}const p=[["scroll",a],["load",a],["transitionrun",l],["transitionend",a],["transitioncancel",a],["animationstart",l],["animationend",a],["animationcancel",a]];u.forEach(h=>p.forEach(([w,_])=>h.addEventListener(w,_,{capture:!0,passive:!0}))),window.addEventListener("resize",a),document.fonts?.addEventListener?.("loadingdone",a);const b=typeof MutationObserver=="function"?new MutationObserver(h=>{h.some(w=>!n.contains(w.target))&&a()}):void 0;d.forEach(h=>b?.observe(h,{attributes:!0,childList:!0,subtree:!0,characterData:!0}));let v;try{if(typeof ResizeObserver=="function"){const h=new ResizeObserver(a);typeof h.observe=="function"&&(v=h)}}catch{v=void 0}let S=[];return{schedule:a,observe:h=>{!v||h.length===S.length&&h.every((w,_)=>w===S[_])||(v.disconnect(),S=h,h.forEach(w=>v?.observe(w)))},dispose(){o=!0,r!==void 0&&(window.cancelAnimationFrame(r),r=void 0),u.forEach(h=>p.forEach(([w,_])=>h.removeEventListener(w,_,{capture:!0}))),window.removeEventListener("resize",a),document.fonts?.removeEventListener?.("loadingdone",a),b?.disconnect(),v?.disconnect()}}}var Js=300,Ri=15e3,Pi="em-canvas-busy-style";function Kf(){if(document.getElementById(Pi))return;const e=document.createElement("style");e.id=Pi,e.textContent="@keyframes em-canvas-busy-spin{to{transform:rotate(360deg)}}",document.head.appendChild(e)}var Yf="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 Xf(e){const t=$f("colorPrimary","#1677ff");return e&&getComputedStyle(e).getPropertyValue(Ws("colorPrimary")).trim()||t}function Qs(e){Kf();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",Yf),n.appendChild(r);const i=document.createElement("span");return i.setAttribute("role","img"),i.setAttribute("aria-label","loading"),i.setAttribute("style",`display:inline-flex;color:${Xf(e)};animation:em-canvas-busy-spin 1s linear infinite`),i.appendChild(n),i}function Jf(e,t,n){const r=t??e,i=Math.max(r.left,e.left,0),o=Math.min(r.right,e.right,n.width),s=Math.max(r.top,e.top,0),a=Math.min(r.bottom,e.bottom,n.height);return o<=i||a<=s?{x:(e.left+e.right)/2-e.left,y:(e.top+e.bottom)/2-e.top}:{x:(i+o)/2-e.left,y:(s+a)/2-e.top}}function Qf(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 i={left:n.left,top:n.top,right:n.right,bottom:n.bottom},o=r.getBoundingClientRect();if(o.width>0&&!Xs({left:o.left,top:o.top,width:o.width,height:o.height},i)){const s=sn(i,Ys(o,sn(i,Zn),Zn));Object.assign(r.style,{left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`,height:`${s.height}px`})}return{showSpinner(){r.style.background="rgba(128, 128, 128, 0.15)";const s=Jf(n,t(),{width:window.innerWidth,height:window.innerHeight}),a=document.createElement("div");Object.assign(a.style,{position:"absolute",left:`${s.x}px`,top:`${s.y}px`,transform:"translate(-50%, -50%)",lineHeight:"0"}),a.appendChild(Qs(e.querySelector(".ant-app")??e)),r.appendChild(a)},remove:()=>r.remove()}}function Di(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(Qs(e))},Js);return{remove(){clearTimeout(r),t.remove(),n||(e.style.position="")}}}var Zf=8e3;function ep(){return{element:document.createElement("iframe"),ready:()=>Promise.reject(new Error("[canvas] нет элемента монтирования")),reload:()=>Promise.resolve(),reloadQuietly:()=>Promise.resolve(),moveTo:()=>Promise.resolve(),scrollBy:()=>{},shown:!1,whenShown:()=>Promise.resolve(),alignTo:()=>{},resize:()=>{},dispose:()=>{}}}function tp(e,t){for(let n=$e(e);n;n=$e(n)){const r=getComputedStyle(n),i=r.overflowX!=="visible"||r.overflowY!=="visible",o=[r.borderTopLeftRadius,r.borderTopRightRadius,r.borderBottomRightRadius,r.borderBottomLeftRadius].some(s=>Ke(s)>0);if(i&&o)return n;if(n===t)return null}return null}function Ke(e){return Number.parseFloat(e)||0}function qt(e,t){return Math.abs(e-t)<=1}function np(e){const t=getComputedStyle(e),n=Ke(t.borderTopWidth),r=Ke(t.borderRightWidth),i=Ke(t.borderBottomWidth),o=Ke(t.borderLeftWidth),s=(a,l,u)=>Math.max(0,Ke(a)-Math.max(l,u));return{...Qn(e),radii:[s(t.borderTopLeftRadius,n,o),s(t.borderTopRightRadius,n,r),s(t.borderBottomRightRadius,i,r),s(t.borderBottomLeftRadius,i,o)]}}function rp(e,t){const n=qt(t.top,e.top),r=qt(t.bottom,e.bottom),i=qt(t.left,e.left),o=qt(t.right,e.right),s=[n&&i?e.radii[0]:0,n&&o?e.radii[1]:0,r&&o?e.radii[2]:0,r&&i?e.radii[3]:0];return s.every(a=>a===0)?"":s.map(a=>`${a}px`).join(" ")}function ip(e,t,n,r,i){const o=n.readyTimeoutMs??Zf,s=document.createElement("div");s.dataset.canvasHost=e,r&&(s.dataset.canvasPlace=r),s.style.position="fixed",s.style.overflow="hidden",s.style.visibility="hidden";const a=n.resolveSrc(e),l=document.createElement("iframe");l.setAttribute("sandbox",n.resolveSandbox(a)),l.setAttribute("allow","clipboard-read; clipboard-write"),l.setAttribute("title","Email content"),l.style.width="100%",l.style.border="0",l.style.display="block",l.style.minHeight="600px",l.src=a,s.appendChild(l),t.appendChild(s),n.mark?.("created"),i||n.onCreated?.(l);const u=new Z;let d=!1,p=!1,b,v,S,E;const h=()=>{clearTimeout(E),E=setTimeout(()=>{p||(p=!0,v?.(new Error(`[canvas] ${e}: документ не загрузился за ${o} мс`)))},o)},w=()=>d?(S=Promise.resolve(),p=!0,S):(p=!1,S=new Promise((k,V)=>{b=k,v=V}),h(),S),_=()=>{if(clearTimeout(E),d=!0,p){S=Promise.resolve();return}p=!0,n.mark?.("loaded"),b?.()};l.addEventListener("load",_),u.addDispose(()=>{clearTimeout(E),l.removeEventListener("load",_)});let A;const I=()=>{A??=n.bindResizer?.(l)},x=()=>{A?.dispose(),A=void 0};let y=null,C=null,R,m=Zn,c="",f="",g=0;const P=k=>{const V=JSON.stringify(k);return V===c?!1:(c=V,s.style.visibility=k.visibility,s.style.left=`${k.css.left}px`,s.style.top=`${k.css.top}px`,s.style.width=`${k.css.width}px`,s.style.height=`${k.css.height}px`,s.style.borderRadius=k.radius,l.style.width=k.elementWidth>0?`${k.elementWidth}px`:"100%",l.style.transform=k.shiftX!==0?`translate(${k.shiftX}px, ${k.shiftY}px)`:`translateY(${k.shiftY}px)`,!0)},D=()=>{if(!y)return c="",s.style.visibility="hidden",l.removeAttribute("id"),!1;n.elementId&&(l.id=n.elementId);const k=y.getBoundingClientRect(),V=qf(y),Y=C?.isConnected?C:null;R?.observe([y,l,...V.map(U=>U.node),...Y?[Y]:[]]);const X=Gf(k,V,Y),Q=Math.max(0,X.right-X.left),Me=Math.max(0,X.bottom-X.top),Le=getComputedStyle(y).visibility==="visible",ke=Q<=0||Me<=0,Ce=ke?{left:X.left,top:X.top,right:X.left,bottom:X.top}:X,Nt=ke?null:tp(y,Y??V[0]?.node??null),yn=Nt?rp(np(Nt),Ce):"",M=U=>P({visibility:Le?"":"hidden",css:sn(Ce,U),elementWidth:k.width/U.scaleX,shiftX:(k.left-Ce.left)/U.scaleX,shiftY:(k.top-Ce.top)/U.scaleY,radius:yn});let q=M(m);if(!ke){const U=s.getBoundingClientRect();U.width>0&&!Xs({left:U.left,top:U.top,width:U.width,height:U.height},Ce)&&(m=Ys(U,sn(Ce,m),m),q=M(m)||q)}return q},B=()=>{if(!y)return!1;let k=D();const V=l.getBoundingClientRect().height;V>0&&V!==g&&(g=V,y.style.height=`${V/Ks(y).y}px`,k=!0);const Y=getComputedStyle(y).pointerEvents;return Y!==f&&(f=Y,s.style.pointerEvents=Y),k},T=()=>{R?.dispose(),R=void 0},O=k=>{R=Wf({slot:k,own:s,measure:B,onDetached:T})};let L=[];const ie=(k,V)=>{if(C=V,k&&L.length>0){const Y=L;L=[],Y.forEach(X=>X())}if(k===y){k&&!R&&O(k),B();return}if(T(),y&&y.style.removeProperty("height"),c="",g=0,f="",y=k,!k){D(),x();return}n.onShown?.(l),O(k),B(),I()};u.addDispose(T);const xe=k=>{d=!1,k&&n.onReload?.(l);let V;p||S===void 0?V=w():(h(),V=S);try{l.contentWindow?.location.reload()}catch{l.src=a}return V};return{element:l,ready(){return S??w()},reload:()=>xe(!0),reloadQuietly:()=>xe(!1),moveTo(k){if(s.parentNode===k)return S??w();d=!1;let V;return p||S===void 0?V=w():(h(),V=S),k.appendChild(s),n.onReload?.(l),c="",R?.schedule(),V},get shown(){return y!==null},whenShown(){return y!==null?Promise.resolve():new Promise(k=>{L.push(k)})},alignTo(k,V){ie(k,V??null)},scrollBy(k,V){let Y=k,X=V;for(let Q=y?$e(y):null;Q;Q=$e(Q)){if(Math.abs(Y)<1&&Math.abs(X)<1)return;const Me=getComputedStyle(Q);if((Me.overflowY==="auto"||Me.overflowY==="scroll")&&Q.scrollHeight>Q.clientHeight){const Le=Q.scrollTop,ke=Q.scrollLeft;Q.scrollBy({left:Y,top:X,behavior:"instant"}),Y-=Q.scrollLeft-ke,X-=Q.scrollTop-Le}}(Math.abs(Y)>=1||Math.abs(X)>=1)&&window.scrollBy({left:Y,top:X,behavior:"instant"})},resize(){A?.resize()},dispose(){ie(null,null),x(),u.dispose(),s.remove()}}}function op(e){const t=new Map;let n="a";const r=()=>n==="a"?"b":"a",i=(v,S)=>v==="email"?`email:${S??n}`:v,o=new Map;let s,a=[],l=!1,u;const d=()=>{if(a.forEach(v=>clearTimeout(v)),a=[],s?.remove(),s=void 0,u?.remove(),u=void 0,l){l=!1;const v=o.get("email");t.get(i("email"))?.alignTo(v?.slot??null,v?.clip??null)}},p=(v,S,E)=>{const h=i(v,S),w=t.get(h);if(w)return w;const _=e.resolveMount();if(!_)return ep();const A=ip(v,_,e,v==="email"?S??n:void 0,E);return t.set(h,A),A},b={get:v=>p(v),current:v=>p(v),peek:v=>t.get(i(v)),spare:()=>t.get(i("email",r())),ensureSpare:()=>p("email",r(),!0),promote(){const v=t.get(i("email",r()));if(!v)return;const S=t.get(i("email"));n=r();const E=o.get("email");v.alignTo(E?.slot??null,E?.clip??null),S?.alignTo(null)},alignSurface(v,S,E){if(o.set(v,{slot:S,clip:E??null}),v==="email"&&l){u?.remove(),u=S?Di(S):void 0;return}(S?p(v):t.get(i(v)))?.alignTo(S,E??null)},visible(){for(const v of t.values())if(v.shown)return v},byWindow(v){if(v){for(const S of t.values())if(S.element.contentWindow===v)return S}},busy(v){if(d(),!v)return;if(!b.visible()){l=!0;const h=o.get("email");h?.slot&&(u=Di(h.slot)),a=[setTimeout(d,Ri)];return}const S=e.resolveMount();if(!S)return;const E=Qf(S,()=>b.visible()?.element.parentElement?.getBoundingClientRect()??null);s=E,a=[setTimeout(()=>E.showSpinner(),Js),setTimeout(d,Ri)]},remount(v){d();const S=i("email");t.forEach((E,h)=>{if(h===S){E.moveTo(v).catch(()=>{});return}E.dispose(),t.delete(h)})},dispose(){d(),t.forEach(v=>v.dispose()),t.clear(),o.clear(),n="a"}};return b}var sp=N("canvas.resizerBinder"),er=N("canvas.service"),ap={created:re.canvasCreated,loaded:re.canvasLoaded};function lp(e,t){if(e.getInstance(er))return;const n=op({resolveMount:()=>t.resolveMount(),resolveSrc:i=>t.resolveSrc(i),resolveSandbox:Vd,elementId:t.elementId,bindResizer:i=>e.getInstance(sp)?.(i),onCreated:i=>Yt(e,i,"fresh"),onReload:i=>Yt(e,i,"fresh"),onShown:i=>Yt(e,i,"switch"),mark:i=>t.mark?.(ap[i])}),r=ne(e).addListener($.SANDBOX_WHEEL,i=>{n.visible()?.scrollBy(i?.deltaX??0,i?.deltaY??0)});e.inject(er,n),e.getInstance(H)?.addDispose(()=>{r.dispose(),n.dispose()})}function Yt(e,t,n){const r=ne(e),i=t.contentWindow;if(!i)return;const o=r.getTarget()===i;o&&n==="switch"||(n==="fresh"&&(r.forget(i),o&&r.setTarget(void 0)),r.setTarget(i),Cd(r))}function cp(e,t){Yt(e,t,"promote")}function up(e,t){const n=t.contentWindow;n&&ne(e).greet(n)}function dp(e,t){const n=t.contentWindow;n&&ne(e).forget(n)}function pe(e){return e.getInstance(er)}function fp(e){const t=ne(e),n=()=>pe(e)?.byWindow(t.getTarget()),r=t.addListenerAsync($.RELOAD,async()=>{await n()?.reload()}),i=t.addListener(s=>{s.data?.operation===$.SANDBOX_RESIZED&&n()?.resize()}),o=J(e,F.ON_EMAIL_INIT_ID)(()=>{n()?.resize()});e.getInstance(H)?.addDispose(()=>{r.dispose(),i.dispose(),o.dispose()})}function Oi(){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 pp(e){const t=e.getInstance(te);let n,r;e.getInstance(H)?.addDispose(()=>{r?.remove(),r=void 0}),lp(e,{resolveMount:()=>n,resolveSrc:o=>Fs(o==="block"),elementId:"email_iframe",mark:o=>K(o)}),t?.watch(o=>{const s=o?.element;if(n&&s instanceof HTMLElement&&s!==n){n=s,pe(e)?.remount(s),r?.remove(),r=void 0;return}if(!n){if(s instanceof HTMLElement)n=s;else if(o!==void 0){n=r??=Oi(),pe(e)?.alignSurface("email",r,r);return}else return;pe(e)?.get("email")}});let i;e.getInstance(H)?.addDispose(()=>{i?.remove(),i=void 0}),sd(e).watch(o=>{const s=pe(e);if(s){if(o){i??=Oi(),s.alignSurface("email",i,i);return}i&&(s.alignSurface("email",null),i.remove(),i=void 0)}})}var Zs=N("canvas.headerFlow"),xi=["subject","preheader"],hp=3e3,mp={subject:$.SANDBOX_SUBJECT_UPDATE,preheader:$.SANDBOX_PREHEADER_UPDATE};function gp(e){const t=De(e),n=ne(e),r=h=>h?"remote":zs(e)?"system":"user",i=(h,{guid:w,value:_,forced:A})=>{const I=lt(t);if(!I||typeof _!="string"||w&&w!==I.get().docId)return;const x=t.forcedHeaders();if(x?.[h]&&!A&&_!==x[h])return;A&&(p.delete(h),p.size===0&&t.endForcedHeaders());const y=I.get().attributes[h]??"";a=!0;try{_t(I,{[h]:_},{source:r(A)})}finally{a=!1}o[h]=_,ae(e,F.ON_HEADER_APPLIED_ID).fire({field:h,value:_,forced:!!A,isGenerated:_!==y&&!!_})};let o={},s,a=!1,l=Promise.resolve();const u=(h,w,_,A=!1)=>{l=n.sendAsync(mp[h],{value:w,guid:lt(t)?.get().docId,..._?{force:!0,echo:!0}:{},...A?{undoStep:!0}:{}}).catch(I=>{})};let d;const p=new Set;e.inject(Zs,{whenDelivered:async()=>{await l},reassert:h=>{const w=lt(t),_=xi.filter(A=>h[A]);if(!(!w||_.length===0)){a=!0;try{_t(w,Object.fromEntries(_.map(A=>[A,h[A]])),{source:"system"})}finally{a=!1}t.beginForcedHeaders({subject:h.subject??"",preheader:h.preheader??""}),clearTimeout(d),d=setTimeout(()=>{p.clear(),t.endForcedHeaders()},hp),p.clear();for(const A of _)p.add(A);for(const A of _)o[A]=h[A],u(A,h[A],!0)}}});const b=()=>{s?.(),s=void 0;const h=lt(t);if(!h){o={};return}const w=h.get().attributes;o={subject:w.subject,preheader:w.preheader},s=h.subscribe(({source:_})=>{if(a)return;const A=h.get().attributes,I=t.forcedHeaders();for(const x of xi){const y=A[x];y!==o[x]&&(o[x]=y,u(x,y??"",_==="system"&&I?.[x]!==void 0,_==="user"))}})};b();const v=t.subscribe(b),S=n.addListenerAsync($.APPLICATION_SUBJECT_UPDATE,h=>i("subject",h)),E=n.addListenerAsync($.APPLICATION_PREHEADER_UPDATE,h=>i("preheader",h));e.getInstance(H)?.addDispose(()=>{S.dispose(),E.dispose(),v(),s?.(),clearTimeout(d)})}function Mi(e){return e!==null&&typeof e=="object"&&!Array.isArray(e)}function tr(e,t){const n={...e};for(const r of Object.keys(t)){const i=t[r],o=e[r];Mi(i)&&Mi(o)?n[r]=tr(o,i):i!==void 0&&(n[r]=i)}return n}function vp(e,t){const n=Sr;if(typeof e=="string"){const r=e.trim();if(r.startsWith("{"))try{const i=JSON.parse(r);if(i&&typeof i=="object"&&!Array.isArray(i)&&Object.keys(i).length>0)return tr(n,i)}catch{}}return t&&typeof t=="object"&&!Array.isArray(t)?tr(n,t):n}function bp(){const e=window.localStorage.getItem(Dt.em_color_scheme),t=matchMedia("(prefers-color-scheme: dark)").matches?jl:Dl;return e&&e!=="system"?e:t}function yp(){const e=window.localStorage.getItem(Dt.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 Ep(e){const{config:t}=e;return{operation:$.UPDATE_PREVIEW,theme:e.theme,commonStyles:vp(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 _p=N("DefaultCommonStyles");function ea(e){return e.getOrCreateInstance(_p,()=>ve(void 0))}function wp(e,t){ea(e).set(t)}function Sp(e){const t=ne(e),n=e.getInstance(ee),r=e.getInstance(te),i=De(e);let o,s="";const a=()=>{const _=n?.get()??{},A=Ep({config:_,emailCommonStyles:i.current()?.get().attributes?.common_styles,defaultCommonStyles:o,theme:bp(),codeMode:yp(),appName:"useblocks"}),I=JSON.stringify(A);I!==s&&(s=I,t.send(A))},l=t.onInit(()=>{s="",a()}),u=()=>{t.isInited()&&a()},d=n?.watch(u),p=ea(e).watch(_=>{o=_,u()}),b=r?.watch(_=>{_&&"commonStyles"in _&&(o=_.commonStyles),u()});let v;const S=()=>{v?.(),v=i.current()?.subscribe(u),u()};S();const E=i.subscribe(S),h=matchMedia(Bl),w=()=>u();h.addEventListener("change",w),e.getInstance(H)?.addDispose(()=>{l.dispose(),d?.dispose(),p.dispose(),b?.dispose(),v?.(),E(),h.removeEventListener("change",w)})}var nr;(function(e){function t(i,o,s=(a,l)=>a===l){if(i===o)return!0;if(i.length!==o.length)return!1;for(let a=0;a<i.length;a++)if(!s(i[a],o[a]))return!1;return!0}e.isEqual=t;function n(i,o=s=>s){const s=new Set;return i.filter(a=>{const l=o(a);return s.has(l)?!1:(s.add(l),!0)})}e.unique=n;function r(i=[],o=[],s=(a,l)=>a===l){const a=[],l=[],u=[];for(const d of i){const p=o.find(b=>s(d,b));p?u.push({prev:d,next:p}):l.push(d)}for(const d of o)i.find(p=>s(d,p))||a.push(d);return{added:a,removed:l,exists:u}}e.diff=r})(nr||(nr={}));function Ip(e,t){return e.type===t.type&&e.key===t.key}function Cp(e){const t=ne(e),n=()=>e.getServices(Ye)??[];let r=[];const i=t.onInit(()=>{r=n(),t.send($.SANDBOX_ADD_EXTENSIONS,r)}),o=bl(Ye),s=e.onInject(a=>{if(a!==o)return;const l=n();if(!t.isInited()){r=l;return}const{added:u,removed:d}=nr.diff(r,l,Ip);if(r=l,d.length){if(d.some(p=>p.type==="script")){t.send($.RELOAD);return}t.send($.SANDBOX_REMOVE_EXTENSIONS,d.map(p=>p.key))}u.length&&t.send($.SANDBOX_ADD_EXTENSIONS,u)});e.getInstance(H)?.addDispose(()=>{i.dispose(),s?.dispose()})}var Tp=new Set([...Object.values($).map(e=>String(e)),"INIT_MESSAGE","FETCH_USER","USER_LOGGED_IN",String(wr)]);function Ap(e){return e.length>0&&!e.startsWith("em:")&&!Tp.has(e)}function Rp(e){const t=ne(e),n=new Map;let r=!1,i=-1,o=new Set;const s=u=>(u!==i&&(i=u,o=new Set),o),a=t.observeOutgoing((u,d)=>{if(!r||!Ap(u))return;const p=me(t);n.set(u,{data:d,generation:p,scripts:new Set(s(p))})}),l=t.addListener(wr,u=>{if(u.phase!=="ready"||u.status!=="success")return;r=!0;const d=me(t),p=s(d);p.add(u.key);for(const[b,v]of n)v.generation===d||![...v.scripts].every(S=>p.has(S))||(v.generation=d,t.send(xo(b),v.data))});e.getInstance(H)?.addDispose(()=>{a.dispose(),l.dispose()})}var Pp=N("prewarm.editorVisible");function Dp(e){if(typeof requestAnimationFrame!="function"){setTimeout(e,0);return}requestAnimationFrame(()=>requestAnimationFrame(e))}function Op(e={}){const t=e.paint??Dp;let n=!1,r=!1,i=!1,o=!1,s=!1;const a=[],l=()=>{s||o||!n||!r||!i||(o=!0,t(()=>{s=!0,K(re.editorVisible);for(const u of a.splice(0))u()}))};return{noteShellVisible(){n=!0,l()},notePagePainted(){r=!0,l()},noteContentShown(){i=!0,l()},whenVisible(u){if(s){u();return}a.push(u)},contentShown:()=>i}}function xp(e){return e.getOrCreateInstance(Pp,()=>Op())}var Mp=500,Lp=500,kp=5e3;function Np(e){const t=e.quietMs??Mp,n=e.floorMs??Lp,r=e.ceilingMs??kp;let i,o,s=0;const a=()=>{clearTimeout(i),clearTimeout(o),i=void 0,o=void 0},l=()=>{a(),e.run()},u=()=>{clearTimeout(i);const d=n-(Date.now()-s);i=setTimeout(l,Math.max(t,d))};return{start(){a(),s=Date.now(),o=setTimeout(l,r),u()},notify(){i!==void 0&&u()},cancel:a}}function Fp({attributes:e,readContent:t,docId:n,hasSession:r,serverId:i,show:o}){if(!r)return;const s={id:i??void 0,renderGuid:n,showId:o?.id,isNew:i==null,showToken:o?.token},a={...e,...s};return Object.defineProperty(a,"html",{get:()=>t()??"",enumerable:!0,configurable:!0}),a}var ta="self-init:";function jp(e){return e.startsWith(ta)}function na(e,t){const n=e.getActiveShowRequest();return jp(t)?n===null:n?.showId===t&&e.hasPendingShow(t)}function Bp(e){const t=()=>e.initPipeline(),n=e.messageService,r=()=>e.waitScope?.()??t();let i="";const o=()=>e.readDocument()?rn(e.readDocument()):i,s=()=>Ve(e.container).editorPolicy,a=()=>e.readEmail(),l=()=>{const p=a();return{...p,id:e.isTemplate()||p.isNew?void 0:p.id,html:o()}};let u=!1;const d={readContent:o,publicEmail:l,sendInitStart:()=>ye(n,"INIT_START",$.SANDBOX_INIT_START,{guid:a().renderGuid},void 0,r()),sendInited:()=>ye(n,"INITED",$.SANDBOX_INITED,{guid:a().renderGuid},void 0,r()),async sendContent(){const p=a(),{html:b,hasBrowserExtensionArtifacts:v}=Hs(p?.html||"");v&&e.events.browserExtensionDetected(),$s(e.readDocument(),b),i=b,await ye(n,"SET_ENTITY",$.SANDBOX_SET_ENTITY,on(o(),p.renderGuid,s(),e.readDocument()?.get().version),{guid:p.renderGuid,emailId:p.id??null},r())},refreshContent:()=>ye(n,"SET_ENTITY",$.SANDBOX_SET_ENTITY,on(o(),a().renderGuid,s(),e.readDocument()?.get().version),void 0,r()),sendPreheader:async()=>{const p=a();if(p.preheader!==void 0)return ye(n,"PREHEADER",$.SANDBOX_PREHEADER_UPDATE,{value:p.preheader,guid:p.renderGuid,force:!0},void 0,r())},sendSubject:async()=>{const p=a();if(p.subject!==void 0)return ye(n,"SUBJECT",$.SANDBOX_SUBJECT_UPDATE,{value:p.subject,guid:p.renderGuid,force:!0},void 0,r())},revealFilled:()=>e.revealFilled?.()??Promise.resolve(),showFilled:p=>e.showFilled?.(p),readTarget:()=>e.readTarget?.(),fireWillInit:()=>e.events.willInit(l()),fireInit(p,b){if(!na(t(),p)){t().getActiveShowRequest()?.showId;return}const v=a();v.id,v.renderGuid,t().completeShow(p);const S=e.readDocument();_t(S,{is_inited:!0},{source:"system"});const E=()=>{const w=l();b&&(w.reset=!0);const _=e.events.inited(w);return b||(u&&d.fireEmailChanged(),u=!0),_};if(!S||S.isReady())return E();const{docId:h}=S.get();return S.whenReady().then(()=>e.readDocument()?.get().docId===h?E():void 0,()=>{})},fireEmailChanged(){e.events.emailChanged(l())},fireContentChanged(){e.events.contentChanged(o())}};return d}function Up(e){const t=()=>e.initPipeline();let n=!1,r,i,o,s=0,a;const l=Bp({...e,waitScope:()=>({getSandboxTimeoutMs:h=>t().getSandboxTimeoutMs(h),getSandboxReadyTimeoutMs:()=>t().getSandboxReadyTimeoutMs(),signal:a?.signal??t().signal})});let u;const d=(h,w)=>{if(u===h)return;u=h;const _=s;setTimeout(()=>{s!==_||t().signal.aborted||S(h,w).catch(()=>{})},0)},p=()=>{a?.abort(),a=void 0};let b;const v=()=>{const h=t().signal;h!==b&&(b?.removeEventListener("abort",p),b=h,h.addEventListener("abort",p))};async function S(h,w){const _=++s;p(),a=new AbortController,v();const A=()=>s!==_,I=l.readTarget(),x=t().generation,y=()=>x===t().generation&&!t().signal.aborted,C=w?"init:reset-":"init:";if(!w){const c=l.publicEmail();c?.id,c?.renderGuid,c?.preheader}let R=!1,m=!1;try{n=!0,await l.sendInitStart(),l.fireWillInit(),await(w?l.refreshContent():l.sendContent()),R=!0,w||l.publicEmail()?.id;try{await l.sendPreheader()}catch(c){`${C}`,String(c)}try{await l.sendSubject()}catch(c){`${C}`,String(c)}if(A()||l.showFilled(I),await l.sendInited(),m=!0,i===h){const c=e.readSandboxGeneration?.()??o;c!==void 0&&(r=c)}await l.revealFilled()}catch(c){throw A()||(`${C}`,{...e.describeSurface?.(),error:String(c)},void 0),!(!A()&&e.recoverFailedFill?.(I)===!0)&&!A()&&na(t(),h)&&t().failShow(h,c),c}finally{E(h,w,C,{superseded:A(),sessionGeneration:x,contentApplied:R,sandboxInitedAcked:m,commit:y()})}}function E(h,w,_,A){const{superseded:I,contentApplied:x,sandboxInitedAcked:y}=A;if(I){`${_}`;return}y&&A.commit?l.fireInit(h,w||void 0):y?(`${_}`,A.sessionGeneration,t().generation,t().signal.aborted,void 0):x?(`${_}`,void 0):(`${_}`,void 0),n=!1,a=void 0,!y&&i===h&&(i=void 0,r===o&&(r=void 0)),!y&&x&&d(h,w)}return{channel:l,isEventsLocked:()=>n,filledGeneration:()=>r,markFilled:h=>{r=h},lastCorrelation:()=>i,markCorrelation:h=>{i=h},bumpRunSeq:()=>{s+=1},noteSandboxGeneration:h=>{o=h},fill:h=>S(h,!1),refill:h=>S(h,!0),stop:()=>{s+=1,p(),n=!1,b?.removeEventListener("abort",p),b=void 0}}}function Hp(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:ra(e,n)}function ra(e,t){return t?e?.id==null?!1:String(e.id)===String(t):!0}function $p(e){const{pipeline:t,readEmail:n,readDocument:r,readRouteEmailId:i,readSandboxGeneration:o}=e,s=d=>{const p=n(),b=i();if(!Hp(p,d,b)){d.showId,d.navId,d.emailId,p?.id,p?.showId,p?.renderGuid;return}d.showId,p?.id,p?.renderGuid,t.markFilled(o()),t.markCorrelation(d.showId),t.fill(d.showId).catch(()=>{})};return{showRequested:d=>{s(d)},showRequestIdentityChanged:()=>{const d=e.initPipeline().getActiveShowRequest();d&&s(d)},selfInitChanged:()=>{if(e.initPipeline().getActiveShowRequest())return;const d=o();if(t.filledGeneration()===d)return;const p=n(),b=i();if(!p?.renderGuid||!ra(p,b))return;const v=`${ta}${p.renderGuid}`;t.markFilled(d),t.markCorrelation(v);const S=r()?.isReady()===!0;p.id,p.renderGuid,(S?E=>t.refill(E):E=>t.fill(E))(v).catch(()=>{t.lastCorrelation()===v&&t.markFilled(void 0)})},saasChanged:()=>{const d=n();d?.renderGuid,d?.showToken,d?.id,r()}}}function Vp(e){return e??""}function qp(e,t,n,r){return[e??"",t??"",n==null?"":String(n),r??""].join("|")}function Gp(e){return e.length>0}function zp(e){const t=De(e),n=ne(e),r=()=>ge(t.sessionKey())?void 0:t.current(),i=()=>{const M=r();return Fp({attributes:M?.get().attributes??{},readContent:()=>M?.getContent(),docId:M?.get().docId,hasSession:!!M,serverId:M?.get().serverId,show:t.showFacts()})},o=()=>e.getInstance(we)??qr;let s={},a=!1;const l=e.getInstance(te)?.watch(M=>{a=!!M?.element});let u=!1,d=!1,p=!1,b=0;const v=()=>{const M=pe(e);if(!M)return;const q=++b,U=M.spare();return U&&dp(e,U.element),(U?U.reloadQuietly():M.ensureSpare()?.ready())?.then(()=>{if(q!==b)return;u=!0;const de=M.spare();de&&up(e,de.element),p&&(p=!1,f(),V())})},S=Np({run:()=>{p||v()?.catch(()=>{})}}),E=()=>{xp(e).noteContentShown(),!u&&!p&&S.start()};let h=!1;const w=M=>{const q=pe(e),U=q?.spare()?.element.contentWindow;d&&q&&U&&M===U&&(d=!1,q.promote(),q.busy(!1),h=!0)};let _=!1;const x=Up({container:e,messageService:n,initPipeline:o,readDocument:r,readEmail:i,revealFilled:()=>{const M=pe(e);return h&&M&&(h=!1,S.start()),a?M?.current("email").whenShown()??Promise.resolve():Promise.resolve()},showFilled:w,recoverFailedFill:M=>{const q=pe(e),U=q?.spare()?.element.contentWindow;return!d||!q||!U||M!==U?!1:(d=!1,u=!1,c="reload",q.busy(!1),q.peek("email")?.reload(),_=!0,V(),!0)},readTarget:()=>n.getTarget(),isTemplate:()=>!!s.isTemplate,readSandboxGeneration:()=>me(n),describeSurface:()=>({canvasPath:c,promoted:d,spareClean:u,handshake:n.isInited(),generation:me(n)}),events:{willInit:M=>{ae(e,F.WILL_EMAIL_INIT_ID).fire(M)},inited:M=>{E(),ae(e,F.ON_EMAIL_INIT_ID).fire(M)},contentChanged:M=>{ae(e,F.ON_CONTENT_CHANGED_ID).fire(M)},emailChanged:M=>{ae(e,F.ON_EMAIL_CHANGED_ID).fire(M)},browserExtensionDetected:()=>{ae(e,F.ON_BROWSER_EXTENSION_DETECTED_ID).fire()}}}),y=$p({pipeline:x,initPipeline:o,readEmail:i,readDocument:r,readRouteEmailId:()=>s.emailId,readSandboxGeneration:()=>me(n)});let C="",R="",m="",c="none";const f=()=>{const M=pe(e)?.spare();M&&(n.sendNow({operation:$.SANDBOX_LOCK_EDIT,data:!0}),u=!1,d=!0,cp(e,M.element))},g=(M,q)=>{const U=pe(e);if(!U)return!0;const de=U.spare(),Ne=de&&u?"spare":"prepare";if(c=Ne,U.busy(!0),de&&u)return f(),!0;S.cancel(),n.sendNow({operation:$.SANDBOX_LOCK_EDIT,data:!0});const qe=v();if(qe===void 0)return c="reload",U.busy(!1),U.peek("email")?.reload(),!0;p=!0;const Ge=b;return qe.catch(()=>{!p||Ge!==b||(p=!1,c="reload",U.busy(!1),U.peek("email")?.reload())}),!1},P=()=>{ke(),x.noteSandboxGeneration(me(n));const M=i(),q=qp(M?.renderGuid,M?.showId,M?.id,s.emailId),U=Vp(M?.renderGuid);if(U!==R){const qe=Gp(R),Ge=R;R=U,qe&&g(Ge,U)}if(p)return;(q!==C||_)&&(_=!1,C=q,y.showRequestIdentityChanged());const de=r(),Ne=`${q}|${de?.get().docId??""}|${me(n)}`;Ne!==m&&de?.isReady()===!0&&(m=Ne,y.selfInitChanged()),y.saasChanged(),xe()};let D=!1,B="",T="",O=!1,L=!1;const ie=M=>{M.source==="user"?L=!0:(r()?.isReady()===!1||t.forcedHeaders()!==void 0)&&(O=!0),V()},xe=()=>{const M=i();if(!M?.renderGuid)return;const q=x.channel.readContent(),U=JSON.stringify([M.preheader,M.common_styles,M.meta,M.subject,M.utm_parameters?.utm_campaign??"",M.utm_parameters?.utm_content??"",M.utm_parameters?.utm_medium??"",M.utm_parameters?.utm_source??"",M.utm_parameters?.utm_term??""]),de=D&&q!==T,Ne=D&&U!==B;D=!0,T=q,B=U;const qe=O&&!L;if(O=!1,L=!1,x.isEventsLocked()||qe)return;const Ge={...M,id:s.isTemplate||M.isNew?void 0:M.id,html:q};if(de){ae(e,F.ON_CONTENT_CHANGED_ID).fire(q),ae(e,F.ON_EMAIL_CHANGED_ID).fire(Ge);return}Ne&&M.is_inited&&ae(e,F.ON_EMAIL_CHANGED_ID).fire(Ge)};let k=!1;const V=()=>{k||(k=!0,queueMicrotask(()=>{k=!1,P()}))};e.inject(Gr,{pipeline:x,setRoute:M=>{M.emailId===s.emailId&&!!M.isTemplate==!!s.isTemplate||(s=M,V())}});let Y,X;const Q=()=>{const M=r()?.get().docId;M!==X&&(Y?.(),X=M,Y=r()?.subscribe(ie)),V()};let Me,Le;const ke=()=>{const M=e.getInstance(we);!M||M===Me||(Le?.(),Me=M,Le=M.onShowRequested(q=>y.showRequested(q)))},Ce=n.addListener(M=>{M.data?.operation===$.SANDBOX_RESIZED&&S.notify()}),Nt=t.subscribe(Q),yn=Ns(n,V);Q(),e.getInstance(H)?.addDispose(()=>{l?.dispose(),Le?.(),yn(),Nt(),Y?.(),Ce.dispose(),S.cancel(),x.stop()})}function Wp(){return Ml!=="useblocks"}var ia={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},Kp={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}},Li=ia,Yp=["freeUserBlocks","blocks"],rr={};function Xp(e){rr=e}var oa=e=>Yp.includes(e)?Li:rr[e]??rr.editor??Li,ir={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},Jp={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},Qp={...ir,config:{...ir.config,imageCenterFileManagerView:!1}};Xp({pro:Kp,editor:Jp,simple:Wp()?ir:Qp,blocks:ia});var sa=N("CodeMode");function aa(){let e;try{const t=window.localStorage?.getItem(Dt.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 Zp(e){try{window.localStorage?.setItem(Dt.em_code_mode_settings,JSON.stringify({isCodeMode:e.isCodeMode,codeModeDirection:e.direction}))}catch{}}function la(e){return e.getOrCreateInstance(sa,()=>{const t=ve(aa());return t.watch(Zp),t})}function ca(e){return e?.getInstance(sa)?.get()??aa()}function or(e,t){const n=la(e);n.get().isCodeMode!==t&&n.set({...n.get(),isCodeMode:t})}function eh(e,t){const n=la(e);n.set({...n.get(),direction:t})}function th(e,t,n=e.getInstance(ee)){n?.setMode(t),n?.get()?.codeEnabled===!1&&ca(e).isCodeMode&&or(e,!1)}function nh(e){e.getInstance(Ol)||e.inject(Se,void 0)}function hn(e){return String(e.standaloneKey||"").trim()||void 0}function rh(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function zr(e){return rh(e)?!!hn(e):!1}function Ot(e){return!!hn(e)&&!zr(e)}var ih=["backendProxy","backendProxyPolicy","resourceProxy","resourceProxyPolicy"];function ki(e){return e==="server"?"serverSide":e}function oh({env:e,base:t={},budgetMs:n}){const r={base:t,profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}},i=ve();let o={kind:"pending"},s;const a=new Promise(b=>{s=b}),l=n===void 0?void 0:setTimeout(()=>{d({kind:"absent",reason:`серверный слой не пришёл за ${n} мс`})},n);function u(){o.kind!=="pending"&&i.set(Tn(r,e))}function d(b){if(o.kind!=="pending")return;clearTimeout(l),o=b;const v=Tn(r,e);i.set(v),s(v)}function p(b,v){r[ki(b)]=v,b==="server"&&o.kind==="pending"?d({kind:"applied"}):u()}return{watch:b=>i.watch(b),select:b=>i.select(b),get:()=>i.get(),ready:()=>a,state:()=>o,layers:()=>({...r}),bootstrap(){const b=Tn(r,e);return Object.fromEntries(ih.map(v=>[v,b[v]]))},merge(b,v){p(v,{...r[ki(v)],...b})},replace(b,v){p(v,b)},setMode(b){r.user={...r.user,mode:b},u()},setAdvancedConfigs(b){r.advancedConfigs=b,u()},serverAbsent(b){d({kind:"absent",reason:b})},applyServerResponse(b){o.kind==="pending"&&p("server",{...r.serverSide,...b})},dispose(){clearTimeout(l)}}}var sh=5e3,ah="blocks";function lh(){return{...oa(ah)?.config,mergeTags:void 0}}function ch(e,t){e.getInstance(te)?.watch(n=>{t.setAdvancedConfigs({...n.advancedConfigs,...n.config?.advancedConfigs}),t.replace(n.config??{},"user")})}function uh(e,t){let n;jr(e).watch(({profile:r})=>{const i=`${r?.theme??""}|${r?.locale??""}`;if(i===n)return;n=i;const o={};r?.theme&&(o.theme=r.theme),r?.locale&&(o.locale=r.locale),t.replace(o,"profile")})}function dh(e){if(!(!e||typeof e!="string"))return e==="simple"?"pro":e}function fh(e,t){let n,r=!1,i;const o=a=>{i??=pn(t.layers(),localStorage.getItem("configSwither")||void 0),t.get()?.mode!==a&&th(e,a,t)},s=jr(e).watch(({profile:a})=>{const l=a?.email_builder_config,u=dh(l);if(u===void 0||l===n)return;const d=n===void 0;n=l,!(d&&r)&&o(u)});e.getInstance(H)?.addDisposable(s),t.ready().then(a=>{if(!a.configSwither)return;const l=localStorage.getItem("configSwither")||(n===void 0?a.mode:i)||"editor";localStorage.setItem("configSwither",l),r=n===void 0,o(l)})}var Ni="замкнутый контур: app_init не выполняется";function ph(e,t){if(e.getInstance(Se)){t.serverAbsent(Ni);return}const n=e.getInstance(te)?.watch(r=>{Ot(r)&&t.serverAbsent(Ni)});n&&e.getInstance(H)?.addDisposable(n)}async function hh(e,t){if(e.getInstance(Pr)===void 0){t.serverAbsent("app_init не зарегистрирован");return}try{const n=await e.getInstanceAsync(Re);t.applyServerResponse(n?.app_config??{})}catch(n){t.serverAbsent(`app_init не выполнился: ${String(n)}`)}}function mh(e){e.injectFactory(ee,(t,n)=>{if(n)return n;const r=oh({base:lh(),env:{modeDefaults:i=>oa(i)?.config||{},fallbackMode:localStorage.getItem("configSwither")||void 0},budgetMs:sh});return ch(e,r),uh(e,r),fh(e,r),ph(e,r),hh(e,r),e.getInstance(H)?.addDisposable(r),r},!0)}var Ze=class extends Z{_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=pl(e);return(i,o,s)=>{const a=r(async l=>{const u=t?t(l):l;s&&i.bind(s);const d=await i(u);return n?n(d):d},o,s);return()=>a.dispose()}}var gh=class{deps;handleDestroy;constructor(e){this.deps=e;const t=new zn;this.handleDestroy=j(t.event),e.lifetime.addDispose(()=>t.fire(e.getInstance()));const n=e.lifetime.addDisposable(new Ze(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{}}},Wr=N("DestroyableService");function vh(e){e.injectFactory(Wr,(t,n)=>{if(n)return n;const r=e.getInstance(H);if(!r)throw new Error("[plugin] время жизни экземпляра не зарегистрировано");return new gh({lifetime:r,options:e.getInstance(te),getInstance:()=>e.getInstance(fn),release:()=>Nl(e.getInstance(Ll)??e)})},!0)}function bh(e){const t=e.getInstance(Wr);if(!t)throw new Error("[plugin] provideDestroyable не выполнен до сборки поверхности");return{handleDestroy:t.handleDestroy,destroy:()=>t.destroy()}}var yh=1e3;function ua(e,t,n=yh,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 i=Object.keys(e),o=Object.keys(t);if(i.length!==o.length)return!1;for(const s of i)if(!ua(e[s],t[s],n,r+1))return!1;return!0}return!1}function vt(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 i=t[r],o=e[r];ua(i,o)||(n[r]=i)}return n}var Eh=({source:e,emailtags:t,group:n,tags:r,...i})=>i;async function _h(e,t){try{return{id:(await t(await e)).id}}catch{return}}async function wh({emails:e,saveTimeoutMs:t},n,r){const i=t?.()??xr();let o;try{const s=e.notifySave(n);return await Promise.race([s,new Promise((a,l)=>{o=setTimeout(()=>{const u=new Mr(i);n.value.id,ru(u,_h(s,r)),l(u)},i)})])}catch(s){throw is(s),s}finally{o!==void 0&&clearTimeout(o)}}function Sh(e){const{emails:t}=e,n=async(r,i)=>{const o=Eh(i),s=r===void 0?void 0:await t.cache.getIfPresent(r),a=s?{...s,...o}:o,l=s?vt(s,o):o,u=d=>{const p=String(d.id??r??Ee()),b=d.id===void 0?{...d,id:p}:d;return t.cache.addOrUpdate(p,()=>b)};return await u(await wh(e,{prev:s,patch:l,value:a,source:i.source??""},u))};return{async readEmail(r){return await t.get(r)??null},async createEmail(r){const i=await n(void 0,r);return i?.renderGuid?i:{...i,renderGuid:Ee()}},async updateEmail(r,i){return await n(r,i)}}}var An=20;function Ih(e){const t=Ch(e);return e.saveTimeoutMs?Th(t,e.saveTimeoutMs):t}function Ch({revisions:e,revisionsByEmail:t,readAutosave:n,savedAt:r,emailAuthor:i,integratorProject:o}){const s=async(a,l)=>(t.clear(),await t.get(a,{page:l}),(await e.cache.values()??[]).filter(u=>String(u?.parent)===String(a)));return{async readRevisions(a,l=1){const u=await s(a,l);return{revisions:u.slice(An*(l-1),An*l),page:l,hasMore:u.length>An*l}},async readAutosave(a){const l=await r?.(a)??NaN,u=Number.isFinite(l)?l:void 0,d=await n?.(a);if(!d?.asked)return fu(await s(a,1),u);if(!d.revision)return bi([],u);const p={...d.revision,parent:a,isAutosave:!0};return bi([p],u,await s(a,1))},async saveAutosave(a,l){const u=await i?.(a),d=o?.();return await e.create({...bu(l),...u!==void 0?{author:u}:{},...d!==void 0?{project:d}:{},parent:a,isAutosave:!0,modified:new Date().toString()})}}}function Th(e,t){return{...e,async saveAutosave(n,r){const i=t();let o;try{return await Promise.race([e.saveAutosave(n,r),new Promise((s,a)=>{o=setTimeout(()=>a(new es(i)),i)})])}catch(s){throw is(s),s}finally{o!==void 0&&clearTimeout(o)}}}}var Ah=class extends Kl{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}},Rh=class extends Ae{};var Fi=class extends Z{_items=new Map;_onChangeEmitter=new ul;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 i=await t(n);return Ie(n,i)||this._onChangeEmitter.fire(),i}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(([i,o])=>i)),r=(await this.entries()).filter(([i,o])=>!n.has(i));for(const[i,o]of e)t.push(this.addOrUpdate(i,()=>o)),n.add(i);for(const[i]of r)t.push(this.remove(i));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 Ph(e,{filter:t,order:n="asc",orderBy:r,page:i,pageSize:o=20}={}){const s=e.length;let a=e.length;if(t!==void 0){const l=Object.keys(t);e=e.filter(u=>{for(const d of l){const p=u[d],b=t[d];return d==="id"||typeof p!="string"?p===b:typeof b=="string"&&p.startsWith(b)}return!0}),a=e.length}return r&&(e=e.sort((l,u)=>(l[r]>u[r]?1:u[r]>l[r]?-1:0)*(n==="asc"?1:-1))),i!==void 0&&(e=e.slice(o*(i-1),o*i)),{data:e,filteredTotal:a,total:s,totalPages:Math.ceil(a/o)}}function Dh(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 i=t.get(r.id)||{};t.set(r.id,{...i,...r})}return[...t].map(([n,r])=>r)}function Oh(e,t){return ji(e)&&ji(t)?String(e)===String(t):e===t}function ji(e){return typeof e=="string"||typeof e=="number"}var xh=class extends Z{_cache=new Fi;_readEmitter=new Ae;_saveEmitter=this.addDisposable(new Ah);_removeEmitter=this.addDisposable(new Rh);_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 Z);n.addDispose(()=>delete this._foreignCache[e]);const r=n.addDisposable(new Fi),i=n.addDisposable(new Ae);t=this._foreignCache[e]={get:async(o,s={})=>{await r.getOrCreate(o,async()=>{try{const l=Dh(await i.fire(o))||[];for(const u of l)u[e]=o,await this._cache.add(u.id,u);return l}catch{return[]}});const a=(await this._cache.values()||[]).filter(l=>{const u=l[e];return u==null||Oh(u,o)});return Ph(a,s)},first(o,s={}){return t.get(o,{...s,page:1,pageSize:1}).then(({data:a})=>a[0])},handleRead:i.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=Ee()),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 i=>{const o=i?{...i,...t}:t;if(!r)return t=i?vt(i,t):t,await this._saveEmitter.fire({prev:i,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 xt(e){const t=N(e);return n=>n.getOrCreateInstance(t,()=>new xh)}function da(e){const t=e.getInstance(H);if(!t)throw new Error("Failed");return t}function Bi(e){return Object.prototype.hasOwnProperty.call(e,"meta")}function Rn(e,t){const n={...e};return t===void 0?(delete n.meta,n):(n.meta={...e.meta??{},...t},n)}function Mh(e,t,n){return e&&!Bi(t)&&Bi(e)?{...n,meta:e.meta}:n}var Lh=N("CurrentProject"),kh={};function Mt(e){return e?.getInstance(Lh)?.get()??kh}function Kr(e){const t=Mt(e).card?.id,n=Number(t);return t!=null&&t!==""&&Number.isFinite(n)?n:void 0}var fa=xt("plugin.dataSource.emails"),pa=xt("plugin.dataSource.emailRevisions"),ha=Vr("plugin.readEmailAutosave"),Ui=N("emailDocuments.provided");function Nh(e){const t=fa(e),n=pa(e),r=n.byForeignKey("parent");if(e.getInstance(Ui))return{emails:t,emailRevisions:n};e.inject(Ui,!0);const i=()=>xr(e.getInstance(we)?.contentReadyTimeoutMs),o=Sh({emails:t,saveTimeoutMs:i}),s=new Map,a=(l,u)=>d=>{const p=d?.id??u;return(typeof p=="string"||typeof p=="number")&&s.set(String(p),l),d};return Hu(e,{...o,createEmail:l=>o.createEmail(l).then(a(Date.now())),updateEmail:(l,u)=>o.updateEmail(l,u).then(a(Date.now(),l))}),Gu(e,Ih({revisions:n,revisionsByEmail:r,readAutosave:async l=>{const u=await ae(e,ha).fire(l);return u.length===0?{asked:!1}:{asked:!0,revision:u[0]??null}},savedAt:async l=>{const u=uu((await t.cache.getIfPresent(l))?.modified),d=s.get(String(l))??NaN;return Number.isFinite(d)&&!(u>=d)?d:u},emailAuthor:async l=>(await t.cache.getIfPresent(l))?.author,saveTimeoutMs:i,integratorProject:()=>Mt(e).requested})),da(e).addDisposable(t.onSave(({prev:l,patch:u,value:d})=>Mh(l,u,d),Number.MIN_VALUE)),{emails:t,emailRevisions:n}}function Hi(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 Fh(e){try{return localStorage.getItem(e)===null?!1:(localStorage.removeItem(e),!0)}catch{return!1}}var jh="po",Gt=null;function Bh(){const e=typeof window.__useblocks__<"u"?window.__useblocks__?.require:void 0;return typeof e!="function"?Promise.reject(new Error("[loadPoParser] AMD loader is unavailable")):new Promise((t,n)=>{e([jh],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadPoParser] Failed to require po module")))})}function Uh(){return Gt===null&&(Gt=Bh().catch(e=>{throw Gt=null,e})),Gt}async function ma(e){if(typeof e=="object")return Yr(e);if(typeof e!="string")return;const t=e.trim();if(t)return t.startsWith("{")||t.startsWith("[")?Hh(t):$h(t)}function Yr(e){if(!(e==null||typeof e!="object"||Array.isArray(e)))return e}function Hh(e){try{return Yr(JSON.parse(e))}catch{return}}var $i=!1;async function $h(e){try{return Yr((await Uh()).parsePoCatalog(e))}catch{$i||($i=!0);return}}var Vh="em_locale",qh="em_ant_locale",Gh="locale",zh="ant_locale";function Xr(e){try{return JSON.parse(localStorage.getItem(e)||"")}catch{return null}}function ga(e,t){const n=Xr(e);if(!n)return null;try{localStorage.removeItem(e),localStorage.setItem(t,JSON.stringify(n))}catch{}return n}function Wh(){return Xr("em_locale")??ga(Gh,"em_locale")}function Vi(e){try{localStorage.setItem(Vh,JSON.stringify(e))}catch{}}function Kh(){return Xr("em_ant_locale")??ga(zh,"em_ant_locale")}function Yh(e,t){try{localStorage.setItem(qh,JSON.stringify({id:e,data:t}))}catch{}}var Xh=8e3;function Jh(e,t){const n=e,r=t,i=Object.keys(n).filter(o=>o!=="");return i.length!==Object.keys(r).filter(o=>o!=="").length?!1:i.every(o=>JSON.stringify(n[o])===JSON.stringify(r[o]))}function Qh(e){const t=Wh(),n=Kh();let r={ready:!1},i;const o=ve(r);let s=0;const a=h=>{r={...r,...h},o.set(r)},l=()=>{r.ready||a({ready:!0})},u=setTimeout(l,e.unlockAfterMs??Xh),d=h=>h!==s;let p;async function b(h,w){if(n?.id===h&&n.data&&a({antd:n.data}),!p)return;const _=await p(h).catch(()=>{});!_||d(w)||(a({antd:_}),Yh(h,_))}async function v(h,w){const _=await e.askHost(h).catch(()=>null);if(d(w))return!0;if(_==null)return!1;const A=await ma(_);return d(w)||(A&&a({catalog:A}),l()),!0}async function S(h,w){const _=await e.readList();if(d(w))return;if("error"in _){a({failure:{kind:"GET_LOCALES_ERROR",error:_.error}}),l();return}const A=_.data.find(x=>x.locale===h);if(!A){Fh("em_locale")&&a({catalog:void 0}),l();return}if(Hi(t,A)&&(!i||i.catalog===t?.data)){l();return}if(i?.entry&&r.catalog===i.catalog&&Hi(i.entry,A)){Vi(i.entry),l();return}const I=await e.readCatalog(h);if(!d(w)){if("error"in I){a({failure:{kind:"GET_LOCALE_ERROR",error:I.error}}),l();return}I.data&&(i?.id===h&&r.catalog===i.catalog&&Jh(i.catalog,I.data)||a({catalog:I.data}),Vi({id:h,time:A.updatedAt||Math.floor(Date.now()/1e3),hash:A.contentHash,data:I.data})),l()}}async function E(h,w){if(!await v(h,w)){if(!d(w)&&(i?.id===h&&r.catalog===i.catalog||h==="en_US")&&l(),e.canUseNetwork&&!e.canUseNetwork()){l();return}await S(h,w)}}return{set(h){if(!h||h===r.id)return;const w=s+=1;a({id:h,failure:void 0});const _=i?.id===h&&r.catalog===i.catalog;(i&&!_&&r.catalog===i.catalog||h==="en_US"&&r.catalog)&&a({catalog:void 0}),t?.id===h&&t.data&&(a({catalog:t.data}),l()),b(h,w),E(h,w)},prime(h,w,_){r.id&&r.id!==h||r.catalog||!w||(i=t?.id===h&&t.data&&(!_||t.time>=_.time)?{id:h,catalog:t.data}:{id:h,catalog:w,entry:_?{id:h,time:_.time,hash:_.hash,data:w}:void 0},a({catalog:i.catalog}))},useAntdLoader(h){p=h,r.id&&b(r.id,s)},state:o,snapshot:()=>r,dispose:()=>clearTimeout(u)}}var Zh=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})},em=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:i,format:o,baseUrl:s,cancelToken:a,...l})=>{const u=(typeof t=="boolean"?t:this.baseApiParams.secure)&&this.securityWorker&&await this.securityWorker(this.securityData)||{},d=this.mergeRequestParams(l,u),p=i&&this.toQueryString(i),b=this.contentFormatters[r||"application/json"],v=o||d.format;return this.customFetch(`${s||this.baseUrl||""}${n}${p?`?${p}`:""}`,{...d,headers:{...d.headers||{},...r&&r!=="multipart/form-data"?{"Content-Type":r}:{}},signal:(a?this.createAbortSignal(a):d.signal)||null,body:typeof e>"u"||e===null?null:b(e)}).then(async S=>{const E=S;E.data=null,E.error=null;const h=v?S.clone():S,w=v?await h[v]().then(_=>(E.ok?E.data=_:E.error=_,E)).catch(_=>(E.error=_,E)):E;return a&&this.abortControllers.delete(a),w})}},tm=N("rest.v2.transport"),qi=Symbol("rest.v2.secureRequest");function nm(e){return e.getOrCreateInstance(tm,()=>{const t=e.getInstance(_l)?.execute||fetch;return new em({baseUrl:"https://app.useblocks.io/api/v2",securityWorker:()=>({[qi]:!0}),customFetch:(n,r={})=>{const{[qi]:i,...o}=r;return t(n,{...o,[wl]:i!==!0})}})})}function rm(e,t){const n=nm(e);return Object.assign({},...t.map(r=>new r(n)))}function Gi(e,t){if(e!=null&&typeof e=="object"){const n=e[t];if(typeof n=="string"&&n!=="")return n}}function va(e){const t=e.error,n=t?.error;return n&&typeof n=="object"?{status:e.status,data:{code:Gi(n.details,"wp_code")??n.code,message:Gi(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 ba(e){return!e.ok||!!e.error}function im(e){try{const t=localStorage.getItem(e);if(t==="true")return!0;if(t==="false")return!1}catch{}}function ya(){return im(Dt.em_translations_v2)??!0}function om(e){return typeof e=="number"&&Number.isFinite(e)?e:0}function sm(e){const t=e?Date.parse(e):NaN;return Number.isNaN(t)?0:Math.floor(t/1e3)}function am(e){return Array.isArray(e)?e.reduce((t,n)=>{const r=Array.isArray(n)?n:[],i=r[0];return typeof i=="string"&&i!==""&&t.push({locale:i,updatedAt:om(r[1])}),t},[]):[]}function lm(e){return(e?.items??[]).reduce((t,n)=>(n.locale&&t.push({locale:n.locale,updatedAt:sm(n.updated_at),contentHash:n.content_hash}),t),[])}function Ea(e){return rm(e,[Zh])}function an(e){return{error:{status:"FETCH_ERROR",error:e instanceof Error?e.message:"locale request failed"}}}function sr(e){return!e.ok||e.error!=null}function ar(e){const t=e.error;return{error:{status:e.status,data:t?.data??e.error}}}async function Pn(e){return{data:await ma(e)??null}}async function cm(e){if(ya())try{const n=await Ea(e).localesList();return ba(n)?{error:va(n)}:{data:lm(n.data)}}catch(n){return an(n)}const t=Mo(e,[Vo]);try{const n=await t.get_translations2({file:"react_app"});return sr(n)?ar(n):{data:am(n.data)}}catch(n){return an(n)}}async function um(e,t){if(ya())try{const r=await Ea(e).jsonList({locale:t});return ba(r)?{error:va(r)}:Pn(r.data)}catch(r){return an(r)}const n=Mo(e,[Vo]);try{const r=await n.get_translations3({id:t,file:"react_app"});return sr(r)?ar(r):Pn(r.data)}catch{try{const r=await n.get_translations3({id:"en_US",file:"react_app"});return sr(r)?ar(r):Pn(r.data)}catch(r){return an(r)}}}var zt=new WeakMap;function dm(e){const t=zt.get(e);if(t!==void 0)return t;const n=cm(e).then(r=>("error"in r&&zt.delete(e),r),r=>{throw zt.delete(e),r});return zt.set(e,n),n}var wt=N("locale.service");function fm(e){if(e.getInstance(wt))return;const t=Qh({readList:()=>dm(e),readCatalog:n=>um(e,n),askHost:async n=>(await ae(e,F.READ_LOCALE).fire(n))[0],canUseNetwork:()=>!e.getInstance(Se)});e.inject(wt,t),e.getInstance(H)?.addDispose(()=>t.dispose())}function pm(e){const t=e.getInstance(ee);if(!t)return;const n=e.getInstance(wt);if(!n)return;const r=t.select(i=>i.locale).watch(i=>n.set(i||"en_US"));e.getInstance(H)?.addDisposable(r)}var hm="user_id",mm="project_id",zi=N("rest.identityHeadersProvided");function gm(e){if(e.getInstance(zi))return;e.inject(zi,!0);let t;e.getInstance(te)?.watch(n=>{t=n}),e.addService(Er,{execute(n,r){if(r?.public)return;const i=t?.user?.id??Ss(e).profile?.id;i!=null&&i!==""&&n.headers.set(hm,String(i));const o=t?.project;o!=null&&o!==""&&n.headers.set(mm,String(o))}})}function vm(e){if(!e)return!1;try{return e.getInstance(Se)!==void 0}catch{return!1}}var bm="Invalid standaloneKey.",aE=N("StandaloneMockGuard");function ym(){const e=new Error(bm);return e.name="InvalidStandaloneKeyError",e}function Em(e){e.addService(Er,{execute:()=>{if(vm(e))throw ym()}})}function _m(e){Wl(e),Em(e)}function wm(e){const t=new Vs;e.inject(we,t);const n=e.getInstance(te)?.watch(i=>{if(!i)return;const o=i.signal??t.externalSignal;t.configure({replaceSession:!0,...i.timeouts!==void 0?{timeouts:i.timeouts}:{},...o!==void 0?{signal:o}:{}})}),r=e.getInstance(H);n&&r?.addDisposable(n),r?.addDispose(()=>{t.abort()})}var Sm=xt("plugin.dataSource.blocks"),Im=xt("plugin.dataSource.blockRevisions"),Cm=xt("plugin.dataSource.comments"),Tm=Vr(),Am=Vr(),_a=`<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
|
1005
1005
|
<html>
|
|
1006
1006
|
<head>
|
|
1007
1007
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
|
@@ -1042,10 +1042,10 @@ import{t as Bi}from"./static/esm/50fbfdf6.js";import{$ as Ns,A as Fs,At as N,B a
|
|
|
1042
1042
|
</tr>
|
|
1043
1043
|
</table>
|
|
1044
1044
|
</body>
|
|
1045
|
-
</html>`;function
|
|
1045
|
+
</html>`;function Rm(e){return{isNew:!0,is_inited:!1,subject:void 0,preheader:void 0,description:"",html:_a,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 wa=new Set(["email","block","blocks","autosaves","revisions","comments","templateId","reload"]);function Pm(e){return!Object.keys(e).some(t=>wa.has(t))}function Dm(e){const t={},n={};for(const[r,i]of Object.entries(e))wa.has(r)?t[r]=i:n[r]=i;return{showOptions:t,misplacedEmailFields:n}}function Wi(e){const t=e.id;if(!(t===null||typeof t=="string"&&t.trim()===""))return e;const n={...e};return delete n.id,n}function Lt(e){return{emails:fa(e),blocks:Sm(e),emailRevisions:pa(e),blocksRevision:Im(e),comments:Cm(e)}}function Om(e){const t=Object.values(Lt(e));return{suspendChange(){t.forEach(n=>n.suspendChange())},resumeChange(){t.forEach(n=>n.resumeChange())}}}function mn(e,t=!0){if(typeof e=="string")return{email:{code:e}};if(Pm(e))return{email:Wi(e)};{const{showOptions:n,misplacedEmailFields:r}=Dm(e),i=Object.keys(r);t&&i.length>0&&void 0;const o=typeof e.email=="string"?{code:e.email}:e.email;return{...n,email:Wi({...r,...o})}}}function Jr(e){return Br(e)?.current()}function Xt(e){return Jr(e)?.getContent()}function Sa(e,t){const n=t??Rm(),r=Jr(e)?.get();return r?{...n,...r.attributes,id:r.serverId??void 0,isNew:r.serverId===null,html:Xt(e)??n.html}:n}async function Jt(e){return(await e.getInstanceAsync(Re))?.project}async function xm(e){return Kr(e)??await Jt(e)}function Ki(e){if(!e)return;const t=mn(e,!1).email.id;return t==null?void 0:String(t)}function Mm(e,t){return e.ticket===t.ticket?!1:e.emailId===void 0||e.emailId!==t.emailId}function Lm(e){return typeof e=="object"&&e!==null&&"reload"in e&&e.reload===!0}function rt({code:e,project:t,...n},r){const i=Pe(n),o=Kr(r),s=Ve(r);return e&&s.warnAboutUnconfiguredInput(e,n.id),{...i,...e?{html:s.toEditorForm(e)}:{},...o===void 0?{}:{project:o},..."utm_parameters"in i?{utm_parameters:i.utm_parameters||{}}:{},_embedded:void 0}}function oe({html:e,renderGuid:t,showToken:n,showId:r,...i},o){const{requested:s}=Mt(o),a=Ts(o);return Pe({...i,code:Ve(o).toOutputForm(e),project:s===void 0?i.project:s,utm_parameters:a.UTMEnabled?i.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 lr(e){return e==null?"":e.replaceAll(`\r
|
|
1046
1046
|
`,`
|
|
1047
|
-
`)}function ui(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function Hp(e,t,n,r){const i=$p(e,t,n,r);return i===void 0}function $p(e,t,n,r){const{email:i}=Ht(t,!1),o=Ue(i,e),s=o.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const l=or(e)?.current();if(!l)return"no-session";const d=l.get(),u=d.attributes;if(d.serverId!==s)return"document-id";if(u.is_inited!==!0)return"not-inited";const h=ui(Ln(n??l.getContent()));if(o.html!==void 0&&ui(Ln(o.html))!==h)return"html";if(o.subject!==void 0&&o.subject!==u.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==u.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==u.common_styles)return"common_styles"}function fi(e,t){const{email:n}=Ht(t,!1),r=Ue(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:Ln(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Gp(e,t){const n={...e};return delete n.id,{...n,...t}}function qp(e){return e.html?e:{...e,html:as}}function We({code:e,project:t,...n},r,i){const o=i??ls(r);return{...n,...e?{html:Ge(r).toEditorForm(e)}:{},renderGuid:pe(),...o===void 0?{}:{project:o}}}function yt({html:e,renderGuid:t,...n},r){const{requested:i}=Bt(r);return _e({...n,code:Ge(r).toOutputForm(e),project:i===void 0?n.project:i,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 us(e){return or(e)?.current()?.get().serverId??void 0}function kn(e,t,n){return n===void 0&&(n=e.post===void 0?us(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function Et(e,t){return _e({...e,link:void 0,comment_status:void 0})}function At({code:e,autosave:t,...n},r,i){return i===void 0&&(i=n.parent===void 0?us(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0,parent:i}}function pi({html:e,isAutosave:t,...n},r){return _e({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:_e({html:e,ampHtml:e&&""})})}var Nn=N("NotificationService"),zp=N("emailTemplate.reads");async function Vp(e,t){try{return await Ae(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,Wp(e,t,n);return}}var Kp=N("emailTemplate.notifiedFailures");function Wp(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Kp,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(Nn).then(()=>{zn(e,$.ON_NOTIFICATION).fire({type:"error",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Yp(e,t){const n=e.getOrCreateInstance(zp,()=>new Map),r=n.get(t);if(r!==void 0)return r;const i=Vp(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,i),i}var Xp="EXTERNAL";function Jp(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var Qp="email_id",Zp=class extends Q{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_dataSources;_eventLock;_queue=Ea();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=Ut(t),this._eventLock=Fp(t);const n=X(e,$.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(Vn,{execute:(r,i)=>{!i?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(Qp,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(he)??cr}_throwIfDestroyed(){if(this.isDisposed())throw Yn()}async getTemplateEmail(e){const t=await Yp(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 tn(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,We(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,At(i,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,kn(i,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,i){const o=this._dataSources.emails,s=o.cache,l=await tn(this._container),d=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let u=Ue(e,this._container);const h=u.id;let g=h;if(h!==void 0){const E=await o.get(h);u={...E??{},...u,utm_parameters:u.utm_parameters??E?.utm_parameters??{},renderGuid:E?.renderGuid??pe(),...d>0?{showToken:d}:{},...i?{showId:i}:{},project:l}}else{g=n??pe();const E=await o.get(g);u={...u,utm_parameters:u.utm_parameters??{},renderGuid:E?.renderGuid??pe(),...d>0?{showToken:d}:{},...i?{showId:i}:{},project:l},delete u.project}if(t){const E=await this.getTemplateEmail(String(t));E&&(u=Gp(E,u))}return h===void 0&&(u=qp(u)),await s.addOrUpdate(g,()=>u),u}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==fi(this._container,e))return!1;const n=It(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=fi(this._container,e);this._lastShow=t===void 0?void 0:{signature:t,html:It(this._container)??""}}async _show(e,t){if(this._throwIfDestroyed(),t!==void 0&&Bp({ticket:t,emailId:ci(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId})){this._showRequests;return}if(!e)return;const n=this._getInitPipeline();z(n.signal);const r=Up(e);if(!r&&Hp(this._container,e,It(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const i=Ht(e);i.email.id,this._prevCommand?.id;let o,s="",l=0,d=!1,u,h=Promise.resolve(),g,E=!1;try{this._eventLock.suspendChange();const{email:b,blocks:w,autosaves:_,comments:m,templateId:S,reload:y}=i;o=b.id;const I=Ue(b,this._container),T=I.id,R=T??pe(),v=await Xe("getProject",tn(this._container));z(n.signal),s=pe();const f={isNew:T===void 0,id:String(R),project:v},a=y===!0&&T!==void 0;a&&(await this._dataSources.emails.remove(String(T),{silent:!0}),String(T)),l=++this._showToken,String(R);const c=[];c.push(this.setBlocks(w)),b.id!==void 0&&(c.push(this.setComments(m)),c.push(this.setEmailRevisions(_,String(b.id)))),c.push(this.setEmail(b,Number(S),T===void 0?String(R):void 0,l,s)),await Xe("setEmail+blocks+revisions",Promise.all(c),{emailId:T??String(R),showId:s,targetShowToken:l}),z(n.signal);const p=await this._dataSources.emails.get(String(R)),A=we(this._container),x={id:s,token:l};T===void 0?g=A.startNewDraft(p??I,{patch:I,show:x}):a?g=A.reload(T,{email:p??I,patch:I,show:x}):A.sessionKey()===Oe(T)?g=A.show(I,x):g=A.open(T,{email:p??I,patch:I,show:x});const j=!!this._prevCommand&&je(this._prevCommand,f);f.id,!this._prevCommand||je(this._prevCommand,f),this._prevCommand?.id,this._rememberShow(f),h=n.requestShow({showId:s,navId:String(R),emailId:T,isNew:T===void 0}),E=!0,String(R),d=!0}catch(b){u=b,E&&s&&n.failShow(s,b),Gi(b)||(oo(b),void 0)}finally{this._eventLock.resumeChange()}if(!d)throw u instanceof Error?u:new Error(`[useblocks] show() setup failed: ${String(u??"unknown error")}`);return Xe("show-init-deferred",Promise.all([h,g?.whenReady().catch(b=>{if(b instanceof Rt){const w=ho(b);throw w?new Error(`[useblocks] show(): email open failed (${w})`,{cause:b}):b}})??Promise.resolve()]).then(()=>{}),{showId:s,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();z(e.signal);const t=we(this._container),n=await t.save("publish",{source:Xp});if(z(e.signal),!n)throw Jp(t.saveState().error);return re(jp(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=ci(e),this._queuedShow(e,t)};save=this._queue.decorate(this._save,this)};function eh(e){return String(e).replace(/"/g,""")}function th(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 nh(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 hi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=eh(n);return r.test(e)?e.replace(r,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function rh(e,t,n){if(!e?.trim()||!t)return e;const r=nh(e);if(!r)return e;const i=String(t),o=th(n??new Date);let{full:s,index:l}=r;const d=s.length;return/\bem-block-id\s*=/.test(s)||(s=hi(s,"em-block-id",i)),s=hi(s,"em-block-version",o),e.slice(0,l)+s+e.slice(l+d)}function ih(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 oh(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),i=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:i,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:ih(e)}}function nn(e,t){return t?oh(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var fs=["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"],sh=[...fs,"html","id","project","password"],sv=new Set(["html",...fs,"global_block","project"]);function ah(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(sh),r={};for(const i of Object.keys(e))n.has(i)||(r[i]=e[i]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function lh(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...ah(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 Fn=new WeakMap;function dh(e){let t=Fn.get(e);return t||(t={byId:new Map,fallback:[]},Fn.set(e,t)),t}function ch(e){Fn.delete(e)}function uh(e,t){const{byId:n,fallback:r}=dh(t);if(e.blockId){const i=n.get(e.blockId);if(i){n.delete(e.blockId);const o=r.indexOf(i);return o>=0&&r.splice(o,1),i}return}for(let i=r.length-1;i>=0;i--){const o=r[i],s=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(s&&l)return r.splice(i,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function fh(e,t){const{blocks:n}=Ut(e);return await n.cache.getIfPresent(t)??void 0}async function ph(e,t){if(!t.blockId)return;const n=await fh(e,t.blockId);if(n)return lh(n,t)}async function hh(e,t){const n=uh(e,t);if(n)return nn(e,n);const r=await ph(t,e);return r?nn(e,r):nn(e,void 0)}var mh=na("application_block_inserted"),gh=-1e3,mi=new WeakSet;function vh(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 bh(e){if(!e||mi.has(e))return;mi.add(e);const t=new Q,n=ee(e);return t.addDisposable(n.addListenerAsyncPipe(mh,async(r,i)=>{const o=vh(r)?await hh(r,e):r;return i?i(o):o},gh)),t.addDisposable({dispose:()=>{ch(e)}}),t}var gi=100,yh=class extends Q{_container;_events;constructor(e){super(),this._container=e;const t=bh(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:i}=Ut(e),o=X(e,$.ON_SHARE_ID),s=X(e,$.ON_SHOW_PREVIEW_ID),l=X(e,$.ON_EMAIL_CLONE_ID),d=X(e,$.ON_CODE_VALIDATE_ID),u=X(e,$.ON_SUBJECT_CHANGED_ID),h=X(e,$.ON_EMAIL_CHANGED_ID),g=X(e,$.ON_PREHEADER_CHANGED_ID),E=X(e,$.ON_SAVEBUTTON_CLICK_ID),b=X(e,$.ON_NEXTBUTTON_CLICK_ID),w=X(e,$.ON_SEND_LIVEPREVIEW_ID),_=X(e,$.ON_SEND_TESTEMAIL_ID),m=X(e,Op),S=X(e,$.ON_CONTENT_CHANGED_ID),y=X(e,Dp),I=X(e,$.ON_PREVIOUSBUTTON_CLICK_ID),T=X(e,$.ON_SEND_EMAIL_MODAL_ID),R=ea(X(e,$.ON_EMAIL_INIT_ID),v=>!v.reset);return{handlePreheaderChanged:F(g),handleSubjectChanged:F(u),handleValidate:F(d),handleReadEmail:F(n.handlerRead,v=>v,v=>v&&Ue(v,e)),handleSaveEmail:F(n.onSave,function({prev:v,patch:f,value:a,source:c}){const p=v?re(v,e):void 0;return{prev:p,patch:Je(p,re(f,e)),value:re(a,e),source:c}},v=>v?Ue(v,e):void 0),handleRemoveEmail:F(n.onRemove,({value:v,source:f})=>({value:re(v,e),source:f}),()=>{}),handleReadCommonBlocks:F(m,v=>v.project,v=>v?.map(f=>We(f,e))),handleReadTemplateBlocks:F(y,v=>v,v=>v?.map(f=>We(f,e))),handleReadBlocks:F(t.byForeignKey("project").handleRead,v=>Bt(e).requested||String(v),v=>v?.map(f=>We(f,e))),handleSaveBlock:F(t.onSave,function({prev:v,patch:f,value:a,source:c}){const p=a.global_block===!0&&a.id&&typeof a.html=="string"?{...a,html:rh(a.html,String(a.id))}:a,A=v?yt(v,e):void 0;return{prev:A,patch:Je(A,yt(f,e)),value:yt(p,e),source:c}},v=>v?We(v,e):void 0),handleRemoveBlock:F(t.onRemove,({value:v,source:f})=>({value:yt(v,e),source:f}),()=>{}),handleReadComments:F(r.byForeignKey("post").handleRead,v=>v,v=>v?.map(f=>kn(f,e))),handleSaveComment:F(r.onSave,function({prev:v,patch:f,value:a,source:c}){const p=v?Et(v,e):void 0;return{prev:p,patch:Je(p,Et(f,e)),value:Et(a,e),source:c}},v=>v?kn(v,e):void 0),handleRemoveComment:F(r.onRemove,({value:v,source:f})=>({value:Et(v,e),source:f}),()=>{}),handleReadEmailRevisions:F(i.byForeignKey("parent").handleRead,v=>v,v=>v?.map(f=>At(f,e))),handleReadEmailAutosave:F(X(e,es),v=>v,v=>v?At(v,e):null),handleEmailAutosave:F(i.onSave,function({prev:v,patch:f,value:a,source:c}){return{value:pi(a,e),source:c}},v=>v?At(v,e):void 0),handleRemoveEmailAutoSave:F(i.onRemove,({value:v,source:f})=>({value:pi(v,e),source:f}),()=>{}),handleEmailChanged:F(Ir(h,gi),v=>re(v,e)),handleEmailInit:F(R,v=>re(v,e)),handlePreviousButtonClick:F(I,v=>re(v,e)),handleNextButtonClick:F(b,v=>re(v,e)),handleSaveButtonClick:F(E,v=>re(v,e)),handleHtmlChanged:F(Ir(S,gi)),handleTestEmailSend:F(_,({html:v,...f})=>({...f,code:v,compiled:{html:v,ampHtml:""}})),handleTestEmailModal:F(T,v=>re(v,e)),handleCloneEmail:F(l,v=>re(v,e)),handleShareEmail:F(o),handlePreviewEmail:F(s),handleLivePreviewEmail:F(w)}}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 Ne(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},Eh=N("DataController"),_h=N("DataEvents");function ps(e){return e.getOrCreateInstance(Eh,()=>{const t=new Zp(e);return e.getInstance(B)?.addDisposable(t),t})}function hs(e){return e.getOrCreateInstance(_h,()=>new yh(e))}var wh=N("plugin.startupShow");function Sh(e){const t=ps(e),n=hs(e),r=e.getInstance(ne),i=e.getInstance(B),o={current:Promise.resolve()};e.inject(wh,o);const s=r?.watch(d=>{d&&n.setOptions(d),o.current=o.current.catch(()=>{})}),l=r?.select(d=>d?.content).watch(d=>{if(d===void 0)return;W(Z.showStart);const u=t.show(d).finally(()=>W(Z.showEnd));u.catch(()=>{}),o.current=u});s&&i?.addDisposable(s),l&&i?.addDisposable(l)}function Ih(e){const t=ps(e);return{...hs(e).get(),show(n){return W(Z.showStart),t.show(n).finally(()=>W(Z.showEnd))},save(){return t.save()}}}var Ah=[{name:"rest.client",setup:Ap},{name:"auth.oauth",setup:fa},{name:"rest.identityHeaders",setup:Ep},{name:"lifetime.destroyable",provides:[fr],setup:Sf},{name:"appInit",provides:[Fe,Xn],setup:Xa},{name:"config",provides:[ye],setup:_f},{name:"email.documents",setup:Uf},{name:"show.initPipeline",provides:[he],setup:Cp},{name:"show",setup:Sh},{name:"locale.service",provides:[nt],setup:gp},{name:"locale.fromConfig",awaits:{services:[ye,nt]},setup:vp},{name:"canvas.early",setup:fu},{name:"canvas.previewSettings",setup:Eu},{name:"canvas.sandboxExtensions",setup:wu},{name:"canvas.headerSync",provides:[Go],setup:mu},{name:"canvas.ampSync",setup:Dd},{name:"canvas.moduleBridge",setup:tc},{name:"canvas.port",setup:Bd},{name:"canvas.images",setup:Fd},{name:"canvas.edits",setup:Lc},{name:"canvas.blockContent",setup:Rc},{name:"canvas.sandboxFill",provides:[ur],setup:Uu},{name:"canvas.reactions",setup:du}],Ch=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Th(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const i=t.get(r)??[];i.push(n),t.set(r,i)}return t}function Rh(e,t){const n=[];for(const r of e.awaits?.services??[])for(const i of t.get(r)??[])i!==e&&n.push(i);return n}function ms(e){const t=Th(e),n=[],r=new Set,i=[],o=new Set,s=l=>{if(!r.has(l)){if(o.has(l)){const d=i.indexOf(l);throw new Ch([...i.slice(d),l].map(u=>u.name))}o.add(l),i.push(l);for(const d of Rh(l,t))s(d);i.pop(),o.delete(l),r.add(l),n.push(l)}};for(const l of e)s(l);return n}var vi;function mr(e){const t=e.getInstance(ne);if(t)return t;e.getInstance(B)||e.inject(B,new Q);const n=Ce();e.inject(ne,n),vi??=ms(Ah);for(const r of vi)r.setup(e);return n}function Ph(e){}var Dh=[{name:"save.previewFollow",setup:Ph}],bi=N("plugin.lateUnitsInstalled");function Oh(e){if(!e.getInstance(bi)){e.inject(bi,!0);for(const t of ms(Dh))t.setup(e)}}function xh(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Mh(e){if(!e)return;const t=zi(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 Lh=$e(e=>{let t,n,r;return{async setOptions(i){const o=r!==i.getAuthToken,s=!je(t,i.user),l=n!==i.project;if(r=i.getAuthToken,t=i.user,n=i.project,!(!e.getInstance(Ee)||!i.getAuthToken)&&!(!o&&!s&&!l))try{const d=await i.getAuthToken(i.user,i.project);e.inject(ga,Promise.resolve(d||""));const u=Mh(d);if(!u)return;e.inject(da,u);const h=e.getInstance(Fe),g=h?await h.catch(()=>{}):void 0;e.inject(Fe,Promise.resolve(xh(u,g)))}catch{}}}});function kh(e,t){if(e.getInstance(wr))return;e.inject(wr,!0);const n=Gn(e,$.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}function Nh(e){e.getInstance(la)||e.inject(Ee,void 0)}function $t(e){return String(e.standaloneKey||"").trim()||void 0}function Fh(e){return e.standaloneOnAuthFailure===!0?!0:e.config?.standaloneOnAuthFailure===!0}function gr(e){return Fh(e)?!!$t(e):!1}function Gt(e){return!!$t(e)&&!gr(e)}var jh=$e(e=>{let t,n=!1;return{setOptions(r){const i=n;if(n=!0,!Gt(r)){t&&(Nh(e),gr(r)),t=void 0;return}const o=$t(r);if(!o||t===o&&e.getInstance(Ee))return;t=o,e.inject(Ee,o);const s=e.getInstance(B);s&&kh(e,s)}}}),Bh=$e(e=>{const t=e.getInstance(B),n=Gn(e,$i),r=F(n),i=t.addDisposable(new Ne(r));return{setOptions({handleLoad:o}){i.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}}),Uh=$e(e=>{const t=e.getInstance(B),n=t.addDisposable(new be),r=t.addDisposable(new be),i=zn(e,Ns),o=F(n.event),s=F(r.event),l=F(i.event),d=t.addDisposable(new Ne(o)),u=t.addDisposable(new Ne(s)),h=t.addDisposable(new Ne(l));return{instance:{handleSetOptions:o,handleOptionsChanged:s,handleConfigChanged:l},async setOptions(g){d.setListener(g.handleSetOptions),u.setListener(g.handleOptionsChanged),h.setListener(g.handleConfigChanged),await n.fire(g),await r.fire(g)},dispose(){}}}),rn,gs="core";function Hh(){const e=window.__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([gs],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function $h(e){const t=window.__useblocks__?.require?.warm;return typeof t!="function"?dt().then(()=>{}):t([gs],e)}function dt(){return rn===void 0&&(rn=Hh().then(e=>(tt()&&e.installDiagnostics().catch(t=>{}),e))),rn}var on=null,sn=null;async function Gh(e){typeof e?.prefetch=="function"&&await e.prefetch()}function vr(){return on||(on=dt().then(()=>{})),on}function vs(e){return sn||(sn=Gh(e)),sn}function qh(){return vs(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}function zh(e){return Promise.all([vr(),vs(e)]).then(()=>{})}function Vh(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function yi(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>$h(t?{priority:t}:void 0)).then(()=>(lr(t?{priority:t}:void 0),n?vr():void 0)).catch(()=>{})}function Kh(e){const t=Vh(e);if(t==="eager")yi(e);else if(t==="idle"){const n=()=>yi(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var bs="PluginRegistry";function Wh(e=Ws()){return e.getOrCreateInstance(bs,()=>new Da)}var Yh=new Oa(()=>Wh()),Xh=$e(e=>{let t;function n(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(r){const i=e.getInstance(Nt),o=e.getInstance(bs);t||(t=new Pa(i,o,{ensureHostRuntimeReady:qh}),e.inject(yn,t));const s=r?.plugins||[];i&&await t.setPlugins(s)},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}}}),ys=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const i=this._listeners.indexOf(r);i>=0&&this._listeners.splice(i,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}},Jh=N("ELEMENT_INSERT_HTML_PIPELINE"),Qh=N("BLOCK_INSERT_HTML_PIPELINE"),Zh="application_block_inserted",em=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Qh,()=>new ys).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(st,()=>new at),i=n?e.bind(n):e;return r.addListener(Zh,i,t)}},tm=N("ComponentRegistry"),Ei;function rt(e,t=tm){const n=Tt.getInstance(t);if(n)return n;if(!Ei)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return Tt.getOrCreateInstance(t,Ei)}var nm=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}getNames(){return new Promise(e=>{const t=this._container.addService(ct,{execute:n=>{t.dispose(),e(n.value.map(r=>({name:r.name,html:r.html})))}})})}update(e,t){const n=this._container,r=rt(n);return n.addService(ct,{execute:i=>{const o=i.value.find(s=>s.name===e);if(o){const{icon:s,title:l,fallbackTooltip:d,...u}=t;s&&(o.icon=r.getReactNode(s)),l&&(o.title=r.getReactNode(l)),d&&(o.fallbackTooltip=r.getReactNode(d)),Object.assign(o,u)}}})}delete(e){this._container.addService(ct,{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=rt(n);return n.addService(ct,{execute:i=>{i.value.splice(t??i.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(Jh,()=>new ys).add(e,t??0,n)}handleInject(e,t,n){return ke(this._container,Js).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},rm=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(st,()=>new at)}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 im(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var om=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=ke(t,Vs),this._closeModalEmitter=ke(t,Gs),this._updateModalEmitter=ke(t,Qs)}get _container(){return this._context.container}show(e){const t=rt(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=rt(this._container),r=t.modalProps;this._updateModalEmitter.fire(im({...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}))}},sm=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 i=()=>this._loadedDisposable.dispose(),o=()=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),n())},s=l=>{this._loadedSettled||(this._loadedSettled=!0,this._readySettled&&i(),r(l))};this._resolveLoaded=o,this._rejectLoaded=s}),this.ready=new Promise((n,r)=>{const i=()=>this._loadedDisposable.dispose(),o=()=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),n())},s=l=>{this._readySettled||(this._readySettled=!0,this._loadedSettled&&i(),r(l))};this._resolveReady=o,this._rejectReady=s})}_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)}},am=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(st,()=>new at)}_createScriptHandle(e,t){const n=this._messageService.addListener(js,i=>{if(i.key===e){if(i.phase==="load"&&i.status==="success"){r.resolveLoaded();return}if(i.phase==="ready"&&i.status==="success"){r.resolveReady();return}if(i.phase==="load"){r.rejectLoad(new Error(i.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(i.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new sm(t,n);return r}registerSandboxCSS(e){return this._container.addService(Me,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(Me,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(Me,{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(Me,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},lm=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function jn(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&lm.has(t)}function Es(){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 an(){return`__settingsPanel:${Es()}`}function ln(e,t){return{type:e,props:t}}function dm(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!jn(e)}function _i(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(jn(t)){const r=an();return n(e.add(r,t)),ln(r,{})}if(typeof t=="function"){const r=an();return n(e.add(r,t)),ln(r,{})}if(dm(t)){const r=t.type;if(typeof r=="string")return t;if(jn(r)||typeof r=="function"){const i=an();return n(e.add(i,r)),ln(i,t.props)}return t}return t}var cm=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=rt(this._container),n=s=>this._trackRegistration(s),r=_i(t,e.content,n),i=e.advancedTabs?.map(s=>({...s,content:_i(t,s.content,n)})),o=e.instanceKey??Es();ke(this._container,_r).fire({...e,content:r,advancedTabs:i,instanceKey:o,type:Ks})}closeSettingsPanel(){this._clearPanelRegistrations(),ke(this._container,_r).fire(null)}},_s={SandboxScriptApi:am,ElementsApi:nm,BlocksApi:em,MessageService:rm,SettingsPanelApi:cm,ModalApi:om};function dn(e,t,n,r={}){const i=Object.assign({},e);for(const[o,s]of Object.entries(t))if(s!==void 0)if(n.includes(o)&&typeof s=="object"&&s!==null){const l=i[o],d=r[o]??{};i[o]=Object.assign({},typeof l=="object"&&l!==null?l:d,s)}else i[o]=s;return i}var oe={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}},um={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"},cn={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},wi={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},De={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:oe.border,borderRadius:oe.borderRadius,textAlign:"center",padding:oe.padding},Si={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:oe.padding},un={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:oe.border,borderRadius:oe.borderRadiusCards};function fm(e){return{...um,...e}}function pm(e){return{...cn,...e,bold:e?.bold??cn.bold,italic:e?.italic??cn.italic}}function hm(e){return{...wi,...e,underline:e?.underline??wi.underline}}function mm(e){return{...De,...e,bold:e?.bold??De.bold,italic:e?.italic??De.italic,border:{...De.border,...e?.border},borderRadius:{...De.borderRadius,...e?.borderRadius},padding:{...De.padding,...e?.padding}}}function gm(e){return{...Si,...e,padding:{...Si.padding,...e?.padding}}}function vm(e){return{...un,...e,border:{...un.border,...e?.border},borderRadius:{...un.borderRadius,...e?.borderRadius}}}function fn(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 Ii(e){let t={...qn};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function pn(e){return{text:fm(e.text),headings:pm(e.headings),links:hm(e.links),buttons:mm(e.buttons),block:gm(e.block),cards:vm(e.cards)}}var Ai=N("EmailSettingsPort"),bm=1e4,ws=class{_editor;_layoutSettingsChanged=new En;_contentStylesChanged=new En;_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(Ai);if(!t)throw new Error("[extensions] настройки письма ещё не загружены — работа с UI начинается с init()");return t}_getCurrentLayoutSettings(){return fn(this._settings().read())}_getCurrentContentStyles(){const e=Ye(this._editor.container)?.current()?.get().attributes.common_styles;return pn(Ii(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(Ai),this._messageSubscription)return;const e=this._editor.container.getOrCreateInstance(st,()=>new at),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const i=r?.data,o=i?.operation;if(o===U.APPLICATION_EMAIL_SETTINGS_SET){const d=fn(i?.settings),u=this._getLayoutSnapshot(d);u!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=u,this._layoutSettingsChanged.fire(d));return}if(o!==U.APPLICATION_COMMON_STYLES_UPDATE)return;const s=pn(r.data?.settings?.commonStyles??{...qn}),l=this._getContentSnapshot(s);l!==this._prevContentSnapshot&&(this._prevContentSnapshot=l,this._contentStylesChanged.fire(s))})})();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=fn(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=bm){const t=Ye(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,i=Gn(r,$.ON_EMAIL_INIT_ID);return new Promise(o=>{let s=!1,l;const d=()=>{l&&(clearTimeout(l),l=void 0)},u=i(()=>{s||(s=!0,d(),u.dispose(),o())});l=setTimeout(()=>{s||(s=!0,u.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Ye(this._editor.container)?.current();if(!t)return;const n=Ii(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=dn(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:oe.border,borderRadius:oe.borderRadius,padding:oe.padding})),e.block!==void 0&&(n.block=dn(n.block||{},e.block,["padding"],{padding:oe.padding})),e.cards!==void 0&&(n.cards=dn(n.cards||{},e.cards,["border","borderRadius"],{border:oe.border,borderRadius:oe.borderRadiusCards}));const r=JSON.stringify(n);Dt(t,{common_styles:r}),this._settings().markAppearanceChanged();const i=pn(n);this._prevContentSnapshot=this._getContentSnapshot(i),this._contentStylesChanged.fire(i)}},ym={..._s,EmailSettingsApi:ws},Em={..._s},av={...Em,EmailSettingsApi:ws},_m={...ym};function wm(){Yh.addAll(_m)}var Sm=[$e(()=>{wm()}),Bh,Uh,jh,pa,Lh,ya];async function Im(){return(await dt()).asyncMixins}var Am=Xh,Cm=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let i;try{i=await Im()}catch(s){throw e.failPendingWaits(s),s}t=i(e);const o=await e.getInstanceAsync(Nt);Object.assign(o,t.instance||{});for(const s of e.getInstance(Vi)??[])s()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},Tm=ia([...Sm]);function hn(){let e,t=!1;const n=new Map,r=new Map;function i(){for(const o of r.values())o();r.clear()}return{event(o,s,l){const d=Symbol("subscription");return t||(n.set(d,{listener:o,priority:s,thisArg:l}),e&&r.set(d,e(o,s,l))),()=>{n.delete(d),r.get(d)?.(),r.delete(d)}},attach(o){i(),e=o;for(const[s,{listener:l,priority:d,thisArg:u}]of n)r.set(s,o(l,d,u))},dispose(){t=!0,i(),n.clear(),e=void 0}}}function Rm(e){const t=hn(),n=hn(),r=hn();return e.getInstance(B)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(Nn).then(i=>{t.attach(i.onNotify),n.attach(i.onError),r.attach(i.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(i){const o=e.getInstance(Nn);if(!o)throw new Error("[plugin] notify() вызван до загрузки редактора");o.notify(i)}}}var Pm=[If,Ih,Rm];function Dm(e,t=Pm){const n=mr(e);Oh(e);const r=Tm(e),i=Am(e),o=Cm(e),s={...r.instance,...i.instance,...o.instance};for(const d of t)Object.assign(s,d(e));let l=!0;return{instance:s,async setOptions(d){await r.setOptions(d);const u=l&&n.get()===d;l=!1,u||n.set(d),await i.setOptions(d),await o.setOptions(d)}}}var Om=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]}},xm="editor-runtime.react.copies",mn=8;function it(e){return e&&typeof e=="object"?e:void 0}function Ci(e){const t=it(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=it(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function Mm(e){const t=it(e),n=t&&typeof t.version=="string"?t.version:void 0,r=it(t?.default),i=r&&typeof r.version=="string"?r.version:void 0;return n??i??"unknown"}function Lm(e,t,n){return e.package===t&&e.version===n}function km({ourReact:e,entries:t,packageName:n,version:r}){const i=Ci(e);if(!i||!Array.isArray(t))return[];const o=[],s=new Set;for(const l of t){const d=it(l);if(!d||!Lm(d,n,r))continue;const u=Ci(d.react);!u||u===i||s.has(u)||(s.add(u),o.push({package:n,version:r,reactVersion:Mm(d.react),react:d.react}))}return o}function Nm({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,mn))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>mn&&n.push(` …and ${t.length-mn} 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(`
|
|
1048
|
-
`)}var
|
|
1047
|
+
`)}function Yi(e){return e.replace(/<title[^>]*>[\s\S]*?<\/title>/gi,"")}function km(e,t,n,r){const i=Nm(e,t,n,r);return i===void 0}function Nm(e,t,n,r){const{email:i}=mn(t,!1),o=rt(i,e),s=o.id;if(s===void 0)return"no-id";if(r!==void 0&&r!==s)return"other-id-shown";const a=Br(e)?.current();if(!a)return"no-session";const l=a.get(),u=l.attributes;if(l.serverId!==s)return"document-id";if(u.is_inited!==!0)return"not-inited";const d=Yi(lr(n??a.getContent()));if(o.html!==void 0&&Yi(lr(o.html))!==d)return"html";if(o.subject!==void 0&&o.subject!==u.subject)return"subject";if(o.preheader!==void 0&&o.preheader!==u.preheader)return"preheader";if(o.common_styles!==void 0&&o.common_styles!==u.common_styles)return"common_styles"}function Xi(e,t){const{email:n}=mn(t,!1),r=rt(n,e);if(r.id!==void 0)return JSON.stringify([r.id,r.html===void 0?null:lr(r.html),r.subject??null,r.preheader??null,r.common_styles??null])}function Fm(e,t){const n={...e};return delete n.id,{...n,...t}}function jm(e){return e.html?e:{...e,html:_a}}function ut({code:e,project:t,...n},r,i){const o=i??Kr(r);return{...n,...e?{html:Ve(r).toEditorForm(e)}:{},renderGuid:Ee(),...o===void 0?{}:{project:o}}}function dt({html:e,renderGuid:t,...n},r){const{requested:i}=Mt(r);return Pe({...n,code:Ve(r).toOutputForm(e),project:i===void 0?n.project:i,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 Ia(e){return Br(e)?.current()?.get().serverId??void 0}function cr(e,t,n){return n===void 0&&(n=e.post===void 0?Ia(t):e.post),{...e,content:e.content?`<p>${e.content}</p>`:"",post:n}}function ft(e,t){return Pe({...e,link:void 0,comment_status:void 0})}function Qt({code:e,autosave:t,...n},r,i){return i===void 0&&(i=n.parent===void 0?Ia(r):n.parent),{...n,...e?{html:e}:{},isAutosave:t===!0||Eu(n.slug),parent:i}}function ur({html:e,isAutosave:t,...n},r){return Pe({...n,autosave:t?!0:void 0,code:e,guid:void 0,compiled:Pe({html:e,ampHtml:e&&""})})}var et=N("NotificationService"),Bm=N("emailTemplate.reads");async function Um(e,t){try{return await He(e).email(e).readEmail(t)??void 0}catch(n){n instanceof Error&&n.message,$m(e,t,n);return}}var Hm=N("emailTemplate.notifiedFailures");function $m(e,t,n){if(n instanceof DOMException&&n.name==="AbortError")return;const r=e.getOrCreateInstance(Hm,()=>new Set);r.has(t)||(r.add(t),e.getInstanceAsync(et).then(()=>{Pt(e,F.ON_NOTIFICATION).fire({type:"warning",id:"TEMPLATE_READ_ERROR",data:{templateId:t},innerException:n})},()=>{}))}function Vm(e,t){const n=e.getOrCreateInstance(Bm,()=>new Map),r=n.get(t);if(r!==void 0)return r;const i=Um(e,t).then(o=>(o===void 0&&n.delete(t),o));return n.set(t,i),i}var qm="EXTERNAL",Ji=Symbol("supersededShow");function Gm(e){return e instanceof Error?e:new Error(typeof e=="string"?e:"[emailmaker] save failed")}var zm="email_id",Wm=class extends Z{_container;_prevCommand;_lastShow;_showToken=0;_showRequests=0;_latestShowEmailId;_latestShow=Promise.resolve();_dataSources;_eventLock;_queue=ko();_currentEmail;constructor(e){super(),this._container=e;const t=e;this._dataSources=Lt(t),this._eventLock=Om(t);const n=J(e,F.ON_EMAIL_CHANGED_ID);this.addDisposable(n(r=>{this._currentEmail=r})),this.addDisposable(e.addService(Er,{execute:(r,i)=>{!i?.public&&this._currentEmail?.id&&!this._currentEmail.isNew&&r.headers.append(zm,this._currentEmail.id)}}))}_getInitPipeline(){return this._container?.getInstance(we)??qr}_throwIfDestroyed(){if(this.isDisposed())throw Te()}async getTemplateEmail(e){const t=await Vm(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 Jt(this._container);await t.setAll(e.filter(r=>r.id!==void 0).map(r=>[r.id,ut(r,this._container,n)]))}async setEmailRevisions(e,t){if(e===void 0)return;const{cache:n}=this._dataSources.emailRevisions,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,Qt(i,this._container,t)]);await n.setAll(r)}async setComments(e=[],t){const{cache:n}=this._dataSources.comments,r=e.filter(i=>i.id!==void 0).map(i=>[i.id,cr(i,this._container,t)]);await n.setAll(r)}async setEmail(e,t,n,r,i){const o=this._dataSources.emails,s=o.cache,a=await Jt(this._container),l=r??this._showToken;e=typeof e=="string"?{code:e}:{...e};let u=rt(e,this._container);const d=u.id;let p=d;if(d!==void 0){const b=await o.get(d);u={...b??{},...u,utm_parameters:u.utm_parameters??b?.utm_parameters??{},renderGuid:b?.renderGuid??Ee(),...l>0?{showToken:l}:{},...i?{showId:i}:{},project:a}}else{p=n??Ee();const b=await o.get(p);u={...u,utm_parameters:u.utm_parameters??{},renderGuid:b?.renderGuid??Ee(),...l>0?{showToken:l}:{},...i?{showId:i}:{},project:a},delete u.project}if(t){const b=await this.getTemplateEmail(String(t));b&&(u=Fm(b,u))}return d===void 0&&(u=jm(u)),await s.setAll([[p,u]]),u}_rememberShow(e){this._prevCommand=e}_isRepeatOfLastShow(e){const t=this._lastShow;if(!t||t.signature!==Xi(this._container,e))return!1;const n=Xt(this._container);return n===void 0||n===t.html}_rememberShownContent(e){const t=Xi(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&&Mm({ticket:t,emailId:Ki(e)},{ticket:this._showRequests,emailId:this._latestShowEmailId}))return this._showRequests,Ji;if(!e)return;const n=this._getInitPipeline();z(n.signal);const r=Lm(e);if(!r&&km(this._container,e,Xt(this._container),this._prevCommand?.id)||!r&&this._isRepeatOfLastShow(e))return;const i=mn(e);i.email.id,this._prevCommand?.id;let o,s="",a=0,l=!1,u,d=Promise.resolve(),p,b=!1;try{this._eventLock.suspendChange();const{email:v,blocks:S,autosaves:E,comments:h,templateId:w,reload:_}=i;o=v.id;const A=rt(v,this._container),I=A.id,x=I??Ee(),y=await mt("getProject",Jt(this._container));z(n.signal),s=Ee();const C={isNew:I===void 0,id:String(x),project:y},R=_===!0&&I!==void 0;R&&(await this._dataSources.emails.remove(String(I),{silent:!0}),String(I)),a=++this._showToken,String(x);const m=[];m.push(this.setBlocks(S)),v.id!==void 0&&(m.push(this.setComments(h)),m.push(this.setEmailRevisions(E,String(v.id)))),m.push(this.setEmail(v,Number(w),I===void 0?String(x):void 0,a,s)),await mt("setEmail+blocks+revisions",Promise.all(m),{emailId:I??String(x),showId:s,targetShowToken:a}),z(n.signal);const c=await this._dataSources.emails.get(String(x)),f=De(this._container),g={id:s,token:a};I===void 0?p=f.startNewDraft(c??A,{patch:A,show:g}):R?p=f.reload(I,{email:c??A,patch:A,show:g}):f.sessionKey()===We(I)?p=f.show(A,g):p=f.open(I,{email:c??A,patch:A,show:g});const P=!!this._prevCommand&&Ie(this._prevCommand,C);C.id,!this._prevCommand||Ie(this._prevCommand,C),this._prevCommand?.id,this._rememberShow(C),d=n.requestShow({showId:s,navId:String(x),emailId:I,isNew:I===void 0}),b=!0,String(x),l=!0}catch(v){u=v,b&&s&&n.failShow(s,v),Lo(v)||(Zo(v),void 0)}finally{this._eventLock.resumeChange()}if(!l)throw u instanceof Error?u:new Error(`[useblocks] show() setup failed: ${String(u??"unknown error")}`);return mt("show-init-deferred",Promise.all([d,p?.whenReady().catch(v=>{if(v instanceof tn){const S=fs(v);throw S?new Error(`[useblocks] show(): email open failed (${S})`,{cause:v}):v}})??Promise.resolve()]).then(()=>{}),{showId:s,emailId:o??null}).then(()=>{this._rememberShownContent(e)})}async _save(){this._throwIfDestroyed();const e=this._getInitPipeline();z(e.signal);const t=De(this._container),n=await t.save("publish",{source:qm,fallbackTitle:Os(this._container)});if(z(e.signal),!n)throw Gm(t.saveState().error);return oe(Sa(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=Ki(e);const n=this._queuedShow(e,t).then(r=>r===Ji?this._latestShow.catch(()=>{}):void 0);return this._latestShow=n,n};save=this._queue.decorate(this._save,this)};function Km(e){return String(e).replace(/"/g,""")}function Ym(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 Xm(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 Qi(e,t,n){const r=new RegExp(`\\b${t}\\s*=\\s*["'][^"']*["']`,"i"),i=Km(n);return r.test(e)?e.replace(r,`${t}="${i}"`):e.replace(/>$/,` ${t}="${i}">`)}function Jm(e,t,n){if(!e?.trim()||!t)return e;const r=Xm(e);if(!r)return e;const i=String(t),o=Ym(n??new Date);let{full:s,index:a}=r;const l=s.length;return/\bem-block-id\s*=/.test(s)||(s=Qi(s,"em-block-id",i)),s=Qi(s,"em-block-version",o),e.slice(0,a)+s+e.slice(a+l)}function Qm(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 Zm(e,t){const n=e.insertFrom??t?.type,r=t?.blockId??(e.id!=null&&e.id!==""?String(e.id):void 0),i=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:i,fragmentRole:e.fragmentRole,id:r,title:e.title??void 0,blockType:e.type,meta:Qm(e)}}function Dn(e,t){return t?Zm(t,e):{type:e.type,name:e.name,blockId:e.blockId,project:e.project,insertFrom:e.type}}var Ca=["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"],eg=[...Ca,"html","id","project","password"],lE=new Set(["html",...Ca,"global_block","project"]);function tg(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(eg),r={};for(const i of Object.keys(e))n.has(i)||(r[i]=e[i]);return Object.keys(r).length>0&&(t.catalogExtra=r),t}function ng(e,t={}){return!e||typeof e!="object"?{html:"",insertFrom:t.type,name:t.name,project:t.project,id:t.blockId}:{...tg(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 dr=new WeakMap;function rg(e){let t=dr.get(e);return t||(t={byId:new Map,fallback:[]},dr.set(e,t)),t}function ig(e){dr.delete(e)}function og(e,t){const{byId:n,fallback:r}=rg(t);if(e.blockId){const i=n.get(e.blockId);if(i){n.delete(e.blockId);const o=r.indexOf(i);return o>=0&&r.splice(o,1),i}return}for(let i=r.length-1;i>=0;i--){const o=r[i],s=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(s&&a)return r.splice(i,1),o.id!=null&&o.id!==""&&n.delete(String(o.id)),o}}async function sg(e,t){const{blocks:n}=Lt(e);return await n.cache.getIfPresent(t)??void 0}async function ag(e,t){if(!t.blockId)return;const n=await sg(e,t.blockId);if(n)return ng(n,t)}async function lg(e,t){const n=og(e,t);if(n)return Dn(e,n);const r=await ag(t,e);return r?Dn(e,r):Dn(e,void 0)}var cg=xo("application_block_inserted"),ug=-1e3,Zi=new WeakSet;function dg(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 fg(e){if(!e||Zi.has(e))return;Zi.add(e);const t=new Z,n=ne(e);return t.addDisposable(n.addListenerAsyncPipe(cg,async(r,i)=>{const o=dg(r)?await lg(r,e):r;return i?i(o):o},ug)),t.addDisposable({dispose:()=>{ig(e)}}),t}var Ta=N("plugin.earlyWindow");function pg(e){return e.getOrCreateInstance(Ta,()=>({depth:0}))}function hg(e){const t=pg(e);t.depth+=1;let n=!1;return()=>{n||(n=!0,t.depth-=1)}}function Aa(e){return(e?.getInstance(Ta)?.depth??0)>0}function Ra(e,t){let n,r=!1;return e(i=>{n=i,r=!0}),(i,o,s)=>{const a=e(i,o,s);if(r&&Aa(t)){const l=n;queueMicrotask(()=>{i.call(s,l)})}return a}}var eo=100,mg=class extends Z{_container;_events;constructor(e){super(),this._container=e;const t=fg(e);t&&this.addDisposable(t)}_get(){const e=this._container,{blocks:t,emails:n,comments:r,emailRevisions:i}=Lt(e),o=J(e,F.ON_SHARE_ID),s=J(e,F.ON_SHOW_PREVIEW_ID),a=J(e,F.ON_EMAIL_CLONE_ID),l=J(e,F.ON_CODE_VALIDATE_ID),u=J(e,F.ON_SUBJECT_CHANGED_ID),d=J(e,F.ON_EMAIL_CHANGED_ID),p=J(e,F.ON_PREHEADER_CHANGED_ID),b=J(e,F.ON_SAVEBUTTON_CLICK_ID),v=J(e,F.ON_NEXTBUTTON_CLICK_ID),S=J(e,F.ON_SEND_LIVEPREVIEW_ID),E=J(e,F.ON_SEND_TESTEMAIL_ID),h=J(e,Am),w=J(e,F.ON_CONTENT_CHANGED_ID),_=J(e,Tm),A=J(e,F.ON_PREVIOUSBUTTON_CLICK_ID),I=J(e,F.ON_SEND_EMAIL_MODAL_ID),x=Cl(J(e,F.ON_EMAIL_INIT_ID),y=>!y.reset);return{handlePreheaderChanged:j(p),handleSubjectChanged:j(u),handleValidate:j(l),handleReadEmail:j(n.handlerRead,y=>y,y=>y&&rt(y,e)),handleSaveEmail:j(n.onSave,function({prev:y,patch:C,value:R,source:m}){const c=y?oe(y,e):void 0;return{prev:c,patch:vt(c,oe(C,e)),value:oe(R,e),source:m}},y=>y?rt(y,e):void 0),handleRemoveEmail:j(n.onRemove,({value:y,source:C})=>({value:oe(y,e),source:C}),()=>{}),handleReadCommonBlocks:j(h,y=>y.project,y=>y?.map(C=>ut(C,e))),handleReadTemplateBlocks:j(_,y=>y,y=>y?.map(C=>ut(C,e))),handleReadBlocks:j(t.byForeignKey("project").handleRead,y=>Mt(e).requested||String(y),y=>y?.map(C=>ut(C,e))),handleSaveBlock:j(t.onSave,function({prev:y,patch:C,value:R,source:m}){const c=R.global_block===!0&&R.id&&typeof R.html=="string"?{...R,html:Jm(R.html,String(R.id))}:R,f=y?dt(y,e):void 0;return{prev:f,patch:vt(f,dt(C,e)),value:dt(c,e),source:m}},y=>y?ut(y,e):void 0),handleRemoveBlock:j(t.onRemove,({value:y,source:C})=>({value:dt(y,e),source:C}),()=>{}),handleReadComments:j(r.byForeignKey("post").handleRead,y=>y,y=>y?.map(C=>cr(C,e))),handleSaveComment:j(r.onSave,function({prev:y,patch:C,value:R,source:m}){const c=y?ft(y,e):void 0;return{prev:c,patch:vt(c,ft(C,e)),value:ft(R,e),source:m}},y=>y?cr(y,e):void 0),handleRemoveComment:j(r.onRemove,({value:y,source:C})=>({value:ft(y,e),source:C}),()=>{}),handleReadEmailRevisions:j(i.byForeignKey("parent").handleRead,y=>y,y=>y?.map(C=>Qt(C,e))),handleReadEmailAutosave:j(J(e,ha),y=>y,y=>y?Qt(y,e):null),handleEmailAutosave:j(i.onSave,function({prev:y,patch:C,value:R,source:m}){return{value:ur(R,e),source:m}},y=>y?Qt(y,e):void 0),handleRemoveEmailAutoSave:j(i.onRemove,({value:y,source:C})=>({value:ur(y,e),source:C}),()=>{}),handleEmailChanged:j(ui(d,eo),y=>oe(y,e)),handleEmailInit:Ra(j(x,y=>oe(y,e)),e),handlePreviousButtonClick:j(A,y=>oe(y,e)),handleNextButtonClick:j(v,y=>oe(y,e)),handleSaveButtonClick:j(b,y=>oe(y,e)),handleHtmlChanged:j(ui(w,eo)),handleTestEmailSend:j(E,({html:y,...C})=>({...C,code:y,compiled:{html:y,ampHtml:""}})),handleTestEmailModal:j(I,y=>oe(y,e)),handleCloneEmail:j(a,y=>oe(y,e)),handleShareEmail:j(o),handlePreviewEmail:j(s),handleLivePreviewEmail:j(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 Ze(t[r]))}for(const r of Object.keys(t))n[r].setListener(e[r])}},gg=N("DataController"),vg=N("DataEvents");function Pa(e){return e.getOrCreateInstance(gg,()=>{const t=new Wm(e);return e.getInstance(H)?.addDisposable(t),t})}function Da(e){return e.getOrCreateInstance(vg,()=>new mg(e))}var bg=N("plugin.pluginStart");function Oa(e){return e.getOrCreateInstance(bg,()=>{let t;const n=new Promise(r=>{t=r});return e.getInstance(H)?.addDispose(()=>t()),{done:n,finish:t}})}function yg(e){return Oa(e).done}function Eg(e){const t=Oa(e);return t.run===void 0&&(t.run=(e.getInstance(Ir)?.activate()??Promise.resolve()).finally(t.finish)),t.run}var _g=N("plugin.startupShow");function wg(e){const t=Pa(e),n=Da(e),r=e.getInstance(te),i=e.getInstance(H),o={current:Promise.resolve()};e.inject(_g,o);let s=!1;const a=r?.watch(u=>{u&&n.setOptions(u),s=(u?.plugins?.length??0)>0,o.current=o.current.catch(()=>{})}),l=r?.select(u=>u?.content).watch(u=>{if(u===void 0)return;const d=()=>(K(re.showStart),t.show(u).finally(()=>K(re.showEnd))),p=s?yg(e).then(d):d();p.catch(()=>{}),o.current=p});a&&i?.addDisposable(a),l&&i?.addDisposable(l)}function Sg(e){const t=Pa(e);return{...Da(e).get(),show(n){return K(re.showStart),t.show(n).finally(()=>K(re.showEnd))},save(){return t.save()}}}function xa(e){return/#set\s*\(\s*.*=.*\)/.test(e)}function gn(e){const t=e.indexOf("(");if(t<0)return!0;let n=0,r="",i=!1;for(let o=t;o<e.length;o++){const s=e[o];if(i){i=!1;continue}if(s==="\\"){i=!0;continue}if(r){s===r&&(r="");continue}if(s==='"'||s==="'"){r=s;continue}if(s==="("){n++;continue}if(s===")"&&(n--,n<0))return!1}return n===0}function Ig(e){return(t,n,r)=>gn(t)?e(t,n,r):!1}function Cg(e){return t=>gn(t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t)?e(t):!1}function Tg(e){return(t,n,r)=>gn(t)?xa(t)?e(t,n,r):t:!1}function Ag(e){return t=>{const n=t.startsWith("<!--")&&t.endsWith("-->")?t.slice(4,-3):t;return gn(n)?xa(n)?e(t):t:!1}}function Rg(e){const t=/[<>&]/g;for(;t.exec(e)!==null;)return!0;return!1}function Qr(e,t){const n=e.length;for(let r=0;r<n;r++){const i=e.charCodeAt(r);if(i===0||t==='"'&&i===34||t==="'"&&i===39||t===""&&(i===32||i===9||i===10||i===13||i===12||i===34||i===39||i===60||i===62||i===61||i===96))return!1}return!0}function Pg(e){const t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",r=new Uint8Array(e);crypto.getRandomValues(r);let i="";for(let o=0;o<e;o++){const s=r[o]%62;i+=t.charAt(s)}return i}var Dg=8,Og=class{_byKey=Object.create(null);_byValue=Object.create(null);getOrCreateByKey(e){let t=this._byKey[e];return t===void 0&&(t=Pg(Dg),this._byKey[e]=t,this._byValue[t]=e),t}getByValue(e){return this._byValue[e]}},vn=new Og;function to(e,t){return t!==void 0&&!Qr(e,t)?`%|{${vn.getOrCreateByKey(e)}}|%`:e}function xg(e){const t=vn.getByValue(e.slice(3,e.length-3));return t===void 0?e:t}function W(e,t,n){return t!==void 0?Qr(e,t)?e:`%|{${vn.getOrCreateByKey(e)}}|%`:`<!--${e}-->`}function Mg(e){return e.replace(/>/g,">").replace(/</g,"<").replace(/&/g,"&")}function G(e){return e.startsWith("<!--")&&e.endsWith("-->")?Mg(e.slice(4,-3)):e}function Lg(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 i=e.match(/\[%\s*([^%]*?)\s*%\]/);i&&(r=i[1]);const o=r.trim();return t.test(o)||n.test(o)}function kg(e,t,n){return t!==void 0?Qr(e,t)?e:`%|{${vn.getOrCreateByKey(e)}}|%`:n||Rg(e)||Lg(e)?`<!--${e}-->`:e}var je=Ig(W),Be=Cg(G),Ng=Tg(W),Fg=Ag(G),Ma=e=>{e.escape("<!--","-->",t=>t,!1),e.escape("<style","</style>",t=>t,!1),e.escape("<script","<\/script>",t=>t,!1),e.unescape("%|{","}|%",xg),e.escape("@{","}",W,!0).unescape("<!--@{","}-->",G,!0),e.unescape("<!--%%%{{{","}}}%%%-->",t=>t.substring(10,t.length-9),!1),e.escape("${","}",to,!0),e.escape("{{","}}",to,!0),e.createSyntax("brace-percent").escape("{%","%}",W).unescape("<!--{%","%}-->",G),e.createSyntax("brace-hash").escape("{#","#}",W).unescape("<!--{#","#}-->",G),e.createSyntax("proscript").escape("[%","%]",kg,!0).unescape("<!--[%","%]-->",G,!0),e.createSyntax("getresponse").escape("[[IF","]]",W).escape("[[if","]]",W).escape("[[ELSE]]","",W).escape("[[else]]","",W).escape("[[ENDIF]]","",W).escape("[[endif]]","",W).unescape("<!--[[IF","]]-->",G).unescape("<!--[[if","]]-->",G).unescape("<!--[[ELSE]]","-->",G).unescape("<!--[[else]]","-->",G).unescape("<!--[[ENDIF]]","-->",G).unescape("<!--[[endif]]","-->",G),e.createSyntax("expert-sender").escape("<if",">",W).escape("</if",">",W).escape("<else",">",W).escape("</else",">",W).escape("<var ",">",W,!0).unescape("<!--<if ",">-->",G).unescape("<!--</if",">-->",G).unescape("<!--<else ",">-->",G).unescape("<!--</else",">-->",G).unescape("<!--<var",">-->",G,!0),e.createSyntax("velocity").escape("#if",")",je).escape("#elseif",")",je).escape("#else","",W).escape("#foreach",")",je).escape("#macro",")",je).escape("#set",")",Ng,!0).escape("#parse",")",je).escape("#include",")",je).escape("#evaluate",")",je).escape("#end","",W).escape("#break","",W).escape("#stop","",W).unescape("<!--#macro","-->",Be).unescape("<!--#if","-->",Be).unescape("<!--#elseif","-->",Be).unescape("<!--#else","-->",G).unescape("<!--#foreach","-->",Be).unescape("<!--#parse","-->",Be).unescape("<!--#include","-->",Be).unescape("<!--#evaluate","-->",Be).unescape("<!--#end","-->",G).unescape("<!--#break","-->",G).unescape("<!--#stop","-->",G).unescape("<!--#set","-->",Fg,!0),e.createSyntax("mailchimp").escape("*|","|*",W).unescape("<!--*|","|*-->",G)},fr="bare",jg=new Map;function Bg(e){return e?jg.get(e)??fr:fr}var La=["brace-percent","brace-hash","proscript","getresponse","expert-sender","mailchimp","velocity"];function no(e){return La.includes(e)}function st(e){return e==="bare"||e==="html-comment"}function On(e){return typeof e=="object"&&e!==null&&!Array.isArray(e)}function Ug(e,t=n=>{}){const n={output:{},editor:{}};if(e==null)return n;let r;if(typeof e=="string"){if(!st(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[u,d]of[["output",r.output],["editor",r.editor]])if(d!==void 0&&!st(d))return t(`templateDirectives.${u}: unknown form "${String(d)}", configuration ignored.`),n;if(r.syntaxes!==void 0&&!On(r.syntaxes))return t("templateDirectives.syntaxes: expected an object, configuration ignored."),n;if(r.syntaxes){for(const[u,d]of Object.entries(r.syntaxes))if(!(!no(u)||d===void 0||st(d))){if(!On(d))return t(`templateDirectives.syntaxes.${u}: expected a form or an object, configuration ignored.`),n;for(const p of["output","editor"]){const b=d[p];if(b!==void 0&&!st(b))return t(`templateDirectives.syntaxes.${u}.${p}: unknown form "${String(b)}", configuration ignored.`),n}}}if(r.output===void 0&&r.editor===void 0&&r.syntaxes===void 0)return n;const i=r.output??fr;let o=r.editor;i==="bare"&&r.editor==="html-comment"&&(t('templateDirectives: editor="html-comment" requires output="html-comment"; editor was reset to match output.'),o=void 0);const s=[];if(r.syntaxes)for(const u of Object.keys(r.syntaxes)){if(!no(u)){t(`templateDirectives.syntaxes: unknown syntax id "${u}", entry ignored.`);continue}s.push(u)}else s.push(...La);const a={},l={};for(const u of s){const d=r.syntaxes?.[u],p=On(d)?d:void 0,b=(st(d)?d:p?.output)??i;let v=p?.editor??o??b;b==="bare"&&v==="html-comment"&&(t(`templateDirectives.syntaxes.${u}: editor="html-comment" requires output="html-comment" for this id; editor was reset to "bare" for it.`),v="bare"),a[u]=b,l[u]=v}return{output:a,editor:l}}function ka(e,t,n,r){for(let i=t;i<n;i++){const o=e[i];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[i-1]==="="&&!['"',"'","`"].includes(o)&&(r.insideAttributeValue=!0,r.attributeQuoteChar="",r.unquotedAttr=!0)}}function pt(e,t){return e.start<t.end&&t.start<e.end}function ro(e,t,n,r,i=[]){if(n&&(t=t.filter(d=>d.isVariable)),!t.length)return[];const o=t.flatMap(d=>d.match(e).flatMap(p=>!Number.isInteger(p.start)||!Number.isInteger(p.end)||p.start<0||p.end>e.length||p.start>=p.end?[]:[{range:p,mapFn:d.mapFn,overrideBuiltins:d.overrideBuiltins,syntax:d.syntax,isVariable:d.isVariable}])).sort((d,p)=>d.range.start-p.range.start||d.range.end-p.range.end),s=[],a=i.slice().sort((d,p)=>d.start-p.start),l={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let u=0;for(const{range:d,mapFn:p,overrideBuiltins:b,syntax:v,isVariable:S}of o){if(r?(l.insideAttributeValue=!0,l.attributeQuoteChar='"'):ka(e,u,d.start,l),u=d.end,a.some(_=>pt(_,d)))continue;const E=l.insideAttributeValue?l.attributeQuoteChar??"":void 0,h=e.substring(d.start,d.end),w=p(h,E,l.insideTag);w!==!1&&w!==h&&(s.push({range:d,text:w,overrideBuiltins:b,syntax:v,isVariable:S}),a.push(d))}return s.sort((d,p)=>d.range.start-p.range.start||d.range.end-p.range.end)}function Hg(e,t){const n=t.reduce((a,{mapFn:l,start:u,end:d,syntax:p,isVariable:b})=>(a[u]||(a[u]=[]),a[u].push({value:d,mapFn:l,syntax:p,isVariable:b}),a),Object.create(null)),r=Object.keys(n).map(a=>a.replace(/[-[\]{}()*+?.,\\^$|]/g,"\\$&")).join("|"),i=new RegExp(r,"g"),o=[];let s;for(;(s=i.exec(e))!==null;){const a=s[0];o.push({start:s.index,startToken:a,endTokens:n[a]})}return o}function xn(e,t,n,r,i=!1){const o=[];if(n&&(t=t.filter(u=>u.isVariable)),!t.length)return o;const s=Hg(e,t),a={insideTag:!1,insideAttributeValue:!1,attributeQuoteChar:void 0,unquotedAttr:!1};let l=0;for(let u=0;u<s.length;u++){const{start:d,startToken:p,endTokens:b}=s[u];r?(a.insideAttributeValue=!0,a.attributeQuoteChar='"'):ka(e,l,d,a),l=d;const v=a.insideAttributeValue?a.attributeQuoteChar??"":void 0;let S=!1;for(const{mapFn:E,value:h,syntax:w,isVariable:_}of b){let A=d+p.length,I=e.indexOf(h,A);for(;I!==-1;){let x=I,y=d+p.length,C=0;for(;x!==-1;){const g=e.indexOf(p,y);if(g!==-1&&g<x)C++,y=g+p.length,x=e.indexOf(h,y);else if(C>0)C--,y=x+h.length,x=e.indexOf(h,y);else break}if(x<0)break;const R=x+h.length,m=e.substring(d,R),c=E(m,v,a.insideTag);if(c===!1){A=I+Math.max(h.length,1),I=e.indexOf(h,A);continue}(i||c!==m)&&o.push({range:{start:d,end:R},text:i?m:c,syntax:w,isVariable:_});const f=s.findIndex(({start:g})=>g>=R);f>u?u=f-1:u=s.length,S=!0;break}if(S)break}}return o}function Wt(e,t){if(!t.length)return e;const n=t.slice().sort((i,o)=>o.range.start-i.range.start);let r=e;for(const{text:i,range:o}of n)r=r.slice(0,o.start)+i+r.slice(o.end);return r}var $g=class{_disposables=[];_escapes=[];_unescapes=[];_escapeMatchers=[];_unescapeMatchers=[];constructor(e=Ma){const{_escapes:t,_unescapes:n}=this;e({createSyntax(r){return{...this,syntax:r}},escape(r,i,o,s){return t.push({start:r,end:i,mapFn:o,isVariable:s,syntax:this.syntax||r}),this},unescape(r,i,o,s){return n.push({start:r,end:i,mapFn:o,isVariable:s,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 i=!1;const o={dispose:()=>{i||(i=!0,this._escapeMatchers=this._escapeMatchers.filter(s=>s!==n),this._unescapeMatchers=this._unescapeMatchers.filter(s=>s!==r))}};return this.addDisposable(o),o}_collectMappings(e,t,n){const r=xn(e,this._escapes,t,n),i=ro(e,this._escapeMatchers,t,n),o=i.filter(l=>l.overrideBuiltins).map(l=>l.range),s=r.filter(l=>!o.some(u=>pt(u,l.range))),a=i.filter(l=>l.overrideBuiltins||!s.some(u=>pt(l.range,u.range)));return[...s,...a].sort((l,u)=>l.range.start-u.range.start||l.range.end-u.range.end)}getMappings(e,t,n){return this._collectMappings(e,t,n)}_collectRevertMappings(e,t){const n=xn(e,this._unescapes,t),r=ro(e,this._unescapeMatchers,t,!1),i=r.filter(a=>a.overrideBuiltins).map(a=>a.range),o=n.filter(a=>!i.some(l=>pt(l,a.range))),s=r.filter(a=>a.overrideBuiltins||!o.some(l=>pt(a.range,l.range)));return[...o,...s].sort((a,l)=>a.range.start-l.range.start||a.range.end-l.range.end)}getRevertMappings(e,t,n){const r=n?i=>i!==void 0&&n.has(i):i=>Bg(i)==="html-comment";return this._collectRevertMappings(e,t).filter(i=>i.isVariable||!r(i.syntax))}getDetectedMappings(e,t,n){return xn(e,this._escapes,t,n,!0)}getEscapedText(e,t){return Wt(e,this.getMappings(e,t))}getUnescapedText(e,t,n){return Wt(e,this.getRevertMappings(e,t,n))}normalizeToPolicy(e,t){const n=o=>o===void 0?void 0:t[o],r=Object.values(t);let i=e;return r.includes("bare")&&(i=Wt(i,this._collectRevertMappings(i).filter(o=>n(o.syntax)==="bare"))),r.includes("html-comment")&&(i=Wt(i,this._collectMappings(i).filter(o=>!o.isVariable&&n(o.syntax)==="html-comment"&&o.text.startsWith("<!--")&&o.text.endsWith("-->")))),i}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 io(e){return e.replace("<script","<___script").replace("<\/script>","</___script>")}var oo=new $g(e=>{e.escape("<script","<\/script>",t=>io(t)).unescape("<___script","</___script>",t=>t.replace("<___script","<script").replace("</___script>","<\/script>")),e.escape("<script","/>",t=>io(t)).unescape("<___script","/>",t=>t.replace("<___script","<script")),Ma(e)});function Vg(e){const t=Ug(e);if(!(Object.keys(t.output).length>0||Object.keys(t.editor).length>0))return Gs();const n=new Set(Object.keys(t.output).filter(i=>t.output[i]==="html-comment")),r=new Set(Object.keys(t.output));return{isConfigured:()=>!0,toEditorForm:i=>oo.normalizeToPolicy(i,t.editor),toOutputForm:i=>oo.normalizeToPolicy(i,t.output),keepWrappedOnOutput:n,editorPolicy:t.editor,warnAboutUnconfiguredInput:qs(r)}}function qg(e){let t;e.injectFactory(Tr,()=>{const n=e.getInstance(ee)?.layers().user.templateDirectives;return(!t||t.raw!==n)&&(t={raw:n,policy:Vg(n)}),t.policy})}var Gg=[{name:"rest.client",setup:_m},{name:"auth.oauth",setup:Al},{name:"rest.identityHeaders",setup:gm},{name:"lifetime.destroyable",provides:[Wr],setup:vh},{name:"appInit",provides:[Re,Pr],setup:Ic},{name:"config",provides:[ee],setup:mh},{name:"templateDirectives",provides:[Tr],setup:qg},{name:"email.documents",setup:Nh},{name:"show.initPipeline",provides:[we],setup:wm},{name:"show",setup:wg},{name:"locale.service",provides:[wt],setup:fm},{name:"locale.fromConfig",awaits:{services:[ee,wt]},setup:pm},{name:"canvas.early",setup:pp},{name:"canvas.previewSettings",setup:Sp},{name:"canvas.sandboxExtensions",setup:Cp},{name:"canvas.sandboxScriptRelay",setup:Rp},{name:"canvas.headerSync",provides:[Zs],setup:gp},{name:"canvas.ampSync",setup:Td},{name:"canvas.moduleBridge",setup:ef},{name:"canvas.port",setup:Nd},{name:"canvas.images",setup:Ld},{name:"canvas.edits",setup:xf},{name:"canvas.blockContent",setup:Tf},{name:"canvas.sandboxFill",provides:[Gr],setup:zp},{name:"canvas.reactions",setup:fp}],zg=class extends Error{cycle;constructor(e){super(`[units] цикл в зависимостях: ${e.join(" → ")}`),this.cycle=e}};function Wg(e){const t=new Map;for(const n of e)for(const r of n.provides??[]){const i=t.get(r)??[];i.push(n),t.set(r,i)}return t}function Kg(e,t){const n=[];for(const r of e.awaits?.services??[])for(const i of t.get(r)??[])i!==e&&n.push(i);return n}function Na(e){const t=Wg(e),n=[],r=new Set,i=[],o=new Set,s=a=>{if(!r.has(a)){if(o.has(a)){const l=i.indexOf(a);throw new zg([...i.slice(l),a].map(u=>u.name))}o.add(a),i.push(a);for(const l of Kg(a,t))s(l);i.pop(),o.delete(a),r.add(a),n.push(a)}};for(const a of e)s(a);return n}var so;function Zr(e){const t=e.getInstance(te);if(t)return t;e.getInstance(H)||e.inject(H,new Z);const n=ve();e.inject(te,n),so??=Na(Gg);for(const r of so)r.setup(e);return n}function Yg(e){}var Xg=[{name:"save.previewFollow",setup:Yg}],ao=N("plugin.lateUnitsInstalled");function Jg(e){if(!e.getInstance(ao)){e.inject(ao,!0);for(const t of Na(Xg))t.setup(e)}}function Qg(e,t){return{project:Number(e),app_id:t?.app_id||0,app_config:t?.app_config||{},user:t?.user}}function Zg(e){if(!e)return;const t=Bo(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 ev=it(e=>{let t,n,r;return{async setOptions(i){const o=r!==i.getAuthToken,s=!Ie(t,i.user),a=n!==i.project;if(r=i.getAuthToken,t=i.user,n=i.project,!(!e.getInstance(Se)||!i.getAuthToken)&&!(!o&&!s&&!a))try{const l=await i.getAuthToken(i.user,i.project);e.inject(xl,Promise.resolve(l||""));const u=Zg(l);if(!u)return;e.inject(Ul,u);const d=e.getInstance(Re),p=d?await d.catch(()=>{}):void 0;e.inject(Re,Promise.resolve(Qg(u,p)))}catch{}}}});function tv(e,t){if(e.getInstance(ci))return;e.inject(ci,!0);const n=se(e,F.FILE_PROXY_EVENT_ID);t.addDisposable(n(async({url:r})=>(await fetch(r)).blob(),Number.MIN_VALUE))}var nv=it(e=>{let t,n=!1;return{setOptions(r){const i=n;if(n=!0,!Ot(r)){t&&(nh(e),zr(r)),t=void 0;return}const o=hn(r);if(!o||t===o&&e.getInstance(Se))return;t=o,e.inject(Se,o);const s=e.getInstance(H);s&&tv(e,s)}}}),rv=it(e=>{const t=e.getInstance(H),n=se(e,jo),r=j(n),i=t.addDisposable(new Ze(r));return{setOptions({handleLoad:o}){i.setListener(o)},instance:{handleLoad:r},dispose:()=>t.dispose()}});function Fa(e,t,n=!0){const r=e,i=t;for(const o of Object.keys(i)){const s=i[o];s!=null&&(n&&typeof s=="object"?r[o]=Fa(r[o]||{},s,!0):r[o]=s)}return e}async function iv(e){const t=(await Yl(()=>import("./static/esm/2490dab8.js").then(n=>sl(n.default)),[],import.meta.url)).default;return new Promise((n,r)=>{t.load({google:{families:[e]},classes:!1,active:()=>n(),inactive:()=>r(new Error(`Шрифт не загрузился: ${e}`))})})}var ja=N("EditorOptions"),pr=Vl;function ov(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 sv(e){return e.getOrCreateInstance(ja,()=>{const t=ve(pr);let n=pr.fontFamily;return t.watch(r=>{!r.fontFamily||r.fontFamily===n||(n=r.fontFamily,Promise.resolve(iv(r.fontFamily.split(",")[0])).catch(()=>{}))}),t})}function av(e){return e?.getInstance(ja)?.get()??pr}function lv(e,t={}){const n=sv(e);n.set(Fa({...n.get()},ov(t)))}function cv(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 uv(e){return{fontSize:e.fontSize,fontFamily:e.fontFamily,tabSize:e.tabSize,wordWrap:e.wordWrap!=="off",minimap:e.minimap?.enabled,insertSpaces:e.insertSpaces}}var dv=N("plugin.publicConfig");function hr(e){return e.getInstance(ee)?.get()??{}}function lo(e){return e.getInstance(ee)?.layers()??{base:{},profile:{},serverSide:{},user:{},local:{},advancedConfigs:{}}}function co(e){const t=ca(e),n=hr(e);return{...n,locale:n.locale||"en_US",theme:n.theme||"light",editor:uv(av(e)),codeModeDirection:t.isCodeMode?t.direction:"none"}}function uo(e){return e.getInstance(ee)?.get()!==void 0}function fv(e){const t=ko(),n=ae(e,Fo);let r,i,o=!1;const s=async()=>{try{return e.getInstance(Re)===void 0?{}:(await e.getInstanceAsync(Re))?.app_config||{}}catch{return{}}},a=async({onlyChangedCodeMode:p=!1}={})=>{await e.getInstance(ee)?.ready(),qo(e).set(hr(e).revisionService===!0);const{codeModeDirection:b,editor:v}=hr(e);v&&lv(e,cv(v)),b!==void 0&&!(p&&b===i)&&(i=b,b==="none"?or(e,!1):(or(e,!0),eh(e,b)))},l=async()=>{if(!uo(e))return;const p=co(e),b=JSON.stringify(p);b!==r&&(r=b,await n.fire(p))},u=async p=>{const b=e.getInstance(ee),v={advancedConfigs:lo(e).advancedConfigs,serverSide:await s(),user:p};b?.setAdvancedConfigs({...v.advancedConfigs,...v.user?.advancedConfigs}),b?.replace(v.user,"user"),b?.replace(v.serverSide,"server"),await a(),await l()},d=p=>{const{commonStyles:b,...v}=p;return"commonStyles"in p&&wp(e,b===void 0?void 0:b),v};return{queue:t,reactToConfig:a,emitConfigChanged:l,resolveServerSideConfig:s,getConfig:()=>uo(e)?co(e):{},setConfig:t.decorate(async p=>{await u(d(p))}),updateConfig:t.decorate(async p=>{const b=d(p);await u({...lo(e).user,...b})}),announceAssembled(){o||(o=!0,e.getInstance(ee)?.ready().then(t.decorate(async()=>{await a({onlyChangedCodeMode:!0}),await l()})))}}}function Ba(e){return e.getOrCreateInstance(dv,()=>fv(e))}function pv(e){const t=Ba(e);return{getConfig:()=>t.getConfig(),setConfig:n=>t.setConfig(n),updateConfig:n=>t.updateConfig(n)}}var hv=it(e=>{const t=e.getInstance(H),n=t.addDisposable(new Ae),r=t.addDisposable(new Ae),i=Pt(e,Fo),o=j(n.event),s=j(r.event),a=Ra(j(i.event),e),l=t.addDisposable(new Ze(o)),u=t.addDisposable(new Ze(s)),d=t.addDisposable(new Ze(a));return{instance:{handleSetOptions:o,handleOptionsChanged:s,handleConfigChanged:a},async setOptions(p){l.setListener(p.handleSetOptions),u.setListener(p.handleOptionsChanged),d.setListener(p.handleConfigChanged),Ba(e).announceAssembled(),await n.fire(p),await r.fire(p)},dispose(){}}}),Mn,Ua="core";function mv(){const e=window.__useblocks__?.require;return typeof e!="function"?Promise.reject(new Error("[loadCore] AMD loader is unavailable")):new Promise((t,n)=>{e([Ua],r=>t(r),r=>n(r instanceof Error?r:new Error("[loadCore] Failed to require core module")))})}function gv(e){const t=window.__useblocks__?.require?.warm;return typeof t!="function"?kt().then(()=>{}):t([Ua],e)}function kt(){return Mn===void 0&&(Mn=mv().then(e=>(yt()&&e.installDiagnostics().catch(t=>{}),e))),Mn}var Ln=null,kn=null;async function vv(e){typeof e?.prefetch=="function"&&await e.prefetch()}function ei(){return Ln||(Ln=kt().then(()=>{})),Ln}function Ha(e){return kn||(kn=vv(e)),kn}function bv(){return Ha(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}function yv(){const e=typeof window.__useblocks__<"u"?window.__useblocks__:void 0,t=e?.__compatMissingReason;return e&&(e.__compatMissingReason=void 0),typeof t=="string"?t:void 0}function Ev(e){return Promise.all([ei(),Ha(e)]).then(()=>{})}function _v(e){const t=e?.preload?.start??e?.startupPrefetchMode;return t==="eager"||t==="idle"||t==="manual"||t==="off"?t:"idle"}function fo(e,t){const n=e?.preload?.execute!==!1;Promise.resolve().then(()=>gv(t?{priority:t}:void 0)).then(()=>($r(t?{priority:t}:void 0),n?ei():void 0)).catch(()=>{})}function wv(e){const t=_v(e);if(t==="eager")fo(e);else if(t==="idle"){const n=()=>fo(e,"low");document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}}var $a="PluginRegistry";function Sv(e=ml()){return e.getOrCreateInstance($a,()=>new rc)}var Iv=new ic(()=>Sv()),Cv=["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"],Tv=["compileEmail","getBlocks","getComments","getEmail","getEmailRevisions","getEmailSnapshot","save","setConfig","show","updateConfig","useAsync","validateCode","waitPlugin"],ln=new Map([...Cv.map(e=>[e,"event"]),...Tv.map(e=>[e,"async"]),["setEmailMeta","queued"],["setBlockMeta","queued"],["notify","queued"],["getConfig","sync"],["use","sync"],["getElement","element"],["getCodeErrors","codeErrors"],["container","field"],["undoRedoService","field"]]),Av=new Map([["use","use `useAsync()` or await `ready` first"]]);function Rv(e){return Av.get(e)??"await `ready` first"}var Pv=new Set(["async","queued"]),Dv=Symbol.for("emailmaker.earlyCtxPlaceholder");function po(e){return e[Dv]=!0,e}function Ov(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 (${Rv(e)}).`)}function xv(e){return new Error(`[emailmaker] ${e}() is missing from the editor instance after the core has loaded.`)}function Mv(e){return[...ln].filter(([t,n])=>n!=="field"&&e[t]===void 0).map(([t])=>t).sort((t,n)=>t.localeCompare(n))}function Lv(e,t){for(const n of Mv(e)){const r=ln.get(n);if(r!==void 0&&Pv.has(r)){const i=async(...o)=>{await t;const s=e[n];if(typeof s!="function"||s===i)throw xv(n);return s.apply(e,o)};e[n]=po(i);continue}e[n]=po(()=>{throw Ov(n)})}}function kv(e,t,n){e.getInstanceAsync(et).then(()=>{Pt(e,F.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_CREATE_ERROR",data:{plugin:t},innerException:n})},()=>{})}function Nv(e,t){e.getInstanceAsync(et).then(()=>{Pt(e,F.ON_NOTIFICATION).fire({type:"error",id:"PLUGIN_LOAD_ERROR",data:{plugin:t.name,url:t.url,message:t.error.message},innerException:t.error})},()=>{})}var Fv=it(e=>{let t;function n(){return new Promise(i=>{const o=e.getOrCreateInstance(Cr,()=>new Set),s=()=>{o.delete(s),i()};o.add(s)})}function r(){if(!t)throw new Error("PluginCollection not initialized. Call init() first.");return t}return{async setOptions(i){const o=e.getInstance(fn),s=e.getInstance($a);if(!t){t=new nc(o,s,{ensureHostRuntimeReady:bv,explainScriptFailure:yv,openEarlyWindow:()=>hg(e),reportLoadFailure:u=>Nv(e,u)}),e.inject(Ir,t);const l=t.onLifecycle(u=>{u.type==="create:error"&&kv(e,u.name,u.error)});e.getInstance(H)?.addDisposable(l)}const a=i?.plugins||[];o&&(Cs(e),a.length>0&&Lv(o,n()),await t.setPlugins(a))},instance:{use(i){return typeof i=="function"?r().useByCtor(i):r().useByKey(i)},useAsync(i){return r().useAsync(i)},waitPlugin(i){return r().waitFor(i)}},dispose(){t?.dispose(),t=void 0}}}),Va=class{_listeners=[];add(e,t=0,n){const r={fn:n?e.bind(n):e,priority:t};return this._listeners.push(r),{dispose:()=>{const i=this._listeners.indexOf(r);i>=0&&this._listeners.splice(i,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}},jv=N("ELEMENT_INSERT_HTML_PIPELINE"),Bv=N("BLOCK_INSERT_HTML_PIPELINE"),Uv="application_block_inserted",Hv=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(Bv,()=>new Va).add(e,t??0,n)}handleInject(e,t,n){const r=this._container.getOrCreateInstance(At,()=>new Rt),i=n?e.bind(n):e;return r.addListener(Uv,i,t)}},ti=N("ComponentRegistry"),$v=N("ComponentRegistryGate");function ni(){return tt.getOrCreateInstance($v,()=>({pending:[]}))}function Vv(e=ti){return ni().factory!==void 0||tt.getInstance(e)!==void 0}function mr(e,t,n=ti){if(Vv(n)){t(cn(e,n));return}ni().pending.push(()=>t(cn(e,n)))}function cn(e,t=ti){const n=tt.getInstance(t);if(n)return n;const r=ni().factory;if(!r)throw new Error("[extensions] component registry is not loaded yet — UI work starts at init()");return tt.getOrCreateInstance(t,r)}var qv=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 s of t)s.dispose();e(o)}};t.push(this._container.addService(Ft,{execute:o=>{r(o.value.map(s=>({name:s.name,html:s.html})))}}));const i=this._container.getInstance(Tl)?.watch(o=>{o&&r([])});i&&(n?i.dispose():t.push(i))})}update(e,t){const n=this._container;return n.addService(Ft,{execute:r=>{const i=cn(n),o=r.value.find(s=>s.name===e);if(o){const{icon:s,title:a,fallbackTooltip:l,...u}=t;s&&(o.icon=i.getReactNode(s)),a&&(o.title=i.getReactNode(a)),l&&(o.fallbackTooltip=i.getReactNode(l)),Object.assign(o,u)}}})}delete(e){this._container.addService(Ft,{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(Ft,{execute:r=>{const i=cn(n);r.value.splice(t??r.value.length,0,{...e,title:i.getReactNode(e.title),icon:i.getReactNode(e.icon),fallbackTooltip:i.getReactNode(e.fallbackTooltip)})}})}handleBeforeInject(e,t,n){return this._container.getOrCreateInstance(jv,()=>new Va).add(e,t??0,n)}handleInject(e,t,n){return Qe(this._container,vl).event(r=>{e({name:r.name,className:r.className||"",html:r.html})},t,n)}},Gv=class{_messageService;constructor(e){this._messageService=e.container.getOrCreateInstance(At,()=>new Rt)}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 zv(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>n!==void 0))}var Wv=class{_context;_showModalEmitter;_closeModalEmitter;_updateModalEmitter;constructor(e){this._context=e;const t=e.container;this._showModalEmitter=Qe(t,yl),this._closeModalEmitter=Qe(t,gl),this._updateModalEmitter=Qe(t,ql)}get _container(){return this._context.container}show(e){const t=`modal_${Date.now()}_${Math.random().toString(36).substr(2,9)}`,n=e.modalProps;return mr(this._container,r=>{this._showModalEmitter.fire({...e,content:r.getReactNode(e.content),title:r.getReactNode(e.title),id:t,modalProps:n?{...n,footer:r.getReactNode(n.footer),okText:r.getReactNode(n.okText),cancelText:r.getReactNode(n.cancelText),closeIcon:r.getReactNode(n.closeIcon)}:void 0})}),t}close(e){this._closeModalEmitter.fire(e)}closeAll(){this._closeModalEmitter.fire()}update(e,t){const n=t.modalProps;mr(this._container,r=>{this._updateModalEmitter.fire(zv({...t,content:r.getReactNode(t.content),title:r.getReactNode(t.title),id:e,modalProps:n?{...n,footer:r.getReactNode(n.footer),okText:r.getReactNode(n.okText),cancelText:r.getReactNode(n.cancelText),closeIcon:r.getReactNode(n.closeIcon)}:void 0}))})}},Kv=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=i=>{this._loadedSettled||(this._loadedSettled=!0,r(i))}}),this.ready=new Promise((n,r)=>{this._resolveReady=()=>{this._readySettled||(this._readySettled=!0,n())},this._rejectReady=i=>{this._readySettled||(this._readySettled=!0,r(i))}})}_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)}},Yv=class{_context;constructor(e){this._context=e}get _container(){return this._context.container}get _messageService(){return this._container.getOrCreateInstance(At,()=>new Rt)}_createScriptHandle(e,t){const n=this._messageService.addListener(wr,i=>{if(i.key===e){if(i.phase==="load"&&i.status==="success"){r.resolveLoaded();return}if(i.phase==="ready"&&i.status==="success"){r.resolveReady();return}if(i.phase==="load"){r.rejectLoad(new Error(i.error||`Sandbox script "${e}" failed to load.`));return}r.rejectReady(new Error(i.error||`Sandbox script "${e}" failed to initialize.`))}}),r=new Kv(t,n);return r}registerSandboxCSS(e){return this._container.addService(Ye,{type:"link",key:e,parent:"head",attributes:{rel:"stylesheet",type:"text/css",href:e}})}registerSandboxCSSCode(e,t){return this._container.addService(Ye,{type:"style",key:e,parent:"head",attributes:{type:"text/css"},innerHTML:t})}registerSandboxScript(e){const t=this._container.addService(Ye,{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(Ye,{type:"script",key:e,parent:"head",attributes:{type:"text/javascript"},innerHTML:t});return this._createScriptHandle(e,n)}},Xv=new Set([Symbol.for("react.element"),Symbol.for("react.transitional.element")]);function gr(e){if(typeof e!="object"||e===null)return!1;const t=e.$$typeof;return typeof t=="symbol"&&Xv.has(t)}function qa(){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 Nn(){return`__settingsPanel:${qa()}`}function Fn(e,t){return{type:e,props:t}}function Jv(e){return typeof e=="object"&&e!==null&&"type"in e&&"props"in e&&!gr(e)}function ho(e,t,n){if(t==null||typeof t=="number"||typeof t=="boolean"||typeof t=="string")return t;if(gr(t)){const r=Nn();return n(e.add(r,t)),Fn(r,{})}if(typeof t=="function"){const r=Nn();return n(e.add(r,t)),Fn(r,{})}if(Jv(t)){const r=t.type;if(typeof r=="string")return t;if(gr(r)||typeof r=="function"){const i=Nn();return n(e.add(i,r)),Fn(i,t.props)}return t}return t}var Qv=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??qa();mr(this._container,n=>{const r=s=>this._trackRegistration(s),i=ho(n,e.content,r),o=e.advancedTabs?.map(s=>({...s,content:ho(n,s.content,r)}));Qe(this._container,li).fire({...e,content:i,advancedTabs:o,instanceKey:t,type:ll})})}closeSettingsPanel(){this._clearPanelRegistrations(),Qe(this._container,li).fire(null)}},Ga={SandboxScriptApi:Yv,ElementsApi:qv,BlocksApi:Hv,MessageService:Gv,SettingsPanelApi:Qv,ModalApi:Wv};function jn(e,t,n,r={}){const i=Object.assign({},e);for(const[o,s]of Object.entries(t))if(s!==void 0)if(n.includes(o)&&typeof s=="object"&&s!==null){const a=i[o],l=r[o]??{};i[o]=Object.assign({},typeof a=="object"&&a!==null?a:l,s)}else i[o]=s;return i}var ue={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}},Zv={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"},Bn={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},mo={color:"#1C52DC",contrastColor:"#FFFFFF",underline:!0},ze={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:ue.border,borderRadius:ue.borderRadius,textAlign:"center",padding:ue.padding},go={backgroundColor:"#FFFFFF",contrastBackgroundColor:"#1C52DC",padding:ue.padding},Un={contrastBackgroundColor:"#1C52DC",contrastTextColor:"#FFFFFF",baseBackgroundColor:"#F8F8F8",baseTextColor:"#333333",border:ue.border,borderRadius:ue.borderRadiusCards};function eb(e){return{...Zv,...e}}function tb(e){return{...Bn,...e,bold:e?.bold??Bn.bold,italic:e?.italic??Bn.italic}}function nb(e){return{...mo,...e,underline:e?.underline??mo.underline}}function rb(e){return{...ze,...e,bold:e?.bold??ze.bold,italic:e?.italic??ze.italic,border:{...ze.border,...e?.border},borderRadius:{...ze.borderRadius,...e?.borderRadius},padding:{...ze.padding,...e?.padding}}}function ib(e){return{...go,...e,padding:{...go.padding,...e?.padding}}}function ob(e){return{...Un,...e,border:{...Un.border,...e?.border},borderRadius:{...Un.borderRadius,...e?.borderRadius}}}function Hn(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={...Sr};try{e&&e!=="{}"&&(t=JSON.parse(e))}catch{}return t}function $n(e){return{text:eb(e.text),headings:tb(e.headings),links:nb(e.links),buttons:rb(e.buttons),block:ib(e.block),cards:ob(e.cards)}}var bo=N("EmailSettingsPort"),sb=1e4,za=class{_editor;_layoutSettingsChanged=new zn;_contentStylesChanged=new zn;_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(!Aa(this._editor.container)||!Xe(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(bo);if(!t)throw new Error("[extensions] email settings are not loaded yet — UI work starts at init()");return t}_getCurrentLayoutSettings(){return Hn(this._settings().read())}_getCurrentContentStyles(){const e=Xe(this._editor.container)?.current()?.get().attributes.common_styles;return $n(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(At,()=>new Rt),t=this._getCurrentLayoutSettings(),n=this._getCurrentContentStyles();this._prevLayoutSnapshot=this._getLayoutSnapshot(t),this._prevContentSnapshot=this._getContentSnapshot(n),this._messageSubscription=e.addListener(r=>{const i=r?.data,o=i?.operation;if(o===$.APPLICATION_EMAIL_SETTINGS_SET){const l=Hn(i?.settings),u=this._getLayoutSnapshot(l);u!==this._prevLayoutSnapshot&&(this._prevLayoutSnapshot=u,this._layoutSettingsChanged.fire(l));return}if(o!==$.APPLICATION_COMMON_STYLES_UPDATE)return;const s=$n(r.data?.settings?.commonStyles??{...Sr}),a=this._getContentSnapshot(s);a!==this._prevContentSnapshot&&(this._prevContentSnapshot=a,this._contentStylesChanged.fire(s))})})();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=Hn(n);this._prevLayoutSnapshot=this._getLayoutSnapshot(r),this._layoutSettingsChanged.fire(r)}async _waitForEmailSettingsFromIframe(e=sb){const t=Xe(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,i=se(r,F.ON_EMAIL_INIT_ID);return new Promise(o=>{let s=!1,a;const l=()=>{a&&(clearTimeout(a),a=void 0)},u=i(()=>{s||(s=!0,l(),u.dispose(),o())});a=setTimeout(()=>{s||(s=!0,u.dispose(),o())},e)})}async getEmailContentStyles(){return this._getCurrentContentStyles()}async setEmailContentStyles(e){const t=Xe(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=jn(n.buttons||{},e.buttons,["border","borderRadius","padding"],{border:ue.border,borderRadius:ue.borderRadius,padding:ue.padding})),e.block!==void 0&&(n.block=jn(n.block||{},e.block,["padding"],{padding:ue.padding})),e.cards!==void 0&&(n.cards=jn(n.cards||{},e.cards,["border","borderRadius"],{border:ue.border,borderRadius:ue.borderRadiusCards}));const r=JSON.stringify(n);_t(t,{common_styles:r},{source:"system"}),this._settings().markAppearanceChanged();const i=$n(n);this._prevContentSnapshot=this._getContentSnapshot(i),this._contentStylesChanged.fire(i)}},ab={...Ga,EmailSettingsApi:za},lb={...Ga},cE={...lb,EmailSettingsApi:za},cb={...ab};function ub(){Iv.addAll(cb)}var db=[it(()=>{ub()}),rv,hv,nv,kl,ev,Gl];async function fb(){return(await kt()).asyncMixins}var pb=Fv,hb=e=>{let t=null,n=!1;return{instance:{},async setOptions(r){if(!t&&!n){let i;try{i=await fb()}catch(s){throw e.failPendingWaits(s),s}t=i(e);const o=await e.getInstanceAsync(fn);Object.assign(o,t.instance||{});for(const s of e.getInstance(Cr)??[])s()}t&&await t.setOptions(r)},dispose(){t?.dispose(),n=!0}}},mb=$l([...db]);function Vn(){let e,t=!1;const n=new Map,r=new Map;function i(){for(const o of r.values())o();r.clear()}return{event(o,s,a){const l=Symbol("subscription");return t||(n.set(l,{listener:o,priority:s,thisArg:a}),e&&r.set(l,e(o,s,a))),()=>{n.delete(l),r.get(l)?.(),r.delete(l)}},attach(o){i(),e=o;for(const[s,{listener:a,priority:l,thisArg:u}]of n)r.set(s,o(a,l,u))},dispose(){t=!0,i(),n.clear(),e=void 0}}}function gb(e){const t=Vn(),n=Vn(),r=Vn();return e.getInstance(H)?.addDispose(()=>{t.dispose(),n.dispose(),r.dispose()}),e.getInstanceAsync(et).then(i=>{t.attach(i.onNotify),n.attach(i.onError),r.attach(i.onSuccess)},()=>{}),{handleNotify:t.event,handleError:n.event,handleSuccess:r.event,notify(i){const o=e.getInstance(et);if(o){o.notify(i);return}e.getInstanceAsync(et).then(s=>s.notify(i),()=>{})}}}var Wa=N("CodeErrors"),vb=[];function bb(e){return e?.getInstance(Wa)?.get()??vb}function yb(e){return e?.getInstance(Wa)!==void 0}var Eb=class extends Z{_container;_dataSources;_currentEmail;_blockMetaWrites=Promise.resolve();constructor(e){super(),this._container=e,this._dataSources=Lt(e),this.addDisposable(se(e,F.ON_EMAIL_CHANGED_ID)(t=>{this._currentEmail=t}))}openEmail(){return Sa(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=>dt(t,this._container))}async _readProjectBlocks(){const e=await xm(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=>ft(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=>ur(n,this._container))}async getEmailSnapshot(){return oe(this.openEmail(),this._container)}setEmailMeta(e){const t=Jr(this._container);if(!t)return;const n=t.get().attributes.meta;_t(t,{meta:Rn({meta:n},e).meta});const r=t.get().serverId;r!=null&&this._dataSources.emails.cache.addOrUpdate(r,i=>i&&Rn(i,e))}setBlockMeta(e,t){const n=async()=>{await this._readProjectBlocks();const{cache:r}=this._dataSources.blocks;await r.getIfPresent(e)&&await r.addOrUpdate(e,i=>i&&Rn(i,t))};this._blockMetaWrites=this._blockMetaWrites.then(n).catch(()=>{})}getCodeErrors(){return yb(this._container)?bb(this._container):void 0}},_b=N("EmailDataController");function wb(e){return e.getOrCreateInstance(_b,()=>{const t=new Eb(e);return e.getInstance(H)?.addDisposable(t),t})}function Sb(e){const t=wb(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 Ib(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 Cb(e){let t;const n=da(e),r=se(e,F.ON_DOCUMENT_SESSION_CHANGE);n.addDisposable(r(({history:o})=>{t=o}));const i=()=>t?Ib(t):void 0;return{undoRedoService:{undo:()=>i()?.undo(),redo:()=>i()?.redo(),clear:()=>i()?.clear(),getPast:o=>i()?.getPast(o)??[],getFuture:o=>i()?.getFuture(o)??[],canUndo:()=>i()?.canUndo()??!1,canRedo:()=>i()?.canRedo()??!1,createSnapshot:()=>i()?.createSnapshot(),restoreSnapshot:o=>i()?.restoreSnapshot(o)}}}var Tb=N("plugin.mountElement");function Ab(e){const t=e.getInstance(te)?.get()?.element;if(typeof Element<"u"&&t instanceof Element||typeof DocumentFragment<"u"&&t instanceof DocumentFragment)return t}function Rb(e){return e.getOrCreateInstance(Tb,()=>{let t=!1,n;return{get:()=>t?n:Ab(e),set(r){t=!0,n=r}}})}function Pb(e){const t=Rb(e);return{getElement:()=>t.get()}}function Db(e){return{handleLoadImage:j(se(e,F.UPLOAD_EVENT_ID)),handleFileProxy:j(se(e,F.FILE_PROXY_EVENT_ID)),handleUrlProxy:j(se(e,F.PROXY_URL_EVENT_ID)),handleAITextRequest:j(se(e,F.AI_TEXT_REQUEST_ID)),handleAIImageRequest:j(se(e,F.AI_IMAGE_REQUEST_ID)),handleReadLocale:j(se(e,F.READ_LOCALE)),handleLimitUsage:j(se(e,F.ON_LIMIT_ID)),handleTranslate:j(se(e,F.ON_TRANSLATE_ID))}}var Ob=[bh,Sg,gb,pv,Sb,Cb,Pb,Db];function xb(e,t=Ob){const n=Zr(e);Jg(e);const r=mb(e),i=pb(e),o=hb(e),s={...r.instance,...i.instance,...o.instance};for(const l of t)Object.assign(s,l(e));let a=!0;return{instance:s,async setOptions(l){await r.setOptions(l);const u=a&&n.get()===l;a=!1,u||n.set(l),await i.setOptions(l),await o.setOptions(l)}}}var Mb=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]}},Lb="editor-runtime.react.copies",qn=8;function St(e){return e&&typeof e=="object"?e:void 0}function yo(e){const t=St(e);if(!t)return;if(typeof t.useState=="function")return t.useState;const n=St(t.default);return n&&typeof n.useState=="function"?n.useState:void 0}function kb(e){const t=St(e),n=t&&typeof t.version=="string"?t.version:void 0,r=St(t?.default),i=r&&typeof r.version=="string"?r.version:void 0;return n??i??"unknown"}function Nb(e,t,n){return e.package===t&&e.version===n}function Fb({ourReact:e,entries:t,packageName:n,version:r}){const i=yo(e);if(!i||!Array.isArray(t))return[];const o=[],s=new Set;for(const a of t){const l=St(a);if(!l||!Nb(l,n,r))continue;const u=yo(l.react);!u||u===i||s.has(u)||(s.add(u),o.push({package:n,version:r,reactVersion:kb(l.react),react:l.react}))}return o}function jb({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,qn))n.push(` • React ${r.reactVersion}, loaded through ${r.package}@${r.version}/runtime/react`);return t.length>qn&&n.push(` …and ${t.length-qn} 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(`
|
|
1048
|
+
`)}var Eo=new Set;function Bb({packageName:e="useblocks",version:t="1.1.85-dev.11",log:n=r=>{}}={}){const r=i=>{try{const o=globalThis[Symbol.for(Lb)],s=Fb({ourReact:i,entries:o,packageName:e,version:t}).filter(a=>!Eo.has(a.react));if(!s.length)return;s.forEach(a=>Eo.add(a.react)),n(jb({packageName:e,copies:s}))}catch{}};try{const i=Rr()?.modules?.React;if(i&&typeof i.then=="function"){i.then(r,()=>{});return}r(i)}catch{}}async function Ub(e,t,n){z(e.signal);const r=t??tt.createChild();Zr(r);const i=r.getInstance(H);let o;async function s(){r.inject(Il,new Mb),Bb();const a=xb(r),l={...a.instance,container:r,get ready(){return o??Promise.resolve(l)},async reset(u){if(z(u.signal),i.isDisposed())throw Te();return await a.setOptions(u),l}};r.inject(fn,l);try{if(n?.onInstance?.(l),await a.setOptions(e),z(e.signal),i.isDisposed()||await Eg(r),e.devTools)try{const u=r.getInstance(Ir);u&&await(await kt()).initDevTools(r,u)}catch{}return z(e.signal),Pt(r,jo).fire(l),l}catch(u){throw i.dispose(),u}}try{return o=en(s(),e.signal),o.catch(()=>{}),await o}catch(a){throw i.isDisposed()||i.dispose(),a}}var It=new WeakMap;function Hb(e){return e?It.get(e):void 0}function Ka(e){try{e.getInstance(H)?.dispose()}catch{}try{e.dispose()}catch{}}function $b(e,t){if(!e)return;const n=It.get(e);n&&n!==t&&Ka(n),It.set(e,t)}function Vb(e,t){e&&It.get(e)===t&&It.delete(e)}function qb(e){const t=tt.createChild();return Ot(e)&&t.inject(Se,hn(e)),t}var bt=new WeakMap,Gb="data-useblocks-config-styles";function zb(e){return typeof e=="string"?e.trim():""}function _o(e,t){if(e.firstChild){e.insertBefore(t,e.firstChild);return}e.appendChild(t)}function Wb(e,t,n){if(!e||typeof document>"u")return null;const r=zb(t),i=bt.get(e),o=n||e;if(!r)return i&&(i.remove(),bt.delete(e)),null;if(i)return i.textContent!==r&&(i.textContent=r),(i.parentNode!==o||i!==o.firstChild)&&_o(o,i),i;const s=document.createElement("style");return s.setAttribute(Gb,"true"),s.textContent=r,_o(o,s),bt.set(e,s),s}function Kb(e){if(!e)return;const t=bt.get(e);t&&(t.remove(),bt.delete(e))}function Ya(){return!1}var Yb=`
|
|
1049
1049
|
.blocks-app-initial-spinner-wrapper {
|
|
1050
1050
|
width: 100%;
|
|
1051
1051
|
height: 100%;
|
|
@@ -1074,7 +1074,7 @@ import{t as Bi}from"./static/esm/50fbfdf6.js";import{$ as Ns,A as Fs,At as N,B a
|
|
|
1074
1074
|
100% {
|
|
1075
1075
|
transform: rotate(360deg);
|
|
1076
1076
|
}
|
|
1077
|
-
}`;function Wm(){return()=>{}}function Ym(e,t){if(!Is()||!e||typeof document>"u")return Wm();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.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 i=document.createElement("style");i.setAttribute(t,"true"),i.textContent=Km,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function Xm(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function Jm({report:e}={}){const t=new Map,n=new Set,r=e??(i=>{});return{run(i,o){const s=t.get(i);if(s!==void 0)return s;const l=o().catch(d=>{throw n.has(i)||(n.add(i),r(d)),Xm(d)||t.delete(i),d});return t.set(i,l),l},clear(){t.clear(),n.clear()},size(){return t.size}}}var br=Jm();function As(){br.clear()}Bs(()=>br.clear());var Pi=new WeakMap,Di=new WeakMap;function Qm(e,t){let n=Di.get(t);n||(n=new Map,Di.set(t,n));const r=n.get(e);if(r!==void 0)return r;const i=t.getInstance(Ui),o=Ia({baseUrl:e,customFetch:i?.execute??fetch},t);return n.set(e,o),o}function yr(e){return Zs(e)}function Zm(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function eg(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function tg(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 Er=new WeakMap;function gn(e,t){Er.set(e,t)}function ng(e){return Er.get(e)}function rg(e,t){return async({baseUrl:n})=>{const r=t();if(!r)throw new Error("[Loader] appInit requires the instance container");const i=Er.get(r)??e,o=yr(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json"});if(i.getAuthToken&&!await tg(i))throw eg();const l=new Yi(Qm(o,r)),d={headers:Object.fromEntries(s.entries()),credentials:"same-origin",failoverAttemptTimeout:gr(i)||void 0},u=await l.app_init_create({},d);if(!u.ok)throw Zm(u.status,u.statusText);return u.data}}function ig(e){return JSON.stringify({baseUrl:yr(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function og(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function sg(e){return t=>br.run(ig(t),()=>(W("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>W("appInit:end",{kind:"network"}))))}function ag(e,t){if(Gt(e)||!e.appInit&&!yr(e.baseUrl)||!og(e))return e;const n=e.appInit??rg(e,t);let r=Pi.get(n);return r||(r=sg(n),Pi.set(n,r)),{...e,appInit:r}}var Cs=0;function lg(){return Cs}function dg(){Cs+=1,As()}var Oi=new WeakMap,xi=new WeakMap,cg=3e4;function ug(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function fg(e,t){try{const n=zi(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+cg}function pg(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=ug(r,i);if(o)return n.delete(s),t.delete(s),As(),e(r,i,o);const l=n.get(s);if(l&&!t.has(s)){if(l.expiresAtMs>Date.now())return l.token;n.delete(s)}let d=t.get(s);return d===void 0&&(W("authToken:start",{kind:"network"}),d=Promise.resolve(e(r,i,o)).then(u=>{const h=String(u||"").trim();return h&&n.set(s,{token:u,expiresAtMs:fg(h,Date.now())}),u}).finally(()=>{W("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,d)),d}}function hg(e){if(Gt(e))return e;const t=e.getAuthToken;if(!t)return e;let n=Oi.get(t);const r=lg();return(!n||xi.get(t)!==r)&&(n=pg(t),Oi.set(t,n),xi.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var mg="[emailmaker] This editor instance was taken over by a later init()/create() into the same element. Get the current one with getInstance(element).";function gg(){const e=new Error(mg);return e.name="EditorReleasedError",e}var vg="[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 bg(e){const t=new Error(vg,{cause:e});return t.name="EditorStartFailedError",t}var qe=new WeakMap,Mt=new WeakMap;function Ts(e,t){qe.set(e,t),Mt.get(e)?.forEach(n=>n())}function yg(e,t){const n=Mt.get(e)??new Set;return n.add(t),Mt.set(e,n),()=>n.delete(t)}function vn(e){const t=(qe.get(e)??0)+1;return Ts(e,t),t}var Lt=new WeakMap;function Eg(e,t){const n=Lt.get(e)??new Set;n.add(t),Lt.set(e,n)}function _g(e,t,n){return qe.get(e)!==t?!0:Lt.get(e)?.has(n)?!1:(Ts(e,n),!0)}function Mi(e,t){return Lt.get(e)?.has(t)===!0}var Rs=new WeakMap;function wg(e,t){Rs.set(e,{reason:t}),Mt.get(e)?.forEach(n=>n())}function bn(e){return Rs.get(e)}function _t(e,t){return qe.get(e)===t}var Bn=new WeakMap;function Sg(e,t){const n=Bn.get(e)??new Set;n.add(t),Bn.set(e,n)}function Ig(e,t){const n=qe.get(e);return n!==void 0&&n!==t&&Bn.get(e)?.has(n)===!0}function Li(e){return qe.get(e)??0}var Ag=new Set(["setConfig","updateConfig","show","save","getEmailSnapshot","getEmail","compileEmail","getBlocks","getEmailRevisions","getComments","validateCode","reset","useAsync"]),Cg=new Set(["setEmailMeta","setBlockMeta","notify"]),Ps=new Map([["getConfig","await `ready` first"],["use","use `useAsync()` or await `ready` first"],["container","await `ready` first"],["undoRedoService","await `ready` first"]]);function ki(e){if(/^handle[A-Z]/.test(e))return"event";if(Ag.has(e))return"async";if(Cg.has(e))return"queued";if(e==="getElement")return"element";if(e==="getCodeErrors")return"codeErrors";if(Ps.has(e))return"notReady"}function Tg(e){return Ps.get(e)??"await `ready` first"}function Ni(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}function Rg(e,t){let n,r=0,i,o,s="pending",l,d,u,h;const g=new Set,E=[];let b,w;const _=new Promise((P,O)=>{b=P,w=O});_.catch(()=>{});const m=P=>n?.[P],S=()=>s==="pending"||n!==void 0&&_t(n,r)&&bn(n)===void 0,y=P=>{const O=m(P.name);P.dispose||typeof O!="function"||!S()||(P.dispose=O(...P.args))},I=()=>g.forEach(y),T=()=>{for(const P of g)P.dispose?.(),P.dispose=void 0},R=()=>I(),v=()=>{s==="ready"&&(S()?I():T())},f=()=>{u?.delete(R),u=void 0},a=()=>{h?.(),h=void 0,T(),g.clear(),f(),E.length=0,n=void 0},c=()=>s==="failed"?l:Yn(),p=()=>{if(s!=="ready"||n===void 0)return;if(Ig(n,r))return gg();const P=bn(n);return P?bg(P.reason):void 0},A=(P,O,H)=>{if(s==="failed"||s==="destroyed")throw c();const M=p();if(M)throw M;const k=m(P);if(typeof k!="function")throw Ni(P);return k.apply(H,O)},x=()=>s==="ready"?Promise.resolve():s==="pending"?_:Promise.reject(c()),j=(P,O)=>{if(s==="failed"||s==="destroyed")throw c();if(s==="ready"&&typeof m(P)!="function")throw Ni(P);const H={name:P,args:O};return g.add(H),y(H),()=>{g.delete(H),H.dispose?.(),H.dispose=void 0}},C=()=>{const P=e.element;return P!==void 0&&typeof P!="string"?P:void 0},L=new Proxy({},{get(P,O,H){if(typeof O!="string"||O==="then")return;const M=ki(O);if(M==="event")return(...k)=>j(O,k);if(O==="reset")return(...k)=>x().then(()=>A(O,k,H)).then(()=>G);if(s==="pending"&&(M==="queued"||M==="codeErrors"))return M==="codeErrors"?()=>[]:(...k)=>{E.push({name:O,args:k})};if(n&&O in n){const k=p();if(k){if(typeof m(O)!="function")throw k;return M==="async"?()=>Promise.reject(k):()=>{throw k}}return Reflect.get(n,O,H)}switch(M){case"async":return(...k)=>x().then(()=>A(O,k,H));case"queued":return(...k)=>{if(s!=="pending")return A(O,k,H);E.push({name:O,args:k})};case"element":return C;case"codeErrors":return()=>[];case"notReady":throw new Error(`[emailmaker] \`${O}\` is not available before the editor is ready: ${Tg(O)}`);default:return O in Object.prototype?Reflect.get(Object.prototype,O,H):void 0}},has(P,O){return typeof O!="string"?!1:n!==void 0&&O in n||ki(O)!==void 0}}),G=Object.create(L);return Object.defineProperty(G,"ready",{get:()=>d,enumerable:!0}),Object.defineProperty(G,"destroy",{enumerable:!0,value:()=>{if(s==="destroyed"||s==="failed")return;if(s==="pending"){const M=i!==void 0&&n!==void 0&&_t(n,r),k=n;s="destroyed",d?.catch(()=>{}),t(te("[emailmaker] editor was destroyed before it was ready")),M&&(a(),k?.destroy());return}const P=n!==void 0&&_t(n,r),O=n,H=O!==void 0&&bn(O)!==void 0;s="destroyed",a(),!H&&(P?O?.destroy():O&&Eg(O,r))}}),{handle:G,bind:(P,O)=>{O?.adopt&&s==="pending"&&i===void 0?(i=Li(P),o=P,r=vn(P)):!O?.adopt&&n!==P&&(i=void 0,o=void 0),n!==P&&(T(),f(),n=P,I(),s==="pending"&&(u=P.container.getOrCreateInstance(Vi,()=>new Set),u.add(R)))},settle:()=>{const P=n;if(s==="destroyed"){a(),P&&(vn(P),P.destroy());const O=te("[emailmaker] editor was destroyed before it was ready");throw l=O,w(O),O}P&&i===void 0&&Li(P)===0&&(r=vn(P)),s="ready",P&&(Sg(P,r),h=yg(P,v),v()),f();for(const O of E.splice(0))try{A(O.name,O.args,G)}catch(H){queueMicrotask(()=>{throw H})}b()},fail:P=>{s!=="destroyed"&&(s="failed",l=P),a(),w(P)},canHandBack:()=>o!==void 0&&i!==void 0&&s!=="destroyed"&&_t(o,r)&&!Mi(o,i),finishAdoption:(P,O)=>{const H=o,M=i;if(o=void 0,i=void 0,!H||M===void 0||s==="destroyed")return;const k=!P||Mi(H,M);if(k&&wg(H,O),!_g(H,r,M)||k)try{H.destroy()}catch{}},setReady:P=>{d=P},isCurrent:()=>s==="pending"||s==="ready"&&p()===void 0}}var Ds="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function Pg(){return te(Ds)}function Dg(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Ds}function Og(e,t,n){if(typeof document>"u")return;let r=!1,i;const o=()=>{r=!0,i?.disconnect(),i=void 0},s=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(s);return}i=new MutationObserver(()=>{e.isConnected||s()});let l=e.parentNode;for(;l;)i.observe(l,{childList:!0}),l=l.parentNode}function xg(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:i}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return Og(n,()=>{n.id,o.abort(Pg())},i),Kn(r,o.signal)}var Os="Superseded by newer init() on the same mount element";function Mg(){return te(Os)}function Lg(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===Os}var Ve=new Map,wt=new WeakMap;function kg(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Ng(e){if(!e)return{previous:Promise.resolve(),release:()=>{}};const t=kg(e);(t?Ve.get(t):void 0)?.forEach(d=>{d.element!==e&&d.controller.abort(Mg())});const n=wt.get(e)??Promise.resolve();let r;const i=new Promise(d=>{r=d}),o=n.then(()=>i);wt.set(e,o),o.then(()=>{wt.get(e)===o&&wt.delete(e)});const s=new AbortController,l={element:e,controller:s};if(t){const d=Ve.get(t)??new Set;d.add(l),Ve.set(t,d)}return{signal:s.signal,previous:n,release:()=>{r();const d=t?Ve.get(t):void 0;t&&d?.delete(l)&&d.size===0&&Ve.delete(t)}}}var kt=new WeakMap;function xs(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function Un(e){return Object.entries(e).filter(([t,n])=>xs(t,n)).map(([t])=>t).sort()}function Fi(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!xs(n,r)&&(t[n]=r);return t}function Hn(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:kt.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},kt.set(e,r));const{current:i,trampolines:o}=r;i.clear();const s={...t};for(const l of Un(t)){i.set(l,t[l]);let d=o.get(l);d||(d=(...u)=>i.get(l)?.(...u),o.set(l,d)),s[l]=d}return r.lastOptions=t,s}function Fg(e){const t=e?kt.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((i,o)=>t.current.set(o,i)),t.lastOptions=r}}function jg(e,t,n){const r=e?kt.get(e):void 0;if(!r||!n)return!1;const i=Un(t),o=je(i,Un(r.lastOptions)),s=i.every(l=>l==="getAuthToken"||n[l]===r.trampolines.get(l));return!o||!s||!je(Fi(t),Fi(r.lastOptions))?!1:(Hn(e,t),!0)}var Ze=new WeakMap;function Bg(e,t){const n=Ze.get(e)??[];n.push(t),Ze.set(e,n)}function Ug(e){const t=Ze.get(e);if(!t)return;const n=t.filter(r=>r.isCurrent());if(n.length===0){Ze.delete(e);return}return Ze.set(e,n),n[n.length-1].handle}var lv=Bi({FileManagerApiError:()=>Hg}),Hg=class Ms extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,i){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,Ms)}},dv=Bi({mapHttpStatusToErrorCode:()=>Xs});function $g(e,t){return{...e,element:t}}function $n(){return()=>{}}function Gg(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?$n():(zm(t,e.config?.styles,t),()=>{Vm(t)})}function qg(e){if(!Is()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:$n()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:$n()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Ym(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function zg(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function ji(e){try{e.destroy()}catch{}}function et(e,...t){const n=ae.get(e);t.some(r=>r!==void 0&&r===n)&&ae.delete(e)}var cv="1.1.85-dev.10";async function uv(e){lr(),await zh(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}async function fv(e){return Vg(e).ready}function Vg(e){W(Z.initStart);const t=new AbortController,n=Kn(e.signal,t.signal),r=Rg(e,s=>t.abort(s)),i=s=>Bg(s,r),o=Jg({...e,signal:n},r,i).then(()=>(W(Z.initEnd),r.settle(),r.handle),s=>{throw r.fail(s),s});return r.setReady(o),r.handle}function pv(e){const t=typeof e=="string"?document.querySelector(e):e;return t?Ug(t):void 0}function Kg(e){let t,n,r=!1;try{t=e.container.getInstance(ne)?.get(),n=e.container.getInstance(he)?.externalSignal;const i=Ye(e.container)?.current();r=i!==void 0&&i.get().savedVersion!==null&&i.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Wg(e),dirty:r}}async function Wg(e){try{return await e.getEmailSnapshot()}catch{return}}function Yg(e){const t=Ye(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}async function Xg(e,t,n,r,i){if(r.fail(i),Lg(i)||Dg(i)||!r.canHandBack()){r.finishAdoption(!0,i);return}const{options:o}=n;if(!o){et(t,e),r.finishAdoption(!1,i);return}const s=await n.email,l=s&&(o.content!==void 0||s.id!==void 0)?s:void 0,d=typeof o.content=="object"&&"email"in o.content?o.content:void 0;try{await e.reset({...o,signal:o.signal??n.signal,content:l?{...d,email:l}:o.content}),n.dirty&&l&&Yg(e),r.canHandBack()&&ae.set(t,e),r.finishAdoption(!0,i)}catch{et(t,e),r.finishAdoption(!1,i)}}async function Jg(e,t,n){z(e.signal);const r=new Q;let i,o;try{const s=await va(e.element,r,e.signal);s&&n(s);const l=xg({hostElementOption:e.element,resolvedElement:s,externalSignal:e.signal,disposable:r}),d=Ng(s);i=d.release;const u=Kn(l,d.signal);return z(u),await Ct(d.previous,u),o=Qg(e,s,t,u),await Ct(o,u)}finally{const s=i;o!==void 0&&s?o.then(s,s):s?.(),r.dispose()}}async function Qg(e,t,n,r){const{bind:i}=n;z(r);let o;const s=b=>{dg();const w=hg($g(b,t)),_=ag(w,()=>o);return{preparedOptions:_,preparedOptionsWithSignal:r!=null?{..._,signal:r}:_}};let l;if(t){const b=ae.get(t);if(b){let w;try{w=await b,z(r)}catch{z(r),et(t,b),w=void 0}if(w)if(w.getElement()===t){const _=Bm(t);o=_;const m=w.container.getInstance(ne)?.get();if(jg(t,e,m))return i(w,{adopt:!0}),r&&w.container.getInstance(he)?.relinkExternalSignal(r),ae.set(t,w),w;const S=Fg(t);l=s(Hn(t,e));const{preparedOptions:y,preparedOptionsWithSignal:I}=l,T=_&&ng(_),R=Kg(w);try{_&&gn(_,y),i(w,{adopt:!0});const v=await w.reset(zg(e,I));return z(r),ae.set(t,w),v}catch(v){if(_&&T&&gn(_,T),!Va(v))throw S(),await Xg(w,t,R,n,v),v;n.finishAdoption(!1,v),et(t,b,w),ji(w),z(r)}}else et(t,b,w),ji(w)}}z(r),l??=s(Hn(t,e,{fresh:!0}));const{preparedOptions:d}=l,u=Gg(d),h=qg(d),g=r!=null?{...h.options,signal:r}:h.options;let E;try{o=$m(g),Um(t,o),gn(o,d),mr(o).set(g),await vr(),W(Z.coreReady),z(r),z(r),E=jm(g,o,{onInstance:i}),t&&ae.set(t,E);const b=await E;if(r?.aborted&&(b.destroy(),z(r)),t)if(ae.get(t)===E)ae.set(t,b);else throw b.destroy(),z(r),te(r?.reason);return b}catch(b){throw u(),h.cleanup(),o&&(Ss(o),Hm(t,o)),t&&E&&ae.get(t)===E&&ae.delete(t),b}}async function hv(e){return(await dt()).parseAMP(e)}typeof window<"u"&&(tt()&&qa(),Kh(typeof window.__useblocks__<"u"?window.__useblocks__:void 0));export{Ds as ELEMENT_DETACHED_ABORT_MESSAGE,Os as SUPERSEDED_INIT_ABORT_MESSAGE,Vg as create,lv as errors,pv as getInstance,dv as helpers,fv as init,Dg as isElementDetachedError,Lg as isSupersededInitError,hv as parseAMP,Yh as pluginRegistry,uv as preload,cv as version};
|
|
1077
|
+
}`;function Xb(){return()=>{}}function Jb(e,t){if(!Ya()||!e||typeof document>"u")return Xb();e.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(s=>{s.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 i=document.createElement("style");i.setAttribute(t,"true"),i.textContent=Yb,document.head?.appendChild(i),e.appendChild(n);let o=!1;return()=>{o||(o=!0,n.remove(),i.remove())}}function Qb(e){if(!(e instanceof Error))return!1;const t=e;return t.terminal===!0||t.status===403||t.status===404}function Zb({report:e}={}){const t=new Map,n=new Set,r=e??(i=>{});return{run(i,o){const s=t.get(i);if(s!==void 0)return s;const a=o().catch(l=>{throw n.has(i)||(n.add(i),r(l)),Qb(l)||t.delete(i),l});return t.set(i,a),a},clear(){t.clear(),n.clear()},size(){return t.size}}}var ri=Zb();function Xa(){ri.clear()}zl(()=>ri.clear());var wo=new WeakMap;function ii(e){return cl(e)}function ey(e,t){const n=new Error(`[Loader] appInit request failed: ${e} ${t}`);return n.status=e,n}function ty(){const e=new Error("[Loader] appInit skipped: empty auth token");return e.terminal=!0,e}async function ny(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 oi=new WeakMap;function Gn(e,t){oi.set(e,t)}function ry(e){return oi.get(e)}function iy(e,t){return async({baseUrl:n})=>{const r=t(),i=r&&oi.get(r)||e,o=ii(n);if(!o)throw new Error("[Loader] appInit requires baseUrl or REACT_APP_OPENAPI_BASE_URL");const s=new Headers({Accept:"application/json","Content-Type":"application/x-www-form-urlencoded;charset=UTF-8"}),a=await ny(i);if(i.getAuthToken&&!a)throw ty();a&&s.set("authorization",a);const l=await Rl("/app/v1/app_init",{method:"POST",headers:s,body:new URLSearchParams,credentials:"same-origin"},o,{attemptTimeout:zr(i)||void 0});if(!l.ok)throw ey(l.status,l.statusText);return await l.json()}}function oy(e){return JSON.stringify({baseUrl:ii(e.baseUrl)||"",project:e.project??"",userId:e.user?.id??""})}function sy(e){return e.appInit?!0:!(e.jwtAuth&&!e.getAuthToken)}function ay(e){return t=>ri.run(oy(t),()=>(K("appInit:start",{kind:"network"}),Promise.resolve(e(t)).finally(()=>K("appInit:end",{kind:"network"}))))}function ly(e,t){if(Ot(e)||!e.appInit&&!ii(e.baseUrl)||!sy(e))return e;const n=e.appInit??iy(e,t);let r=wo.get(n);return r||(r=ay(n),wo.set(n,r)),{...e,appInit:r}}var Ja=0;function cy(){return Ja}function uy(){Ja+=1,Xa()}var So=new WeakMap,Io=new WeakMap,dy=3e4;function fy(e,t){return JSON.stringify({userId:e?.id??"",project:t??""})}function py(e,t){try{const n=Bo(e)?.exp;if(typeof n=="number"&&Number.isFinite(n)&&n>0)return n*1e3}catch{}return t+dy}function hy(e){const t=new Map,n=new Map;return async(r,i,o)=>{const s=fy(r,i);if(o)return n.delete(s),t.delete(s),Xa(),e(r,i,o);const a=n.get(s);if(a&&!t.has(s)){if(a.expiresAtMs>Date.now())return a.token;n.delete(s)}let l=t.get(s);return l===void 0&&(K("authToken:start",{kind:"network"}),l=Promise.resolve(e(r,i,o)).then(u=>{const d=String(u||"").trim();return d&&n.set(s,{token:u,expiresAtMs:py(d,Date.now())}),u}).finally(()=>{K("authToken:end",{kind:"network"}),t.delete(s)}),t.set(s,l)),l}}function my(e){if(Ot(e))return e;const t=e.getAuthToken;if(!t)return e;let n=So.get(t);const r=cy();return(!n||Io.get(t)!==r)&&(n=hy(t),So.set(t,n),Io.set(t,r)),Promise.resolve(n(e.user,e.project,void 0)).catch(i=>{}),{...e,getAuthToken:n}}var gy="[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 vy(e){const t=new Error(gy,{cause:e});return t.name="EditorStartFailedError",t}var by={getConfig:"await `ready` first",use:"use `useAsync()` or await `ready` first"};function Co(e){return new Error(`[emailmaker] \`${e}\` is not available on this editor`)}var Qa=["handleLoad","handleDestroy"];function Za(e,t){let n=e;for(const r of Qa){const i=e?.[r];typeof i=="function"&&(n={...n,[r]:(o,...s)=>i(t,...s)})}return n}function yy(e){let t,n="pending",r,i,o,s;const a=new Set,l=[],u=new Set;let d,p;const b=new Promise((T,O)=>{d=T,p=O});b.catch(()=>{});const v={},S=T=>t?.[T],E=()=>r??Te(),h=(T,O)=>{const L=S(T);if(typeof L!="function")throw Co(T);return L.apply(t,O)},w=(T,O)=>{try{return Promise.resolve(h(T,O))}catch(L){return Promise.reject(L)}},_=()=>{const T=t?.container?.getInstance?.(H);if(!(n!=="ready"||T?.isDisposed()||typeof S("getConfig")!="function"))try{s=h("getConfig",[])}catch{}},A=()=>n==="dead"?Promise.reject(E()):n==="ready"?Promise.resolve():b,I=()=>{for(const[T,O]of ln)O==="field"&&(v[T]=S(T))},x=T=>{const O=S(T.name);T.dispose||typeof O!="function"||n==="dead"||(T.dispose=O.apply(t,T.args))},y=()=>a.forEach(x),C=()=>{for(const T of a){try{T.dispose?.()}catch{}T.dispose=void 0}},R=()=>{I(),y()},m=()=>{o?.delete(R),o=void 0},c=(T,O)=>{const[L,...ie]=O;return!Qa.includes(T)||typeof L!="function"?O:[(xe,...k)=>L(v,...k),...ie]},f=(T,O)=>{if(n==="dead")return()=>{};if(n==="ready"&&typeof S(T)!="function")throw Co(T);const L={name:T,args:c(T,O)};return a.add(L),x(L),()=>{a.delete(L),L.dispose?.(),L.dispose=void 0}},g=()=>t?.container?.getInstance(te)?.get()?.content,P=()=>{const T=e.element();return T!==void 0&&typeof T!="string"?T:void 0},D=(T,O)=>{switch(O){case"event":return(...L)=>f(T,L);case"async":return(...L)=>(T==="show"&&L[0]!==void 0&&e.shown?.(L[0]),n!=="dead"&&typeof S(T)=="function"?w(T,L):A().then(()=>h(T,L)));case"queued":return(...L)=>{if(n==="dead"){if(T==="notify")return;throw E()}if(n==="pending"){l.push({name:T,args:L});return}return h(T,L)};case"sync":return(...L)=>{if(n==="dead"){if(T==="getConfig")return s;throw E()}if(typeof S(T)!="function")throw new Error(`[emailmaker] \`${T}\` is not available before the editor is ready: ${by[T]??"await `ready` first"}`);const ie=h(T,L);return T==="getConfig"&&(s=ie),ie};case"element":return()=>{if(typeof S(T)!="function")return P();try{return h(T,[])}catch{return P()}};case"codeErrors":return()=>n==="ready"&&typeof S(T)=="function"?h(T,[]):[];case"field":return}};for(const[T,O]of ln)v[T]=D(T,O);v.reset=T=>(T?.content!==void 0&&e.shown?.(T.content),A().then(async()=>{const O=T?.content!==void 0&&Ie(T.content,g());await h("reset",[Za(T,B)]),O&&await h("show",[T.content])}).then(()=>v)),v.destroy=()=>{if(n==="dead")return;const T=le("[emailmaker] editor was destroyed before it was ready");i?.catch(()=>{}),u.forEach(O=>O(T)),_(),e.destroy()},Object.defineProperty(v,"ready",{get:()=>i,enumerable:!0,configurable:!0});const B=v;return{object:B,get state(){return n},get editor(){return t},bind:T=>{n==="dead"||t===T||(C(),m(),t=T,I(),y(),n==="pending"&&(o=T.container.getOrCreateInstance(Cr,()=>new Set),o.add(R)))},settle:()=>{if(n==="pending"){n="ready",m(),I(),y();for(const T of l.splice(0))try{h(T.name,T.args)}catch(O){queueMicrotask(()=>{throw O})}d()}},kill:(T,O)=>{n!=="dead"&&(_(),n="dead",r=T,l.length=0,u.forEach(L=>L(T)),m(),O?.keepSubscriptions||(C(),a.clear()),p(T))},detach:()=>{C(),a.clear()},setReady:T=>{i=T},trackCall:T=>(u.add(T),()=>u.delete(T)),hasCalls:()=>u.size>0}}var el="Editor mount element was removed from the document. Call instance.destroy() on host unmount.";function Ey(){return le(el)}function _y(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===el}function wy(e,t,n){if(typeof document>"u")return;let r=!1,i;const o=()=>{r=!0,i?.disconnect(),i=void 0},s=()=>{r||(o(),t())};if(n.addDispose(o),!e.isConnected){queueMicrotask(s);return}i=new MutationObserver(()=>{e.isConnected||s()});let a=e.parentNode;for(;a;)i.observe(a,{childList:!0}),a=a.parentNode}function Sy(e){const{hostElementOption:t,resolvedElement:n,externalSignal:r,disposable:i}=e;if(t===void 0||!(n instanceof Element))return r;const o=new AbortController;return wy(n,()=>{n.id,o.abort(Ey())},i),_r(r,o.signal)}var tl="Superseded by newer init() on the same mount element";function To(){return le(tl)}function Iy(e){return!(e instanceof DOMException)||e.name!=="AbortError"?!1:e.message===tl}var at=new Map,Ao=new WeakMap,Kt=new WeakMap;function Cy(e){if(e instanceof Element){const t=e.id?.trim();if(t)return`#${t}`}}function Ty(e,{supersede:t=!1}={}){if(!e)return{previous:Promise.resolve(),release:()=>{}};const n=Cy(e);(n?at.get(n):void 0)?.forEach(d=>{d.element!==e&&d.controller.abort(To())});const r=Ao.get(e)??new Set;t&&r.forEach(d=>{d.supersedable&&d.controller.abort(To())});const i=Kt.get(e)??Promise.resolve();let o;const s=new Promise(d=>{o=d}),a=i.then(()=>s);Kt.set(e,a),a.then(()=>{Kt.get(e)===a&&Kt.delete(e)});const l=new AbortController,u={element:e,controller:l,supersedable:t};if(r.add(u),Ao.set(e,r),n){const d=at.get(n)??new Set;d.add(u),at.set(n,d)}return{signal:l.signal,previous:i,release:()=>{o(),r.delete(u);const d=n?at.get(n):void 0;n&&d?.delete(u)&&d.size===0&&at.delete(n)}}}var Ct=new WeakMap;function si(e,t){return typeof t=="function"&&(/^(handle|on)[A-Z]/.test(e)||e==="getAuthToken")}function vr(e){return Object.entries(e).filter(([t,n])=>si(t,n)).map(([t])=>t).sort()}function Ro(e){const t={};for(const[n,r]of Object.entries(e))n!=="signal"&&!si(n,r)&&(t[n]=r);return t}function br(e,t,{fresh:n=!1}={}){if(!e)return t;let r=n?void 0:Ct.get(e);r||(r={current:new Map,trampolines:new Map,lastOptions:t},Ct.set(e,r));const{current:i,trampolines:o}=r;i.clear();const s={...t};for(const a of vr(t)){i.set(a,t[a]);let l=o.get(a);l||(l=(...u)=>i.get(a)?.(...u),o.set(a,l)),s[a]=l}return r.lastOptions=t,s}function nl(e,t){const n=e?Ct.get(e):void 0;if(n)for(const r of n.trampolines.keys()){const i=t[r];si(r,i)?n.current.set(r,i):n.current.delete(r)}}function Ay(e){const t=e?Ct.get(e):void 0;if(!t)return()=>{};const n=new Map(t.current),{lastOptions:r}=t;return()=>{t.current.clear(),n.forEach((i,o)=>t.current.set(o,i)),t.lastOptions=r}}function Ry(e,t,n){const r=e?Ct.get(e):void 0;if(!r||!n)return!1;const i=vr(t),o=Ie(i,vr(r.lastOptions)),s=i.every(a=>a==="getAuthToken"||n[a]===r.trampolines.get(a));return!o||!s||!Ie(Ro(t),Ro(r.lastOptions))?!1:(br(e,t),!0)}var he=new WeakMap;function bn(e){let t=he.get(e);return t||(t={counted:new Set,leaving:new Set,order:[],options:new Map,latestCall:0,warned:!1},he.set(e,t)),t}var Oe=e=>e!==void 0&&e.state!=="dead";function Py(e){const t=he.get(e)?.shared;return Oe(t)?t:void 0}function Dy(e,t){bn(e).shared=t}function Oy(e,t){!(Oe(e.shared)&&[...e.counted].some(Oe))||e.warned||!t.devTools||(e.warned=!0)}function xy(e,t,n,r){const i=bn(e);return i.latestCall+=1,i.releaseTimer!==void 0&&(clearTimeout(i.releaseTimer),i.releaseTimer=void 0),i.leaving.forEach(o=>o.detach()),i.leaving.clear(),n==="single"?i.shared=t:i.counted.add(t),i.options.set(t,r),i.order=[...i.order.filter(o=>o!==t&&Oe(o)),t],Oy(i,r),i.latestCall}function My(e,t){return he.get(e)?.latestCall===t}function Ly(e){const t=he.get(e);if(t)return t.order=t.order.filter(Oe),t.order.at(-1)?.object}function Tt(e,t){const n=he.get(e);return n?Oe(n.shared)&&n.shared!==t||[...n.counted].some(r=>r!==t&&Oe(r)):!1}function ky(e,t){const n=he.get(e),r=n?.order.filter(i=>i!==t&&Oe(i)).at(-1);return r?n?.options.get(r):void 0}function rl(e,t){bn(e).content={value:t}}function Ny(e){return he.get(e)?.content}function Fy(e,t,n,r){const i=bn(e);if(i.counted.delete(t),i.options.delete(t),Tt(e)){t.kill(n);return}t.kill(n,{keepSubscriptions:!0}),i.leaving.add(t),il(e,r)}function il(e,t){const n=he.get(e);!n||Tt(e)||n.releaseTimer!==void 0||(n.releaseTimer=setTimeout(()=>{n.releaseTimer=void 0,!Tt(e)&&(t(),n.leaving.forEach(r=>r.detach()),n.leaving.clear())},0))}function jy(e,t){const n=he.get(e);if(n){n.releaseTimer!==void 0&&clearTimeout(n.releaseTimer);for(const r of[n.shared,...n.counted,...n.leaving])r?.kill(t);he.delete(e)}}var uE=Oo({FileManagerApiError:()=>By,IntegratorSaveTimeoutError:()=>Mr,SaveRefusedError:()=>ht}),By=class ol extends Error{code;status;details;get httpStatus(){return this.status}constructor(t,n,r,i){super(t),this.name="FileManagerApiError",this.code=n,this.status=r,this.details=i,Error.captureStackTrace&&Error.captureStackTrace(this,ol)}},dE=Oo({mapHttpStatusToErrorCode:()=>Fl});function Uy(e,t){return{...e,element:t}}function yr(){return()=>{}}function Hy(e){const t=e.element;return!t||typeof t=="string"||typeof document>"u"?yr():(Wb(t,e.config?.styles,t),()=>{Kb(t)})}function $y(e){if(!Ya()||e.initialSpinner===!1||typeof document>"u")return{options:e,cleanup:yr()};const t=e.element;if(!t||typeof t=="string")return{options:e,cleanup:yr()};t.querySelectorAll(".blocks-app-initial-spinner-wrapper").forEach(i=>{i.remove()});const n=Jb(t,"data-useblocks"),r=e.handleChunkLoaded;return{options:{...e,handleChunkLoaded:()=>{n(),r?.()}},cleanup:n}}function Vy(e,t){if(e.appInit||!("appInit"in t))return t;const n={...t};return delete n.appInit,n}function un(e){try{e.destroy()}catch{}}function Zt(e,...t){const n=ce.get(e);t.some(r=>r!==void 0&&r===n)&&ce.delete(e)}var fE="1.1.85-dev.11";async function pE(e){$r(),await Ev(typeof window.__useblocks__<"u"?window.__useblocks__:void 0)}async function hE(e){return Ky(e).ready}function qy(e){if(typeof e!="string")return e??void 0;try{return document.querySelector(e)??void 0}catch{return}}function Gy(e){const t=ce.get(e);return t&&!(t instanceof Promise)?t:void 0}function dn(e,t,n){const r=t??Gy(e);r&&(Zt(e,r),un(r)),jy(e,n)}function zy(e){const{control:t,mode:n,ref:r}=e,i=r.host;if(!i){const s=t.editor;Wy(s),t.kill(Te());return}if(n==="single"){dn(i,t.editor,Te());return}const o=ky(i,t);Fy(i,t,Te(),()=>dn(i,t.editor,Te())),o&&Tt(i)&&nl(i,o)}function Wy(e){e&&un(e)}function Ky(e){K(re.initStart);const t=e.ownership==="counted"?"counted":"single",n=new AbortController,r=_r(e.signal,n.signal),i=t==="single"?qy(e.element):void 0,o=i?Py(i):void 0;let s;if(o)s={control:o,mode:t,ref:{host:i}};else{const d={},p=yy({element:()=>d.host??e.element,destroy:()=>zy(s),shown:b=>{d.host&&rl(d.host,b)}});s={control:p,mode:t,ref:d},i&&Dy(i,p)}const{control:a}=s,l=a.trackCall(d=>n.abort(d)),u=Zy(Za({...e,signal:r},a.object),s).then(()=>(l(),K(re.initEnd),a.settle(),a.object),d=>{l(),a.state==="pending"&&!a.hasCalls()&&a.kill(d);const p=s.ref.host;throw p&&il(p,()=>dn(p,void 0,Te())),d});return a.setReady(u),a.object}function mE(e){const t=typeof e=="string"?document.querySelector(e):e;return t?Ly(t):void 0}function Yy(e){let t,n,r=!1;try{t=e.container.getInstance(te)?.get(),n=e.container.getInstance(we)?.externalSignal;const i=Xe(e.container)?.current();r=i!==void 0&&i.get().savedVersion!==null&&i.isDirty()}catch{t=void 0}return{options:t,signal:n,email:Xy(e),dirty:r}}async function Xy(e){try{return await e.getEmailSnapshot()}catch{return}}function Jy(e){const t=Xe(e.container)?.current();t?.whenReady().then(()=>t.markUnsaved()).catch(()=>{})}function Po(e,t){const{control:n,mode:r}=t;return r==="single"&&n.state==="ready"||Tt(e,n)}async function Qy(e,t,n,r,i){if(r.mode==="counted"&&r.control.detach(),Iy(i)||_y(i))return;const o=()=>dn(t,e,vy(i)),{options:s}=n;if(!s||!Po(t,r)){o();return}const a=await n.email,l=a&&(s.content!==void 0||a.id!==void 0)?a:void 0,u=typeof s.content=="object"&&"email"in s.content?s.content:void 0;try{await e.reset({...s,signal:s.signal??n.signal,content:l?{...u,email:l}:s.content}),n.dirty&&l&&Jy(e),Po(t,r)?ce.set(t,e):o()}catch{o()}}async function Zy(e,t){z(e.signal);const n=new Z;let r,i,o,s,a=0;try{const l=await Hl(e.element,n,e.signal);l&&(s=l,t.ref.host=l,a=xy(l,t.control,t.mode,e));const u=Sy({hostElementOption:e.element,resolvedElement:l,externalSignal:e.signal,disposable:n}),d=Ty(l,{supersede:t.mode==="single"});r=d.release;const p=_r(u,d.signal);z(p),o=Ay(l),nl(l,e),await en(d.previous,p),i=eE(e,l,t,p,o);const b=await en(i,p);return l&&e.content!==void 0&&rl(l,e.content),b}catch(l){throw s&&o&&My(s,a)&&o(),l}finally{const l=r;i!==void 0&&l?i.then(l,l):l?.(),n.dispose()}}async function Do(e,t,n,r){const i=Ny(t);n===void 0||r||!i||Ie(n,i.value)||await e.show(n)}async function eE(e,t,n,r,i){const{control:o}=n,s=E=>o.bind(E);z(r);let a;const l=E=>{uy();const h=my(Uy(E,t)),w=ly(h,()=>a);return{preparedOptions:w,preparedOptionsWithSignal:r!=null?{...w,signal:r}:w}};let u;if(t){const E=ce.get(t);if(E){let h;try{h=await E,z(r)}catch{z(r),Zt(t,E),h=void 0}if(h)if(h.getElement()===t){const w=Hb(t);a=w;const _=h.container.getInstance(te)?.get();if(Ry(t,e,_))return s(h),r&&h.container.getInstance(we)?.relinkExternalSignal(r),ce.set(t,h),await Do(h,t,e.content,!1),h;const A=!Ie(e.content,_?.content);u=l(br(t,e));const{preparedOptions:I,preparedOptionsWithSignal:x}=u,y=w&&ry(w),C=Yy(h);try{w&&Gn(w,I),s(h);const R=await h.reset(Vy(e,x));return z(r),ce.set(t,h),await Do(h,t,e.content,A),R}catch(R){if(w&&y&&Gn(w,y),!yc(R))throw i(),await Qy(h,t,C,n,R),R;Zt(t,E,h),un(h),z(r)}}else Zt(t,E,h),un(h)}}z(r),u??=l(br(t,e,{fresh:!0}));const{preparedOptions:d}=u,p=Hy(d),b=$y(d),v=r!=null?{...b.options,signal:r}:b.options;let S;try{a=qb(v),$b(t,a),Gn(a,d),Zr(a).set(v),await ei(),K(re.coreReady),z(r),z(r),S=Ub(v,a,{onInstance:s}),t&&ce.set(t,S);const E=await S;if(r?.aborted&&(E.destroy(),z(r)),t)if(ce.get(t)===S)ce.set(t,E);else throw E.destroy(),z(r),le(r?.reason);return E}catch(E){throw p(),b.cleanup(),a&&(Ka(a),Vb(t,a)),t&&S&&ce.get(t)===S&&ce.delete(t),E}}async function gE(e){return(await kt()).parseAMP(e)}typeof window<"u"&&(yt()&&vc(),wv(typeof window.__useblocks__<"u"?window.__useblocks__:void 0));export{el as ELEMENT_DETACHED_ABORT_MESSAGE,tl as SUPERSEDED_INIT_ABORT_MESSAGE,Ky as create,uE as errors,mE as getInstance,dE as helpers,hE as init,_y as isElementDetachedError,Iy as isSupersededInitError,gE as parseAMP,Iv as pluginRegistry,pE as preload,fE as version};
|
|
1078
1078
|
|
|
1079
1079
|
|
|
1080
|
-
window.__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/
|
|
1080
|
+
window.__useblocks__.require.config({"graph":{"core":["__delivery__/libs"],"static/core/11bc33e0.js":[],"static/core/1ed86ed3.js":[],"static/core/248de796.js":[],"static/core/274b5d7a.js":[],"static/core/3fd50a29.js":[],"static/core/4067c5be.js":[],"static/core/453596ac.js":["static/core/e47dcbb0.js","__delivery__/libs","monaco"],"static/core/48da14fd.js":[],"static/core/4b12ae50.js":[],"static/core/50d547f6.js":[],"static/core/549c0ef1.js":[],"static/core/563a690f.js":[],"static/core/5c62f38b.js":["static/core/a3f7b4c9.js"],"static/core/5f949f39.js":[],"static/core/60aa31a3.js":[],"static/core/6561b34a.js":[],"static/core/66619f08.js":[],"static/core/7052d050.js":["__delivery__/libs"],"static/core/7555e955.js":["static/core/a494cc9f.js"],"static/core/7b850506.js":[],"static/core/7c89682e.js":["static/core/e7620593.js","static/core/ff7d14e8.js","__delivery__/libs"],"static/core/83c17079.js":["static/core/8c5284f6.js","static/core/7c89682e.js","static/core/958fe93e.js","static/core/d61988e0.js","__delivery__/libs"],"static/core/8c5284f6.js":[],"static/core/958fe93e.js":["static/core/7c89682e.js","__delivery__/libs"],"static/core/a3f7b4c9.js":[],"static/core/a494cc9f.js":[],"static/core/a6303cb2.js":["static/core/ff7d14e8.js"],"static/core/b8a0f663.js":[],"static/core/bb65f553.js":["static/core/8c5284f6.js","static/core/7c89682e.js","__delivery__/libs"],"static/core/c2f990cf.js":["static/core/ff7d14e8.js","static/core/7c89682e.js","__delivery__/libs"],"static/core/c8d6258e.js":["static/core/a3f7b4c9.js","static/core/a494cc9f.js","static/core/7555e955.js"],"static/core/d58ae4ac.js":["static/core/958fe93e.js","static/core/7052d050.js","__delivery__/libs","static/core/7c89682e.js"],"static/core/d61988e0.js":["static/core/7052d050.js","__delivery__/libs"],"static/core/d887672a.js":[],"static/core/dcc37768.js":[],"static/core/e47dcbb0.js":[],"static/core/e50befab.js":[],"static/core/e50f64f6.js":["static/core/a494cc9f.js"],"static/core/e7620593.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"],"compat-globals.js":["static/esm/971f1b2c.js"],"static/esm/delivery-libs.js":[],"useblocks-esm.js":["static/esm/971f1b2c.js","static/esm/ad8c16a9.js","static/esm/f76c9d9d.js"],"static/esm/2490dab8.js":["static/esm/971f1b2c.js"],"static/esm/971f1b2c.js":[],"static/esm/ad8c16a9.js":[],"static/esm/f76c9d9d.js":[]},"bundles":{"static/core/7052d050.js":["static/core/2827ff97.js","static/core/36f4021e.js","static/core/5ae1e3a3.js"],"static/core/5c62f38b.js":["static/core/a71c4cd8.js"],"static/core/c2f990cf.js":["static/core/8daf15a4.js"],"static/core/d61988e0.js":["static/core/a73da823.js"],"static/core/d58ae4ac.js":["static/core/5b4f83da.js"],"core":["static/core/2ff39ddf.js","static/core/734b5dbf.js","static/core/41d2fa95.js","static/core/727fabd0.js","static/core/caadce3e.js"]}});
|