import{client as d,jsxRuntimeExports as o,reactExports as r}from"./chunks/vendor-react.js";import l from"./chunks/ExcalidrawCanvas.js";import"./chunks/_commonjsHelpers.js";import"./chunks/preload-helper.js";import"./chunks/vendor-excalidraw.js";import"./chunks/vendor-common.js";import"./chunks/spec-template-vendor.js";import"./chunks/vendor-antd.js";import"./chunks/_commonjs-dynamic-modules.js";import"./chunks/vendor-export.js";import"./chunks/excalidrawUiMode.js";import"./chunks/dialog.js";import"./chunks/vendor-assistant.js";import"./chunks/select.js";import"./chunks/switch.js";const c="axhub-make-dark-mode";function s(e){var t;return typeof document>"u"?"":((t=document.querySelector(`meta[name="${e}"]`))==null?void 0:t.getAttribute("content"))||""}function m(e){const t=String(e||"").trim();return!t||t.startsWith("{{")?"":t}function p(e){const t=e.match(/^\/canvas\/(.+?)\/?$/);if(!(t!=null&&t[1]))return"";try{return decodeURIComponent(t[1])}catch{return t[1]}}function f(){const e=m(s("axhub-canvas-name"));return e||(typeof window>"u"?"":p(window.location.pathname))}function v(e){const t=m(s("axhub-canvas-title"));if(t)return t;const n=e.replace(/\.excalidraw$/i,"").trim();return n?`${n} - Canvas`:"Canvas"}function g(){try{return localStorage.getItem(c)==="true"}catch{return!1}}function h(){const[e]=r.useState(()=>f()),[t,n]=r.useState(()=>g());return r.useEffect(()=>{const a=i=>{i.key===c&&n(i.newValue==="true")};return window.addEventListener("storage",a),()=>{window.removeEventListener("storage",a)}},[]),r.useEffect(()=>{const a=v(e);document.title=a,document.documentElement.classList.toggle("dark",t),document.body.classList.toggle("dark",t)},[e,t]),o.jsx("div",{className:t?"canvas-template-shell dark":"canvas-template-shell",children:e?o.jsx(l,{canvasName:e,isDarkMode:t}):o.jsx("div",{className:"canvas-template-placeholder",children:"未指定画布"})})}const u=document.getElementById("canvas-root");if(!u)throw new Error("[Canvas Template] 找不到 #canvas-root 元素");const E=d.createRoot(u);E.render(o.jsx(h,{}));
