cardbuddy 0.18.0 → 0.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -57,6 +57,8 @@ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=
57
57
  <symbol id="icon-git-push" viewBox="0 0 24 24"><line x1="12" y1="19" x2="12" y2="5"></line><polyline points="5 12 12 5 19 12"></polyline></symbol>
58
58
  <!-- git 拉取(下箭头):顶栏「远端 → 拉取最新卡」语义图标,git 约定「下=拉」,不与 icon-arrow-down(回到底部)撞语义 -->
59
59
  <symbol id="icon-git-pull" viewBox="0 0 24 24"><line x1="12" y1="5" x2="12" y2="19"></line><polyline points="19 12 12 19 5 12"></polyline></symbol>
60
+ <!-- 发布(rocket):顶栏「远端 → 卡片发布」语义图标,发布上线新版本(火箭=发布/上线通用隐喻) -->
61
+ <symbol id="icon-rocket" viewBox="0 0 24 24"><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09z"></path><path d="M12 15l-3-3a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.35 22.35 0 0 1-4 2z"></path><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 0 5 0"></path><path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"></path></symbol>
60
62
  <!-- 帮助(help-circle):表单字段的「?」详情入口,点开看说明浮层 -->
61
63
  <symbol id="icon-help" viewBox="0 0 24 24"><circle cx="12" cy="12" r="10"></circle><path d="M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3"></path><line x1="12" y1="17" x2="12.01" y2="17"></line></symbol>
62
64
  <!-- 展开箭头(chevron-right):折叠行展开态,CSS 旋转 90° 即为收起态 -->
@@ -174,15 +176,15 @@ Expected function or array of functions, received type ${typeof e}.`),m)}var Yc=
174
176
  `),r=x();O(n),f(e),S({start:Math.min(r.start,r.end)+n.length,end:Math.min(r.start,r.end)+n.length,dir:`<-`})}function ae(t){let n=x(),r=ge();(t.originalEvent??t).clipboardData.setData(`text/plain`,r.toString()),a.execCommand(`delete`),f(e),S({start:Math.min(n.start,n.end),end:Math.min(n.start,n.end),dir:`<-`}),he(t)}function oe(e,t){let n=[];e.firstChild&&n.push(e.firstChild);let r=n.pop();for(;r&&t(r)!==`stop`;)r.nextSibling&&n.push(r.nextSibling),r.firstChild&&n.push(r.firstChild),r=n.pop()}function se(e){return e.metaKey||e.ctrlKey}function ce(e){return se(e)&&!e.shiftKey&&de(e)===`Z`}function le(e){return se(e)&&e.shiftKey&&de(e)===`Z`}function ue(e){return se(e)&&de(e)===`C`}function de(e){let t=e.key||e.keyCode||e.which;if(t)return(typeof t==`string`?t:String.fromCharCode(t)).toUpperCase()}function O(e){e=e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#039;`),a.execCommand(`insertHTML`,!1,e)}function fe(e,t){let n=0;return(...r)=>{clearTimeout(n),n=i.setTimeout(()=>e(...r),t)}}function pe(e){let t=e.length-1;for(;t>=0&&e[t]!==`
175
177
  `;)t--;t++;let n=t;for(;n<e.length&&/[ \t]/.test(e[n]);)n++;return[e.substring(t,n)||``,t,n]}function me(){return e.textContent||``}function he(e){e.preventDefault()}function ge(){return e.getRootNode().getSelection()}return{updateOptions(e){Object.assign(r,e)},updateCode(t,n=!0){e.textContent=t,f(e),n&&u(t)},onUpdate(e){u=e},toString:me,save:x,restore:S,recordHistory:re,destroy(){for(let[t,n]of o)e.removeEventListener(t,n)}}}var D_=c(o(((e,t)=>{var n=function(e){var t=/(?:^|\s)lang(?:uage)?-([\w-]+)(?=\s|$)/i,n=0,r={},i={manual:e.Prism&&e.Prism.manual,disableWorkerMessageHandler:e.Prism&&e.Prism.disableWorkerMessageHandler,util:{encode:function e(t){return t instanceof a?new a(t.type,e(t.content),t.alias):Array.isArray(t)?t.map(e):t.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/\u00a0/g,` `)},type:function(e){return Object.prototype.toString.call(e).slice(8,-1)},objId:function(e){return e.__id||Object.defineProperty(e,"__id",{value:++n}),e.__id},clone:function e(t,n){n||={};var r,a;switch(i.util.type(t)){case`Object`:if(a=i.util.objId(t),n[a])return n[a];for(var o in r={},n[a]=r,t)t.hasOwnProperty(o)&&(r[o]=e(t[o],n));return r;case`Array`:return a=i.util.objId(t),n[a]?n[a]:(r=[],n[a]=r,t.forEach(function(t,i){r[i]=e(t,n)}),r);default:return t}},getLanguage:function(e){for(;e;){var n=t.exec(e.className);if(n)return n[1].toLowerCase();e=e.parentElement}return`none`},setLanguage:function(e,n){e.className=e.className.replace(RegExp(t,`gi`),``),e.classList.add(`language-`+n)},currentScript:function(){if(typeof document>`u`)return null;if(document.currentScript&&document.currentScript.tagName===`SCRIPT`)return document.currentScript;try{throw Error()}catch(r){var e=(/at [^(\r\n]*\((.*):[^:]+:[^:]+\)$/i.exec(r.stack)||[])[1];if(e){var t=document.getElementsByTagName(`script`);for(var n in t)if(t[n].src==e)return t[n]}return null}},isActive:function(e,t,n){for(var r=`no-`+t;e;){var i=e.classList;if(i.contains(t))return!0;if(i.contains(r))return!1;e=e.parentElement}return!!n}},languages:{plain:r,plaintext:r,text:r,txt:r,extend:function(e,t){var n=i.util.clone(i.languages[e]);for(var r in t)n[r]=t[r];return n},insertBefore:function(e,t,n,r){r||=i.languages;var a=r[e],o={};for(var s in a)if(a.hasOwnProperty(s)){if(s==t)for(var c in n)n.hasOwnProperty(c)&&(o[c]=n[c]);n.hasOwnProperty(s)||(o[s]=a[s])}var l=r[e];return r[e]=o,i.languages.DFS(i.languages,function(t,n){n===l&&t!=e&&(this[t]=o)}),o},DFS:function e(t,n,r,a){a||={};var o=i.util.objId;for(var s in t)if(t.hasOwnProperty(s)){n.call(t,s,t[s],r||s);var c=t[s],l=i.util.type(c);l===`Object`&&!a[o(c)]?(a[o(c)]=!0,e(c,n,null,a)):l===`Array`&&!a[o(c)]&&(a[o(c)]=!0,e(c,n,s,a))}}},plugins:{},highlightAll:function(e,t){i.highlightAllUnder(document,e,t)},highlightAllUnder:function(e,t,n){var r={callback:n,container:e,selector:`code[class*="language-"], [class*="language-"] code, code[class*="lang-"], [class*="lang-"] code`};i.hooks.run(`before-highlightall`,r),r.elements=Array.prototype.slice.apply(r.container.querySelectorAll(r.selector)),i.hooks.run(`before-all-elements-highlight`,r);for(var a=0,o;o=r.elements[a++];)i.highlightElement(o,t===!0,r.callback)},highlightElement:function(t,n,r){var a=i.util.getLanguage(t),o=i.languages[a];i.util.setLanguage(t,a);var s=t.parentElement;s&&s.nodeName.toLowerCase()===`pre`&&i.util.setLanguage(s,a);var c={element:t,language:a,grammar:o,code:t.textContent};function l(e){c.highlightedCode=e,i.hooks.run(`before-insert`,c),c.element.innerHTML=c.highlightedCode,i.hooks.run(`after-highlight`,c),i.hooks.run(`complete`,c),r&&r.call(c.element)}if(i.hooks.run(`before-sanity-check`,c),s=c.element.parentElement,s&&s.nodeName.toLowerCase()===`pre`&&!s.hasAttribute(`tabindex`)&&s.setAttribute(`tabindex`,`0`),!c.code){i.hooks.run(`complete`,c),r&&r.call(c.element);return}if(i.hooks.run(`before-highlight`,c),!c.grammar){l(i.util.encode(c.code));return}if(n&&e.Worker){var u=new Worker(i.filename);u.onmessage=function(e){l(e.data)},u.postMessage(JSON.stringify({language:c.language,code:c.code,immediateClose:!0}))}else l(i.highlight(c.code,c.grammar,c.language))},highlight:function(e,t,n){var r={code:e,grammar:t,language:n};if(i.hooks.run(`before-tokenize`,r),!r.grammar)throw Error(`The language "`+r.language+`" has no grammar.`);return r.tokens=i.tokenize(r.code,r.grammar),i.hooks.run(`after-tokenize`,r),a.stringify(i.util.encode(r.tokens),r.language)},tokenize:function(e,t){var n=t.rest;if(n){for(var r in n)t[r]=n[r];delete t.rest}var i=new c;return l(i,i.head,e),s(e,i,t,i.head,0),d(i)},hooks:{all:{},add:function(e,t){var n=i.hooks.all;n[e]=n[e]||[],n[e].push(t)},run:function(e,t){var n=i.hooks.all[e];if(!(!n||!n.length))for(var r=0,a;a=n[r++];)a(t)}},Token:a};e.Prism=i;function a(e,t,n,r){this.type=e,this.content=t,this.alias=n,this.length=(r||``).length|0}a.stringify=function e(t,n){if(typeof t==`string`)return t;if(Array.isArray(t)){var r=``;return t.forEach(function(t){r+=e(t,n)}),r}var a={type:t.type,content:e(t.content,n),tag:`span`,classes:[`token`,t.type],attributes:{},language:n},o=t.alias;o&&(Array.isArray(o)?Array.prototype.push.apply(a.classes,o):a.classes.push(o)),i.hooks.run(`wrap`,a);var s=``;for(var c in a.attributes)s+=` `+c+`="`+(a.attributes[c]||``).replace(/"/g,`&quot;`)+`"`;return`<`+a.tag+` class="`+a.classes.join(` `)+`"`+s+`>`+a.content+`</`+a.tag+`>`};function o(e,t,n,r){e.lastIndex=t;var i=e.exec(n);if(i&&r&&i[1]){var a=i[1].length;i.index+=a,i[0]=i[0].slice(a)}return i}function s(e,t,n,r,c,d){for(var f in n)if(!(!n.hasOwnProperty(f)||!n[f])){var p=n[f];p=Array.isArray(p)?p:[p];for(var m=0;m<p.length;++m){if(d&&d.cause==f+`,`+m)return;var h=p[m],g=h.inside,_=!!h.lookbehind,v=!!h.greedy,y=h.alias;if(v&&!h.pattern.global){var b=h.pattern.toString().match(/[imsuy]*$/)[0];h.pattern=RegExp(h.pattern.source,b+`g`)}for(var x=h.pattern||h,S=r.next,C=c;S!==t.tail&&!(d&&C>=d.reach);C+=S.value.length,S=S.next){var w=S.value;if(t.length>e.length)return;if(!(w instanceof a)){var ee=1,T;if(v){if(T=o(x,C,e,_),!T||T.index>=e.length)break;var E=T.index,te=T.index+T[0].length,D=C;for(D+=S.value.length;E>=D;)S=S.next,D+=S.value.length;if(D-=S.value.length,C=D,S.value instanceof a)continue;for(var ne=S;ne!==t.tail&&(D<te||typeof ne.value==`string`);ne=ne.next)ee++,D+=ne.value.length;ee--,w=e.slice(C,D),T.index-=C}else if(T=o(x,0,w,_),!T)continue;var E=T.index,re=T[0],ie=w.slice(0,E),ae=w.slice(E+re.length),oe=C+w.length;d&&oe>d.reach&&(d.reach=oe);var se=S.prev;ie&&(se=l(t,se,ie),C+=ie.length),u(t,se,ee);var ce=new a(f,g?i.tokenize(re,g):re,y,re);if(S=l(t,se,ce),ae&&l(t,S,ae),ee>1){var le={cause:f+`,`+m,reach:oe};s(e,t,n,S.prev,C,le),d&&le.reach>d.reach&&(d.reach=le.reach)}}}}}}function c(){var e={value:null,prev:null,next:null},t={value:null,prev:e,next:null};e.next=t,this.head=e,this.tail=t,this.length=0}function l(e,t,n){var r=t.next,i={value:n,prev:t,next:r};return t.next=i,r.prev=i,e.length++,i}function u(e,t,n){for(var r=t.next,i=0;i<n&&r!==e.tail;i++)r=r.next;t.next=r,r.prev=t,e.length-=i}function d(e){for(var t=[],n=e.head.next;n!==e.tail;)t.push(n.value),n=n.next;return t}if(!e.document)return e.addEventListener&&(i.disableWorkerMessageHandler||e.addEventListener(`message`,function(t){var n=JSON.parse(t.data),r=n.language,a=n.code,o=n.immediateClose;e.postMessage(i.highlight(a,i.languages[r],r)),o&&e.close()},!1)),i;var f=i.util.currentScript();f&&(i.filename=f.src,f.hasAttribute(`data-manual`)&&(i.manual=!0));function p(){i.manual||i.highlightAll()}if(!i.manual){var m=document.readyState;m===`loading`||m===`interactive`&&f&&f.defer?document.addEventListener(`DOMContentLoaded`,p):window.requestAnimationFrame?window.requestAnimationFrame(p):window.setTimeout(p,16)}return i}(typeof window<`u`?window:typeof WorkerGlobalScope<`u`&&self instanceof WorkerGlobalScope?self:{});t!==void 0&&t.exports&&(t.exports=n),typeof global<`u`&&(global.Prism=n),n.languages.markup={comment:{pattern:/<!--(?:(?!<!--)[\s\S])*?-->/,greedy:!0},prolog:{pattern:/<\?[\s\S]+?\?>/,greedy:!0},doctype:{pattern:/<!DOCTYPE(?:[^>"'[\]]|"[^"]*"|'[^']*')+(?:\[(?:[^<"'\]]|"[^"]*"|'[^']*'|<(?!!--)|<!--(?:[^-]|-(?!->))*-->)*\]\s*)?>/i,greedy:!0,inside:{"internal-subset":{pattern:/(^[^\[]*\[)[\s\S]+(?=\]>$)/,lookbehind:!0,greedy:!0,inside:null},string:{pattern:/"[^"]*"|'[^']*'/,greedy:!0},punctuation:/^<!|>$|[[\]]/,"doctype-tag":/^DOCTYPE/i,name:/[^\s<>'"]+/}},cdata:{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,greedy:!0},tag:{pattern:/<\/?(?!\d)[^\s>\/=$<%]+(?:\s(?:\s*[^\s>\/=]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+(?=[\s>]))|(?=[\s/>])))+)?\s*\/?>/,greedy:!0,inside:{tag:{pattern:/^<\/?[^\s>\/]+/,inside:{punctuation:/^<\/?/,namespace:/^[^\s>\/:]+:/}},"special-attr":[],"attr-value":{pattern:/=\s*(?:"[^"]*"|'[^']*'|[^\s'">=]+)/,inside:{punctuation:[{pattern:/^=/,alias:`attr-equals`},{pattern:/^(\s*)["']|["']$/,lookbehind:!0}]}},punctuation:/\/?>/,"attr-name":{pattern:/[^\s>\/]+/,inside:{namespace:/^[^\s>\/:]+:/}}}},entity:[{pattern:/&[\da-z]{1,8};/i,alias:`named-entity`},/&#x?[\da-f]{1,8};/i]},n.languages.markup.tag.inside[`attr-value`].inside.entity=n.languages.markup.entity,n.languages.markup.doctype.inside[`internal-subset`].inside=n.languages.markup,n.hooks.add(`wrap`,function(e){e.type===`entity`&&(e.attributes.title=e.content.replace(/&amp;/,`&`))}),Object.defineProperty(n.languages.markup.tag,"addInlined",{value:function(e,t){var r={};r[`language-`+t]={pattern:/(^<!\[CDATA\[)[\s\S]+?(?=\]\]>$)/i,lookbehind:!0,inside:n.languages[t]},r.cdata=/^<!\[CDATA\[|\]\]>$/i;var i={"included-cdata":{pattern:/<!\[CDATA\[[\s\S]*?\]\]>/i,inside:r}};i[`language-`+t]={pattern:/[\s\S]+/,inside:n.languages[t]};var a={};a[e]={pattern:RegExp(`(<__[^>]*>)(?:<!\\[CDATA\\[(?:[^\\]]|\\](?!\\]>))*\\]\\]>|(?!<!\\[CDATA\\[)[\\s\\S])*?(?=<\\/__>)`.replace(/__/g,function(){return e}),`i`),lookbehind:!0,greedy:!0,inside:i},n.languages.insertBefore(`markup`,`cdata`,a)}}),Object.defineProperty(n.languages.markup.tag,"addAttribute",{value:function(e,t){n.languages.markup.tag.inside[`special-attr`].push({pattern:RegExp(`(^|["'\\s])(?:`+e+`)\\s*=\\s*(?:"[^"]*"|'[^']*'|[^\\s'">=]+(?=[\\s>]))`,`i`),lookbehind:!0,inside:{"attr-name":/^[^\s=]+/,"attr-value":{pattern:/=[\s\S]+/,inside:{value:{pattern:/(^=\s*(["']|(?!["'])))\S[\s\S]*(?=\2$)/,lookbehind:!0,alias:[t,`language-`+t],inside:n.languages[t]},punctuation:[{pattern:/^=/,alias:`attr-equals`},/"|'/]}}}})}}),n.languages.html=n.languages.markup,n.languages.mathml=n.languages.markup,n.languages.svg=n.languages.markup,n.languages.xml=n.languages.extend(`markup`,{}),n.languages.ssml=n.languages.xml,n.languages.atom=n.languages.xml,n.languages.rss=n.languages.xml,(function(e){var t=/(?:"(?:\\(?:\r\n|[\s\S])|[^"\\\r\n])*"|'(?:\\(?:\r\n|[\s\S])|[^'\\\r\n])*')/;e.languages.css={comment:/\/\*[\s\S]*?\*\//,atrule:{pattern:RegExp(`@[\\w-](?:[^;{\\s"']|\\s+(?!\\s)|`+t.source+`)*?(?:;|(?=\\s*\\{))`),inside:{rule:/^@[\w-]+/,"selector-function-argument":{pattern:/(\bselector\s*\(\s*(?![\s)]))(?:[^()\s]|\s+(?![\s)])|\((?:[^()]|\([^()]*\))*\))+(?=\s*\))/,lookbehind:!0,alias:`selector`},keyword:{pattern:/(^|[^\w-])(?:and|not|only|or)(?![\w-])/,lookbehind:!0}}},url:{pattern:RegExp(`\\burl\\((?:`+t.source+`|(?:[^\\\\\\r\\n()"']|\\\\[\\s\\S])*)\\)`,`i`),greedy:!0,inside:{function:/^url/i,punctuation:/^\(|\)$/,string:{pattern:RegExp(`^`+t.source+`$`),alias:`url`}}},selector:{pattern:RegExp(`(^|[{}\\s])[^{}\\s](?:[^{};"'\\s]|\\s+(?![\\s{])|`+t.source+`)*(?=\\s*\\{)`),lookbehind:!0},string:{pattern:t,greedy:!0},property:{pattern:/(^|[^-\w\xA0-\uFFFF])(?!\s)[-_a-z\xA0-\uFFFF](?:(?!\s)[-\w\xA0-\uFFFF])*(?=\s*:)/i,lookbehind:!0},important:/!important\b/i,function:{pattern:/(^|[^-a-z0-9])[-a-z0-9]+(?=\()/i,lookbehind:!0},punctuation:/[(){};:,]/},e.languages.css.atrule.inside.rest=e.languages.css;var n=e.languages.markup;n&&(n.tag.addInlined(`style`,`css`),n.tag.addAttribute(`style`,`css`))})(n),n.languages.clike={comment:[{pattern:/(^|[^\\])\/\*[\s\S]*?(?:\*\/|$)/,lookbehind:!0,greedy:!0},{pattern:/(^|[^\\:])\/\/.*/,lookbehind:!0,greedy:!0}],string:{pattern:/(["'])(?:\\(?:\r\n|[\s\S])|(?!\1)[^\\\r\n])*\1/,greedy:!0},"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|trait)\s+|\bcatch\s+\()[\w.\\]+/i,lookbehind:!0,inside:{punctuation:/[.\\]/}},keyword:/\b(?:break|catch|continue|do|else|finally|for|function|if|in|instanceof|new|null|return|throw|try|while)\b/,boolean:/\b(?:false|true)\b/,function:/\b\w+(?=\()/,number:/\b0x[\da-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:e[+-]?\d+)?/i,operator:/[<>]=?|[!=]=?=?|--?|\+\+?|&&?|\|\|?|[?*/~^%]/,punctuation:/[{}[\];(),.:]/},n.languages.javascript=n.languages.extend(`clike`,{"class-name":[n.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),n.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,n.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:n.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:n.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:n.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:n.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:n.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),n.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:n.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),n.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),n.languages.markup&&(n.languages.markup.tag.addInlined(`script`,`javascript`),n.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),n.languages.js=n.languages.javascript,(function(){if(n===void 0||typeof document>`u`)return;Element.prototype.matches||(Element.prototype.matches=Element.prototype.msMatchesSelector||Element.prototype.webkitMatchesSelector);var e=`Loading…`,t=function(e,t){return`✖ Error `+e+` while fetching file: `+t},r=`✖ Error: File does not exist or is empty`,i={js:`javascript`,py:`python`,rb:`ruby`,ps1:`powershell`,psm1:`powershell`,sh:`bash`,bat:`batch`,h:`c`,tex:`latex`},a=`data-src-status`,o=`loading`,s=`loaded`,c=`failed`,l=`pre[data-src]:not([`+a+`="`+s+`"]):not([`+a+`="`+o+`"])`;function u(e,n,i){var a=new XMLHttpRequest;a.open(`GET`,e,!0),a.onreadystatechange=function(){a.readyState==4&&(a.status<400&&a.responseText?n(a.responseText):a.status>=400?i(t(a.status,a.statusText)):i(r))},a.send(null)}function d(e){var t=/^\s*(\d+)\s*(?:(,)\s*(?:(\d+)\s*)?)?$/.exec(e||``);if(t){var n=Number(t[1]),r=t[2],i=t[3];return r?i?[n,Number(i)]:[n,void 0]:[n,n]}}n.hooks.add(`before-highlightall`,function(e){e.selector+=`, `+l}),n.hooks.add(`before-sanity-check`,function(t){var r=t.element;if(r.matches(l)){t.code=``,r.setAttribute(a,o);var f=r.appendChild(document.createElement(`CODE`));f.textContent=e;var p=r.getAttribute(`data-src`),m=t.language;if(m===`none`){var h=(/\.(\w+)$/.exec(p)||[,`none`])[1];m=i[h]||h}n.util.setLanguage(f,m),n.util.setLanguage(r,m);var g=n.plugins.autoloader;g&&g.loadLanguages(m),u(p,function(e){r.setAttribute(a,s);var t=d(r.getAttribute(`data-range`));if(t){var i=e.split(/\r\n?|\n/g),o=t[0],c=t[1]==null?i.length:t[1];o<0&&(o+=i.length),o=Math.max(0,Math.min(o-1,i.length)),c<0&&(c+=i.length),c=Math.max(0,Math.min(c,i.length)),e=i.slice(o,c).join(`
176
178
  `),r.hasAttribute(`data-start`)||r.setAttribute(`data-start`,String(o+1))}f.textContent=e,n.highlightElement(f)},function(e){r.setAttribute(a,c),f.textContent=e})}}),n.plugins.fileHighlight={highlight:function(e){for(var t=(e||document).querySelectorAll(l),r=0,i;i=t[r++];)n.highlightElement(i)}};var f=!1;n.fileHighlight=function(){f||=(console.warn("Prism.fileHighlight is deprecated. Use `Prism.plugins.fileHighlight.highlight` instead."),!0),n.plugins.fileHighlight.highlight.apply(this,arguments)}})()}))());Prism.languages.json={property:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?=\s*:)/,lookbehind:!0,greedy:!0},string:{pattern:/(^|[^\\])"(?:\\.|[^\\"\r\n])*"(?!\s*:)/,lookbehind:!0,greedy:!0},comment:{pattern:/\/\/.*|\/\*[\s\S]*?(?:\*\/|$)/,greedy:!0},number:/-?\b\d+(?:\.\d+)?(?:e[+-]?\d+)?\b/i,punctuation:/[{}[\],]/,operator:/:/,boolean:/\b(?:false|true)\b/,null:{pattern:/\bnull\b/,alias:`keyword`}},Prism.languages.webmanifest=Prism.languages.json;function O_(e,t={}){if(!e||typeof e!=`object`)return{};let n=t.includeMocks?k_(e):null,r={};for(let t of e.dictionary?.inputParams||[]){let e=j_(t),i=t.defaultValue,a=i&&typeof i==`object`&&!Array.isArray(i)&&Object.keys(i).length===0,o=e!==void 0&&(i===void 0||i===``||a)?e:i;n&&A_(n,t.key)&&(o=n[t.key]),r[t.key]=M_(o)}return r}function k_(e){let t=e&&e.dictionary&&e.dictionary.mocks;return t&&typeof t==`object`&&!Array.isArray(t)?t:null}function A_(e,t){if(!e||!Object.prototype.hasOwnProperty.call(e,t))return!1;let n=e[t];return n==null||n===``?!1:Array.isArray(n)?n.length>0:typeof n!=`object`||Object.keys(n).length>0}function j_(e){if(!e.desc||typeof e.desc!=`string`)return;let t=e.desc.trim();if(t.startsWith(`{`))try{let n=JSON.parse(t);return Object.prototype.hasOwnProperty.call(n,e.key)?n[e.key]:void 0}catch{return}}function M_(e){return e==null?e:JSON.parse(JSON.stringify(e))}var N_=/\x1b\[[0-9;:?]*[ -/]*[@-~]|\x1b\][^\x07\x1b]*(?:\x07|\x1b\\)|\x1b[@-Z\\-_]/g;function P_(e){return String(e??``).replace(N_,``)}var F_=[[0,0,0],[170,0,0],[0,170,0],[170,85,0],[0,0,170],[170,0,170],[0,170,170],[170,170,170]],I_=[[85,85,85],[255,85,85],[85,255,85],[255,255,85],[85,85,255],[255,85,255],[85,255,255],[255,255,255]];function L_(e){let t=Math.round(Number(e));return Number.isFinite(t)?t<0?0:t>255?255:t:0}function R_(e){let t=L_(e);if(t<8)return F_[t];if(t<16)return I_[t-8];if(t<232){let e=t-16,n=e=>e?e*40+55:0;return[n(Math.floor(e/36)),n(Math.floor(e%36/6)),n(e%6)]}let n=8+(t-232)*10;return[n,n,n]}function z_(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function B_(e){return`rgb(${e[0]},${e[1]},${e[2]})`}function V_(){return{fg:null,bg:null,bold:!1,dim:!1,italic:!1,underline:!1}}function H_(e){return!e.fg&&!e.bg&&!e.bold&&!e.dim&&!e.italic&&!e.underline}function U_(e){let t=[],n=e.fg;return n&&n.basic!=null&&(n={rgb:e.bold?I_[n.basic]:F_[n.basic]}),n&&t.push(`color:${B_(n.rgb)}`),e.bg&&t.push(`background-color:${B_(e.bg.rgb)}`),e.bold&&t.push(`font-weight:600`),e.dim&&t.push(`opacity:.72`),e.italic&&t.push(`font-style:italic`),e.underline&&t.push(`text-decoration:underline`),t.join(`;`)}function W_(e,t){let n=String(t||``),r=(n===``?`0`:n).split(/[;:]/).map(e=>e===``?0:Number(e));for(let t=0;t<r.length;t++){let n=r[t];if(Number.isFinite(n)){if(n===0)Object.assign(e,V_());else if(n===1)e.bold=!0;else if(n===2)e.dim=!0;else if(n===3)e.italic=!0;else if(n===4)e.underline=!0;else if(n===22)e.bold=!1,e.dim=!1;else if(n===23)e.italic=!1;else if(n===24)e.underline=!1;else if(n===39)e.fg=null;else if(n===49)e.bg=null;else if(n>=30&&n<=37)e.fg={basic:n-30};else if(n>=90&&n<=97)e.fg={rgb:I_[n-90]};else if(n>=40&&n<=47)e.bg={basic:n-40};else if(n>=100&&n<=107)e.bg={rgb:I_[n-100]};else if(n===38||n===48){let i=r[t+1],a=null,o=0;i===5?(a=R_(r[t+2]),o=2):i===2&&(a=[L_(r[t+2]),L_(r[t+3]),L_(r[t+4])],o=4),a&&(n===38?e.fg={rgb:a}:e.bg={rgb:a},t+=o)}}}}function G_(e){let t=String(e??``);if(!t)return``;if(t.indexOf(`\x1B`)<0)return z_(t);let n=V_(),r=``,i=0,a;for(N_.lastIndex=0;(a=N_.exec(t))!==null;){a.index>i&&(r+=K_(t.slice(i,a.index),n)),i=a.index+a[0].length;let e=a[0];e[1]===`[`&&/[m]$/.test(e)&&W_(n,e.slice(2,-1))}return i<t.length&&(r+=K_(t.slice(i),n)),r}function K_(e,t){if(!e)return``;let n=z_(e);if(H_(t))return n;let r=U_(t);return r?`<span style="${r}">${n}</span>`:n}var q_=800;function J_(e){let t=String(e??``).replace(/^\uFEFF/,``),n=``,r=0,i=t.length,a=()=>{let e=n.length-1;for(;e>=0&&/\s/.test(n[e]);)--e;return e},o=()=>{let e=a();e>=0&&n[e]!==`,`&&n[e]!==`[`&&n[e]!==`{`&&(n+=`,`)},s=e=>{let n=e;for(;n<i&&/\s/.test(t[n]);)n+=1;return n};for(;r<i;){let e=t[r];if(e===`"`){let e=r+1;for(;e<i;){if(t[e]===`\\`){e+=2;continue}if(t[e]===`"`){e+=1;break}e+=1}n+=t.slice(r,e),r=e;continue}if(e===`'`){let e=r+1,a=``;for(;e<i;){let n=t[e];if(n===`\\`&&e+1<i){let r=t[e+1];if(r===`'`){a+=`'`,e+=2;continue}if(r===`"`){a+=`\\"`,e+=2;continue}a+=n+r,e+=2;continue}if(n===`'`){e+=1;break}if(n===`"`){a+=`\\"`,e+=1;continue}a+=n,e+=1}n+=`"`+a+`"`,r=e;continue}if(e===`/`&&t[r+1]===`/`){for(;r<i&&t[r]!==`
177
- `;)r+=1;continue}if(e===`/`&&t[r+1]===`*`){let e=t.indexOf(`*/`,r+2);r=e===-1?i:e+2;continue}if(e===`;`||e===`,`){o(),r+=1;continue}if(/[A-Za-z_$]/.test(e)){let e=r;for(;e<i&&/[A-Za-z0-9_$]/.test(t[e]);)e+=1;let a=t.slice(r,e);t[s(e)]===`:`?n+=`"`+a+`"`:n+=a===`undefined`||a===`NaN`||a===`Infinity`?`null`:a,r=e;continue}if(e===`-`&&t.startsWith(`Infinity`,r+1)){n+=`null`,r+=9;continue}if(/[0-9]/.test(e)||e===`-`&&/[0-9]/.test(t[r+1]||``)){let e=r;for(;e<i&&/[0-9eE+\-.]/.test(t[e]);)e+=1;let a=t.slice(r,e);t[s(e)]===`:`?n+=`"`+a+`"`:n+=a,r=e;continue}if(e===`}`||e===`]`){let e=a();for(;e>=0&&n[e]===`,`;)n=n.slice(0,e)+n.slice(e+1),e=a()}n+=e,r+=1}try{return{value:JSON.parse(n.trim()||`{}`)}}catch(e){return{error:e.message}}}function Y_(e){let t=/^\d{2}:\d{2}:\d{2}\.\d{3}\s+(INFO|OK\s|WARN|ERR)\b/.exec(e);if(t){let e=t[1].trim();return e===`ERR`?`error`:e===`WARN`?`warn`:e===`OK`?`ok`:`info`}return`info`}function X_(e){let t=String(e&&e.text!=null?e.text:``),n=P_(t);return{seq:Number(e&&e.seq)||0,t:Number(e&&e.t)||0,level:Y_(n),plain:n,html:G_(t)}}function Z_(e,t){if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Z_(e[r],t[r]))return!1;return!0}function Q_(e){return e===void 0?void 0:JSON.parse(JSON.stringify(e))}var $_={name:`DebugPanel`,components:{JsonTree:qp,StateDiffPanel:Cm,StructureTree:Ym,NodeInspector:Oh,EventEditor:dg,LogValue:Ug,Dropdown:e_,ConfirmDialog:_p,NumberStepper:c_,SetSegment:w_},props:{rt:{type:Object,required:!0},preview:{type:Object,default:null},schema:{type:Object,default:null},cardId:{type:String,default:``},reloadToken:{type:Number,default:0},cardCount:{type:Number,default:0},selectedNodeId:{type:String,default:``},moveCollapseToken:{type:Number,default:0},activeTab:{type:String,default:`vars`},devSvcClass:{type:String,default:`app__btn--warn`},devSvcTitle:{type:String,default:``},devSvcLabel:{type:String,default:``},devSvcConn:{type:String,default:``},chromeOff:{type:Boolean,default:!1}},data(){return{copied:!1,copyTimer:null,copiedVar:null,varCopyTimer:null,errorPanel:``,eventTab:`log`,svcLogs:[],svcLogSeq:0,svcLogFloor:0,svcLogLive:!1,svcLogFollow:!0,svcLogDropped:0,svcLogLoading:!1,svcLogErr:``,svcCopied:!1,statePanelOpen:!1,panelH:this.loadPanelH(),panelDragging:!1,inspectingComp:null,inspectKey:0,editingEventComp:null,eventEditorKey:0,rawText:``,rawError:``,varsMode:`list`,varDlg:null,varDlgError:``,delVarTarget:null,schemaViewerOpen:!1,copiedSchemaText:!1,schemaViewData:null,varTypeOptions:[{key:`string`,value:`字符串`},{key:`number`,value:`数字`},{key:`boolean`,value:`布尔`},{key:`array`,value:`数组`},{key:`object`,value:`对象`}],varBoolOptions:[{key:`true`,value:`true`},{key:`false`,value:`false`}],importMeta:null,tabs:[{key:`vars`,label:`变量`},{key:`structure`,label:`组件结构`},{key:`meta`,label:`卡片来源`}]}},computed:{mocks(){return k_(this.schema)||{}},inputParams(){let e=this.schema&&this.schema.dictionary;return e&&Array.isArray(e.inputParams)?e.inputParams:[]},delVarRefs(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];return this.scanVarRefs(e&&e.key)},delVarSeverity(){let e=this.delVarRefs;return e.binding+e.event+e.other>0?`danger`:`warn`},delVarConfirmText(){return this.delVarSeverity===`danger`?`仍要删除`:`删除`},delVarMessage(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];if(!e)return``;let t=e.name&&e.name!==e.key?`(`+e.name+`)`:``,n=this.delVarRefs,r=n.binding+n.event+n.other;if(r>0){let i=[];return n.binding&&i.push(`绑定表达式 ${n.binding} 处`),n.event&&i.push(`事件脚本 ${n.event} 处`),n.other&&i.push(`其它文本 ${n.other} 处`),`变量「${e.key}」${t}仍被${i.join(`、`)}引用(共 ${r} 处)。删除后这些引用将取不到值,画布可能出现空白或执行报错,请先迁移再删除。`}return`变量「${e.key}」${t}当前未被任何绑定表达式或事件脚本引用。删除后变量定义与 mock 值一并移除,不可恢复。`},svcEmptyText(){return this.devSvcConn===`unconfigured`?`未配置本地开发服务`:this.devSvcConn===`open`?`暂无服务日志`:`本地服务未连接`},svcEmptyHint(){return this.svcLogErr?`取历史失败:`+this.svcLogErr+`(本地服务需升级到支持 /__logs 的 cardbuddy 版本)`:this.devSvcConn===`unconfigured`?`在顶栏「连接」中配置本地开发服务地址后,这里会实时镜像该服务终端的彩色输出`:this.devSvcConn===`open`?`cardbuddy 终端的输出(含配色)会实时镜像到这里;试试同步、保存、校验或截图`:`连接恢复后自动继续;服务端保留最近 800 行历史,重连不丢`},scopeText(){this.rt.revision;try{return JSON.stringify(this.rt.rootScope,null,2)}catch{return`(无法序列化)`}},bindingErrors(){return this.rt.errorRev,this.rt.errors.slice()},eventErrors(){return this.rt.errorRev,this.rt.eventErrors.slice()},logs(){return this.rt.logRev,this.rt.eventLogs.slice()},eventCount(){return this.eventErrors.length+this.logs.length},eventStatusClass(){return this.eventErrors.length?`is-error`:this.logs.length?`is-log`:`is-ok`},eventStatusTitle(){return this.eventErrors.length?`查看事件(含错误)`:this.logs.length?`查看事件(含日志)`:`无事件记录`},panelErrors(){return this.errorPanel===`event`?this.eventErrors:this.bindingErrors},compNames(){let e={};for(let t in vu)e[t]=vu[t].name||t;return e.Root=`根`,e},canPaste(){return!!Vu.node},schemaText(){if(!this.schema)return``;try{let e={...this.schema};return this.rt&&this.rt.rootScope&&(e.data=this.rt.rootScope),JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t,2)}catch{return`(无法序列化)`}},schemaTextLines(){return this.schemaText?this.schemaText.split(`
178
- `).length:0},schemaTextBytes(){let e=new Blob([this.schemaText]).size;return e>=1024?(e/1024).toFixed(1)+` KB`:e+` B`},stateDirty(){return this.rt.revision,!Z_(this.rt.state,this.rt.rootScope)}},watch:{errorPanel(e){e===`svclog`?this.startSvcLog():this.stopSvcLog()},cardId:{immediate:!0,handler(){this.rawError=``,this.destroyJar(),this.varsMode=`list`,this.varDlg=null,this.varDlgError=``,this.delVarTarget=null,this.inspectingComp=null,this.editingEventComp=null,this.importMeta=null,this.schemaViewerOpen=!1,this.maybeFetchMeta()}},reloadToken(){this.maybeFetchMeta()},activeTab(e){e===`meta`&&this.fetchImportMeta(),e!==`vars`&&(this.varsMode=`list`,this.rawError=``,this.destroyJar(),this.varDlg=null)},varDlg(e){if(!e){this.destroyDlgJar();return}this.varDlgError=``,this.isComplexType(e.form.type)&&this.$nextTick(()=>this.initDlgJar())},"varDlg.form.type"(e,t){!this.varDlg||e===t||(this.varDlg.form.defaultValue=this.normalizeDefaultText(e,this.varDlg.form.defaultValue),this.isComplexType(e)?this.$nextTick(()=>this.initDlgJar()):this.destroyDlgJar())},varsMode(e){e===`mock`?(this.seedRawFromMocks(),this.$nextTick(()=>this.initJar())):(this.rawError=``,this.destroyJar())},schema(){this.inspectingComp=null,this.editingEventComp=null,this.varsMode===`mock`&&this.seedRawFromMocks()}},mounted(){let e=this.panelH;this.$refs.statePanel&&(this.$refs.statePanel.style.height=e+`px`),this.$refs.errPanel&&(this.$refs.errPanel.style.height=e+`px`)},beforeUnmount(){this.destroyJar(),this.destroyDlgJar(),this.cancelResize(),this.stopSvcLog()},methods:{toggleStatePanel(){this.statePanelOpen=!this.statePanelOpen,this.statePanelOpen&&(this.errorPanel=``)},toggleErrorPanel(e){this.errorPanel=this.errorPanel===e?``:e,this.errorPanel&&(this.statePanelOpen=!1,e===`event`&&(this.eventTab=this.eventErrors.length?`err`:`log`))},startResize(e){if(e.target.closest(`button`))return;this.panelDragging=!0;let t=e.clientY,n=this.panelH,r=Math.max(120,Math.round(window.innerHeight*.6)),i=e=>{this.panelH=e,this.$refs.statePanel&&(this.$refs.statePanel.style.height=e+`px`),this.$refs.errPanel&&(this.$refs.errPanel.style.height=e+`px`)},a=e=>{let a=t-e.clientY;i(Math.min(r,Math.max(120,n+a)))},o=()=>{document.body.style.cursor=``,document.body.style.userSelect=``,document.removeEventListener(`mousemove`,a),document.removeEventListener(`mouseup`,o),this._resizeMove=this._resizeUp=null,this.panelDragging=!1,this.savePanelH()};this._resizeMove=a,this._resizeUp=o,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,a),document.addEventListener(`mouseup`,o)},cancelResize(){this._resizeMove&&document.removeEventListener(`mousemove`,this._resizeMove),this._resizeUp&&document.removeEventListener(`mouseup`,this._resizeUp),this._resizeMove=this._resizeUp=null,this.panelDragging=!1,document.body.style.cursor=``,document.body.style.userSelect=``},loadPanelH(){try{let e=localStorage.getItem(`cardbuddy:debug-panel-height`);if(e!=null){let t=parseInt(e,10);if(!Number.isNaN(t)){let e=Math.max(120,Math.round(window.innerHeight*.6));return Math.min(e,Math.max(120,t))}}}catch{}return 240},savePanelH(){try{localStorage.setItem(`cardbuddy:debug-panel-height`,String(Math.round(this.panelH)))}catch{}},initJar(){let e=this.$refs.rawEditor;if(!e)return;this.destroyJar();let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.json,`json`)};this._jar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.rawText||``),this._jar.onUpdate(e=>{this.rawText=e,this.rawError&&=``}),window.__rawEditor=this._jar,this.$nextTick(()=>e.focus())},destroyJar(){this._jar&&this._jar.destroy&&this._jar.destroy(),this._jar=null,typeof window<`u`&&window.__rawEditor&&(window.__rawEditor=null)},initDlgJar(){let e=this.$refs.dlgCode;if(!e)return;this.destroyDlgJar();let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.json,`json`)};this._dlgJar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._dlgJar.updateCode(this.varDlg?this.varDlg.form.defaultValue:``),this._dlgJar.onUpdate(e=>{this.varDlg&&(this.varDlg.form.defaultValue=e),this.varDlgError&&=``}),window.__dlgEditor=this._dlgJar},destroyDlgJar(){this._dlgJar&&this._dlgJar.destroy&&this._dlgJar.destroy(),this._dlgJar=null,typeof window<`u`&&window.__dlgEditor&&(window.__dlgEditor=null)},complexSeed(e,t){let n=e===`array`?`[]`:`{}`,r=String(t??``).trim();if(!r)return n;try{let t=JSON.parse(r);return(e===`array`?Array.isArray(t):t&&typeof t==`object`)?JSON.stringify(t,null,2):n}catch{return n}},normalizeDefaultText(e,t){if(this.isComplexType(e))return this.complexSeed(e,t);let n=String(t??``).trim();return e===`number`?n!==``&&Number.isFinite(Number(n))?String(Number(n)):``:e===`boolean`?/^(true|1)$/i.test(n)?`true`:`false`:String(t??``)},saveRaw(){let e=J_(this.rawText);if(e.error){this.rawError=`JSON 格式错误:`+e.error;return}if(e.value===null||typeof e.value!=`object`||Array.isArray(e.value)){this.rawError=`变量 mock 必须是 JSON 对象({ ... })`;return}let t=this.schema;if(!t){this.rawError=`当前未载入卡片`;return}(!t.dictionary||typeof t.dictionary!=`object`)&&(t.dictionary={dictionaryList:[],inputParams:[]}),t.dictionary.mocks=e.value,this.rt.setRootScope(O_(t,{includeMocks:!0}));let n=JSON.stringify(e.value,null,2);this.rawText=n,this._jar&&this._jar.updateCode(n),this.$nextTick(()=>this.onCommit()),this.rawError=``},async copyScope(){await op(this.rawText||``)&&(this.copied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.copied=!1},1500))},onEditEvent(e){this.editingEventComp=e,this.eventEditorKey++},onApply(){this.$emit(`schema-changed`)},onCommit(){this.$emit(`schema-commit`)},hasMock(e){return A_(this.mocks,e.key)},async copyVarName(e,t){let n=e&&e.key?String(e.key):``;n&&await op(n)&&(this.copiedVar=t,this.varCopyTimer&&clearTimeout(this.varCopyTimer),this.varCopyTimer=setTimeout(()=>{this.copiedVar===t&&(this.copiedVar=null)},1500))},isComplexType(e){return e===`array`||e===`object`},scalarPlaceholder(e){return e===`number`?`数字,如 0 / 99.5`:`字符串原样保存`},onVarTypeChange(e){this.varDlg&&(this.varDlg.form.type=e)},openVarDlg(e){let t=e==null?null:this.inputParams[e],n=t&&t.type||`string`,r=t?t.defaultValue:void 0,i=``;r!=null&&(i=typeof r==`object`?JSON.stringify(r,null,2):String(r)),i=this.normalizeDefaultText(n,i),this.varDlgError=``,this.varDlg={index:e,form:{key:t&&t.key||``,name:t&&t.name||``,type:n,defaultValue:i,desc:t&&t.desc||``}}},parseDefault(e,t){let n=String(t??``).trim();if(this.isComplexType(e)){if(!n)return{value:e===`array`?[]:{}};let t=J_(n);if(t.error)return{error:`默认值不是合法 JSON:`+t.error};let r=t.value;return e===`array`&&!Array.isArray(r)?{error:`默认值需为 JSON 数组`}:e===`object`&&(typeof r!=`object`||!r||Array.isArray(r))?{error:`默认值需为 JSON 对象`}:{value:r}}if(e===`number`){if(!n)return{value:0};let e=Number(n);return Number.isFinite(e)?{value:e}:{error:`默认值不是合法数字`}}return e===`boolean`?n?n===`true`||n===`1`?{value:!0}:n===`false`||n===`0`?{value:!1}:{error:`布尔默认值仅接受 true / false`}:{value:!1}:{value:String(t??``)}},confirmVarDlg(){let e=this.varDlg;if(!e)return;let t=e.form,n=String(t.key||``).trim(),r=String(t.name||``).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)){this.varDlgError=`变量名需为字母 / 下划线开头的英文标识(绑定以 $key 引用)`;return}if(this.inputParams.some((t,r)=>t.key===n&&r!==e.index)){this.varDlgError=`已存在同名变量 `+n;return}if(!r){this.varDlgError=`中文名不能为空`;return}let i=this.parseDefault(t.type,t.defaultValue);if(i.error){this.varDlgError=i.error;return}if(this.isComplexType(t.type)){let e=JSON.stringify(i.value,null,2);t.defaultValue=e,this._dlgJar&&this._dlgJar.updateCode(e)}let a=this.schema;if(!a){this.varDlgError=`当前未载入卡片`;return}(!a.dictionary||typeof a.dictionary!=`object`)&&(a.dictionary={dictionaryList:[],inputParams:[]}),Array.isArray(a.dictionary.inputParams)||(a.dictionary.inputParams=[]);let o=a.dictionary.inputParams,s=this.rt.rootScope,c=k_(a)||{},l=Q_(i.value);if(e.index==null)o.push({key:n,name:r,type:t.type,defaultValue:Q_(l),desc:String(t.desc||``),rule:{type:``,options:{}},children:[]}),A_(c,n)||(s[n]=l);else{let i=o[e.index];if(!i)return;let a=i.key;i.key=n,i.name=r,i.type=t.type,i.desc=String(t.desc||``),i.defaultValue=Q_(l),a!==n&&(Object.prototype.hasOwnProperty.call(c,a)&&(c[n]=c[a],delete c[a]),s&&Object.prototype.hasOwnProperty.call(s,a)&&delete s[a]),A_(c,n)||(s[n]=l)}this.varDlg=null,this.onCommit()},askDeleteVar(e){this.delVarTarget=e},scanVarRefs(e){let t={binding:0,event:0,other:0},n=this.schema;if(!e||!n||typeof n!=`object`)return t;let r=String(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`\\$`+r+`(?![A-Za-z0-9_$])`),a=RegExp(`state\\s*(?:\\.\\s*`+r+`(?![A-Za-z0-9_$])|\\[\\s*['"]`+r+`['"]\\s*\\])`),o=e=>i.test(e)||a.test(e),s=e=>{if(e!=null){if(Array.isArray(e)){for(let t of e)s(t);return}if(typeof e==`object`){for(let[n,r]of Object.entries(e))if(n!==`dictionary`&&n!==`compiled`)if(typeof r==`string`){if(!o(r))continue;n===`itemValue`?t.binding+=1:n===`code`?t.event+=1:t.other+=1}else s(r)}}};return s(n),t},confirmDeleteVar(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];if(this.delVarTarget=null,!e||!this.schema||!this.schema.dictionary)return;let t=this.schema.dictionary.inputParams||[],n=t.indexOf(e);n>=0&&t.splice(n,1);let r=k_(this.schema)||{};Object.prototype.hasOwnProperty.call(r,e.key)&&delete r[e.key];let i=this.rt.rootScope;i&&Object.prototype.hasOwnProperty.call(i,e.key)&&delete i[e.key],this.onCommit()},leaveMock(){this.varsMode=`list`},seedRawFromMocks(){this.rawError=``;try{this.rawText=JSON.stringify(this.mocks,null,2)}catch(e){this.rawText=``,this.rawError=`无法序列化当前数据:`+(e&&e.message);return}this._jar&&this._jar.updateCode(this.rawText)},onInspect(e){this.inspectingComp=e,this.inspectKey++},openSchemaViewer(){try{let e={...this.schema||{}};this.schema&&this.rt&&this.rt.rootScope&&(e.data=this.rt.rootScope),this.schemaViewData=this.schema?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null}catch{this.schemaViewData=null}this.schemaViewerOpen=!0,this.$nextTick(()=>{let e=this.$refs.schemaViewerEl;e&&e.focus&&e.focus()})},onSchemaViewerKey(e){if(e.key===`Escape`){e.preventDefault(),this.schemaViewerOpen=!1;return}(e.key===`c`||e.key===`C`)&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),this.copySchemaText())},async copySchemaText(){!this.schema||!this.schemaText||await op(this.schemaText)&&(this.copiedSchemaText=!0,clearTimeout(this._schemaCopyTimer),this._schemaCopyTimer=setTimeout(()=>{this.copiedSchemaText=!1},1500))},onSelectNode(e){this.$emit(`select-node`,e)},onAddNode(e){this.$emit(`add-node`,e)},onMoveNode(e){this.$emit(`move-node`,e)},onHoverNode(e){this.$emit(`hover-node`,e)},clearEventLogs(){this.rt.clearEventLogs()},async startSvcLog(){this.svcLogFollow=!0,await this.pullSvcLogHistory(0),!this._svcUnsub&&(this._svcUnsub=Ul(e=>this.appendSvcLogs(e&&e.lines),e=>{this.svcLogLive=e===`open`,e===`open`&&this.svcLogSeq&&this.pullSvcLogHistory(this.svcLogSeq)}))},stopSvcLog(){this._svcUnsub&&=(this._svcUnsub(),null),this.svcLogLive=!1},async pullSvcLogHistory(e){if(this.svcLogLoading)return;this.svcLogLoading=!0;let t=Math.max(Number(e)||0,this.svcLogFloor);try{let e=await Wl({limit:q_,since:t});if(this.svcLogErr=``,e&&e.enabled===!1)this.svcLogErr=`服务端已关闭日志流(CARDBUDDY_STREAM_LOGS=0)`;else{this.svcLogDropped=e&&e.dropped||0,e&&e.seq&&(this.svcLogSeq=Math.max(this.svcLogSeq,e.seq));let n=(e&&e.lines||[]).map(X_);t?this.appendSvcLogs(n):this.svcLogs=n,this.scrollSvcToBottom(!0)}}catch(e){this.svcLogErr=e&&e.message||String(e)}finally{this.svcLogLoading=!1}},appendSvcLogs(e){let t=Array.isArray(e)?e:[];if(!t.length)return;let n=[];for(let e of t){let t=e&&e.html!=null?e:X_(e),r=Number(t.seq)||0;r&&r<=this.svcLogSeq||(r&&(this.svcLogSeq=r),n.push(t))}if(!n.length)return;let r=this.svcLogs.concat(n);this.svcLogs=r.length>q_?r.slice(r.length-q_):r,this.svcLogFollow&&this.scrollSvcToBottom()},clearSvcLogs(){this.svcLogFloor=this.svcLogSeq,this.svcLogs=[],this.svcLogDropped=0},async copySvcLogs(){await op(this.svcLogs.map(e=>e.plain).join(`
179
- `))&&(this.svcCopied=!0,this._svcCopiedTimer&&clearTimeout(this._svcCopiedTimer),this._svcCopiedTimer=setTimeout(()=>{this.svcCopied=!1},1200))},toggleSvcFollow(){this.svcLogFollow=!this.svcLogFollow,this.svcLogFollow&&this.scrollSvcToBottom(!0)},scrollSvcToBottom(e){!e&&!this.svcLogFollow||this.$nextTick(()=>{let e=this.$refs.errBody;e&&(e.scrollTop=e.scrollHeight)})},onErrBodyScroll(){if(this.errorPanel!==`svclog`)return;let e=this.$refs.errBody;e&&(this.svcLogFollow=e.scrollHeight-e.scrollTop-e.clientHeight<24)},fmtTime(e){if(!e)return`--:--:--`;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return n(t.getHours())+`:`+n(t.getMinutes())+`:`+n(t.getSeconds())},maybeFetchMeta(){this.activeTab===`meta`&&this.fetchImportMeta()},async fetchImportMeta(){let e=this.cardId;if(!e){this.importMeta=null;return}try{let t=await J(`/__import-meta/${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();this.importMeta=e.meta||null}else this.importMeta=null}catch{this.importMeta=null}},formatTime(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return e}}}},ev={class:`debug`},tv={class:`debug__tabs`},nv=[`onClick`],rv={class:`debug__body`},iv={key:0,class:`vars`},av={key:0,class:`empty-state`},ov={key:1,class:`vars__list`},sv=[`onDblclick`],cv={class:`vars__key`},lv={key:0,class:`vars__mock`,title:`已配置 mock(dictionary.mocks,设计期覆盖默认值)`},uv=[`title`],dv=[`disabled`,`title`,`onClick`],fv={key:0,class:`debug__copy-ok`},pv={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},mv=[`onClick`],hv=[`onClick`],gv={class:`vars__fabs`},_v={class:`debug__scope-wrap debug__scope-wrap--raw`},vv={class:`vars__mockhead`},yv={class:`debug__scope-raw`},bv={key:0,class:`raw-err-bar`,role:`alert`},xv={class:`raw-err-bar__msg`},Sv={ref:`rawEditor`,class:`debug__raw-editor`,spellcheck:`false`},Cv={class:`debug__scope-foot`},wv={key:0,class:`debug__copied`},Tv={key:1,class:`structab`},Ev={class:`structab__fabs`},Dv=[`title`],Ov={key:0,class:`debug__copy-ok`},kv={key:1,class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Av={key:2,class:`debug__meta`},jv={key:0,class:`empty-state`},Mv={key:1,class:`debug__meta-list`},Nv={class:`debug__meta-row`},Pv={class:`debug__meta-muted`},Fv={class:`debug__meta-row`},Iv={class:`debug__meta-row`},Lv={class:`debug__meta-row`},Rv={key:0,class:`debug__meta-row`},zv={class:`debug__meta-row`},Bv={class:`debug__meta-row`},Vv={class:`debug__meta-row`},Hv={class:`debug__meta-row`},Uv={key:0,class:`debug__tag debug__tag--warn`,title:`本地已编辑,偏离导入镜像`},Wv={key:1,class:`debug__tag debug__tag--ok`},Gv={key:1,class:`debug__meta-row`},Kv={key:0,class:`debug__tag debug__tag--ok`},qv={key:1,class:`debug__tag debug__tag--err`},Jv={class:`debug__meta-muted`},Yv={key:2,class:`debug__meta-err`},Xv={class:`statepanel`,ref:`statePanel`},Zv={class:`statepanel__head`},Qv={class:`statepanel__tree`},$v={class:`statusbar`},ey=[`title`],ty=[`title`],ny={class:`statusbar__icon`},ry=[`title`],iy={class:`statusbar__icon`},ay=[`title`],oy={class:`statusbar__item statusbar__item--right`},sy={class:`statusbar__item statusbar__item--right`},cy={class:`errpanel`,ref:`errPanel`},ly={class:`errpanel__head`},uy={class:`errpanel__title`},dy={key:0,class:`svclog__meta`},fy={key:0},py={key:1,class:`errpanel__tabs`},my={class:`errpanel__tab-count`},hy={class:`errpanel__actions`},gy=[`disabled`],_y=[`disabled`,`title`],vy=[`title`],yy=[`disabled`],by={key:0,class:`empty-state`},xy={class:`debug__empty`},Sy={class:`empty-state__hint`},Cy={key:1,class:`svclog`},wy=[`innerHTML`],Ty={key:0,class:`empty-state`},Ey={key:1,class:`debug__list debug__list--log`},Dy={class:`log__time`},Oy={class:`log__content`},ky={key:1,class:`log__empty`},Ay={key:0,class:`empty-state`},jy={key:1,class:`debug__list`},My={class:`err__time`},Ny={class:`debug__kind`},Py={class:`err__msg`},Fy={key:0,class:`empty-state`},Iy={key:1,class:`debug__list`},Ly={class:`err__time`},Ry={class:`debug__kind`},zy={class:`err__msg`},By={class:`schemaview__title`},Vy={class:`schemaview__card`},Hy={class:`schemaview__meta`},Uy={class:`schemaview__acts`},Wy=[`title`],Gy={key:0,class:`debug__copy-ok`},Ky={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},qy={key:0,class:`schemaview__tree`},Jy={key:1,class:`empty-state`},Yy=[`aria-label`],Xy={class:`ni-head`},Zy={class:`ni-title`},Qy={class:`ni-cls`},$y={class:`ni-body`},eb={class:`ni-scroll`},tb={class:`ni-field-row`},nb={class:`ni-field-row`},rb={class:`ni-field-row`},ib={key:0,class:`vars-type-pick`},ab={class:`vars-type-pick__name`},ob={class:`vars-type-pick`},sb={class:`vars-type-pick__name`},cb={class:`ni-field-row ni-field-row--top`},lb={key:0,ref:`dlgCode`,class:`vars-dlg__code`,spellcheck:`false`},ub=[`placeholder`],db={class:`ni-field-row ni-field-row--top`},fb={key:0,class:`vars-dlg__err`},pb={class:`ni-foot`},mb={class:`ni-foot-btns`};function hb(e,t,n,r,i,a){let o=L(`StructureTree`),s=L(`NodeInspector`),c=L(`EventEditor`),l=L(`StateDiffPanel`),u=L(`LogValue`),d=L(`JsonTree`),f=L(`Dropdown`),p=L(`NumberStepper`),m=L(`SetSegment`),h=L(`ConfirmDialog`);return B(),V(`aside`,ev,[U(`div`,tv,[(B(!0),V(z,null,R(i.tabs,t=>(B(),V(`button`,{key:t.key,class:A([`debug__tab`,{"debug__tab--active":n.activeTab===t.key}]),onClick:n=>e.$emit(`update:activeTab`,t.key)},j(t.label),11,nv))),128))]),U(`div`,rv,[n.activeTab===`vars`?(B(),V(z,{key:0},[K(` 变量列表视图:管理 schema.dictionary.inputParams(变量属性的增 / 删 / 改) `),i.varsMode===`list`?(B(),V(`div`,iv,[K(` 空态占位:与卡片来源 / API 调用面板同款语言 `),a.inputParams.length?(B(),V(`ul`,ov,[(B(!0),V(z,null,R(a.inputParams,(e,n)=>(B(),V(`li`,{key:e.key||n,class:`vars__row`,onDblclick:e=>a.openVarDlg(n)},[U(`span`,cv,j(e.key),1),U(`span`,{class:A([`vars__type`,`vars__type--`+(e.type||`string`)])},j(e.type||`string`),3),a.hasMock(e)?(B(),V(`span`,lv,`m`)):K(`v-if`,!0),U(`span`,{class:`vars__name`,title:[e.name,e.desc].filter(Boolean).join(` · `)},j(e.name||e.desc||``),9,uv),K(` 操作区双击不冒泡到行:连点复制/删除/编辑钮时不误开编辑弹窗 `),U(`span`,{class:`vars__ops`,onDblclick:t[0]||=q(()=>{},[`stop`])},[K(` 复制变量名:复制当前变量 key(绑定以 $key 引用),无变量名时禁用 `),U(`button`,{class:`vars__op`,type:`button`,disabled:!e.key,title:i.copiedVar===n?`已复制 ✓`:e.key?`复制变量名`:`暂无变量名`,onClick:t=>a.copyVarName(e,n)},[i.copiedVar===n?(B(),V(`span`,fv,`✓`)):(B(),V(`svg`,pv,[...t[51]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,dv),U(`button`,{class:`vars__op`,type:`button`,title:`编辑变量`,onClick:e=>a.openVarDlg(n)},[...t[52]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-gear`})],-1)]],8,mv),U(`button`,{class:`vars__op vars__op--del`,type:`button`,title:`删除变量`,onClick:e=>a.askDeleteVar(n)},[...t[53]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],8,hv)],32)],40,sv))),128))])):(B(),V(`div`,av,[...t[50]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-settings"></use></svg></span><p class="debug__empty">暂无变量</p><p class="empty-state__hint">变量与 schema.dictionary.inputParams 一一对应:绑定表达式以 $key 引用,mock 值供设计期预览</p>`,3)]])),K(` 右下角悬浮操作组:与 mock 视图悬浮条同语言,不占固定行高 `),U(`div`,gv,[U(`button`,{class:`debug__copy`,type:`button`,title:`新增变量(写入 dictionary.inputParams)`,onClick:t[1]||=e=>a.openVarDlg(null)},`+ 添加变量`),a.inputParams.length?(B(),V(`button`,{key:0,class:`debug__copy`,type:`button`,title:`以 Raw JSON 编辑全部变量的设计期 mock 数据`,onClick:t[2]||=e=>i.varsMode=`mock`},`配置变量 mock`)):K(`v-if`,!0)])])):(B(),V(z,{key:1},[K(` mock 二级视图:仅 Raw JSON(CodeJar + Prism 高亮);右下角操作按钮只在此出现 `),U(`div`,_v,[U(`div`,vv,[U(`button`,{class:`vars__back`,type:`button`,title:`返回变量列表`,onClick:t[3]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[54]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-left`})],-1),G(` 变量 `,-1)]]),t[55]||=U(`span`,{class:`vars__mocktitle`},`变量 mock · 设计期覆盖(dictionary.mocks · Raw JSON)`,-1),t[56]||=U(`span`,{class:`vars__mockhint`},`仅设计期生效 · 未列出的键回退默认值`,-1)]),U(`div`,yv,[K(` 报错提示条:与顶部提示条同语言(语义色软底 + 图标 + 关闭),钉在编辑器顶部不挤占编辑区 `),i.rawError?(B(),V(`div`,bv,[t[57]||=U(`svg`,{class:`raw-err-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,xv,j(i.rawError),1),U(`button`,{class:`raw-err-bar__close`,type:`button`,title:`关闭`,onClick:t[4]||=e=>i.rawError=``},`✕`)])):K(`v-if`,!0),U(`div`,Sv,null,512)]),U(`div`,Cv,[K(` 右下角悬浮组内的返回:与头部 chip 同一 leaveMock 语义,手不离编辑区即可退出二级视图 `),U(`button`,{class:`debug__copy`,type:`button`,title:`返回变量列表`,onClick:t[5]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[58]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-left`})],-1),G(`返回 `,-1)]]),t[62]||=U(`span`,{class:`debug__sep`},null,-1),i.copied?(B(),V(`span`,wv,`已复制 ✓`)):K(`v-if`,!0),U(`button`,{class:`debug__copy`,type:`button`,onClick:t[6]||=(...e)=>a.copyScope&&a.copyScope(...e)},[...t[59]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-copy-sm`})],-1),G(`复制 `,-1)]]),t[63]||=U(`span`,{class:`debug__sep`},null,-1),U(`button`,{class:`debug__copy debug__copy--primary`,type:`button`,onClick:t[7]||=(...e)=>a.saveRaw&&a.saveRaw(...e)},[...t[60]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-check`})],-1),G(`应用 `,-1)]]),U(`button`,{class:`debug__copy debug__copy--warn`,type:`button`,onClick:t[8]||=t=>e.$emit(`reset-import`),title:`丢弃内存编辑,从磁盘重新载入(导入优先于编辑)`},[...t[61]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1),G(`重置 `,-1)]])])])],2112))],64)):n.activeTab===`structure`?(B(),V(`div`,Tv,[W(o,{preview:n.preview,schema:n.schema,"card-code":n.cardId,"selected-node-id":n.selectedNodeId,"move-collapse-token":n.moveCollapseToken,"can-paste":a.canPaste,onEditEvent:a.onEditEvent,onInspect:a.onInspect,onSelectNode:a.onSelectNode,onAddNode:a.onAddNode,onMoveNode:a.onMoveNode,onHoverNode:a.onHoverNode,onCopySelected:t[9]||=t=>e.$emit(`copy-selected`),onPaste:t[10]||=t=>e.$emit(`paste`),onDuplicate:t[11]||=t=>e.$emit(`duplicate`),onDeleteSelected:t[12]||=t=>e.$emit(`delete-selected`),onRenameCard:t[13]||=t=>e.$emit(`rename-card`)},null,8,[`preview`,`schema`,`card-code`,`selected-node-id`,`move-collapse-token`,`can-paste`,`onEditEvent`,`onInspect`,`onSelectNode`,`onAddNode`,`onMoveNode`,`onHoverNode`]),K(` 右下角悬浮融合按钮组:查看 schema(全屏只读面板)+ 复制整份 schema `),U(`div`,Ev,[U(`button`,{class:`debug__copy`,type:`button`,title:`全屏查看当前卡片的原始 schema(只读)`,onClick:t[14]||=(...e)=>a.openSchemaViewer&&a.openSchemaViewer(...e)},`查看 schema`),U(`button`,{class:`debug__copy`,type:`button`,title:i.copiedSchemaText?`已复制 ✓`:`复制整份 schema(含变量 mock 合并后的数据)`,onClick:t[15]||=(...e)=>a.copySchemaText&&a.copySchemaText(...e)},[i.copiedSchemaText?(B(),V(`span`,Ov,`✓`)):(B(),V(`svg`,kv,[...t[64]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]])),t[65]||=G(`复制 `,-1)],8,Dv)])])):n.activeTab===`meta`?(B(),V(`div`,Av,[K(` 空状态占位:与 API 调用面板同款(虚线徽章 + 线性图标 + 文案 + 弱提示) `),i.importMeta?(B(),V(`dl`,Mv,[U(`div`,Nv,[t[68]||=U(`dt`,null,`导入接口`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.interface),1),t[67]||=G(),U(`span`,Pv,`(`+j(i.importMeta.source)+`)`,1)])]),U(`div`,Fv,[t[69]||=U(`dt`,null,`远端基址`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.baseUrl),1)])]),U(`div`,Iv,[t[70]||=U(`dt`,null,`cardId`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.cardId),1)])]),U(`div`,Lv,[t[71]||=U(`dt`,null,`cardCode`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.cardCode),1)])]),i.importMeta.cardName?(B(),V(`div`,Rv,[t[72]||=U(`dt`,null,`卡片标题`,-1),U(`dd`,null,j(i.importMeta.cardName),1)])):K(`v-if`,!0),U(`div`,zv,[t[74]||=U(`dt`,null,`应用 / 空间`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.appId),1),t[73]||=G(` / `,-1),U(`code`,null,j(i.importMeta.workspaceId),1)])]),U(`div`,Bv,[t[75]||=U(`dt`,null,`同步时间`,-1),U(`dd`,null,j(a.formatTime(i.importMeta.syncedAt)),1)]),U(`div`,Vv,[t[76]||=U(`dt`,null,`落库位置`,-1),U(`dd`,null,[U(`code`,null,`src/cards/`+j(i.importMeta.cardCode)+`/`,1)])]),U(`div`,Hv,[t[77]||=U(`dt`,null,`本地状态`,-1),U(`dd`,null,[i.importMeta.dirty?(B(),V(`span`,Uv,`已编辑(偏离导入镜像)`)):(B(),V(`span`,Wv,`与导入镜像一致`))])]),i.importMeta.lastExport?(B(),V(`div`,Gv,[t[78]||=U(`dt`,null,`最近导出`,-1),U(`dd`,null,[i.importMeta.lastExport.ok?(B(),V(`span`,Kv,`读回校验通过 ✓`)):(B(),V(`span`,qv,`读回校验未通过 ✗`)),U(`span`,Jv,`(`+j(a.formatTime(i.importMeta.lastExport.at))+`)`,1),i.importMeta.lastExport.readBackError?(B(),V(`span`,Yv,` · `+j(i.importMeta.lastExport.readBackError),1)):K(`v-if`,!0)])])):K(`v-if`,!0)])):(B(),V(`div`,jv,[...t[66]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cloud"></use></svg></span><p class="debug__empty">暂无卡片来源</p><p class="empty-state__hint">该卡尚未经「同步远程」导入,无导入来源元数据;本地新建卡 / 未同步卡均如此</p>`,3)]])),t[79]||=U(`p`,{class:`debug__meta-hint`},`导入优先于编辑:在「变量」tab →「配置变量 mock」里点「重置」,可丢弃内存编辑、从磁盘重新载入最新导入。`,-1)])):K(`v-if`,!0)]),K(`
179
+ `;)r+=1;continue}if(e===`/`&&t[r+1]===`*`){let e=t.indexOf(`*/`,r+2);r=e===-1?i:e+2;continue}if(e===`;`||e===`,`){o(),r+=1;continue}if(/[A-Za-z_$]/.test(e)){let e=r;for(;e<i&&/[A-Za-z0-9_$]/.test(t[e]);)e+=1;let a=t.slice(r,e);t[s(e)]===`:`?n+=`"`+a+`"`:n+=a===`undefined`||a===`NaN`||a===`Infinity`?`null`:a,r=e;continue}if(e===`-`&&t.startsWith(`Infinity`,r+1)){n+=`null`,r+=9;continue}if(/[0-9]/.test(e)||e===`-`&&/[0-9]/.test(t[r+1]||``)){let e=r;for(;e<i&&/[0-9eE+\-.]/.test(t[e]);)e+=1;let a=t.slice(r,e);t[s(e)]===`:`?n+=`"`+a+`"`:n+=a,r=e;continue}if(e===`}`||e===`]`){let e=a();for(;e>=0&&n[e]===`,`;)n=n.slice(0,e)+n.slice(e+1),e=a()}n+=e,r+=1}try{return{value:JSON.parse(n.trim()||`{}`)}}catch(e){return{error:e.message}}}function Y_(e){let t=/^\d{2}:\d{2}:\d{2}\.\d{3}\s+(INFO|OK\s|WARN|ERR)\b/.exec(e);if(t){let e=t[1].trim();return e===`ERR`?`error`:e===`WARN`?`warn`:e===`OK`?`ok`:`info`}return`info`}function X_(e){let t=String(e&&e.text!=null?e.text:``),n=P_(t);return{seq:Number(e&&e.seq)||0,t:Number(e&&e.t)||0,level:Y_(n),plain:n,html:G_(t)}}function Z_(e,t){if(e===t)return!0;if(typeof e!=`object`||!e||typeof t!=`object`||!t)return!1;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(!Object.prototype.hasOwnProperty.call(t,r)||!Z_(e[r],t[r]))return!1;return!0}function Q_(e){return e===void 0?void 0:JSON.parse(JSON.stringify(e))}var $_={name:`DebugPanel`,components:{JsonTree:qp,StateDiffPanel:Cm,StructureTree:Ym,NodeInspector:Oh,EventEditor:dg,LogValue:Ug,Dropdown:e_,ConfirmDialog:_p,NumberStepper:c_,SetSegment:w_},props:{rt:{type:Object,required:!0},preview:{type:Object,default:null},schema:{type:Object,default:null},cardId:{type:String,default:``},reloadToken:{type:Number,default:0},cardCount:{type:Number,default:0},selectedNodeId:{type:String,default:``},moveCollapseToken:{type:Number,default:0},activeTab:{type:String,default:`vars`},metaRefreshToken:{type:Number,default:0},devSvcClass:{type:String,default:`app__btn--warn`},devSvcTitle:{type:String,default:``},devSvcLabel:{type:String,default:``},devSvcConn:{type:String,default:``},chromeOff:{type:Boolean,default:!1}},data(){return{copied:!1,copyTimer:null,copiedVar:null,varCopyTimer:null,errorPanel:``,eventTab:`log`,svcLogs:[],svcLogSeq:0,svcLogFloor:0,svcLogLive:!1,svcLogFollow:!0,svcLogDropped:0,svcLogLoading:!1,svcLogErr:``,svcCopied:!1,statePanelOpen:!1,panelH:this.loadPanelH(),panelDragging:!1,inspectingComp:null,inspectKey:0,editingEventComp:null,eventEditorKey:0,rawText:``,rawError:``,varsMode:`list`,varDlg:null,varDlgError:``,delVarTarget:null,schemaViewerOpen:!1,copiedSchemaText:!1,copiedCode:!1,schemaViewData:null,varTypeOptions:[{key:`string`,value:`字符串`},{key:`number`,value:`数字`},{key:`boolean`,value:`布尔`},{key:`array`,value:`数组`},{key:`object`,value:`对象`}],varBoolOptions:[{key:`true`,value:`true`},{key:`false`,value:`false`}],importMeta:null,remoteVersionLoading:!1,remoteVersionError:``,tabs:[{key:`vars`,label:`变量`},{key:`structure`,label:`组件结构`},{key:`meta`,label:`卡片来源`}]}},computed:{mocks(){return k_(this.schema)||{}},inputParams(){let e=this.schema&&this.schema.dictionary;return e&&Array.isArray(e.inputParams)?e.inputParams:[]},delVarRefs(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];return this.scanVarRefs(e&&e.key)},delVarSeverity(){let e=this.delVarRefs;return e.binding+e.event+e.other>0?`danger`:`warn`},delVarConfirmText(){return this.delVarSeverity===`danger`?`仍要删除`:`删除`},delVarMessage(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];if(!e)return``;let t=e.name&&e.name!==e.key?`(`+e.name+`)`:``,n=this.delVarRefs,r=n.binding+n.event+n.other;if(r>0){let i=[];return n.binding&&i.push(`绑定表达式 ${n.binding} 处`),n.event&&i.push(`事件脚本 ${n.event} 处`),n.other&&i.push(`其它文本 ${n.other} 处`),`变量「${e.key}」${t}仍被${i.join(`、`)}引用(共 ${r} 处)。删除后这些引用将取不到值,画布可能出现空白或执行报错,请先迁移再删除。`}return`变量「${e.key}」${t}当前未被任何绑定表达式或事件脚本引用。删除后变量定义与 mock 值一并移除,不可恢复。`},svcEmptyText(){return this.devSvcConn===`unconfigured`?`未配置本地开发服务`:this.devSvcConn===`open`?`暂无服务日志`:`本地服务未连接`},svcEmptyHint(){return this.svcLogErr?`取历史失败:`+this.svcLogErr+`(本地服务需升级到支持 /__logs 的 cardbuddy 版本)`:this.devSvcConn===`unconfigured`?`在顶栏「连接」中配置本地开发服务地址后,这里会实时镜像该服务终端的彩色输出`:this.devSvcConn===`open`?`cardbuddy 终端的输出(含配色)会实时镜像到这里;试试同步、保存、校验或截图`:`连接恢复后自动继续;服务端保留最近 800 行历史,重连不丢`},scopeText(){this.rt.revision;try{return JSON.stringify(this.rt.rootScope,null,2)}catch{return`(无法序列化)`}},bindingErrors(){return this.rt.errorRev,this.rt.errors.slice()},eventErrors(){return this.rt.errorRev,this.rt.eventErrors.slice()},logs(){return this.rt.logRev,this.rt.eventLogs.slice()},eventCount(){return this.eventErrors.length+this.logs.length},eventStatusClass(){return this.eventErrors.length?`is-error`:this.logs.length?`is-log`:`is-ok`},eventStatusTitle(){return this.eventErrors.length?`查看事件(含错误)`:this.logs.length?`查看事件(含日志)`:`无事件记录`},panelErrors(){return this.errorPanel===`event`?this.eventErrors:this.bindingErrors},compNames(){let e={};for(let t in vu)e[t]=vu[t].name||t;return e.Root=`根`,e},canPaste(){return!!Vu.node},schemaText(){if(!this.schema)return``;try{let e={...this.schema};return this.rt&&this.rt.rootScope&&(e.data=this.rt.rootScope),JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t,2)}catch{return`(无法序列化)`}},schemaTextLines(){return this.schemaText?this.schemaText.split(`
180
+ `).length:0},schemaTextBytes(){let e=new Blob([this.schemaText]).size;return e>=1024?(e/1024).toFixed(1)+` KB`:e+` B`},stateDirty(){return this.rt.revision,!Z_(this.rt.state,this.rt.rootScope)}},watch:{errorPanel(e){e===`svclog`?this.startSvcLog():this.stopSvcLog()},cardId:{immediate:!0,handler(){this.rawError=``,this.destroyJar(),this.varsMode=`list`,this.varDlg=null,this.varDlgError=``,this.delVarTarget=null,this.inspectingComp=null,this.editingEventComp=null,this.importMeta=null,this.remoteVersionLoading=!1,this.remoteVersionError=``,this.schemaViewerOpen=!1,this.maybeFetchMeta()}},reloadToken(){this.maybeFetchMeta()},metaRefreshToken(e,t){e!==t&&this.activeTab===`meta`&&this.fetchImportMeta()},activeTab(e){e===`meta`&&this.fetchImportMeta(),e!==`vars`&&(this.varsMode=`list`,this.rawError=``,this.destroyJar(),this.varDlg=null)},varDlg(e){if(!e){this.destroyDlgJar();return}this.varDlgError=``,this.isComplexType(e.form.type)&&this.$nextTick(()=>this.initDlgJar())},"varDlg.form.type"(e,t){!this.varDlg||e===t||(this.varDlg.form.defaultValue=this.normalizeDefaultText(e,this.varDlg.form.defaultValue),this.isComplexType(e)?this.$nextTick(()=>this.initDlgJar()):this.destroyDlgJar())},varsMode(e){e===`mock`?(this.seedRawFromMocks(),this.$nextTick(()=>this.initJar())):(this.rawError=``,this.destroyJar())},schema(){this.inspectingComp=null,this.editingEventComp=null,this.varsMode===`mock`&&this.seedRawFromMocks()}},mounted(){let e=this.panelH;this.$refs.statePanel&&(this.$refs.statePanel.style.height=e+`px`),this.$refs.errPanel&&(this.$refs.errPanel.style.height=e+`px`)},beforeUnmount(){this.destroyJar(),this.destroyDlgJar(),this.cancelResize(),this.stopSvcLog()},methods:{toggleStatePanel(){this.statePanelOpen=!this.statePanelOpen,this.statePanelOpen&&(this.errorPanel=``)},toggleErrorPanel(e){this.errorPanel=this.errorPanel===e?``:e,this.errorPanel&&(this.statePanelOpen=!1,e===`event`&&(this.eventTab=this.eventErrors.length?`err`:`log`))},startResize(e){if(e.target.closest(`button`))return;this.panelDragging=!0;let t=e.clientY,n=this.panelH,r=Math.max(120,Math.round(window.innerHeight*.6)),i=e=>{this.panelH=e,this.$refs.statePanel&&(this.$refs.statePanel.style.height=e+`px`),this.$refs.errPanel&&(this.$refs.errPanel.style.height=e+`px`)},a=e=>{let a=t-e.clientY;i(Math.min(r,Math.max(120,n+a)))},o=()=>{document.body.style.cursor=``,document.body.style.userSelect=``,document.removeEventListener(`mousemove`,a),document.removeEventListener(`mouseup`,o),this._resizeMove=this._resizeUp=null,this.panelDragging=!1,this.savePanelH()};this._resizeMove=a,this._resizeUp=o,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`,document.addEventListener(`mousemove`,a),document.addEventListener(`mouseup`,o)},cancelResize(){this._resizeMove&&document.removeEventListener(`mousemove`,this._resizeMove),this._resizeUp&&document.removeEventListener(`mouseup`,this._resizeUp),this._resizeMove=this._resizeUp=null,this.panelDragging=!1,document.body.style.cursor=``,document.body.style.userSelect=``},loadPanelH(){try{let e=localStorage.getItem(`cardbuddy:debug-panel-height`);if(e!=null){let t=parseInt(e,10);if(!Number.isNaN(t)){let e=Math.max(120,Math.round(window.innerHeight*.6));return Math.min(e,Math.max(120,t))}}}catch{}return 240},savePanelH(){try{localStorage.setItem(`cardbuddy:debug-panel-height`,String(Math.round(this.panelH)))}catch{}},initJar(){let e=this.$refs.rawEditor;if(!e)return;this.destroyJar();let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.json,`json`)};this._jar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.rawText||``),this._jar.onUpdate(e=>{this.rawText=e,this.rawError&&=``}),window.__rawEditor=this._jar,this.$nextTick(()=>e.focus())},destroyJar(){this._jar&&this._jar.destroy&&this._jar.destroy(),this._jar=null,typeof window<`u`&&window.__rawEditor&&(window.__rawEditor=null)},initDlgJar(){let e=this.$refs.dlgCode;if(!e)return;this.destroyDlgJar();let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.json,`json`)};this._dlgJar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._dlgJar.updateCode(this.varDlg?this.varDlg.form.defaultValue:``),this._dlgJar.onUpdate(e=>{this.varDlg&&(this.varDlg.form.defaultValue=e),this.varDlgError&&=``}),window.__dlgEditor=this._dlgJar},destroyDlgJar(){this._dlgJar&&this._dlgJar.destroy&&this._dlgJar.destroy(),this._dlgJar=null,typeof window<`u`&&window.__dlgEditor&&(window.__dlgEditor=null)},complexSeed(e,t){let n=e===`array`?`[]`:`{}`,r=String(t??``).trim();if(!r)return n;try{let t=JSON.parse(r);return(e===`array`?Array.isArray(t):t&&typeof t==`object`)?JSON.stringify(t,null,2):n}catch{return n}},normalizeDefaultText(e,t){if(this.isComplexType(e))return this.complexSeed(e,t);let n=String(t??``).trim();return e===`number`?n!==``&&Number.isFinite(Number(n))?String(Number(n)):``:e===`boolean`?/^(true|1)$/i.test(n)?`true`:`false`:String(t??``)},saveRaw(){let e=J_(this.rawText);if(e.error){this.rawError=`JSON 格式错误:`+e.error;return}if(e.value===null||typeof e.value!=`object`||Array.isArray(e.value)){this.rawError=`变量 mock 必须是 JSON 对象({ ... })`;return}let t=this.schema;if(!t){this.rawError=`当前未载入卡片`;return}(!t.dictionary||typeof t.dictionary!=`object`)&&(t.dictionary={dictionaryList:[],inputParams:[]}),t.dictionary.mocks=e.value,this.rt.setRootScope(O_(t,{includeMocks:!0}));let n=JSON.stringify(e.value,null,2);this.rawText=n,this._jar&&this._jar.updateCode(n),this.$nextTick(()=>this.onCommit()),this.rawError=``},async copyScope(){await op(this.rawText||``)&&(this.copied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.copied=!1},1500))},onEditEvent(e){this.editingEventComp=e,this.eventEditorKey++},onApply(){this.$emit(`schema-changed`)},onCommit(){this.$emit(`schema-commit`)},hasMock(e){return A_(this.mocks,e.key)},async copyVarName(e,t){let n=e&&e.key?String(e.key):``;n&&await op(n)&&(this.copiedVar=t,this.varCopyTimer&&clearTimeout(this.varCopyTimer),this.varCopyTimer=setTimeout(()=>{this.copiedVar===t&&(this.copiedVar=null)},1500))},async copyCardCode(){let e=this.importMeta&&this.importMeta.cardCode!=null?String(this.importMeta.cardCode):``;e&&await op(e)&&(this.copiedCode=!0,this._codeCopyTimer&&clearTimeout(this._codeCopyTimer),this._codeCopyTimer=setTimeout(()=>{this.copiedCode=!1},1500))},isComplexType(e){return e===`array`||e===`object`},scalarPlaceholder(e){return e===`number`?`数字,如 0 / 99.5`:`字符串原样保存`},onVarTypeChange(e){this.varDlg&&(this.varDlg.form.type=e)},openVarDlg(e){let t=e==null?null:this.inputParams[e],n=t&&t.type||`string`,r=t?t.defaultValue:void 0,i=``;r!=null&&(i=typeof r==`object`?JSON.stringify(r,null,2):String(r)),i=this.normalizeDefaultText(n,i),this.varDlgError=``,this.varDlg={index:e,form:{key:t&&t.key||``,name:t&&t.name||``,type:n,defaultValue:i,desc:t&&t.desc||``}}},parseDefault(e,t){let n=String(t??``).trim();if(this.isComplexType(e)){if(!n)return{value:e===`array`?[]:{}};let t=J_(n);if(t.error)return{error:`默认值不是合法 JSON:`+t.error};let r=t.value;return e===`array`&&!Array.isArray(r)?{error:`默认值需为 JSON 数组`}:e===`object`&&(typeof r!=`object`||!r||Array.isArray(r))?{error:`默认值需为 JSON 对象`}:{value:r}}if(e===`number`){if(!n)return{value:0};let e=Number(n);return Number.isFinite(e)?{value:e}:{error:`默认值不是合法数字`}}return e===`boolean`?n?n===`true`||n===`1`?{value:!0}:n===`false`||n===`0`?{value:!1}:{error:`布尔默认值仅接受 true / false`}:{value:!1}:{value:String(t??``)}},confirmVarDlg(){let e=this.varDlg;if(!e)return;let t=e.form,n=String(t.key||``).trim(),r=String(t.name||``).trim();if(!/^[A-Za-z_][A-Za-z0-9_]*$/.test(n)){this.varDlgError=`变量名需为字母 / 下划线开头的英文标识(绑定以 $key 引用)`;return}if(this.inputParams.some((t,r)=>t.key===n&&r!==e.index)){this.varDlgError=`已存在同名变量 `+n;return}if(!r){this.varDlgError=`中文名不能为空`;return}let i=this.parseDefault(t.type,t.defaultValue);if(i.error){this.varDlgError=i.error;return}if(this.isComplexType(t.type)){let e=JSON.stringify(i.value,null,2);t.defaultValue=e,this._dlgJar&&this._dlgJar.updateCode(e)}let a=this.schema;if(!a){this.varDlgError=`当前未载入卡片`;return}(!a.dictionary||typeof a.dictionary!=`object`)&&(a.dictionary={dictionaryList:[],inputParams:[]}),Array.isArray(a.dictionary.inputParams)||(a.dictionary.inputParams=[]);let o=a.dictionary.inputParams,s=this.rt.rootScope,c=k_(a)||{},l=Q_(i.value);if(e.index==null)o.push({key:n,name:r,type:t.type,defaultValue:Q_(l),desc:String(t.desc||``),rule:{type:``,options:{}},children:[]}),A_(c,n)||(s[n]=l);else{let i=o[e.index];if(!i)return;let a=i.key;i.key=n,i.name=r,i.type=t.type,i.desc=String(t.desc||``),i.defaultValue=Q_(l),a!==n&&(Object.prototype.hasOwnProperty.call(c,a)&&(c[n]=c[a],delete c[a]),s&&Object.prototype.hasOwnProperty.call(s,a)&&delete s[a]),A_(c,n)||(s[n]=l)}this.varDlg=null,this.onCommit()},askDeleteVar(e){this.delVarTarget=e},scanVarRefs(e){let t={binding:0,event:0,other:0},n=this.schema;if(!e||!n||typeof n!=`object`)return t;let r=String(e).replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),i=RegExp(`\\$`+r+`(?![A-Za-z0-9_$])`),a=RegExp(`state\\s*(?:\\.\\s*`+r+`(?![A-Za-z0-9_$])|\\[\\s*['"]`+r+`['"]\\s*\\])`),o=e=>i.test(e)||a.test(e),s=e=>{if(e!=null){if(Array.isArray(e)){for(let t of e)s(t);return}if(typeof e==`object`){for(let[n,r]of Object.entries(e))if(n!==`dictionary`&&n!==`compiled`)if(typeof r==`string`){if(!o(r))continue;n===`itemValue`?t.binding+=1:n===`code`?t.event+=1:t.other+=1}else s(r)}}};return s(n),t},confirmDeleteVar(){let e=this.delVarTarget==null?null:this.inputParams[this.delVarTarget];if(this.delVarTarget=null,!e||!this.schema||!this.schema.dictionary)return;let t=this.schema.dictionary.inputParams||[],n=t.indexOf(e);n>=0&&t.splice(n,1);let r=k_(this.schema)||{};Object.prototype.hasOwnProperty.call(r,e.key)&&delete r[e.key];let i=this.rt.rootScope;i&&Object.prototype.hasOwnProperty.call(i,e.key)&&delete i[e.key],this.onCommit()},leaveMock(){this.varsMode=`list`},seedRawFromMocks(){this.rawError=``;try{this.rawText=JSON.stringify(this.mocks,null,2)}catch(e){this.rawText=``,this.rawError=`无法序列化当前数据:`+(e&&e.message);return}this._jar&&this._jar.updateCode(this.rawText)},onInspect(e){this.inspectingComp=e,this.inspectKey++},openSchemaViewer(){try{let e={...this.schema||{}};this.schema&&this.rt&&this.rt.rootScope&&(e.data=this.rt.rootScope),this.schemaViewData=this.schema?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null}catch{this.schemaViewData=null}this.schemaViewerOpen=!0,this.$nextTick(()=>{let e=this.$refs.schemaViewerEl;e&&e.focus&&e.focus()})},onSchemaViewerKey(e){if(e.key===`Escape`){e.preventDefault(),this.schemaViewerOpen=!1;return}(e.key===`c`||e.key===`C`)&&!e.metaKey&&!e.ctrlKey&&!e.altKey&&(e.preventDefault(),this.copySchemaText())},async copySchemaText(){!this.schema||!this.schemaText||await op(this.schemaText)&&(this.copiedSchemaText=!0,clearTimeout(this._schemaCopyTimer),this._schemaCopyTimer=setTimeout(()=>{this.copiedSchemaText=!1},1500))},onSelectNode(e){this.$emit(`select-node`,e)},onAddNode(e){this.$emit(`add-node`,e)},onMoveNode(e){this.$emit(`move-node`,e)},onHoverNode(e){this.$emit(`hover-node`,e)},clearEventLogs(){this.rt.clearEventLogs()},async startSvcLog(){this.svcLogFollow=!0,await this.pullSvcLogHistory(0),!this._svcUnsub&&(this._svcUnsub=Ul(e=>this.appendSvcLogs(e&&e.lines),e=>{this.svcLogLive=e===`open`,e===`open`&&this.svcLogSeq&&this.pullSvcLogHistory(this.svcLogSeq)}))},stopSvcLog(){this._svcUnsub&&=(this._svcUnsub(),null),this.svcLogLive=!1},async pullSvcLogHistory(e){if(this.svcLogLoading)return;this.svcLogLoading=!0;let t=Math.max(Number(e)||0,this.svcLogFloor);try{let e=await Wl({limit:q_,since:t});if(this.svcLogErr=``,e&&e.enabled===!1)this.svcLogErr=`服务端已关闭日志流(CARDBUDDY_STREAM_LOGS=0)`;else{this.svcLogDropped=e&&e.dropped||0,e&&e.seq&&(this.svcLogSeq=Math.max(this.svcLogSeq,e.seq));let n=(e&&e.lines||[]).map(X_);t?this.appendSvcLogs(n):this.svcLogs=n,this.scrollSvcToBottom(!0)}}catch(e){this.svcLogErr=e&&e.message||String(e)}finally{this.svcLogLoading=!1}},appendSvcLogs(e){let t=Array.isArray(e)?e:[];if(!t.length)return;let n=[];for(let e of t){let t=e&&e.html!=null?e:X_(e),r=Number(t.seq)||0;r&&r<=this.svcLogSeq||(r&&(this.svcLogSeq=r),n.push(t))}if(!n.length)return;let r=this.svcLogs.concat(n);this.svcLogs=r.length>q_?r.slice(r.length-q_):r,this.svcLogFollow&&this.scrollSvcToBottom()},clearSvcLogs(){this.svcLogFloor=this.svcLogSeq,this.svcLogs=[],this.svcLogDropped=0},async copySvcLogs(){await op(this.svcLogs.map(e=>e.plain).join(`
181
+ `))&&(this.svcCopied=!0,this._svcCopiedTimer&&clearTimeout(this._svcCopiedTimer),this._svcCopiedTimer=setTimeout(()=>{this.svcCopied=!1},1200))},toggleSvcFollow(){this.svcLogFollow=!this.svcLogFollow,this.svcLogFollow&&this.scrollSvcToBottom(!0)},scrollSvcToBottom(e){!e&&!this.svcLogFollow||this.$nextTick(()=>{let e=this.$refs.errBody;e&&(e.scrollTop=e.scrollHeight)})},onErrBodyScroll(){if(this.errorPanel!==`svclog`)return;let e=this.$refs.errBody;e&&(this.svcLogFollow=e.scrollHeight-e.scrollTop-e.clientHeight<24)},fmtTime(e){if(!e)return`--:--:--`;let t=new Date(e),n=e=>String(e).padStart(2,`0`);return n(t.getHours())+`:`+n(t.getMinutes())+`:`+n(t.getSeconds())},maybeFetchMeta(){this.activeTab===`meta`&&this.fetchImportMeta()},async fetchImportMeta(){let e=this.cardId;if(!e){this.importMeta=null;return}try{let t=await J(`/__import-meta/${encodeURIComponent(e)}`);if(t.ok){let e=await t.json();this.importMeta=e.meta||null}else this.importMeta=null}catch{this.importMeta=null}},async refreshRemoteVersion(){if(!(!this.importMeta||!this.importMeta.cardId)){this.remoteVersionLoading=!0,this.remoteVersionError=``;try{let e=await J(`/__card-version/${encodeURIComponent(this.cardId)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok){let t=await e.json().catch(()=>({}));if(t.needCredentials){this.remoteVersionError=`需先登录 FinMall 后查询`;return}throw Error(t.message||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.message||`查询失败`);await this.fetchImportMeta()}catch(e){this.remoteVersionError=e&&e.message?e.message:`查询失败`}finally{this.remoteVersionLoading=!1}}},formatTime(e){if(!e)return`-`;try{return new Date(e).toLocaleString(`zh-CN`,{hour12:!1})}catch{return e}}}},ev={class:`debug`},tv={class:`debug__tabs`},nv=[`onClick`],rv={class:`debug__body`},iv={key:0,class:`vars`},av={key:0,class:`empty-state`},ov={key:1,class:`vars__list`},sv=[`onDblclick`],cv={class:`vars__key`},lv={key:0,class:`vars__mock`,title:`已配置 mock(dictionary.mocks,设计期覆盖默认值)`},uv=[`title`],dv=[`disabled`,`title`,`onClick`],fv={key:0,class:`debug__copy-ok`},pv={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},mv=[`onClick`],hv=[`onClick`],gv={class:`vars__fabs`},_v={class:`debug__scope-wrap debug__scope-wrap--raw`},vv={class:`vars__mockhead`},yv={class:`debug__scope-raw`},bv={key:0,class:`raw-err-bar`,role:`alert`},xv={class:`raw-err-bar__msg`},Sv={ref:`rawEditor`,class:`debug__raw-editor`,spellcheck:`false`},Cv={class:`debug__scope-foot`},wv={key:0,class:`debug__copied`},Tv={key:1,class:`structab`},Ev={class:`structab__fabs`},Dv=[`title`],Ov={key:0,class:`debug__copy-ok`},kv={key:1,class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Av={key:2,class:`debug__meta`},jv={key:0,class:`empty-state`},Mv={key:1,class:`debug__meta-list`},Nv={class:`debug__meta-row`},Pv={class:`debug__meta-muted`},Fv={class:`debug__meta-row`},Iv={class:`debug__meta-row`},Lv={class:`debug__meta-row`},Rv=[`title`],zv={key:0,class:`debug__copy-ok`},Bv={key:1,class:`debug__meta-copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Vv={key:0,class:`debug__meta-row`},Hv={class:`debug__meta-row`},Uv={class:`debug__meta-row`},Wv={class:`debug__meta-row`},Gv={class:`debug__meta-row`},Kv={key:0,class:`debug__tag debug__tag--warn`,title:`本地已编辑,偏离导入镜像`},qv={key:1,class:`debug__tag debug__tag--ok`},Jv={key:1,class:`debug__meta-row`},Yv={key:0,class:`debug__tag debug__tag--ok`},Xv={key:1,class:`debug__tag debug__tag--err`},Zv={class:`debug__meta-muted`},Qv={key:2,class:`debug__meta-err`},$v={class:`debug__meta-row`},ey={key:0,class:`debug__meta-muted`},ty={class:`debug__version`},ny={key:0,class:`debug__meta-muted`},ry={key:2,class:`debug__meta-err`},iy={key:3,class:`debug__meta-muted`},ay={class:`statepanel`,ref:`statePanel`},oy={class:`statepanel__head`},sy={class:`statepanel__tree`},cy={class:`statusbar`},ly=[`title`],uy=[`title`],dy={class:`statusbar__icon`},fy=[`title`],py={class:`statusbar__icon`},my=[`title`],hy={class:`statusbar__item statusbar__item--right`},gy={class:`statusbar__item statusbar__item--right`},_y={class:`errpanel`,ref:`errPanel`},vy={class:`errpanel__head`},yy={class:`errpanel__title`},by={key:0,class:`svclog__meta`},xy={key:0},Sy={key:1,class:`errpanel__tabs`},Cy={class:`errpanel__tab-count`},wy={class:`errpanel__actions`},Ty=[`disabled`],Ey=[`disabled`,`title`],Dy=[`title`],Oy=[`disabled`],ky={key:0,class:`empty-state`},Ay={class:`debug__empty`},jy={class:`empty-state__hint`},My={key:1,class:`svclog`},Ny=[`innerHTML`],Py={key:0,class:`empty-state`},Fy={key:1,class:`debug__list debug__list--log`},Iy={class:`log__time`},Ly={class:`log__content`},Ry={key:1,class:`log__empty`},zy={key:0,class:`empty-state`},By={key:1,class:`debug__list`},Vy={class:`err__time`},Hy={class:`debug__kind`},Uy={class:`err__msg`},Wy={key:0,class:`empty-state`},Gy={key:1,class:`debug__list`},Ky={class:`err__time`},qy={class:`debug__kind`},Jy={class:`err__msg`},Yy={class:`schemaview__title`},Xy={class:`schemaview__card`},Zy={class:`schemaview__meta`},Qy={class:`schemaview__acts`},$y=[`title`],eb={key:0,class:`debug__copy-ok`},tb={key:1,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},nb={key:0,class:`schemaview__tree`},rb={key:1,class:`empty-state`},ib=[`aria-label`],ab={class:`ni-head`},ob={class:`ni-title`},sb={class:`ni-cls`},cb={class:`ni-body`},lb={class:`ni-scroll`},ub={class:`ni-field-row`},db={class:`ni-field-row`},fb={class:`ni-field-row`},pb={key:0,class:`vars-type-pick`},mb={class:`vars-type-pick__name`},hb={class:`vars-type-pick`},gb={class:`vars-type-pick__name`},_b={class:`ni-field-row ni-field-row--top`},vb={key:0,ref:`dlgCode`,class:`vars-dlg__code`,spellcheck:`false`},yb=[`placeholder`],bb={class:`ni-field-row ni-field-row--top`},xb={key:0,class:`vars-dlg__err`},Sb={class:`ni-foot`},Cb={class:`ni-foot-btns`};function wb(e,t,n,r,i,a){let o=L(`StructureTree`),s=L(`NodeInspector`),c=L(`EventEditor`),l=L(`StateDiffPanel`),u=L(`LogValue`),d=L(`JsonTree`),f=L(`Dropdown`),p=L(`NumberStepper`),m=L(`SetSegment`),h=L(`ConfirmDialog`);return B(),V(`aside`,ev,[U(`div`,tv,[(B(!0),V(z,null,R(i.tabs,t=>(B(),V(`button`,{key:t.key,class:A([`debug__tab`,{"debug__tab--active":n.activeTab===t.key}]),onClick:n=>e.$emit(`update:activeTab`,t.key)},j(t.label),11,nv))),128))]),U(`div`,rv,[n.activeTab===`vars`?(B(),V(z,{key:0},[K(` 变量列表视图:管理 schema.dictionary.inputParams(变量属性的增 / 删 / 改) `),i.varsMode===`list`?(B(),V(`div`,iv,[K(` 空态占位:与卡片来源 / API 调用面板同款语言 `),a.inputParams.length?(B(),V(`ul`,ov,[(B(!0),V(z,null,R(a.inputParams,(e,n)=>(B(),V(`li`,{key:e.key||n,class:`vars__row`,onDblclick:e=>a.openVarDlg(n)},[U(`span`,cv,j(e.key),1),U(`span`,{class:A([`vars__type`,`vars__type--`+(e.type||`string`)])},j(e.type||`string`),3),a.hasMock(e)?(B(),V(`span`,lv,`m`)):K(`v-if`,!0),U(`span`,{class:`vars__name`,title:[e.name,e.desc].filter(Boolean).join(` · `)},j(e.name||e.desc||``),9,uv),K(` 操作区双击不冒泡到行:连点复制/删除/编辑钮时不误开编辑弹窗 `),U(`span`,{class:`vars__ops`,onDblclick:t[0]||=q(()=>{},[`stop`])},[K(` 复制变量名:复制当前变量 key(绑定以 $key 引用),无变量名时禁用 `),U(`button`,{class:`vars__op`,type:`button`,disabled:!e.key,title:i.copiedVar===n?`已复制 ✓`:e.key?`复制变量名`:`暂无变量名`,onClick:t=>a.copyVarName(e,n)},[i.copiedVar===n?(B(),V(`span`,fv,`✓`)):(B(),V(`svg`,pv,[...t[55]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,dv),U(`button`,{class:`vars__op`,type:`button`,title:`编辑变量`,onClick:e=>a.openVarDlg(n)},[...t[56]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-gear`})],-1)]],8,mv),U(`button`,{class:`vars__op vars__op--del`,type:`button`,title:`删除变量`,onClick:e=>a.askDeleteVar(n)},[...t[57]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],8,hv)],32)],40,sv))),128))])):(B(),V(`div`,av,[...t[54]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-settings"></use></svg></span><p class="debug__empty">暂无变量</p><p class="empty-state__hint">变量与 schema.dictionary.inputParams 一一对应:绑定表达式以 $key 引用,mock 值供设计期预览</p>`,3)]])),K(` 右下角悬浮操作组:与 mock 视图悬浮条同语言,不占固定行高 `),U(`div`,gv,[U(`button`,{class:`debug__copy`,type:`button`,title:`新增变量(写入 dictionary.inputParams)`,onClick:t[1]||=e=>a.openVarDlg(null)},`+ 添加变量`),a.inputParams.length?(B(),V(`button`,{key:0,class:`debug__copy`,type:`button`,title:`以 Raw JSON 编辑全部变量的设计期 mock 数据`,onClick:t[2]||=e=>i.varsMode=`mock`},`配置变量 mock`)):K(`v-if`,!0)])])):(B(),V(z,{key:1},[K(` mock 二级视图:仅 Raw JSON(CodeJar + Prism 高亮);右下角操作按钮只在此出现 `),U(`div`,_v,[U(`div`,vv,[U(`button`,{class:`vars__back`,type:`button`,title:`返回变量列表`,onClick:t[3]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[58]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-left`})],-1),G(` 变量 `,-1)]]),t[59]||=U(`span`,{class:`vars__mocktitle`},`变量 mock · 设计期覆盖(dictionary.mocks · Raw JSON)`,-1),t[60]||=U(`span`,{class:`vars__mockhint`},`仅设计期生效 · 未列出的键回退默认值`,-1)]),U(`div`,yv,[K(` 报错提示条:与顶部提示条同语言(语义色软底 + 图标 + 关闭),钉在编辑器顶部不挤占编辑区 `),i.rawError?(B(),V(`div`,bv,[t[61]||=U(`svg`,{class:`raw-err-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,xv,j(i.rawError),1),U(`button`,{class:`raw-err-bar__close`,type:`button`,title:`关闭`,onClick:t[4]||=e=>i.rawError=``},`✕`)])):K(`v-if`,!0),U(`div`,Sv,null,512)]),U(`div`,Cv,[K(` 右下角悬浮组内的返回:与头部 chip 同一 leaveMock 语义,手不离编辑区即可退出二级视图 `),U(`button`,{class:`debug__copy`,type:`button`,title:`返回变量列表`,onClick:t[5]||=(...e)=>a.leaveMock&&a.leaveMock(...e)},[...t[62]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-left`})],-1),G(`返回 `,-1)]]),t[66]||=U(`span`,{class:`debug__sep`},null,-1),i.copied?(B(),V(`span`,wv,`已复制 ✓`)):K(`v-if`,!0),U(`button`,{class:`debug__copy`,type:`button`,onClick:t[6]||=(...e)=>a.copyScope&&a.copyScope(...e)},[...t[63]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-copy-sm`})],-1),G(`复制 `,-1)]]),t[67]||=U(`span`,{class:`debug__sep`},null,-1),U(`button`,{class:`debug__copy debug__copy--primary`,type:`button`,onClick:t[7]||=(...e)=>a.saveRaw&&a.saveRaw(...e)},[...t[64]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-check`})],-1),G(`应用 `,-1)]]),U(`button`,{class:`debug__copy debug__copy--warn`,type:`button`,onClick:t[8]||=t=>e.$emit(`reset-import`),title:`丢弃内存编辑,从磁盘重新载入(导入优先于编辑)`},[...t[65]||=[U(`svg`,{class:`debug__copy-icn`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1),G(`重置 `,-1)]])])])],2112))],64)):n.activeTab===`structure`?(B(),V(`div`,Tv,[W(o,{preview:n.preview,schema:n.schema,"card-code":n.cardId,"selected-node-id":n.selectedNodeId,"move-collapse-token":n.moveCollapseToken,"can-paste":a.canPaste,onEditEvent:a.onEditEvent,onInspect:a.onInspect,onSelectNode:a.onSelectNode,onAddNode:a.onAddNode,onMoveNode:a.onMoveNode,onHoverNode:a.onHoverNode,onCopySelected:t[9]||=t=>e.$emit(`copy-selected`),onPaste:t[10]||=t=>e.$emit(`paste`),onDuplicate:t[11]||=t=>e.$emit(`duplicate`),onDeleteSelected:t[12]||=t=>e.$emit(`delete-selected`),onRenameCard:t[13]||=t=>e.$emit(`rename-card`)},null,8,[`preview`,`schema`,`card-code`,`selected-node-id`,`move-collapse-token`,`can-paste`,`onEditEvent`,`onInspect`,`onSelectNode`,`onAddNode`,`onMoveNode`,`onHoverNode`]),K(` 右下角悬浮融合按钮组:查看 schema(全屏只读面板)+ 复制整份 schema `),U(`div`,Ev,[U(`button`,{class:`debug__copy`,type:`button`,title:`全屏查看当前卡片的原始 schema(只读)`,onClick:t[14]||=(...e)=>a.openSchemaViewer&&a.openSchemaViewer(...e)},`查看 schema`),U(`button`,{class:`debug__copy`,type:`button`,title:i.copiedSchemaText?`已复制 ✓`:`复制整份 schema(含变量 mock 合并后的数据)`,onClick:t[15]||=(...e)=>a.copySchemaText&&a.copySchemaText(...e)},[i.copiedSchemaText?(B(),V(`span`,Ov,`✓`)):(B(),V(`svg`,kv,[...t[68]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]])),t[69]||=G(`复制 `,-1)],8,Dv)])])):n.activeTab===`meta`?(B(),V(`div`,Av,[K(` 空状态占位:与 API 调用面板同款(虚线徽章 + 线性图标 + 文案 + 弱提示) `),i.importMeta?(B(),V(`dl`,Mv,[U(`div`,Nv,[t[72]||=U(`dt`,null,`导入接口`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.interface),1),t[71]||=G(),U(`span`,Pv,`(`+j(i.importMeta.source)+`)`,1)])]),U(`div`,Fv,[t[73]||=U(`dt`,null,`远端基址`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.baseUrl),1)])]),U(`div`,Iv,[t[74]||=U(`dt`,null,`cardId`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.cardId),1)])]),U(`div`,Lv,[t[76]||=U(`dt`,null,`cardCode`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.cardCode),1),U(`button`,{class:`debug__meta-copy`,type:`button`,title:i.copiedCode?`已复制 ✓`:`复制 cardCode`,onClick:t[16]||=(...e)=>a.copyCardCode&&a.copyCardCode(...e)},[i.copiedCode?(B(),V(`span`,zv,`✓`)):(B(),V(`svg`,Bv,[...t[75]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,Rv)])]),i.importMeta.cardName?(B(),V(`div`,Vv,[t[77]||=U(`dt`,null,`卡片标题`,-1),U(`dd`,null,j(i.importMeta.cardName),1)])):K(`v-if`,!0),U(`div`,Hv,[t[79]||=U(`dt`,null,`应用 / 空间`,-1),U(`dd`,null,[U(`code`,null,j(i.importMeta.appId),1),t[78]||=G(` / `,-1),U(`code`,null,j(i.importMeta.workspaceId),1)])]),U(`div`,Uv,[t[80]||=U(`dt`,null,`同步时间`,-1),U(`dd`,null,j(a.formatTime(i.importMeta.syncedAt)),1)]),U(`div`,Wv,[t[81]||=U(`dt`,null,`落库位置`,-1),U(`dd`,null,[U(`code`,null,`src/cards/`+j(i.importMeta.cardCode)+`/`,1)])]),U(`div`,Gv,[t[82]||=U(`dt`,null,`本地状态`,-1),U(`dd`,null,[i.importMeta.dirty?(B(),V(`span`,Kv,`已编辑(偏离导入镜像)`)):(B(),V(`span`,qv,`与导入镜像一致`))])]),i.importMeta.lastExport?(B(),V(`div`,Jv,[t[83]||=U(`dt`,null,`最近导出`,-1),U(`dd`,null,[i.importMeta.lastExport.ok?(B(),V(`span`,Yv,`读回校验通过 ✓`)):(B(),V(`span`,Xv,`读回校验未通过 ✗`)),U(`span`,Zv,`(`+j(a.formatTime(i.importMeta.lastExport.at))+`)`,1),i.importMeta.lastExport.readBackError?(B(),V(`span`,Qv,` · `+j(i.importMeta.lastExport.readBackError),1)):K(`v-if`,!0)])])):K(`v-if`,!0),U(`div`,$v,[t[88]||=U(`dt`,null,`远端最新版本`,-1),U(`dd`,null,[i.remoteVersionLoading?(B(),V(`span`,ey,`查询中…`)):i.importMeta.remoteVersion==null?i.remoteVersionError?(B(),V(`span`,ry,[G(j(i.remoteVersionError)+`(`,1),U(`a`,{class:`debug__link`,onClick:t[18]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},`重试`),t[85]||=G(`)`,-1)])):(B(),V(`span`,iy,[t[86]||=G(`未记录(`,-1),U(`a`,{class:`debug__link`,onClick:t[19]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},`查询`),t[87]||=G(`)`,-1)])):(B(),V(z,{key:1},[U(`code`,ty,j(i.importMeta.remoteVersion),1),i.importMeta.remoteVersionAt?(B(),V(`span`,ny,`(`+j(a.formatTime(i.importMeta.remoteVersionAt))+` 查询)`,1)):K(`v-if`,!0),U(`button`,{class:`debug__meta-refresh`,type:`button`,title:`刷新远端最新版本`,onClick:t[17]||=(...e)=>a.refreshRemoteVersion&&a.refreshRemoteVersion(...e)},[...t[84]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-refresh`})],-1)]])],64))])])])):(B(),V(`div`,jv,[...t[70]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cloud"></use></svg></span><p class="debug__empty">暂无卡片来源</p><p class="empty-state__hint">该卡尚未经「同步远程」导入,无导入来源元数据;本地新建卡 / 未同步卡均如此</p>`,3)]])),t[89]||=U(`p`,{class:`debug__meta-hint`},`导入优先于编辑:在「变量」tab →「配置变量 mock」里点「重置」,可丢弃内存编辑、从磁盘重新载入最新导入。`,-1)])):K(`v-if`,!0)]),K(`
180
182
  节点属性面板:组件结构 tab 双击节点弹出(可编辑写回)。
181
183
  事件编辑已并入本面板的「事件」页签(meta 驱动),不再有独立弹层。
182
- `),W(ic,{name:`modal`},{default:F(()=>[i.inspectingComp?(B(),H(s,{key:i.inspectKey,comp:i.inspectingComp,"comp-names":a.compNames,rt:n.rt,onApply:a.onApply,onCommit:a.onCommit,onClose:t[16]||=e=>i.inspectingComp=null},null,8,[`comp`,`comp-names`,`rt`,`onApply`,`onCommit`])):K(`v-if`,!0)]),_:1}),K(`
184
+ `),W(ic,{name:`modal`},{default:F(()=>[i.inspectingComp?(B(),H(s,{key:i.inspectKey,comp:i.inspectingComp,"comp-names":a.compNames,rt:n.rt,onApply:a.onApply,onCommit:a.onCommit,onClose:t[20]||=e=>i.inspectingComp=null},null,8,[`comp`,`comp-names`,`rt`,`onApply`,`onCommit`])):K(`v-if`,!0)]),_:1}),K(`
183
185
  事件编辑弹框:点击结构树「事件」徽标时单独弹出,与属性面板解耦。
184
186
  只编辑 eventactions,不涉及属性/样式。
185
- `),W(ic,{name:`ee-drawer`},{default:F(()=>[i.editingEventComp?(B(),H(c,{key:`evt-`+i.eventEditorKey,comp:i.editingEventComp,"comp-names":a.compNames,rt:n.rt,onApply:a.onApply,onCommit:a.onCommit,onClose:t[17]||=e=>i.editingEventComp=null},null,8,[`comp`,`comp-names`,`rt`,`onApply`,`onCommit`])):K(`v-if`,!0)]),_:1}),K(`
187
+ `),W(ic,{name:`ee-drawer`},{default:F(()=>[i.editingEventComp?(B(),H(c,{key:`evt-`+i.eventEditorKey,comp:i.editingEventComp,"comp-names":a.compNames,rt:n.rt,onApply:a.onApply,onCommit:a.onCommit,onClose:t[21]||=e=>i.editingEventComp=null},null,8,[`comp`,`comp-names`,`rt`,`onApply`,`onCommit`])):K(`v-if`,!0)]),_:1}),K(`
186
188
  运行态面板:默认收起;点击底部状态栏「运行态」指示器弹出。面板高度由头部
187
189
  拖拽调整(startResize,无专门拖拽节点,与预览区宽度调节同一套 mousedown 机制),
188
190
  并持久化到 localStorage。展示 rt.state 实时 JSON(运行期交互态,只读),不污染绑定数据、
@@ -192,7 +194,7 @@ Expected function or array of functions, received type ${typeof e}.`),m)}var Yc=
192
194
  宽度贯穿中右两栏、紧贴右缘(与共同底栏同一容器机制,贴近 VSCode 底部面板)。
193
195
  defer:目标与 Teleport 同属本应用组件树,挂载时目标尚未插入 document,须等整个
194
196
  应用挂载完成后再解析(Vue 3.5+)。chrome-off 截图模式下禁用 Teleport,回落本面板内。
195
- `),(B(),H(ai,{defer:``,to:`#app-workside-panels`,disabled:n.chromeOff},[I(U(`section`,Xv,[K(` 顶缘拖拽条:与竖向分隔条同规格(命中 6px / 高亮 5px),仅分割边缘触发 `),U(`div`,{class:A([`panelhead__edge`,{"is-dragging":i.panelDragging}]),title:`拖拽调整面板高度`,onMousedown:t[18]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`])},null,34),U(`div`,Zv,[t[81]||=U(`span`,{class:`statepanel__title`},[G(`运行态 `),U(`code`,null,`rt.state`)],-1),U(`button`,{class:`statepanel__close`,type:`button`,title:`收起`,onClick:t[19]||=e=>i.statePanelOpen=!1},[...t[80]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,Qv,[K(`
197
+ `),(B(),H(ai,{defer:``,to:`#app-workside-panels`,disabled:n.chromeOff},[I(U(`section`,ay,[K(` 顶缘拖拽条:与竖向分隔条同规格(命中 6px / 高亮 5px),仅分割边缘触发 `),U(`div`,{class:A([`panelhead__edge`,{"is-dragging":i.panelDragging}]),title:`拖拽调整面板高度`,onMousedown:t[22]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`])},null,34),U(`div`,oy,[t[91]||=U(`span`,{class:`statepanel__title`},[G(`运行态 `),U(`code`,null,`rt.state`)],-1),U(`button`,{class:`statepanel__close`,type:`button`,title:`收起`,onClick:t[23]||=e=>i.statePanelOpen=!1},[...t[90]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,sy,[K(`
196
198
  运行态 diff 双栏对比:左 = 当前 rt.state,右 = 基线 rt.rootScope(绑定数据),
197
199
  git diff 式行对齐 + 增/改/删三态高亮(StateDiffPanel,行模型见 runtime/state-diff.js)。
198
200
  `),W(l,{rt:n.rt,"card-id":n.cardId},null,8,[`rt`,`card-id`])])],512),[[Sc,i.statePanelOpen]])],8,[`disabled`])),K(`
@@ -201,38 +203,38 @@ Expected function or array of functions, received type ${typeof e}.`),m)}var Yc=
201
203
  挂载时目标尚未插入 document,须等整个应用挂载完成后再解析(Vue 3.5+)。
202
204
  chrome-off 截图模式下禁用 Teleport,回落到本面板内渲染(随面板一起隐藏)。
203
205
  左侧三枚指示器(运行态 / 变量绑定 / 事件)点击弹出或收起对应底部面板;右侧展示当前卡片与卡片总数。
204
- `),(B(),H(ai,{defer:``,to:`#app-workside-bar`,disabled:n.chromeOff},[U(`section`,$v,[U(`button`,{class:A([`statusbar__item statusbar__item--prob`,{"is-open":i.statePanelOpen}]),type:`button`,onClick:t[20]||=(...e)=>a.toggleStatePanel&&a.toggleStatePanel(...e),title:i.statePanelOpen?`收起运行态面板`:`展开运行态面板(可拖拽调整高度)`},[U(`span`,{class:A([`statusbar__icon`,{"is-dirty":a.stateDirty}])},`◉`,2),t[82]||=U(`span`,null,`运行态`,-1)],10,ey),U(`button`,{class:A([`statusbar__item statusbar__item--prob`,{"is-error":a.bindingErrors.length,"is-ok":!a.bindingErrors.length}]),type:`button`,onClick:t[21]||=e=>a.toggleErrorPanel(`binding`),title:a.bindingErrors.length?`查看绑定错误`:`无绑定错误`},[U(`span`,ny,j(a.bindingErrors.length?`⚠`:`✓`),1),U(`span`,null,j(a.bindingErrors.length?a.bindingErrors.length+` 个绑定错误`:`无绑定错误`),1)],10,ty),U(`button`,{class:A([`statusbar__item statusbar__item--prob`,a.eventStatusClass]),type:`button`,onClick:t[22]||=e=>a.toggleErrorPanel(`event`),title:a.eventStatusTitle},[U(`span`,iy,j(a.eventCount?a.eventErrors.length?`⚠`:`☰`:`✓`),1),U(`span`,null,j(a.eventCount?a.eventCount+` 条事件记录`:`无事件记录`),1)],10,ry),K(` 本地开发服务连接状态:连接图标 + 状态文案,颜色与右上角「连接」按钮实时同步(复用 devSvcClass / devSvcTitle / devSvcLabel)。
206
+ `),(B(),H(ai,{defer:``,to:`#app-workside-bar`,disabled:n.chromeOff},[U(`section`,cy,[U(`button`,{class:A([`statusbar__item statusbar__item--prob`,{"is-open":i.statePanelOpen}]),type:`button`,onClick:t[24]||=(...e)=>a.toggleStatePanel&&a.toggleStatePanel(...e),title:i.statePanelOpen?`收起运行态面板`:`展开运行态面板(可拖拽调整高度)`},[U(`span`,{class:A([`statusbar__icon`,{"is-dirty":a.stateDirty}])},`◉`,2),t[92]||=U(`span`,null,`运行态`,-1)],10,ly),U(`button`,{class:A([`statusbar__item statusbar__item--prob`,{"is-error":a.bindingErrors.length,"is-ok":!a.bindingErrors.length}]),type:`button`,onClick:t[25]||=e=>a.toggleErrorPanel(`binding`),title:a.bindingErrors.length?`查看绑定错误`:`无绑定错误`},[U(`span`,dy,j(a.bindingErrors.length?`⚠`:`✓`),1),U(`span`,null,j(a.bindingErrors.length?a.bindingErrors.length+` 个绑定错误`:`无绑定错误`),1)],10,uy),U(`button`,{class:A([`statusbar__item statusbar__item--prob`,a.eventStatusClass]),type:`button`,onClick:t[26]||=e=>a.toggleErrorPanel(`event`),title:a.eventStatusTitle},[U(`span`,py,j(a.eventCount?a.eventErrors.length?`⚠`:`☰`:`✓`),1),U(`span`,null,j(a.eventCount?a.eventCount+` 条事件记录`:`无事件记录`),1)],10,fy),K(` 本地开发服务连接状态:连接图标 + 状态文案,颜色与右上角「连接」按钮实时同步(复用 devSvcClass / devSvcTitle / devSvcLabel)。
205
207
  可点击:弹出 / 收起底部「服务日志」面板(实时镜像所连 cardbuddy 终端输出)。
206
- 仅重连 / 断开 / 未配置等_warn、danger 态着语义色,连接成功用状态栏默认色;不设选中态,仅 hover 提示可点。 `),U(`button`,{class:A([`statusbar__item statusbar__conn`,n.devSvcClass]),type:`button`,title:n.devSvcTitle+`(点击查看服务日志)`,onClick:t[23]||=e=>a.toggleErrorPanel(`svclog`)},[t[83]||=U(`svg`,{class:`statusbar__conn-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-link`})],-1),U(`span`,null,j(n.devSvcLabel),1)],10,ay),t[84]||=U(`span`,{class:`statusbar__spacer`},null,-1),U(`span`,oy,j(n.cardId),1),U(`span`,sy,j(n.cardCount)+` 张卡片`,1)])],8,[`disabled`])),(B(),H(ai,{defer:``,to:`#app-workside-panels`,disabled:n.chromeOff},[I(U(`section`,cy,[K(` 顶缘拖拽条:与竖向分隔条同规格(命中 6px / 高亮 5px),仅分割边缘触发 `),U(`div`,{class:A([`panelhead__edge`,{"is-dragging":i.panelDragging}]),title:`拖拽调整面板高度`,onMousedown:t[24]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`])},null,34),U(`div`,ly,[U(`span`,uy,j(i.errorPanel===`svclog`?`服务日志`:i.errorPanel===`event`?`事件记录`:`绑定错误记录`),1),K(` 服务日志:标题后给一枚读数(行数 + 实时态),与事件面板 tab 同一位置语言 `),i.errorPanel===`svclog`?(B(),V(`span`,dy,[G(j(i.svcLogs.length)+` 行`,1),i.svcLogDropped?(B(),V(`span`,fy,` · 已滚动淘汰 `+j(i.svcLogDropped),1)):K(`v-if`,!0),U(`i`,{class:A([`svclog__dot`,i.svcLogLive?`is-live`:`is-off`])},null,2),G(j(i.svcLogLive?`实时`:`未连接`),1)])):K(`v-if`,!0),K(` 事件面板:日志 / 错误 tab 并入头部单行(一次只看一类);变量绑定面板无 tab `),i.errorPanel===`event`?(B(),V(`div`,py,[U(`button`,{type:`button`,class:A([`errpanel__tab`,{"errpanel__tab--active":i.eventTab===`log`}]),onClick:t[25]||=e=>i.eventTab=`log`},[t[85]||=G(` 日志`,-1),U(`span`,my,j(a.logs.length),1)],2),U(`button`,{type:`button`,class:A([`errpanel__tab`,{"errpanel__tab--active":i.eventTab===`err`}]),onClick:t[26]||=e=>i.eventTab=`err`},[t[86]||=G(` 错误`,-1),U(`span`,{class:A([`errpanel__tab-count`,{"is-hit":a.eventErrors.length}])},j(a.eventErrors.length),3)],2)])):K(`v-if`,!0),U(`span`,hy,[i.errorPanel===`event`&&i.eventTab===`log`?(B(),V(`button`,{key:0,class:`errpanel__iconbtn errpanel__clear`,type:`button`,disabled:!a.logs.length,title:`清空日志(不影响错误)`,onClick:t[27]||=(...e)=>a.clearEventLogs&&a.clearEventLogs(...e)},[K(` 垃圾桶图标:清空日志 `),t[87]||=U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-trash`})],-1)],8,gy)):K(`v-if`,!0),i.errorPanel===`svclog`?(B(),V(`button`,{key:1,class:A([`errpanel__iconbtn`,{"is-done":i.svcCopied}]),type:`button`,disabled:!i.svcLogs.length,title:i.svcCopied?`已复制`:`复制全部日志(纯文本,去 ANSI)`,onClick:t[28]||=(...e)=>a.copySvcLogs&&a.copySvcLogs(...e)},[...t[88]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-copy`})],-1)]],10,_y)):K(`v-if`,!0),i.errorPanel===`svclog`?(B(),V(`button`,{key:2,class:A([`errpanel__iconbtn svclog__follow`,{"is-on":i.svcLogFollow}]),type:`button`,title:i.svcLogFollow?`跟随最新输出(点击暂停)`:`已暂停跟随(点击回到最新)`,onClick:t[29]||=(...e)=>a.toggleSvcFollow&&a.toggleSvcFollow(...e)},[K(` 下箭头图标:跟随最新输出 `),t[89]||=U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-arrow-down`})],-1)],10,vy)):K(`v-if`,!0),i.errorPanel===`svclog`?(B(),V(`button`,{key:3,class:`errpanel__iconbtn errpanel__clear`,type:`button`,disabled:!i.svcLogs.length,title:`清空面板(不影响服务端缓冲)`,onClick:t[30]||=(...e)=>a.clearSvcLogs&&a.clearSvcLogs(...e)},[...t[90]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-trash`})],-1)]],8,yy)):K(`v-if`,!0),U(`button`,{class:`errpanel__iconbtn errpanel__close`,type:`button`,title:`关闭`,onClick:t[31]||=e=>i.errorPanel=``},[...t[91]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-x`})],-1)]])])]),U(`div`,{class:A([`errpanel__body`,{"errpanel__body--term":i.errorPanel===`svclog`&&i.svcLogs.length}]),ref:`errBody`,onScrollPassive:t[32]||=(...e)=>a.onErrBodyScroll&&a.onErrBodyScroll(...e)},[K(` 服务日志面板:本地服务(cardbuddy)终端输出的实时镜像。
208
+ 仅重连 / 断开 / 未配置等_warn、danger 态着语义色,连接成功用状态栏默认色;不设选中态,仅 hover 提示可点。 `),U(`button`,{class:A([`statusbar__item statusbar__conn`,n.devSvcClass]),type:`button`,title:n.devSvcTitle+`(点击查看服务日志)`,onClick:t[27]||=e=>a.toggleErrorPanel(`svclog`)},[t[93]||=U(`svg`,{class:`statusbar__conn-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-link`})],-1),U(`span`,null,j(n.devSvcLabel),1)],10,my),t[94]||=U(`span`,{class:`statusbar__spacer`},null,-1),U(`span`,hy,j(n.cardId),1),U(`span`,gy,j(n.cardCount)+` 张卡片`,1)])],8,[`disabled`])),(B(),H(ai,{defer:``,to:`#app-workside-panels`,disabled:n.chromeOff},[I(U(`section`,_y,[K(` 顶缘拖拽条:与竖向分隔条同规格(命中 6px / 高亮 5px),仅分割边缘触发 `),U(`div`,{class:A([`panelhead__edge`,{"is-dragging":i.panelDragging}]),title:`拖拽调整面板高度`,onMousedown:t[28]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`])},null,34),U(`div`,vy,[U(`span`,yy,j(i.errorPanel===`svclog`?`服务日志`:i.errorPanel===`event`?`事件记录`:`绑定错误记录`),1),K(` 服务日志:标题后给一枚读数(行数 + 实时态),与事件面板 tab 同一位置语言 `),i.errorPanel===`svclog`?(B(),V(`span`,by,[G(j(i.svcLogs.length)+` 行`,1),i.svcLogDropped?(B(),V(`span`,xy,` · 已滚动淘汰 `+j(i.svcLogDropped),1)):K(`v-if`,!0),U(`i`,{class:A([`svclog__dot`,i.svcLogLive?`is-live`:`is-off`])},null,2),G(j(i.svcLogLive?`实时`:`未连接`),1)])):K(`v-if`,!0),K(` 事件面板:日志 / 错误 tab 并入头部单行(一次只看一类);变量绑定面板无 tab `),i.errorPanel===`event`?(B(),V(`div`,Sy,[U(`button`,{type:`button`,class:A([`errpanel__tab`,{"errpanel__tab--active":i.eventTab===`log`}]),onClick:t[29]||=e=>i.eventTab=`log`},[t[95]||=G(` 日志`,-1),U(`span`,Cy,j(a.logs.length),1)],2),U(`button`,{type:`button`,class:A([`errpanel__tab`,{"errpanel__tab--active":i.eventTab===`err`}]),onClick:t[30]||=e=>i.eventTab=`err`},[t[96]||=G(` 错误`,-1),U(`span`,{class:A([`errpanel__tab-count`,{"is-hit":a.eventErrors.length}])},j(a.eventErrors.length),3)],2)])):K(`v-if`,!0),U(`span`,wy,[i.errorPanel===`event`&&i.eventTab===`log`?(B(),V(`button`,{key:0,class:`errpanel__iconbtn errpanel__clear`,type:`button`,disabled:!a.logs.length,title:`清空日志(不影响错误)`,onClick:t[31]||=(...e)=>a.clearEventLogs&&a.clearEventLogs(...e)},[K(` 垃圾桶图标:清空日志 `),t[97]||=U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-trash`})],-1)],8,Ty)):K(`v-if`,!0),i.errorPanel===`svclog`?(B(),V(`button`,{key:1,class:A([`errpanel__iconbtn`,{"is-done":i.svcCopied}]),type:`button`,disabled:!i.svcLogs.length,title:i.svcCopied?`已复制`:`复制全部日志(纯文本,去 ANSI)`,onClick:t[32]||=(...e)=>a.copySvcLogs&&a.copySvcLogs(...e)},[...t[98]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-copy`})],-1)]],10,Ey)):K(`v-if`,!0),i.errorPanel===`svclog`?(B(),V(`button`,{key:2,class:A([`errpanel__iconbtn svclog__follow`,{"is-on":i.svcLogFollow}]),type:`button`,title:i.svcLogFollow?`跟随最新输出(点击暂停)`:`已暂停跟随(点击回到最新)`,onClick:t[33]||=(...e)=>a.toggleSvcFollow&&a.toggleSvcFollow(...e)},[K(` 下箭头图标:跟随最新输出 `),t[99]||=U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-arrow-down`})],-1)],10,Dy)):K(`v-if`,!0),i.errorPanel===`svclog`?(B(),V(`button`,{key:3,class:`errpanel__iconbtn errpanel__clear`,type:`button`,disabled:!i.svcLogs.length,title:`清空面板(不影响服务端缓冲)`,onClick:t[34]||=(...e)=>a.clearSvcLogs&&a.clearSvcLogs(...e)},[...t[100]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-trash`})],-1)]],8,Oy)):K(`v-if`,!0),U(`button`,{class:`errpanel__iconbtn errpanel__close`,type:`button`,title:`关闭`,onClick:t[35]||=e=>i.errorPanel=``},[...t[101]||=[U(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-x`})],-1)]])])]),U(`div`,{class:A([`errpanel__body`,{"errpanel__body--term":i.errorPanel===`svclog`&&i.svcLogs.length}]),ref:`errBody`,onScrollPassive:t[36]||=(...e)=>a.onErrBodyScroll&&a.onErrBodyScroll(...e)},[K(` 服务日志面板:本地服务(cardbuddy)终端输出的实时镜像。
207
209
  服务端按行镜像 stdout/stderr 并保留原始 ANSI,这里经 card-editor/ansi.js 还原配色,
208
- 因此面板固定深色终端底(chalk 调色板取自深色令牌,浅底不可读)。 `),i.errorPanel===`svclog`?(B(),V(z,{key:0},[i.svcLogs.length?(B(),V(`div`,Cy,[(B(!0),V(z,null,R(i.svcLogs,e=>(B(),V(`div`,{key:e.seq||e.t,class:A([`svclog__line`,`svclog__line--`+e.level])},[U(`span`,{class:`svclog__text`,innerHTML:e.html},null,8,wy)],2))),128))])):(B(),V(`div`,by,[t[92]||=U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-terminal`})])],-1),U(`p`,xy,j(a.svcEmptyText),1),U(`p`,Sy,j(a.svcEmptyHint),1)]))],64)):i.errorPanel===`event`?(B(),V(z,{key:1},[K(` 事件面板:按当前 tab 只渲染日志或错误一类 `),i.eventTab===`log`?(B(),V(z,{key:0},[K(` 空状态占位:与 API 调用面板同款(虚线徽章 + 线性图标 + 文案 + 弱提示) `),a.logs.length?(B(),V(`ul`,Ey,[(B(!0),V(z,null,R(a.logs,(e,t)=>(B(),V(`li`,{key:`l`+t,class:A([`log__item`,`log--`+e.level])},[U(`span`,Dy,j(a.fmtTime(e.t)),1),U(`span`,{class:A([`log__tag`,`log__tag--`+e.level])},j(e.level),3),U(`div`,Oy,[e.args&&e.args.length?(B(!0),V(z,{key:0},R(e.args,(e,t)=>(B(),H(u,{key:t,value:e},null,8,[`value`]))),128)):(B(),V(`span`,ky,`—`))])],2))),128))])):(B(),V(`div`,Ty,[...t[93]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-menu`})])],-1),U(`p`,{class:`debug__empty`},`暂无日志`,-1),U(`p`,{class:`empty-state__hint`},`卡片事件内 console.* 主动打印的日志会实时显示在这里`,-1)]]))],64)):(B(),V(z,{key:1},[a.eventErrors.length?(B(),V(`ul`,jy,[(B(!0),V(z,null,R(a.eventErrors,(e,t)=>(B(),V(`li`,{key:`e`+t,class:`debug__item debug__item--err`},[U(`span`,My,j(a.fmtTime(e.t)),1),U(`span`,Ny,j(e.kind),1),U(`span`,Py,j(e.msg),1)]))),128))])):(B(),V(`div`,Ay,[...t[94]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-check-circle`})])],-1),U(`p`,{class:`debug__empty`},`无事件错误`,-1),U(`p`,{class:`empty-state__hint`},`事件动作(customAction / 监听器)执行报错时会记录在这里`,-1)]]))],64))],64)):(B(),V(z,{key:2},[K(` 变量绑定面板:仅错误列表 `),a.panelErrors.length?(B(),V(`ul`,Iy,[(B(!0),V(z,null,R(a.panelErrors,(e,t)=>(B(),V(`li`,{key:t,class:`debug__item debug__item--err`},[U(`span`,Ly,j(a.fmtTime(e.t)),1),U(`span`,Ry,j(e.kind),1),U(`span`,zy,j(e.msg),1)]))),128))])):(B(),V(`div`,Fy,[...t[95]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-check-circle`})])],-1),U(`p`,{class:`debug__empty`},`无绑定错误`,-1),U(`p`,{class:`empty-state__hint`},`绑定 / 表达式(bind、vshow、render、refresh)求值失败时会记录在这里`,-1)]]))],64))],34)],512),[[Sc,i.errorPanel]])],8,[`disabled`])),K(`
210
+ 因此面板固定深色终端底(chalk 调色板取自深色令牌,浅底不可读)。 `),i.errorPanel===`svclog`?(B(),V(z,{key:0},[i.svcLogs.length?(B(),V(`div`,My,[(B(!0),V(z,null,R(i.svcLogs,e=>(B(),V(`div`,{key:e.seq||e.t,class:A([`svclog__line`,`svclog__line--`+e.level])},[U(`span`,{class:`svclog__text`,innerHTML:e.html},null,8,Ny)],2))),128))])):(B(),V(`div`,ky,[t[102]||=U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-terminal`})])],-1),U(`p`,Ay,j(a.svcEmptyText),1),U(`p`,jy,j(a.svcEmptyHint),1)]))],64)):i.errorPanel===`event`?(B(),V(z,{key:1},[K(` 事件面板:按当前 tab 只渲染日志或错误一类 `),i.eventTab===`log`?(B(),V(z,{key:0},[K(` 空状态占位:与 API 调用面板同款(虚线徽章 + 线性图标 + 文案 + 弱提示) `),a.logs.length?(B(),V(`ul`,Fy,[(B(!0),V(z,null,R(a.logs,(e,t)=>(B(),V(`li`,{key:`l`+t,class:A([`log__item`,`log--`+e.level])},[U(`span`,Iy,j(a.fmtTime(e.t)),1),U(`span`,{class:A([`log__tag`,`log__tag--`+e.level])},j(e.level),3),U(`div`,Ly,[e.args&&e.args.length?(B(!0),V(z,{key:0},R(e.args,(e,t)=>(B(),H(u,{key:t,value:e},null,8,[`value`]))),128)):(B(),V(`span`,Ry,`—`))])],2))),128))])):(B(),V(`div`,Py,[...t[103]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-menu`})])],-1),U(`p`,{class:`debug__empty`},`暂无日志`,-1),U(`p`,{class:`empty-state__hint`},`卡片事件内 console.* 主动打印的日志会实时显示在这里`,-1)]]))],64)):(B(),V(z,{key:1},[a.eventErrors.length?(B(),V(`ul`,By,[(B(!0),V(z,null,R(a.eventErrors,(e,t)=>(B(),V(`li`,{key:`e`+t,class:`debug__item debug__item--err`},[U(`span`,Vy,j(a.fmtTime(e.t)),1),U(`span`,Hy,j(e.kind),1),U(`span`,Uy,j(e.msg),1)]))),128))])):(B(),V(`div`,zy,[...t[104]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-check-circle`})])],-1),U(`p`,{class:`debug__empty`},`无事件错误`,-1),U(`p`,{class:`empty-state__hint`},`事件动作(customAction / 监听器)执行报错时会记录在这里`,-1)]]))],64))],64)):(B(),V(z,{key:2},[K(` 变量绑定面板:仅错误列表 `),a.panelErrors.length?(B(),V(`ul`,Gy,[(B(!0),V(z,null,R(a.panelErrors,(e,t)=>(B(),V(`li`,{key:t,class:`debug__item debug__item--err`},[U(`span`,Ky,j(a.fmtTime(e.t)),1),U(`span`,qy,j(e.kind),1),U(`span`,Jy,j(e.msg),1)]))),128))])):(B(),V(`div`,Wy,[...t[105]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-check-circle`})])],-1),U(`p`,{class:`debug__empty`},`无绑定错误`,-1),U(`p`,{class:`empty-state__hint`},`绑定 / 表达式(bind、vshow、render、refresh)求值失败时会记录在这里`,-1)]]))],64))],34)],512),[[Sc,i.errorPanel]])],8,[`disabled`])),K(`
209
211
  Schema 全屏只读面板:结构 tab「查看 schema」弹出。Teleport 到 body 跳出面板层叠上下文,
210
212
  覆盖全屏展示当前卡原始 schema(含绑定数据合并,与「复制」同一序列化口径);
211
213
  Esc / 点空白 / × 关闭。
212
- `),(B(),H(ai,{to:`body`},[W(ic,{name:`imgbox-fade`},{default:F(()=>[i.schemaViewerOpen?(B(),V(`div`,{key:0,ref:`schemaViewerEl`,class:`schemaview`,role:`dialog`,"aria-modal":`true`,"aria-label":`Schema 预览`,tabindex:`-1`,onKeydown:t[37]||=(...e)=>a.onSchemaViewerKey&&a.onSchemaViewerKey(...e),onClick:t[38]||=q(e=>i.schemaViewerOpen=!1,[`self`])},[U(`header`,{class:`schemaview__bar`,onClick:t[35]||=q(()=>{},[`stop`])},[U(`span`,By,[t[96]||=G(`Schema 预览`,-1),U(`em`,Vy,j(n.cardId),1)]),U(`span`,Hy,j(a.schemaTextLines)+` 行 · `+j(a.schemaTextBytes),1),U(`span`,Uy,[U(`button`,{type:`button`,class:A([`schemaview__btn`,{"is-done":i.copiedSchemaText}]),title:i.copiedSchemaText?`已复制 ✓`:`复制全部(C)`,onClick:t[33]||=(...e)=>a.copySchemaText&&a.copySchemaText(...e)},[i.copiedSchemaText?(B(),V(`span`,Gy,`✓`)):(B(),V(`svg`,Ky,[...t[97]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]]))],10,Wy),U(`button`,{type:`button`,class:`schemaview__btn`,title:`关闭(Esc)`,onClick:t[34]||=e=>i.schemaViewerOpen=!1},[...t[98]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])])]),U(`div`,{class:`schemaview__body`,onClick:t[36]||=q(()=>{},[`stop`])},[K(` 树形折叠视图:与运行态面板同款 JsonTree(只读),打开瞬间拍平快照,折叠态在面板存活期内不因编辑跳变 `),i.schemaViewData?(B(),V(`div`,qy,[W(d,{data:i.schemaViewData,editable:!1,"default-open":999,"show-tools":``},null,8,[`data`])])):(B(),V(`div`,Jy,[...t[99]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-file-text`})])],-1),U(`p`,{class:`debug__empty`},`当前未载入卡片`,-1)]]))])],544)):K(`v-if`,!0)]),_:1})])),K(` 变量添加 / 编辑弹窗:与节点属性面板同构(ni-overlay / ni-panel / ni-head / ni-foot),
214
+ `),(B(),H(ai,{to:`body`},[W(ic,{name:`imgbox-fade`},{default:F(()=>[i.schemaViewerOpen?(B(),V(`div`,{key:0,ref:`schemaViewerEl`,class:`schemaview`,role:`dialog`,"aria-modal":`true`,"aria-label":`Schema 预览`,tabindex:`-1`,onKeydown:t[41]||=(...e)=>a.onSchemaViewerKey&&a.onSchemaViewerKey(...e),onClick:t[42]||=q(e=>i.schemaViewerOpen=!1,[`self`])},[U(`header`,{class:`schemaview__bar`,onClick:t[39]||=q(()=>{},[`stop`])},[U(`span`,Yy,[t[106]||=G(`Schema 预览`,-1),U(`em`,Xy,j(n.cardId),1)]),U(`span`,Zy,j(a.schemaTextLines)+` 行 · `+j(a.schemaTextBytes),1),U(`span`,Qy,[U(`button`,{type:`button`,class:A([`schemaview__btn`,{"is-done":i.copiedSchemaText}]),title:i.copiedSchemaText?`已复制 ✓`:`复制全部(C)`,onClick:t[37]||=(...e)=>a.copySchemaText&&a.copySchemaText(...e)},[i.copiedSchemaText?(B(),V(`span`,eb,`✓`)):(B(),V(`svg`,tb,[...t[107]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]]))],10,$y),U(`button`,{type:`button`,class:`schemaview__btn`,title:`关闭(Esc)`,onClick:t[38]||=e=>i.schemaViewerOpen=!1},[...t[108]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])])]),U(`div`,{class:`schemaview__body`,onClick:t[40]||=q(()=>{},[`stop`])},[K(` 树形折叠视图:与运行态面板同款 JsonTree(只读),打开瞬间拍平快照,折叠态在面板存活期内不因编辑跳变 `),i.schemaViewData?(B(),V(`div`,nb,[W(d,{data:i.schemaViewData,editable:!1,"default-open":999,"show-tools":``},null,8,[`data`])])):(B(),V(`div`,rb,[...t[109]||=[U(`span`,{class:`empty-state__badge`,"aria-hidden":`true`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-file-text`})])],-1),U(`p`,{class:`debug__empty`},`当前未载入卡片`,-1)]]))])],544)):K(`v-if`,!0)]),_:1})])),K(` 变量添加 / 编辑弹窗:与节点属性面板同构(ni-overlay / ni-panel / ni-head / ni-foot),
213
215
  宽度 · 字号 · 控件高度 · 发丝线分隔全部沿用 node-inspector 的视觉语言;
214
216
  默认值按类型分控件:数组 / 对象走 CodeJar 代码编辑区(高亮 + 缩进 + 大段粘贴,确定时自动格式化)、
215
- 字符串走多行文本域、数字走带 −/+ 的 NumberStepper、布尔走 SetSegment 分段单选。 `),W(ic,{name:`modal`},{default:F(()=>[i.varDlg?(B(),V(`div`,{key:0,class:`ni-overlay`,onClick:t[48]||=q(e=>i.varDlg=null,[`self`])},[U(`div`,{class:`ni-panel modal-card vars-dlg`,role:`alertdialog`,"aria-modal":`true`,"aria-label":i.varDlg.index==null?`添加变量`:`编辑变量`},[U(`div`,Xy,[U(`span`,Zy,[G(j(i.varDlg.index==null?`添加变量`:`编辑变量`),1),U(`em`,Qy,j(i.varDlg.form.key||`未命名`),1)]),U(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[39]||=e=>i.varDlg=null})]),U(`div`,$y,[U(`div`,eb,[U(`div`,tb,[t[100]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`变量名`)],-1),I(U(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[40]||=e=>i.varDlg.form.key=e,placeholder:`英文标识,绑定以 $key 引用`},null,512),[[il,i.varDlg.form.key]])]),U(`div`,nb,[t[101]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`中文名`)],-1),I(U(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[41]||=e=>i.varDlg.form.name=e,placeholder:`中文名`},null,512),[[il,i.varDlg.form.name]])]),U(`div`,rb,[t[102]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`类型`)],-1),K(` 类型下拉:触发器与选项都走「中文名 + 彩色类型标签」,标签直接复用变量列表的
216
- .vars__type / .vars__type--<type>(同一套 --type-* 语义色),两处视觉完全一致 `),W(f,{class:`vars-dlg__ctrl`,block:``,size:`sm`,value:i.varDlg.form.type,options:i.varTypeOptions,onChange:a.onVarTypeChange},{current:F(({opt:e,text:t})=>[e?(B(),V(`span`,ib,[U(`span`,ab,j(e.value),1),U(`span`,{class:A([`vars__type`,`vars__type--`+e.key])},j(e.key),3)])):(B(),V(z,{key:1},[G(j(t),1)],64))]),option:F(({opt:e})=>[U(`span`,ob,[U(`span`,sb,j(e.value),1),U(`span`,{class:A([`vars__type`,`vars__type--`+e.key])},j(e.key),3)])]),_:1},8,[`value`,`options`,`onChange`])]),K(` 默认值按类型分四种控件:数组 / 对象 = CodeJar 代码编辑区、字符串 = 多行文本域、
217
+ 字符串走多行文本域、数字走带 −/+ 的 NumberStepper、布尔走 SetSegment 分段单选。 `),W(ic,{name:`modal`},{default:F(()=>[i.varDlg?(B(),V(`div`,{key:0,class:`ni-overlay`,onClick:t[52]||=q(e=>i.varDlg=null,[`self`])},[U(`div`,{class:`ni-panel modal-card vars-dlg`,role:`alertdialog`,"aria-modal":`true`,"aria-label":i.varDlg.index==null?`添加变量`:`编辑变量`},[U(`div`,ab,[U(`span`,ob,[G(j(i.varDlg.index==null?`添加变量`:`编辑变量`),1),U(`em`,sb,j(i.varDlg.form.key||`未命名`),1)]),U(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[43]||=e=>i.varDlg=null})]),U(`div`,cb,[U(`div`,lb,[U(`div`,ub,[t[110]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`变量名`)],-1),I(U(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[44]||=e=>i.varDlg.form.key=e,placeholder:`英文标识,绑定以 $key 引用`},null,512),[[il,i.varDlg.form.key]])]),U(`div`,db,[t[111]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`中文名`)],-1),I(U(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[45]||=e=>i.varDlg.form.name=e,placeholder:`中文名`},null,512),[[il,i.varDlg.form.name]])]),U(`div`,fb,[t[112]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`类型`)],-1),K(` 类型下拉:触发器与选项都走「中文名 + 彩色类型标签」,标签直接复用变量列表的
218
+ .vars__type / .vars__type--<type>(同一套 --type-* 语义色),两处视觉完全一致 `),W(f,{class:`vars-dlg__ctrl`,block:``,size:`sm`,value:i.varDlg.form.type,options:i.varTypeOptions,onChange:a.onVarTypeChange},{current:F(({opt:e,text:t})=>[e?(B(),V(`span`,pb,[U(`span`,mb,j(e.value),1),U(`span`,{class:A([`vars__type`,`vars__type--`+e.key])},j(e.key),3)])):(B(),V(z,{key:1},[G(j(t),1)],64))]),option:F(({opt:e})=>[U(`span`,hb,[U(`span`,gb,j(e.value),1),U(`span`,{class:A([`vars__type`,`vars__type--`+e.key])},j(e.key),3)])]),_:1},8,[`value`,`options`,`onChange`])]),K(` 默认值按类型分四种控件:数组 / 对象 = CodeJar 代码编辑区、字符串 = 多行文本域、
217
219
  数字 = 带 −/+ 的 NumberStepper、布尔 = 复用 SetSegment 的 true / false 分段单选。四者统一以文本承载
218
- (varDlg.form.defaultValue),确定时仍由 parseDefault 按类型解析。 `),U(`div`,cb,[t[103]||=U(`label`,{class:`ni-field-label`},`默认值`,-1),a.isComplexType(i.varDlg.form.type)?(B(),V(`div`,lb,null,512)):i.varDlg.form.type===`string`?I((B(),V(`textarea`,{key:1,class:`ni-input vars-dlg__str`,"onUpdate:modelValue":t[42]||=e=>i.varDlg.form.defaultValue=e,placeholder:a.scalarPlaceholder(`string`)},null,8,ub)),[[il,i.varDlg.form.defaultValue]]):i.varDlg.form.type===`number`?(B(),H(p,{key:2,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,placeholder:a.scalarPlaceholder(`number`),onInput:t[43]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`placeholder`])):(B(),H(m,{key:3,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,options:{iParamList:i.varBoolOptions},onInput:t[44]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`options`]))]),U(`div`,db,[t[104]||=U(`label`,{class:`ni-field-label`},`描述`,-1),I(U(`textarea`,{class:`ni-input vars-dlg__desc`,"onUpdate:modelValue":t[45]||=e=>i.varDlg.form.desc=e,placeholder:`可选`},null,512),[[il,i.varDlg.form.desc]])]),i.varDlgError?(B(),V(`p`,fb,j(i.varDlgError),1)):K(`v-if`,!0)])]),U(`div`,pb,[t[105]||=U(`span`,{class:`ni-tip`},`默认值入 defaultValue;设计期覆盖见「配置变量 mock」`,-1),U(`div`,mb,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[46]||=e=>i.varDlg=null},`取消`),U(`button`,{class:`ni-btn`,type:`button`,onClick:t[47]||=(...e)=>a.confirmVarDlg&&a.confirmVarDlg(...e)},`确定`)])])],8,Yy)])):K(`v-if`,!0)]),_:1}),W(h,{visible:i.delVarTarget!=null,title:`删除变量`,message:a.delVarMessage,severity:a.delVarSeverity,"confirm-text":a.delVarConfirmText,onConfirm:a.confirmDeleteVar,onCancel:t[49]||=e=>i.delVarTarget=null},null,8,[`visible`,`message`,`severity`,`confirm-text`,`onConfirm`])])}var gb=X($_,[[`render`,hb],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/DebugPanel.vue`]]),_b={name:`ApiCallPanel`,components:{ApiPayloadTree:zg},props:{rt:{type:Object,required:!0}},emits:[`close`],data(){return{copiedIndex:null,apiCopyTimer:null}},computed:{apiCalls(){return this.rt.apiRev,this.rt.apiCalls.slice()}},methods:{clearApiLog(){this.rt.clearApiCalls()},async copyApiPayload(e,t){let n=``;try{n=JSON.stringify(e.payload,null,2)}catch{n=String(e.payload)}await op(n)&&(this.copiedIndex=t,this.apiCopyTimer&&clearTimeout(this.apiCopyTimer),this.apiCopyTimer=setTimeout(()=>{this.copiedIndex===t&&(this.copiedIndex=null)},1500))}}},vb={class:`apipanel`},yb={class:`apipanel__head`},bb={class:`apipanel__title`},xb={key:0,class:`debug__count`},Sb=[`disabled`],Cb={class:`apipanel__body`},wb={key:0,class:`empty-state`},Tb={class:`debug__list`},Eb={class:`debug__api-row`},Db={class:`debug__kind`},Ob=[`title`,`onClick`],kb={key:0,width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},Ab={key:1,class:`debug__copy-ok`};function jb(e,t,n,r,i,a){let o=L(`ApiPayloadTree`);return B(),V(`aside`,vb,[U(`div`,yb,[U(`span`,bb,[t[2]||=G(` API调用 `,-1),a.apiCalls.length?(B(),V(`span`,xb,j(a.apiCalls.length),1)):K(`v-if`,!0)]),t[5]||=U(`span`,{class:`apipanel__spacer`},null,-1),U(`button`,{class:`apipanel__btn`,type:`button`,disabled:!a.apiCalls.length,title:`清空日志`,onClick:t[0]||=(...e)=>a.clearApiLog&&a.clearApiLog(...e)},[...t[3]||=[U(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-trash`})],-1)]],8,Sb),U(`button`,{class:`apipanel__btn`,type:`button`,title:`收起接口调用面板`,onClick:t[1]||=t=>e.$emit(`close`)},[...t[4]||=[U(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,Cb,[K(` 空状态占位:虚线圆形徽章 + 插头图标(与全局 24 网格线性图标同语言)+ 文案 + 弱提示 `),a.apiCalls.length?K(`v-if`,!0):(B(),V(`div`,wb,[...t[6]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cup"></use></svg></span><p class="debug__empty">暂无API调用</p><p class="empty-state__hint">卡片事件触发 ynet.callJSAPI / postMessage 后,调用流水会实时显示在这里</p>`,3)]])),U(`ul`,Tb,[(B(!0),V(z,null,R(a.apiCalls,(e,n)=>(B(),V(`li`,{key:n,class:`debug__item debug__item--api`},[U(`div`,Eb,[U(`span`,Db,j(e.api),1),U(`button`,{class:`debug__copy-ic`,type:`button`,title:i.copiedIndex===n?`已复制 ✓`:`复制数据(不含方法名)`,onClick:t=>a.copyApiPayload(e,n)},[i.copiedIndex===n?(B(),V(`span`,Ab,`✓`)):(B(),V(`svg`,kb,[...t[7]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,Ob)]),K(` 返回数据:结构化折叠树(Chrome 控制台风格) `),W(o,{value:e.payload},null,8,[`value`])]))),128))])])])}var Mb=X(_b,[[`render`,jb],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ApiCallPanel.vue`]]),Nb={name:`CardSelect`,emits:[`input`,`change`],props:{value:{type:String,default:``},options:{type:Array,default:()=>[]}},data(){return{open:!1,query:``,highlighted:0,sortByTime:this.loadSortByTime()}},created(){this.saveSortByTime()},computed:{current(){return this.options.find(e=>e.id===this.value)||{id:this.value,name:this.value}},filtered(){let e=this.query.trim().toLowerCase(),t=this.options;return e&&(t=this.options.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))}},watch:{open(e){e?(this.query=``,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value)),this.$nextTick(()=>{this.$refs.search&&this.$refs.search.focus(),this.scrollToActive()}),document.addEventListener(`click`,this.onDocClick,!0)):document.removeEventListener(`click`,this.onDocClick,!0)},sortByTime(e){this.saveSortByTime()}},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0)},methods:{toggle(){this.open=!this.open},toggleSort(){this.sortByTime=!this.sortByTime,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value))},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardselect-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardselect-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},close(){this.open=!1},onDocClick(e){this.$refs.root&&!this.$refs.root.contains(e.target)&&this.close()},move(e){if(!this.filtered.length)return;let t=this.filtered.length;this.highlighted=(this.highlighted+e+t)%t,this.$nextTick(this.scrollToActive)},scrollToActive(){let e=this.$refs.list;if(!e)return;let t=e.children[this.highlighted];t&&t.scrollIntoView&&t.scrollIntoView({block:`nearest`})},choose(e){e&&(this.close(),e.id!==this.value&&(this.$emit(`input`,e.id),this.$emit(`change`,e.id)))}}},Pb={class:`csel__current`},Fb={class:`csel__id`},Ib={class:`csel__name`},Lb={key:0,class:`csel__pop`},Rb={class:`csel__search`},zb={ref:`list`,class:`csel__list`},Bb=[`onMousemove`,`onClick`],Vb=[`title`],Hb={class:`csel__item-id`},Ub={class:`csel__item-name`},Wb={key:0,class:`csel__check`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},Gb={key:0,class:`csel__empty`},Kb={class:`csel__foot`},qb=[`title`,`aria-pressed`],Jb={class:`csel__count`};function Yb(e,t,n,r,i,a){return B(),V(`div`,{ref:`root`,class:A([`csel`,{"csel--open":i.open}])},[U(`button`,{type:`button`,class:A([`csel__trigger`,{"csel__trigger--active":i.open}]),onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[U(`span`,Pb,[U(`span`,Fb,j(a.current.id),1),U(`span`,Ib,j(a.current.name),1)]),t[7]||=U(`svg`,{class:`csel__chev`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron`})],-1)],2),W(ic,{name:`csel-fade`},{default:F(()=>[i.open?(B(),V(`div`,Lb,[U(`div`,Rb,[t[8]||=U(`svg`,{class:`csel__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[U(`use`,{href:`#icon-search`})],-1),I(U(`input`,{ref:`search`,"onUpdate:modelValue":t[1]||=e=>i.query=e,class:`csel__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`,onKeydown:[t[2]||=vl(q(e=>a.move(1),[`prevent`]),[`down`]),t[3]||=vl(q(e=>a.move(-1),[`prevent`]),[`up`]),t[4]||=vl(q(e=>a.choose(a.filtered[i.highlighted]),[`prevent`]),[`enter`]),t[5]||=vl(q((...e)=>a.close&&a.close(...e),[`prevent`]),[`esc`])]},null,544),[[il,i.query]])]),U(`ul`,zb,[(B(!0),V(z,null,R(a.filtered,(e,r)=>(B(),V(`li`,{key:e.id,class:A([`csel__item`,{"csel__item--active":r===i.highlighted,"csel__item--selected":e.id===n.value}]),onMousemove:e=>i.highlighted=r,onClick:t=>a.choose(e)},[U(`span`,{class:A([`csel__dot`,{"csel__dot--imported":e.imported}]),title:e.imported?`导入卡片(含 .import-meta.json 来源信息)`:`本地卡片(无导入来源信息)`,"aria-hidden":`true`},null,10,Vb),U(`span`,Hb,j(e.id),1),U(`span`,Ub,j(e.name),1),e.id===n.value?(B(),V(`svg`,Wb,[...t[9]||=[U(`use`,{href:`#icon-check`},null,-1)]])):K(`v-if`,!0)],42,Bb))),128)),a.filtered.length?K(`v-if`,!0):(B(),V(`li`,Gb,`无匹配卡片`))],512),U(`div`,Kb,[U(`button`,{class:A([`csel__sort`,{"csel__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[6]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,qb),U(`span`,Jb,j(a.filtered.length)+` / `+j(n.options.length)+` 张卡片`,1)])])):K(`v-if`,!0)]),_:1})],2)}var Xb=X(Nb,[[`render`,Yb],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/CardSelect.vue`]]),Zb=X({name:`AlertCardInstance`,components:{RenderTree:ap},props:{entry:{type:Object,required:!0},mainRt:{type:Object,default:null}},data(){let e=new eu,t=au(this.entry.scope,e),n=this.mainRt;if(n&&n.pushError&&n.pushApiCall){let e=t.pushError.bind(t);t.pushError=(t,r)=>{e(t,r),n.pushError(t,r)};let r=t.pushApiCall.bind(t);t.pushApiCall=(e,t)=>{r(e,t),n.pushApiCall(e,t)}}return{adapter:e,cardRuntime:t}},provide(){return{adapter:this.adapter,cardRuntime:this.cardRuntime,customComponents:{}}},render(){return Vs(ap,{node:this.entry.preview.view,scope:this.cardRuntime.rootScope,key:this.entry.id})}},[[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AlertCardInstance.vue`]]),Qb=rn({stack:[]}),$b=0;async function ex(e,t){let n=e||{},r=n.cardCode,i=null;try{let e=await J(`/__card/${encodeURIComponent(r)}`);if(e.ok){let t=await e.json();t&&t.schema&&(i=t)}}catch{}if(!i||!i.schema){typeof t==`function`&&t({success:!1,error:`card_not_found`,errorMessage:`未找到卡片 `+r});return}let a=Qb.stack;a.length&&a.splice(0,a.length).forEach(e=>{if(typeof e.callback==`function`)try{e.callback({success:!0,data:{event:`hidden`}})}catch{}});let o=i.data&&typeof i.data==`object`?i.data:{},s=rn(Object.assign({},o,n.data||{})),c=Pu(i.schema),l=`alert-`+ ++$b;a.push({id:l,cardCode:r,preview:c,scope:s,gravity:n.gravity||`bottom`,width:typeof n.width==`number`?n.width:void 0,height:typeof n.height==`number`?n.height:void 0,offsetX:typeof n.offsetX==`number`?n.offsetX:0,offsetY:typeof n.offsetY==`number`?n.offsetY:0,clickOutsideCanHide:n.clickOutsideCanHide!==!1,callback:t})}function tx(e,t){let n=e||{},r=Qb.stack,i=null;if(typeof n.index==`number`){let e=Math.abs(n.index);r.length>=e&&(i=r[r.length-e])}else if(n.cardCode){for(let e=r.length-1;e>=0;e--)if(r[e].cardCode===n.cardCode){i=r[e];break}}else i=r[r.length-1];if(!i){typeof t==`function`&&t({success:!1,error:`no_alert`,errorMessage:`没有可关闭的弹窗`});return}let a=r.indexOf(i);r.splice(a,1),typeof i.callback==`function`&&(n.data?i.callback({success:!0,data:Object.assign({event:`hidden`},n.data)}):i.callback({success:!0,data:{}})),typeof t==`function`&&t({success:!0})}function nx(){let e=Qb.stack;e.length&&e.splice(0,e.length)}var rx={name:`AlertCardLayer`,components:{AlertCardInstance:Zb},props:{mainRt:{type:Object,default:null}},computed:{top(){let e=Qb.stack;return e.length?e[e.length-1]:null}},methods:{onMaskClick(e){e.clickOutsideCanHide&&tx({cardCode:e.cardCode})},panelStyle(e){let t={};e.width&&(t.width=e.width+`px`),e.height&&(t.height=e.height+`px`);let n=[];return e.offsetX&&n.push(`translateX(`+e.offsetX+`px)`),e.offsetY&&n.push(`translateY(`+e.offsetY+`px)`),n.length&&(t.transform=n.join(` `)),t}}},ix={key:0,class:`alert-layer`};function ax(e,t,n,r,i,a){let o=L(`AlertCardInstance`);return a.top?(B(),V(`div`,ix,[U(`div`,{class:A([`alert-mask`,`alert-mask--`+a.top.gravity]),onClick:t[0]||=q(e=>a.onMaskClick(a.top),[`self`])},[U(`div`,{class:`alert-panel`,style:k(a.panelStyle(a.top))},[W(o,{entry:a.top,"main-rt":n.mainRt},null,8,[`entry`,`main-rt`])],4)],2)])):K(`v-if`,!0)}var ox=X(rx,[[`render`,ax],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AlertCardLayer.vue`]]),sx=rn({dialog:null,toast:null,picker:null,datePicker:null}),cx=[],lx=0,ux=null,dx=[],fx=0,px=[],mx=0,hx=2200;function gx(e,t){if(typeof e==`function`)try{e(t)}catch{}}function _x(){sx.dialog=cx.length?cx.shift():null}function vx(e,t){let n=e||{};cx.push({id:++lx,title:n.title||``,message:n.message==null?``:String(n.message),okButton:n.okButton||`确定`,cancelButton:n.cancelButton||``,clickBgToHide:n.clickBgToHide===!0,cancelGrayStyle:n.cancelGrayStyle===!0,callback:t}),sx.dialog||_x()}function yx(e){let t=sx.dialog;t&&(sx.dialog=null,gx(t.callback,{success:!0,data:{ok:!!e.ok,dismissByClickBg:!!e.dismissByClickBg}}),_x())}function bx(e,t){let n=e||{},r=n.showIcon==null?``:String(n.showIcon),i=r===`1`?`ok`:r===`0`?`err`:``;ux&&=(clearTimeout(ux),null),sx.toast={message:n.message==null?``:String(n.message),icon:i},ux=setTimeout(()=>{sx.toast=null,ux=null},hx),gx(t,{success:!0,data:{}})}function xx(e,t){let n=e||{},r=Array.isArray(n.currentValue)?n.currentValue:[];r.length&&Array.isArray(r[0])&&(r=r[0]),dx.push({id:++fx,title:n.title||``,mode:n.mode===`multi`?`multi`:`single`,dataSource:Array.isArray(n.dataSource)?n.dataSource:[],currentValue:r.map(e=>String(e)),callback:t}),sx.picker||Sx()}function Sx(){sx.picker=dx.length?dx.shift():null}function Cx(e,t){let n=sx.picker;if(n){if(sx.picker=null,e){let e={success:!0,error:`0`,data:{result:t},result:t};gx(n.callback,e)}else gx(n.callback,{success:!0,data:{}});Sx()}}function wx(e,t){let n=e||{},r=[`year_month_day`,`year_month`,`month_day`].includes(n.type)?n.type:`year_month_day`;px.push({id:++mx,title:n.title||``,type:r,startDate:n.startDate||`1970-1-1`,endDate:n.endDate||`2100-12-31`,selectDate:n.selectDate||``,callback:t}),sx.datePicker||Tx()}function Tx(){sx.datePicker=px.length?px.shift():null}function Ex(e,t){let n=sx.datePicker;if(n){if(sx.datePicker=null,e){let e={success:!0,error:`0`,currentDate:t.value,data:{year:t.year,month:t.month,day:t.day,value:t.value}};gx(n.callback,e)}else gx(n.callback,{success:!0,data:{}});Tx()}}var Dx={alertCard:(e,t)=>ex(e,t),closeAlertCard:(e,t)=>tx(e,t),alertDialog:vx,showToast:bx,showPicker:xx,showDatePicker:wx};function Ox(e){typeof window>`u`||(window.ynet={callJSAPI(t,n,r){e&&e.pushApiCall&&e.pushApiCall(t,n);let i=Dx[t];if(i){i(n,r);return}gx(r,{success:!0,data:{}})}})}function kx(){cx.length=0,sx.dialog=null,sx.toast=null,ux&&=(clearTimeout(ux),null),dx.length=0,sx.picker=null,px.length=0,sx.datePicker=null}var Ax={name:`DeviceOverlay`,computed:{dialog(){return sx.dialog},toast(){return sx.toast}},methods:{onOk(){yx({ok:!0,dismissByClickBg:!1})},onCancel(){yx({ok:!1,dismissByClickBg:!1})},onMaskClick(){this.dialog&&this.dialog.clickBgToHide&&yx({ok:!1,dismissByClickBg:!0})}}},jx={class:`device-ui`},Mx={class:`dlg`},Nx={key:0,class:`dlg__title`},Px={key:1,class:`dlg__msg`},Fx={class:`dlg__btns`},Ix={class:`dtoast__icon-svg`,viewBox:`0 0 24 24`,"aria-hidden":`true`},Lx=[`href`],Rx={class:`dtoast__msg`};function zx(e,t,n,r,i,a){return B(),V(`div`,jx,[K(` alertDialog:原生风格居中确认对话框 `),W(ic,{name:`dlg-fade`},{default:F(()=>[a.dialog?(B(),V(`div`,{key:0,class:`dlg-mask`,onClick:t[2]||=q((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[U(`div`,Mx,[a.dialog.title?(B(),V(`div`,Nx,j(a.dialog.title),1)):K(`v-if`,!0),a.dialog.message?(B(),V(`div`,Px,j(a.dialog.message),1)):K(`v-if`,!0),U(`div`,Fx,[a.dialog.cancelButton?(B(),V(`button`,{key:0,type:`button`,class:A([`dlg__btn dlg__btn--cancel`,{"dlg__btn--gray":a.dialog.cancelGrayStyle}]),onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},j(a.dialog.cancelButton),3)):K(`v-if`,!0),U(`button`,{type:`button`,class:`dlg__btn dlg__btn--ok`,onClick:t[1]||=(...e)=>a.onOk&&a.onOk(...e)},j(a.dialog.okButton),1)])])])):K(`v-if`,!0)]),_:1}),K(` showToast:居中弱提示(对齐 Vant Toast 视觉语言) `),W(ic,{name:`toast-fade`},{default:F(()=>[a.toast?(B(),V(`div`,{key:0,class:A([`dtoast`,{"dtoast--icon":a.toast.icon}])},[a.toast.icon?(B(),V(`span`,{key:0,class:A([`dtoast__icon`,`dtoast__icon--`+a.toast.icon])},[(B(),V(`svg`,Ix,[U(`use`,{href:a.toast.icon===`ok`?`#icon-check-plain`:`#icon-x`},null,8,Lx)]))],2)):K(`v-if`,!0),U(`span`,Rx,j(a.toast.message),1)],2)):K(`v-if`,!0)]),_:1})])}var Bx=X(Ax,[[`render`,zx],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/DeviceOverlay.vue`]]),Vx={name:`PickerOverlay`,data(){return{sel:[]}},computed:{picker(){return sx.picker},columns(){if(!this.picker)return[];let e=this.picker.dataSource||[];if(this.picker.mode===`multi`){let t=e.map(e=>({key:String(e.key),text:e.text})),n=this.sel[0]||0,r=(e[n]&&e[n].children||[]).map(e=>({key:String(e.key),text:e.text}));return[{items:t,level:0},{items:r,level:1}]}return[{items:e.map(e=>({key:String(e.key),text:e.text})),level:0}]}},watch:{picker:{immediate:!0,handler(e){if(!e){this.sel=[];return}let t=e.dataSource||[],n=e.currentValue||[];if(e.mode===`multi`){let e=t.findIndex(e=>String(e.key)===String(n[0])),r=e>=0?e:0,i=t[r]&&t[r].children||[],a=i.findIndex(e=>String(e.key)===String(n[1]));this.sel=[r,a>=0?a:i.length?0:-1]}else{let e=t.findIndex(e=>String(e.key)===String(n[0]));this.sel=[e>=0?e:0]}}}},methods:{select(e,t){let n=this.sel.slice();if(n[e]=t,e===0&&this.picker.mode===`multi`){let e=this.picker.dataSource||[];n[1]=(e[t]&&e[t].children||[]).length?0:-1}this.sel=n},buildResult(){let e=this.picker;if(!e)return[];let t=e.dataSource||[],n=e=>({key:String(e.key),text:e.text,value:e.text});if(e.mode===`multi`){let e=t[this.sel[0]]||t[0],r=e&&e.children||[],i=r[this.sel[1]]||r[0],a=[];return e&&a.push(n(e)),i&&a.push(n(i)),a}let r=t[this.sel[0]]||t[0];return r?[n(r)]:[]},onConfirm(){Cx(!0,this.buildResult())},onCancel(){Cx(!1)}}},Hx={class:`device-ui`},Ux={class:`pk-sheet`},Wx={class:`pk-bar`},Gx={key:0,class:`pk-bar__title`},Kx={class:`pk-col__list`},qx=[`onClick`];function Jx(e,t,n,r,i,a){return B(),V(`div`,Hx,[W(ic,{name:`picker-fade`},{default:F(()=>[a.picker?(B(),V(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=q((...e)=>a.onCancel&&a.onCancel(...e),[`self`])},[U(`div`,Ux,[U(`div`,Wx,[U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.picker.title?(B(),V(`div`,Gx,j(a.picker.title),1)):K(`v-if`,!0),U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),U(`div`,{class:A([`pk-cols`,`pk-cols--`+a.columns.length])},[(B(!0),V(z,null,R(a.columns,(e,n)=>(B(),V(`div`,{key:n,class:`pk-col`},[t[3]||=U(`div`,{class:`pk-col__band`},null,-1),U(`div`,Kx,[(B(!0),V(z,null,R(e.items,(e,t)=>(B(),V(`div`,{key:e.key,class:A([`pk-item`,{"pk-item--on":i.sel[n]===t}]),onClick:e=>a.select(n,t)},j(e.text),11,qx))),128))])]))),128))],2)])])):K(`v-if`,!0)]),_:1})])}var Yx=X(Vx,[[`render`,Jx],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/PickerOverlay.vue`]]),Xx=40;function Zx(e){return String(e).padStart(2,`0`)}function Qx(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function $x(e,t){return[31,e%4==0&&e%100!=0||e%400==0?29:28,31,30,31,30,31,31,30,31,30,31][(t-1+12)%12]}function eS(e){if(!e)return null;let t=String(e).split(`-`).map(e=>parseInt(e,10));return t.some(e=>Number.isNaN(e))?null:t.length===3?{y:t[0],m:t[1],d:t[2]}:t.length===2?{m:t[0],d:t[1]}:null}var tS={name:`DatePickerOverlay`,data(){return{sel:[],dragging:!1,drag:null,suppressClick:!1,scrollTimers:[]}},computed:{datePicker(){return sx.datePicker},yearRange(){let e=this.datePicker,t=eS(e&&e.startDate)||{y:1970},n=eS(e&&e.endDate)||{y:2100};return{minY:t.y||1970,maxY:n.y||2100}},columns(){let e=this.datePicker;if(!e)return[];let{minY:t}=this.yearRange;if(e.type===`month_day`)return[{key:`month`,items:Qx(1,12).map(e=>({text:Zx(e)}))},{key:`day`,items:Qx(1,31).map(e=>({text:Zx(e)}))}];if(e.type===`year_month`)return[{key:`year`,items:Qx(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:Qx(1,12).map(e=>({text:Zx(e)}))}];let n=$x(t+(this.sel[0]||0),(this.sel[1]||0)+1);return[{key:`year`,items:Qx(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:Qx(1,12).map(e=>({text:Zx(e)}))},{key:`day`,items:Qx(1,n).map(e=>({text:Zx(e)}))}]}},watch:{datePicker:{immediate:!0,handler(e){if(!e){this.sel=[],this.scrollTimers=[];return}let t=eS(e.selectDate)||this.todayConstrained(e),{minY:n}=this.yearRange;if(e.type===`month_day`)this.sel=[t.m-1,t.d-1];else if(e.type===`year_month`)this.sel=[t.y-n,t.m-1];else{let e=$x(t.y,t.m);this.sel=[t.y-n,t.m-1,Math.min(t.d,e)-1]}this.$nextTick(()=>this.syncScrollTops())}},sel:{deep:!0,handler(){let e=this.datePicker;if(!e)return;let t=this.sel.slice();if(e.type===`year_month_day`){let e=$x(this.yearRange.minY+(t[0]||0),(t[1]||0)+1);if(t[2]>e-1){t[2]=e-1,this.sel=t;return}}this.$nextTick(()=>this.syncScrollTops())}}},methods:{getList(e){let t=this.$refs.cols;return t&&t.querySelectorAll(`.pk-col__list`)[e]||null},scrollForIndex(e){return(e||0)*Xx},syncScrollTops(){this.columns.forEach((e,t)=>{let n=this.getList(t);n&&(n.scrollTop=this.scrollForIndex(this.sel[t]||0))})},pointerY(e){return e.touches&&e.touches.length?e.touches[0].clientY:e.clientY},onDragStart(e,t){this.suppressClick=!1;let n=this.getList(e);this.drag={ci:e,startY:this.pointerY(t),startScrollTop:n?n.scrollTop:0,moved:!1},this.dragging=!0,clearTimeout(this.scrollTimers[e]),window.addEventListener(`mousemove`,this.onDragMove),window.addEventListener(`mouseup`,this.onDragEnd),window.addEventListener(`touchmove`,this.onDragMove,{passive:!1}),window.addEventListener(`touchend`,this.onDragEnd)},onDragMove(e){if(!this.drag)return;e.cancelable&&e.preventDefault();let t=this.pointerY(e)-this.drag.startY;Math.abs(t)>3&&(this.drag.moved=!0);let n=this.getList(this.drag.ci);n&&(n.scrollTop=this.drag.startScrollTop-t)},onDragEnd(){if(!this.drag)return;let e=this.drag.ci,t=this.getList(e),n=this.drag.moved;if(this.drag=null,this.dragging=!1,window.removeEventListener(`mousemove`,this.onDragMove),window.removeEventListener(`mouseup`,this.onDragEnd),window.removeEventListener(`touchmove`,this.onDragMove),window.removeEventListener(`touchend`,this.onDragEnd),t){let n=this.columns[e].items.length-1,r=Math.round(t.scrollTop/Xx);if(r=Math.max(0,Math.min(n,r)),t.scrollTop=this.scrollForIndex(r),this.sel[e]!==r){let t=this.sel.slice();t[e]=r,this.sel=t}}n&&(this.suppressClick=!0,this.$nextTick(()=>{this.suppressClick=!1}))},onWheel(e,t){clearTimeout(this.scrollTimers[e]),this.scrollTimers[e]=setTimeout(()=>this.snapToNearest(e),120)},onScroll(e,t){this.dragging||(clearTimeout(this.scrollTimers[e]),this.scrollTimers[e]=setTimeout(()=>this.snapToNearest(e),120))},snapToNearest(e){let t=this.getList(e);if(!t)return;let n=this.columns[e]&&this.columns[e].items.length-1||0,r=Math.round(t.scrollTop/Xx);if(r=Math.max(0,Math.min(n,r)),t.scrollTop=this.scrollForIndex(r),this.sel[e]!==r){let t=this.sel.slice();t[e]=r,this.sel=t}},onItemClick(e,t){if(this.suppressClick)return;let n=this.getList(e);n&&(n.scrollTop=this.scrollForIndex(t));let r=this.sel.slice();r[e]=t,this.sel=r},todayConstrained(e){let t=new Date,{minY:n,maxY:r}=this.yearRange,i=t.getFullYear();i=Math.max(n,Math.min(r,i));let a=t.getMonth()+1,o=$x(i,a),s=Math.min(t.getDate(),o);return{y:i,m:a,d:s}},buildResult(){let e=this.datePicker;if(!e)return null;let{minY:t}=this.yearRange,n=``,r=0,i=0;e.type===`month_day`?(r=(this.sel[0]||0)+1,i=(this.sel[1]||0)+1):e.type===`year_month`?(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1):(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1,i=(this.sel[2]||0)+1);let a=Zx(r),o=Zx(i),s;return s=e.type===`year_month_day`?`${n}-${a}-${o}`:e.type===`year_month`?`${n}-${a}`:`${a}-${o}`,{year:e.type===`month_day`?``:String(n),month:a,day:e.type===`year_month`?``:o,value:s}},onConfirm(){Ex(!0,this.buildResult())},onCancel(){Ex(!1)}},beforeUnmount(){window.removeEventListener(`mousemove`,this.onDragMove),window.removeEventListener(`mouseup`,this.onDragEnd),window.removeEventListener(`touchmove`,this.onDragMove),window.removeEventListener(`touchend`,this.onDragEnd),this.scrollTimers.forEach(e=>clearTimeout(e))}},nS={class:`device-ui`},rS={class:`pk-sheet`},iS={class:`pk-bar`},aS={key:0,class:`pk-bar__title`},oS=[`onMousedown`,`onTouchstart`,`onWheel`],sS=[`onScroll`],cS=[`onClick`];function lS(e,t,n,r,i,a){return B(),V(`div`,nS,[W(ic,{name:`picker-fade`},{default:F(()=>[a.datePicker?(B(),V(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=q((...e)=>a.onCancel&&a.onCancel(...e),[`self`])},[U(`div`,rS,[U(`div`,iS,[U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.datePicker.title?(B(),V(`div`,aS,j(a.datePicker.title),1)):K(`v-if`,!0),U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),U(`div`,{ref:`cols`,class:A([`pk-cols pk-cols--wheel`,[`pk-cols--`+a.columns.length,{"is-dragging":i.dragging}]])},[(B(!0),V(z,null,R(a.columns,(e,n)=>(B(),V(`div`,{key:e.key,class:`pk-col`,onMousedown:q(e=>a.onDragStart(n,e),[`prevent`]),onTouchstart:q(e=>a.onDragStart(n,e),[`prevent`]),onWheel:e=>a.onWheel(n,e)},[t[3]||=U(`div`,{class:`pk-col__band`},null,-1),U(`div`,{class:`pk-col__list`,onScroll:e=>a.onScroll(n,e)},[(B(!0),V(z,null,R(e.items,(t,r)=>(B(),V(`div`,{key:e.key+`-`+t.text,class:A([`pk-item`,{"pk-item--on":i.sel[n]===r}]),onClick:e=>a.onItemClick(n,r)},j(t.text),11,cS))),128))],40,sS)],40,oS))),128))],2)])])):K(`v-if`,!0)]),_:1})])}var uS=X(tS,[[`render`,lS],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/DatePickerOverlay.vue`]]),dS={name:`SelectionOverlay`,props:{store:{type:Object,default:()=>Qf},boxClass:{type:String,default:`ce-sel-overlay`}},data(){return{boxStyle:{top:`0px`,left:`0px`,width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0}},watch:{"store.el"(){this.bindTarget(),this.schedule()}},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=this.store.el;!e||typeof ResizeObserver>`u`||(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=this.store.el;if(!e||!this.store.visible)return;let t=e.closest(`.phone__screen`);if(!t){this.store.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-n.top+t.scrollTop,a=r.left-n.left+t.scrollLeft;this.boxStyle={top:i+`px`,left:a+`px`,width:r.width+`px`,height:r.height+`px`}}}},fS={width:`100%`,height:`100%`,style:{display:`block`},xmlns:`http://www.w3.org/2000/svg`};function pS(e,t,n,r,i,a){return I((B(),V(`div`,{class:A(n.boxClass),style:k(i.boxStyle)},[(B(),V(`svg`,fS,[...t[0]||=[U(`rect`,{id:`controls_bounding_rect`,x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`transparent`,style:{stroke:`var(--accent)`},"stroke-width":`1`,"stroke-dasharray":`4`},null,-1)]]))],6)),[[Sc,n.store.visible]])}var mS=X(dS,[[`render`,pS],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/SelectionOverlay.vue`]]),hS=rn({el:null,visible:!1,nodeId:null});function gS(e,t){hS.el=e,hS.nodeId=t,hS.visible=!0}function _S(e){hS.el&&(e==null||hS.nodeId===e)&&(hS.el=null,hS.nodeId=null,hS.visible=!1)}var vS={name:`HoverGuides`,setup(){return{hoverGuide:hS}},data(){return{box:{left:0,top:0,right:0,bottom:0},containerStyle:{width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0,_stopWatch:null}},created(){this._stopWatch=Wr(()=>hS.el,()=>{this.bindTarget(),this.schedule()})},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._stopWatch&&=(this._stopWatch(),null),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=hS.el;!e||typeof ResizeObserver>`u`||(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=hS.el;if(!e||!hS.visible)return;let t=e.closest(`.phone__screen`);if(!t){hS.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.left-n.left+t.scrollLeft,a=r.top-n.top+t.scrollTop,o=r.width,s=r.height;this.box={left:i,top:a,right:i+o,bottom:a+s},this.containerStyle={width:t.clientWidth+`px`,height:t.scrollHeight+`px`}}}};function yS(e,t,n,r,i,a){return I((B(),V(`div`,{class:`ce-guides`,style:k(i.containerStyle)},[K(` 左 / 右竖线:贯穿画布全高 `),U(`div`,{class:`ce-guide ce-guide--v`,style:k({left:i.box.left+`px`})},null,4),U(`div`,{class:`ce-guide ce-guide--v`,style:k({left:i.box.right+`px`})},null,4),K(` 上 / 下横线:贯穿画布全宽 `),U(`div`,{class:`ce-guide ce-guide--h`,style:k({top:i.box.top+`px`})},null,4),U(`div`,{class:`ce-guide ce-guide--h`,style:k({top:i.box.bottom+`px`})},null,4)],4)),[[Sc,r.hoverGuide.visible]])}var bS=X(vS,[[`render`,yS],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/HoverGuides.vue`]]),xS=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),SS=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),CS=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),wS=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),TS=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),ES=o((e=>{var t=SS().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),DS=o((e=>{var t=SS().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),OS=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),kS=o((e=>{var t=CS(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),AS=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),jS=o((e=>{var t=AS();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),MS=o(((e,t)=>{var n=jS();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),NS=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),PS=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
219
- ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),FS=o((e=>{var t=NS(),n=PS();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),IS=o((e=>{var t=SS(),n=kS(),r=CS(),i=FS(),a=NS(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),LS=o((e=>{var t=SS(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),RS=o(((e,t)=>{var n=FS();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),zS=o(((e,t)=>{var n=FS(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),BS=o(((e,t)=>{var n=FS();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),VS=o(((e,t)=>{var n=FS(),r=SS();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
220
- Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),HS=o(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),US=o((e=>{var t=FS(),n=RS(),r=zS(),i=BS(),a=VS(),o=PS(),s=SS(),c=HS();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
221
- Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),WS=o((e=>{var t=SS(),n=CS(),r=wS(),i=TS(),a=ES(),o=DS(),s=OS(),c=kS(),l=MS(),u=IS(),d=LS(),f=FS(),p=US();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
220
+ (varDlg.form.defaultValue),确定时仍由 parseDefault 按类型解析。 `),U(`div`,_b,[t[113]||=U(`label`,{class:`ni-field-label`},`默认值`,-1),a.isComplexType(i.varDlg.form.type)?(B(),V(`div`,vb,null,512)):i.varDlg.form.type===`string`?I((B(),V(`textarea`,{key:1,class:`ni-input vars-dlg__str`,"onUpdate:modelValue":t[46]||=e=>i.varDlg.form.defaultValue=e,placeholder:a.scalarPlaceholder(`string`)},null,8,yb)),[[il,i.varDlg.form.defaultValue]]):i.varDlg.form.type===`number`?(B(),H(p,{key:2,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,placeholder:a.scalarPlaceholder(`number`),onInput:t[47]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`placeholder`])):(B(),H(m,{key:3,class:`vars-dlg__ctrl`,value:i.varDlg.form.defaultValue,options:{iParamList:i.varBoolOptions},onInput:t[48]||=e=>i.varDlg.form.defaultValue=e},null,8,[`value`,`options`]))]),U(`div`,bb,[t[114]||=U(`label`,{class:`ni-field-label`},`描述`,-1),I(U(`textarea`,{class:`ni-input vars-dlg__desc`,"onUpdate:modelValue":t[49]||=e=>i.varDlg.form.desc=e,placeholder:`可选`},null,512),[[il,i.varDlg.form.desc]])]),i.varDlgError?(B(),V(`p`,xb,j(i.varDlgError),1)):K(`v-if`,!0)])]),U(`div`,Sb,[t[115]||=U(`span`,{class:`ni-tip`},`默认值入 defaultValue;设计期覆盖见「配置变量 mock」`,-1),U(`div`,Cb,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[50]||=e=>i.varDlg=null},`取消`),U(`button`,{class:`ni-btn`,type:`button`,onClick:t[51]||=(...e)=>a.confirmVarDlg&&a.confirmVarDlg(...e)},`确定`)])])],8,ib)])):K(`v-if`,!0)]),_:1}),W(h,{visible:i.delVarTarget!=null,title:`删除变量`,message:a.delVarMessage,severity:a.delVarSeverity,"confirm-text":a.delVarConfirmText,onConfirm:a.confirmDeleteVar,onCancel:t[53]||=e=>i.delVarTarget=null},null,8,[`visible`,`message`,`severity`,`confirm-text`,`onConfirm`])])}var Tb=X($_,[[`render`,wb],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/DebugPanel.vue`]]),Eb={name:`ApiCallPanel`,components:{ApiPayloadTree:zg},props:{rt:{type:Object,required:!0}},emits:[`close`],data(){return{copiedIndex:null,apiCopyTimer:null}},computed:{apiCalls(){return this.rt.apiRev,this.rt.apiCalls.slice()}},methods:{clearApiLog(){this.rt.clearApiCalls()},async copyApiPayload(e,t){let n=``;try{n=JSON.stringify(e.payload,null,2)}catch{n=String(e.payload)}await op(n)&&(this.copiedIndex=t,this.apiCopyTimer&&clearTimeout(this.apiCopyTimer),this.apiCopyTimer=setTimeout(()=>{this.copiedIndex===t&&(this.copiedIndex=null)},1500))}}},Db={class:`apipanel`},Ob={class:`apipanel__head`},kb={class:`apipanel__title`},Ab={key:0,class:`debug__count`},jb=[`disabled`],Mb={class:`apipanel__body`},Nb={key:0,class:`empty-state`},Pb={class:`debug__list`},Fb={class:`debug__api-row`},Ib={class:`debug__kind`},Lb=[`title`,`onClick`],Rb={key:0,width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},zb={key:1,class:`debug__copy-ok`};function Bb(e,t,n,r,i,a){let o=L(`ApiPayloadTree`);return B(),V(`aside`,Db,[U(`div`,Ob,[U(`span`,kb,[t[2]||=G(` API调用 `,-1),a.apiCalls.length?(B(),V(`span`,Ab,j(a.apiCalls.length),1)):K(`v-if`,!0)]),t[5]||=U(`span`,{class:`apipanel__spacer`},null,-1),U(`button`,{class:`apipanel__btn`,type:`button`,disabled:!a.apiCalls.length,title:`清空日志`,onClick:t[0]||=(...e)=>a.clearApiLog&&a.clearApiLog(...e)},[...t[3]||=[U(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-trash`})],-1)]],8,jb),U(`button`,{class:`apipanel__btn`,type:`button`,title:`收起接口调用面板`,onClick:t[1]||=t=>e.$emit(`close`)},[...t[4]||=[U(`svg`,{width:`15`,height:`15`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,Mb,[K(` 空状态占位:虚线圆形徽章 + 插头图标(与全局 24 网格线性图标同语言)+ 文案 + 弱提示 `),a.apiCalls.length?K(`v-if`,!0):(B(),V(`div`,Nb,[...t[6]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><use href="#icon-cup"></use></svg></span><p class="debug__empty">暂无API调用</p><p class="empty-state__hint">卡片事件触发 ynet.callJSAPI / postMessage 后,调用流水会实时显示在这里</p>`,3)]])),U(`ul`,Pb,[(B(!0),V(z,null,R(a.apiCalls,(e,n)=>(B(),V(`li`,{key:n,class:`debug__item debug__item--api`},[U(`div`,Fb,[U(`span`,Ib,j(e.api),1),U(`button`,{class:`debug__copy-ic`,type:`button`,title:i.copiedIndex===n?`已复制 ✓`:`复制数据(不含方法名)`,onClick:t=>a.copyApiPayload(e,n)},[i.copiedIndex===n?(B(),V(`span`,zb,`✓`)):(B(),V(`svg`,Rb,[...t[7]||=[U(`use`,{href:`#icon-copy-sm`},null,-1)]]))],8,Lb)]),K(` 返回数据:结构化折叠树(Chrome 控制台风格) `),W(o,{value:e.payload},null,8,[`value`])]))),128))])])])}var Vb=X(Eb,[[`render`,Bb],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ApiCallPanel.vue`]]),Hb={name:`CardSelect`,emits:[`input`,`change`],props:{value:{type:String,default:``},options:{type:Array,default:()=>[]}},data(){return{open:!1,query:``,highlighted:0,sortByTime:this.loadSortByTime()}},created(){this.saveSortByTime()},computed:{current(){return this.options.find(e=>e.id===this.value)||{id:this.value,name:this.value}},filtered(){let e=this.query.trim().toLowerCase(),t=this.options;return e&&(t=this.options.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))}},watch:{open(e){e?(this.query=``,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value)),this.$nextTick(()=>{this.$refs.search&&this.$refs.search.focus(),this.scrollToActive()}),document.addEventListener(`click`,this.onDocClick,!0)):document.removeEventListener(`click`,this.onDocClick,!0)},sortByTime(e){this.saveSortByTime()}},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0)},methods:{toggle(){this.open=!this.open},toggleSort(){this.sortByTime=!this.sortByTime,this.highlighted=Math.max(0,this.filtered.findIndex(e=>e.id===this.value))},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardselect-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardselect-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},close(){this.open=!1},onDocClick(e){this.$refs.root&&!this.$refs.root.contains(e.target)&&this.close()},move(e){if(!this.filtered.length)return;let t=this.filtered.length;this.highlighted=(this.highlighted+e+t)%t,this.$nextTick(this.scrollToActive)},scrollToActive(){let e=this.$refs.list;if(!e)return;let t=e.children[this.highlighted];t&&t.scrollIntoView&&t.scrollIntoView({block:`nearest`})},choose(e){e&&(this.close(),e.id!==this.value&&(this.$emit(`input`,e.id),this.$emit(`change`,e.id)))}}},Ub={class:`csel__current`},Wb={class:`csel__id`},Gb={class:`csel__name`},Kb={key:0,class:`csel__pop`},qb={class:`csel__search`},Jb={ref:`list`,class:`csel__list`},Yb=[`onMousemove`,`onClick`],Xb=[`title`],Zb={class:`csel__item-id`},Qb={class:`csel__item-name`},$b={key:0,class:`csel__check`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},ex={key:0,class:`csel__empty`},tx={class:`csel__foot`},nx=[`title`,`aria-pressed`],rx={class:`csel__count`};function ix(e,t,n,r,i,a){return B(),V(`div`,{ref:`root`,class:A([`csel`,{"csel--open":i.open}])},[U(`button`,{type:`button`,class:A([`csel__trigger`,{"csel__trigger--active":i.open}]),onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[U(`span`,Ub,[U(`span`,Wb,j(a.current.id),1),U(`span`,Gb,j(a.current.name),1)]),t[7]||=U(`svg`,{class:`csel__chev`,viewBox:`0 0 16 16`,width:`14`,height:`14`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron`})],-1)],2),W(ic,{name:`csel-fade`},{default:F(()=>[i.open?(B(),V(`div`,Kb,[U(`div`,qb,[t[8]||=U(`svg`,{class:`csel__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[U(`use`,{href:`#icon-search`})],-1),I(U(`input`,{ref:`search`,"onUpdate:modelValue":t[1]||=e=>i.query=e,class:`csel__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`,onKeydown:[t[2]||=vl(q(e=>a.move(1),[`prevent`]),[`down`]),t[3]||=vl(q(e=>a.move(-1),[`prevent`]),[`up`]),t[4]||=vl(q(e=>a.choose(a.filtered[i.highlighted]),[`prevent`]),[`enter`]),t[5]||=vl(q((...e)=>a.close&&a.close(...e),[`prevent`]),[`esc`])]},null,544),[[il,i.query]])]),U(`ul`,Jb,[(B(!0),V(z,null,R(a.filtered,(e,r)=>(B(),V(`li`,{key:e.id,class:A([`csel__item`,{"csel__item--active":r===i.highlighted,"csel__item--selected":e.id===n.value}]),onMousemove:e=>i.highlighted=r,onClick:t=>a.choose(e)},[U(`span`,{class:A([`csel__dot`,{"csel__dot--imported":e.imported}]),title:e.imported?`导入卡片(含 .import-meta.json 来源信息)`:`本地卡片(无导入来源信息)`,"aria-hidden":`true`},null,10,Xb),U(`span`,Zb,j(e.id),1),U(`span`,Qb,j(e.name),1),e.id===n.value?(B(),V(`svg`,$b,[...t[9]||=[U(`use`,{href:`#icon-check`},null,-1)]])):K(`v-if`,!0)],42,Yb))),128)),a.filtered.length?K(`v-if`,!0):(B(),V(`li`,ex,`无匹配卡片`))],512),U(`div`,tx,[U(`button`,{class:A([`csel__sort`,{"csel__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[6]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,nx),U(`span`,rx,j(a.filtered.length)+` / `+j(n.options.length)+` 张卡片`,1)])])):K(`v-if`,!0)]),_:1})],2)}var ax=X(Hb,[[`render`,ix],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/CardSelect.vue`]]),ox=X({name:`AlertCardInstance`,components:{RenderTree:ap},props:{entry:{type:Object,required:!0},mainRt:{type:Object,default:null}},data(){let e=new eu,t=au(this.entry.scope,e),n=this.mainRt;if(n&&n.pushError&&n.pushApiCall){let e=t.pushError.bind(t);t.pushError=(t,r)=>{e(t,r),n.pushError(t,r)};let r=t.pushApiCall.bind(t);t.pushApiCall=(e,t)=>{r(e,t),n.pushApiCall(e,t)}}return{adapter:e,cardRuntime:t}},provide(){return{adapter:this.adapter,cardRuntime:this.cardRuntime,customComponents:{}}},render(){return Vs(ap,{node:this.entry.preview.view,scope:this.cardRuntime.rootScope,key:this.entry.id})}},[[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AlertCardInstance.vue`]]),sx=rn({stack:[]}),cx=0;async function lx(e,t){let n=e||{},r=n.cardCode,i=null;try{let e=await J(`/__card/${encodeURIComponent(r)}`);if(e.ok){let t=await e.json();t&&t.schema&&(i=t)}}catch{}if(!i||!i.schema){typeof t==`function`&&t({success:!1,error:`card_not_found`,errorMessage:`未找到卡片 `+r});return}let a=sx.stack;a.length&&a.splice(0,a.length).forEach(e=>{if(typeof e.callback==`function`)try{e.callback({success:!0,data:{event:`hidden`}})}catch{}});let o=i.data&&typeof i.data==`object`?i.data:{},s=rn(Object.assign({},o,n.data||{})),c=Pu(i.schema),l=`alert-`+ ++cx;a.push({id:l,cardCode:r,preview:c,scope:s,gravity:n.gravity||`bottom`,width:typeof n.width==`number`?n.width:void 0,height:typeof n.height==`number`?n.height:void 0,offsetX:typeof n.offsetX==`number`?n.offsetX:0,offsetY:typeof n.offsetY==`number`?n.offsetY:0,clickOutsideCanHide:n.clickOutsideCanHide!==!1,callback:t})}function ux(e,t){let n=e||{},r=sx.stack,i=null;if(typeof n.index==`number`){let e=Math.abs(n.index);r.length>=e&&(i=r[r.length-e])}else if(n.cardCode){for(let e=r.length-1;e>=0;e--)if(r[e].cardCode===n.cardCode){i=r[e];break}}else i=r[r.length-1];if(!i){typeof t==`function`&&t({success:!1,error:`no_alert`,errorMessage:`没有可关闭的弹窗`});return}let a=r.indexOf(i);r.splice(a,1),typeof i.callback==`function`&&(n.data?i.callback({success:!0,data:Object.assign({event:`hidden`},n.data)}):i.callback({success:!0,data:{}})),typeof t==`function`&&t({success:!0})}function dx(){let e=sx.stack;e.length&&e.splice(0,e.length)}var fx={name:`AlertCardLayer`,components:{AlertCardInstance:ox},props:{mainRt:{type:Object,default:null}},computed:{top(){let e=sx.stack;return e.length?e[e.length-1]:null}},methods:{onMaskClick(e){e.clickOutsideCanHide&&ux({cardCode:e.cardCode})},panelStyle(e){let t={};e.width&&(t.width=e.width+`px`),e.height&&(t.height=e.height+`px`);let n=[];return e.offsetX&&n.push(`translateX(`+e.offsetX+`px)`),e.offsetY&&n.push(`translateY(`+e.offsetY+`px)`),n.length&&(t.transform=n.join(` `)),t}}},px={key:0,class:`alert-layer`};function mx(e,t,n,r,i,a){let o=L(`AlertCardInstance`);return a.top?(B(),V(`div`,px,[U(`div`,{class:A([`alert-mask`,`alert-mask--`+a.top.gravity]),onClick:t[0]||=q(e=>a.onMaskClick(a.top),[`self`])},[U(`div`,{class:`alert-panel`,style:k(a.panelStyle(a.top))},[W(o,{entry:a.top,"main-rt":n.mainRt},null,8,[`entry`,`main-rt`])],4)],2)])):K(`v-if`,!0)}var hx=X(fx,[[`render`,mx],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AlertCardLayer.vue`]]),gx=rn({dialog:null,toast:null,picker:null,datePicker:null}),_x=[],vx=0,yx=null,bx=[],xx=0,Sx=[],Cx=0,wx=2200;function Tx(e,t){if(typeof e==`function`)try{e(t)}catch{}}function Ex(){gx.dialog=_x.length?_x.shift():null}function Dx(e,t){let n=e||{};_x.push({id:++vx,title:n.title||``,message:n.message==null?``:String(n.message),okButton:n.okButton||`确定`,cancelButton:n.cancelButton||``,clickBgToHide:n.clickBgToHide===!0,cancelGrayStyle:n.cancelGrayStyle===!0,callback:t}),gx.dialog||Ex()}function Ox(e){let t=gx.dialog;t&&(gx.dialog=null,Tx(t.callback,{success:!0,data:{ok:!!e.ok,dismissByClickBg:!!e.dismissByClickBg}}),Ex())}function kx(e,t){let n=e||{},r=n.showIcon==null?``:String(n.showIcon),i=r===`1`?`ok`:r===`0`?`err`:``;yx&&=(clearTimeout(yx),null),gx.toast={message:n.message==null?``:String(n.message),icon:i},yx=setTimeout(()=>{gx.toast=null,yx=null},wx),Tx(t,{success:!0,data:{}})}function Ax(e,t){let n=e||{},r=Array.isArray(n.currentValue)?n.currentValue:[];r.length&&Array.isArray(r[0])&&(r=r[0]),bx.push({id:++xx,title:n.title||``,mode:n.mode===`multi`?`multi`:`single`,dataSource:Array.isArray(n.dataSource)?n.dataSource:[],currentValue:r.map(e=>String(e)),callback:t}),gx.picker||jx()}function jx(){gx.picker=bx.length?bx.shift():null}function Mx(e,t){let n=gx.picker;if(n){if(gx.picker=null,e){let e={success:!0,error:`0`,data:{result:t},result:t};Tx(n.callback,e)}else Tx(n.callback,{success:!0,data:{}});jx()}}function Nx(e,t){let n=e||{},r=[`year_month_day`,`year_month`,`month_day`].includes(n.type)?n.type:`year_month_day`;Sx.push({id:++Cx,title:n.title||``,type:r,startDate:n.startDate||`1970-1-1`,endDate:n.endDate||`2100-12-31`,selectDate:n.selectDate||``,callback:t}),gx.datePicker||Px()}function Px(){gx.datePicker=Sx.length?Sx.shift():null}function Fx(e,t){let n=gx.datePicker;if(n){if(gx.datePicker=null,e){let e={success:!0,error:`0`,currentDate:t.value,data:{year:t.year,month:t.month,day:t.day,value:t.value}};Tx(n.callback,e)}else Tx(n.callback,{success:!0,data:{}});Px()}}var Ix={alertCard:(e,t)=>lx(e,t),closeAlertCard:(e,t)=>ux(e,t),alertDialog:Dx,showToast:kx,showPicker:Ax,showDatePicker:Nx};function Lx(e){typeof window>`u`||(window.ynet={callJSAPI(t,n,r){e&&e.pushApiCall&&e.pushApiCall(t,n);let i=Ix[t];if(i){i(n,r);return}Tx(r,{success:!0,data:{}})}})}function Rx(){_x.length=0,gx.dialog=null,gx.toast=null,yx&&=(clearTimeout(yx),null),bx.length=0,gx.picker=null,Sx.length=0,gx.datePicker=null}var zx={name:`DeviceOverlay`,computed:{dialog(){return gx.dialog},toast(){return gx.toast}},methods:{onOk(){Ox({ok:!0,dismissByClickBg:!1})},onCancel(){Ox({ok:!1,dismissByClickBg:!1})},onMaskClick(){this.dialog&&this.dialog.clickBgToHide&&Ox({ok:!1,dismissByClickBg:!0})}}},Bx={class:`device-ui`},Vx={class:`dlg`},Hx={key:0,class:`dlg__title`},Ux={key:1,class:`dlg__msg`},Wx={class:`dlg__btns`},Gx={class:`dtoast__icon-svg`,viewBox:`0 0 24 24`,"aria-hidden":`true`},Kx=[`href`],qx={class:`dtoast__msg`};function Jx(e,t,n,r,i,a){return B(),V(`div`,Bx,[K(` alertDialog:原生风格居中确认对话框 `),W(ic,{name:`dlg-fade`},{default:F(()=>[a.dialog?(B(),V(`div`,{key:0,class:`dlg-mask`,onClick:t[2]||=q((...e)=>a.onMaskClick&&a.onMaskClick(...e),[`self`])},[U(`div`,Vx,[a.dialog.title?(B(),V(`div`,Hx,j(a.dialog.title),1)):K(`v-if`,!0),a.dialog.message?(B(),V(`div`,Ux,j(a.dialog.message),1)):K(`v-if`,!0),U(`div`,Wx,[a.dialog.cancelButton?(B(),V(`button`,{key:0,type:`button`,class:A([`dlg__btn dlg__btn--cancel`,{"dlg__btn--gray":a.dialog.cancelGrayStyle}]),onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},j(a.dialog.cancelButton),3)):K(`v-if`,!0),U(`button`,{type:`button`,class:`dlg__btn dlg__btn--ok`,onClick:t[1]||=(...e)=>a.onOk&&a.onOk(...e)},j(a.dialog.okButton),1)])])])):K(`v-if`,!0)]),_:1}),K(` showToast:居中弱提示(对齐 Vant Toast 视觉语言) `),W(ic,{name:`toast-fade`},{default:F(()=>[a.toast?(B(),V(`div`,{key:0,class:A([`dtoast`,{"dtoast--icon":a.toast.icon}])},[a.toast.icon?(B(),V(`span`,{key:0,class:A([`dtoast__icon`,`dtoast__icon--`+a.toast.icon])},[(B(),V(`svg`,Gx,[U(`use`,{href:a.toast.icon===`ok`?`#icon-check-plain`:`#icon-x`},null,8,Kx)]))],2)):K(`v-if`,!0),U(`span`,qx,j(a.toast.message),1)],2)):K(`v-if`,!0)]),_:1})])}var Yx=X(zx,[[`render`,Jx],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/DeviceOverlay.vue`]]),Xx={name:`PickerOverlay`,data(){return{sel:[]}},computed:{picker(){return gx.picker},columns(){if(!this.picker)return[];let e=this.picker.dataSource||[];if(this.picker.mode===`multi`){let t=e.map(e=>({key:String(e.key),text:e.text})),n=this.sel[0]||0,r=(e[n]&&e[n].children||[]).map(e=>({key:String(e.key),text:e.text}));return[{items:t,level:0},{items:r,level:1}]}return[{items:e.map(e=>({key:String(e.key),text:e.text})),level:0}]}},watch:{picker:{immediate:!0,handler(e){if(!e){this.sel=[];return}let t=e.dataSource||[],n=e.currentValue||[];if(e.mode===`multi`){let e=t.findIndex(e=>String(e.key)===String(n[0])),r=e>=0?e:0,i=t[r]&&t[r].children||[],a=i.findIndex(e=>String(e.key)===String(n[1]));this.sel=[r,a>=0?a:i.length?0:-1]}else{let e=t.findIndex(e=>String(e.key)===String(n[0]));this.sel=[e>=0?e:0]}}}},methods:{select(e,t){let n=this.sel.slice();if(n[e]=t,e===0&&this.picker.mode===`multi`){let e=this.picker.dataSource||[];n[1]=(e[t]&&e[t].children||[]).length?0:-1}this.sel=n},buildResult(){let e=this.picker;if(!e)return[];let t=e.dataSource||[],n=e=>({key:String(e.key),text:e.text,value:e.text});if(e.mode===`multi`){let e=t[this.sel[0]]||t[0],r=e&&e.children||[],i=r[this.sel[1]]||r[0],a=[];return e&&a.push(n(e)),i&&a.push(n(i)),a}let r=t[this.sel[0]]||t[0];return r?[n(r)]:[]},onConfirm(){Mx(!0,this.buildResult())},onCancel(){Mx(!1)}}},Zx={class:`device-ui`},Qx={class:`pk-sheet`},$x={class:`pk-bar`},eS={key:0,class:`pk-bar__title`},tS={class:`pk-col__list`},nS=[`onClick`];function rS(e,t,n,r,i,a){return B(),V(`div`,Zx,[W(ic,{name:`picker-fade`},{default:F(()=>[a.picker?(B(),V(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=q((...e)=>a.onCancel&&a.onCancel(...e),[`self`])},[U(`div`,Qx,[U(`div`,$x,[U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.picker.title?(B(),V(`div`,eS,j(a.picker.title),1)):K(`v-if`,!0),U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),U(`div`,{class:A([`pk-cols`,`pk-cols--`+a.columns.length])},[(B(!0),V(z,null,R(a.columns,(e,n)=>(B(),V(`div`,{key:n,class:`pk-col`},[t[3]||=U(`div`,{class:`pk-col__band`},null,-1),U(`div`,tS,[(B(!0),V(z,null,R(e.items,(e,t)=>(B(),V(`div`,{key:e.key,class:A([`pk-item`,{"pk-item--on":i.sel[n]===t}]),onClick:e=>a.select(n,t)},j(e.text),11,nS))),128))])]))),128))],2)])])):K(`v-if`,!0)]),_:1})])}var iS=X(Xx,[[`render`,rS],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/PickerOverlay.vue`]]),aS=40;function oS(e){return String(e).padStart(2,`0`)}function sS(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function cS(e,t){return[31,e%4==0&&e%100!=0||e%400==0?29:28,31,30,31,30,31,31,30,31,30,31][(t-1+12)%12]}function lS(e){if(!e)return null;let t=String(e).split(`-`).map(e=>parseInt(e,10));return t.some(e=>Number.isNaN(e))?null:t.length===3?{y:t[0],m:t[1],d:t[2]}:t.length===2?{m:t[0],d:t[1]}:null}var uS={name:`DatePickerOverlay`,data(){return{sel:[],dragging:!1,drag:null,suppressClick:!1,scrollTimers:[]}},computed:{datePicker(){return gx.datePicker},yearRange(){let e=this.datePicker,t=lS(e&&e.startDate)||{y:1970},n=lS(e&&e.endDate)||{y:2100};return{minY:t.y||1970,maxY:n.y||2100}},columns(){let e=this.datePicker;if(!e)return[];let{minY:t}=this.yearRange;if(e.type===`month_day`)return[{key:`month`,items:sS(1,12).map(e=>({text:oS(e)}))},{key:`day`,items:sS(1,31).map(e=>({text:oS(e)}))}];if(e.type===`year_month`)return[{key:`year`,items:sS(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:sS(1,12).map(e=>({text:oS(e)}))}];let n=cS(t+(this.sel[0]||0),(this.sel[1]||0)+1);return[{key:`year`,items:sS(t,this.yearRange.maxY).map(e=>({text:String(e)}))},{key:`month`,items:sS(1,12).map(e=>({text:oS(e)}))},{key:`day`,items:sS(1,n).map(e=>({text:oS(e)}))}]}},watch:{datePicker:{immediate:!0,handler(e){if(!e){this.sel=[],this.scrollTimers=[];return}let t=lS(e.selectDate)||this.todayConstrained(e),{minY:n}=this.yearRange;if(e.type===`month_day`)this.sel=[t.m-1,t.d-1];else if(e.type===`year_month`)this.sel=[t.y-n,t.m-1];else{let e=cS(t.y,t.m);this.sel=[t.y-n,t.m-1,Math.min(t.d,e)-1]}this.$nextTick(()=>this.syncScrollTops())}},sel:{deep:!0,handler(){let e=this.datePicker;if(!e)return;let t=this.sel.slice();if(e.type===`year_month_day`){let e=cS(this.yearRange.minY+(t[0]||0),(t[1]||0)+1);if(t[2]>e-1){t[2]=e-1,this.sel=t;return}}this.$nextTick(()=>this.syncScrollTops())}}},methods:{getList(e){let t=this.$refs.cols;return t&&t.querySelectorAll(`.pk-col__list`)[e]||null},scrollForIndex(e){return(e||0)*aS},syncScrollTops(){this.columns.forEach((e,t)=>{let n=this.getList(t);n&&(n.scrollTop=this.scrollForIndex(this.sel[t]||0))})},pointerY(e){return e.touches&&e.touches.length?e.touches[0].clientY:e.clientY},onDragStart(e,t){this.suppressClick=!1;let n=this.getList(e);this.drag={ci:e,startY:this.pointerY(t),startScrollTop:n?n.scrollTop:0,moved:!1},this.dragging=!0,clearTimeout(this.scrollTimers[e]),window.addEventListener(`mousemove`,this.onDragMove),window.addEventListener(`mouseup`,this.onDragEnd),window.addEventListener(`touchmove`,this.onDragMove,{passive:!1}),window.addEventListener(`touchend`,this.onDragEnd)},onDragMove(e){if(!this.drag)return;e.cancelable&&e.preventDefault();let t=this.pointerY(e)-this.drag.startY;Math.abs(t)>3&&(this.drag.moved=!0);let n=this.getList(this.drag.ci);n&&(n.scrollTop=this.drag.startScrollTop-t)},onDragEnd(){if(!this.drag)return;let e=this.drag.ci,t=this.getList(e),n=this.drag.moved;if(this.drag=null,this.dragging=!1,window.removeEventListener(`mousemove`,this.onDragMove),window.removeEventListener(`mouseup`,this.onDragEnd),window.removeEventListener(`touchmove`,this.onDragMove),window.removeEventListener(`touchend`,this.onDragEnd),t){let n=this.columns[e].items.length-1,r=Math.round(t.scrollTop/aS);if(r=Math.max(0,Math.min(n,r)),t.scrollTop=this.scrollForIndex(r),this.sel[e]!==r){let t=this.sel.slice();t[e]=r,this.sel=t}}n&&(this.suppressClick=!0,this.$nextTick(()=>{this.suppressClick=!1}))},onWheel(e,t){clearTimeout(this.scrollTimers[e]),this.scrollTimers[e]=setTimeout(()=>this.snapToNearest(e),120)},onScroll(e,t){this.dragging||(clearTimeout(this.scrollTimers[e]),this.scrollTimers[e]=setTimeout(()=>this.snapToNearest(e),120))},snapToNearest(e){let t=this.getList(e);if(!t)return;let n=this.columns[e]&&this.columns[e].items.length-1||0,r=Math.round(t.scrollTop/aS);if(r=Math.max(0,Math.min(n,r)),t.scrollTop=this.scrollForIndex(r),this.sel[e]!==r){let t=this.sel.slice();t[e]=r,this.sel=t}},onItemClick(e,t){if(this.suppressClick)return;let n=this.getList(e);n&&(n.scrollTop=this.scrollForIndex(t));let r=this.sel.slice();r[e]=t,this.sel=r},todayConstrained(e){let t=new Date,{minY:n,maxY:r}=this.yearRange,i=t.getFullYear();i=Math.max(n,Math.min(r,i));let a=t.getMonth()+1,o=cS(i,a),s=Math.min(t.getDate(),o);return{y:i,m:a,d:s}},buildResult(){let e=this.datePicker;if(!e)return null;let{minY:t}=this.yearRange,n=``,r=0,i=0;e.type===`month_day`?(r=(this.sel[0]||0)+1,i=(this.sel[1]||0)+1):e.type===`year_month`?(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1):(n=t+(this.sel[0]||0),r=(this.sel[1]||0)+1,i=(this.sel[2]||0)+1);let a=oS(r),o=oS(i),s;return s=e.type===`year_month_day`?`${n}-${a}-${o}`:e.type===`year_month`?`${n}-${a}`:`${a}-${o}`,{year:e.type===`month_day`?``:String(n),month:a,day:e.type===`year_month`?``:o,value:s}},onConfirm(){Fx(!0,this.buildResult())},onCancel(){Fx(!1)}},beforeUnmount(){window.removeEventListener(`mousemove`,this.onDragMove),window.removeEventListener(`mouseup`,this.onDragEnd),window.removeEventListener(`touchmove`,this.onDragMove),window.removeEventListener(`touchend`,this.onDragEnd),this.scrollTimers.forEach(e=>clearTimeout(e))}},dS={class:`device-ui`},fS={class:`pk-sheet`},pS={class:`pk-bar`},mS={key:0,class:`pk-bar__title`},hS=[`onMousedown`,`onTouchstart`,`onWheel`],gS=[`onScroll`],_S=[`onClick`];function vS(e,t,n,r,i,a){return B(),V(`div`,dS,[W(ic,{name:`picker-fade`},{default:F(()=>[a.datePicker?(B(),V(`div`,{key:0,class:`pk-mask`,onClick:t[2]||=q((...e)=>a.onCancel&&a.onCancel(...e),[`self`])},[U(`div`,fS,[U(`div`,pS,[U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--cancel`,onClick:t[0]||=(...e)=>a.onCancel&&a.onCancel(...e)},`取消`),a.datePicker.title?(B(),V(`div`,mS,j(a.datePicker.title),1)):K(`v-if`,!0),U(`button`,{type:`button`,class:`pk-bar__btn pk-bar__btn--ok`,onClick:t[1]||=(...e)=>a.onConfirm&&a.onConfirm(...e)},`确定`)]),U(`div`,{ref:`cols`,class:A([`pk-cols pk-cols--wheel`,[`pk-cols--`+a.columns.length,{"is-dragging":i.dragging}]])},[(B(!0),V(z,null,R(a.columns,(e,n)=>(B(),V(`div`,{key:e.key,class:`pk-col`,onMousedown:q(e=>a.onDragStart(n,e),[`prevent`]),onTouchstart:q(e=>a.onDragStart(n,e),[`prevent`]),onWheel:e=>a.onWheel(n,e)},[t[3]||=U(`div`,{class:`pk-col__band`},null,-1),U(`div`,{class:`pk-col__list`,onScroll:e=>a.onScroll(n,e)},[(B(!0),V(z,null,R(e.items,(t,r)=>(B(),V(`div`,{key:e.key+`-`+t.text,class:A([`pk-item`,{"pk-item--on":i.sel[n]===r}]),onClick:e=>a.onItemClick(n,r)},j(t.text),11,_S))),128))],40,gS)],40,hS))),128))],2)])])):K(`v-if`,!0)]),_:1})])}var yS=X(uS,[[`render`,vS],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/DatePickerOverlay.vue`]]),bS={name:`SelectionOverlay`,props:{store:{type:Object,default:()=>Qf},boxClass:{type:String,default:`ce-sel-overlay`}},data(){return{boxStyle:{top:`0px`,left:`0px`,width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0}},watch:{"store.el"(){this.bindTarget(),this.schedule()}},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=this.store.el;!e||typeof ResizeObserver>`u`||(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=this.store.el;if(!e||!this.store.visible)return;let t=e.closest(`.phone__screen`);if(!t){this.store.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.top-n.top+t.scrollTop,a=r.left-n.left+t.scrollLeft;this.boxStyle={top:i+`px`,left:a+`px`,width:r.width+`px`,height:r.height+`px`}}}},xS={width:`100%`,height:`100%`,style:{display:`block`},xmlns:`http://www.w3.org/2000/svg`};function SS(e,t,n,r,i,a){return I((B(),V(`div`,{class:A(n.boxClass),style:k(i.boxStyle)},[(B(),V(`svg`,xS,[...t[0]||=[U(`rect`,{id:`controls_bounding_rect`,x:`0`,y:`0`,width:`100%`,height:`100%`,fill:`transparent`,style:{stroke:`var(--accent)`},"stroke-width":`1`,"stroke-dasharray":`4`},null,-1)]]))],6)),[[Sc,n.store.visible]])}var CS=X(bS,[[`render`,SS],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/SelectionOverlay.vue`]]),wS=rn({el:null,visible:!1,nodeId:null});function TS(e,t){wS.el=e,wS.nodeId=t,wS.visible=!0}function ES(e){wS.el&&(e==null||wS.nodeId===e)&&(wS.el=null,wS.nodeId=null,wS.visible=!1)}var DS={name:`HoverGuides`,setup(){return{hoverGuide:wS}},data(){return{box:{left:0,top:0,right:0,bottom:0},containerStyle:{width:`0px`,height:`0px`},_ro:null,_onScroll:null,_onResize:null,_raf:0,_stopWatch:null}},created(){this._stopWatch=Wr(()=>wS.el,()=>{this.bindTarget(),this.schedule()})},mounted(){this._onScroll=()=>this.schedule(),this._onResize=()=>this.schedule(),document.addEventListener(`scroll`,this._onScroll,{passive:!0,capture:!0}),window.addEventListener(`resize`,this._onResize),this.bindTarget(),this.schedule()},beforeUnmount(){document.removeEventListener(`scroll`,this._onScroll,{capture:!0}),window.removeEventListener(`resize`,this._onResize),this._stopWatch&&=(this._stopWatch(),null),this._ro&&=(this._ro.disconnect(),null),this._raf&&cancelAnimationFrame(this._raf)},methods:{bindTarget(){this._ro&&=(this._ro.disconnect(),null);let e=wS.el;!e||typeof ResizeObserver>`u`||(this._ro=new ResizeObserver(()=>this.schedule()),this._ro.observe(e))},schedule(){this._raf||=requestAnimationFrame(()=>{this._raf=0,this.recompute()})},recompute(){let e=wS.el;if(!e||!wS.visible)return;let t=e.closest(`.phone__screen`);if(!t){wS.visible=!1;return}let n=t.getBoundingClientRect(),r=e.getBoundingClientRect(),i=r.left-n.left+t.scrollLeft,a=r.top-n.top+t.scrollTop,o=r.width,s=r.height;this.box={left:i,top:a,right:i+o,bottom:a+s},this.containerStyle={width:t.clientWidth+`px`,height:t.scrollHeight+`px`}}}};function OS(e,t,n,r,i,a){return I((B(),V(`div`,{class:`ce-guides`,style:k(i.containerStyle)},[K(` 左 / 右竖线:贯穿画布全高 `),U(`div`,{class:`ce-guide ce-guide--v`,style:k({left:i.box.left+`px`})},null,4),U(`div`,{class:`ce-guide ce-guide--v`,style:k({left:i.box.right+`px`})},null,4),K(` 上 / 下横线:贯穿画布全宽 `),U(`div`,{class:`ce-guide ce-guide--h`,style:k({top:i.box.top+`px`})},null,4),U(`div`,{class:`ce-guide ce-guide--h`,style:k({top:i.box.bottom+`px`})},null,4)],4)),[[Sc,r.hoverGuide.visible]])}var kS=X(DS,[[`render`,OS],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/HoverGuides.vue`]]),AS=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),jS=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),MS=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),NS=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),PS=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),FS=o((e=>{var t=jS().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),IS=o((e=>{var t=jS().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),LS=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),RS=o((e=>{var t=MS(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),zS=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),BS=o((e=>{var t=zS();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),VS=o(((e,t)=>{var n=BS();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),HS=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),US=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
221
+ ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),WS=o((e=>{var t=HS(),n=US();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),GS=o((e=>{var t=jS(),n=RS(),r=MS(),i=WS(),a=HS(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),KS=o((e=>{var t=jS(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),qS=o(((e,t)=>{var n=WS();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),JS=o(((e,t)=>{var n=WS(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),YS=o(((e,t)=>{var n=WS();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),XS=o(((e,t)=>{var n=WS(),r=jS();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t;for(t=0;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
222
+ Make sure your charset is UTF-8`);n=(n>>>8&255)*192+(n&255),e.put(n,13)}},t.exports=i})),ZS=o(((e,t)=>{var n={single_source_shortest_paths:function(e,t,r){var i={},a={};a[t]=0;var o=n.PriorityQueue.make();o.push(t,0);for(var s,c,l,u,d,f,p,m,h;!o.empty();)for(l in s=o.pop(),c=s.value,u=s.cost,d=e[c]||{},d)d.hasOwnProperty(l)&&(f=d[l],p=u+f,m=a[l],h=a[l]===void 0,(h||m>p)&&(a[l]=p,o.push(l,p),i[l]=c));if(r!==void 0&&a[r]===void 0){var g=[`Could not find a path from `,t,` to `,r,`.`].join(``);throw Error(g)}return i},extract_shortest_path_from_predecessor_list:function(e,t){for(var n=[],r=t;r;)n.push(r),e[r],r=e[r];return n.reverse(),n},find_path:function(e,t,r){var i=n.single_source_shortest_paths(e,t,r);return n.extract_shortest_path_from_predecessor_list(i,r)},PriorityQueue:{make:function(e){var t=n.PriorityQueue,r={},i;for(i in e||={},t)t.hasOwnProperty(i)&&(r[i]=t[i]);return r.queue=[],r.sorter=e.sorter||t.default_sorter,r},default_sorter:function(e,t){return e.cost-t.cost},push:function(e,t){var n={value:e,cost:t};this.queue.push(n),this.queue.sort(this.sorter)},pop:function(){return this.queue.shift()},empty:function(){return this.queue.length===0}}};t!==void 0&&(t.exports=n)})),QS=o((e=>{var t=WS(),n=qS(),r=JS(),i=YS(),a=XS(),o=US(),s=jS(),c=ZS();function l(e){return unescape(encodeURIComponent(e)).length}function u(e,t,n){let r=[],i;for(;(i=e.exec(n))!==null;)r.push({data:i[0],index:i.index,mode:t,length:i[0].length});return r}function d(e){let n=u(o.NUMERIC,t.NUMERIC,e),r=u(o.ALPHANUMERIC,t.ALPHANUMERIC,e),i,a;return s.isKanjiModeEnabled()?(i=u(o.BYTE,t.BYTE,e),a=u(o.KANJI,t.KANJI,e)):(i=u(o.BYTE_KANJI,t.BYTE,e),a=[]),n.concat(r,i,a).sort(function(e,t){return e.index-t.index}).map(function(e){return{data:e.data,mode:e.mode,length:e.length}})}function f(e,o){switch(o){case t.NUMERIC:return n.getBitsLength(e);case t.ALPHANUMERIC:return r.getBitsLength(e);case t.KANJI:return a.getBitsLength(e);case t.BYTE:return i.getBitsLength(e)}}function p(e){return e.reduce(function(e,t){let n=e.length-1>=0?e[e.length-1]:null;return n&&n.mode===t.mode?(e[e.length-1].data+=t.data,e):(e.push(t),e)},[])}function m(e){let n=[];for(let r=0;r<e.length;r++){let i=e[r];switch(i.mode){case t.NUMERIC:n.push([i,{data:i.data,mode:t.ALPHANUMERIC,length:i.length},{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.ALPHANUMERIC:n.push([i,{data:i.data,mode:t.BYTE,length:i.length}]);break;case t.KANJI:n.push([i,{data:i.data,mode:t.BYTE,length:l(i.data)}]);break;case t.BYTE:n.push([{data:i.data,mode:t.BYTE,length:l(i.data)}])}}return n}function h(e,n){let r={},i={start:{}},a=[`start`];for(let o=0;o<e.length;o++){let s=e[o],c=[];for(let e=0;e<s.length;e++){let l=s[e],u=``+o+e;c.push(u),r[u]={node:l,lastCount:0},i[u]={};for(let e=0;e<a.length;e++){let o=a[e];r[o]&&r[o].node.mode===l.mode?(i[o][u]=f(r[o].lastCount+l.length,l.mode)-f(r[o].lastCount,l.mode),r[o].lastCount+=l.length):(r[o]&&(r[o].lastCount=l.length),i[o][u]=f(l.length,l.mode)+4+t.getCharCountIndicator(l.mode,n))}}a=c}for(let e=0;e<a.length;e++)i[a[e]].end=0;return{map:i,table:r}}function g(e,o){let c,l=t.getBestModeForData(e);if(c=t.from(o,l),c!==t.BYTE&&c.bit<l.bit)throw Error(`"`+e+`" cannot be encoded with mode `+t.toString(c)+`.
223
+ Suggested mode is: `+t.toString(l));switch(c===t.KANJI&&!s.isKanjiModeEnabled()&&(c=t.BYTE),c){case t.NUMERIC:return new n(e);case t.ALPHANUMERIC:return new r(e);case t.KANJI:return new a(e);case t.BYTE:return new i(e)}}e.fromArray=function(e){return e.reduce(function(e,t){return typeof t==`string`?e.push(g(t,null)):t.data&&e.push(g(t.data,t.mode)),e},[])},e.fromString=function(t,n){let r=h(m(d(t,s.isKanjiModeEnabled())),n),i=c.find_path(r.map,`start`,`end`),a=[];for(let e=1;e<i.length-1;e++)a.push(r.table[i[e]].node);return e.fromArray(p(a))},e.rawSplit=function(t){return e.fromArray(d(t,s.isKanjiModeEnabled()))}})),$S=o((e=>{var t=jS(),n=MS(),r=NS(),i=PS(),a=FS(),o=IS(),s=LS(),c=RS(),l=VS(),u=GS(),d=KS(),f=WS(),p=QS();function m(e,t){let n=e.size,r=o.getPositions(t);for(let t=0;t<r.length;t++){let i=r[t][0],a=r[t][1];for(let t=-1;t<=7;t++)if(!(i+t<=-1||n<=i+t))for(let r=-1;r<=7;r++)a+r<=-1||n<=a+r||(t>=0&&t<=6&&(r===0||r===6)||r>=0&&r<=6&&(t===0||t===6)||t>=2&&t<=4&&r>=2&&r<=4?e.set(i+t,a+r,!0,!0):e.set(i+t,a+r,!1,!0))}}function h(e){let t=e.size;for(let n=8;n<t-8;n++){let t=n%2==0;e.set(n,6,t,!0),e.set(6,n,t,!0)}}function g(e,t){let n=a.getPositions(t);for(let t=0;t<n.length;t++){let r=n[t][0],i=n[t][1];for(let t=-2;t<=2;t++)for(let n=-2;n<=2;n++)t===-2||t===2||n===-2||n===2||t===0&&n===0?e.set(r+t,i+n,!0,!0):e.set(r+t,i+n,!1,!0)}}function _(e,t){let n=e.size,r=u.getEncodedBits(t),i,a,o;for(let t=0;t<18;t++)i=Math.floor(t/3),a=t%3+n-8-3,o=(r>>t&1)==1,e.set(i,a,o,!0),e.set(a,i,o,!0)}function v(e,t,n){let r=e.size,i=d.getEncodedBits(t,n),a,o;for(a=0;a<15;a++)o=(i>>a&1)==1,a<6?e.set(a,8,o,!0):a<8?e.set(a+1,8,o,!0):e.set(r-15+a,8,o,!0),a<8?e.set(8,r-a-1,o,!0):a<9?e.set(8,15-a-1+1,o,!0):e.set(8,15-a-1,o,!0);e.set(r-8,8,1,!0)}function y(e,t){let n=e.size,r=-1,i=n-1,a=7,o=0;for(let s=n-1;s>0;s-=2)for(s===6&&s--;;){for(let n=0;n<2;n++)if(!e.isReserved(i,s-n)){let r=!1;o<t.length&&(r=(t[o]>>>a&1)==1),e.set(i,s-n,r),a--,a===-1&&(o++,a=7)}if(i+=r,i<0||n<=i){i-=r,r=-r;break}}}function b(e,n,i){let a=new r;i.forEach(function(t){a.put(t.mode.bit,4),a.put(t.getLength(),f.getCharCountIndicator(t.mode,e)),t.write(a)});let o=(t.getSymbolTotalCodewords(e)-c.getTotalCodewordsCount(e,n))*8;for(a.getLengthInBits()+4<=o&&a.put(0,4);a.getLengthInBits()%8!=0;)a.putBit(0);let s=(o-a.getLengthInBits())/8;for(let e=0;e<s;e++)a.put(e%2?17:236,8);return x(a,e,n)}function x(e,n,r){let i=t.getSymbolTotalCodewords(n),a=i-c.getTotalCodewordsCount(n,r),o=c.getBlocksCount(n,r),s=o-i%o,u=Math.floor(i/o),d=Math.floor(a/o),f=d+1,p=u-d,m=new l(p),h=0,g=Array(o),_=Array(o),v=0,y=new Uint8Array(e.buffer);for(let e=0;e<o;e++){let t=e<s?d:f;g[e]=y.slice(h,h+t),_[e]=m.encode(g[e]),h+=t,v=Math.max(v,t)}let b=new Uint8Array(i),x=0,S,C;for(S=0;S<v;S++)for(C=0;C<o;C++)S<g[C].length&&(b[x++]=g[C][S]);for(S=0;S<p;S++)for(C=0;C<o;C++)b[x++]=_[C][S];return b}function S(e,n,r,a){let o;if(Array.isArray(e))o=p.fromArray(e);else if(typeof e==`string`){let t=n;if(!t){let n=p.rawSplit(e);t=u.getBestVersionForData(n,r)}o=p.fromString(e,t||40)}else throw Error(`Invalid data`);let c=u.getBestVersionForData(o,r);if(!c)throw Error(`The amount of data is too big to be stored in a QR Code`);if(!n)n=c;else if(n<c)throw Error(`
222
224
  The chosen QR Code version cannot contain this amount of data.
223
225
  Minimum version required to store current data is: `+c+`.
224
- `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),GS=o((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),KS=o((e=>{var t=GS();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),qS=o((e=>{var t=GS();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
225
- `;return typeof a==`function`&&a(null,p),p}})),JS=c(o((e=>{var t=xS(),n=WS(),r=KS(),i=qS();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))()),YS={name:`RemotePreview`,props:{visible:{type:Boolean,default:!1},pageId:{type:[String,Number],default:``},schema:{type:Object,default:null},cardCode:{type:String,default:``}},data(){return{qrDataUrl:``,url:``,loading:!1,publishing:!1,copied:!1,copyTimer:null,warn:``,code:``}},watch:{visible(e){e&&this.open()},pageId(){this.visible&&this.open()}},beforeUnmount(){this.copyTimer&&clearTimeout(this.copyTimer)},methods:{buildSocket(e){return`${`https://uat-pkg.finmall.com`.replace(/^https?:/,`wss:`)}/pmb-web/websocket/card/${e}`},fullUrl(e,t){let n=this.buildSocket(e);return`app://previewCard?cardId=${encodeURIComponent(e)}&cardCode=${encodeURIComponent(t||``)}&cardVersion=00000000&socket=${encodeURIComponent(n)}`},async makeQr(e){return JS.toDataURL(e,{width:220,margin:1,errorCorrectionLevel:`H`,color:{dark:`#10131a`,light:`#ffffff`}})},async open(){this.qrDataUrl=``,this.url=``,this.loading=!0,this.publishing=!1,this.copied=!1,this.warn=``,this.code=this.cardCode||``;let e=String(this.pageId||``).trim();if(!e){this.warn=`当前卡片缺少 pageId(远端卡片 id),无法生成预览二维码`,this.loading=!1;return}this.url=`app://previewCard?cardId=${encodeURIComponent(e)}`;try{this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`二维码生成失败:`+(e&&e.message)}this.publishing=!0;try{let t=await J(`/__preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({schema:this.schema||{pageId:e}})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.message||`preview failed`);n.cardCode!==void 0&&(this.code=n.cardCode),this.url=this.fullUrl(e,this.code),this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`远端发布失败:`+(e&&e.message)}finally{this.publishing=!1,this.loading=!1}},async copyUrl(){if(this.url)try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(this.url);else{let e=document.createElement(`textarea`);e.value=this.url,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}this.copied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.copied=!1},1500)}catch(e){this.warn=`复制失败:`+(e&&e.message)}}}},XS={class:`rp-card modal-card`,role:`dialog`,"aria-label":`远端预览二维码`},ZS={class:`rp-head`},QS={class:`rp-body`},$S={class:`rp-qr-wrap`},eC=[`src`],tC={key:1,class:`rp-qr rp-qr--loading`},nC={key:2,class:`rp-qr-loading`},rC={class:`rp-url`},iC={class:`rp-url-text`},aC=[`disabled`],oC={key:0,class:`rp-warn`};function sC(e,t,n,r,i,a){return B(),H(ic,{name:`modal`},{default:F(()=>[n.visible?(B(),V(`div`,{key:0,class:`rp-mask`,onClick:t[2]||=q(t=>e.$emit(`close`),[`self`])},[U(`div`,XS,[U(`div`,ZS,[t[3]||=U(`span`,{class:`rp-title`},`远端预览(真机扫码)`,-1),U(`button`,{class:`rp-x`,type:`button`,onClick:t[0]||=t=>e.$emit(`close`),"aria-label":`关闭`},`×`)]),U(`div`,QS,[U(`div`,$S,[i.qrDataUrl?(B(),V(`img`,{key:0,src:i.qrDataUrl,class:A([`rp-qr`,{"rp-qr--blurred":i.publishing}]),alt:`preview qr`},null,10,eC)):(B(),V(`div`,tC,j(i.loading?`准备中…`:`—`),1)),i.publishing?(B(),V(`div`,nC,[...t[4]||=[U(`span`,{class:`rp-spinner`},null,-1),U(`span`,{class:`rp-loading-text`},`正在发布预览…`,-1)]])):K(`v-if`,!0)]),t[5]||=U(`p`,{class:`rp-tip`},`手机(FinMall App)扫一扫,真机查看当前卡片预览`,-1),U(`div`,rC,[U(`code`,iC,j(i.url||`—`),1),U(`button`,{class:`rp-copy`,type:`button`,disabled:!i.url,onClick:t[1]||=(...e)=>a.copyUrl&&a.copyUrl(...e)},j(i.copied?`已复制 ✓`:`复制链接`),9,aC)]),i.warn?(B(),V(`p`,oC,j(i.warn),1)):K(`v-if`,!0)])])])):K(`v-if`,!0)]),_:1})}var cC=X(YS,[[`render`,sC],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/RemotePreview.vue`]]),lC={name:`AppToast`,computed:{toast(){return sp}}},uC={class:`apptoast__icon`},dC={class:`apptoast__icon-svg`,viewBox:`0 0 24 24`,"aria-hidden":`true`},fC=[`href`],pC={class:`apptoast__msg`};function mC(e,t,n,r,i,a){return B(),H(ic,{name:`apptoast-fade`},{default:F(()=>[a.toast.visible?(B(),V(`div`,{key:0,class:A([`apptoast`,`apptoast--`+a.toast.type]),role:`status`,"aria-live":`polite`},[U(`span`,uC,[(B(),V(`svg`,dC,[U(`use`,{href:a.toast.type===`ok`?`#icon-check-plain`:`#icon-x`},null,8,fC)]))]),U(`span`,pC,j(a.toast.message),1)],2)):K(`v-if`,!0)]),_:1})}var hC=X(lC,[[`render`,mC],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AppToast.vue`]]),gC=rn({open:!1,index:0,items:[]});function _C(e,t=0){let n=Array.isArray(e)?e.filter(e=>e&&e.src):[];n.length&&(gC.items=n,gC.index=Math.max(0,Math.min(n.length-1,t|0)),gC.open=!0)}function vC(e){if(!gC.open)return;let t=gC.index+e;t<0||t>=gC.items.length||(gC.index=t)}function yC(){gC.open=!1}var bC=1.25,xC=.05,SC=16,CC={name:`ImageLightbox`,data(){return{STEP:bC,scale:1,tx:0,ty:0,natW:0,natH:0,loaded:!1,failed:!1,dragging:!1,fitScale:1,_pan:null,_prevFocus:null}},computed:{box(){return gC},current(){return this.box.items[this.box.index]||{src:``,alt:``,title:``}},displayName(){return(this.current.alt||this.current.title||``).split(/[\\/]/).pop()||`图片`},zoomLabel(){return`${Math.round(this.scale*100)}%`},atFit(){return Math.abs(this.scale-this.fitScale)<.001&&this.tx===0&&this.ty===0},imgStyle(){let e={transform:`translate(${this.tx}px, ${this.ty}px) scale(${this.scale})`};return this.natW&&this.natH&&(e.width=`${this.natW}px`,e.height=`${this.natH}px`),e}},watch:{"box.open"(e){e?(this._prevFocus=document.activeElement,this.resetView(),this.$nextTick(()=>this.$refs.rootEl?.focus())):this._prevFocus&&this._prevFocus.focus&&(this._prevFocus.focus(),this._prevFocus=null)},"box.index"(){this.resetView()}},mounted(){window.addEventListener(`resize`,this.onResize)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),this.stopPan()},methods:{resetView(){this.scale=1,this.fitScale=1,this.tx=0,this.ty=0,this.natW=0,this.natH=0,this.loaded=!1,this.failed=!1},onLoaded(e){let t=e.target;this.natW=t.naturalWidth||0,this.natH=t.naturalHeight||0,this.loaded=!0,this.fit()},fit(){let e=this.$refs.stageEl;if(!e||!this.natW||!this.natH)return;let t=Math.max(80,e.clientWidth-96),n=Math.max(80,e.clientHeight-96);this.fitScale=Math.min(t/this.natW,n/this.natH),this.scale=this.fitScale,this.tx=0,this.ty=0},toggleFit(){this.atFit?(this.scale=1,this.tx=0,this.ty=0):this.fit()},clampScale(e){return Math.max(xC,Math.min(SC,e))},zoomAt(e,t,n){let r=this.$refs.stageEl;if(!r)return;let i=this.clampScale(n),a=r.getBoundingClientRect(),o=e-a.left-a.width/2,s=t-a.top-a.height/2,c=i/this.scale;this.tx=o-(o-this.tx)*c,this.ty=s-(s-this.ty)*c,this.scale=i},zoomBy(e){let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect();this.zoomAt(n.left+n.width/2,n.top+n.height/2,this.scale*e)},onWheel(e){e.preventDefault();let t=Math.exp(-e.deltaY*(e.ctrlKey?.01:.0022));this.zoomAt(e.clientX,e.clientY,this.scale*t)},onPanStart(e){e.button!==0||this.failed||(e.preventDefault(),this.dragging=!0,this._pan={x:e.clientX,y:e.clientY,tx:this.tx,ty:this.ty,id:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,this.onPanMove),window.addEventListener(`pointerup`,this.onPanEnd))},onPanMove(e){this._pan&&(this.tx=this._pan.tx+(e.clientX-this._pan.x),this.ty=this._pan.ty+(e.clientY-this._pan.y))},onPanEnd(){this.stopPan()},stopPan(){this.dragging=!1,this._pan=null,window.removeEventListener(`pointermove`,this.onPanMove),window.removeEventListener(`pointerup`,this.onPanEnd)},onResize(){this.box.open&&this.atFit&&this.fit()},onKey(e){let t=e.key;if(t===`Escape`){e.preventDefault(),this.close();return}if(t===`ArrowLeft`){e.preventDefault(),this.step(-1);return}if(t===`ArrowRight`){e.preventDefault(),this.step(1);return}if(t===`+`||t===`=`){e.preventDefault(),this.zoomBy(bC);return}if(t===`-`||t===`_`){e.preventDefault(),this.zoomBy(1/bC);return}if(t===`0`){e.preventDefault(),this.fit();return}t===`1`&&(e.preventDefault(),this.scale=1,this.tx=0,this.ty=0)},step(e){vC(e)},close(){yC()},openRaw(){this.current.src&&window.open(this.current.src,`_blank`,`noopener`)},async copyPath(){let e=await op(this.current.title||this.current.src);Z(e?`已复制图片路径`:`复制失败`,e?`ok`:`err`)}}},wC=[`title`],TC={class:`imgbox__name`},EC={key:0,class:`imgbox__count`},DC={key:1,class:`imgbox__dims`},OC={class:`imgbox__acts`},kC=[`title`],AC={key:0,class:`imgbox__fail`},jC=[`title`],MC=[`src`,`alt`],NC={key:2,class:`imgbox__spin`,"aria-hidden":`true`};function PC(e,t,n,r,i,a){return B(),H(ai,{to:`body`},[W(ic,{name:`imgbox-fade`},{default:F(()=>[a.box.open?(B(),V(`div`,{key:0,ref:`rootEl`,class:`imgbox`,role:`dialog`,"aria-modal":`true`,"aria-label":`图片预览`,tabindex:`-1`,onKeydown:t[16]||=(...e)=>a.onKey&&a.onKey(...e),onClick:t[17]||=q((...e)=>a.close&&a.close(...e),[`self`])},[K(` 顶栏:左=图名与序号 / 右=工具 `),U(`header`,{class:`imgbox__bar`,onClick:t[7]||=q(()=>{},[`stop`])},[U(`span`,{class:`imgbox__meta`,title:a.current.title||a.current.alt},[U(`span`,TC,j(a.displayName),1),a.box.items.length>1?(B(),V(`span`,EC,j(a.box.index+1)+` / `+j(a.box.items.length),1)):K(`v-if`,!0),i.natW?(B(),V(`span`,DC,j(i.natW)+`×`+j(i.natH),1)):K(`v-if`,!0)],8,wC),U(`span`,OC,[U(`button`,{type:`button`,class:`imgbox__btn`,title:`缩小(-)`,onClick:t[0]||=e=>a.zoomBy(1/i.STEP)},[...t[18]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-zoom-out`})],-1)]]),U(`button`,{type:`button`,class:`imgbox__zoom`,title:a.atFit?`当前为适应窗口,点击恢复 1:1`:`点击恢复适应窗口`,onClick:t[1]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},j(a.zoomLabel),9,kC),U(`button`,{type:`button`,class:`imgbox__btn`,title:`放大(+)`,onClick:t[2]||=e=>a.zoomBy(i.STEP)},[...t[19]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-zoom-in`})],-1)]]),t[24]||=U(`span`,{class:`imgbox__sep`},null,-1),U(`button`,{type:`button`,class:A([`imgbox__btn`,{"is-on":a.atFit}]),title:`适应窗口(0)`,onClick:t[3]||=(...e)=>a.fit&&a.fit(...e)},[...t[20]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-maximize`})],-1)]],2),U(`button`,{type:`button`,class:`imgbox__btn`,title:`复制图片路径`,onClick:t[4]||=(...e)=>a.copyPath&&a.copyPath(...e)},[...t[21]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-copy-sm`})],-1)]]),U(`button`,{type:`button`,class:`imgbox__btn`,title:`在新标签打开原图`,onClick:t[5]||=(...e)=>a.openRaw&&a.openRaw(...e)},[...t[22]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-external`})],-1)]]),t[25]||=U(`span`,{class:`imgbox__sep`},null,-1),U(`button`,{type:`button`,class:`imgbox__btn`,title:`关闭(Esc)`,onClick:t[6]||=(...e)=>a.close&&a.close(...e)},[...t[23]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])])]),K(` 画布:图片居中,transform 承担缩放与平移 `),U(`div`,{ref:`stageEl`,class:`imgbox__stage`,onWheel:t[10]||=(...e)=>a.onWheel&&a.onWheel(...e),onPointerdown:t[11]||=(...e)=>a.onPanStart&&a.onPanStart(...e),onDblclick:t[12]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},[i.failed?(B(),V(`div`,AC,[t[26]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),t[27]||=U(`span`,null,`图片加载失败`,-1),U(`code`,{title:a.current.src},j(a.displayName),9,jC)])):(B(),V(`img`,{key:a.current.src,class:A([`imgbox__img`,{"is-dragging":i.dragging,"is-loading":!i.loaded}]),src:a.current.src,alt:a.current.alt||`预览图`,draggable:`false`,style:k(a.imgStyle),onLoad:t[8]||=(...e)=>a.onLoaded&&a.onLoaded(...e),onError:t[9]||=e=>i.failed=!0},null,46,MC)),!i.loaded&&!i.failed?(B(),V(`div`,NC,[...t[28]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-loading`})],-1)]])):K(`v-if`,!0)],544),K(` 多张时的左右翻页 `),a.box.index>0?(B(),V(`button`,{key:0,type:`button`,class:`imgbox__nav imgbox__nav--prev`,title:`上一张(←)`,onClick:t[13]||=q(e=>a.step(-1),[`stop`])},[...t[29]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1)]])):K(`v-if`,!0),a.box.index<a.box.items.length-1?(B(),V(`button`,{key:1,type:`button`,class:`imgbox__nav imgbox__nav--next`,title:`下一张(→)`,onClick:t[14]||=q(e=>a.step(1),[`stop`])},[...t[30]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1)]])):K(`v-if`,!0),U(`footer`,{class:`imgbox__hint`,onClick:t[15]||=q(()=>{},[`stop`])},`滚轮缩放 · 拖拽平移 · 双击切换 1:1 · ←/→ 翻页 · Esc 关闭`)],544)):K(`v-if`,!0)]),_:1})])}var FC=X(CC,[[`render`,PC],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ImageLightbox.vue`]]),IC={name:`CardGallery`,components:{ConfirmDialog:_p},props:{visible:{type:Boolean,default:!1},cards:{type:Array,default:()=>[]},selectedId:{type:String,default:``}},emits:[`select`,`close`,`delete`],data(){return{query:``,sortByTime:this.loadSortByTime(),visibleIds:new Set,failed:new Set,observer:null,base:``,pendingDelete:null,placeholderUrl:gd}},created(){this.saveSortByTime()},computed:{filtered(){let e=this.query.trim().toLowerCase(),t=this.cards;return e&&(t=t.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))}},watch:{visible(e){e?(this.query=``,this.failed=new Set,this.$nextTick(()=>{this.setupObserver(),this.focusSearch()}),window.addEventListener(`keydown`,this.onKey)):(this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey))},query(){this.visible&&this.$nextTick(this.setupObserver)},sortByTime(e){this.saveSortByTime()}},beforeUnmount(){this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey)},methods:{askDelete(e){this.pendingDelete=e},confirmDelete(){let e=this.pendingDelete;this.pendingDelete=null,e&&(this.visibleIds.delete(e.id),this.failed.delete(e.id),this.$emit(`delete`,e.id))},thumbUrl(e){return(this.base||Fl()||``)+`/__card-image/`+encodeURIComponent(e)},setupObserver(){this.base=Fl()||``;let e=this.$refs.grid;e&&(this.teardownObserver(),this.observer=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target.getAttribute(`data-id`);if(e&&!this.visibleIds.has(e)){let t=new Set(this.visibleIds);t.add(e),this.visibleIds=t}this.observer.unobserve(t.target)}},{root:e,rootMargin:`200px`}),e.querySelectorAll(`.cg-tile`).forEach(e=>this.observer.observe(e)))},teardownObserver(){this.observer&&=(this.observer.disconnect(),null)},onImgError(e){let t=new Set(this.failed);t.add(e),this.failed=t},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardgallery-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardgallery-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},toggleSort(){this.sortByTime=!this.sortByTime},onKey(e){e.key===`Escape`&&this.close()},focusSearch(){this.$refs.search&&this.$refs.search.focus()},choose(e){e&&(this.$emit(`select`,e.id),this.close())},close(){this.$emit(`close`)}}},LC={class:`cg-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`卡片网格预览`},RC={class:`cg-modal__head`},zC={class:`cg-modal__title`},BC={class:`cg-modal__count`},VC={class:`cg-modal__search`},HC=[`title`,`aria-pressed`],UC={ref:`grid`,class:`cg-grid`},WC=[`data-id`,`onClick`],GC={class:`cg-tile__thumb`},KC={key:0,class:`cg-tile__tag`,title:`导入卡片(含 .import-meta.json 来源信息)`},qC=[`src`,`alt`,`onError`],JC={key:2,class:`cg-tile__skeleton`},YC=[`src`,`alt`],XC={class:`cg-tile__meta`},ZC=[`title`],QC=[`title`],$C=[`title`,`aria-label`,`onClick`,`onKeydown`],ew={key:0,class:`cg-empty`};function tw(e,t,n,r,i,a){let o=L(`ConfirmDialog`);return B(),H(ic,{name:`modal`},{default:F(()=>[n.visible?(B(),V(`div`,{key:0,class:`cg-mask`,onClick:t[4]||=q((...e)=>a.close&&a.close(...e),[`self`])},[U(`div`,LC,[U(`header`,RC,[U(`div`,zC,[t[5]||=U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-grid`})],-1),t[6]||=U(`span`,null,`卡片网格预览`,-1),U(`span`,BC,j(n.cards.length)+` 张本地卡片`,1)]),U(`div`,VC,[t[7]||=U(`svg`,{class:`cg-modal__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[U(`use`,{href:`#icon-search`})],-1),I(U(`input`,{ref:`search`,"onUpdate:modelValue":t[0]||=e=>i.query=e,class:`cg-modal__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`},null,512),[[il,i.query]])]),U(`button`,{class:A([`cg-modal__sort`,{"cg-modal__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[1]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,HC),U(`button`,{class:`cg-modal__close`,type:`button`,title:`关闭`,onClick:t[2]||=(...e)=>a.close&&a.close(...e),"aria-label":`关闭`},[...t[8]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,UC,[(B(!0),V(z,null,R(a.filtered,e=>(B(),V(`button`,{key:e.id,"data-id":e.id,type:`button`,class:A([`cg-tile`,{"cg-tile--active":e.id===n.selectedId,"cg-tile--failed":i.failed.has(e.id)}]),onClick:t=>a.choose(e)},[U(`div`,GC,[K(` 导入标记:仅含 .import-meta.json 侧车的卡(经远端同步导入)显示,悬浮于缩略图右上角 `),e.imported?(B(),V(`span`,KC,`导入`)):K(`v-if`,!0),i.visibleIds.has(e.id)&&!i.failed.has(e.id)?(B(),V(`img`,{key:1,class:`cg-tile__img`,src:a.thumbUrl(e.id),alt:e.name,loading:`lazy`,onError:t=>a.onImgError(e.id)},null,40,qC)):i.visibleIds.has(e.id)?(B(),V(z,{key:3},[K(` 无封面(空白新卡无位图、且空白卡跳过无头截图直接 404):
226
- 回退工程统一占位图(与 Image 组件兜底图同源),浅色底与缩略图区调性一致 `),U(`img`,{class:`cg-tile__img cg-tile__img--placeholder`,src:i.placeholderUrl,alt:`暂无封面:${e.name}`},null,8,YC)],2112)):(B(),V(`div`,JC,`预览加载中…`))]),U(`div`,XC,[U(`span`,{class:`cg-tile__name`,title:e.name},j(e.name),9,ZC),U(`span`,{class:`cg-tile__id`,title:e.id},j(e.id),9,QC)]),K(` 删除钮:仅图标不带文字,悬浮于格子右下角。格子本身是 button,
226
+ `);let l=b(n,r,o),d=new i(t.getSymbolSize(n));return m(d,n),h(d),g(d,n),v(d,r,0),n>=7&&_(d,n),y(d,l),isNaN(a)&&(a=s.getBestMask(d,v.bind(null,d,r))),s.applyMask(a,d),v(d,r,a),{modules:d,version:n,errorCorrectionLevel:r,maskPattern:a,segments:o}}e.create=function(e,r){if(e===void 0||e===``)throw Error(`No input text`);let i=n.M,a,o;return r!==void 0&&(i=n.from(r.errorCorrectionLevel,n.M),a=u.from(r.version),o=s.from(r.maskPattern),r.toSJISFunc&&t.setToSJISFunction(r.toSJISFunc)),S(e,a,i,o)}})),eC=o((e=>{function t(e){if(typeof e==`number`&&(e=e.toString()),typeof e!=`string`)throw Error(`Color should be defined as hex string`);let t=e.slice().replace(`#`,``).split(``);if(t.length<3||t.length===5||t.length>8)throw Error(`Invalid hex color: `+e);(t.length===3||t.length===4)&&(t=Array.prototype.concat.apply([],t.map(function(e){return[e,e]}))),t.length===6&&t.push(`F`,`F`);let n=parseInt(t.join(``),16);return{r:n>>24&255,g:n>>16&255,b:n>>8&255,a:n&255,hex:`#`+t.slice(0,6).join(``)}}e.getOptions=function(e){e||={},e.color||(e.color={});let n=e.margin===void 0||e.margin===null||e.margin<0?4:e.margin,r=e.width&&e.width>=21?e.width:void 0,i=e.scale||4;return{width:r,scale:r?4:i,margin:n,color:{dark:t(e.color.dark||`#000000ff`),light:t(e.color.light||`#ffffffff`)},type:e.type,rendererOpts:e.rendererOpts||{}}},e.getScale=function(e,t){return t.width&&t.width>=e+t.margin*2?t.width/(e+t.margin*2):t.scale},e.getImageWidth=function(t,n){let r=e.getScale(t,n);return Math.floor((t+n.margin*2)*r)},e.qrToImageData=function(t,n,r){let i=n.modules.size,a=n.modules.data,o=e.getScale(i,r),s=Math.floor((i+r.margin*2)*o),c=r.margin*o,l=[r.color.light,r.color.dark];for(let e=0;e<s;e++)for(let n=0;n<s;n++){let u=(e*s+n)*4,d=r.color.light;if(e>=c&&n>=c&&e<s-c&&n<s-c){let t=Math.floor((e-c)/o),r=Math.floor((n-c)/o);d=l[+!!a[t*i+r]]}t[u++]=d.r,t[u++]=d.g,t[u++]=d.b,t[u]=d.a}}})),tC=o((e=>{var t=eC();function n(e,t,n){e.clearRect(0,0,t.width,t.height),t.style||={},t.height=n,t.width=n,t.style.height=n+`px`,t.style.width=n+`px`}function r(){try{return document.createElement(`canvas`)}catch{throw Error(`You need to specify a canvas element`)}}e.render=function(e,i,a){let o=a,s=i;o===void 0&&(!i||!i.getContext)&&(o=i,i=void 0),i||(s=r()),o=t.getOptions(o);let c=t.getImageWidth(e.modules.size,o),l=s.getContext(`2d`),u=l.createImageData(c,c);return t.qrToImageData(u.data,e,o),n(l,s,c),l.putImageData(u,0,0),s},e.renderToDataURL=function(t,n,r){let i=r;i===void 0&&(!n||!n.getContext)&&(i=n,n=void 0),i||={};let a=e.render(t,n,i),o=i.type||`image/png`,s=i.rendererOpts||{};return a.toDataURL(o,s.quality)}})),nC=o((e=>{var t=eC();function n(e,t){let n=e.a/255,r=t+`="`+e.hex+`"`;return n<1?r+` `+t+`-opacity="`+n.toFixed(2).slice(1)+`"`:r}function r(e,t,n){let r=e+t;return n!==void 0&&(r+=` `+n),r}function i(e,t,n){let i=``,a=0,o=!1,s=0;for(let c=0;c<e.length;c++){let l=Math.floor(c%t),u=Math.floor(c/t);!l&&!o&&(o=!0),e[c]?(s++,c>0&&l>0&&e[c-1]||(i+=o?r(`M`,l+n,.5+u+n):r(`m`,a,0),a=0,o=!1),l+1<t&&e[c+1]||(i+=r(`h`,s),s=0)):a++}return i}e.render=function(e,r,a){let o=t.getOptions(r),s=e.modules.size,c=e.modules.data,l=s+o.margin*2,u=o.color.light.a?`<path `+n(o.color.light,`fill`)+` d="M0 0h`+l+`v`+l+`H0z"/>`:``,d=`<path `+n(o.color.dark,`stroke`)+` d="`+i(c,s,o.margin)+`"/>`,f=`viewBox="0 0 `+l+` `+l+`"`,p=`<svg xmlns="http://www.w3.org/2000/svg" `+(o.width?`width="`+o.width+`" height="`+o.width+`" `:``)+f+` shape-rendering="crispEdges">`+u+d+`</svg>
227
+ `;return typeof a==`function`&&a(null,p),p}})),rC=c(o((e=>{var t=AS(),n=$S(),r=tC(),i=nC();function a(e,r,i,a,o){let s=[].slice.call(arguments,1),c=s.length,l=typeof s[c-1]==`function`;if(!l&&!t())throw Error(`Callback required as last argument`);if(l){if(c<2)throw Error(`Too few arguments provided`);c===2?(o=i,i=r,r=a=void 0):c===3&&(r.getContext&&o===void 0?(o=a,a=void 0):(o=a,a=i,i=r,r=void 0))}else{if(c<1)throw Error(`Too few arguments provided`);return c===1?(i=r,r=a=void 0):c===2&&!r.getContext&&(a=i,i=r,r=void 0),new Promise(function(t,o){try{t(e(n.create(i,a),r,a))}catch(e){o(e)}})}try{let t=n.create(i,a);o(null,e(t,r,a))}catch(e){o(e)}}e.create=n.create,e.toCanvas=a.bind(null,r.render),e.toDataURL=a.bind(null,r.renderToDataURL),e.toString=a.bind(null,function(e,t,n){return i.render(e,n)})}))()),iC={name:`RemotePreview`,props:{visible:{type:Boolean,default:!1},pageId:{type:[String,Number],default:``},schema:{type:Object,default:null},cardCode:{type:String,default:``}},data(){return{qrDataUrl:``,url:``,loading:!1,publishing:!1,copied:!1,copyTimer:null,warn:``,code:``}},watch:{visible(e){e&&this.open()},pageId(){this.visible&&this.open()}},beforeUnmount(){this.copyTimer&&clearTimeout(this.copyTimer)},methods:{buildSocket(e){return`${`https://uat-pkg.finmall.com`.replace(/^https?:/,`wss:`)}/pmb-web/websocket/card/${e}`},fullUrl(e,t){let n=this.buildSocket(e);return`app://previewCard?cardId=${encodeURIComponent(e)}&cardCode=${encodeURIComponent(t||``)}&cardVersion=00000000&socket=${encodeURIComponent(n)}`},async makeQr(e){return rC.toDataURL(e,{width:220,margin:1,errorCorrectionLevel:`H`,color:{dark:`#10131a`,light:`#ffffff`}})},async open(){this.qrDataUrl=``,this.url=``,this.loading=!0,this.publishing=!1,this.copied=!1,this.warn=``,this.code=this.cardCode||``;let e=String(this.pageId||``).trim();if(!e){this.warn=`当前卡片缺少 pageId(远端卡片 id),无法生成预览二维码`,this.loading=!1;return}this.url=`app://previewCard?cardId=${encodeURIComponent(e)}`;try{this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`二维码生成失败:`+(e&&e.message)}this.publishing=!0;try{let t=await J(`/__preview`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({schema:this.schema||{pageId:e}})}),n=await t.json().catch(()=>({}));if(!t.ok)throw Error(n.message||`preview failed`);n.cardCode!==void 0&&(this.code=n.cardCode),this.url=this.fullUrl(e,this.code),this.qrDataUrl=await this.makeQr(this.url)}catch(e){this.warn=`远端发布失败:`+(e&&e.message)}finally{this.publishing=!1,this.loading=!1}},async copyUrl(){if(this.url)try{if(navigator.clipboard&&navigator.clipboard.writeText)await navigator.clipboard.writeText(this.url);else{let e=document.createElement(`textarea`);e.value=this.url,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select(),document.execCommand(`copy`),document.body.removeChild(e)}this.copied=!0,this.copyTimer&&clearTimeout(this.copyTimer),this.copyTimer=setTimeout(()=>{this.copied=!1},1500)}catch(e){this.warn=`复制失败:`+(e&&e.message)}}}},aC={class:`rp-card modal-card`,role:`dialog`,"aria-label":`远端预览二维码`},oC={class:`rp-head`},sC={class:`rp-body`},cC={class:`rp-qr-wrap`},lC=[`src`],uC={key:1,class:`rp-qr rp-qr--loading`},dC={key:2,class:`rp-qr-loading`},fC={class:`rp-url`},pC={class:`rp-url-text`},mC=[`disabled`],hC={key:0,class:`rp-warn`};function gC(e,t,n,r,i,a){return B(),H(ic,{name:`modal`},{default:F(()=>[n.visible?(B(),V(`div`,{key:0,class:`rp-mask`,onClick:t[2]||=q(t=>e.$emit(`close`),[`self`])},[U(`div`,aC,[U(`div`,oC,[t[3]||=U(`span`,{class:`rp-title`},`远端预览(真机扫码)`,-1),U(`button`,{class:`rp-x`,type:`button`,onClick:t[0]||=t=>e.$emit(`close`),"aria-label":`关闭`},`×`)]),U(`div`,sC,[U(`div`,cC,[i.qrDataUrl?(B(),V(`img`,{key:0,src:i.qrDataUrl,class:A([`rp-qr`,{"rp-qr--blurred":i.publishing}]),alt:`preview qr`},null,10,lC)):(B(),V(`div`,uC,j(i.loading?`准备中…`:`—`),1)),i.publishing?(B(),V(`div`,dC,[...t[4]||=[U(`span`,{class:`rp-spinner`},null,-1),U(`span`,{class:`rp-loading-text`},`正在发布预览…`,-1)]])):K(`v-if`,!0)]),t[5]||=U(`p`,{class:`rp-tip`},`手机(FinMall App)扫一扫,真机查看当前卡片预览`,-1),U(`div`,fC,[U(`code`,pC,j(i.url||`—`),1),U(`button`,{class:`rp-copy`,type:`button`,disabled:!i.url,onClick:t[1]||=(...e)=>a.copyUrl&&a.copyUrl(...e)},j(i.copied?`已复制 ✓`:`复制链接`),9,mC)]),i.warn?(B(),V(`p`,hC,j(i.warn),1)):K(`v-if`,!0)])])])):K(`v-if`,!0)]),_:1})}var _C=X(iC,[[`render`,gC],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/RemotePreview.vue`]]),vC={name:`AppToast`,computed:{toast(){return sp}}},yC={class:`apptoast__icon`},bC={class:`apptoast__icon-svg`,viewBox:`0 0 24 24`,"aria-hidden":`true`},xC=[`href`],SC={class:`apptoast__msg`};function CC(e,t,n,r,i,a){return B(),H(ic,{name:`apptoast-fade`},{default:F(()=>[a.toast.visible?(B(),V(`div`,{key:0,class:A([`apptoast`,`apptoast--`+a.toast.type]),role:`status`,"aria-live":`polite`},[U(`span`,yC,[(B(),V(`svg`,bC,[U(`use`,{href:a.toast.type===`ok`?`#icon-check-plain`:`#icon-x`},null,8,xC)]))]),U(`span`,SC,j(a.toast.message),1)],2)):K(`v-if`,!0)]),_:1})}var wC=X(vC,[[`render`,CC],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AppToast.vue`]]),TC=rn({open:!1,index:0,items:[]});function EC(e,t=0){let n=Array.isArray(e)?e.filter(e=>e&&e.src):[];n.length&&(TC.items=n,TC.index=Math.max(0,Math.min(n.length-1,t|0)),TC.open=!0)}function DC(e){if(!TC.open)return;let t=TC.index+e;t<0||t>=TC.items.length||(TC.index=t)}function OC(){TC.open=!1}var kC=1.25,AC=.05,jC=16,MC={name:`ImageLightbox`,data(){return{STEP:kC,scale:1,tx:0,ty:0,natW:0,natH:0,loaded:!1,failed:!1,dragging:!1,fitScale:1,_pan:null,_prevFocus:null}},computed:{box(){return TC},current(){return this.box.items[this.box.index]||{src:``,alt:``,title:``}},displayName(){return(this.current.alt||this.current.title||``).split(/[\\/]/).pop()||`图片`},zoomLabel(){return`${Math.round(this.scale*100)}%`},atFit(){return Math.abs(this.scale-this.fitScale)<.001&&this.tx===0&&this.ty===0},imgStyle(){let e={transform:`translate(${this.tx}px, ${this.ty}px) scale(${this.scale})`};return this.natW&&this.natH&&(e.width=`${this.natW}px`,e.height=`${this.natH}px`),e}},watch:{"box.open"(e){e?(this._prevFocus=document.activeElement,this.resetView(),this.$nextTick(()=>this.$refs.rootEl?.focus())):this._prevFocus&&this._prevFocus.focus&&(this._prevFocus.focus(),this._prevFocus=null)},"box.index"(){this.resetView()}},mounted(){window.addEventListener(`resize`,this.onResize)},beforeUnmount(){window.removeEventListener(`resize`,this.onResize),this.stopPan()},methods:{resetView(){this.scale=1,this.fitScale=1,this.tx=0,this.ty=0,this.natW=0,this.natH=0,this.loaded=!1,this.failed=!1},onLoaded(e){let t=e.target;this.natW=t.naturalWidth||0,this.natH=t.naturalHeight||0,this.loaded=!0,this.fit()},fit(){let e=this.$refs.stageEl;if(!e||!this.natW||!this.natH)return;let t=Math.max(80,e.clientWidth-96),n=Math.max(80,e.clientHeight-96);this.fitScale=Math.min(t/this.natW,n/this.natH),this.scale=this.fitScale,this.tx=0,this.ty=0},toggleFit(){this.atFit?(this.scale=1,this.tx=0,this.ty=0):this.fit()},clampScale(e){return Math.max(AC,Math.min(jC,e))},zoomAt(e,t,n){let r=this.$refs.stageEl;if(!r)return;let i=this.clampScale(n),a=r.getBoundingClientRect(),o=e-a.left-a.width/2,s=t-a.top-a.height/2,c=i/this.scale;this.tx=o-(o-this.tx)*c,this.ty=s-(s-this.ty)*c,this.scale=i},zoomBy(e){let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect();this.zoomAt(n.left+n.width/2,n.top+n.height/2,this.scale*e)},onWheel(e){e.preventDefault();let t=Math.exp(-e.deltaY*(e.ctrlKey?.01:.0022));this.zoomAt(e.clientX,e.clientY,this.scale*t)},onPanStart(e){e.button!==0||this.failed||(e.preventDefault(),this.dragging=!0,this._pan={x:e.clientX,y:e.clientY,tx:this.tx,ty:this.ty,id:e.pointerId},e.currentTarget.setPointerCapture?.(e.pointerId),window.addEventListener(`pointermove`,this.onPanMove),window.addEventListener(`pointerup`,this.onPanEnd))},onPanMove(e){this._pan&&(this.tx=this._pan.tx+(e.clientX-this._pan.x),this.ty=this._pan.ty+(e.clientY-this._pan.y))},onPanEnd(){this.stopPan()},stopPan(){this.dragging=!1,this._pan=null,window.removeEventListener(`pointermove`,this.onPanMove),window.removeEventListener(`pointerup`,this.onPanEnd)},onResize(){this.box.open&&this.atFit&&this.fit()},onKey(e){let t=e.key;if(t===`Escape`){e.preventDefault(),this.close();return}if(t===`ArrowLeft`){e.preventDefault(),this.step(-1);return}if(t===`ArrowRight`){e.preventDefault(),this.step(1);return}if(t===`+`||t===`=`){e.preventDefault(),this.zoomBy(kC);return}if(t===`-`||t===`_`){e.preventDefault(),this.zoomBy(1/kC);return}if(t===`0`){e.preventDefault(),this.fit();return}t===`1`&&(e.preventDefault(),this.scale=1,this.tx=0,this.ty=0)},step(e){DC(e)},close(){OC()},openRaw(){this.current.src&&window.open(this.current.src,`_blank`,`noopener`)},async copyPath(){let e=await op(this.current.title||this.current.src);Z(e?`已复制图片路径`:`复制失败`,e?`ok`:`err`)}}},NC=[`title`],PC={class:`imgbox__name`},FC={key:0,class:`imgbox__count`},IC={key:1,class:`imgbox__dims`},LC={class:`imgbox__acts`},RC=[`title`],zC={key:0,class:`imgbox__fail`},BC=[`title`],VC=[`src`,`alt`],HC={key:2,class:`imgbox__spin`,"aria-hidden":`true`};function UC(e,t,n,r,i,a){return B(),H(ai,{to:`body`},[W(ic,{name:`imgbox-fade`},{default:F(()=>[a.box.open?(B(),V(`div`,{key:0,ref:`rootEl`,class:`imgbox`,role:`dialog`,"aria-modal":`true`,"aria-label":`图片预览`,tabindex:`-1`,onKeydown:t[16]||=(...e)=>a.onKey&&a.onKey(...e),onClick:t[17]||=q((...e)=>a.close&&a.close(...e),[`self`])},[K(` 顶栏:左=图名与序号 / 右=工具 `),U(`header`,{class:`imgbox__bar`,onClick:t[7]||=q(()=>{},[`stop`])},[U(`span`,{class:`imgbox__meta`,title:a.current.title||a.current.alt},[U(`span`,PC,j(a.displayName),1),a.box.items.length>1?(B(),V(`span`,FC,j(a.box.index+1)+` / `+j(a.box.items.length),1)):K(`v-if`,!0),i.natW?(B(),V(`span`,IC,j(i.natW)+`×`+j(i.natH),1)):K(`v-if`,!0)],8,NC),U(`span`,LC,[U(`button`,{type:`button`,class:`imgbox__btn`,title:`缩小(-)`,onClick:t[0]||=e=>a.zoomBy(1/i.STEP)},[...t[18]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-zoom-out`})],-1)]]),U(`button`,{type:`button`,class:`imgbox__zoom`,title:a.atFit?`当前为适应窗口,点击恢复 1:1`:`点击恢复适应窗口`,onClick:t[1]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},j(a.zoomLabel),9,RC),U(`button`,{type:`button`,class:`imgbox__btn`,title:`放大(+)`,onClick:t[2]||=e=>a.zoomBy(i.STEP)},[...t[19]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-zoom-in`})],-1)]]),t[24]||=U(`span`,{class:`imgbox__sep`},null,-1),U(`button`,{type:`button`,class:A([`imgbox__btn`,{"is-on":a.atFit}]),title:`适应窗口(0)`,onClick:t[3]||=(...e)=>a.fit&&a.fit(...e)},[...t[20]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-maximize`})],-1)]],2),U(`button`,{type:`button`,class:`imgbox__btn`,title:`复制图片路径`,onClick:t[4]||=(...e)=>a.copyPath&&a.copyPath(...e)},[...t[21]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-copy-sm`})],-1)]]),U(`button`,{type:`button`,class:`imgbox__btn`,title:`在新标签打开原图`,onClick:t[5]||=(...e)=>a.openRaw&&a.openRaw(...e)},[...t[22]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-external`})],-1)]]),t[25]||=U(`span`,{class:`imgbox__sep`},null,-1),U(`button`,{type:`button`,class:`imgbox__btn`,title:`关闭(Esc)`,onClick:t[6]||=(...e)=>a.close&&a.close(...e)},[...t[23]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])])]),K(` 画布:图片居中,transform 承担缩放与平移 `),U(`div`,{ref:`stageEl`,class:`imgbox__stage`,onWheel:t[10]||=(...e)=>a.onWheel&&a.onWheel(...e),onPointerdown:t[11]||=(...e)=>a.onPanStart&&a.onPanStart(...e),onDblclick:t[12]||=(...e)=>a.toggleFit&&a.toggleFit(...e)},[i.failed?(B(),V(`div`,zC,[t[26]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),t[27]||=U(`span`,null,`图片加载失败`,-1),U(`code`,{title:a.current.src},j(a.displayName),9,BC)])):(B(),V(`img`,{key:a.current.src,class:A([`imgbox__img`,{"is-dragging":i.dragging,"is-loading":!i.loaded}]),src:a.current.src,alt:a.current.alt||`预览图`,draggable:`false`,style:k(a.imgStyle),onLoad:t[8]||=(...e)=>a.onLoaded&&a.onLoaded(...e),onError:t[9]||=e=>i.failed=!0},null,46,VC)),!i.loaded&&!i.failed?(B(),V(`div`,HC,[...t[28]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`},[U(`use`,{href:`#icon-loading`})],-1)]])):K(`v-if`,!0)],544),K(` 多张时的左右翻页 `),a.box.index>0?(B(),V(`button`,{key:0,type:`button`,class:`imgbox__nav imgbox__nav--prev`,title:`上一张(←)`,onClick:t[13]||=q(e=>a.step(-1),[`stop`])},[...t[29]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1)]])):K(`v-if`,!0),a.box.index<a.box.items.length-1?(B(),V(`button`,{key:1,type:`button`,class:`imgbox__nav imgbox__nav--next`,title:`下一张(→)`,onClick:t[14]||=q(e=>a.step(1),[`stop`])},[...t[30]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1)]])):K(`v-if`,!0),U(`footer`,{class:`imgbox__hint`,onClick:t[15]||=q(()=>{},[`stop`])},`滚轮缩放 · 拖拽平移 · 双击切换 1:1 · ←/→ 翻页 · Esc 关闭`)],544)):K(`v-if`,!0)]),_:1})])}var WC=X(MC,[[`render`,UC],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ImageLightbox.vue`]]),GC={name:`CardGallery`,components:{ConfirmDialog:_p},props:{visible:{type:Boolean,default:!1},cards:{type:Array,default:()=>[]},selectedId:{type:String,default:``}},emits:[`select`,`close`,`delete`],data(){return{query:``,sortByTime:this.loadSortByTime(),visibleIds:new Set,failed:new Set,observer:null,base:``,pendingDelete:null,placeholderUrl:gd}},created(){this.saveSortByTime()},computed:{filtered(){let e=this.query.trim().toLowerCase(),t=this.cards;return e&&(t=t.filter(t=>t.id.toLowerCase().includes(e)||String(t.name||``).toLowerCase().includes(e))),this.sortByTime?t.slice().sort((e,t)=>(t.mtime||0)-(e.mtime||0)):t.slice().sort((e,t)=>String(e.name||``).localeCompare(String(t.name||``)))}},watch:{visible(e){e?(this.query=``,this.failed=new Set,this.$nextTick(()=>{this.setupObserver(),this.focusSearch()}),window.addEventListener(`keydown`,this.onKey)):(this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey))},query(){this.visible&&this.$nextTick(this.setupObserver)},sortByTime(e){this.saveSortByTime()}},beforeUnmount(){this.teardownObserver(),window.removeEventListener(`keydown`,this.onKey)},methods:{askDelete(e){this.pendingDelete=e},confirmDelete(){let e=this.pendingDelete;this.pendingDelete=null,e&&(this.visibleIds.delete(e.id),this.failed.delete(e.id),this.$emit(`delete`,e.id))},thumbUrl(e){return(this.base||Fl()||``)+`/__card-image/`+encodeURIComponent(e)},setupObserver(){this.base=Fl()||``;let e=this.$refs.grid;e&&(this.teardownObserver(),this.observer=new IntersectionObserver(e=>{for(let t of e){if(!t.isIntersecting)continue;let e=t.target.getAttribute(`data-id`);if(e&&!this.visibleIds.has(e)){let t=new Set(this.visibleIds);t.add(e),this.visibleIds=t}this.observer.unobserve(t.target)}},{root:e,rootMargin:`200px`}),e.querySelectorAll(`.cg-tile`).forEach(e=>this.observer.observe(e)))},teardownObserver(){this.observer&&=(this.observer.disconnect(),null)},onImgError(e){let t=new Set(this.failed);t.add(e),this.failed=t},loadSortByTime(){try{return localStorage.getItem(`cardbuddy:cardgallery-sort-by-time`)===`1`}catch{return!1}},saveSortByTime(){try{localStorage.setItem(`cardbuddy:cardgallery-sort-by-time`,this.sortByTime?`1`:`0`)}catch{}},toggleSort(){this.sortByTime=!this.sortByTime},onKey(e){e.key===`Escape`&&this.close()},focusSearch(){this.$refs.search&&this.$refs.search.focus()},choose(e){e&&(this.$emit(`select`,e.id),this.close())},close(){this.$emit(`close`)}}},KC={class:`cg-modal modal-card`,role:`dialog`,"aria-modal":`true`,"aria-label":`卡片网格预览`},qC={class:`cg-modal__head`},JC={class:`cg-modal__title`},YC={class:`cg-modal__count`},XC={class:`cg-modal__search`},ZC=[`title`,`aria-pressed`],QC={ref:`grid`,class:`cg-grid`},$C=[`data-id`,`onClick`],ew={class:`cg-tile__thumb`},tw={key:0,class:`cg-tile__tag`,title:`导入卡片(含 .import-meta.json 来源信息)`},nw=[`src`,`alt`,`onError`],rw={key:2,class:`cg-tile__skeleton`},iw=[`src`,`alt`],aw={class:`cg-tile__meta`},ow=[`title`],sw=[`title`],cw=[`title`,`aria-label`,`onClick`,`onKeydown`],lw={key:0,class:`cg-empty`};function uw(e,t,n,r,i,a){let o=L(`ConfirmDialog`);return B(),H(ic,{name:`modal`},{default:F(()=>[n.visible?(B(),V(`div`,{key:0,class:`cg-mask`,onClick:t[4]||=q((...e)=>a.close&&a.close(...e),[`self`])},[U(`div`,KC,[U(`header`,qC,[U(`div`,JC,[t[5]||=U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-grid`})],-1),t[6]||=U(`span`,null,`卡片网格预览`,-1),U(`span`,YC,j(n.cards.length)+` 张本地卡片`,1)]),U(`div`,XC,[t[7]||=U(`svg`,{class:`cg-modal__search-icon`,viewBox:`0 0 16 16`,width:`13`,height:`13`,"aria-hidden":`true`},[U(`use`,{href:`#icon-search`})],-1),I(U(`input`,{ref:`search`,"onUpdate:modelValue":t[0]||=e=>i.query=e,class:`cg-modal__input`,type:`text`,placeholder:`搜索卡片 ID / 名称…`},null,512),[[il,i.query]])]),U(`button`,{class:A([`cg-modal__sort`,{"cg-modal__sort--active":i.sortByTime}]),type:`button`,title:i.sortByTime?`已按修改时间排序(新→旧),点击取消`:`按修改时间排序(新→旧)`,"aria-pressed":i.sortByTime,onClick:t[1]||=(...e)=>a.toggleSort&&a.toggleSort(...e)},`按修改时间排序`,10,ZC),U(`button`,{class:`cg-modal__close`,type:`button`,title:`关闭`,onClick:t[2]||=(...e)=>a.close&&a.close(...e),"aria-label":`关闭`},[...t[8]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,QC,[(B(!0),V(z,null,R(a.filtered,e=>(B(),V(`button`,{key:e.id,"data-id":e.id,type:`button`,class:A([`cg-tile`,{"cg-tile--active":e.id===n.selectedId,"cg-tile--failed":i.failed.has(e.id)}]),onClick:t=>a.choose(e)},[U(`div`,ew,[K(` 导入标记:仅含 .import-meta.json 侧车的卡(经远端同步导入)显示,悬浮于缩略图右上角 `),e.imported?(B(),V(`span`,tw,`导入`)):K(`v-if`,!0),i.visibleIds.has(e.id)&&!i.failed.has(e.id)?(B(),V(`img`,{key:1,class:`cg-tile__img`,src:a.thumbUrl(e.id),alt:e.name,loading:`lazy`,onError:t=>a.onImgError(e.id)},null,40,nw)):i.visibleIds.has(e.id)?(B(),V(z,{key:3},[K(` 无封面(空白新卡无位图、且空白卡跳过无头截图直接 404):
228
+ 回退工程统一占位图(与 Image 组件兜底图同源),浅色底与缩略图区调性一致 `),U(`img`,{class:`cg-tile__img cg-tile__img--placeholder`,src:i.placeholderUrl,alt:`暂无封面:${e.name}`},null,8,iw)],2112)):(B(),V(`div`,rw,`预览加载中…`))]),U(`div`,aw,[U(`span`,{class:`cg-tile__name`,title:e.name},j(e.name),9,ow),U(`span`,{class:`cg-tile__id`,title:e.id},j(e.id),9,sw)]),K(` 删除钮:仅图标不带文字,悬浮于格子右下角。格子本身是 button,
227
229
  这里用 span + role=button 避免 button 套 button 的非法结构;
228
- click.stop 阻止冒泡到格子的「选中载入」。 `),U(`span`,{class:`cg-tile__del`,role:`button`,tabindex:`0`,title:`删除本地卡片 ${e.id}`,"aria-label":`删除本地卡片 ${e.id}`,onClick:q(t=>a.askDelete(e),[`stop`]),onKeydown:[vl(q(t=>a.askDelete(e),[`stop`,`prevent`]),[`enter`]),vl(q(t=>a.askDelete(e),[`stop`,`prevent`]),[`space`])]},[...t[9]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],40,$C)],10,WC))),128)),a.filtered.length?K(`v-if`,!0):(B(),V(`p`,ew,`无匹配卡片`))],512)]),K(` 删除确认:警告级(橙黄 + 三角图标);删除本地目录不可逆,文案明示影响范围 `),W(o,{visible:i.pendingDelete!=null,title:`删除卡片`,message:i.pendingDelete?`将删除本地卡片目录 src/cards/${i.pendingDelete.id}/(schema / 切图 / 预览图一并删除),不可恢复。确定删除「${i.pendingDelete.name}」吗?`:``,"confirm-text":`删除`,severity:`warn`,onConfirm:a.confirmDelete,onCancel:t[3]||=e=>i.pendingDelete=null},null,8,[`visible`,`message`,`onConfirm`])])):K(`v-if`,!0)]),_:1})}var nw=X(IC,[[`render`,tw],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/CardGallery.vue`]]),rw=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,iw={name:`NewCardDialog`,props:{visible:{type:Boolean,default:!1},mode:{type:String,default:`create`},cardId:{type:String,default:``},cardDesc:{type:String,default:``},existingIds:{type:Array,default:()=>[]}},emits:[`close`,`created`,`renamed`],data(){return{id:``,desc:``,error:``,busy:!1}},computed:{isRename(){return this.mode===`rename`},title(){return this.isRename?`卡片重命名`:`新增空白卡片`},submitLabel(){return this.isRename?`保存`:`创建`},busyLabel(){return this.isRename?`保存中…`:`创建中…`},tip(){return this.isRename?`保存后重命名卡片目录并重载卡片`:`创建后写入 src/cards/<id>/ 空骨架,并切换到新卡`},dupId(){let e=this.id.trim();return!e||this.isRename&&e===this.cardId?``:this.existingIds.find(t=>t===e)||``}},watch:{visible(e){e&&this.resetFields()},mode(){this.visible&&this.resetFields()}},methods:{resetFields(){this.error=``,this.busy=!1,this.isRename?(this.id=this.cardId||``,this.desc=this.cardDesc||``):(this.id=``,this.desc=``)},validate(){let e=this.id.trim(),t=this.desc.trim();return e?rw.test(e)?this.dupId?`卡片 ID 已存在:本地已有「${this.dupId}」,换一个 ID`:t.length>200?`卡片描述过长(≤200 字)`:``:`卡片 ID 只能以字母/数字开头,含字母/数字/_/-(≤64 字符)`:`卡片 ID 必填`},async submit(){if(this.busy)return;let e=this.validate();if(e){this.error=e;return}this.busy=!0,this.error=``;let t=this.id.trim(),n=this.desc.trim();try{if(this.isRename){let e=await J(`/__card/${encodeURIComponent(this.cardId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`renamed`,{oldId:this.cardId,id:r&&r.id||t})}else{let e=await J(`/__cards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`created`,t)}}catch(e){this.error=`${this.isRename?`保存`:`创建`}失败:${e.message}`}finally{this.busy=!1}}}},aw=[`aria-label`],ow={class:`ni-head`},sw={class:`ni-title`},cw={class:`ni-body`},lw={class:`ni-scroll`},uw={class:`ni-field-row`},dw=[`placeholder`,`aria-invalid`,`disabled`],fw={class:`ni-field-row`},pw=[`disabled`],mw={key:0,class:`newcard-dlg__err`,role:`alert`},hw={key:1,class:`newcard-dlg__err`,role:`alert`},gw={class:`ni-foot`},_w={class:`ni-tip`},vw={class:`ni-foot-btns`},yw=[`disabled`],bw=[`disabled`];function xw(e,t,n,r,i,a){return B(),H(ic,{name:`modal`},{default:F(()=>[n.visible?(B(),V(`div`,{key:0,class:`ni-overlay`,onClick:t[7]||=q(t=>e.$emit(`close`),[`self`])},[U(`div`,{class:`ni-panel modal-card newcard-dlg`,role:`alertdialog`,"aria-modal":`true`,"aria-label":a.title},[U(`div`,ow,[U(`span`,sw,j(a.title),1),U(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)})]),U(`div`,cw,[U(`div`,lw,[U(`div`,uw,[t[8]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`卡片 ID`)],-1),I(U(`input`,{class:A([`ni-input`,{"newcard-dlg__input--dup":!!a.dupId}]),type:`text`,"onUpdate:modelValue":t[1]||=e=>i.id=e,placeholder:a.isRename?`英文标识,改名即重命名卡片目录(字母/数字/_/-)`:`英文标识,如 myNewCard(字母/数字/_/-)`,"aria-invalid":a.dupId?`true`:null,disabled:i.busy,onKeydown:t[2]||=vl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,42,dw),[[il,i.id]])]),U(`div`,fw,[t[9]||=U(`label`,{class:`ni-field-label`},`卡片描述`,-1),I(U(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[3]||=e=>i.desc=e,placeholder:`选填,卡片用途简述;留空则用卡片 ID 作显示名`,disabled:i.busy,onKeydown:t[4]||=vl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,40,pw),[[il,i.desc]])]),a.dupId?(B(),V(`p`,mw,`卡片 ID 已存在:本地已有「`+j(a.dupId)+`」,换一个 ID`,1)):i.error?(B(),V(`p`,hw,j(i.error),1)):K(`v-if`,!0)])]),U(`div`,gw,[U(`span`,_w,j(a.tip),1),U(`div`,vw,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,disabled:i.busy,onClick:t[5]||=t=>e.$emit(`close`)},`取消`,8,yw),U(`button`,{class:`ni-btn`,type:`button`,disabled:i.busy||!!a.dupId,onClick:t[6]||=(...e)=>a.submit&&a.submit(...e)},j(i.busy?a.busyLabel:a.submitLabel),9,bw)])])],8,aw)])):K(`v-if`,!0)]),_:1})}var Sw=X(iw,[[`render`,xw],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/NewCardDialog.vue`]]),Cw=[`Row`,`Column`,`MultiColumn`,`ListLayout`,`GridLayout`,`AbsoluteLayout`,`ViewContainer`,`Text`,`Button`,`Image`,`Icon`,`MultiText`,`Canvas`,`Input`,`CheckGroup`,`RadioButton`,`ProgressSlider`,`Video`,`Map`,`Divider`];function ww(){let e=fu.groups&&fu.groups.length?fu.groups:[`布局组件`,`基础组件`],t={},n=fu.components||{};for(let e in n){let r=n[e],i=r.group||`基础组件`;t[i]||(t[i]=[]);let a=r.name||e;t[i].push({className:e,name:a,glyph:e})}return e.filter(e=>t[e]&&t[e].length).map(e=>({key:e,items:t[e]}))}var Tw={name:`ComponentPalette`,emits:[`pick`,`close`],data(){return{groups:ww(),query:``}},computed:{filteredGroups(){let e=(this.query||``).trim().toLowerCase();return e?this.groups.map(t=>({key:t.key,items:t.items.filter(t=>{let n=(t.name||``).toLowerCase(),r=(t.className||``).toLowerCase();return n.indexOf(e)!==-1||r.indexOf(e)!==-1})})).filter(e=>e.items.length):this.groups}},methods:{iconSvg(e){return Cw.indexOf(e)===-1?`<span class="cp__avatar-text">`+String(e).slice(0,1)+`</span>`:`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="18" height="18"><use href="#icon-glyph-`+e+`"></use></svg>`}}},Ew={class:`cp modal-card`,role:`dialog`,"aria-label":`选择组件类型`},Dw={class:`cp__head`},Ow={class:`cp__body`},kw={class:`cp__group-title`},Aw={class:`cp__grid`},jw=[`title`,`onClick`],Mw=[`data-g`,`innerHTML`],Nw={class:`cp__item-name`},Pw={class:`cp__item-class`},Fw={key:0,class:`cp__empty`};function Iw(e,t,n,r,i,a){return B(),V(`div`,{class:`cp__mask`,onClick:t[2]||=q(t=>e.$emit(`close`),[`self`])},[U(`div`,Ew,[U(`div`,Dw,[t[3]||=U(`span`,{class:`cp__title`},`添加组件`,-1),t[4]||=U(`span`,{class:`cp__hint`},`选择要插入的组件类型`,-1),U(`button`,{class:`cp__close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},`✕`)]),U(`div`,Ow,[I(U(`input`,{class:`cp__search`,type:`text`,"onUpdate:modelValue":t[1]||=e=>i.query=e,placeholder:`搜索组件…`,title:`按组件名 / 类型过滤`},null,512),[[il,i.query]]),(B(!0),V(z,null,R(a.filteredGroups,t=>(B(),V(`section`,{key:t.key,class:`cp__group`},[U(`h4`,kw,j(t.key),1),U(`div`,Aw,[(B(!0),V(z,null,R(t.items,n=>(B(),V(`button`,{key:n.className,class:`cp__item`,type:`button`,title:n.className,onClick:t=>e.$emit(`pick`,n.className)},[U(`span`,{class:`cp__avatar`,"data-g":t.key===`布局组件`?`layout`:`basic`,innerHTML:a.iconSvg(n.glyph)},null,8,Mw),U(`span`,Nw,j(n.name),1),U(`span`,Pw,j(n.className),1)],8,jw))),128))])]))),128)),i.query&&!a.filteredGroups.length?(B(),V(`p`,Fw,`无匹配组件`)):K(`v-if`,!0)])])])}var Lw=X(Tw,[[`render`,Iw],[`__scopeId`,`data-v-88e70dcf`],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ComponentPalette.vue`]]),Rw={name:`Switch`,props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],methods:{onClick(){this.disabled||this.$emit(`update:modelValue`,!this.modelValue)}}},zw=[`aria-checked`,`disabled`];function Bw(e,t,n,r,i,a){return B(),V(`button`,{type:`button`,class:A([`switch`,{"switch--on":n.modelValue,"switch--disabled":n.disabled}]),role:`switch`,"aria-checked":String(n.modelValue),disabled:n.disabled,onClick:t[0]||=(...e)=>a.onClick&&a.onClick(...e)},[...t[1]||=[U(`span`,{class:`switch__track`},[U(`span`,{class:`switch__thumb`})],-1)]],10,zw)}var Vw=X(Rw,[[`render`,Bw],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/Switch.vue`]]);function Hw(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Uw=Hw();function Ww(e){Uw=e}var Gw={exec:()=>null};function Kw(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Q(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(Jw.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var qw=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),Jw={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:Kw(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:Kw(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:Kw(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:Kw(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:Kw(e=>RegExp(`^ {0,${e}}(?:</?(?:${lT})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:Kw(e=>RegExp(`^ {0,${e}}>`))},Yw=/^(?:[ \t]*(?:\n|$))+/,Xw=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,Zw=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Qw=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,$w=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,eT=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,tT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,nT=Q(tT).replace(/bull/g,eT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),rT=Q(tT).replace(/bull/g,eT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),iT=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,aT=/^[^\n]+/,oT=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,sT=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,oT).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),cT=Q(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,eT).getRegex(),lT=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,uT=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,dT=Q(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,uT).replace(`tag`,lT).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),fT=e=>Q(iT).replace(`hr`,Qw).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,lT).getRegex(),pT=fT(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),mT=fT(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),hT={blockquote:Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,mT).getRegex(),code:Xw,def:sT,fences:Zw,heading:$w,hr:Qw,html:dT,lheading:nT,list:cT,newline:Yw,paragraph:pT,table:Gw,text:aT},gT=Q(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,Qw).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,lT).getRegex(),_T={...hT,lheading:rT,table:gT,paragraph:Q(iT).replace(`hr`,Qw).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,gT).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,lT).getRegex()},vT={...hT,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,uT).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:Gw,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(iT).replace(`hr`,Qw).replace(`heading`,` *#{1,6} *[^
229
- ]`).replace(`lheading`,nT).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},yT=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,bT=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,xT=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,ST=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,CT=/[\p{P}\p{S}]/u,wT=/[\s\p{P}\p{S}]/u,TT=/[^\s\p{P}\p{S}]/u,ET=Q(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,wT).getRegex(),DT=/[\p{Pi}\p{Ps}"']/u,OT=/(?!~)[\p{P}\p{S}]/u,kT=/(?!~)[\s\p{P}\p{S}]/u,AT=/(?:[^\s\p{P}\p{S}]|~)/u,jT=Q(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,qw?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),MT=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,NT=Q(MT,`u`).replace(/punct/g,CT).getRegex(),PT=Q(MT,`u`).replace(/punct/g,OT).getRegex(),FT=Q(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,DT).replace(/punct/g,CT).getRegex(),IT=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,LT=Q(IT,`gu`).replace(/notPunctSpace/g,TT).replace(/punctSpace/g,wT).replace(/punct/g,CT).getRegex(),RT=Q(IT,`gu`).replace(/notPunctSpace/g,AT).replace(/punctSpace/g,kT).replace(/punct/g,OT).getRegex(),zT=Q(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,TT).replace(/punctSpace/g,wT).replace(/punct/g,CT).getRegex(),BT=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,TT).replace(/punctSpace/g,wT).replace(/punct/g,CT).getRegex(),VT=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,TT).replace(/punctSpace/g,wT).replace(/punct/g,CT).getRegex(),HT=Q(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,CT).getRegex(),UT=Q(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,TT).replace(/punctSpace/g,wT).replace(/punct/g,CT).getRegex(),WT=Q(/\\(punct)/,`gu`).replace(/punct/g,CT).getRegex(),GT=Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),KT=Q(uT).replace(`(?:-->|$)`,`-->`).getRegex(),qT=Q(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,KT).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),JT=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,YT=Q(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,JT).getRegex(),XT=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,YT).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),ZT=Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,YT).replace(`ref`,oT).getRegex(),QT=Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,oT).getRegex(),$T=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,eE=Q(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,JT).getRegex(),tE=Q(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,eE).replace(`ref`,$T).getRegex()).replace(`nolink`,Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,$T).getRegex()).getRegex(),nE=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,rE={_backpedal:Gw,anyPunctuation:WT,autolink:GT,blockSkip:jT,br:xT,code:bT,del:Gw,delLDelim:Gw,delRDelim:Gw,emStrongLDelim:NT,emStrongRDelimAst:LT,emStrongRDelimUnd:BT,escape:yT,link:XT,nolink:QT,punctuation:ET,reflink:ZT,reflinkSearch:tE,tag:qT,text:ST,url:Gw},iE={...rE,emStrongLDelim:FT,emStrongRDelimAst:zT,emStrongRDelimUnd:VT,link:Q(/^!?\[(label)\]\((.*?)\)/).replace(`label`,YT).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,YT).getRegex()},aE={...rE,emStrongRDelimAst:RT,emStrongLDelim:PT,delLDelim:HT,delRDelim:UT,url:Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,nE).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Q(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,nE).getRegex()},oE={...aE,br:Q(xT).replace(`{2,}`,`*`).getRegex(),text:Q(aE.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},sE={normal:hT,gfm:_T,pedantic:vT},cE={normal:rE,gfm:aE,breaks:oE,pedantic:iE},lE={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},uE=e=>lE[e];function dE(e,t){if(t){if(Jw.escapeTest.test(e))return e.replace(Jw.escapeReplace,uE)}else if(Jw.escapeTestNoEncode.test(e))return e.replace(Jw.escapeReplaceNoEncode,uE);return e}function fE(e){try{e=encodeURI(e).replace(Jw.percentDecode,`%`)}catch{return null}return e}function pE(e,t){let n=e.replace(Jw.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(Jw.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(Jw.slashPipe,`|`);return n}function mE(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function hE(e){let t=e.split(`
230
- `),n=t.length-1;for(;n>=0&&Jw.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
231
- `)}function gE(e){return e.toLowerCase().toUpperCase().toLowerCase()}function _E(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function vE(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function yE(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function bE(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
230
+ click.stop 阻止冒泡到格子的「选中载入」。 `),U(`span`,{class:`cg-tile__del`,role:`button`,tabindex:`0`,title:`删除本地卡片 ${e.id}`,"aria-label":`删除本地卡片 ${e.id}`,onClick:q(t=>a.askDelete(e),[`stop`]),onKeydown:[vl(q(t=>a.askDelete(e),[`stop`,`prevent`]),[`enter`]),vl(q(t=>a.askDelete(e),[`stop`,`prevent`]),[`space`])]},[...t[9]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],40,cw)],10,$C))),128)),a.filtered.length?K(`v-if`,!0):(B(),V(`p`,lw,`无匹配卡片`))],512)]),K(` 删除确认:警告级(橙黄 + 三角图标);删除本地目录不可逆,文案明示影响范围 `),W(o,{visible:i.pendingDelete!=null,title:`删除卡片`,message:i.pendingDelete?`将删除本地卡片目录 src/cards/${i.pendingDelete.id}/(schema / 切图 / 预览图一并删除),不可恢复。确定删除「${i.pendingDelete.name}」吗?`:``,"confirm-text":`删除`,severity:`warn`,onConfirm:a.confirmDelete,onCancel:t[3]||=e=>i.pendingDelete=null},null,8,[`visible`,`message`,`onConfirm`])])):K(`v-if`,!0)]),_:1})}var dw=X(GC,[[`render`,uw],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/CardGallery.vue`]]),fw=/^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$/,pw={name:`NewCardDialog`,props:{visible:{type:Boolean,default:!1},mode:{type:String,default:`create`},cardId:{type:String,default:``},cardDesc:{type:String,default:``},existingIds:{type:Array,default:()=>[]}},emits:[`close`,`created`,`renamed`],data(){return{id:``,desc:``,error:``,busy:!1}},computed:{isRename(){return this.mode===`rename`},title(){return this.isRename?`卡片重命名`:`新增空白卡片`},submitLabel(){return this.isRename?`保存`:`创建`},busyLabel(){return this.isRename?`保存中…`:`创建中…`},tip(){return this.isRename?`保存后重命名卡片目录并重载卡片`:`创建后写入 src/cards/<id>/ 空骨架,并切换到新卡`},dupId(){let e=this.id.trim();return!e||this.isRename&&e===this.cardId?``:this.existingIds.find(t=>t===e)||``}},watch:{visible(e){e&&this.resetFields()},mode(){this.visible&&this.resetFields()}},methods:{resetFields(){this.error=``,this.busy=!1,this.isRename?(this.id=this.cardId||``,this.desc=this.cardDesc||``):(this.id=``,this.desc=``)},validate(){let e=this.id.trim(),t=this.desc.trim();return e?fw.test(e)?this.dupId?`卡片 ID 已存在:本地已有「${this.dupId}」,换一个 ID`:t.length>200?`卡片描述过长(≤200 字)`:``:`卡片 ID 只能以字母/数字开头,含字母/数字/_/-(≤64 字符)`:`卡片 ID 必填`},async submit(){if(this.busy)return;let e=this.validate();if(e){this.error=e;return}this.busy=!0,this.error=``;let t=this.id.trim(),n=this.desc.trim();try{if(this.isRename){let e=await J(`/__card/${encodeURIComponent(this.cardId)}`,{method:`PATCH`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`renamed`,{oldId:this.cardId,id:r&&r.id||t})}else{let e=await J(`/__cards`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:t,desc:n})}),r=await e.json().catch(()=>null);if(!e.ok)throw Error(r&&(r.message||r.error)||`HTTP ${e.status}`);this.$emit(`created`,t)}}catch(e){this.error=`${this.isRename?`保存`:`创建`}失败:${e.message}`}finally{this.busy=!1}}}},mw=[`aria-label`],hw={class:`ni-head`},gw={class:`ni-title`},_w={class:`ni-body`},vw={class:`ni-scroll`},yw={class:`ni-field-row`},bw=[`placeholder`,`aria-invalid`,`disabled`],xw={class:`ni-field-row`},Sw=[`disabled`],Cw={key:0,class:`newcard-dlg__err`,role:`alert`},ww={key:1,class:`newcard-dlg__err`,role:`alert`},Tw={class:`ni-foot`},Ew={class:`ni-tip`},Dw={class:`ni-foot-btns`},Ow=[`disabled`],kw=[`disabled`];function Aw(e,t,n,r,i,a){return B(),H(ic,{name:`modal`},{default:F(()=>[n.visible?(B(),V(`div`,{key:0,class:`ni-overlay`,onClick:t[7]||=q(t=>e.$emit(`close`),[`self`])},[U(`div`,{class:`ni-panel modal-card newcard-dlg`,role:`alertdialog`,"aria-modal":`true`,"aria-label":a.title},[U(`div`,hw,[U(`span`,gw,j(a.title),1),U(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)})]),U(`div`,_w,[U(`div`,vw,[U(`div`,yw,[t[8]||=U(`label`,{class:`ni-field-label`},[U(`i`,null,`*`),G(`卡片 ID`)],-1),I(U(`input`,{class:A([`ni-input`,{"newcard-dlg__input--dup":!!a.dupId}]),type:`text`,"onUpdate:modelValue":t[1]||=e=>i.id=e,placeholder:a.isRename?`英文标识,改名即重命名卡片目录(字母/数字/_/-)`:`英文标识,如 myNewCard(字母/数字/_/-)`,"aria-invalid":a.dupId?`true`:null,disabled:i.busy,onKeydown:t[2]||=vl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,42,bw),[[il,i.id]])]),U(`div`,xw,[t[9]||=U(`label`,{class:`ni-field-label`},`卡片描述`,-1),I(U(`input`,{class:`ni-input`,type:`text`,"onUpdate:modelValue":t[3]||=e=>i.desc=e,placeholder:`选填,卡片用途简述;留空则用卡片 ID 作显示名`,disabled:i.busy,onKeydown:t[4]||=vl((...e)=>a.submit&&a.submit(...e),[`enter`])},null,40,Sw),[[il,i.desc]])]),a.dupId?(B(),V(`p`,Cw,`卡片 ID 已存在:本地已有「`+j(a.dupId)+`」,换一个 ID`,1)):i.error?(B(),V(`p`,ww,j(i.error),1)):K(`v-if`,!0)])]),U(`div`,Tw,[U(`span`,Ew,j(a.tip),1),U(`div`,Dw,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,disabled:i.busy,onClick:t[5]||=t=>e.$emit(`close`)},`取消`,8,Ow),U(`button`,{class:`ni-btn`,type:`button`,disabled:i.busy||!!a.dupId,onClick:t[6]||=(...e)=>a.submit&&a.submit(...e)},j(i.busy?a.busyLabel:a.submitLabel),9,kw)])])],8,mw)])):K(`v-if`,!0)]),_:1})}var jw=X(pw,[[`render`,Aw],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/NewCardDialog.vue`]]),Mw=[`Row`,`Column`,`MultiColumn`,`ListLayout`,`GridLayout`,`AbsoluteLayout`,`ViewContainer`,`Text`,`Button`,`Image`,`Icon`,`MultiText`,`Canvas`,`Input`,`CheckGroup`,`RadioButton`,`ProgressSlider`,`Video`,`Map`,`Divider`];function Nw(){let e=fu.groups&&fu.groups.length?fu.groups:[`布局组件`,`基础组件`],t={},n=fu.components||{};for(let e in n){let r=n[e],i=r.group||`基础组件`;t[i]||(t[i]=[]);let a=r.name||e;t[i].push({className:e,name:a,glyph:e})}return e.filter(e=>t[e]&&t[e].length).map(e=>({key:e,items:t[e]}))}var Pw={name:`ComponentPalette`,emits:[`pick`,`close`],data(){return{groups:Nw(),query:``}},computed:{filteredGroups(){let e=(this.query||``).trim().toLowerCase();return e?this.groups.map(t=>({key:t.key,items:t.items.filter(t=>{let n=(t.name||``).toLowerCase(),r=(t.className||``).toLowerCase();return n.indexOf(e)!==-1||r.indexOf(e)!==-1})})).filter(e=>e.items.length):this.groups}},methods:{iconSvg(e){return Mw.indexOf(e)===-1?`<span class="cp__avatar-text">`+String(e).slice(0,1)+`</span>`:`<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" width="18" height="18"><use href="#icon-glyph-`+e+`"></use></svg>`}}},Fw={class:`cp modal-card`,role:`dialog`,"aria-label":`选择组件类型`},Iw={class:`cp__head`},Lw={class:`cp__body`},Rw={class:`cp__group-title`},zw={class:`cp__grid`},Bw=[`title`,`onClick`],Vw=[`data-g`,`innerHTML`],Hw={class:`cp__item-name`},Uw={class:`cp__item-class`},Ww={key:0,class:`cp__empty`};function Gw(e,t,n,r,i,a){return B(),V(`div`,{class:`cp__mask`,onClick:t[2]||=q(t=>e.$emit(`close`),[`self`])},[U(`div`,Fw,[U(`div`,Iw,[t[3]||=U(`span`,{class:`cp__title`},`添加组件`,-1),t[4]||=U(`span`,{class:`cp__hint`},`选择要插入的组件类型`,-1),U(`button`,{class:`cp__close`,type:`button`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},`✕`)]),U(`div`,Lw,[I(U(`input`,{class:`cp__search`,type:`text`,"onUpdate:modelValue":t[1]||=e=>i.query=e,placeholder:`搜索组件…`,title:`按组件名 / 类型过滤`},null,512),[[il,i.query]]),(B(!0),V(z,null,R(a.filteredGroups,t=>(B(),V(`section`,{key:t.key,class:`cp__group`},[U(`h4`,Rw,j(t.key),1),U(`div`,zw,[(B(!0),V(z,null,R(t.items,n=>(B(),V(`button`,{key:n.className,class:`cp__item`,type:`button`,title:n.className,onClick:t=>e.$emit(`pick`,n.className)},[U(`span`,{class:`cp__avatar`,"data-g":t.key===`布局组件`?`layout`:`basic`,innerHTML:a.iconSvg(n.glyph)},null,8,Vw),U(`span`,Hw,j(n.name),1),U(`span`,Uw,j(n.className),1)],8,Bw))),128))])]))),128)),i.query&&!a.filteredGroups.length?(B(),V(`p`,Ww,`无匹配组件`)):K(`v-if`,!0)])])])}var Kw=X(Pw,[[`render`,Gw],[`__scopeId`,`data-v-88e70dcf`],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ComponentPalette.vue`]]),qw={name:`Switch`,props:{modelValue:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},emits:[`update:modelValue`],methods:{onClick(){this.disabled||this.$emit(`update:modelValue`,!this.modelValue)}}},Jw=[`aria-checked`,`disabled`];function Yw(e,t,n,r,i,a){return B(),V(`button`,{type:`button`,class:A([`switch`,{"switch--on":n.modelValue,"switch--disabled":n.disabled}]),role:`switch`,"aria-checked":String(n.modelValue),disabled:n.disabled,onClick:t[0]||=(...e)=>a.onClick&&a.onClick(...e)},[...t[1]||=[U(`span`,{class:`switch__track`},[U(`span`,{class:`switch__thumb`})],-1)]],10,Jw)}var Xw=X(qw,[[`render`,Yw],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/Switch.vue`]]);function Zw(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Qw=Zw();function $w(e){Qw=e}var eT={exec:()=>null};function tT(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function Q(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(rT.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var nT=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),rT={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:tT(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:tT(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:tT(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:tT(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:tT(e=>RegExp(`^ {0,${e}}(?:</?(?:${vT})(?: +|$|/?>)|<(?:script|pre|style|textarea|!--))`,`i`)),blockquoteBeginRegex:tT(e=>RegExp(`^ {0,${e}}>`))},iT=/^(?:[ \t]*(?:\n|$))+/,aT=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,oT=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,sT=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,cT=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,lT=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,uT=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,dT=Q(uT).replace(/bull/g,lT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),fT=Q(uT).replace(/bull/g,lT).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),pT=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,mT=/^[^\n]+/,hT=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,gT=Q(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,hT).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),_T=Q(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,lT).getRegex(),vT=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,yT=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,bT=Q(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,yT).replace(`tag`,vT).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),xT=e=>Q(pT).replace(`hr`,sT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,vT).getRegex(),ST=xT(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),CT=xT(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),wT={blockquote:Q(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,CT).getRegex(),code:aT,def:gT,fences:oT,heading:cT,hr:sT,html:bT,lheading:dT,list:_T,newline:iT,paragraph:ST,table:eT,text:mT},TT=Q(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,sT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,vT).getRegex(),ET={...wT,lheading:fT,table:TT,paragraph:Q(pT).replace(`hr`,sT).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,TT).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,vT).getRegex()},DT={...wT,html:Q(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,yT).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:eT,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:Q(pT).replace(`hr`,sT).replace(`heading`,` *#{1,6} *[^
231
+ ]`).replace(`lheading`,dT).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},OT=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,kT=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,AT=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,jT=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,MT=/[\p{P}\p{S}]/u,NT=/[\s\p{P}\p{S}]/u,PT=/[^\s\p{P}\p{S}]/u,FT=Q(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,NT).getRegex(),IT=/[\p{Pi}\p{Ps}"']/u,LT=/(?!~)[\p{P}\p{S}]/u,RT=/(?!~)[\s\p{P}\p{S}]/u,zT=/(?:[^\s\p{P}\p{S}]|~)/u,BT=Q(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,nT?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),VT=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,HT=Q(VT,`u`).replace(/punct/g,MT).getRegex(),UT=Q(VT,`u`).replace(/punct/g,LT).getRegex(),WT=Q(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,IT).replace(/punct/g,MT).getRegex(),GT=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,KT=Q(GT,`gu`).replace(/notPunctSpace/g,PT).replace(/punctSpace/g,NT).replace(/punct/g,MT).getRegex(),qT=Q(GT,`gu`).replace(/notPunctSpace/g,zT).replace(/punctSpace/g,RT).replace(/punct/g,LT).getRegex(),JT=Q(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,PT).replace(/punctSpace/g,NT).replace(/punct/g,MT).getRegex(),YT=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,PT).replace(/punctSpace/g,NT).replace(/punct/g,MT).getRegex(),XT=Q(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,PT).replace(/punctSpace/g,NT).replace(/punct/g,MT).getRegex(),ZT=Q(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,MT).getRegex(),QT=Q(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,PT).replace(/punctSpace/g,NT).replace(/punct/g,MT).getRegex(),$T=Q(/\\(punct)/,`gu`).replace(/punct/g,MT).getRegex(),eE=Q(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),tE=Q(yT).replace(`(?:-->|$)`,`-->`).getRegex(),nE=Q(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,tE).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),rE=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,iE=Q(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,rE).getRegex(),aE=Q(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace(`label`,iE).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),oE=Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,iE).replace(`ref`,hT).getRegex(),sE=Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,hT).getRegex(),cE=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,lE=Q(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,rE).getRegex(),uE=Q(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,Q(/^!?\[(label)\]\[(ref)\]/).replace(`label`,lE).replace(`ref`,cE).getRegex()).replace(`nolink`,Q(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,cE).getRegex()).getRegex(),dE=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,fE={_backpedal:eT,anyPunctuation:$T,autolink:eE,blockSkip:BT,br:AT,code:kT,del:eT,delLDelim:eT,delRDelim:eT,emStrongLDelim:HT,emStrongRDelimAst:KT,emStrongRDelimUnd:YT,escape:OT,link:aE,nolink:sE,punctuation:FT,reflink:oE,reflinkSearch:uE,tag:nE,text:jT,url:eT},pE={...fE,emStrongLDelim:WT,emStrongRDelimAst:JT,emStrongRDelimUnd:XT,link:Q(/^!?\[(label)\]\((.*?)\)/).replace(`label`,iE).getRegex(),reflink:Q(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,iE).getRegex()},mE={...fE,emStrongRDelimAst:qT,emStrongLDelim:UT,delLDelim:ZT,delRDelim:QT,url:Q(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`protocol`,dE).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:Q(/^(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace(`protocol`,dE).getRegex()},hE={...mE,br:Q(AT).replace(`{2,}`,`*`).getRegex(),text:Q(mE.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},gE={normal:wT,gfm:ET,pedantic:DT},_E={normal:fE,gfm:mE,breaks:hE,pedantic:pE},vE={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},yE=e=>vE[e];function bE(e,t){if(t){if(rT.escapeTest.test(e))return e.replace(rT.escapeReplace,yE)}else if(rT.escapeTestNoEncode.test(e))return e.replace(rT.escapeReplaceNoEncode,yE);return e}function xE(e){try{e=encodeURI(e).replace(rT.percentDecode,`%`)}catch{return null}return e}function SE(e,t){let n=e.replace(rT.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(rT.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(rT.slashPipe,`|`);return n}function CE(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function wE(e){let t=e.split(`
232
+ `),n=t.length-1;for(;n>=0&&rT.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
233
+ `)}function TE(e){return e.toLowerCase().toUpperCase().toLowerCase()}function EE(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function DE(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function OE(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`;r.state.inLink=!0;let l=r.state.linkEmitted,u=r.state.inRawBlock;r.state.linkEmitted=!1;let d=r.inlineTokens(s),f=r.state.linkEmitted;if(r.state.linkEmitted=l,r.state.inLink=!1,!c){if(f){r.state.inRawBlock=u;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:d}}function kE(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
232
234
  `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
233
- `)}function xE(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var SE=class{options;rules;lexer;constructor(e){this.options=e||Uw}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:hE(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=bE(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=mE(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:mE(t[0],`
234
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:mE(t[0],`
235
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=mE(t[0],`
235
+ `)}function AE(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var jE=class{options;rules;lexer;constructor(e){this.options=e||Qw}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:wE(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=kE(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=CE(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:CE(t[0],`
236
+ `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:CE(t[0],`
237
+ `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=CE(t[0],`
236
238
  `).split(`
237
239
  `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o;for(o=0;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
238
240
  `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
@@ -244,20 +246,20 @@ ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTo
244
246
  ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
245
247
  `+e.join(`
246
248
  `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
247
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=vE(t[2].split(`
249
+ `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=this.rules.other.listItemRegex(n),o=!1;for(;e;){let n=!1,r=``,s=``;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;r=t[0],e=e.substring(r.length);let c=DE(t[2].split(`
248
250
  `,1)[0],t[1].length),l=e.split(`
249
251
  `,1)[0],u=!c.trim(),d=0;if(this.options.pedantic?(d=2,s=c.trimStart()):u?d=t[1].length+1:(d=c.search(this.rules.other.nonSpaceChar),d=d>4?1:d,s=c.slice(d),d+=t[1].length),u&&this.rules.other.blankLine.test(l)&&(r+=l+`
250
252
  `,e=e.substring(l.length+1),n=!0),!n){let t=this.rules.other.nextBulletRegex(d),n=this.rules.other.hrRegex(d),i=this.rules.other.fencesBeginRegex(d),a=this.rules.other.headingBeginRegex(d),o=this.rules.other.htmlBeginRegex(d),f=this.rules.other.blockquoteBeginRegex(d);for(;e;){let p=e.split(`
251
253
  `,1)[0],m;if(l=p,this.options.pedantic?(l=l.replace(this.rules.other.listReplaceNesting,` `),m=l):m=l.replace(this.rules.other.tabCharGlobal,` `),i.test(l)||a.test(l)||o.test(l)||f.test(l)||t.test(l)||n.test(l))break;if(m.search(this.rules.other.nonSpaceChar)>=d||!l.trim())s+=`
252
254
  `+m.slice(d);else{if(u||c.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||i.test(c)||a.test(c)||n.test(c))break;s+=`
253
255
  `+l}u=!l.trim(),r+=p+`
254
- `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=hE(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=gE(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:mE(t[0],`
255
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=pE(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
256
- `):[],a={type:`table`,raw:mE(t[0],`
257
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(pE(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:mE(t[0],`
256
+ `,e=e.substring(p.length+1),c=m.slice(d)}}i.loose||(o?i.loose=!0:this.rules.other.doubleBlankLine.test(r)&&(o=!0)),i.items.push({type:`list_item`,raw:r,task:!!this.options.gfm&&this.rules.other.listIsTask.test(s),loose:!1,text:s,tokens:[]}),i.raw+=r}let s=i.items.at(-1);if(s)s.raw=s.raw.trimEnd(),s.text=s.text.trimEnd();else return;i.raw=i.raw.trimEnd();for(let e of i.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!i.loose){let t=e.tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of i.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,i.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(i.loose)for(let e of i.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return i}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=wE(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=TE(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:CE(t[0],`
257
+ `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=SE(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
258
+ `):[],a={type:`table`,raw:CE(t[0],`
259
+ `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(SE(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:CE(t[0],`
258
260
  `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
259
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&xE(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=mE(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=_E(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),yE(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&xE(e,n[1],r,this.rules))return;let i=t[gE((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return yE(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},CE=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Uw,this.options.tokenizer=this.options.tokenizer||new SE,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:Jw,block:sE.normal,inline:cE.normal};this.options.pedantic?(t.block=sE.pedantic,t.inline=cE.pedantic):this.options.gfm&&(t.block=sE.gfm,t.inline=this.options.breaks?cE.breaks:cE.gfm),this.tokenizer.rules=t}static get rules(){return{block:sE,inline:cE}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(Jw.carriageReturn,`
260
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(Jw.tabCharGlobal,` `).replace(Jw.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
261
+ `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&AE(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=CE(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=EE(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),OE(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&AE(e,n[1],r,this.rules))return;let i=t[TE((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return OE(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:t[0],escaped:e}}}},ME=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||Qw,this.options.tokenizer=this.options.tokenizer||new jE,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,top:!0};let t={other:rT,block:gE.normal,inline:_E.normal};this.options.pedantic?(t.block=gE.pedantic,t.inline=_E.pedantic):this.options.gfm&&(t.block=gE.gfm,t.inline=this.options.breaks?_E.breaks:_E.gfm),this.tokenizer.rules=t}static get rules(){return{block:gE,inline:_E}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(rT.carriageReturn,`
262
+ `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(rT.tabCharGlobal,` `).replace(rT.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
261
263
  `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
262
264
  `)?``:`
263
265
  `)+i.raw,n.text+=`
@@ -270,9 +272,9 @@ ${a}`,r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){
270
272
  `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
271
273
  `)?``:`
272
274
  `)+i.raw,n.text+=`
273
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,gE(e.slice(n+1,-1))))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,gE(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},wE=class{options;parser;constructor(e){this.options=e||Uw}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(Jw.notSpaceStart)?.[0],i=e?e.replace(Jw.endingNewline,``)+`
274
- `:``;return r?`<pre><code class="language-`+dE(r)+`">`+(n?i:dE(i,!0))+`</code></pre>
275
- `:`<pre><code>`+(n?i:dE(i,!0))+`</code></pre>
275
+ `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(!(e.charAt(0)===`!`||!Object.hasOwn(this.tokens.links,TE(e.slice(n+1,-1))))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,TE(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuation,e=>`+`.repeat(e.length)),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},NE=class{options;parser;constructor(e){this.options=e||Qw}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(rT.notSpaceStart)?.[0],i=e?e.replace(rT.endingNewline,``)+`
276
+ `:``;return r?`<pre><code class="language-`+bE(r)+`">`+(n?i:bE(i,!0))+`</code></pre>
277
+ `:`<pre><code>`+(n?i:bE(i,!0))+`</code></pre>
276
278
  `}blockquote({tokens:e}){return`<blockquote>
277
279
  ${this.parser.parse(e)}</blockquote>
278
280
  `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
@@ -288,43 +290,45 @@ ${this.parser.parse(e)}</blockquote>
288
290
  `}tablerow({text:e}){return`<tr>
289
291
  ${e}</tr>
290
292
  `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
291
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${dE(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?dE(n,!0):this.parser.parseInline(r),o=fE(e);if(o===null)return a;e=dE(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+dE(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=fE(e);if(i===null)return dE(n);e=i;let a=`<img src="${dE(e)}" alt="${dE(n)}"`;return t&&(a+=` title="${dE(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:dE(e.text)}},TE=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},EE=class e{options;renderer;textRenderer;constructor(e){this.options=e||Uw,this.options.renderer=this.options.renderer||new wE,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new TE}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},DE=class{options;block;constructor(e){this.options=e||Uw}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?CE.lex:CE.lexInline}provideParser(e=this.block){return e?EE.parse:EE.parseInline}},OE=new class{defaults=Hw();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=EE;Renderer=wE;TextRenderer=TE;Lexer=CE;Tokenizer=SE;Hooks=DE;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new wE(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new SE(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new DE;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=DE.passThroughHooks.has(n)?e=>{if(this.defaults.async&&DE.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return CE.lex(e,t??this.defaults)}parser(e,t){return EE.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?CE.lex:CE.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?EE.parse:EE.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?CE.lex:CE.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?EE.parse:EE.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
292
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+dE(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function kE(e,t){return OE.parse(e,t)}kE.options=kE.setOptions=function(e){return OE.setOptions(e),kE.defaults=OE.defaults,Ww(kE.defaults),kE},kE.getDefaults=Hw,kE.defaults=Uw;function AE(...e){return OE.use(...e),kE.defaults=OE.defaults,Ww(kE.defaults),kE}kE.use=AE,kE.walkTokens=function(e,t){return OE.walkTokens(e,t)},kE.parseInline=OE.parseInline,kE.Parser=EE,kE.parser=EE.parse,kE.Renderer=wE,kE.TextRenderer=TE,kE.Lexer=CE,kE.lexer=CE.lex,kE.Tokenizer=SE,kE.Hooks=DE,kE.parse=kE,kE.options,kE.setOptions,kE.walkTokens,kE.parseInline,EE.parse,CE.lex;function jE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function ME(e){if(Array.isArray(e))return e}function NE(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function PE(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
293
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function FE(e,t){return ME(e)||NE(e,t)||IE(e,t)||PE()}function IE(e,t){if(e){if(typeof e==`string`)return jE(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?jE(e,t):void 0}}var LE=Object.entries,RE=Object.setPrototypeOf,zE=Object.isFrozen,BE=Object.getPrototypeOf,VE=Object.getOwnPropertyDescriptor,HE=Object.freeze,UE=Object.seal,WE=Object.create,GE=typeof Reflect<`u`&&Reflect,KE=GE.apply,qE=GE.construct;HE||=function(e){return e},UE||=function(e){return e},KE||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},qE||=function(e){return new e(...[...arguments].slice(1))};var JE=mD(Array.prototype.forEach),YE=mD(Array.prototype.lastIndexOf),XE=mD(Array.prototype.pop),ZE=mD(Array.prototype.push),QE=mD(Array.prototype.splice),$E=Array.isArray,eD=mD(String.prototype.toLowerCase),tD=mD(String.prototype.toString),nD=mD(String.prototype.match),rD=mD(String.prototype.replace),iD=mD(String.prototype.indexOf),aD=mD(String.prototype.trim),oD=mD(Number.prototype.toString),sD=mD(Boolean.prototype.toString),cD=typeof BigInt>`u`?null:mD(BigInt.prototype.toString),lD=typeof Symbol>`u`?null:mD(Symbol.prototype.toString),uD=mD(Object.prototype.hasOwnProperty),dD=mD(Object.prototype.toString),fD=mD(RegExp.prototype.test),pD=hD(TypeError);function mD(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return KE(e,t,n)}}function hD(e){return function(){return qE(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:eD;if(RE&&RE(e,null),!$E(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(zE(t)||(t[r]=e),i=e)}e[i]=!0}return e}function gD(e){for(let t=0;t<e.length;t++)uD(e,t)||(e[t]=null);return e}function _D(e){let t=WE(null);for(let r of LE(e)){var n=FE(r,2);let i=n[0],a=n[1];uD(e,i)&&(t[i]=$E(a)?gD(a):a&&typeof a==`object`&&a.constructor===Object?_D(a):a)}return t}function vD(e){switch(typeof e){case`string`:return e;case`number`:return oD(e);case`boolean`:return sD(e);case`bigint`:return cD?cD(e):`0`;case`symbol`:return lD?lD(e):`Symbol()`;case`undefined`:return dD(e);case`function`:case`object`:{if(e===null)return dD(e);let t=e,n=yD(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:dD(e)}return dD(e)}default:return dD(e)}}function yD(e,t){for(;e!==null;){let n=VE(e,t);if(n){if(n.get)return mD(n.get);if(typeof n.value==`function`)return mD(n.value)}e=BE(e)}function n(){return null}return n}function bD(e){try{return fD(e,``),!0}catch{return!1}}var xD=HE(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),SD=HE(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),CD=HE([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),wD=HE([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),TD=HE(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),ED=HE([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),DD=HE([`#text`]),OD=HE(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),kD=HE(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),AD=HE(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),jD=HE([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),MD=UE(/{{[\w\W]*|^[\w\W]*}}/g),ND=UE(/<%[\w\W]*|^[\w\W]*%>/g),PD=UE(/\${[\w\W]*/g),FD=UE(/^data-[\-\w.\u00B7-\uFFFF]+$/),ID=UE(/^aria-[\-\w]+$/),LD=UE(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),RD=UE(/^(?:\w+script|data):/i),zD=UE(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),BD=UE(/^html$/i),VD=UE(/^[a-z][.\w]*(-[.\w]+)+$/i),HD=UE(/<[/\w!]/g),UD=UE(/<[/\w]/g),WD=UE(/<\/no(script|embed|frames)/i),GD=UE(/\/>/i),KD={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},qD=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],JD=HE($({},qD)),YD=function(){let e={};return JE(qD,t=>{e[t]=UE(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),HE(e)}(),XD=function(){return typeof window>`u`?null:window},ZD=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},QD=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},$D=function(e,t,n,r){return uD(e,t)&&$E(e[t])?$(r.base?_D(r.base):{},e[t],r.transform):n},eO=function(e,t,n){let r=uD(e,t)?e[t]:void 0;return r&&typeof r==`object`?_D(r):n()};function tO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:XD(),t=e=>tO(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==KD.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=yD(d,`cloneNode`),p=yD(d,`remove`),m=yD(d,`removeAttributeNode`),h=yD(d,`nextSibling`),g=yD(d,`childNodes`),_=yD(d,`parentNode`),v=yD(d,`shadowRoot`),y=yD(d,`attributes`),b=o&&o.prototype?yD(o.prototype,`nodeType`):null,x=o&&o.prototype?yD(o.prototype,`nodeName`):null,S=o&&o.prototype?yD(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let ee,T=``,E,te=!1,D=0,ne=function(){if(D>0)throw pD(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},re=function(e){ne(),D++;try{return ee.createHTML(e)}finally{D--}},ie=function(e){ne(),D++;try{return ee.createScriptURL(e)}finally{D--}},ae=function(){return te||=(E=ZD(u,i),!0),E},oe=n,se=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,ue=oe.getElementsByTagName,de=r.importNode,O=QD();t.isSupported=typeof LE==`function`&&typeof _==`function`&&se&&se.createHTMLDocument!==void 0;let fe=MD,pe=ND,me=PD,he=FD,ge=ID,_e=RD,ve=zD,ye=VD,be=LD,xe=null,Se=$({},[...xD,...SD,...CD,...TD,...DD]),k=null,Ce=$({},[...OD,...kD,...AD,...jD]),we=Object.seal(WE(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ee=null,A=Object.seal(WE(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),De=!0,Oe=!0,ke=!1,Ae=!0,je=!1,Me=!0,Ne=!1,Pe=!1,Fe=null,Ie=null,Le=!1,Re=!1,ze=!1,j=!1,Be=!0,Ve=!1,He=`user-content-`,Ue=!0,We=!1,Ge={},M=null,Ke=$({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),qe=null,Je=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ye=null,Xe=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ze=`http://www.w3.org/1998/Math/MathML`,Qe=`http://www.w3.org/2000/svg`,$e=`http://www.w3.org/1999/xhtml`,et=$e,tt=!1,nt=null,rt=$({},[Ze,Qe,$e],tD),it=HE([`mi`,`mo`,`mn`,`ms`,`mtext`]),at=$({},it),ot=HE([`annotation-xml`]),st=$({},ot),ct=$({},[`title`,`style`,`font`,`a`,`script`]),lt=null,ut=[`application/xhtml+xml`,`text/html`],dt=null,ft=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ft&&ft===e)return;(!e||typeof e!=`object`)&&(e={}),e=_D(e),lt=ut.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,dt=lt===`application/xhtml+xml`?tD:eD,xe=$D(e,`ALLOWED_TAGS`,Se,{transform:dt}),k=$D(e,`ALLOWED_ATTR`,Ce,{transform:dt}),nt=$D(e,`ALLOWED_NAMESPACES`,rt,{transform:tD}),Ye=$D(e,`ADD_URI_SAFE_ATTR`,Xe,{transform:dt,base:Xe}),qe=$D(e,`ADD_DATA_URI_TAGS`,Je,{transform:dt,base:Je}),M=$D(e,`FORBID_CONTENTS`,Ke,{transform:dt}),Te=$D(e,`FORBID_TAGS`,_D({}),{transform:dt}),Ee=$D(e,`FORBID_ATTR`,_D({}),{transform:dt}),Ge=uD(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?_D(e.USE_PROFILES):e.USE_PROFILES:!1,De=e.ALLOW_ARIA_ATTR!==!1,Oe=e.ALLOW_DATA_ATTR!==!1,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,ze=e.RETURN_DOM_FRAGMENT||!1,j=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ve=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,We=e.IN_PLACE||!1,be=bD(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:LD,et=typeof e.NAMESPACE==`string`?e.NAMESPACE:$e,at=eO(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>$({},it)),st=eO(e,`HTML_INTEGRATION_POINTS`,()=>$({},ot));let t=eO(e,`CUSTOM_ELEMENT_HANDLING`,()=>WE(null));if(we=WE(null),uD(t,`tagNameCheck`)&&mt(t.tagNameCheck)&&(we.tagNameCheck=t.tagNameCheck),uD(t,`attributeNameCheck`)&&mt(t.attributeNameCheck)&&(we.attributeNameCheck=t.attributeNameCheck),uD(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(we.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),UE(we),je&&(Oe=!1),ze&&(Re=!0),Ge&&(xe=$({},DD),k=WE(null),Ge.html===!0&&($(xe,xD),$(k,OD)),Ge.svg===!0&&($(xe,SD),$(k,kD),$(k,jD)),Ge.svgFilters===!0&&($(xe,CD),$(k,kD),$(k,jD)),Ge.mathMl===!0&&($(xe,TD),$(k,AD),$(k,jD))),A.tagCheck=null,A.attributeCheck=null,uD(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?A.tagCheck=e.ADD_TAGS:$E(e.ADD_TAGS)&&(xe===Se&&(xe=_D(xe)),$(xe,e.ADD_TAGS,dt))),uD(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?A.attributeCheck=e.ADD_ATTR:$E(e.ADD_ATTR)&&(k===Ce&&(k=_D(k)),$(k,e.ADD_ATTR,dt))),uD(e,`ADD_FORBID_CONTENTS`)&&$E(e.ADD_FORBID_CONTENTS)&&(M===Ke&&(M=_D(M)),$(M,e.ADD_FORBID_CONTENTS,dt)),Ue&&(xe[`#text`]=!0),Ne&&$(xe,[`html`,`head`,`body`]),xe.table&&($(xe,[`tbody`]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw pD(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw pD(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=ee;ee=e.TRUSTED_TYPES_POLICY;try{T=re(``)}catch(e){throw ee=t,e}}else e.TRUSTED_TYPES_POLICY===null?(ee=void 0,T=``):(ee===void 0&&(ee=ae()),ee&&typeof T==`string`&&(T=re(``)));HE&&HE(e),ft=e},gt=$({},[...SD,...CD,...wD]),_t=$({},[...TD,...ED]),vt=function(e,t,n){return t.namespaceURI===$e?e===`svg`:t.namespaceURI===Ze?e===`svg`&&(n===`annotation-xml`||at[n]):!!gt[e]},yt=function(e,t,n){return t.namespaceURI===$e?e===`math`:t.namespaceURI===Qe?e===`math`&&st[n]:!!_t[e]},bt=function(e,t,n){return t.namespaceURI===Qe&&!st[n]||t.namespaceURI===Ze&&!at[n]?!1:!_t[e]&&(ct[e]||!gt[e])},xt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:et,tagName:`template`});let n=eD(e.tagName),r=eD(t.tagName);return nt[e.namespaceURI]?e.namespaceURI===Qe?vt(n,t,r):e.namespaceURI===Ze?yt(n,t,r):e.namespaceURI===$e?bt(n,t,r):!!(lt===`application/xhtml+xml`&&nt[e.namespaceURI]):!1},St=function(e){ZE(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw pD(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Ct=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},wt=function(e){Dt(e);let t=g(e);if(t){let e=[];JE(t,t=>{ZE(e,t)}),JE(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&Ct(e,r,i)}},Tt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}ZE(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(Re||ze)try{St(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Et=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||k[dt(i)]||Ct(e,r,i)}},Dt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===KD.element&&Et(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Ot=function(e,t){return Me?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},kt=function(e){if(!Me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===KD.processingInstruction||n===KD.comment&&fD(UD,e.data)){try{p(e)}catch{}continue}if(n===KD.element){let t=e,n=dt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Ot(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},At=function(e){let t=null,r=null;if(Le)e=`<remove></remove>`+e;else{let t=nD(e,/^[\r\n\t ]+/);r=t&&t[0]}lt===`application/xhtml+xml`&&et===$e&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=ee?re(e):e;if(et===$e)try{t=new l().parseFromString(i,lt)}catch{}if(!t||!t.documentElement){t=se.createDocument(et,`template`,null);try{t.documentElement.innerHTML=tt?T:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),et===$e?ue.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},jt=function(e){let t=S?S(e):e.ownerDocument;return ce.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Mt=function(e){return e=rD(e,fe,` `),e=rD(e,pe,` `),e=rD(e,me,` `),e},Nt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ce.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Mt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&JE(i,e=>{Ft(e.content)&&Nt(e.content)})},Pt=function(e){let t=x?x(e):null;return typeof t!=`string`||dt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Ft=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===KD.documentFragment}catch{return!1}},It=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Lt(e,n,r){e.length!==0&&JE(e,e=>{e.call(t,n,r,ft)})}let Rt=function(e,t){return!!(Me&&e.hasChildNodes()&&!It(e.firstElementChild)&&fD(HD,e.textContent)&&fD(HD,e.innerHTML)||Me&&e.namespaceURI===$e&&JD[t]&&(It(e.firstElementChild)||typeof e.textContent==`string`&&fD(YD[t],e.textContent))||e.nodeType===KD.processingInstruction||Me&&e.nodeType===KD.comment&&fD(UD,e.data))},zt=function(e,t){return e instanceof RegExp?fD(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Bt=function(e,t,n){if(!Te[t]&&Kt(t)&&zt(we.tagNameCheck,t))return!1;if(Ue&&!M[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return St(e),!0},Vt=function(e,t,n,r){return e.length===0?t:t===n||t===r?_D(t):t},Ht=function(e,t){return e===t||_(e)!==null?!1:(We&&Dt(e),!0)},Ut=function(e,n){if(Lt(O.beforeSanitizeElements,e,null),Ht(e,n))return!0;if(Pt(e))return St(e),!0;let r=dt(w(e));if(xe=Vt(O.uponSanitizeElement,xe,Se,Fe),Lt(O.uponSanitizeElement,e,{tagName:r,allowedTags:xe}),Ht(e,n))return!0;if(Rt(e,r))return St(e),!0;if(Te[r]||!(A.tagCheck instanceof Function&&A.tagCheck(r))&&!xe[r]){let t=Bt(e,r,n);return t===!1&&Lt(O.afterSanitizeElements,e,null),t}if(C(e)===KD.element&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&fD(WD,e.innerHTML))return St(e),!0;if(je&&e.nodeType===KD.text){let n=Mt(e.textContent);e.textContent!==n&&(ZE(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Lt(O.afterSanitizeElements,e,null),!1},Wt=function(e,t,r){if(Ee[t]||Ot(t,e)||Be&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;let i=k[t]||A.attributeCheck instanceof Function&&A.attributeCheck(t,e);return Oe&&fD(he,t)||De&&fD(ge,t)?!0:i?Ye[t]||fD(be,rD(r,ve,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&iD(r,`data:`)===0&&qe[e]||ke&&!fD(_e,rD(r,ve,``))?!0:!r:Kt(e)&&zt(we.tagNameCheck,e)&&zt(we.attributeNameCheck,t,e)||t===`is`&&we.allowCustomizedBuiltInElements&&zt(we.tagNameCheck,r)},Gt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Kt=function(e){return!Gt[eD(e)]&&fD(ye,e)},qt=function(e,t,n,r){if(ee&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return re(r);case`TrustedScriptURL`:return ie(r)}return r},Jt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Pt(e)||(St(e),!1)}catch{return Tt(t,e),!1}},Yt=function(e){Lt(O.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||Pt(e))return;k=Vt(O.uponSanitizeAttribute,k,Ce,Ie);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:k,forceKeepAttr:void 0},i=n.length,a=dt(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=dt(s),d=l,f=s===`value`?d:aD(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,Lt(O.uponSanitizeAttribute,e,r),f=r.attrValue,Ve&&(u===`id`||u===`name`)&&iD(f,He)!==0&&(Tt(s,e,o),f=He+f,p=!0),Me&&fD(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){Tt(s,e,o);continue}if(u===`attributename`&&nD(f,`href`)){Tt(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){Tt(s,e,o);continue}if(!Ae&&fD(GD,f)){Tt(s,e,o);continue}if(je&&(f=Mt(f)),!Wt(a,u,f)){Tt(s,e,o);continue}f=qt(a,u,c,f),f!==d&&Jt(e,s,c,f)&&p&&XE(t.removed)}}Lt(O.afterSanitizeAttributes,e,null)},Xt=function(e){let t=null,n=jt(e);for(Lt(O.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Lt(O.uponSanitizeShadowNode,t,null),Ut(t,e),Yt(t),Ft(t.content)&&Xt(t.content),C(t)===KD.element){let e=v(t);Ft(e)&&(Zt(e),Xt(e))}Lt(O.afterSanitizeShadowDOM,e,null)},Zt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Xt(e.shadow);continue}let n=e.node,r=C(n)===KD.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&dt(e)===`template`){let e=n.content;Ft(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Ft(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(tt=!e,tt&&(e=`<!-->`),typeof e!=`string`&&!It(e)&&(e=vD(e),typeof e!=`string`))throw pD(`dirty is not a string, aborting`);if(!t.isSupported)return e;Pe?(xe=Fe,k=Ie):ht(n),(O.uponSanitizeElement.length>0||O.uponSanitizeAttribute.length>0)&&(xe=_D(xe)),O.uponSanitizeAttribute.length>0&&(k=_D(k)),t.removed=[];let c=We&&typeof e!=`string`&&It(e);if(c){kt(e);let t=w(e);if(typeof t==`string`){let n=dt(t);if(!xe[n]||Te[n])throw wt(e),pD(`root node is forbidden and cannot be sanitized in-place`)}if(Pt(e))throw wt(e),pD(`root node is clobbered and cannot be sanitized in-place`);try{Zt(e)}catch(t){throw wt(e),t}}else if(It(e))i=At(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===KD.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Zt(i);else{if(!Re&&!je&&!Ne&&e.indexOf(`<`)===-1)return ee&&j?re(e):e;if(i=At(e),!i)return Re?null:j?T:``}i&&Le&&St(i.firstChild);let l=c?e:i;try{let e=jt(l);for(;o=e.nextNode();)Ut(o,l),Yt(o),Ft(o.content)&&Xt(o.content)}catch(n){throw c&&(wt(e),JE(t.removed,e=>{e.element&&Dt(e.element)})),n}if(c)return JE(t.removed,e=>{e.element&&Dt(e.element)}),je&&Nt(e),e;if(Re){if(je&&Nt(i),ze)for(s=le.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(k.shadowroot||k.shadowrootmode)&&(s=de.call(r,s,!0)),s}let u=Ne?i.outerHTML:i.innerHTML;return Ne&&xe[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&fD(BD,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
294
- `+u),je&&(u=Mt(u)),ee&&j?re(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(e),Pe=!0,Fe=xe,Ie=k},t.clearConfig=function(){ft=null,Pe=!1,Fe=null,Ie=null,ee=E,T=``},t.isValidAttribute=function(e,t,n){ft||ht({});let r=dt(e),i=dt(t);return Wt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&uD(O,e)&&ZE(O[e],t)},t.removeHook=function(e,t){if(uD(O,e)){if(t!==void 0){let n=YE(O[e],t);return n===-1?void 0:QE(O[e],n,1)[0]}return XE(O[e])}},t.removeHooks=function(e){uD(O,e)&&(O[e]=[])},t.removeAllHooks=function(){O=QD()},t}var nO=tO(),rO=`png|jpe?g|gif|webp|bmp|svg|avif|ico|tiff?`,iO=`(?:file:\\/\\/(?:(?:localhost)?\\/(?=[^\\s])|[A-Za-z]:[\\\\/]|[^\\/\\s:]+\\/)|\\/(?!\\/)(?!\\s)|[A-Za-z]:[\\\\/](?!\\s)|\\\\\\\\[^\\\\/\\s]+[\\\\/](?!\\s))`,aO=`(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?`,oO=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?(${iO}.+?\\.(?:${rO}))\\s*$`,`i`),sO=RegExp(`(^|[\\s(「『【>])(${iO}[^\`"'<>()\\[\\]{}\\s()「」『』【】,。;、!?:…·]+?\\.(?:${rO}))(?=\$|[\\s))」』】.,;:!?,。;、!?])`,`gi`),cO=/^\s*(?:```|~~~)/,lO=RegExp(`\\.(?:${rO})`,`i`);function uO(e){return oO.test(e)||yO.test(e)||e.match(CO)!=null||e.match(wO)!=null}function dO(e){let t=[];for(let n=0;n<e.length;){if(!cO.test(e[n])){t.push(e[n]),n++;continue}let r=n+1;for(;r<e.length&&!cO.test(e[r]);)r++;let i=e.slice(n+1,r);if(i.filter(uO).length>=2){t.push(...i),n=r<e.length?r+1:e.length;continue}t.push(e[n]),n++}return t}var fO=/^\/(?:slices|assets|icons|favicon|__)(?:[/.]|$)/i,pO=e=>fO.test(String(e)),mO=e=>/[*{}]/.test(String(e)),hO=e=>pO(e)||mO(e),gO=/^(?:…|\.{3,})[\\/]/,_O=`(?:…|\\.{3,})[\\\\/][^\\s\`"'<>()「」『』【】,。;、!?:…]+?\\.(?:${rO})`,vO=RegExp(`(^|[\\s(「『【>→::])(\`?)(${_O})(\`?)`,`gi`),yO=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)${aO}(${_O})\\s*$`,`i`);function bO(e,t){let n=String(e).replace(gO,``).replace(/\\/g,`/`);if(mO(n))return null;let r=`/${n.replace(/^\/+/,``)}`;return pO(r)?`![${TO(r)}](${OO(r)} "${DO(e)}")`:NO(e,t)}var xO=/!\[([^\]]*)\]\(\s*(data:[^)]*)\)/gi;function SO(e){let t=String(e??``);return!t||!/!\[[^\]]*\]\(\s*data:/i.test(t)?t:t.replace(xO,(e,t,n)=>{let r=/^data:([^;,]*)((?:;[^,]*)*),([\s\S]*)$/i.exec(n),i=String(t||``).trim()||`未命名`;return r?String(r[3]||``).trim()?e:`\`⚠ 图片缺失:${i}(data URI 载荷为空)\``:`\`⚠ 图片缺失:${i}(data URI 结构异常)\``})}var CO=RegExp(`(!\\[[^\\]]*\\]\\()\\s*(${iO}(?:[^\\s?#()]|\\([^\\s()]*\\))+?\\.(?:${rO}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`),wO=RegExp(`(!\\[[^\\]]*\\]\\()\\s*([^\\s()/?#\\\\](?:[^\\s?#()]|\\([^\\s()]*\\))*?\\.(?:${rO}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`);function TO(e){return EO(e).replace(/[[\]!]/g,``).trim().slice(0,120)||`预览图`}function EO(e){let t=String(e??``).trim();if(!t||/^(?:data|blob):/i.test(t))return``;let n=t;try{let e=new URL(t,`http://localhost/`);n=e.searchParams.get(`path`)||e.pathname||t,n=decodeURIComponent(n)}catch{try{n=decodeURIComponent(n)}catch{}}return(n.split(/[\\/]/).pop()||``).trim()}function DO(e){return String(e).replace(/"/g,`'`)}function OO(e){return String(e).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/ /g,`%20`)}function kO(e){let t=String(e);if(!t.includes(`%`))return t;try{return decodeURIComponent(t)}catch{return t}}function AO(e){let t=String(e);if(!/^file:\/\//i.test(t))return t;let n=t.replace(/^file:\/\//i,``),r=/^(?:localhost)?(\/.*)$/i.exec(n);if(r){let e=r[1];return/^\/[A-Za-z]:[\\/]/.test(e)?e.slice(1):e}if(/^[A-Za-z]:[\\/]/.test(n))return n;let i=/^([^\/\s:]+)\/(.*)$/.exec(n);return i?`\\\\${i[1]}\\${i[2].replace(/\//g,`\\`)}`:t}function jO(e,t){let n=AO(kO(e));if(hO(n))return null;let r=``;try{r=t(n)}catch{return null}return r?OO(r):null}function MO(e,t){let n=kO(e).replace(/\\/g,`/`);if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(n)||n.startsWith(`.`)||n.split(`/`).includes(`..`))return null;let r=``;try{r=t(n)}catch{return null}return r?OO(r):null}function NO(e,t){let n=AO(e);if(hO(n))return null;let r=``;try{r=t(n)}catch{return null}if(!r)return null;let i=OO(r);return`![${TO(n)}](${i} "${DO(n)}")`}function PO(e,t){let n=SO(e);if(!n||typeof t!=`function`||!lO.test(n))return n;let r=!1;return dO(n.split(`
295
- `)).map(e=>{if(cO.test(e))return r=!r,e;if(r||!lO.test(e))return e;let n=e.match(oO);if(n){let r=NO(n[2],t);return r===null?e:n[1]+r}let i=e.match(yO);if(i){let n=bO(i[2],t);return n===null?e:i[1]+n}return e.replace(CO,(e,n,r)=>n+(jO(r,t)??r)).replace(wO,(e,n,r)=>n+(MO(r,t)??r)).replace(sO,(e,n,r)=>n+(NO(r,t)??r)).replace(vO,(e,n,r,i)=>{let a=bO(i,t);return a===null?e:n+a})}).join(`
296
- `)}(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){(e.language===`jsx`||e.language===`tsx`)&&s(e.tokens)})})(Prism),kE.setOptions({gfm:!0,breaks:!0}),nO.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&e.getAttribute(`href`)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)),e.tagName===`IMG`&&(e.setAttribute(`loading`,`lazy`),e.setAttribute(`decoding`,`async`))});var FO={js:`javascript`,mjs:`javascript`,cjs:`javascript`,node:`javascript`,ts:`typescript`,sh:`bash`,shell:`bash`,zsh:`bash`,console:`bash`,html:`markup`,vue:`markup`,xml:`markup`,svg:`markup`,jsonc:`json`,json5:`json`,py:`python`,yml:`yaml`};function IO(e){let t=String(e||``).trim().toLowerCase();if(!t)return``;let n=FO[t]||t;return D_.default.languages[n]?n:``}function LO(e){let t=String(e??``);if(!t.trim())return``;let n=``;try{n=kE.parse(t)}catch{n=`<p>${t.replace(/[&<>]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`})[e])}</p>`}return nO.sanitize(n,{ADD_ATTR:[`target`,`rel`]})}function RO(e){if(!(!e||!e.querySelectorAll))for(let t of e.querySelectorAll(`pre`)){let e=t.querySelector(`code`);if(!e)continue;let n=IO((e.className.match(/language-([\w+-]+)/)||[])[1]||``);if(n&&e.className.indexOf(`language-`)<0&&(e.className=`language-${n}`),n&&!e.dataset.mdHighlighted){try{D_.default.highlightElement(e)}catch{}e.dataset.mdHighlighted=`1`}if(t.dataset.mdCode)continue;t.dataset.mdCode=`1`;let r=document.createElement(`div`);r.className=`md-code`;let i=document.createElement(`div`);i.className=`md-code__bar`;let a=document.createElement(`span`);a.className=`md-code__lang`,a.textContent=n||`text`;let o=document.createElement(`button`);o.type=`button`,o.className=`md-code__copy`,o.textContent=`复制`,o.addEventListener(`click`,async()=>{await op(e.textContent||``)?(o.textContent=`已复制`,o.classList.add(`is-ok`)):o.textContent=`复制失败`,setTimeout(()=>{o.textContent=`复制`,o.classList.remove(`is-ok`)},1600)}),i.append(a,o),t.parentNode?.insertBefore(r,t),r.append(i,t)}}function zO(e){if(!(!e||!e.querySelectorAll))for(let t of e.querySelectorAll(`pre code[data-md-highlighted]`))delete t.dataset.mdHighlighted}function BO(e){return e?e.nodeType===3?!e.textContent.trim():e.nodeType===1&&e.tagName===`BR`:!1}function VO(e){if(e.length>1)return`${e.length} 张图像`;let t=e[0],n=(t.getAttribute(`alt`)||``).trim();if(n)return n;let r=(t.getAttribute(`title`)||``).trim();return(r?(r.split(/[\\/]/).pop()||``).trim():``)||EO(t.getAttribute(`src`))||`1 张图像`}function HO(e){let t=document.createElement(`div`);t.className=`md-imggroup`,t.dataset.mdImggroup=`1`;let n=document.createElement(`button`);n.type=`button`,n.className=`md-imggroup__head`,n.setAttribute(`aria-expanded`,`false`),n.innerHTML=`<svg class="md-imggroup__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-images" /></svg><span class="md-imggroup__label"></span><svg class="md-imggroup__chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-chevron-right" /></svg>`,n.querySelector(`.md-imggroup__label`).textContent=VO(e);let r=document.createElement(`div`);return r.className=`md-imggroup__body`,r.hidden=!0,n.addEventListener(`click`,()=>{let e=r.hidden;r.hidden=!e,t.classList.toggle(`is-open`,e),n.setAttribute(`aria-expanded`,e?`true`:`false`)}),t.append(n,r),{group:t,body:r}}function UO(e){if(e.dataset.mdImgFallback)return;e.dataset.mdImgFallback=`1`;let t=()=>{if(!e.isConnected||!(e.complete&&e.naturalWidth===0))return;let t=e.getAttribute(`src`)||``;if(/\.svgz?(?:[?#]|$)/i.test(t)||/^data:image\/svg/i.test(t))return;let n=EO(t)||(e.getAttribute(`alt`)||``).trim()||`未知图片`,r=document.createElement(`span`);r.className=`md-imgfail`,r.textContent=`图片加载失败:${n}`,r.title=t,e.replaceWith(r);let i=r.closest(`.md-imggroup__body`);if(i&&!i.querySelector(`img`)){let e=r.closest(`[data-md-imggroup]`);if(e){let t=e.querySelector(`.md-imggroup__head`);t&&t.remove(),e.classList.add(`is-open`)}}};e.addEventListener(`error`,t,{once:!0}),t()}function WO(e){if(!e||!e.querySelectorAll)return;let t=[...e.querySelectorAll(`img`)];for(let e of t)UO(e);for(let e of t){if(e.closest(`[data-md-imggroup]`))continue;let t=[e],n=e.nextSibling;for(;n;){if(BO(n)){n=n.nextSibling;continue}if(n.tagName===`IMG`&&!n.closest(`[data-md-imggroup]`)){t.push(n),n=n.nextSibling;continue}break}let{group:r,body:i}=HO(t);e.parentNode.insertBefore(r,e);for(let e of t)i.append(e)}}var GO={name:`MarkdownBody`,props:{source:{type:String,default:``},streaming:{type:Boolean,default:!1}},data(){return{html:``,_raf:0}},watch:{source:{immediate:!0,handler(){this.scheduleRender()}},streaming(e){e||this.renderNow()}},beforeUnmount(){this._raf&&cancelAnimationFrame(this._raf),this._raf=0},methods:{scheduleRender(){if(!this.streaming){this.renderNow();return}this._raf||=requestAnimationFrame(()=>{this._raf=0,this.renderNow()})},renderNow(){this._raf&&=(cancelAnimationFrame(this._raf),0),this.html=LO(this.source),this.$nextTick(()=>{let e=this.$refs.bodyEl;e&&(zO(e),RO(e),WO(e))})}}},KO=[`innerHTML`];function qO(e,t,n,r,i,a){return B(),V(z,null,[K(` 模型输出经 marked 解析 + DOMPurify 消毒后注入;代码块由 enhanceCodeBlocks 补高亮与复制按钮 `),U(`div`,{ref:`bodyEl`,class:`md-body`,innerHTML:i.html},null,8,KO)],2112)}var JO=X(GO,[[`render`,qO],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/MarkdownBody.vue`]]),YO={card_list:`列出卡片`,card_read:`读取卡片`,card_write:`写入卡片`,card_validate:`校验卡片`,card_render_status:`渲染状态`,card_node_models:`组件模型`,card_screenshot:`截图预览`,card_sync:`同步远端卡片`,card_save:`推送到远端`,card_slice_upload:`上传切图`,card_import_meta:`来源侧车`,card_route_input:`输入路由`,card_scaffold:`生成骨架`,card_add_component:`添加组件`,card_history:`编辑历史`,card_rollback:`回滚版本`,skill_read:`读技能文档`,skill_exec:`跑技能脚本`,card_grep:`定位卡片字段`,card_patch:`最小改写卡片`,fs_read:`读文件`,fs_list:`列目录`,fs_write:`写草稿文件`,fs_copy:`复制文件`,shell_exec:`本地命令`};function XO(e){return YO[e]||e||`工具`}function ZO(e){let t=e&&e.args||{};return`${typeof t.script==`string`?t.script:``} ${Array.isArray(t.args)?t.args.join(` `):typeof t.command==`string`?t.command:``} ${typeof t.name==`string`?t.name:``}`.toLowerCase()}var QO=[{order:6,id:`S6`,label:`收尾门禁`,hit:(e,t)=>/check_fidelity/.test(t)||/iterate/.test(t)&&/--gate/.test(t)},{order:5,id:`S5`,label:`像素自循环`,hit:(e,t)=>/iterate|diff_bands/.test(t)||e===`card_screenshot`},{order:4,id:`S4`,label:`组件填充`,hit:e=>e===`card_add_component`||e===`card_patch`||e===`card_write`},{order:3,id:`S3`,label:`骨架落盘`,hit:(e,t)=>e===`card_scaffold`||/expand_ir/.test(t)||e===`fs_write`&&/\.ir\.json/.test(t)},{order:2,id:`S2`,label:`设计稿审计`,hit:(e,t)=>/spec_tree|sketch_spec|design_sample|audit_|slice_/.test(t)},{order:1,id:`S1`,label:`输入路由`,hit:e=>e===`card_route_input`}];function $O(e){let t=Math.max(0,Math.round(Number(e||0)/1e3));if(t<60)return`${t} 秒`;let n=Math.floor(t/60);return n<60?`${n} 分 ${t%60} 秒`:`${Math.floor(n/60)} 小时 ${n%60} 分`}function ek(e){let t=Number(e||0);if(!t)return``;let n=new Date(t),r=e=>String(e).padStart(2,`0`);return`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`}function tk(e){let t=Number(e||0);return t>0?`+${$O(t)}`:``}function nk(e,t=0){let n=Number(e&&e.startedAt)||0;if(!n)return 0;let r=Number(e&&e.ms)||0;if(r>0)return n+r;let i=Number(t)||0;return i>n?i:0}function rk(e){let t=e&&e.toolName||``,n=ZO(e);for(let e of QO)if(e.hit(t,n))return e;return null}var ik=new Set([`card_write`,`card_patch`,`card_scaffold`,`card_add_component`,`fs_write`,`fs_copy`,`card_save`,`card_sync`,`card_slice_upload`]),ak=new Set([`card_read`,`card_list`,`card_node_models`,`card_grep`,`card_history`,`card_validate`,`card_render_status`,`fs_read`,`fs_list`,`skill_read`]);function ok(e){let t=e&&e.toolName||``;return e&&e.error||ik.has(t)||t===`skill_exec`||t===`shell_exec`||t===`card_screenshot`?!0:!ak.has(t)}function sk(e){if(e==null||e===``)return null;if(typeof e==`object`)return e;let t=String(e);try{return JSON.parse(t)}catch{}let n=t.indexOf(`{`),r=t.lastIndexOf(`}`);if(n>=0&&r>n)try{return JSON.parse(t.slice(n,r+1))}catch{return null}return null}function ck(e){let t=ZO(e);if(!/--gate|check_fidelity/.test(t))return null;let n=sk(e&&e.result),r=n&&typeof n==`object`?n.gate:null;if(r&&typeof r.passed==`boolean`)return{passed:r.passed,verdict:String(r.verdict||``)};let i=String(e&&e.result||``);if(!/"passed"\s*:/.test(i))return null;let a=/"passed"\s*:\s*(true|false)/.exec(i),o=/"verdict"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(i);return a?{passed:a[1]===`true`,verdict:o?o[1].replace(/\\n/g,` `):``}:null}var lk=/\s#([^\s#]+)\s*$/;function uk(e){let t=String(e??``),n=lk.exec(t);return n?{text:t.slice(0,n.index).trim(),cid:n[1]}:{text:t,cid:``}}var dk=12;function fk(e){let t=e&&e.toolName||``,n=sk(e&&e.result);if(!n||typeof n!=`object`)return null;let r=t===`card_validate`?n:n.verify&&n.verify.validate;if(!r||typeof r!=`object`||!Array.isArray(r.errors))return null;let i=Array.isArray(r.warnings)?r.warnings:[],a=[...r.errors.map(e=>({level:`error`,...uk(e)})),...i.map(e=>({level:`warn`,...uk(e)}))].slice(0,dk);return{ok:r.ok!==!1&&r.errors.length===0,errors:r.errors.length,warnings:i.length,issues:a}}function pk(e){let t=Array.isArray(e)?e:[],n=0,r=0,i=0,a=0,o=null,s=null;for(let e of t){e.error&&a++,ik.has(e.toolName)&&(e.error?r++:n++),e.toolName===`card_screenshot`&&!e.error&&i++;let t=fk(e);t&&(o=t);let c=ck(e);c&&(s=c)}return{total:t.length,writes:n,writeFails:r,shots:i,failed:a,validate:o,gate:s}}var mk={length:`单次输出上限截断:调高「单次输出上限」,或要求 AI 走紧凑 IR 路线(fs_write 写 IR → expand_ir 展开)`,stall:`上游长时间静默:多为网关 / 网络抖动。上下文与已落盘产物都在,重试本轮即可接着做`,empty:`网关连续返回空响应:重试本轮,或检查网关额度 / 换个时间段`,context:`上下文超出网关窗口:后端已自动压缩重试仍失败,建议新开一轮或清理对话记录`,network:`连不上网关:检查网络与 Base URL 后重试本轮`,"rate-limit":`网关限流或额度不足:稍后重试,或换一个 API Key`,auth:`API Key 无效或权限不足:到设置里更新 Key 再重试`,"wrap-failed":`熔断收尾的进度汇总也没拿到:上下文已保留,回复「继续」接着做`,aborted:`本轮已中止:已执行的写入都保留,可从中断处继续`,unknown:`未归类的失败:复制错误原文排查,或换个说法重试本轮`};function hk(e){return{hint:mk[e]||``,action:e===`length`||e===`auth`?`settings`:e===`wrap-failed`||e===`aborted`?`continue`:`retry`}}var gk=/^\s*(\d+)\.\s+(.+?)\s+\((\d+x\d+|\?)\)\s*(.*)$/,_k=/--pick\s+([\d.,~]+)/;function vk(e){if(typeof e!=`string`||!e.includes(`--pick`))return[];let t=[];for(let n of e.split(`
297
- `)){let e=n.match(gk);if(!e)continue;let r=(e[4].match(_k)||[])[1];r&&t.push({no:Number(e[1]),name:e[2].trim(),size:e[3],pick:r})}return t}var yk=/^(\d+)\.(\d+)~(\d+)\.(\d+)$/,bk=/^\d+\.\d+$/;function xk(e){let t=[];for(let n of e||[]){if(!n||!n.pick)continue;let e=String(n.pick),r=e.match(yk),i=r?Number(r[2]):0,a=r?Number(r[4]):0;if(r&&r[1]===r[3]&&a>i){for(let e=i;e<=a;e+=1)t.push({...n,pick:`${r[1]}.${e}`,token:`${r[1]}.${e}`,kind:`card`});t.push({...n,token:`全 ${a-i+1} 张`,kind:`all`});continue}t.push({...n,token:e,kind:bk.test(e)?`card`:`board`})}return t}function Sk(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e]&&t[e].toolCalls;if(Array.isArray(n)){for(let e=n.length-1;e>=0;--e)if(n[e]&&vk(n[e].result).length)return n[e]}}return null}function Ck(e,t=``){if(!e||!e.pick)return``;let n=e.name?`「${e.name}」`:``,r=e.kind===`card`||bk.test(String(e.pick))?`(只建这一张卡,同画板的其它卡不要一起建)`:``,i=t?`落点卡 = 当前卡 ${t}(覆盖它,不是新建;要另建新卡我会直说)。`:``;return`建卡:画板 ${e.no}${n}。${i}参数已选好,照抄重跑:parse_meaxure.py --build --pick ${e.pick}${r}`}var wk={name:`ChatToolRow`,components:{MarkdownBody:JO},props:{tc:{type:Object,required:!0},turnTs:{type:Number,default:0},nowTs:{type:Number,default:0},pickOwner:{type:Object,default:null}},emits:[`approval`,`pick-board`],data(){return{opened:null}},computed:{state(){return this.tc.error?`error`:this.tc.result!==void 0&&this.tc.result!==null?`done`:this.tc.pending?`pending`:`running`},open(){return this.opened===null?!!this.tc.error||this.boardPicks.length>0:this.opened},boardPicks(){return this.pickOwner&&this.tc!==this.pickOwner?[]:xk(vk(this.tc.result))},msText(){let e=this.tc.ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`:``},stampText(){return ek(this.tc.startedAt)},cumText(){let e=nk(this.tc,this.nowTs);return e&&this.turnTs?tk(e-this.turnTs):``},clockText(){return[this.stampText,this.cumText].filter(Boolean).join(` · `)},clockTitle(){let e=[];return this.stampText&&e.push(`开始于 ${this.stampText}`),this.cumText&&e.push(`距本轮开始 ${this.cumText.slice(1)}`),this.msText&&e.push(`本步耗时 ${this.msText}`),e.join(` · `)},approvalCommand(){if(this.tc.command)return String(this.tc.command);let e=this.tc.args||{};return typeof e.command==`string`&&e.command?e.command:this.tc.toolName===`skill_exec`?[e.script,Array.isArray(e.args)?e.args.join(` `):``].filter(Boolean).join(` `):JSON.stringify(e)},argSummary(){if(this.tc.toolName===`skill_exec`&&this.tc.args?.script){let e=[String(this.tc.args.script).replace(/^skills\//,``),(Array.isArray(this.tc.args.args)?this.tc.args.args:[]).map(e=>String(e).replace(/^\/[^\s]{20,}$/,e=>`…/${e.slice(-14)}`)).join(` `)].filter(Boolean).join(` `);return e.length>96?`${e.slice(0,96)}…`:e}let e=this.tc.args||{},t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===``)continue;let e=typeof r==`object`?JSON.stringify(r):String(r);if(t.push(`${n}=${e.length>28?`${e.slice(0,28)}…`:e}`),t.join(` `).length>56)break}let n=t.join(` `);return n.length>72?`${n.slice(0,72)}…`:n},argsSource(){let e=this.tc.args||{};if(!Object.keys(e).length)return``;if(this.tc.toolName===`skill_exec`&&typeof e.script==`string`){if(!this.tc.error)return``;let t=Array.isArray(e.args)?e.args.join(` `):``;return`\`\`\`\n${[e.script,t].filter(Boolean).join(` `)}\n\`\`\``}if(this.tc.toolName===`shell_exec`&&typeof e.command==`string`)return this.tc.error?`\`\`\`\n${e.command}\n\`\`\``:``;let t=``;try{t=JSON.stringify(e,null,2)}catch{t=String(e)}return`\`\`\`json\n${t}\n\`\`\``},resultSource(){let e=this.tc.result;if(e==null||e===``||this.boardPicks.length&&!this.tc.error)return``;let t=typeof e==`string`?e:JSON.stringify(e);try{t=JSON.stringify(JSON.parse(t),null,2)}catch{}t.length>4e3&&(t=`${t.slice(0,4e3)}\n…(已截断)`);let n=`\`\`\`json\n${t}\n\`\`\``;return this.tc.truncated?`${n}\n\n> 结果过长,面板只显示前 4000 字;喂给模型的上下文另有额度,不受此限。`:n}},methods:{toolLabel:XO,toggle(){this.opened=!this.open}}},Tk=[`aria-expanded`],Ek={key:0,class:`aitool__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Dk={key:1,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Ok={key:2,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},kk={class:`aitool__name`},Ak={class:`aitool__args`},jk=[`title`],Mk=[`title`],Nk={key:0,class:`aitool__approve`},Pk=[`title`],Fk={class:`aitool__approve-hint`},Ik={class:`aitool__approve-hint`},Lk=[`title`],Rk={class:`aitool__body`},zk={key:0,class:`aitool__picks`},Bk=[`title`,`aria-label`,`onClick`],Vk={class:`aitool__pick-no`},Hk={class:`aitool__pick-arg`},Uk=[`src`],Wk={key:3,class:`aitool__error`};function Gk(e,t,n,r,i,a){let o=L(`MarkdownBody`);return B(),V(z,null,[K(` 单次工具调用:一行摘要,可展开看参数 / 结果 / 截图。
293
+ `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${bE(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?bE(n,!0):this.parser.parseInline(r),o=xE(e);if(o===null)return a;e=bE(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+bE(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=xE(e);if(i===null)return bE(n);e=i;let a=`<img src="${bE(e)}" alt="${bE(n)}"`;return t&&(a+=` title="${bE(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:bE(e.text)}},PE=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},FE=class e{options;renderer;textRenderer;constructor(e){this.options=e||Qw,this.options.renderer=this.options.renderer||new NE,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new PE}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},IE=class{options;block;constructor(e){this.options=e||Qw}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?ME.lex:ME.lexInline}provideParser(e=this.block){return e?FE.parse:FE.parseInline}},LE=new class{defaults=Zw();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=FE;Renderer=NE;TextRenderer=PE;Lexer=ME;Tokenizer=jE;Hooks=IE;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new NE(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new jE(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new IE;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=IE.passThroughHooks.has(n)?e=>{if(this.defaults.async&&IE.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return ME.lex(e,t??this.defaults)}parser(e,t){return FE.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?ME.lex:ME.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?FE.parse:FE.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?ME.lex:ME.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?FE.parse:FE.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
294
+ Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+bE(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function RE(e,t){return LE.parse(e,t)}RE.options=RE.setOptions=function(e){return LE.setOptions(e),RE.defaults=LE.defaults,$w(RE.defaults),RE},RE.getDefaults=Zw,RE.defaults=Qw;function zE(...e){return LE.use(...e),RE.defaults=LE.defaults,$w(RE.defaults),RE}RE.use=zE,RE.walkTokens=function(e,t){return LE.walkTokens(e,t)},RE.parseInline=LE.parseInline,RE.Parser=FE,RE.parser=FE.parse,RE.Renderer=NE,RE.TextRenderer=PE,RE.Lexer=ME,RE.lexer=ME.lex,RE.Tokenizer=jE,RE.Hooks=IE,RE.parse=RE,RE.options,RE.setOptions,RE.walkTokens,RE.parseInline,FE.parse,ME.lex;function BE(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function VE(e){if(Array.isArray(e))return e}function HE(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t!==0)for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function UE(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
295
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function WE(e,t){return VE(e)||HE(e,t)||GE(e,t)||UE()}function GE(e,t){if(e){if(typeof e==`string`)return BE(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?BE(e,t):void 0}}var KE=Object.entries,qE=Object.setPrototypeOf,JE=Object.isFrozen,YE=Object.getPrototypeOf,XE=Object.getOwnPropertyDescriptor,ZE=Object.freeze,QE=Object.seal,$E=Object.create,eD=typeof Reflect<`u`&&Reflect,tD=eD.apply,nD=eD.construct;ZE||=function(e){return e},QE||=function(e){return e},tD||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},nD||=function(e){return new e(...[...arguments].slice(1))};var rD=CD(Array.prototype.forEach),iD=CD(Array.prototype.lastIndexOf),aD=CD(Array.prototype.pop),oD=CD(Array.prototype.push),sD=CD(Array.prototype.splice),cD=Array.isArray,lD=CD(String.prototype.toLowerCase),uD=CD(String.prototype.toString),dD=CD(String.prototype.match),fD=CD(String.prototype.replace),pD=CD(String.prototype.indexOf),mD=CD(String.prototype.trim),hD=CD(Number.prototype.toString),gD=CD(Boolean.prototype.toString),_D=typeof BigInt>`u`?null:CD(BigInt.prototype.toString),vD=typeof Symbol>`u`?null:CD(Symbol.prototype.toString),yD=CD(Object.prototype.hasOwnProperty),bD=CD(Object.prototype.toString),xD=CD(RegExp.prototype.test),SD=wD(TypeError);function CD(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return tD(e,t,n)}}function wD(e){return function(){return nD(e,[...arguments])}}function $(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:lD;if(qE&&qE(e,null),!cD(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(JE(t)||(t[r]=e),i=e)}e[i]=!0}return e}function TD(e){for(let t=0;t<e.length;t++)yD(e,t)||(e[t]=null);return e}function ED(e){let t=$E(null);for(let r of KE(e)){var n=WE(r,2);let i=n[0],a=n[1];yD(e,i)&&(t[i]=cD(a)?TD(a):a&&typeof a==`object`&&a.constructor===Object?ED(a):a)}return t}function DD(e){switch(typeof e){case`string`:return e;case`number`:return hD(e);case`boolean`:return gD(e);case`bigint`:return _D?_D(e):`0`;case`symbol`:return vD?vD(e):`Symbol()`;case`undefined`:return bD(e);case`function`:case`object`:{if(e===null)return bD(e);let t=e,n=OD(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:bD(e)}return bD(e)}default:return bD(e)}}function OD(e,t){for(;e!==null;){let n=XE(e,t);if(n){if(n.get)return CD(n.get);if(typeof n.value==`function`)return CD(n.value)}e=YE(e)}function n(){return null}return n}function kD(e){try{return xD(e,``),!0}catch{return!1}}var AD=ZE(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),jD=ZE(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),MD=ZE([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),ND=ZE([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),PD=ZE(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),FD=ZE([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),ID=ZE([`#text`]),LD=ZE(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),RD=ZE(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),zD=ZE(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),BD=ZE([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),VD=QE(/{{[\w\W]*|^[\w\W]*}}/g),HD=QE(/<%[\w\W]*|^[\w\W]*%>/g),UD=QE(/\${[\w\W]*/g),WD=QE(/^data-[\-\w.\u00B7-\uFFFF]+$/),GD=QE(/^aria-[\-\w]+$/),KD=QE(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),qD=QE(/^(?:\w+script|data):/i),JD=QE(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),YD=QE(/^html$/i),XD=QE(/^[a-z][.\w]*(-[.\w]+)+$/i),ZD=QE(/<[/\w!]/g),QD=QE(/<[/\w]/g),$D=QE(/<\/no(script|embed|frames)/i),eO=QE(/\/>/i),tO={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},nO=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],rO=ZE($({},nO)),iO=function(){let e={};return rD(nO,t=>{e[t]=QE(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),ZE(e)}(),aO=function(){return typeof window>`u`?null:window},oO=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},sO=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},cO=function(e,t,n,r){return yD(e,t)&&cD(e[t])?$(r.base?ED(r.base):{},e[t],r.transform):n},lO=function(e,t,n){let r=yD(e,t)?e[t]:void 0;return r&&typeof r==`object`?ED(r):n()};function uO(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:aO(),t=e=>uO(e);if(t.version=`3.4.15`,t.removed=[],!e||!e.document||e.document.nodeType!==tO.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=OD(d,`cloneNode`),p=OD(d,`remove`),m=OD(d,`removeAttributeNode`),h=OD(d,`nextSibling`),g=OD(d,`childNodes`),_=OD(d,`parentNode`),v=OD(d,`shadowRoot`),y=OD(d,`attributes`),b=o&&o.prototype?OD(o.prototype,`nodeType`):null,x=o&&o.prototype?OD(o.prototype,`nodeName`):null,S=o&&o.prototype?OD(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let ee,T=``,E,te=!1,D=0,ne=function(){if(D>0)throw SD(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},re=function(e){ne(),D++;try{return ee.createHTML(e)}finally{D--}},ie=function(e){ne(),D++;try{return ee.createScriptURL(e)}finally{D--}},ae=function(){return te||=(E=oO(u,i),!0),E},oe=n,se=oe.implementation,ce=oe.createNodeIterator,le=oe.createDocumentFragment,ue=oe.getElementsByTagName,de=r.importNode,O=sO();t.isSupported=typeof KE==`function`&&typeof _==`function`&&se&&se.createHTMLDocument!==void 0;let fe=VD,pe=HD,me=UD,he=WD,ge=GD,_e=qD,ve=JD,ye=XD,be=KD,xe=null,Se=$({},[...AD,...jD,...MD,...PD,...ID]),k=null,Ce=$({},[...LD,...RD,...zD,...BD]),we=Object.seal($E(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),Te=null,Ee=null,A=Object.seal($E(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),De=!0,Oe=!0,ke=!1,Ae=!0,je=!1,Me=!0,Ne=!1,Pe=!1,Fe=null,Ie=null,Le=!1,Re=!1,ze=!1,j=!1,Be=!0,Ve=!1,He=`user-content-`,Ue=!0,We=!1,Ge={},M=null,Ke=$({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),qe=null,Je=$({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Ye=null,Xe=$({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Ze=`http://www.w3.org/1998/Math/MathML`,Qe=`http://www.w3.org/2000/svg`,$e=`http://www.w3.org/1999/xhtml`,et=$e,tt=!1,nt=null,rt=$({},[Ze,Qe,$e],uD),it=ZE([`mi`,`mo`,`mn`,`ms`,`mtext`]),at=$({},it),ot=ZE([`annotation-xml`]),st=$({},ot),ct=$({},[`title`,`style`,`font`,`a`,`script`]),lt=null,ut=[`application/xhtml+xml`,`text/html`],dt=null,ft=null,pt=n.createElement(`form`),mt=function(e){return e instanceof RegExp||e instanceof Function},ht=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(ft&&ft===e)return;(!e||typeof e!=`object`)&&(e={}),e=ED(e),lt=ut.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,dt=lt===`application/xhtml+xml`?uD:lD,xe=cO(e,`ALLOWED_TAGS`,Se,{transform:dt}),k=cO(e,`ALLOWED_ATTR`,Ce,{transform:dt}),nt=cO(e,`ALLOWED_NAMESPACES`,rt,{transform:uD}),Ye=cO(e,`ADD_URI_SAFE_ATTR`,Xe,{transform:dt,base:Xe}),qe=cO(e,`ADD_DATA_URI_TAGS`,Je,{transform:dt,base:Je}),M=cO(e,`FORBID_CONTENTS`,Ke,{transform:dt}),Te=cO(e,`FORBID_TAGS`,ED({}),{transform:dt}),Ee=cO(e,`FORBID_ATTR`,ED({}),{transform:dt}),Ge=yD(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?ED(e.USE_PROFILES):e.USE_PROFILES:!1,De=e.ALLOW_ARIA_ATTR!==!1,Oe=e.ALLOW_DATA_ATTR!==!1,ke=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ae=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,je=e.SAFE_FOR_TEMPLATES||!1,Me=e.SAFE_FOR_XML!==!1,Ne=e.WHOLE_DOCUMENT||!1,Re=e.RETURN_DOM||!1,ze=e.RETURN_DOM_FRAGMENT||!1,j=e.RETURN_TRUSTED_TYPE||!1,Le=e.FORCE_BODY||!1,Be=e.SANITIZE_DOM!==!1,Ve=e.SANITIZE_NAMED_PROPS||!1,Ue=e.KEEP_CONTENT!==!1,We=e.IN_PLACE||!1,be=kD(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:KD,et=typeof e.NAMESPACE==`string`?e.NAMESPACE:$e,at=lO(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>$({},it)),st=lO(e,`HTML_INTEGRATION_POINTS`,()=>$({},ot));let t=lO(e,`CUSTOM_ELEMENT_HANDLING`,()=>$E(null));if(we=$E(null),yD(t,`tagNameCheck`)&&mt(t.tagNameCheck)&&(we.tagNameCheck=t.tagNameCheck),yD(t,`attributeNameCheck`)&&mt(t.attributeNameCheck)&&(we.attributeNameCheck=t.attributeNameCheck),yD(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(we.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),QE(we),je&&(Oe=!1),ze&&(Re=!0),Ge&&(xe=$({},ID),k=$E(null),Ge.html===!0&&($(xe,AD),$(k,LD)),Ge.svg===!0&&($(xe,jD),$(k,RD),$(k,BD)),Ge.svgFilters===!0&&($(xe,MD),$(k,RD),$(k,BD)),Ge.mathMl===!0&&($(xe,PD),$(k,zD),$(k,BD))),A.tagCheck=null,A.attributeCheck=null,yD(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?A.tagCheck=e.ADD_TAGS:cD(e.ADD_TAGS)&&(xe===Se&&(xe=ED(xe)),$(xe,e.ADD_TAGS,dt))),yD(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?A.attributeCheck=e.ADD_ATTR:cD(e.ADD_ATTR)&&(k===Ce&&(k=ED(k)),$(k,e.ADD_ATTR,dt))),yD(e,`ADD_FORBID_CONTENTS`)&&cD(e.ADD_FORBID_CONTENTS)&&(M===Ke&&(M=ED(M)),$(M,e.ADD_FORBID_CONTENTS,dt)),Ue&&(xe[`#text`]=!0),Ne&&$(xe,[`html`,`head`,`body`]),xe.table&&($(xe,[`tbody`]),delete Te.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw SD(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw SD(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=ee;ee=e.TRUSTED_TYPES_POLICY;try{T=re(``)}catch(e){throw ee=t,e}}else e.TRUSTED_TYPES_POLICY===null?(ee=void 0,T=``):(ee===void 0&&(ee=ae()),ee&&typeof T==`string`&&(T=re(``)));ZE&&ZE(e),ft=e},gt=$({},[...jD,...MD,...ND]),_t=$({},[...PD,...FD]),vt=function(e,t,n){return t.namespaceURI===$e?e===`svg`:t.namespaceURI===Ze?e===`svg`&&(n===`annotation-xml`||at[n]):!!gt[e]},yt=function(e,t,n){return t.namespaceURI===$e?e===`math`:t.namespaceURI===Qe?e===`math`&&st[n]:!!_t[e]},bt=function(e,t,n){return t.namespaceURI===Qe&&!st[n]||t.namespaceURI===Ze&&!at[n]?!1:!_t[e]&&(ct[e]||!gt[e])},xt=function(e){let t=_(e);(!t||!t.tagName)&&(t={namespaceURI:et,tagName:`template`});let n=lD(e.tagName),r=lD(t.tagName);return nt[e.namespaceURI]?e.namespaceURI===Qe?vt(n,t,r):e.namespaceURI===Ze?yt(n,t,r):e.namespaceURI===$e?bt(n,t,r):!!(lt===`application/xhtml+xml`&&nt[e.namespaceURI]):!1},St=function(e){oD(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw SD(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},Ct=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},wt=function(e){Dt(e);let t=g(e);if(t){let e=[];rD(t,t=>{oD(e,t)}),rD(e,e=>{try{p(e)}catch{}})}let n=y(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&Ct(e,r,i)}},Tt=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}oD(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(Re||ze)try{St(n)}catch{}else try{n.setAttribute(e,``)}catch{}},Et=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||k[dt(i)]||Ct(e,r,i)}},Dt=function(e){let t=[e];for(;t.length>0;){let e=t.pop();C(e)===tO.element&&Et(e);let n=g(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},Ot=function(e,t){return Me?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},kt=function(e){if(!Me)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=C(e);if(n===tO.processingInstruction||n===tO.comment&&xD(QD,e.data)){try{p(e)}catch{}continue}if(n===tO.element){let t=e,n=dt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Ot(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=g(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},At=function(e){let t=null,r=null;if(Le)e=`<remove></remove>`+e;else{let t=dD(e,/^[\r\n\t ]+/);r=t&&t[0]}lt===`application/xhtml+xml`&&et===$e&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=ee?re(e):e;if(et===$e)try{t=new l().parseFromString(i,lt)}catch{}if(!t||!t.documentElement){t=se.createDocument(et,`template`,null);try{t.documentElement.innerHTML=tt?T:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),et===$e?ue.call(t,Ne?`html`:`body`)[0]:Ne?t.documentElement:a},jt=function(e){let t=S?S(e):e.ownerDocument;return ce.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},Mt=function(e){return e=fD(e,fe,` `),e=fD(e,pe,` `),e=fD(e,me,` `),e},Nt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=ce.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=Mt(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&rD(i,e=>{Ft(e.content)&&Nt(e.content)})},Pt=function(e){let t=x?x(e):null;return typeof t!=`string`||dt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Ft=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===tO.documentFragment}catch{return!1}},It=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Lt(e,n,r){e.length!==0&&rD(e,e=>{e.call(t,n,r,ft)})}let Rt=function(e,t){return!!(Me&&e.hasChildNodes()&&!It(e.firstElementChild)&&xD(ZD,e.textContent)&&xD(ZD,e.innerHTML)||Me&&e.namespaceURI===$e&&rO[t]&&(It(e.firstElementChild)||typeof e.textContent==`string`&&xD(iO[t],e.textContent))||e.nodeType===tO.processingInstruction||Me&&e.nodeType===tO.comment&&xD(QD,e.data))},zt=function(e,t){return e instanceof RegExp?xD(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Bt=function(e,t,n){if(!Te[t]&&Kt(t)&&zt(we.tagNameCheck,t))return!1;if(Ue&&!M[t]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return St(e),!0},Vt=function(e,t,n,r){return e.length===0?t:t===n||t===r?ED(t):t},Ht=function(e,t){return e===t||_(e)!==null?!1:(We&&Dt(e),!0)},Ut=function(e,n){if(Lt(O.beforeSanitizeElements,e,null),Ht(e,n))return!0;if(Pt(e))return St(e),!0;let r=dt(w(e));if(xe=Vt(O.uponSanitizeElement,xe,Se,Fe),Lt(O.uponSanitizeElement,e,{tagName:r,allowedTags:xe}),Ht(e,n))return!0;if(Rt(e,r))return St(e),!0;if(Te[r]||!(A.tagCheck instanceof Function&&A.tagCheck(r))&&!xe[r]){let t=Bt(e,r,n);return t===!1&&Lt(O.afterSanitizeElements,e,null),t}if(C(e)===tO.element&&!xt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&xD($D,e.innerHTML))return St(e),!0;if(je&&e.nodeType===tO.text){let n=Mt(e.textContent);e.textContent!==n&&(oD(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Lt(O.afterSanitizeElements,e,null),!1},Wt=function(e,t,r){if(Ee[t]||Ot(t,e)||Be&&(t===`id`||t===`name`)&&(r in n||r in pt))return!1;let i=k[t]||A.attributeCheck instanceof Function&&A.attributeCheck(t,e);return Oe&&xD(he,t)||De&&xD(ge,t)?!0:i?Ye[t]||xD(be,fD(r,ve,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&pD(r,`data:`)===0&&qe[e]||ke&&!xD(_e,fD(r,ve,``))?!0:!r:Kt(e)&&zt(we.tagNameCheck,e)&&zt(we.attributeNameCheck,t,e)||t===`is`&&we.allowCustomizedBuiltInElements&&zt(we.tagNameCheck,r)},Gt=$({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Kt=function(e){return!Gt[lD(e)]&&xD(ye,e)},qt=function(e,t,n,r){if(ee&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return re(r);case`TrustedScriptURL`:return ie(r)}return r},Jt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!Pt(e)||(St(e),!1)}catch{return Tt(t,e),!1}},Yt=function(e){Lt(O.beforeSanitizeAttributes,e,null);let n=e.attributes;if(!n||Pt(e))return;k=Vt(O.uponSanitizeAttribute,k,Ce,Ie);let r={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:k,forceKeepAttr:void 0},i=n.length,a=dt(e.nodeName);for(;i--;){let o=n[i],s=o.name,c=o.namespaceURI,l=o.value,u=dt(s),d=l,f=s===`value`?d:mD(d),p=!1;if(r.attrName=u,r.attrValue=f,r.keepAttr=!0,r.forceKeepAttr=void 0,Lt(O.uponSanitizeAttribute,e,r),f=r.attrValue,Ve&&(u===`id`||u===`name`)&&pD(f,He)!==0&&(Tt(s,e,o),f=He+f,p=!0),Me&&xD(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){Tt(s,e,o);continue}if(u===`attributename`&&dD(f,`href`)){Tt(s,e,o);continue}if(!r.forceKeepAttr){if(!r.keepAttr){Tt(s,e,o);continue}if(!Ae&&xD(eO,f)){Tt(s,e,o);continue}if(je&&(f=Mt(f)),!Wt(a,u,f)){Tt(s,e,o);continue}f=qt(a,u,c,f),f!==d&&Jt(e,s,c,f)&&p&&aD(t.removed)}}Lt(O.afterSanitizeAttributes,e,null)},Xt=function(e){let t=null,n=jt(e);for(Lt(O.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Lt(O.uponSanitizeShadowNode,t,null),Ut(t,e),Yt(t),Ft(t.content)&&Xt(t.content),C(t)===tO.element){let e=v(t);Ft(e)&&(Zt(e),Xt(e))}Lt(O.afterSanitizeShadowDOM,e,null)},Zt=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Xt(e.shadow);continue}let n=e.node,r=C(n)===tO.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&dt(e)===`template`){let e=n.content;Ft(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Ft(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(tt=!e,tt&&(e=`<!-->`),typeof e!=`string`&&!It(e)&&(e=DD(e),typeof e!=`string`))throw SD(`dirty is not a string, aborting`);if(!t.isSupported)return e;Pe?(xe=Fe,k=Ie):ht(n),(O.uponSanitizeElement.length>0||O.uponSanitizeAttribute.length>0)&&(xe=ED(xe)),O.uponSanitizeAttribute.length>0&&(k=ED(k)),t.removed=[];let c=We&&typeof e!=`string`&&It(e);if(c){kt(e);let t=w(e);if(typeof t==`string`){let n=dt(t);if(!xe[n]||Te[n])throw wt(e),SD(`root node is forbidden and cannot be sanitized in-place`)}if(Pt(e))throw wt(e),SD(`root node is clobbered and cannot be sanitized in-place`);try{Zt(e)}catch(t){throw wt(e),t}}else if(It(e))i=At(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===tO.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Zt(i);else{if(!Re&&!je&&!Ne&&e.indexOf(`<`)===-1)return ee&&j?re(e):e;if(i=At(e),!i)return Re?null:j?T:``}i&&Le&&St(i.firstChild);let l=c?e:i;try{let e=jt(l);for(;o=e.nextNode();)Ut(o,l),Yt(o),Ft(o.content)&&Xt(o.content)}catch(n){throw c&&(wt(e),rD(t.removed,e=>{e.element&&Dt(e.element)})),n}if(c)return rD(t.removed,e=>{e.element&&Dt(e.element)}),je&&Nt(e),e;if(Re){if(je&&Nt(i),ze)for(s=le.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(k.shadowroot||k.shadowrootmode)&&(s=de.call(r,s,!0)),s}let u=Ne?i.outerHTML:i.innerHTML;return Ne&&xe[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&xD(YD,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
296
+ `+u),je&&(u=Mt(u)),ee&&j?re(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ht(e),Pe=!0,Fe=xe,Ie=k},t.clearConfig=function(){ft=null,Pe=!1,Fe=null,Ie=null,ee=E,T=``},t.isValidAttribute=function(e,t,n){ft||ht({});let r=dt(e),i=dt(t);return Wt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&yD(O,e)&&oD(O[e],t)},t.removeHook=function(e,t){if(yD(O,e)){if(t!==void 0){let n=iD(O[e],t);return n===-1?void 0:sD(O[e],n,1)[0]}return aD(O[e])}},t.removeHooks=function(e){yD(O,e)&&(O[e]=[])},t.removeAllHooks=function(){O=sO()},t}var dO=uO(),fO=`png|jpe?g|gif|webp|bmp|svg|avif|ico|tiff?`,pO=`(?:file:\\/\\/(?:(?:localhost)?\\/(?=[^\\s])|[A-Za-z]:[\\\\/]|[^\\/\\s:]+\\/)|\\/(?!\\/)(?!\\s)|[A-Za-z]:[\\\\/](?!\\s)|\\\\\\\\[^\\\\/\\s]+[\\\\/](?!\\s))`,mO=`(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?`,hO=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)(?:(?:图|图片|预览图|预览|截图|设计稿|整图|效果图|封面|原图|缩略图|路径|image|img|preview|screenshot|pic|photo|file|path)\\s*[::]\\s*)?(${pO}.+?\\.(?:${fO}))\\s*$`,`i`),gO=RegExp(`(^|[\\s(「『【>])(${pO}[^\`"'<>()\\[\\]{}\\s()「」『』【】,。;、!?:…·]+?\\.(?:${fO}))(?=\$|[\\s))」』】.,;:!?,。;、!?])`,`gi`),_O=/^\s*(?:```|~~~)/,vO=RegExp(`\\.(?:${fO})`,`i`);function yO(e){return hO.test(e)||OO.test(e)||e.match(MO)!=null||e.match(NO)!=null}function bO(e){let t=[];for(let n=0;n<e.length;){if(!_O.test(e[n])){t.push(e[n]),n++;continue}let r=n+1;for(;r<e.length&&!_O.test(e[r]);)r++;let i=e.slice(n+1,r);if(i.filter(yO).length>=2){t.push(...i),n=r<e.length?r+1:e.length;continue}t.push(e[n]),n++}return t}var xO=/^\/(?:slices|assets|icons|favicon|__)(?:[/.]|$)/i,SO=e=>xO.test(String(e)),CO=e=>/[*{}]/.test(String(e)),wO=e=>SO(e)||CO(e),TO=/^(?:…|\.{3,})[\\/]/,EO=`(?:…|\\.{3,})[\\\\/][^\\s\`"'<>()「」『』【】,。;、!?:…]+?\\.(?:${fO})`,DO=RegExp(`(^|[\\s(「『【>→::])(\`?)(${EO})(\`?)`,`gi`),OO=RegExp(`^(\\s*(?:[-*+]\\s+|\\d+[.)]\\s+)?)${mO}(${EO})\\s*$`,`i`);function kO(e,t){let n=String(e).replace(TO,``).replace(/\\/g,`/`);if(CO(n))return null;let r=`/${n.replace(/^\/+/,``)}`;return SO(r)?`![${PO(r)}](${LO(r)} "${IO(e)}")`:HO(e,t)}var AO=/!\[([^\]]*)\]\(\s*(data:[^)]*)\)/gi;function jO(e){let t=String(e??``);return!t||!/!\[[^\]]*\]\(\s*data:/i.test(t)?t:t.replace(AO,(e,t,n)=>{let r=/^data:([^;,]*)((?:;[^,]*)*),([\s\S]*)$/i.exec(n),i=String(t||``).trim()||`未命名`;return r?String(r[3]||``).trim()?e:`\`⚠ 图片缺失:${i}(data URI 载荷为空)\``:`\`⚠ 图片缺失:${i}(data URI 结构异常)\``})}var MO=RegExp(`(!\\[[^\\]]*\\]\\()\\s*(${pO}(?:[^\\s?#()]|\\([^\\s()]*\\))+?\\.(?:${fO}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`),NO=RegExp(`(!\\[[^\\]]*\\]\\()\\s*([^\\s()/?#\\\\](?:[^\\s?#()]|\\([^\\s()]*\\))*?\\.(?:${fO}))(?=\\s*(?:"[^"]*"|'[^']*')?\\s*\\))`,`gi`);function PO(e){return FO(e).replace(/[[\]!]/g,``).trim().slice(0,120)||`预览图`}function FO(e){let t=String(e??``).trim();if(!t||/^(?:data|blob):/i.test(t))return``;let n=t;try{let e=new URL(t,`http://localhost/`);n=e.searchParams.get(`path`)||e.pathname||t,n=decodeURIComponent(n)}catch{try{n=decodeURIComponent(n)}catch{}}return(n.split(/[\\/]/).pop()||``).trim()}function IO(e){return String(e).replace(/"/g,`'`)}function LO(e){return String(e).replace(/\(/g,`%28`).replace(/\)/g,`%29`).replace(/ /g,`%20`)}function RO(e){let t=String(e);if(!t.includes(`%`))return t;try{return decodeURIComponent(t)}catch{return t}}function zO(e){let t=String(e);if(!/^file:\/\//i.test(t))return t;let n=t.replace(/^file:\/\//i,``),r=/^(?:localhost)?(\/.*)$/i.exec(n);if(r){let e=r[1];return/^\/[A-Za-z]:[\\/]/.test(e)?e.slice(1):e}if(/^[A-Za-z]:[\\/]/.test(n))return n;let i=/^([^\/\s:]+)\/(.*)$/.exec(n);return i?`\\\\${i[1]}\\${i[2].replace(/\//g,`\\`)}`:t}function BO(e,t){let n=zO(RO(e));if(wO(n))return null;let r=``;try{r=t(n)}catch{return null}return r?LO(r):null}function VO(e,t){let n=RO(e).replace(/\\/g,`/`);if(/^[A-Za-z][A-Za-z0-9+.-]*:/.test(n)||n.startsWith(`.`)||n.split(`/`).includes(`..`))return null;let r=``;try{r=t(n)}catch{return null}return r?LO(r):null}function HO(e,t){let n=zO(e);if(wO(n))return null;let r=``;try{r=t(n)}catch{return null}if(!r)return null;let i=LO(r);return`![${PO(n)}](${i} "${IO(n)}")`}function UO(e,t){let n=jO(e);if(!n||typeof t!=`function`||!vO.test(n))return n;let r=!1;return bO(n.split(`
297
+ `)).map(e=>{if(_O.test(e))return r=!r,e;if(r||!vO.test(e))return e;let n=e.match(hO);if(n){let r=HO(n[2],t);return r===null?e:n[1]+r}let i=e.match(OO);if(i){let n=kO(i[2],t);return n===null?e:i[1]+n}return e.replace(MO,(e,n,r)=>n+(BO(r,t)??r)).replace(NO,(e,n,r)=>n+(VO(r,t)??r)).replace(gO,(e,n,r)=>n+(HO(r,t)??r)).replace(DO,(e,n,r,i)=>{let a=kO(i,t);return a===null?e:n+a})}).join(`
298
+ `)}(function(e){var t=`\\b(?:BASH|BASHOPTS|BASH_ALIASES|BASH_ARGC|BASH_ARGV|BASH_CMDS|BASH_COMPLETION_COMPAT_DIR|BASH_LINENO|BASH_REMATCH|BASH_SOURCE|BASH_VERSINFO|BASH_VERSION|COLORTERM|COLUMNS|COMP_WORDBREAKS|DBUS_SESSION_BUS_ADDRESS|DEFAULTS_PATH|DESKTOP_SESSION|DIRSTACK|DISPLAY|EUID|GDMSESSION|GDM_LANG|GNOME_KEYRING_CONTROL|GNOME_KEYRING_PID|GPG_AGENT_INFO|GROUPS|HISTCONTROL|HISTFILE|HISTFILESIZE|HISTSIZE|HOME|HOSTNAME|HOSTTYPE|IFS|INSTANCE|JOB|LANG|LANGUAGE|LC_ADDRESS|LC_ALL|LC_IDENTIFICATION|LC_MEASUREMENT|LC_MONETARY|LC_NAME|LC_NUMERIC|LC_PAPER|LC_TELEPHONE|LC_TIME|LESSCLOSE|LESSOPEN|LINES|LOGNAME|LS_COLORS|MACHTYPE|MAILCHECK|MANDATORY_PATH|NO_AT_BRIDGE|OLDPWD|OPTERR|OPTIND|ORBIT_SOCKETDIR|OSTYPE|PAPERSIZE|PATH|PIPESTATUS|PPID|PS1|PS2|PS3|PS4|PWD|RANDOM|REPLY|SECONDS|SELINUX_INIT|SESSION|SESSIONTYPE|SESSION_MANAGER|SHELL|SHELLOPTS|SHLVL|SSH_AUTH_SOCK|TERM|UID|UPSTART_EVENTS|UPSTART_INSTANCE|UPSTART_JOB|UPSTART_SESSION|USER|WINDOWID|XAUTHORITY|XDG_CONFIG_DIRS|XDG_CURRENT_DESKTOP|XDG_DATA_DIRS|XDG_GREETER_DATA_DIR|XDG_MENU_PREFIX|XDG_RUNTIME_DIR|XDG_SEAT|XDG_SEAT_PATH|XDG_SESSION_DESKTOP|XDG_SESSION_ID|XDG_SESSION_PATH|XDG_SESSION_TYPE|XDG_VTNR|XMODIFIERS)\\b`,n={pattern:/(^(["']?)\w+\2)[ \t]+\S.*/,lookbehind:!0,alias:`punctuation`,inside:null},r={bash:n,environment:{pattern:RegExp(`\\$`+t),alias:`constant`},variable:[{pattern:/\$?\(\([\s\S]+?\)\)/,greedy:!0,inside:{variable:[{pattern:/(^\$\(\([\s\S]+)\)\)/,lookbehind:!0},/^\$\(\(/],number:/\b0x[\dA-Fa-f]+\b|(?:\b\d+(?:\.\d*)?|\B\.\d+)(?:[Ee]-?\d+)?/,operator:/--|\+\+|\*\*=?|<<=?|>>=?|&&|\|\||[=!+\-*/%<>^&|]=?|[?~:]/,punctuation:/\(\(?|\)\)?|,|;/}},{pattern:/\$\((?:\([^)]+\)|[^()])+\)|`[^`]+`/,greedy:!0,inside:{variable:/^\$\(|^`|\)$|`$/}},{pattern:/\$\{[^}]+\}/,greedy:!0,inside:{operator:/:[-=?+]?|[!\/]|##?|%%?|\^\^?|,,?/,punctuation:/[\[\]]/,environment:{pattern:RegExp(`(\\{)`+t),lookbehind:!0,alias:`constant`}}},/\$(?:\w+|[#?*!@$])/],entity:/\\(?:[abceEfnrtv\\"]|O?[0-7]{1,3}|U[0-9a-fA-F]{8}|u[0-9a-fA-F]{4}|x[0-9a-fA-F]{1,2})/};e.languages.bash={shebang:{pattern:/^#!\s*\/.*/,alias:`important`},comment:{pattern:/(^|[^"{\\$])#.*/,lookbehind:!0},"function-name":[{pattern:/(\bfunction\s+)[\w-]+(?=(?:\s*\(?:\s*\))?\s*\{)/,lookbehind:!0,alias:`function`},{pattern:/\b[\w-]+(?=\s*\(\s*\)\s*\{)/,alias:`function`}],"for-or-select":{pattern:/(\b(?:for|select)\s+)\w+(?=\s+in\s)/,alias:`variable`,lookbehind:!0},"assign-left":{pattern:/(^|[\s;|&]|[<>]\()\w+(?:\.\w+)*(?=\+?=)/,inside:{environment:{pattern:RegExp(`(^|[\\s;|&]|[<>]\\()`+t),lookbehind:!0,alias:`constant`}},alias:`variable`,lookbehind:!0},parameter:{pattern:/(^|\s)-{1,2}(?:\w+:[+-]?)?\w+(?:\.\w+)*(?=[=\s]|$)/,alias:`variable`,lookbehind:!0},string:[{pattern:/((?:^|[^<])<<-?\s*)(\w+)\s[\s\S]*?(?:\r?\n|\r)\2/,lookbehind:!0,greedy:!0,inside:r},{pattern:/((?:^|[^<])<<-?\s*)(["'])(\w+)\2\s[\s\S]*?(?:\r?\n|\r)\3/,lookbehind:!0,greedy:!0,inside:{bash:n}},{pattern:/(^|[^\\](?:\\\\)*)"(?:\\[\s\S]|\$\([^)]+\)|\$(?!\()|`[^`]+`|[^"\\`$])*"/,lookbehind:!0,greedy:!0,inside:r},{pattern:/(^|[^$\\])'[^']*'/,lookbehind:!0,greedy:!0},{pattern:/\$'(?:[^'\\]|\\[\s\S])*'/,greedy:!0,inside:{entity:r.entity}}],environment:{pattern:RegExp(`\\$?`+t),alias:`constant`},variable:r.variable,function:{pattern:/(^|[\s;|&]|[<>]\()(?:add|apropos|apt|apt-cache|apt-get|aptitude|aspell|automysqlbackup|awk|basename|bash|bc|bconsole|bg|bzip2|cal|cargo|cat|cfdisk|chgrp|chkconfig|chmod|chown|chroot|cksum|clear|cmp|column|comm|composer|cp|cron|crontab|csplit|curl|cut|date|dc|dd|ddrescue|debootstrap|df|diff|diff3|dig|dir|dircolors|dirname|dirs|dmesg|docker|docker-compose|du|egrep|eject|env|ethtool|expand|expect|expr|fdformat|fdisk|fg|fgrep|file|find|fmt|fold|format|free|fsck|ftp|fuser|gawk|git|gparted|grep|groupadd|groupdel|groupmod|groups|grub-mkconfig|gzip|halt|head|hg|history|host|hostname|htop|iconv|id|ifconfig|ifdown|ifup|import|install|ip|java|jobs|join|kill|killall|less|link|ln|locate|logname|logrotate|look|lpc|lpr|lprint|lprintd|lprintq|lprm|ls|lsof|lynx|make|man|mc|mdadm|mkconfig|mkdir|mke2fs|mkfifo|mkfs|mkisofs|mknod|mkswap|mmv|more|most|mount|mtools|mtr|mutt|mv|nano|nc|netstat|nice|nl|node|nohup|notify-send|npm|nslookup|op|open|parted|passwd|paste|pathchk|ping|pkill|pnpm|podman|podman-compose|popd|pr|printcap|printenv|ps|pushd|pv|quota|quotacheck|quotactl|ram|rar|rcp|reboot|remsync|rename|renice|rev|rm|rmdir|rpm|rsync|scp|screen|sdiff|sed|sendmail|seq|service|sftp|sh|shellcheck|shuf|shutdown|sleep|slocate|sort|split|ssh|stat|strace|su|sudo|sum|suspend|swapon|sync|sysctl|tac|tail|tar|tee|time|timeout|top|touch|tr|traceroute|tsort|tty|umount|uname|unexpand|uniq|units|unrar|unshar|unzip|update-grub|uptime|useradd|userdel|usermod|users|uudecode|uuencode|v|vcpkg|vdir|vi|vim|virsh|vmstat|wait|watch|wc|wget|whereis|which|who|whoami|write|xargs|xdg-open|yarn|yes|zenity|zip|zsh|zypper)(?=$|[)\s;|&])/,lookbehind:!0},keyword:{pattern:/(^|[\s;|&]|[<>]\()(?:case|do|done|elif|else|esac|fi|for|function|if|in|select|then|until|while)(?=$|[)\s;|&])/,lookbehind:!0},builtin:{pattern:/(^|[\s;|&]|[<>]\()(?:\.|:|alias|bind|break|builtin|caller|cd|command|continue|declare|echo|enable|eval|exec|exit|export|getopts|hash|help|let|local|logout|mapfile|printf|pwd|read|readarray|readonly|return|set|shift|shopt|source|test|times|trap|type|typeset|ulimit|umask|unalias|unset)(?=$|[)\s;|&])/,lookbehind:!0,alias:`class-name`},boolean:{pattern:/(^|[\s;|&]|[<>]\()(?:false|true)(?=$|[)\s;|&])/,lookbehind:!0},"file-descriptor":{pattern:/\B&\d\b/,alias:`important`},operator:{pattern:/\d?<>|>\||\+=|=[=~]?|!=?|<<[<-]?|[&\d]?>>|\d[<>]&?|[<>][&=]?|&[>&]?|\|[&|]?/,inside:{"file-descriptor":{pattern:/^\d/,alias:`important`}}},punctuation:/\$?\(\(?|\)\)?|\.\.|[{}[\];\\]/,number:{pattern:/(^|\s)(?:[1-9]\d*|0)(?:[.,]\d+)?\b/,lookbehind:!0}},n.inside=e.languages.bash;for(var i=[`comment`,`function-name`,`for-or-select`,`assign-left`,`parameter`,`string`,`environment`,`function`,`keyword`,`builtin`,`boolean`,`file-descriptor`,`operator`,`punctuation`,`number`],a=r.variable[1].inside,o=0;o<i.length;o++)a[i[o]]=e.languages.bash[i[o]];e.languages.sh=e.languages.bash,e.languages.shell=e.languages.bash})(Prism),(function(e){e.languages.typescript=e.languages.extend(`javascript`,{"class-name":{pattern:/(\b(?:class|extends|implements|instanceof|interface|new|type)\s+)(?!keyof\b)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?:\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>)?/,lookbehind:!0,greedy:!0,inside:null},builtin:/\b(?:Array|Function|Promise|any|boolean|console|never|number|string|symbol|unknown)\b/}),e.languages.typescript.keyword.push(/\b(?:abstract|declare|is|keyof|readonly|require)\b/,/\b(?:asserts|infer|interface|module|namespace|type)\b(?=\s*(?:[{_$a-zA-Z\xA0-\uFFFF]|$))/,/\btype\b(?=\s*(?:[\{*]|$))/),delete e.languages.typescript.parameter,delete e.languages.typescript[`literal-property`];var t=e.languages.extend(`typescript`,{});delete t[`class-name`],e.languages.typescript[`class-name`].inside=t,e.languages.insertBefore(`typescript`,`function`,{decorator:{pattern:/@[$\w\xA0-\uFFFF]+/,inside:{at:{pattern:/^@/,alias:`operator`},function:/^[\s\S]+/}},"generic-function":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*<(?:[^<>]|<(?:[^<>]|<[^<>]*>)*>)*>(?=\s*\()/,greedy:!0,inside:{function:/^#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*/,generic:{pattern:/<[\s\S]+/,alias:`class-name`,inside:t}}}}),e.languages.ts=e.languages.typescript})(Prism),(function(e){var t=e.util.clone(e.languages.javascript),n=`(?:\\s|\\/\\/.*(?!.)|\\/\\*(?:[^*]|\\*(?!\\/))\\*\\/)`,r=`(?:\\{(?:\\{(?:\\{[^{}]*\\}|[^{}])*\\}|[^{}])*\\})`,i=`(?:\\{<S>*\\.{3}(?:[^{}]|<BRACES>)*\\})`;function a(e,t){return e=e.replace(/<S>/g,function(){return n}).replace(/<BRACES>/g,function(){return r}).replace(/<SPREAD>/g,function(){return i}),RegExp(e,t)}i=a(i).source,e.languages.jsx=e.languages.extend(`markup`,t),e.languages.jsx.tag.pattern=a(`<\\/?(?:[\\w.:-]+(?:<S>+(?:[\\w.:$-]+(?:=(?:"(?:\\\\[\\s\\S]|[^\\\\"])*"|'(?:\\\\[\\s\\S]|[^\\\\'])*'|[^\\s{'"/>=]+|<BRACES>))?|<SPREAD>))*<S>*\\/?)?>`),e.languages.jsx.tag.inside.tag.pattern=/^<\/?[^\s>\/]*/,e.languages.jsx.tag.inside[`attr-value`].pattern=/=(?!\{)(?:"(?:\\[\s\S]|[^\\"])*"|'(?:\\[\s\S]|[^\\'])*'|[^\s'">]+)/,e.languages.jsx.tag.inside.tag.inside[`class-name`]=/^[A-Z]\w*(?:\.[A-Z]\w*)*$/,e.languages.jsx.tag.inside.comment=t.comment,e.languages.insertBefore(`inside`,`attr-name`,{spread:{pattern:a(`<SPREAD>`),inside:e.languages.jsx}},e.languages.jsx.tag),e.languages.insertBefore(`inside`,`special-attr`,{script:{pattern:a(`=<BRACES>`),alias:`language-javascript`,inside:{"script-punctuation":{pattern:/^=(?=\{)/,alias:`punctuation`},rest:e.languages.jsx}}},e.languages.jsx.tag);var o=function(e){return e?typeof e==`string`?e:typeof e.content==`string`?e.content:e.content.map(o).join(``):``},s=function(t){for(var n=[],r=0;r<t.length;r++){var i=t[r],a=!1;if(typeof i!=`string`&&(i.type===`tag`&&i.content[0]&&i.content[0].type===`tag`?i.content[0].content[0].content===`</`?n.length>0&&n[n.length-1].tagName===o(i.content[0].content[1])&&n.pop():i.content[i.content.length-1].content===`/>`||n.push({tagName:o(i.content[0].content[1]),openedBraces:0}):n.length>0&&i.type===`punctuation`&&i.content===`{`?n[n.length-1].openedBraces++:n.length>0&&n[n.length-1].openedBraces>0&&i.type===`punctuation`&&i.content===`}`?n[n.length-1].openedBraces--:a=!0),(a||typeof i==`string`)&&n.length>0&&n[n.length-1].openedBraces===0){var c=o(i);r<t.length-1&&(typeof t[r+1]==`string`||t[r+1].type===`plain-text`)&&(c+=o(t[r+1]),t.splice(r+1,1)),r>0&&(typeof t[r-1]==`string`||t[r-1].type===`plain-text`)&&(c=o(t[r-1])+c,t.splice(r-1,1),r--),t[r]=new e.Token(`plain-text`,c,null,c)}i.content&&typeof i.content!=`string`&&s(i.content)}};e.hooks.add(`after-tokenize`,function(e){(e.language===`jsx`||e.language===`tsx`)&&s(e.tokens)})})(Prism),RE.setOptions({gfm:!0,breaks:!0}),dO.addHook(`afterSanitizeAttributes`,e=>{e.tagName===`A`&&e.getAttribute(`href`)&&(e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)),e.tagName===`IMG`&&(e.setAttribute(`loading`,`lazy`),e.setAttribute(`decoding`,`async`))});var WO={js:`javascript`,mjs:`javascript`,cjs:`javascript`,node:`javascript`,ts:`typescript`,sh:`bash`,shell:`bash`,zsh:`bash`,console:`bash`,html:`markup`,vue:`markup`,xml:`markup`,svg:`markup`,jsonc:`json`,json5:`json`,py:`python`,yml:`yaml`};function GO(e){let t=String(e||``).trim().toLowerCase();if(!t)return``;let n=WO[t]||t;return D_.default.languages[n]?n:``}function KO(e){let t=String(e??``);if(!t.trim())return``;let n=``;try{n=RE.parse(t)}catch{n=`<p>${t.replace(/[&<>]/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`})[e])}</p>`}return dO.sanitize(n,{ADD_ATTR:[`target`,`rel`]})}function qO(e){if(!(!e||!e.querySelectorAll))for(let t of e.querySelectorAll(`pre`)){let e=t.querySelector(`code`);if(!e)continue;let n=GO((e.className.match(/language-([\w+-]+)/)||[])[1]||``);if(n&&e.className.indexOf(`language-`)<0&&(e.className=`language-${n}`),n&&!e.dataset.mdHighlighted){try{D_.default.highlightElement(e)}catch{}e.dataset.mdHighlighted=`1`}if(t.dataset.mdCode)continue;t.dataset.mdCode=`1`;let r=document.createElement(`div`);r.className=`md-code`;let i=document.createElement(`div`);i.className=`md-code__bar`;let a=document.createElement(`span`);a.className=`md-code__lang`,a.textContent=n||`text`;let o=document.createElement(`button`);o.type=`button`,o.className=`md-code__copy`,o.textContent=`复制`,o.addEventListener(`click`,async()=>{await op(e.textContent||``)?(o.textContent=`已复制`,o.classList.add(`is-ok`)):o.textContent=`复制失败`,setTimeout(()=>{o.textContent=`复制`,o.classList.remove(`is-ok`)},1600)}),i.append(a,o),t.parentNode?.insertBefore(r,t),r.append(i,t)}}function JO(e){if(!(!e||!e.querySelectorAll))for(let t of e.querySelectorAll(`pre code[data-md-highlighted]`))delete t.dataset.mdHighlighted}function YO(e){return e?e.nodeType===3?!e.textContent.trim():e.nodeType===1&&e.tagName===`BR`:!1}function XO(e){if(e.length>1)return`${e.length} 张图像`;let t=e[0],n=(t.getAttribute(`alt`)||``).trim();if(n)return n;let r=(t.getAttribute(`title`)||``).trim();return(r?(r.split(/[\\/]/).pop()||``).trim():``)||FO(t.getAttribute(`src`))||`1 张图像`}function ZO(e){let t=document.createElement(`div`);t.className=`md-imggroup`,t.dataset.mdImggroup=`1`;let n=document.createElement(`button`);n.type=`button`,n.className=`md-imggroup__head`,n.setAttribute(`aria-expanded`,`false`),n.innerHTML=`<svg class="md-imggroup__icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-images" /></svg><span class="md-imggroup__label"></span><svg class="md-imggroup__chev" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><use href="#icon-chevron-right" /></svg>`,n.querySelector(`.md-imggroup__label`).textContent=XO(e);let r=document.createElement(`div`);return r.className=`md-imggroup__body`,r.hidden=!0,n.addEventListener(`click`,()=>{let e=r.hidden;r.hidden=!e,t.classList.toggle(`is-open`,e),n.setAttribute(`aria-expanded`,e?`true`:`false`)}),t.append(n,r),{group:t,body:r}}function QO(e){if(e.dataset.mdImgFallback)return;e.dataset.mdImgFallback=`1`;let t=()=>{if(!e.isConnected||!(e.complete&&e.naturalWidth===0))return;let t=e.getAttribute(`src`)||``;if(/\.svgz?(?:[?#]|$)/i.test(t)||/^data:image\/svg/i.test(t))return;let n=FO(t)||(e.getAttribute(`alt`)||``).trim()||`未知图片`,r=document.createElement(`span`);r.className=`md-imgfail`,r.textContent=`图片加载失败:${n}`,r.title=t,e.replaceWith(r);let i=r.closest(`.md-imggroup__body`);if(i&&!i.querySelector(`img`)){let e=r.closest(`[data-md-imggroup]`);if(e){let t=e.querySelector(`.md-imggroup__head`);t&&t.remove(),e.classList.add(`is-open`)}}};e.addEventListener(`error`,t,{once:!0}),t()}function $O(e){if(!e||!e.querySelectorAll)return;let t=[...e.querySelectorAll(`img`)];for(let e of t)QO(e);for(let e of t){if(e.closest(`[data-md-imggroup]`))continue;let t=[e],n=e.nextSibling;for(;n;){if(YO(n)){n=n.nextSibling;continue}if(n.tagName===`IMG`&&!n.closest(`[data-md-imggroup]`)){t.push(n),n=n.nextSibling;continue}break}let{group:r,body:i}=ZO(t);e.parentNode.insertBefore(r,e);for(let e of t)i.append(e)}}var ek={name:`MarkdownBody`,props:{source:{type:String,default:``},streaming:{type:Boolean,default:!1}},data(){return{html:``,_raf:0}},watch:{source:{immediate:!0,handler(){this.scheduleRender()}},streaming(e){e||this.renderNow()}},beforeUnmount(){this._raf&&cancelAnimationFrame(this._raf),this._raf=0},methods:{scheduleRender(){if(!this.streaming){this.renderNow();return}this._raf||=requestAnimationFrame(()=>{this._raf=0,this.renderNow()})},renderNow(){this._raf&&=(cancelAnimationFrame(this._raf),0),this.html=KO(this.source),this.$nextTick(()=>{let e=this.$refs.bodyEl;e&&(JO(e),qO(e),$O(e))})}}},tk=[`innerHTML`];function nk(e,t,n,r,i,a){return B(),V(z,null,[K(` 模型输出经 marked 解析 + DOMPurify 消毒后注入;代码块由 enhanceCodeBlocks 补高亮与复制按钮 `),U(`div`,{ref:`bodyEl`,class:`md-body`,innerHTML:i.html},null,8,tk)],2112)}var rk=X(ek,[[`render`,nk],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/MarkdownBody.vue`]]),ik={card_list:`列出卡片`,card_read:`读取卡片`,card_write:`写入卡片`,card_validate:`校验卡片`,card_render_status:`渲染状态`,card_node_models:`组件模型`,card_screenshot:`截图预览`,card_sync:`同步远端卡片`,card_save:`推送到远端`,card_slice_upload:`上传切图`,card_import_meta:`来源侧车`,card_route_input:`输入路由`,card_scaffold:`生成骨架`,card_add_component:`添加组件`,card_history:`编辑历史`,card_rollback:`回滚版本`,skill_read:`读技能文档`,skill_exec:`跑技能脚本`,card_grep:`定位卡片字段`,card_patch:`最小改写卡片`,fs_read:`读文件`,fs_list:`列目录`,fs_write:`写草稿文件`,fs_copy:`复制文件`,shell_exec:`本地命令`};function ak(e){return ik[e]||e||`工具`}function ok(e){let t=e&&e.args||{};return`${typeof t.script==`string`?t.script:``} ${Array.isArray(t.args)?t.args.join(` `):typeof t.command==`string`?t.command:``} ${typeof t.name==`string`?t.name:``}`.toLowerCase()}var sk=[{order:6,id:`S6`,label:`收尾门禁`,hit:(e,t)=>/check_fidelity/.test(t)||/iterate/.test(t)&&/--gate/.test(t)},{order:5,id:`S5`,label:`像素自循环`,hit:(e,t)=>/iterate|diff_bands/.test(t)||e===`card_screenshot`},{order:4,id:`S4`,label:`组件填充`,hit:e=>e===`card_add_component`||e===`card_patch`||e===`card_write`},{order:3,id:`S3`,label:`骨架落盘`,hit:(e,t)=>e===`card_scaffold`||/expand_ir/.test(t)||e===`fs_write`&&/\.ir\.json/.test(t)},{order:2,id:`S2`,label:`设计稿审计`,hit:(e,t)=>/spec_tree|sketch_spec|design_sample|audit_|slice_/.test(t)},{order:1,id:`S1`,label:`输入路由`,hit:e=>e===`card_route_input`}];function ck(e){let t=Math.max(0,Math.round(Number(e||0)/1e3));if(t<60)return`${t} 秒`;let n=Math.floor(t/60);return n<60?`${n} 分 ${t%60} 秒`:`${Math.floor(n/60)} 小时 ${n%60} 分`}function lk(e){let t=Number(e||0);if(!t)return``;let n=new Date(t),r=e=>String(e).padStart(2,`0`);return`${r(n.getHours())}:${r(n.getMinutes())}:${r(n.getSeconds())}`}function uk(e){let t=Number(e||0);return t>0?`+${ck(t)}`:``}function dk(e,t=0){let n=Number(e&&e.startedAt)||0;if(!n)return 0;let r=Number(e&&e.ms)||0;if(r>0)return n+r;let i=Number(t)||0;return i>n?i:0}function fk(e){let t=e&&e.toolName||``,n=ok(e);for(let e of sk)if(e.hit(t,n))return e;return null}var pk=new Set([`card_write`,`card_patch`,`card_scaffold`,`card_add_component`,`fs_write`,`fs_copy`,`card_save`,`card_sync`,`card_slice_upload`]),mk=new Set([`card_read`,`card_list`,`card_node_models`,`card_grep`,`card_history`,`card_validate`,`card_render_status`,`fs_read`,`fs_list`,`skill_read`]);function hk(e){let t=e&&e.toolName||``;return e&&e.error||pk.has(t)||t===`skill_exec`||t===`shell_exec`||t===`card_screenshot`?!0:!mk.has(t)}function gk(e){if(e==null||e===``)return null;if(typeof e==`object`)return e;let t=String(e);try{return JSON.parse(t)}catch{}let n=t.indexOf(`{`),r=t.lastIndexOf(`}`);if(n>=0&&r>n)try{return JSON.parse(t.slice(n,r+1))}catch{return null}return null}function _k(e){let t=ok(e);if(!/--gate|check_fidelity/.test(t))return null;let n=gk(e&&e.result),r=n&&typeof n==`object`?n.gate:null;if(r&&typeof r.passed==`boolean`)return{passed:r.passed,verdict:String(r.verdict||``)};let i=String(e&&e.result||``);if(!/"passed"\s*:/.test(i))return null;let a=/"passed"\s*:\s*(true|false)/.exec(i),o=/"verdict"\s*:\s*"((?:[^"\\]|\\.)*)"/.exec(i);return a?{passed:a[1]===`true`,verdict:o?o[1].replace(/\\n/g,` `):``}:null}var vk=/\s#([^\s#]+)\s*$/;function yk(e){let t=String(e??``),n=vk.exec(t);return n?{text:t.slice(0,n.index).trim(),cid:n[1]}:{text:t,cid:``}}var bk=12;function xk(e){let t=e&&e.toolName||``,n=gk(e&&e.result);if(!n||typeof n!=`object`)return null;let r=t===`card_validate`?n:n.verify&&n.verify.validate;if(!r||typeof r!=`object`||!Array.isArray(r.errors))return null;let i=Array.isArray(r.warnings)?r.warnings:[],a=[...r.errors.map(e=>({level:`error`,...yk(e)})),...i.map(e=>({level:`warn`,...yk(e)}))].slice(0,bk);return{ok:r.ok!==!1&&r.errors.length===0,errors:r.errors.length,warnings:i.length,issues:a}}function Sk(e){let t=Array.isArray(e)?e:[],n=0,r=0,i=0,a=0,o=null,s=null;for(let e of t){e.error&&a++,pk.has(e.toolName)&&(e.error?r++:n++),e.toolName===`card_screenshot`&&!e.error&&i++;let t=xk(e);t&&(o=t);let c=_k(e);c&&(s=c)}return{total:t.length,writes:n,writeFails:r,shots:i,failed:a,validate:o,gate:s}}var Ck={length:`单次输出上限截断:调高「单次输出上限」,或要求 AI 走紧凑 IR 路线(fs_write 写 IR → expand_ir 展开)`,stall:`上游长时间静默:多为网关 / 网络抖动。上下文与已落盘产物都在,重试本轮即可接着做`,empty:`网关连续返回空响应:重试本轮,或检查网关额度 / 换个时间段`,context:`上下文超出网关窗口:后端已自动压缩重试仍失败,建议新开一轮或清理对话记录`,network:`连不上网关:检查网络与 Base URL 后重试本轮`,"rate-limit":`网关限流或额度不足:稍后重试,或换一个 API Key`,auth:`API Key 无效或权限不足:到设置里更新 Key 再重试`,"wrap-failed":`熔断收尾的进度汇总也没拿到:上下文已保留,回复「继续」接着做`,aborted:`本轮已中止:已执行的写入都保留,可从中断处继续`,unknown:`未归类的失败:复制错误原文排查,或换个说法重试本轮`};function wk(e){return{hint:Ck[e]||``,action:e===`length`||e===`auth`?`settings`:e===`wrap-failed`||e===`aborted`?`continue`:`retry`}}var Tk=/^\s*(\d+)\.\s+(.+?)\s+\((\d+x\d+|\?)\)\s*(.*)$/,Ek=/--pick\s+([\d.,~]+)/;function Dk(e){if(typeof e!=`string`||!e.includes(`--pick`))return[];let t=[];for(let n of e.split(`
299
+ `)){let e=n.match(Tk);if(!e)continue;let r=(e[4].match(Ek)||[])[1];r&&t.push({no:Number(e[1]),name:e[2].trim(),size:e[3],pick:r})}return t}var Ok=/^(\d+)\.(\d+)~(\d+)\.(\d+)$/,kk=/^\d+\.\d+$/;function Ak(e){let t=[];for(let n of e||[]){if(!n||!n.pick)continue;let e=String(n.pick),r=e.match(Ok),i=r?Number(r[2]):0,a=r?Number(r[4]):0;if(r&&r[1]===r[3]&&a>i){for(let e=i;e<=a;e+=1)t.push({...n,pick:`${r[1]}.${e}`,token:`${r[1]}.${e}`,kind:`card`});t.push({...n,token:`全 ${a-i+1} 张`,kind:`all`});continue}t.push({...n,token:e,kind:kk.test(e)?`card`:`board`})}return t}function jk(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e]&&t[e].toolCalls;if(Array.isArray(n)){for(let e=n.length-1;e>=0;--e)if(n[e]&&Dk(n[e].result).length)return n[e]}}return null}function Mk(e,t=``){if(!e||!e.pick)return``;let n=e.name?`「${e.name}」`:``,r=e.kind===`card`||kk.test(String(e.pick))?`(只建这一张卡,同画板的其它卡不要一起建)`:``,i=t?`落点卡 = 当前卡 ${t}(覆盖它,不是新建;要另建新卡我会直说)。`:``;return`建卡:画板 ${e.no}${n}。${i}参数已选好,照抄重跑:parse_meaxure.py --build --pick ${e.pick}${r}`}var Nk={name:`ChatToolRow`,components:{MarkdownBody:rk},props:{tc:{type:Object,required:!0},turnTs:{type:Number,default:0},nowTs:{type:Number,default:0},pickOwner:{type:Object,default:null}},emits:[`approval`,`pick-board`],data(){return{opened:null}},computed:{state(){return this.tc.error?`error`:this.tc.result!==void 0&&this.tc.result!==null?`done`:this.tc.pending?`pending`:`running`},open(){return this.opened===null?!!this.tc.error||this.boardPicks.length>0:this.opened},boardPicks(){return this.pickOwner&&this.tc!==this.pickOwner?[]:Ak(Dk(this.tc.result))},msText(){let e=this.tc.ms;return e?e<1e3?`${e}ms`:`${(e/1e3).toFixed(1)}s`:``},stampText(){return lk(this.tc.startedAt)},cumText(){let e=dk(this.tc,this.nowTs);return e&&this.turnTs?uk(e-this.turnTs):``},clockText(){return[this.stampText,this.cumText].filter(Boolean).join(` · `)},clockTitle(){let e=[];return this.stampText&&e.push(`开始于 ${this.stampText}`),this.cumText&&e.push(`距本轮开始 ${this.cumText.slice(1)}`),this.msText&&e.push(`本步耗时 ${this.msText}`),e.join(` · `)},approvalCommand(){if(this.tc.command)return String(this.tc.command);let e=this.tc.args||{};return typeof e.command==`string`&&e.command?e.command:this.tc.toolName===`skill_exec`?[e.script,Array.isArray(e.args)?e.args.join(` `):``].filter(Boolean).join(` `):JSON.stringify(e)},argSummary(){if(this.tc.toolName===`skill_exec`&&this.tc.args?.script){let e=[String(this.tc.args.script).replace(/^skills\//,``),(Array.isArray(this.tc.args.args)?this.tc.args.args:[]).map(e=>String(e).replace(/^\/[^\s]{20,}$/,e=>`…/${e.slice(-14)}`)).join(` `)].filter(Boolean).join(` `);return e.length>96?`${e.slice(0,96)}…`:e}let e=this.tc.args||{},t=[];for(let[n,r]of Object.entries(e)){if(r==null||r===``)continue;let e=typeof r==`object`?JSON.stringify(r):String(r);if(t.push(`${n}=${e.length>28?`${e.slice(0,28)}…`:e}`),t.join(` `).length>56)break}let n=t.join(` `);return n.length>72?`${n.slice(0,72)}…`:n},argsSource(){let e=this.tc.args||{};if(!Object.keys(e).length)return``;if(this.tc.toolName===`skill_exec`&&typeof e.script==`string`){if(!this.tc.error)return``;let t=Array.isArray(e.args)?e.args.join(` `):``;return`\`\`\`\n${[e.script,t].filter(Boolean).join(` `)}\n\`\`\``}if(this.tc.toolName===`shell_exec`&&typeof e.command==`string`)return this.tc.error?`\`\`\`\n${e.command}\n\`\`\``:``;let t=``;try{t=JSON.stringify(e,null,2)}catch{t=String(e)}return`\`\`\`json\n${t}\n\`\`\``},resultSource(){let e=this.tc.result;if(e==null||e===``||this.boardPicks.length&&!this.tc.error)return``;let t=typeof e==`string`?e:JSON.stringify(e);try{t=JSON.stringify(JSON.parse(t),null,2)}catch{}t.length>4e3&&(t=`${t.slice(0,4e3)}\n…(已截断)`);let n=`\`\`\`json\n${t}\n\`\`\``;return this.tc.truncated?`${n}\n\n> 结果过长,面板只显示前 4000 字;喂给模型的上下文另有额度,不受此限。`:n}},methods:{toolLabel:ak,toggle(){this.opened=!this.open}}},Pk=[`aria-expanded`],Fk={key:0,class:`aitool__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Ik={key:1,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Lk={key:2,class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Rk={class:`aitool__name`},zk={class:`aitool__args`},Bk=[`title`],Vk=[`title`],Hk={key:0,class:`aitool__approve`},Uk=[`title`],Wk={class:`aitool__approve-hint`},Gk={class:`aitool__approve-hint`},Kk=[`title`],qk={class:`aitool__body`},Jk={key:0,class:`aitool__picks`},Yk=[`title`,`aria-label`,`onClick`],Xk={class:`aitool__pick-no`},Zk={class:`aitool__pick-arg`},Qk=[`src`],$k={key:3,class:`aitool__error`};function eA(e,t,n,r,i,a){let o=L(`MarkdownBody`);return B(),V(z,null,[K(` 单次工具调用:一行摘要,可展开看参数 / 结果 / 截图。
298
300
  抽成独立组件的原因:ChatMessage 要把「连续同名调用」折叠成分组行,
299
- 分组展开后的成员行与平铺行走的是同一份标记,复制两遍必然漂移 `),U(`div`,{class:A([`aitool`,[`aitool--${a.state}`,{"is-open":a.open}]])},[U(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.open?`true`:`false`,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[7]||=U(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),a.state===`running`||a.state===`pending`?(B(),V(`svg`,Ek,[...t[4]||=[U(`use`,{href:`#icon-loading`},null,-1)]])):a.state===`error`?(B(),V(`svg`,Dk,[...t[5]||=[U(`use`,{href:`#icon-alert-triangle`},null,-1)]])):(B(),V(`svg`,Ok,[...t[6]||=[U(`use`,{href:`#icon-check`},null,-1)]])),U(`span`,kk,j(a.toolLabel(n.tc.toolName)),1),U(`code`,Ak,j(n.tc.pending?`参数生成中…`:a.argSummary),1),K(` 时间三件套:这一步什么时候开始(墙钟)· 距回合起点多久(累计)· 自身耗时。
300
- 长任务里「卡在哪一步、卡了多久」全靠这三个数互相对齐 `),a.clockText?(B(),V(`span`,{key:3,class:`aitool__clock`,title:a.clockTitle},j(a.clockText),9,jk)):K(`v-if`,!0),a.msText?(B(),V(`span`,{key:4,class:`aitool__ms`,title:`本步耗时 ${a.msText}`},j(a.msText),9,Mk)):K(`v-if`,!0)],8,Tk),K(` 高危执行逐次确认:命令原文 + 允许一次 / 本回合不再询问 / 拒绝(Codex 审批的同款交互) `),n.tc.needsApproval?(B(),V(`div`,Nk,[t[8]||=U(`svg`,{class:`aitool__approve-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`code`,{class:`aitool__approve-cmd`,title:a.approvalCommand},j(a.approvalCommand),9,Pk),U(`span`,Fk,j(n.tc.toolName===`skill_exec`?`技能脚本,需要你确认`:`本地命令,需要你确认`),1),U(`button`,{type:`button`,class:`aitool__approve-btn`,onClick:t[1]||=q(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`once`}),[`stop`])},`允许一次`),U(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--ghost`,onClick:t[2]||=q(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`turn`}),[`stop`])},`本回合不再询问`),U(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--deny`,onClick:t[3]||=q(t=>e.$emit(`approval`,{tc:n.tc,ok:!1}),[`stop`])},`拒绝`)])):n.tc.approvalNote?(B(),V(z,{key:1},[K(` 免确认策略命中:没有审批条,但照样把「跑了什么命令」摆出来,免确认不等于无痕迹 `),U(`div`,{class:A([`aitool__approve-note`,{"is-auto":n.tc.autoApproved}])},[U(`span`,Ik,j(n.tc.approvalNote),1),n.tc.autoApproved&&n.tc.command?(B(),V(`code`,{key:0,class:`aitool__approve-cmd`,title:n.tc.command},j(n.tc.command),9,Lk)):K(`v-if`,!0)],2)],2112)):K(`v-if`,!0),I(U(`div`,Rk,[K(` 画板清单点选:清单里是 1 起的板号、--indices 是 0 起,让用户/模型去换算,实测就是这么
301
- 错一位建错画板的。点一下 = 把清单行尾那串原样的 --pick 直接发给模型,中间零翻译 `),a.boardPicks.length?(B(),V(`div`,zk,[t[9]||=U(`div`,{class:`aitool__picks-hint`},`点一下直接建卡 = 照抄清单行尾的 --pick,不用换算序号;一板多卡已按张拆开:`,-1),(B(!0),V(z,null,R(a.boardPicks,t=>(B(),V(`button`,{key:t.pick,type:`button`,class:`aitool__pick`,title:`${t.name}(${t.size})→ parse_meaxure.py --pick ${t.pick}`,"aria-label":`建卡:画板 ${t.no} ${t.name}(${t.size})--pick ${t.pick}`,onClick:n=>e.$emit(`pick-board`,t)},[U(`span`,Vk,`第 `+j(t.no)+` 板`,1),U(`code`,Hk,j(t.token),1)],8,Bk))),128))])):K(`v-if`,!0),a.argsSource?(B(),H(o,{key:1,source:a.argsSource},null,8,[`source`])):K(`v-if`,!0),n.tc.image?(B(),V(`img`,{key:2,class:`aitool__shot`,src:`data:${n.tc.image.mime||`image/png`};base64,${n.tc.image.base64}`,alt:`卡片截图`},null,8,Uk)):K(`v-if`,!0),n.tc.error?(B(),V(`div`,Wk,j(n.tc.error),1)):a.resultSource?(B(),H(o,{key:4,source:a.resultSource},null,8,[`source`])):K(`v-if`,!0)],512),[[Sc,a.open]])],2)],2112)}var Kk=X(wk,[[`render`,Gk],[`__scopeId`,`data-v-c80ddf1d`],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatToolRow.vue`]]);function qk(e){return`${Fl()||``}/__ai/fs/raw?path=${encodeURIComponent(e)}`}async function Jk(e){let t=await e.json().catch(()=>({}));if(!e.ok){let n=``;try{n=new URL(e.url).pathname}catch{}let r=(e.status===404||e.status===405)&&n.startsWith(`/__ai/`)?`本地开发服务仍在运行改造前的旧代码(缺少该接口),请重启 npm run dev(cardbuddy)后重试`:t.message||t.error||`HTTP ${e.status}`,i=Error(r);throw i.code=t.error,i.payload=t,i}return t}async function Yk(e=!1){return Jk(await J(`/__ai/config${e?`?reveal=1`:``}`))}async function Xk(e){return Jk(await J(`/__ai/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function Zk(){return Jk(await J(`/__ai/models`))}async function Qk(){return Jk(await J(`/__ai/cc-switch-providers`))}async function $k(e,t=!1){return Jk(await J(`/__ai/models/${encodeURIComponent(e)}${t?`?reveal=1`:``}`))}async function eA(e){return Jk(await J(`/__ai/models`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function tA(e,t){return Jk(await J(`/__ai/models/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}))}async function nA(e){return Jk(await J(`/__ai/models/${encodeURIComponent(e)}`,{method:`DELETE`}))}async function rA(e){return Jk(await J(`/__ai/models/${encodeURIComponent(e)}/activate`,{method:`POST`}))}async function iA(e={}){let{baseUrl:t=``,apiKey:n=``,model:r=``}=e||{};return Jk(await J(`/__ai/probe-maxtokens`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({baseUrl:t,apiKey:n,model:r})}))}async function aA(e){return Jk(await J(`/__ai/ping`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function oA(e=`image`){return Jk(await J(`/__ai/fs/pick`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,multiple:!0})}))}async function sA(e){return Jk(await J(`/__ai/fs/stat?path=${encodeURIComponent(e)}`))}async function cA({name:e,relPath:t,size:n,child:r=``}){return Jk(await J(`/__ai/fs/locate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,relPath:t,size:n,child:r})}))}function lA(e,t,n=`request`){return new Promise((r,i)=>{let a=setTimeout(()=>{let e=Error(`${n}-timeout`);e.code=`timeout`,i(e)},t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})})}async function uA(e){return Jk(await J(`/__ai/fs/stash`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dataUrl:e})}))}async function dA({approvalId:e,ok:t,scope:n=`once`}){return Jk(await J(`/__ai/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvalId:e,ok:t,scope:n})}))}async function fA(e){return e?Jk(await J(`/__ai/history?cardId=${encodeURIComponent(e)}`)):{cardId:``,messages:[],updatedAt:0}}async function pA(e,t,n={}){return e?Jk(await J(`/__ai/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e,messages:t}),keepalive:n.keepalive===!0})):{ok:!1,error:`missing-card-id`}}async function mA(e){return e?Jk(await J(`/__ai/history?cardId=${encodeURIComponent(e)}`,{method:`DELETE`})):{ok:!1,error:`missing-card-id`}}async function hA(e,t){let n=e.body.getReader(),r=new TextDecoder,i=``,a=e=>{i+=e;let n=i.split(`
302
- `);i=n.pop()||``;for(let e of n){let n=e.trim();if(!n.startsWith(`data:`))continue;let r=n.slice(5).trim();if(!r)continue;let i;try{i=JSON.parse(r)}catch{continue}if(t(i)===!0)return!0}return!1};try{for(;;){let{done:e,value:t}=await n.read();if(e||a(r.decode(t,{stream:!0})))break}a(r.decode())}finally{try{n.releaseLock?.()}catch{}}}async function gA({messages:e,cardContext:t,attachments:n=[],config:r={},signal:i,onEvent:a}){let o=await J(`/__ai/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({messages:e,cardContext:t,attachments:n,config:r}),signal:i});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t.payload=e,t}await hA(o,e=>(a(e),e.type===`done`))}async function _A(e){return e?Jk(await J(`/__ai/turns?cardId=${encodeURIComponent(e)}`)):{cardId:``,active:null,recent:[]}}async function vA(e){return e?Jk(await J(`/__ai/stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})})):{ok:!1,error:`missing-card-id`}}async function yA({cardId:e,afterSeq:t=0,turnId:n=``,signal:r,onEvent:i}){if(!e){let e=Error(`缺少 cardId,无法续订回合`);throw e.code=`missing-card-id`,e}let a=new URLSearchParams({cardId:e,afterSeq:String(Number(t)||0)});n&&a.set(`turnId`,String(n));let o=await J(`/__ai/turn?${a}`,{signal:r});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t}let s=Number(t)||0;return await hA(o,e=>{let t=Number(e.seq)||0;return t>s&&(s=t),i(e),!1}),s}function bA(e,t,n=300){let r=String(e??``),i=Math.max(0,Math.min(Number(t)||0,r.length));return i<Math.max(0,Number(n)||0)?{head:``,tail:r,folded:!1}:{head:r.slice(0,i),tail:r.slice(i),folded:!0}}var xA=3,SA={name:`ChatMessage`,components:{MarkdownBody:JO,ChatToolRow:Kk},props:{msg:{type:Object,required:!0},streaming:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},canRollback:{type:Boolean,default:!1},nowTs:{type:Number,default:0},canRegenerate:{type:Boolean,default:!1},pickOwner:{type:Object,default:null}},emits:[`regenerate`,`approval`,`continue`,`rollback`,`open-settings`,`show-all-steps`,`locate-node`,`pick-board`],data(){return{thinkOpen:!1,narrOpen:!1,eventsOpen:null,copied:!1,elapsed:0,openGroups:Object.create(null),errorCopied:!1,_tick:0}},computed:{budgetLabel(){return{loop:`死循环熔断`,timeout:`墙钟熔断`,steps:`步数硬顶`}[this.msg.budget?.reason]||`本轮收尾`},budgetHint(){return{loop:`连续多轮同工具同参数 = 拿不到新信息。回复「继续」前最好补一句新思路(换证据链 / 指定要改的字段),否则大概率原地再转一次。`,timeout:`本轮跑到墙钟上限(AI_TURN_TIMEOUT_MS 可调)。回复「继续」会带着完整上下文从中断处接着做。`,steps:`你在设置里配了「单轮步数上限」。留空即不限步数,失控由死循环 / 墙钟熔断兜住。`}[this.msg.budget?.reason]||`上下文已保留,回复「继续」可接着做。`},attachments(){return Array.isArray(this.msg.attachments)?this.msg.attachments:[]},toolCalls(){return Array.isArray(this.msg.toolCalls)?this.msg.toolCalls:[]},msgTs(){return Number(this.msg.ts)||0},turnClock(){let e=this.msgTs,t=Number(this.msg.elapsedMs)||0,n=e&&t>0?e+t:0;if(!n)for(let e of this.toolCalls)n=Math.max(n,nk(e,this.nowTs));return{stamp:ek(e),endStamp:n>e?ek(n):``,total:n>e?$O(n-e):``}},toolGroups(){let e=[],t=[],n=()=>{if(t.length>=xA)e.push({kind:`group`,key:`g-${t[0].toolCallId||e.length}`,toolName:t[0].toolName,rows:t.slice(),ms:t.reduce((e,t)=>e+(Number(t.ms)||0),0),failed:t.filter(e=>e.error).length,clock:this.groupClock(t)});else for(let n of t)e.push({kind:`row`,key:n.toolCallId||`r-${e.length}`,tc:n});t=[]};for(let e of this.toolCalls)if(!(this.compact&&!ok(e))){if(t.length&&t[0].toolName===e.toolName){t.push(e);continue}n(),t=[e]}return n(),e},hiddenSteps(){return this.compact?this.toolCalls.filter(e=>!ok(e)).length:0},summary(){return pk(this.toolCalls)},showSummary(){if(this.streaming)return!1;let e=this.summary;return!!(e.writes||e.writeFails||e.gate||e.validate||e.failed||this.cacheBadge)},cacheBadge(){let e=this.msg.usage;if(!e||!Number(e.promptTokens))return null;let t=Number(e.promptTokens)||0,n=Number(e.cachedTokens)||0,r=Number(e.steps)||0,i=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);if(!e.reported)return{label:`缓存未提供`,ok:!1,title:`本回合累计输入 ${i(t)} token(${r} 步):该网关未回缓存命中字段,无法统计命中率`};let a=Number(e.hitRate)||0;return{label:`缓存命中 ${a}%`,ok:a>=50,title:`本回合累计输入 ${i(t)} token(${r} 步,命中 ${i(n)} / 未命中 ${i(t-n)}):命中量按网关的 64 token 块对齐,未命中部分多为本轮新增的工具结果与收尾提示`}},validateIssues(){let e=this.summary.validate;return e&&Array.isArray(e.issues)?e.issues:[]},validateMore(){let e=this.summary.validate;return e?Math.max(0,(e.errors||0)+(e.warnings||0)-this.validateIssues.length):0},advice(){return this.msg.error?hk(this.msg.errorCode||``):{hint:``,action:``}},errorHint(){return this.advice.hint},errorAction(){return this.advice.action},events(){return Array.isArray(this.msg.events)?this.msg.events:[]},hasErrorEvent(){return this.events.some(e=>e.level===`error`)},eventsExpanded(){return this.eventsOpen===null?this.hasErrorEvent:this.eventsOpen},eventsLabel(){let e=this.events.filter(e=>e.level!==`info`).length;return e?`过程事件 ${this.events.length} 条(${e} 条需留意)`:`过程事件 ${this.events.length} 条`},bodyText(){return PO(this.bodySplit.tail.replace(/\n*\[\s*(?:任务完成|需用户确认)\s*\]\s*$/,``).trimEnd(),qk)},bodySplit(){return bA(this.msg.content,this.msg.narrationChars)},narrationText(){return this.bodySplit.head?PO(this.bodySplit.head,qk):``},narrationSize(){return this.bodySplit.head.length.toLocaleString(`zh-CN`)},thinking(){return!!(this.streaming&&!this.msg.content&&!this.toolCalls.length)},streamingText(){return!!(this.streaming&&this.msg.content)},waiting(){return!!(this.streaming&&!this.msg.reasoning&&!this.msg.content&&!this.toolCalls.length&&!this.msg.error)},thinkLabel(){return this.thinking?`思考中… ${this.fmtClock(this.elapsedMs)}`:`已思考 ${this.fmtClock(this.msg.reasoningMs||this.elapsedMs)}`},elapsedMs(){return this.thinking?this.elapsed:this.msg.reasoningMs||this.elapsed},peek(){let e=String(this.msg.reasoning||``).split(`
303
- `).map(e=>e.trim()).filter(Boolean),t=e[e.length-1]||``;return t.length>72?`${t.slice(0,72)}…`:t}},watch:{streaming:{immediate:!0,handler(e){e?this.startTick():this.stopTick()}},thinking(e){e||this.stopTick()}},beforeUnmount(){this.stopTick()},updated(){let e=this.$refs.thinkPre;e&&this.thinkOpen&&this.thinking&&(e.scrollTop=e.scrollHeight)},methods:{startTick(){this.stopTick(),this.elapsed=0,this._tick=setInterval(()=>{this.elapsed+=250},250)},stopTick(){this._tick&&clearInterval(this._tick),this._tick=0},fmtStamp:ek,fmtClock:$O,evOff(e){let t=Number(e&&e.ts)||0;return t>this.msgTs?tk(t-this.msgTs):``},groupClock(e){let t=nk(e[e.length-1],this.nowTs),n=t>this.msgTs?tk(t-this.msgTs):``;return[ek(e[0]&&e[0].startedAt),n].filter(Boolean).join(` · `)},fileUrl(e){return qk(e)},attSub(e){return e.exists===!1?`路径不可读`:e.isDir?`${e.entryCount??e.entries?.length??0} 项`:this.formatSize(e.size)},formatSize(e){let t=Number(e||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`:`0 B`},toolLabel:XO,msText(e){let t=Number(e)||0;return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:``},groupOpen(e){let t=this.openGroups[e.key];if(t!==void 0)return t;if(e.failed)return!0;let n=e.rows[e.rows.length-1];return!!(n&&n.result===void 0&&!n.error)},toggleGroup(e){this.openGroups={...this.openGroups,[e.key]:!this.groupOpen(e)}},onApproval(e){this.$emit(`approval`,e)},async copyError(){await op(`${this.msg.errorCode?`[${this.msg.errorCode}] `:``}${String(this.msg.error||``)}`)&&(this.errorCopied=!0,setTimeout(()=>{this.errorCopied=!1},1600))},async copyText(){await op(String(this.msg.content||``))&&(this.copied=!0,setTimeout(()=>{this.copied=!1},1600))}}},CA={key:0,class:`aimsg__files`},wA=[`title`],TA=[`src`,`alt`],EA={key:1,class:`aifile__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},DA=[`href`],OA={class:`aifile__meta`},kA={class:`aifile__name`},AA={class:`aifile__sub`},jA={key:1,class:`aimsg__bubble`},MA=[`aria-expanded`],NA={key:0,class:`aithink__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},PA={key:1,class:`aithink__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},FA={class:`aithink__label`},IA={key:2,class:`aithink__peek`},LA={class:`aithink__body`},RA={key:1,class:`aiwait`},zA=[`aria-expanded`,`onClick`],BA={class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},VA=[`href`],HA={class:`aitool__name`},UA={class:`aitool__count`},WA={class:`aitool__args`},GA=[`title`],KA=[`title`],qA={class:`aitool__groupbody`},JA=[`aria-expanded`],YA={class:`aiev__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},XA=[`href`],ZA={class:`aiev__label`},QA={class:`aiev__body`},$A={class:`aiev__time`},ej={key:0,class:`aiev__off`,title:`距本轮开始的累计耗时`},tj={class:`aiev__msg`},nj=[`aria-expanded`,`title`],rj={class:`ainarr__label`},ij={class:`ainarr__hint`},aj={class:`ainarr__body`},oj={key:6,class:`aisum`},sj={class:`aisum__head`},cj=[`title`],lj={class:`aisum__chips`},uj={key:0,class:`aisum__chip aisum__chip--ok`},dj={key:1,class:`aisum__chip aisum__chip--danger`},fj={key:2,class:`aisum__chip`},pj={key:4,class:`aisum__chip aisum__chip--warn`},mj=[`title`],hj={key:1,class:`aisum__issues`},gj={class:`aisum__issue-list`},_j={class:`aisum__issue-text`},vj=[`title`,`onClick`],yj={key:0,class:`aisum__issues-more`},bj={key:7,class:`aimsg__error`},xj={class:`aimsg__error-main`},Sj={class:`aimsg__error-text`},Cj={key:0,class:`aimsg__error-hint`},wj={key:1,class:`aimsg__error-time`},Tj={key:2,class:`aimsg__error-acts`},Ej={key:8,class:`aimsg__aborted`},Dj={key:0,class:`aimsg__aborted-time`},Oj=[`title`],kj={class:`aimsg__budget-text`},Aj={key:10,class:`aimsg__acts`},jj=[`title`],Mj={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Nj=[`href`];function Pj(e,t,n,r,i,a){let o=L(`ChatToolRow`),s=L(`MarkdownBody`);return B(),V(`article`,{class:A([`aimsg`,[`aimsg--${n.msg.role}`,{"aimsg--live":n.streaming}]])},[K(` ===== 用户消息:附件芯片 + 文本气泡 ===== `),n.msg.role===`user`?(B(),V(z,{key:0},[a.attachments.length?(B(),V(`div`,CA,[(B(!0),V(z,null,R(a.attachments,e=>(B(),V(`div`,{key:e.path,class:A([`aifile`,{"aifile--dir":e.isDir,"aifile--missing":e.exists===!1}]),title:e.path},[e.isImage?(B(),V(`img`,{key:0,class:`aifile__thumb`,src:a.fileUrl(e.path),alt:e.name,loading:`lazy`},null,8,TA)):(B(),V(`svg`,EA,[U(`use`,{href:e.isDir?`#icon-folder-plus`:`#icon-file-text`},null,8,DA)])),U(`span`,OA,[U(`span`,kA,j(e.name),1),U(`span`,AA,j(a.attSub(e)),1)])],10,wA))),128))])):K(`v-if`,!0),n.msg.content?(B(),V(`div`,jA,j(n.msg.content),1)):K(`v-if`,!0)],64)):(B(),V(z,{key:1},[K(` ===== 助手消息:思考 → 工具 → 正文(与 Codex 同序) ===== `),K(` 思考过程:默认折叠成一行,进行中给「计时 + 最新一行」预览,结束收成「已思考 N 秒」 `),n.msg.reasoning?(B(),V(`div`,{key:0,class:A([`aithink`,{"is-open":i.thinkOpen,"is-live":a.thinking}])},[U(`button`,{type:`button`,class:`aithink__head`,"aria-expanded":i.thinkOpen?`true`:`false`,onClick:t[0]||=e=>i.thinkOpen=!i.thinkOpen},[t[17]||=U(`svg`,{class:`aithink__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),a.thinking?(B(),V(`svg`,NA,[...t[15]||=[U(`use`,{href:`#icon-loading`},null,-1)]])):(B(),V(`svg`,PA,[...t[16]||=[U(`use`,{href:`#icon-sparkles`},null,-1)]])),U(`span`,FA,j(a.thinkLabel),1),a.thinking&&!i.thinkOpen?(B(),V(`span`,IA,j(a.peek),1)):K(`v-if`,!0)],8,MA),I(U(`div`,LA,[U(`pre`,{ref:`thinkPre`},j(n.msg.reasoning),513)],512),[[Sc,i.thinkOpen]])],2)):K(`v-if`,!0),K(` 首个 token 之前的等待态 `),a.waiting?(B(),V(`div`,RA,[...t[18]||=[U(`span`,{class:`aiwait__dot`},null,-1),U(`span`,{class:`aiwait__dot`},null,-1),U(`span`,{class:`aiwait__dot`},null,-1),U(`span`,{class:`aiwait__text`},`正在思考`,-1)]])):K(`v-if`,!0),K(` 工具调用:平铺单次调用;连续同名 ≥3 次折叠成分组行(长任务里几十次 card_read 不该刷屏)。
304
- 行标记抽到 ChatToolRow:分组内成员与平铺行走同一份模板,两处不会漂移 `),(B(!0),V(z,null,R(a.toolGroups,r=>(B(),V(z,{key:r.key},[r.kind===`row`?(B(),H(o,{key:0,tc:r.tc,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[1]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`])):(B(),V(`div`,{key:1,class:A([`aitool aitool--group`,[r.failed?`aitool--error`:`aitool--done`,{"is-open":a.groupOpen(r)}]])},[U(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.groupOpen(r)?`true`:`false`,onClick:e=>a.toggleGroup(r)},[t[19]||=U(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),(B(),V(`svg`,BA,[U(`use`,{href:r.failed?`#icon-alert-triangle`:`#icon-check`},null,8,VA)])),U(`span`,HA,j(a.toolLabel(r.toolName)),1),U(`span`,UA,`×`+j(r.rows.length),1),U(`code`,WA,j(r.failed?`${r.failed} 次失败,点开看原因`:`连续 ${r.rows.length} 次,点开逐条查看`),1),K(` 分组行同样给「首次调用时刻 · 累计到最后一次」:折叠不等于把时间线也折掉 `),r.clock?(B(),V(`span`,{key:0,class:`aitool__clock`,title:`首次调用 ${r.clock.split(` · `)[0]} · 距本轮开始的累计耗时(算到最后一次)`},j(r.clock),9,GA)):K(`v-if`,!0),r.ms?(B(),V(`span`,{key:1,class:`aitool__ms`,title:`${r.rows.length} 次调用合计耗时`},j(a.msText(r.ms)),9,KA)):K(`v-if`,!0)],8,zA),I(U(`div`,qA,[(B(!0),V(z,null,R(r.rows,r=>(B(),H(o,{key:r.toolCallId,tc:r,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[2]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`]))),128))],512),[[Sc,a.groupOpen(r)]])],2))],64))),128)),K(` 紧凑视图折叠掉的读取类调用:留一行出口,一键回到全量视图(不必去面板头部找开关) `),a.hiddenSteps?(B(),V(`button`,{key:2,type:`button`,class:`aitool__hidden`,onClick:t[3]||=t=>e.$emit(`show-all-steps`)},[t[20]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-eye`})],-1),U(`span`,null,`紧凑视图已折叠 `+j(a.hiddenSteps)+` 次读取类调用,点这里显示全部步骤`,1)])):K(`v-if`,!0),K(` 过程事件时间线:后端 notice / round-retry 的持久落点。横幅只留最近一条且 6 秒即逝,
305
- 「上下文折叠过几次 / 自动续跑过几次 / 网关重试过没有」这些线索全靠这里留存 `),a.events.length?(B(),V(`div`,{key:3,class:A([`aiev`,{"is-open":a.eventsExpanded}])},[U(`button`,{type:`button`,class:`aiev__head`,"aria-expanded":a.eventsExpanded?`true`:`false`,onClick:t[4]||=e=>i.eventsOpen=!a.eventsExpanded},[t[21]||=U(`svg`,{class:`aiev__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),(B(),V(`svg`,YA,[U(`use`,{href:a.hasErrorEvent?`#icon-alert-triangle`:`#icon-activity`},null,8,XA)])),U(`span`,ZA,j(a.eventsLabel),1)],8,JA),I(U(`ol`,QA,[(B(!0),V(z,null,R(a.events,(e,t)=>(B(),V(`li`,{key:t,class:A([`aiev__row`,`aiev__row--${e.level}`])},[U(`span`,$A,j(a.fmtStamp(e.ts)),1),a.evOff(e)?(B(),V(`span`,ej,j(a.evOff(e)),1)):K(`v-if`,!0),U(`span`,tj,j(e.message),1)],2))),128))],512),[[Sc,a.eventsExpanded]])],2)):K(`v-if`,!0),K(` 过程性正文:模型把推理过程当正文写出来时(实测单回合 46.7 万字),
306
- 把「最后一次工具调用之前」那段折成一行——收尾结论照常展开,记录不再是一堵墙 `),a.narrationText?(B(),V(`div`,{key:4,class:A([`ainarr`,{"is-open":i.narrOpen}])},[U(`button`,{type:`button`,class:`ainarr__head`,"aria-expanded":i.narrOpen?`true`:`false`,title:i.narrOpen?`收起过程说明`:`展开过程说明(模型在本轮工具调用前的推理正文)`,onClick:t[5]||=e=>i.narrOpen=!i.narrOpen},[t[22]||=U(`svg`,{class:`ainarr__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),t[23]||=U(`svg`,{class:`ainarr__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-activity`})],-1),U(`span`,rj,`过程说明 `+j(a.narrationSize)+` 字`,1),U(`span`,ij,j(i.narrOpen?`收起`:`展开`),1)],8,nj),I(U(`div`,aj,[W(s,{source:a.narrationText},null,8,[`source`])],512),[[Sc,i.narrOpen]])],2)):K(`v-if`,!0),K(` 正文:Markdown(流式重渲染 + 代码块高亮 / 复制) `),a.bodyText?(B(),H(s,{key:5,class:A([`aimsg__md`,{"is-streaming":a.streamingText}]),source:a.bodyText,streaming:a.streamingText},null,8,[`class`,`source`,`streaming`])):K(`v-if`,!0),K(` 本次改动摘要:写入次数 / 校验错误 / 门禁结论都从工具行就地算——落盘记录里同样算得出来,
307
- 所以重开面板、刷新之后这条摘要依然在,而不是只在当轮可见 `),a.showSummary?(B(),V(`div`,oj,[U(`span`,sj,[t[25]||=U(`svg`,{class:`aisum__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-activity`})],-1),t[26]||=U(`span`,{class:`aisum__title`},`本次改动`,-1),K(` 本轮的时间坐标:几点开始、一共跑了多久。摘要条是回合的收尾锚点,这两个数在这里最有用 `),a.turnClock.stamp?(B(),V(`span`,{key:0,class:`aisum__clock`,title:`本轮 ${a.turnClock.stamp} 开始${a.turnClock.endStamp?`,${a.turnClock.endStamp} 收尾`:``}`},[G(j(a.turnClock.stamp)+` 开始`,1),a.turnClock.total?(B(),V(z,{key:0},[G(` · 累计 `+j(a.turnClock.total),1)],64)):K(`v-if`,!0)],8,cj)):K(`v-if`,!0),U(`span`,lj,[a.summary.writes?(B(),V(`span`,uj,`写入 `+j(a.summary.writes)+` 次`,1)):K(`v-if`,!0),a.summary.writeFails?(B(),V(`span`,dj,`写入失败 `+j(a.summary.writeFails)+` 次`,1)):K(`v-if`,!0),a.summary.shots?(B(),V(`span`,fj,`截图自检 `+j(a.summary.shots)+` 次`,1)):K(`v-if`,!0),a.summary.validate?(B(),V(`span`,{key:3,class:A([`aisum__chip`,a.summary.validate.ok?`aisum__chip--ok`:`aisum__chip--danger`])},`校验 `+j(a.summary.validate.errors)+` 错 / `+j(a.summary.validate.warnings)+` 警`,3)):K(`v-if`,!0),a.summary.failed?(B(),V(`span`,pj,j(a.summary.failed)+` 次调用报错`,1)):K(`v-if`,!0),a.cacheBadge?(B(),V(`span`,{key:5,class:A([`aisum__chip`,a.cacheBadge.ok?`aisum__chip--ok`:``]),title:a.cacheBadge.title},j(a.cacheBadge.label),11,mj)):K(`v-if`,!0)]),n.canRollback&&a.summary.writes?(B(),V(`button`,{key:1,type:`button`,class:`aisum__rollback`,title:`取本轮第一次写入前的历史快照,回到 AI 动手之前的版本;回滚本身可再撤销,确认后仍需点「保存到本地」才落盘`,onClick:t[6]||=t=>e.$emit(`rollback`,n.msg)},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-undo`})],-1),U(`span`,null,`回滚到本轮之前`,-1)]])):K(`v-if`,!0)]),K(` 门禁结论原样透出:这是唯一的机器判定,不能被模型自述的「已通过」覆盖 `),a.summary.gate?(B(),V(`p`,{key:0,class:A([`aisum__verdict`,a.summary.gate.passed?`is-pass`:`is-fail`])},[U(`strong`,null,`收尾门禁`+j(a.summary.gate.passed?`通过`:`未通过`),1),a.summary.gate.verdict?(B(),V(z,{key:0},[G(`:`+j(a.summary.gate.verdict),1)],64)):K(`v-if`,!0)],2)):K(`v-if`,!0),K(` 校验问题可点定位(P2-14):校验器在每条消息末尾挂了 #componentId,点「定位」就在画布与
308
- 组件结构里选中那个节点——不用再照着一句 "at depth 1[0]" 自己去树里翻 `),a.validateIssues.length?(B(),V(`div`,hj,[t[28]||=U(`p`,{class:`aisum__issues-head`},[G(`校验问题`),U(`span`,{class:`aisum__issues-hint`},`点图标跳到该节点`)],-1),U(`ul`,gj,[(B(!0),V(z,null,R(a.validateIssues,(n,r)=>(B(),V(`li`,{key:r,class:A([`aisum__issue`,n.level===`error`?`is-error`:`is-warn`])},[U(`span`,_j,j(n.text),1),n.cid?(B(),V(`button`,{key:0,type:`button`,class:`aisum__issue-go`,title:`在画布与组件结构中定位 `+n.cid,"aria-label":`定位该节点`,onClick:t=>e.$emit(`locate-node`,n.cid)},[...t[27]||=[U(`svg`,{class:`aisum__issue-go-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-locate`})],-1)]],8,vj)):K(`v-if`,!0)],2))),128))]),a.validateMore?(B(),V(`p`,yj,`另有 `+j(a.validateMore)+` 条:展开对应工具行看全部原文`,1)):K(`v-if`,!0)])):K(`v-if`,!0)])):K(`v-if`,!0),n.msg.error?(B(),V(`div`,bj,[t[29]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,xj,[U(`span`,Sj,j(n.msg.error),1),K(` 错误分级:后端给 code,这里给「怎么办」与对应的定向动作,不再只丢一句原文让人自己猜 `),a.errorHint?(B(),V(`span`,Cj,j(a.errorHint),1)):K(`v-if`,!0),K(` 失败也要有时刻与累计:报网关工单 / 对后端日志时,「几点失败、跑了多久」是第一句要交代的话 `),a.turnClock.endStamp?(B(),V(`span`,wj,j(a.turnClock.endStamp)+` 失败 · 本轮已用 `+j(a.turnClock.total),1)):K(`v-if`,!0),n.streaming?K(`v-if`,!0):(B(),V(`span`,Tj,[a.errorAction===`settings`?(B(),V(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[7]||=t=>e.$emit(`open-settings`)},`打开设置`)):K(`v-if`,!0),n.canRegenerate?(B(),V(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[8]||=t=>e.$emit(`regenerate`,n.msg)},`重试本轮`)):K(`v-if`,!0),n.canRegenerate?(B(),V(`button`,{key:2,type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[9]||=t=>e.$emit(`continue`)},`从中断处继续`)):K(`v-if`,!0),U(`button`,{type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[10]||=(...e)=>a.copyError&&a.copyError(...e)},j(i.errorCopied?`已复制`:`复制错误`),1)]))])])):K(`v-if`,!0),K(` 手动终止同样给续跑入口:已落盘产物与上下文都还在,点一下就能接着做。
309
- 此前只有熔断收尾(budget)分支有按钮,手滑终止后用户只能自己打字 `),n.msg.status===`aborted`?(B(),V(`div`,Ej,[t[30]||=U(`span`,{class:`aimsg__aborted-text`},`已终止生成`,-1),a.turnClock.endStamp?(B(),V(`span`,Dj,j(a.turnClock.endStamp)+` 终止 · 已用 `+j(a.turnClock.total),1)):K(`v-if`,!0),n.canRegenerate&&!n.streaming?(B(),V(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[11]||=t=>e.$emit(`continue`)},`从中断处继续`)):K(`v-if`,!0)])):n.msg.budget?.message?(B(),V(`div`,{key:9,class:`aimsg__budget`,title:a.budgetHint},[t[31]||=U(`svg`,{class:`aimsg__budget-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,kj,[U(`strong`,null,j(a.budgetLabel),1),G(`:`+j(n.msg.budget.message)+`(上下文已保留)`,1)]),n.canRegenerate&&!n.streaming?(B(),V(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[12]||=t=>e.$emit(`continue`)},`继续这轮`)):K(`v-if`,!0)],8,Oj)):K(`v-if`,!0),K(` 悬停操作:复制 / 重新生成(仅最后一条助手消息可重发) `),n.msg.content||n.msg.error?(B(),V(`footer`,Aj,[U(`button`,{type:`button`,class:`aimsg__act`,title:i.copied?`已复制`:`复制回答`,onClick:t[13]||=(...e)=>a.copyText&&a.copyText(...e)},[(B(),V(`svg`,Mj,[U(`use`,{href:i.copied?`#icon-check`:`#icon-copy-sm`},null,8,Nj)])),U(`span`,null,j(i.copied?`已复制`:`复制`),1)],8,jj),n.canRegenerate&&!n.streaming?(B(),V(`button`,{key:0,type:`button`,class:`aimsg__act`,title:`丢弃这次回答并重新生成`,onClick:t[14]||=t=>e.$emit(`regenerate`,n.msg)},[...t[32]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1),U(`span`,null,`重新生成`,-1)]])):K(`v-if`,!0)])):K(`v-if`,!0)],64))],2)}var Fj=X(SA,[[`render`,Pj],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatMessage.vue`]]),Ij=106,Lj=.5,Rj=`cardbuddy:ai-composer-height`,zj={name:`ChatComposer`,props:{busy:{type:Boolean,default:!1},model:{type:String,default:``},attachments:{type:Array,default:()=>[]},placeholder:{type:String,default:`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`},context:{type:Object,default:null}},emits:[`send`,`stop`,`pick`,`add-path`,`remove-attachment`,`drop-files`,`paste-image`,`escape`],data(){return{text:``,attachOpen:!1,pathInputOpen:!1,pathText:``,dragOver:!1,heightPx:0,resizing:!1,_outside:null,_onWinResize:null}},computed:{canSend(){return!!(this.text.trim()||this.attachments.some(e=>!e.pending&&e.exists!==!1))},compStyle(){return this.heightPx>0?{height:`${this.heightPx}px`}:null},ctx(){let e=this.context;if(!e)return null;let t=Number(e.window)>0?Number(e.window):Number(e.total)>0?Number(e.total):0,n=Math.max(0,Number(e.used)||0);if(!(t>0))return null;let r=Math.min(1,n/t),i=2*Math.PI*8;return{pct:r,arc:(i*r).toFixed(2),circ:i.toFixed(2),pctLabel:`${Math.round(r*100)}%`,level:r>=.85?`danger`:r>=.6?`warn`:`ok`,used:n,total:t}},ctxTitle(){let e=this.ctx;if(!e)return``;let t=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e)),n=Number(this.context?.window)>0?` · 网关窗口 ${t(Number(this.context.window))}`:``;return`上下文占用 ${t(e.used)} / ${t(e.total)} token(${e.pctLabel})${n};接近上限时后端会自动折叠早期工具结果`}},mounted(){this._outside=e=>{let t=this.$refs.attachEl;t&&!t.contains(e.target)&&(this.attachOpen=!1)},document.addEventListener(`mousedown`,this._outside),this.loadHeight(),this._onWinResize=()=>this.clampHeight(),window.addEventListener(`resize`,this._onWinResize),this.autoGrow()},beforeUnmount(){this._outside&&document.removeEventListener(`mousedown`,this._outside),this._onWinResize&&window.removeEventListener(`resize`,this._onWinResize)},methods:{focus(){this.$nextTick(()=>this.$refs.taEl?.focus())},setText(e){this.text=e,this.focus(),this.autoGrow()},fileUrl(e){return qk(e)},chipSub(e){if(e.exists===!1)return`不可读`;if(e.isDir)return`${e.entryCount??e.entries?.length??0} 项`;let t=Number(e.size||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(0)} KB`:`${(t/1024/1024).toFixed(1)} MB`:``},autoGrow(){let e=this.$refs.taEl;if(e){if(this.heightPx>0){e.style.height=``;return}e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,168)}px`}},heightLimits(){let e=this.$el?.closest(`.aichat`)?.clientHeight||window.innerHeight;return{min:Ij,max:Math.max(Ij,Math.floor(e*Lj))}},clampHeight(){if(!this.heightPx)return;let{min:e,max:t}=this.heightLimits();this.heightPx=Math.max(e,Math.min(t,this.heightPx))},loadHeight(){try{let e=localStorage.getItem(Rj),t=e==null?0:parseInt(e,10);!Number.isNaN(t)&&t>=Ij&&(this.heightPx=t)}catch{}this.clampHeight()},saveHeight(){try{this.heightPx?localStorage.setItem(Rj,String(Math.round(this.heightPx))):localStorage.removeItem(Rj)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=this.$el.getBoundingClientRect().bottom,i=e=>{let{min:t,max:n}=this.heightLimits();this.heightPx=Math.max(t,Math.min(n,Math.round(r-e.clientY)))},a=()=>{t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,a),t.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveHeight()};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,a),t.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},resetHeight(){this.heightPx=0,this.saveHeight(),this.$nextTick(this.autoGrow)},onKeydown(e){if(e.key===`Escape`){e.preventDefault(),this.$emit(`escape`);return}e.key===`Enter`&&(e.isComposing||e.keyCode===229||e.shiftKey||(e.preventDefault(),this.busy||this.submit()))},submit(){if(this.busy||!this.canSend)return;let e={text:this.text.trim(),attachments:this.attachments.filter(e=>!e.pending&&e.exists!==!1)};this.text=``,this.attachOpen=!1,this.$nextTick(this.autoGrow),this.$emit(`send`,e)},toggleAttach(){this.attachOpen=!this.attachOpen},pick(e){this.attachOpen=!1,this.$emit(`pick`,e)},openPathInput(){this.attachOpen=!1,this.pathInputOpen=!0,this.pathText=``,this.$nextTick(()=>this.$refs.pathEl?.focus())},closePathInput(){this.pathInputOpen=!1,this.pathText=``},confirmPath(){let e=this.pathText.trim();e&&(this.$emit(`add-path`,e),this.closePathInput())},onDragEnter(){this.dragOver=!0},onDragOver(){this.dragOver=!0},onDragLeave(){this.dragOver=!1},onDrop(e){this.dragOver=!1;let t=e.dataTransfer;t&&this.$emit(`drop-files`,t)},async onPaste(e){let t=e.clipboardData?.items;if(t){for(let n of t)if(n.type&&n.type.indexOf(`image/`)===0){let t=n.getAsFile();if(!t)continue;e.preventDefault();let r=await new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result||``)),n.onerror=()=>e(``),n.readAsDataURL(t)});r&&this.$emit(`paste-image`,r);return}}}}},Bj={key:0,class:`aicomp__files`},Vj=[`title`],Hj=[`src`,`alt`],Uj={key:1,class:`aichip__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Wj=[`href`],Gj={class:`aichip__name`},Kj={key:2,class:`aichip__sub`},qj=[`onClick`],Jj={key:1,class:`aicomp__path`},Yj=[`disabled`],Xj=[`placeholder`],Zj={class:`aicomp__bar`},Qj={class:`aicomp__tools`},$j={class:`aicomp__attach`,ref:`attachEl`},eM={key:0,class:`aicomp__menu`,role:`menu`},tM={class:`aicomp__right`},nM=[`title`],rM={class:`aicomp__ctx-ring`,viewBox:`0 0 20 20`,"aria-hidden":`true`},iM=[`stroke-dasharray`],aM={class:`aicomp__ctx-pct`},oM=[`title`],sM=[`disabled`,`title`];function cM(e,t,n,r,i,a){return B(),V(`div`,{class:A([`aicomp`,{"is-busy":n.busy,"is-drag":i.dragOver,"is-manual":i.heightPx>0,"is-resizing":i.resizing}]),style:k(a.compStyle)},[K(` 上缘拖拽把手:调输入区高度(106px ~ 面板高度 50%,双击恢复自适应),与面板宽度把手同一套交互 `),U(`div`,{class:A([`aicomp__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整输入区高度(双击恢复自适应)`,onPointerdown:t[0]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=q((...e)=>a.resetHeight&&a.resetHeight(...e),[`prevent`])},null,34),K(` 已挂载的本地文件:只预览 + 传路径,不上传 `),n.attachments.length?(B(),V(`div`,Bj,[(B(!0),V(z,null,R(n.attachments,n=>(B(),V(`div`,{key:n.id||n.path,class:A([`aichip`,{"aichip--dir":n.isDir,"aichip--pending":n.pending,"aichip--missing":n.exists===!1}]),title:n.path},[n.isImage&&!n.pending?(B(),V(`img`,{key:0,class:`aichip__thumb`,src:a.fileUrl(n.path),alt:n.name,loading:`lazy`},null,8,Hj)):(B(),V(`svg`,Uj,[U(`use`,{href:n.pending?`#icon-loading`:n.isDir?`#icon-folder-plus`:n.isImage?`#icon-image`:`#icon-file-text`},null,8,Wj)])),U(`span`,Gj,j(n.pending?`解析路径中…`:n.name),1),n.pending?K(`v-if`,!0):(B(),V(`span`,Kj,j(a.chipSub(n)),1)),U(`button`,{type:`button`,class:`aichip__rm`,title:`移除`,onClick:t=>e.$emit(`remove-attachment`,n.id||n.path)},[...t[22]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]],8,qj)],10,Vj))),128))])):K(`v-if`,!0),K(` 粘贴绝对路径(非 macOS / 拖拽反查失败时的兜底入口) `),i.pathInputOpen?(B(),V(`div`,Jj,[I(U(`input`,{ref:`pathEl`,"onUpdate:modelValue":t[2]||=e=>i.pathText=e,class:`aicomp__path-input`,type:`text`,placeholder:`粘贴本地图片或文件夹的绝对路径,回车确认`,spellcheck:`false`,onKeydown:[t[3]||=vl(q((...e)=>a.confirmPath&&a.confirmPath(...e),[`prevent`]),[`enter`]),t[4]||=vl(q((...e)=>a.closePathInput&&a.closePathInput(...e),[`stop`,`prevent`]),[`esc`])]},null,544),[[il,i.pathText]]),U(`button`,{type:`button`,class:`aicomp__path-ok`,disabled:!i.pathText.trim(),onClick:t[5]||=(...e)=>a.confirmPath&&a.confirmPath(...e)},`添加`,8,Yj),U(`button`,{type:`button`,class:`aicomp__path-no`,onClick:t[6]||=(...e)=>a.closePathInput&&a.closePathInput(...e)},`取消`)])):K(`v-if`,!0),U(`div`,{class:`aicomp__box`,onDragenter:t[18]||=q((...e)=>a.onDragEnter&&a.onDragEnter(...e),[`prevent`]),onDragover:t[19]||=q((...e)=>a.onDragOver&&a.onDragOver(...e),[`prevent`]),onDragleave:t[20]||=q((...e)=>a.onDragLeave&&a.onDragLeave(...e),[`prevent`]),onDrop:t[21]||=q((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[I(U(`textarea`,{ref:`taEl`,"onUpdate:modelValue":t[7]||=e=>i.text=e,class:`aicomp__ta`,placeholder:n.placeholder,rows:`1`,onInput:t[8]||=(...e)=>a.autoGrow&&a.autoGrow(...e),onKeydown:t[9]||=(...e)=>a.onKeydown&&a.onKeydown(...e),onPaste:t[10]||=(...e)=>a.onPaste&&a.onPaste(...e)},null,40,Xj),[[il,i.text]]),U(`div`,Zj,[U(`div`,Qj,[U(`div`,$j,[U(`button`,{type:`button`,class:A([`aicomp__iconbtn`,{"is-open":i.attachOpen}]),title:`挂载本地图片 / 文件 / 文件夹`,onClick:t[11]||=(...e)=>a.toggleAttach&&a.toggleAttach(...e)},[...t[23]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-paperclip`})],-1)]],2),i.attachOpen?(B(),V(`div`,eM,[U(`button`,{type:`button`,role:`menuitem`,onClick:t[12]||=e=>a.pick(`image`)},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-image`})],-1),G(` 本地图片… `,-1)]]),U(`button`,{type:`button`,role:`menuitem`,onClick:t[13]||=e=>a.pick(`file`)},[...t[25]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-file-text`})],-1),G(` 本地文件… `,-1)]]),U(`button`,{type:`button`,role:`menuitem`,onClick:t[14]||=e=>a.pick(`folder`)},[...t[26]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-folder-plus`})],-1),G(` 本地文件夹… `,-1)]]),t[28]||=U(`div`,{class:`aicomp__menu-sep`},null,-1),U(`button`,{type:`button`,role:`menuitem`,onClick:t[15]||=(...e)=>a.openPathInput&&a.openPathInput(...e)},[...t[27]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-link`})],-1),G(` 粘贴路径… `,-1)]])])):K(`v-if`,!0)],512),t[29]||=U(`span`,{class:`aicomp__hint`},`拖拽文件 / 文件夹到此,或直接 ⌘V 粘贴截图`,-1)]),U(`div`,tM,[a.ctx?(B(),V(`span`,{key:0,class:A([`aicomp__ctx`,`is-${a.ctx.level}`]),title:a.ctxTitle},[(B(),V(`svg`,rM,[t[30]||=U(`circle`,{class:`aicomp__ctx-track`,cx:`10`,cy:`10`,r:`8`},null,-1),U(`circle`,{class:`aicomp__ctx-arc`,cx:`10`,cy:`10`,r:`8`,"stroke-dasharray":`${a.ctx.arc} ${a.ctx.circ}`,transform:`rotate(-90 10 10)`},null,8,iM)])),U(`span`,aM,j(a.ctx.pctLabel),1)],10,nM)):K(`v-if`,!0),n.model?(B(),V(`span`,{key:1,class:`aicomp__model`,title:`当前模型:${n.model}`},j(n.model),9,oM)):K(`v-if`,!0),n.busy?(B(),V(`button`,{key:2,type:`button`,class:`aicomp__send aicomp__send--stop`,title:`终止生成(Esc)`,onClick:t[16]||=t=>e.$emit(`stop`)},[...t[31]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[U(`use`,{href:`#icon-stop`})],-1)]])):(B(),V(`button`,{key:3,type:`button`,class:`aicomp__send`,disabled:!a.canSend,title:a.canSend?`发送(Enter)`:`输入内容后发送`,onClick:t[17]||=(...e)=>a.submit&&a.submit(...e)},[...t[32]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-send`})],-1)]],8,sM))])])],32)],6)}var lM=X(zj,[[`render`,cM],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatComposer.vue`]]),uM={name:`AiSettings`,components:{NumberStepper:c_,Switch:Vw},props:{config:{type:Object,default:()=>({baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``})},modelId:{type:String,default:null},initialModel:{type:Object,default:null}},emits:[`close`,`saved`],data(){let e=this.modelId&&this.initialModel||{};return{form:{name:e.name||``,baseUrl:e.baseUrl||``,model:e.model||``,apiKey:``,thinking:e.thinking!==!1,vision:e.vision===!0,maxTokens:e.maxTokensAuto?0:Number(e.maxTokens)>0?Number(e.maxTokens):0},reveal:!1,saving:!1,testing:!1,probing:!1,ping:null,help:null,keyLoaded:!1,submitted:!1,touched:{}}},computed:{title(){return this.modelId?`编辑模型`:`添加模型`},errors(){let e={},t=this.form.baseUrl.trim(),n=this.form.model.trim();return t?/^https?:\/\/[^\s]+$/i.test(t)||(e.baseUrl=`Base URL 需以 http:// 或 https:// 开头`):e.baseUrl=`请填写 Base URL`,n||(e.model=`请填写模型名`),!this.keyLoaded&&!this.form.apiKey.trim()&&(e.apiKey=`请填写 API Key`),e},isValid(){return Object.keys(this.errors).length===0},knownCapLimit(){return(Number(this.config.maxTokensCap)>0?Number(this.config.maxTokensCap):0)||(Number(this.config.maxTokensWindow)>0?Number(this.config.maxTokensWindow):0)},maxTokensOver(){return this.knownCapLimit>0&&this.form.maxTokens>this.knownCapLimit},maxTokensPlaceholder(){let e=Number(this.config.maxTokens)>0?Number(this.config.maxTokens):0;return e>0?`留空 = 自动(当前按 ${e})`:`留空 = 自动`},keyPlaceholder(){return this.keyLoaded?this.form.apiKey?``:`已保存的密钥为空,请填写新密钥`:this.config.hasKey?`已保存(${this.config.apiKeyMasked||`••••`}),回显失败:留空沿用、填写覆盖`:`sk-…`}},created(){this.loadKey()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},showError(e){return!!this.errors[e]&&(this.submitted||this.touched[e])},markTouched(e){this.$set(this.touched,e,!0)},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onMaxTokens(e){let t=Number(String(e).trim());this.form.maxTokens=Number.isFinite(t)&&t>=0?Math.round(t):0},async probe(){let e=[];if(this.form.baseUrl.trim()||e.push(`Base URL`),this.form.apiKey.trim()||e.push(`API Key`),this.form.model.trim()||e.push(`模型名`),e.length){this.ping={ok:!1,text:`探测前请先填写:${e.join(` / `)}`};return}this.probing=!0,this.ping=null;try{let e=await iA({baseUrl:this.form.baseUrl,apiKey:this.form.apiKey,model:this.form.model}),t=Number(e.window)>0?Number(e.window):0,n=Number(e.cap)>0?Number(e.cap):0;if(n>0){this.form.maxTokens=n;let r=e.source===`models-meta`?`模型元数据`:e.source===`probe`?`二分试探`:e.source===`halved`?`减半回写`:e.source||`探测`,i=[`接受单次输出上限 ${n}`];t>0&&i.push(`上下文窗口 ${t}`),this.ping={ok:!0,text:`网关${i.join(`、`)}(来源:${r})→ 已填入 ${n};留空则走自动(取 min(上限, ${Number(e.ceiling)>0?e.ceiling:32768}) = ${Number(e.autoMax)>0?e.autoMax:n})`}}else{let n=[];t>0&&n.push(`上下文窗口 ${t}`),e.source===`fallback`?n.push(`网关未接受任何档位(可能是地址 / 密钥 / 模型名有误,或该网关不暴露上限)`):n.push(`未探到网关接受的单次输出上限`),this.ping={ok:!1,text:`${n.join(`;`)}。建议留空走自动:后端按默认值开跑,被网关拒绝时自动减半并记下真实上限`}}}catch(e){this.ping={ok:!1,text:`探测失败:${e.message||e}`}}finally{this.probing=!1}},async loadKey(){if(this.modelId)try{let e=await $k(this.modelId,!0),t=typeof e.apiKey==`string`?e.apiKey:``;t&&(this.form.apiKey=t,this.keyLoaded=!0),typeof e.name==`string`&&(this.form.name=e.name),typeof e.baseUrl==`string`&&(this.form.baseUrl=e.baseUrl),typeof e.model==`string`&&(this.form.model=e.model),this.form.maxTokens=e.maxTokensAuto||!(Number(e.maxTokens)>0)?0:Number(e.maxTokens),e.thinking!==void 0&&(this.form.thinking=e.thinking!==!1),e.vision!==void 0&&(this.form.vision=e.vision===!0)}catch{}},payload(){let e={name:this.form.name.trim(),baseUrl:this.form.baseUrl.trim(),model:this.form.model.trim(),thinking:!!this.form.thinking,vision:!!this.form.vision,maxTokens:Number(this.form.maxTokens)>0?Number(this.form.maxTokens):0};return(this.keyLoaded||this.form.apiKey.trim())&&(e.apiKey=this.form.apiKey.trim()),e},async test(){if(!this.isValid){this.submitted=!0,this.help=null,this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)再测试连接`};return}this.testing=!0,this.ping=null;try{let e=await aA(this.payload());this.ping=e.ok?{ok:!0,text:`连接正常 · ${e.model||this.form.model} · ${e.latencyMs}ms`}:{ok:!1,text:`连接失败${e.status?`(HTTP ${e.status})`:``}:${e.message||`未知错误`}`}}catch(e){this.ping={ok:!1,text:`测试失败:${e.message||e}`}}finally{this.testing=!1}},async save(){if(this.submitted=!0,!this.isValid){this.help=null;let e={baseUrl:`aiset-baseurl`,model:`aiset-model`,apiKey:`aiset-key`},t=Object.keys(this.errors)[0],n=t?this.$el.querySelector(`#${e[t]}`):null;n&&typeof n.focus==`function`&&n.focus(),this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)`};return}this.saving=!0;try{let e=this.modelId?await tA(this.modelId,this.payload()):await eA(this.payload());this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}},dM={class:`aiset__mask`},fM={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 模型设置`},pM={class:`aiset__head`},mM={class:`aiset__title`},hM={class:`aiset__body`},gM={class:`aiset__field`},_M={class:`aiset__field`},vM={class:`aiset__labelrow`},yM=[`aria-expanded`],bM=[`aria-invalid`],xM={key:0,class:`aiset__errline`},SM={key:1,class:`aiset__pop`},CM={class:`aiset__field`},wM={class:`aiset__labelrow`},TM=[`aria-expanded`],EM=[`aria-invalid`],DM={key:0,class:`aiset__errline`},OM={key:1,class:`aiset__pop`},kM={class:`aiset__field`},AM={class:`aiset__labelrow`},jM=[`aria-expanded`],MM={class:`aiset__keywrap`},NM=[`type`,`placeholder`,`aria-invalid`],PM=[`title`,`aria-pressed`],FM={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},IM=[`href`],LM={key:0,class:`aiset__errline`},RM={key:1,class:`aiset__pop`},zM={class:`aiset__field`},BM={class:`aiset__labelrow`},VM=[`aria-expanded`],HM={class:`aiset__stepperrow`},UM=[`disabled`],WM={key:0,class:`aiset__warnline`},GM={key:1,class:`aiset__pop`},KM={class:`aiset__field`},qM={class:`aiset__labelrow`},JM=[`aria-expanded`],YM={key:0,class:`aiset__pop`},XM={class:`aiset__field`},ZM={class:`aiset__labelrow`},QM=[`aria-expanded`],$M={key:0,class:`aiset__pop`},eN={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},tN=[`href`],nN={class:`aiset__foot`},rN=[`disabled`],iN={class:`aiset__btn-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},aN=[`href`],oN=[`disabled`],sN=[`disabled`];function cN(e,t,n,r,i,a){let o=L(`NumberStepper`),s=L(`Switch`);return B(),V(`div`,dM,[U(`section`,fM,[U(`header`,pM,[t[22]||=U(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[U(`use`,{href:`#icon-model`})],-1),U(`span`,mM,j(a.title),1),U(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[21]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),K(` 字段说明一律收进「?」浮层:面板只留标签 + 控件,需要时点开看详情 `),U(`div`,hM,[U(`div`,gM,[t[23]||=U(`div`,{class:`aiset__labelrow`},[U(`label`,{class:`aiset__label`,for:`aiset-name`},`名称`)],-1),I(U(`input`,{id:`aiset-name`,"onUpdate:modelValue":t[1]||=e=>i.form.name=e,class:`aiset__input`,type:`text`,placeholder:`模型显示名(如 GPT-4o / 我的 GLM)`,spellcheck:`false`,autocomplete:`off`},null,512),[[il,i.form.name]])]),U(`div`,_M,[U(`div`,vM,[t[25]||=U(`label`,{class:`aiset__label`,for:`aiset-baseurl`},[G(`Base URL`),U(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`baseUrl`}]),"aria-expanded":i.help===`baseUrl`,title:`查看说明`,onClick:t[2]||=q(e=>a.toggleHelp(`baseUrl`),[`stop`])},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,yM)]),I(U(`input`,{id:`aiset-baseurl`,"onUpdate:modelValue":t[3]||=e=>i.form.baseUrl=e,class:A([`aiset__input`,{"is-invalid":a.showError(`baseUrl`)}]),type:`text`,placeholder:`https://api.example.com/v1`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`baseUrl`)?`true`:`false`,onBlur:t[4]||=e=>a.markTouched(`baseUrl`)},null,42,bM),[[il,i.form.baseUrl]]),a.showError(`baseUrl`)?(B(),V(`p`,xM,j(a.errors.baseUrl),1)):K(`v-if`,!0),i.help===`baseUrl`?(B(),V(`p`,SM,[...t[26]||=[G(`OpenAI 兼容网关的基址,`,-1),U(`strong`,null,`不含`,-1),G(),U(`code`,null,`/chat/completions`,-1),G(` 后缀(后端会自己拼)。例:`,-1),U(`code`,null,`https://api.openai.com/v1`,-1),G(`。`,-1)]])):K(`v-if`,!0)]),U(`div`,CM,[U(`div`,wM,[t[28]||=U(`label`,{class:`aiset__label`,for:`aiset-model`},[G(`模型名`),U(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`model`}]),"aria-expanded":i.help===`model`,title:`查看说明`,onClick:t[5]||=q(e=>a.toggleHelp(`model`),[`stop`])},[...t[27]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,TM)]),I(U(`input`,{id:`aiset-model`,"onUpdate:modelValue":t[6]||=e=>i.form.model=e,class:A([`aiset__input`,{"is-invalid":a.showError(`model`)}]),type:`text`,placeholder:`gpt-4o / GLM-4.6 / deepseek-chat`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`model`)?`true`:`false`,onBlur:t[7]||=e=>a.markTouched(`model`)},null,42,EM),[[il,i.form.model]]),a.showError(`model`)?(B(),V(`p`,DM,j(a.errors.model),1)):K(`v-if`,!0),i.help===`model`?(B(),V(`p`,OM,`必须与网关侧的模型标识完全一致。建卡这类多步工具调用建议用支持 function calling 的模型。`)):K(`v-if`,!0)]),U(`div`,kM,[U(`div`,AM,[t[30]||=U(`label`,{class:`aiset__label`,for:`aiset-key`},[G(`API Key`),U(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`apiKey`}]),"aria-expanded":i.help===`apiKey`,title:`查看说明`,onClick:t[8]||=q(e=>a.toggleHelp(`apiKey`),[`stop`])},[...t[29]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,jM)]),U(`div`,MM,[I(U(`input`,{id:`aiset-key`,"onUpdate:modelValue":t[9]||=e=>i.form.apiKey=e,class:A([`aiset__input aiset__input--key`,{"is-invalid":a.showError(`apiKey`)}]),type:i.reveal?`text`:`password`,placeholder:a.keyPlaceholder,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`apiKey`)?`true`:`false`,onBlur:t[10]||=e=>a.markTouched(`apiKey`)},null,42,NM),[[fl,i.form.apiKey]]),U(`button`,{type:`button`,class:`aiset__eye`,title:i.reveal?`掩码显示密钥`:`明文显示密钥`,"aria-pressed":i.reveal,onClick:t[11]||=e=>i.reveal=!i.reveal},[(B(),V(`svg`,FM,[U(`use`,{href:i.reveal?`#icon-eye-off`:`#icon-eye`},null,8,IM)]))],8,PM)]),a.showError(`apiKey`)?(B(),V(`p`,LM,j(a.errors.apiKey),1)):K(`v-if`,!0),i.help===`apiKey`?(B(),V(`p`,RM,[...t[31]||=[G(` 密钥保存在项目根 `,-1),U(`code`,null,`.env.cb.local`,-1),G(`(个人覆盖层,已被 .gitignore 忽略,不会进版本库)。 打开面板自动回填已保存的密钥(默认掩码),点输入框尾部小眼睛切换明文;`,-1),U(`strong`,null,`清空后保存即删除`,-1),G(`已保存的密钥。 `,-1)]])):K(`v-if`,!0)]),U(`div`,zM,[U(`div`,BM,[t[33]||=U(`label`,{class:`aiset__label`},`单次输出上限`,-1),t[34]||=U(`span`,{class:`aiset__unit`},`max_tokens`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`maxTokens`}]),"aria-expanded":i.help===`maxTokens`,title:`查看说明`,onClick:t[12]||=q(e=>a.toggleHelp(`maxTokens`),[`stop`])},[...t[32]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,VM)]),U(`div`,HM,[W(o,{id:`aiset-maxtok`,class:`aiset__stepper`,value:i.form.maxTokens>0?String(i.form.maxTokens):``,step:1024,min:0,max:262144,placeholder:a.maxTokensPlaceholder,onInput:a.onMaxTokens},null,8,[`value`,`placeholder`,`onInput`]),U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.probing||i.saving||i.testing,onClick:t[13]||=(...e)=>a.probe&&a.probe(...e)},j(i.probing?`探测中…`:`探测`),9,UM)]),a.maxTokensOver?(B(),V(`p`,WM,` 超过网关已知上限 `+j(a.knownCapLimit)+`:对话时会主动夹取到该值,建议留空走自动 `,1)):K(`v-if`,!0),i.help===`maxTokens`?(B(),V(`p`,GM,[t[35]||=U(`strong`,null,`普通用户不用管这一项:留空 = 自动`,-1),t[36]||=G(`。后端自己协商:先读网关 `,-1),t[37]||=U(`code`,null,`/v1/models`,-1),t[38]||=G(` 的上下文窗口(免费、毫秒级,最多等 2 秒,超时先用默认 24576 开跑), 拿到后取 `,-1),t[39]||=U(`code`,null,`min(窗口, 32768)`,-1),t[40]||=G(` 当作单次输出上限(输出预算 ≠ 上下文窗口,建卡一轮 32k 足够)。 读不到元数据也不会偷偷发试探请求;想知道窗口多大就点「探测」做一次二分试探(会产生一次真实补全,约十几秒)。 手填值超过网关接受上限时,对话开跑前会主动夹取并说明;真被 400 拒绝才会自动减半重试, 减半成功的值记为「接受上限」(**不是窗口**:窗口与输出上限是两回事,有网关窗口 262144 但 max_tokens 硬上限 131072)。 只有某轮明确报「被单次输出上限截断」才需要手填更大值。注意:推理模型的思考过程也算进这个上限。 `,-1),t[41]||=U(`br`,null,null,-1),t[42]||=U(`strong`,null,[G(`注意:`),U(`code`,null,`32768`),G(` 是自动模式的「封顶假设值」,不是网关能力上限。`)],-1),t[43]||=G(` 真实上限只能实测得到,请以「接受的单次输出上限」为准(如 qwen-max 实测仅 8192)。 `,-1),t[44]||=U(`br`,null,null,-1),t[45]||=G(`当前自动生效值:`,-1),U(`strong`,null,j(n.config.maxTokens>0?n.config.maxTokens:24576),1),G(`; 网关上下文窗口:`+j(n.config.maxTokensWindow>0?n.config.maxTokensWindow:`未拿到(网关可能不提供元数据)`)+`; 接受的单次输出上限:`+j(n.config.maxTokensCap>0?n.config.maxTokensCap:`未知(点「探测」,或撞过一次 400 后自动回写)`)+`。 `,1)])):K(`v-if`,!0)]),U(`div`,KM,[K(` 仅「勾选框 + 标题」包进 label:点说明 / 问号不应误触开关 `),U(`div`,qM,[t[47]||=U(`span`,{class:`aiset__label`},`深度思考`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`thinking`}]),"aria-expanded":i.help===`thinking`,title:`查看说明`,onClick:t[14]||=q(e=>a.toggleHelp(`thinking`),[`stop`])},[...t[46]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,JM),W(s,{modelValue:i.form.thinking,"onUpdate:modelValue":t[15]||=e=>i.form.thinking=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`thinking`?(B(),V(`p`,YM,[...t[48]||=[G(` 开启:模型先长篇推理再动手,规划更稳但慢很多、更费 token。关闭:直接出结果,实测同一网关快数倍。 关闭依赖网关支持 `,-1),U(`code`,null,`chat_template_kwargs.enable_thinking`,-1),G(`(vLLM / SGLang 系);网关不认时后端会自动回退成带思考并在对话里提示一次。 另外,`,-1),U(`strong`,null,`某一轮思考超时`,-1),G(`时后端会自动只在那一轮关闭深度思考并重试,逼出结果。 `,-1)]])):K(`v-if`,!0)]),U(`div`,XM,[U(`div`,ZM,[t[50]||=U(`span`,{class:`aiset__label`},`多模态视觉`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`vision`}]),"aria-expanded":i.help===`vision`,title:`查看说明`,onClick:t[16]||=q(e=>a.toggleHelp(`vision`),[`stop`])},[...t[49]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,QM),W(s,{modelValue:i.form.vision,"onUpdate:modelValue":t[17]||=e=>i.form.vision=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`vision`?(B(),V(`p`,$M,[...t[51]||=[G(` 开启后首轮对话会`,-1),U(`strong`,null,`自动探测`,-1),G(`网关是否真支持图像(比较带图 / 不带图的 prompt_tokens):支持则把渲染截图、设计稿 vs 渲染并排对比图、你挂载的图片注入上下文,AI 可直接读图找差异; 不支持会自动降级为数值闭环(pixelDiff.match)并在对话里提示一次。注入前降采样到长边 ≤ 1024px / ≤ 900KB,每轮最多 2 张;对话记录落盘不含图像。 `,-1)]])):K(`v-if`,!0)]),i.ping?(B(),V(`div`,{key:0,class:A([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(B(),V(`svg`,eN,[U(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,tN)])),U(`span`,null,j(i.ping.text),1)],2)):K(`v-if`,!0)]),U(`footer`,nN,[U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.testing||i.saving,onClick:t[18]||=(...e)=>a.test&&a.test(...e)},[(B(),V(`svg`,iN,[U(`use`,{href:i.testing?`#icon-loading`:`#icon-activity`},null,8,aN)])),U(`span`,null,j(i.testing?`测试中…`:`测试连接`),1)],8,rN),t[52]||=U(`span`,{class:`aiset__foot-gap`},null,-1),U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[19]||=t=>e.$emit(`close`)},`取消`,8,oN),U(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving||i.testing,onClick:t[20]||=(...e)=>a.save&&a.save(...e)},j(i.saving?`保存中…`:`保存`),9,sN)])])])}var lN=X(uM,[[`render`,cN],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AiSettings.vue`]]),uN={name:`ModelList`,props:{models:{type:Array,default:()=>[]},activeId:{type:String,default:null},turnRunning:{type:Boolean,default:!1}},emits:[`add`,`edit`,`delete`,`activate`,`close`,`open-common`,`import-ccswitch`],methods:{locked(e){return!!(this.turnRunning&&e&&e.id===this.activeId)},hostOf(e){let t=String(e||``).trim();if(!t)return`未填地址`;try{return new URL(t).host}catch{return t.replace(/^https?:\/\//,``).replace(/\/+$/,``)||t}}}},dN={class:`aiset__mask`},fN={class:`aiset modellist`,role:`dialog`,"aria-modal":`true`,"aria-label":`模型选择`},pN={class:`aiset__head`},mN={class:`aiset__body ml__body`},hN={class:`ml__toolbar`},gN={key:0,class:`ml__lock`,role:`status`},_N={key:1,class:`empty-state`},vN={class:`ml__list`},yN=[`aria-disabled`,`onClick`],bN={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},xN={class:`ml__info`},SN={class:`ml__name`},CN={class:`ml__meta`},wN={class:`ml__model`},TN={class:`ml__host`},EN={key:0,class:`ml__key`,title:`已配置密钥`},DN={key:1,class:`ml__key ml__key--off`,title:`未配置密钥`},ON={key:2,class:`ml__key ml__key--lock`,title:`对话进行中,正在使用的模型已锁定`},kN={class:`ml__actions`},AN=[`disabled`,`title`,`onClick`],jN=[`disabled`,`title`,`onClick`],MN={class:`ml__foot`},NN={class:`ml__hint`};function PN(e,t,n,r,i,a){return B(),V(`div`,dN,[U(`section`,fN,[U(`header`,pN,[t[5]||=U(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[U(`use`,{href:`#icon-model`})],-1),t[6]||=U(`span`,{class:`aiset__title`},`模型`,-1),U(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[4]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,mN,[K(` 操作工具条:添加模型 / 从 cc-switch 导入,靠右对齐 `),U(`div`,hN,[U(`button`,{type:`button`,class:`ml__import`,title:`从 cc-switch 导入`,onClick:t[1]||=t=>e.$emit(`import-ccswitch`)},[...t[7]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-download`})],-1),U(`span`,null,`导入`,-1)]]),U(`button`,{type:`button`,class:`ml__add`,title:`添加模型`,onClick:t[2]||=t=>e.$emit(`add`)},[...t[8]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-plus`})],-1),U(`span`,null,`添加模型`,-1)]])]),K(` 对话进行中:正在使用的模型被锁,说明原因与解除方式,避免用户反复点却没反应 `),n.turnRunning?(B(),V(`div`,gN,[...t[9]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,null,`有对话正在进行:正在使用的模型已锁定,本轮结束后可切换或修改。其他模型仍可编辑。`,-1)]])):K(`v-if`,!0),K(` 空状态:与其他面板占位(图标 + 文字)同一语言 `),n.models.length?(B(),V(z,{key:2},[K(` 模型列表:参考 cc-switch 的 provider 列表——每条可编辑 / 删除,当前生效项高亮 `),U(`ul`,vN,[(B(!0),V(z,null,R(n.models,r=>(B(),V(`li`,{key:r.id,class:A([`ml__item`,{"is-active":r.id===n.activeId,"is-locked":a.locked(r)}]),"aria-disabled":a.locked(r)?`true`:`false`,onClick:t=>e.$emit(`activate`,r)},[U(`span`,{class:A([`ml__check`,{"is-on":r.id===n.activeId}]),"aria-hidden":`true`},[r.id===n.activeId?(B(),V(`svg`,bN,[...t[11]||=[U(`use`,{href:`#icon-check`},null,-1)]])):K(`v-if`,!0)],2),U(`span`,xN,[U(`span`,SN,j(r.name||r.model||`未命名模型`),1),U(`span`,CN,[U(`span`,wN,j(r.model||`未填模型名`),1),t[12]||=U(`span`,{class:`ml__dot`},`·`,-1),U(`span`,TN,j(a.hostOf(r.baseUrl)),1),r.hasKey?(B(),V(`span`,EN,`已配密钥`)):(B(),V(`span`,DN,`无密钥`)),a.locked(r)?(B(),V(`span`,ON,`运行中 · 锁定`)):K(`v-if`,!0)])]),U(`span`,kN,[U(`button`,{type:`button`,class:`ml__btn`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可编辑`:`编辑`,onClick:q(t=>e.$emit(`edit`,r),[`stop`])},[...t[13]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-edit`})],-1)]],8,AN),U(`button`,{type:`button`,class:`ml__btn ml__btn--danger`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可删除`:`删除`,onClick:q(t=>e.$emit(`delete`,r),[`stop`])},[...t[14]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],8,jN)])],10,yN))),128))])],2112)):(B(),V(`div`,_N,[...t[10]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg class="is-solid-icon" viewBox="0 0 1024 1024"><use href="#icon-model"></use></svg></span><p class="debug__empty">还没有模型</p><p class="empty-state__hint">点上方「添加模型」配置第一个 AI 模型(Base URL / API Key / 模型名),或「导入」从 cc-switch 拉取已有的 Codex 供应商。配置保存在项目根 .env.cb.local,不进版本库。</p>`,3)]]))]),U(`footer`,MN,[U(`span`,NN,j(n.turnRunning?`对话进行中:正在使用的模型已锁定,无法切换`:`点击任意模型即可切换为当前生效模型`),1),U(`button`,{type:`button`,class:`ml__common`,title:`通用设置(执行策略 / 环境参数,所有模型共享)`,onClick:t[3]||=t=>e.$emit(`open-common`)},[...t[15]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-settings`})],-1),U(`span`,null,`通用设置`,-1)]])])])])}var FN=X(uN,[[`render`,PN],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ModelList.vue`]]),IN=6e4,LN={name:`AiCommonSettings`,components:{NumberStepper:c_,Switch:Vw},emits:[`close`,`saved`],data(){return{form:{allowShell:!0,autoApprove:`all`,maxSteps:0,turnTimeoutMin:60,stallTimeoutMin:120,stallRetries:-1,reasoningTimeoutMin:600,autoContinueMax:-1},saving:!1,ping:null,help:null,adv:!1,approveOptions:[{value:`none`,label:`逐次确认`},{value:`skill`,label:`免技能`},{value:`all`,label:`全免确认`}]}},created(){this.loadConfig()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onInt(e,t){let n=String(t).trim();if(!n){this.form[e]=e===`stallRetries`||e===`autoContinueMax`?-1:0;return}let r=Number(n);this.form[e]=Number.isFinite(r)?Math.round(r):0},async loadConfig(){try{let e=await Yk();e.shellEnabled!==void 0&&(this.form.allowShell=e.shellEnabled!==!1),e.autoApprove&&(this.form.autoApprove=e.autoApprove),Number(e.maxSteps)>0&&(this.form.maxSteps=Number(e.maxSteps)),Number(e.turnTimeoutMs)>0&&(this.form.turnTimeoutMin=Math.round(Number(e.turnTimeoutMs)/IN)),Number(e.stallTimeoutMs)>0&&(this.form.stallTimeoutMin=Math.round(Number(e.stallTimeoutMs)/IN)),e.stallRetries!==void 0&&e.stallRetries>=0&&(this.form.stallRetries=Number(e.stallRetries)),Number(e.reasoningTimeoutMs)>0&&(this.form.reasoningTimeoutMin=Math.round(Number(e.reasoningTimeoutMs)/IN)),e.autoContinueMax!==void 0&&e.autoContinueMax>=0&&(this.form.autoContinueMax=Number(e.autoContinueMax))}catch{}},async save(){this.saving=!0,this.ping=null;try{let e=await Xk({allowShell:!!this.form.allowShell,autoApprove:this.form.autoApprove,maxSteps:Number(this.form.maxSteps)>0?Number(this.form.maxSteps):0,turnTimeoutMs:Number(this.form.turnTimeoutMin)>0?Number(this.form.turnTimeoutMin)*IN:0,stallTimeoutMs:Number(this.form.stallTimeoutMin)>0?Number(this.form.stallTimeoutMin)*IN:0,stallRetries:Number(this.form.stallRetries)>=0?Number(this.form.stallRetries):-1,reasoningTimeoutMs:Number(this.form.reasoningTimeoutMin)>0?Number(this.form.reasoningTimeoutMin)*IN:0,autoContinueMax:Number(this.form.autoContinueMax)>=0?Number(this.form.autoContinueMax):-1});this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}},RN={class:`aiset__mask`},zN={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 通用设置`},BN={class:`aiset__head`},VN={class:`aiset__body`},HN={class:`aiset__field`},UN={class:`aiset__labelrow`},WN=[`aria-expanded`],GN={key:0,class:`aiset__pop`},KN={class:`aiset__field`},qN={class:`aiset__labelrow`},JN=[`aria-expanded`],YN={class:`aiset__seg`},XN=[`onClick`],ZN={key:0,class:`aiset__pop`},QN={class:`aiset__adv`},$N=[`aria-expanded`],eP={class:`aiset__adv-hint`},tP={key:0,class:`aiset__adv-body`},nP={class:`aiset__field`},rP={class:`aiset__labelrow`},iP=[`aria-expanded`],aP={class:`aiset__stepperrow`},oP={key:0,class:`aiset__pop`},sP={class:`aiset__field`},cP={class:`aiset__labelrow`},lP=[`aria-expanded`],uP={class:`aiset__stepperrow`},dP={key:0,class:`aiset__pop`},fP={class:`aiset__field`},pP={class:`aiset__labelrow`},mP=[`aria-expanded`],hP={class:`aiset__stepperrow`},gP={key:0,class:`aiset__pop`},_P={class:`aiset__field`},vP={class:`aiset__labelrow`},yP=[`aria-expanded`],bP={class:`aiset__stepperrow`},xP={key:0,class:`aiset__pop`},SP={class:`aiset__field`},CP={class:`aiset__labelrow`},wP=[`aria-expanded`],TP={class:`aiset__stepperrow`},EP={key:0,class:`aiset__pop`},DP={class:`aiset__field`},OP={class:`aiset__labelrow`},kP=[`aria-expanded`],AP={class:`aiset__stepperrow`},jP={key:0,class:`aiset__pop`},MP={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},NP=[`href`],PP={class:`aiset__foot`},FP=[`disabled`],IP=[`disabled`];function LP(e,t,n,r,i,a){let o=L(`Switch`),s=L(`NumberStepper`);return B(),V(`div`,RN,[U(`section`,zN,[U(`header`,BN,[t[20]||=U(`svg`,{class:`aiset__head-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-settings`})],-1),t[21]||=U(`span`,{class:`aiset__title`},`通用设置`,-1),U(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[19]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,VN,[t[51]||=U(`p`,{class:`aiset__note`},[G(`以下为`),U(`strong`,null,`所有模型共享`),G(`的执行策略 / 环境参数,与具体模型无关,故不放在每个模型条目里。`)],-1),U(`div`,HN,[U(`div`,UN,[t[23]||=U(`span`,{class:`aiset__label`},`本地命令执行`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`allowShell`}]),"aria-expanded":i.help===`allowShell`,title:`查看说明`,onClick:t[1]||=q(e=>a.toggleHelp(`allowShell`),[`stop`])},[...t[22]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,WN),W(o,{modelValue:i.form.allowShell,"onUpdate:modelValue":t[2]||=e=>i.form.allowShell=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`allowShell`?(B(),V(`p`,GN,[...t[24]||=[G(` 是否注册 `,-1),U(`code`,null,`shell_exec`,-1),G(` 本地命令执行。默认开(工具只监听 127.0.0.1,命令过白名单 + 全量审计)。 关掉后 AI 不能跑本地命令,但仍可执行技能脚本(由 `,-1),U(`code`,null,`autoApprove`,-1),G(` 控制是否逐次确认)。 `,-1)]])):K(`v-if`,!0)]),U(`div`,KN,[U(`div`,qN,[t[26]||=U(`span`,{class:`aiset__label`},`免确认执行策略`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`autoApprove`}]),"aria-expanded":i.help===`autoApprove`,title:`查看说明`,onClick:t[3]||=q(e=>a.toggleHelp(`autoApprove`),[`stop`])},[...t[25]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,JN)]),U(`div`,YN,[(B(!0),V(z,null,R(i.approveOptions,e=>(B(),V(`button`,{key:e.value,type:`button`,class:A([`aiset__seg-btn`,{"is-on":i.form.autoApprove===e.value}]),onClick:t=>i.form.autoApprove=e.value},j(e.label),11,XN))),128))]),i.help===`autoApprove`?(B(),V(`p`,ZN,[...t[27]||=[U(`code`,null,`none`,-1),G(`=逐次弹审批;`,-1),U(`code`,null,`skill`,-1),G(`=只免技能脚本;`,-1),U(`code`,null,`all`,-1),G(`=技能脚本 + 本地命令都免确认(默认)。 建卡管线连跑十几次脚本 / 命令,`,-1),U(`code`,null,`all`,-1),G(` 避免每次等用户点「允许」。 `,-1)]])):K(`v-if`,!0)]),K(` 保活 / 预算阈值:实测调优出来的值,改只会变坏,故默认收起。
310
- 全部有代码默认值,留空即走默认;折叠区保留可写入口,真要调时不用去翻 .env `),U(`div`,QN,[U(`button`,{type:`button`,class:`aiset__adv-head`,"aria-expanded":i.adv,onClick:t[4]||=e=>i.adv=!i.adv},[(B(),V(`svg`,{class:A([`aiset__adv-caret`,{"is-open":i.adv}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[...t[28]||=[U(`use`,{href:`#icon-chevron-right`},null,-1)]],2)),t[29]||=U(`span`,{class:`aiset__adv-title`},`高级:保活与预算阈值`,-1),U(`span`,eP,j(i.adv?``:`默认值经实测调优,不建议修改`),1)],8,$N),i.adv?(B(),V(`div`,tP,[t[50]||=U(`p`,{class:`aiset__adv-note`},[G(` 这几项是长程任务的`),U(`strong`,null,`熔断与保活阈值`),G(`,数值由实测调优得出(如纯思考预算从 90s 放宽到 600s,因 240s 会误伤正常轮次)。 留空即走默认,`),U(`strong`,null,`没有明确理由不建议改动`),G(`。 `)],-1),U(`div`,nP,[U(`div`,rP,[t[31]||=U(`span`,{class:`aiset__label`},`单轮步数上限`,-1),t[32]||=U(`span`,{class:`aiset__unit`},`0 / 留空 = 不限`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`maxSteps`}]),"aria-expanded":i.help===`maxSteps`,title:`查看说明`,onClick:t[5]||=q(e=>a.toggleHelp(`maxSteps`),[`stop`])},[...t[30]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,iP)]),U(`div`,aP,[W(s,{id:`common-maxsteps`,class:`aiset__stepper`,value:i.form.maxSteps>0?String(i.form.maxSteps):``,step:8,min:0,max:1e3,placeholder:`留空 = 不限(推荐)`,onInput:t[6]||=e=>a.onInt(`maxSteps`,e)},null,8,[`value`])]),i.help===`maxSteps`?(B(),V(`p`,oP,[...t[33]||=[U(`strong`,null,`普通用户不用管:留空 = 不限`,-1),G(`。失控由三道精准熔断兜住(同参打转跳过 / 单轮墙钟到点收尾 / 每 24 步提醒)。 只有想硬性控成本时才填(>0 即恢复旧硬顶行为)。 `,-1)]])):K(`v-if`,!0)]),U(`div`,sP,[U(`div`,cP,[t[35]||=U(`span`,{class:`aiset__label`},`单轮墙钟上限`,-1),t[36]||=U(`span`,{class:`aiset__unit`},`分钟`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`turnTimeout`}]),"aria-expanded":i.help===`turnTimeout`,title:`查看说明`,onClick:t[7]||=q(e=>a.toggleHelp(`turnTimeout`),[`stop`])},[...t[34]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,lP)]),U(`div`,uP,[W(s,{id:`common-turn`,class:`aiset__stepper`,value:i.form.turnTimeoutMin>0?String(i.form.turnTimeoutMin):``,step:5,min:0,max:240,placeholder:`留空 = 60`,onInput:t[8]||=e=>a.onInt(`turnTimeoutMin`,e)},null,8,[`value`])]),i.help===`turnTimeout`?(B(),V(`p`,dP,` 单轮允许跑的最长时间(分钟)。到点收尾汇报、上下文不丢,回复「继续」接着做。默认 60 分钟,不限步数后的唯一兜底闸门。 `)):K(`v-if`,!0)]),U(`div`,fP,[U(`div`,pP,[t[38]||=U(`span`,{class:`aiset__label`},`网关静默阈值`,-1),t[39]||=U(`span`,{class:`aiset__unit`},`分钟`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`stall`}]),"aria-expanded":i.help===`stall`,title:`查看说明`,onClick:t[9]||=q(e=>a.toggleHelp(`stall`),[`stop`])},[...t[37]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,mP)]),U(`div`,hP,[W(s,{id:`common-stall`,class:`aiset__stepper`,value:i.form.stallTimeoutMin>0?String(i.form.stallTimeoutMin):``,step:1,min:0,max:120,placeholder:`留空 = 2`,onInput:t[10]||=e=>a.onInt(`stallTimeoutMin`,e)},null,8,[`value`])]),i.help===`stall`?(B(),V(`p`,gP,` 上游多少分钟不回任何字节算「网关静默」;静默自动重试本步而非整轮报废。默认 2 分钟(120 秒)。 `)):K(`v-if`,!0)]),U(`div`,_P,[U(`div`,vP,[t[41]||=U(`span`,{class:`aiset__label`},`静默重试次数`,-1),t[42]||=U(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`stallRetries`}]),"aria-expanded":i.help===`stallRetries`,title:`查看说明`,onClick:t[11]||=q(e=>a.toggleHelp(`stallRetries`),[`stop`])},[...t[40]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,yP)]),U(`div`,bP,[W(s,{id:`common-stallretries`,class:`aiset__stepper`,value:i.form.stallRetries>=0?String(i.form.stallRetries):``,step:1,min:-1,max:20,placeholder:`留空 / -1 = 3`,onInput:t[12]||=e=>a.onInt(`stallRetries`,e)},null,8,[`value`])]),i.help===`stallRetries`?(B(),V(`p`,xP,` 网关静默后的自动重试次数。0 = 回到「一次静默即报错」的旧行为;留空 / -1 = 用默认 3 次。 `)):K(`v-if`,!0)]),U(`div`,SP,[U(`div`,CP,[t[44]||=U(`span`,{class:`aiset__label`},`纯思考预算`,-1),t[45]||=U(`span`,{class:`aiset__unit`},`分钟`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`reasoning`}]),"aria-expanded":i.help===`reasoning`,title:`查看说明`,onClick:t[13]||=q(e=>a.toggleHelp(`reasoning`),[`stop`])},[...t[43]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,wP)]),U(`div`,TP,[W(s,{id:`common-reasoning`,class:`aiset__stepper`,value:i.form.reasoningTimeoutMin>0?String(i.form.reasoningTimeoutMin):``,step:1,min:0,max:300,placeholder:`留空 = 10`,onInput:t[14]||=e=>a.onInt(`reasoningTimeoutMin`,e)},null,8,[`value`])]),i.help===`reasoning`?(B(),V(`p`,EP,` 单轮「纯思考」(不调工具)的预算(分钟)。到点催促 + 关深度思考重试;催 3 次仍无产出则停该熔断,改墙钟兜底。默认 10 分钟(600 秒)。 `)):K(`v-if`,!0)]),U(`div`,DP,[U(`div`,OP,[t[47]||=U(`span`,{class:`aiset__label`},`自动续跑上限`,-1),t[48]||=U(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`autoContinue`}]),"aria-expanded":i.help===`autoContinue`,title:`查看说明`,onClick:t[15]||=q(e=>a.toggleHelp(`autoContinue`),[`stop`])},[...t[46]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,kP)]),U(`div`,AP,[W(s,{id:`common-autocont`,class:`aiset__stepper`,value:i.form.autoContinueMax>=0?String(i.form.autoContinueMax):``,step:1,min:-1,max:200,placeholder:`留空 / -1 = 12`,onInput:t[16]||=e=>a.onInt(`autoContinueMax`,e)},null,8,[`value`])]),i.help===`autoContinue`?(B(),V(`p`,jP,[...t[49]||=[G(` 模型没给收尾标记(`,-1),U(`code`,null,`[任务完成]`,-1),G(` / `,-1),U(`code`,null,`[需用户确认]`,-1),G(`)就停手时的自动续跑次数上限。0 = 关闭(等你手打「继续」);留空 / -1 = 用默认 12。 `,-1)]])):K(`v-if`,!0)])])):K(`v-if`,!0)]),i.ping?(B(),V(`div`,{key:0,class:A([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(B(),V(`svg`,MP,[U(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,NP)])),U(`span`,null,j(i.ping.text),1)],2)):K(`v-if`,!0)]),U(`footer`,PP,[t[52]||=U(`span`,{class:`aiset__foot-gap`},null,-1),U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[17]||=t=>e.$emit(`close`)},`取消`,8,FP),U(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving,onClick:t[18]||=(...e)=>a.save&&a.save(...e)},j(i.saving?`保存中…`:`保存`),9,IP)])])])}var RP=X(LN,[[`render`,LP],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AiCommonSettings.vue`]]),zP=2e3;function BP(e){try{let t=JSON.stringify(e);return t==null?0:t.length}catch{return 1/0}}function VP(e,t){let n=typeof e==`string`?e:e==null?``:JSON.stringify(e);return n.length<=t?e:`${n.slice(0,t)}\n…(历史归档已裁剪,完整内容以卡片与落盘产物为准)`}function HP(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))n[r]=typeof i==`string`||typeof i==`object`&&i?VP(i,t):i;return n}function UP(e,t=!1){let n=Array.isArray(e)?e:[],r=t?400:zP;return n.map(e=>{if(!e||!Array.isArray(e.toolCalls)||!e.toolCalls.length)return e;let n=!1,i=e.toolCalls.map(e=>{if(!e||typeof e!=`object`)return e;let i=HP(e.args,r),a=t?e.result==null||e.result===``?e.result:`[历史归档已裁剪]`:VP(e.result,r);return(JSON.stringify(i)!==JSON.stringify(e.args)||String(a)!==String(e.result))&&(n=!0),{...e,args:i,result:a}});return n?{...e,toolCalls:i,trimmedArchive:!0}:e})}var WP={card_read:12e3,skill_read:1e4,card_grep:4e3,skill_exec:3e3,fs_read:4e3,fs_write:2e3,fs_list:2e3,fs_copy:1e3,ir_patch:2e3,card_patch:2e3,card_validate:4e3,card_render_status:6e3,card_node_models:4e3,card_screenshot:1e3},GP=6e3;function KP(e){return WP[e]||6e3}function qP(e,t){return(typeof t==`string`?t:String(t??``)).slice(0,KP(e))}Math.max(GP,...Object.values(WP));var JP={pick:{id:`pick`,label:`选一张已有的卡`,hint:`从顶栏下拉里挑`,icon:`#icon-search`,weight:`read`,text:`列出仓库里现有的卡片,按用途分组,帮我挑一张适合修改的。`},scaffold:{id:`scaffold`,label:`新建一张卡`,hint:`从空白骨架开始`,icon:`#icon-folder-plus`,weight:`write`,text:`帮我新建一张卡片:先用 card_scaffold 生成骨架,再按我的需求补齐结构与示例内容,最后自检。`},spec:{id:`spec`,label:`按设计稿标注建卡`,hint:`先拖入 MeaXure 目录`,icon:`#icon-image-upload`,weight:`write`,attach:!0,text:`我会挂载一份 Sketch MeaXure 标注导出目录,请按标注生成卡片 schema 并自检。`},fromimage:{id:`fromimage`,label:`从参考图建卡`,hint:`拖一张设计图进来`,icon:`#icon-image`,weight:`write`,attach:!0,text:`我会拖入一张参考设计图(本机路径),请按图生成卡片 schema 并截图自检还原度。`},learn:{id:`learn`,label:`看已有卡学写法`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`列出仓库里结构最完整的几张卡片,读 1-2 张的关键片段,说明本仓库的建卡约定与常用范式。`},component:{id:`component`,label:`加一个常用组件`,hint:`列表 / 按钮 / 金额卡`,icon:`#icon-plus`,weight:`write`,text:`帮我给这张卡加一个常用组件(列表 / 按钮组 / 金额统计卡),按仓库范式写并自检。`},explain:{id:`explain`,label:`解释结构与数据来源`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`读取当前卡片 schema,用中文解释它的结构、关键绑定与数据来源,指出可能的问题。`},bind:{id:`bind`,label:`把写死文案抽成变量`,hint:`绑定 data.json`,icon:`#icon-link`,weight:`write`,text:`把当前卡片里写死的动态值(金额 / 日期 / 名称等)抽成变量并绑定 data.json,保持展示文案与设计稿一致。`},fix:{id:`fix`,label:`校验并修复`,hint:`会改动卡片`,icon:`#icon-wrench`,weight:`write`,text:`对当前卡片执行校验,列出全部错误并按规则修复,修完再校验一次确认清零。`},shot:{id:`shot`,label:`截图自检还原度`,hint:`多尺寸预览比对`,icon:`#icon-images`,weight:`read`,text:`给当前卡片截图,检查布局、字号、间距与配色是否协调,指出需要调整的地方。`},interact:{id:`interact`,label:`加按钮点击行为`,hint:`customAction / 发消息`,icon:`#icon-send`,weight:`write`,text:`给当前卡片里的主按钮加点击行为(customAction 或发送一条消息),参照现有卡片的写法。`},diagnose:{id:`diagnose`,label:`定位并修复刚才的报错`,hint:`接上一轮`,icon:`#icon-alert-triangle`,weight:`write`,text:`上一轮失败了,请读取错误信息与上下文,定位原因并修复,修完再校验一次。`},resume:{id:`resume`,label:`从中断处继续`,hint:`不重做已完成部分`,icon:`#icon-redo`,weight:`write`,text:`上一轮被中断了,请按上下文里的中断标记从中断处继续,不要从零重做。`},rollback:{id:`rollback`,label:`回滚上一轮改动`,hint:`恢复到改动前`,icon:`#icon-undo`,weight:`write`,text:`把上一轮对卡片做的改动回滚到改动前,并说明回滚了什么。`}},YP={nocare:[`pick`,`scaffold`,`spec`,`learn`,`component`],empty:[`spec`,`fromimage`,`scaffold`,`component`,`learn`],card:[`explain`,`bind`,`fix`,`shot`,`interact`],error:[`diagnose`,`resume`,`rollback`,`explain`,`fix`]},XP={nocare:{title:`选择或新建一张卡`,desc:`先从顶栏选一张卡,或让 AI 新建一张;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`},empty:{title:`把这张空卡搭起来`,desc:`描述想要的效果,或拖入设计稿标注目录 / 参考图,AI 会按标注生成卡片并截图自检。`},error:{title:`接着上一轮往下做`,desc:`上一轮失败或被中断了:可以接着修、从中断处继续,或回滚到改动前。`},card:{title:`让 AI 直接改这张卡`,desc:`描述需求即可,AI 会调用卡片工具读改校验并截图自检;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`}};function ZP(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e];if(n&&n.role===`assistant`)return n.status||`done`}return``}function QP({cardId:e,cardEmpty:t,messages:n}={}){if(!e)return`nocare`;if(t)return`empty`;let r=ZP(n);return r===`error`||r===`aborted`?`error`:`card`}function $P(e){return(YP[e]||YP.card).map(e=>JP[e]).filter(Boolean)}function eF(e,t,n=4){let r=Array.isArray(e)?e:[];if(r.length<=n)return r.slice();let i=r.length,a=((Number(t)||0)%i+i)%i;return[...r.slice(a),...r.slice(0,a)].slice(0,n)}function tF(e,t=4){return(Array.isArray(e)?e:[]).slice(0,t)}var nF=`cardbuddy:ai-panel-width`,rF=2e4,iF=`cardbuddy:ai-compact-steps`,aF=380,oF=.5,sF=.33,cF=0;function lF(e=`m`){return cF+=1,`${e}${Date.now().toString(36)}-${cF}`}var uF=`有对话正在进行,无法修改正在使用的模型:请先等这一轮结束,或在输入区点「停止」`,dF={name:`ChatPanel`,components:{ChatMessage:Fj,ChatComposer:lM,AiSettings:lN,ModelList:FN,AiCommonSettings:RP,ConfirmDialog:_p},props:{visible:{type:Boolean,default:!1},cardId:{type:String,default:``},cardName:{type:String,default:``},cardEmpty:{type:Boolean,default:!1}},emits:[`close`,`busy`,`turn-progress`,`turn-finished`,`rollback-turn`,`locate-node`],data(){return{messages:[],draftAttachments:[],busy:!1,loadingHistory:!1,modelListOpen:!1,models:[],activeId:null,turnRunning:!1,modelEditOpen:!1,editModelId:null,editInitialModel:null,confirmDeleteModel:null,ccSwitchOpen:!1,ccSwitchProviders:[],ccSwitchLoading:!1,ccSwitchReason:``,ccSwitchSelected:{},commonOpen:!1,confirmClear:!1,notice:null,config:{baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``},widthPx:0,winW:typeof window<`u`?window.innerWidth:1280,resizing:!1,pinned:!0,contextUsage:null,compactSteps:!1,archiveTrimmed:!1,suggestOffset:0,suggestStats:{},confirmStop:!1,turnStep:0,turnStage:null,turnToolLabel:``,turnStartedAt:0,lastByteAt:0,turnId:``,lastSeq:0,_resumeProbe:!1,nowTs:0,_abort:null,_saveTimer:0,_loadedCard:``,_cardRenamedTo:``,_saving:!1,_liveTicker:0,_turnPersistTimer:0}},computed:{pickOwnerRow(){return Sk(this.messages)},suggestBatchKey(){return QP({cardId:this.cardId,cardEmpty:this.cardEmpty,messages:this.messages})},suggestBatch(){return $P(this.suggestBatchKey)},suggestions(){return eF(this.suggestBatch,this.suggestOffset)},canShuffle(){return this.suggestBatch.length>4},quickChips(){return tF(this.suggestBatch)},emptyTitle(){return(XP[this.suggestBatchKey]||XP.card).title},emptyDesc(){return(XP[this.suggestBatchKey]||XP.card).desc},ccSwitchCheckedCount(){let e=this.ccSwitchSelected||{};return Object.keys(e).filter(t=>e[t]).length},ccSwitchDupCount(){return(this.ccSwitchProviders||[]).filter(e=>e.duplicate).length},configReady(){return!!(this.config.baseUrl&&this.config.model&&this.config.hasKey)},panelWidth(){let e=this.winW||1280,t=Math.max(aF,Math.floor(e*oF)),n=Math.round(e*sF),r=this.widthPx||n;return Math.max(aF,Math.min(t,r))},panelStyle(){return{width:`${this.panelWidth}px`}},stallLimitMs(){let e=Number(this.config.stallTimeoutMs)>0?Number(this.config.stallTimeoutMs):12e4;return Math.round(e*1.5)},idleMs(){return this.lastByteAt?Math.max(0,(this.nowTs||Date.now())-this.lastByteAt):0},stalled(){return!!(this.busy&&this.idleMs>this.stallLimitMs)},liveText(){if(!this.busy)return``;let e=[];return this.turnStartedAt&&e.push(`${ek(this.turnStartedAt)} 开始`),this.turnStep>0&&e.push(`第 ${this.turnStep} 步`),e.push(`已用 ${this.fmtClock(this.nowTs-this.turnStartedAt)}`),this.turnStage?e.push(`${this.turnStage.id} ${this.turnStage.label}`):this.turnToolLabel&&e.push(this.turnToolLabel),this.stalled?`${Math.round(this.idleMs/1e3)} 秒没收到任何数据,连接可能已中断(${e.join(` · `)})`:(e.push(`最近数据 ${Math.round(this.idleMs/1e3)} 秒前`),e.join(` · `))}},watch:{suggestBatchKey(){this.suggestOffset=0},visible(e){e?(this.refreshConfig(),this.ensureHistory().then(()=>this.checkResumableTurn()),this.$nextTick(()=>{this.scrollToBottom(!0),this.$refs.composerEl?.focus()})):this.busy&&this.flushHistory()},cardId(e,t){if(this._cardRenamedTo&&this._cardRenamedTo===e){this._cardRenamedTo=``,this._dirtyFor===t&&(this._dirtyFor=e),this._loadedCard===t?(this._loadedCard=e,this._dirtyFor===e&&this.flushHistory(e)):(this._loadedCard=``,this.ensureHistory());return}this._saveTimer&&=(clearTimeout(this._saveTimer),0);let n=this._dirtyFor===t?this.serialize():null;this._dirtyFor=null,this.draftAttachments=[],this.messages=[],n&&t&&this.flushHistory(t,n),this.ensureHistory()}},mounted(){this.loadWidth(),this.loadCompact(),window.addEventListener(`resize`,this.onWinResize),window.addEventListener(`pagehide`,this.onPagehide),this.refreshConfig(),this.ensureHistory()},beforeUnmount(){window.removeEventListener(`resize`,this.onWinResize),window.removeEventListener(`pagehide`,this.onPagehide),this.stopTurnTimers(),this.stopTickers(),this.flushHistory(),this._abort&&this._abort.abort()},methods:{onWinResize(){this.winW=window.innerWidth},onImageClick(e){let t=e.target&&e.target.closest?e.target.closest(`img`):null;if(!t||t.dataset.noZoom===`1`)return;let n=Array.from(this.$el.querySelectorAll(`img`)).filter(e=>e.dataset.noZoom!==`1`),r=n.indexOf(t);r<0||_C(n.map(e=>({src:e.currentSrc||e.src,alt:e.alt||``,title:e.getAttribute(`title`)||e.closest(`[title]`)?.getAttribute(`title`)||``})),r)},loadWidth(){try{let e=localStorage.getItem(nF);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=aF&&(this.widthPx=t)}}catch{}},saveWidth(){try{this.widthPx?localStorage.setItem(nF,String(Math.round(this.panelWidth))):localStorage.removeItem(nF)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=e=>{let t=Math.max(aF,Math.floor(window.innerWidth*oF));this.widthPx=Math.max(aF,Math.min(t,Math.round(window.innerWidth-e.clientX)))},i=()=>{t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i),t.removeEventListener(`pointercancel`,i),window.removeEventListener(`blur`,i);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveWidth()};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i),t.addEventListener(`pointercancel`,i),window.addEventListener(`blur`,i)},resetWidth(){this.widthPx=0,this.saveWidth()},async refreshConfig(){try{let e=await Yk();this.config={...e,hasKey:!!(e.hasKey||e.apiKey)},e.turnRunning!==void 0&&(this.turnRunning=e.turnRunning===!0)}catch{this.config={baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``}}},async loadModels(){try{let e=await Zk();this.models=Array.isArray(e.models)?e.models:[],this.activeId=e.activeId||null,this.turnRunning=e.turnRunning===!0}catch{this.models=[],this.activeId=null}},openModelList(){this.modelListOpen=!0,this.loadModels(),this.refreshConfig()},closeModelList(){this.modelListOpen=!1},onModelAdd(){this.modelListOpen=!1,this.editModelId=null,this.editInitialModel=null,this.modelEditOpen=!0},onModelEdit(e){if(this.turnRunning&&e&&e.id===this.activeId)return this.notify(`warn`,uF);this.modelListOpen=!1,this.editModelId=e&&e.id?e.id:null,this.editInitialModel=e||null,this.modelEditOpen=!0},onModelEditClose(){this.modelEditOpen=!1,this.modelListOpen=!0},async onModelSaved(){this.modelEditOpen=!1,this.modelListOpen=!0,await this.loadModels(),await this.refreshConfig()},async onModelActivate(e){if(!(!e||!e.id)){if(this.turnRunning&&e.id!==this.activeId)return this.notify(`warn`,uF);try{await rA(e.id)}catch(e){this.notify(`warn`,`切换模型失败:${e.message||e}`)}await this.loadModels(),await this.refreshConfig()}},onModelDelete(e){if(!(!e||!e.id)){if(this.turnRunning&&e.id===this.activeId)return this.notify(`warn`,uF);this.confirmDeleteModel=e}},async doDeleteModel(){let e=this.confirmDeleteModel;if(this.confirmDeleteModel=null,!(!e||!e.id)){try{await nA(e.id)}catch(e){this.notify(`warn`,`删除失败:${e.message||e}`);return}await this.loadModels(),await this.refreshConfig(),this.notify(`ok`,`已删除模型「${e.name||e.model||e.id}」`)}},get deleteModelMessage(){let e=this.confirmDeleteModel;return`确定删除模型「${e?e.name||e.model||e.id:``}」吗?此操作不可撤销,配置将从 .env.cb.local 移除${e&&e.id===this.activeId?`。该模型当前为生效模型,删除后会自动回落到剩余模型中的第一条(若已无模型则需重新添加)。`:`。`}`},async onImportCcSwitch(){this.ccSwitchOpen=!0,this.ccSwitchLoading=!0,this.ccSwitchProviders=[],this.ccSwitchReason=``,this.ccSwitchSelected={};try{let e=await Qk(),t=Array.isArray(e.providers)?e.providers:[],n=this.models.map(e=>e.model).filter(Boolean);t.forEach(e=>{e.duplicate=n.includes(e.model)}),this.ccSwitchProviders=t,t.length||(this.ccSwitchReason=e.reason||`cc-switch 中没有可导入的 Codex 类供应商`)}catch(e){this.ccSwitchReason=`读取 cc-switch 失败:${e&&e.message||e}`}finally{this.ccSwitchLoading=!1}},toggleCcSwitchItem(e){if(!e||e.duplicate)return;let t={...this.ccSwitchSelected};t[e.id]?delete t[e.id]:t[e.id]=!0,this.ccSwitchSelected=t},async confirmImportCcSwitch(){let e=this.ccSwitchProviders.filter(e=>this.ccSwitchSelected[e.id]&&!e.duplicate);if(!e.length)return;let t=0,n=0;for(let r of e)try{await eA({name:r.name||r.model,baseUrl:r.baseUrl,apiKey:r.apiKey||``,model:r.model,maxTokens:0,thinking:!1,vision:!1}),t++}catch(e){n++,console.error(`[cc-switch 导入失败]`,r.name,e)}this.ccSwitchOpen=!1,await this.loadModels(),await this.refreshConfig(),n?this.notify(`warn`,`导入完成:成功 ${t} 个、失败 ${n} 个`):this.notify(`ok`,`已从 cc-switch 导入 ${t} 个模型`)},openCommon(){this.modelListOpen=!1,this.commonOpen=!0},async onCommonSaved(){this.commonOpen=!1,await this.refreshConfig(),this.notify(`ok`,`通用设置已保存`)},async ensureHistory(){let e=this.cardId;if(!(!e||this._loadedCard===e)){this._loadedCard=e,this.loadingHistory=!0;try{let t=await fA(e);if(this.cardId!==e)return;let n=this.busy?this.turnId:``,r=(t.messages||[]).map(e=>this.revive(e)).filter(e=>!(n&&e.role===`assistant`&&e.turnId===n));this.archiveTrimmed=r.some(e=>e.trimmedArchive===!0);let i=new Set(r.map(e=>e.id)),a=this.messages.filter(e=>!i.has(e.id));this.messages=[...r,...a],this.contextUsage=null,this._dirtyFor=null,this.checkResumableTurn(),this.$nextTick(()=>this.scrollToBottom(!0))}catch{this.cardId===e&&(this.messages=[]),this._dirtyFor=null}finally{this.cardId===e&&(this.loadingHistory=!1)}}},serialize(){return this.messages.map(e=>{let t={id:e.id,role:e.role,content:e.content||``,ts:e.ts};return e.role===`assistant`?(t.reasoning=e.reasoning||``,t.reasoningMs=e.reasoningMs||0,t.error=e.error||``,e.errorCode&&(t.errorCode=e.errorCode),e.events?.length&&(t.events=e.events.map(e=>({ts:e.ts||0,level:e.level||`warn`,code:e.code||``,message:e.message||``}))),t.elapsedMs=e.elapsedMs||0,t.status=e.status===`streaming`?`aborted`:e.status||`done`,e.turnId&&(t.turnId=e.turnId),e.serverAuthored&&(t.serverAuthored=!0),e.budget?.message&&(t.budget={reason:e.budget.reason||``,message:e.budget.message}),e.usage&&(t.usage=e.usage),e.toolCalls?.length&&(t.toolCalls=e.toolCalls.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:e.result,error:e.error||``,ms:e.ms||0,startedAt:e.startedAt||0,command:e.command||``,approvalNote:e.approvalNote||``,autoApproved:!!e.autoApproved,truncated:!!e.truncated})))):e.attachments?.length&&(t.attachments=e.attachments.map(e=>({path:e.path,name:e.name,isDir:!!e.isDir,isImage:!!e.isImage,size:e.size||0,entryCount:e.entryCount||0,exists:e.exists!==!1}))),t})},revive(e){return{id:e.id||lF(),role:e.role===`user`?`user`:`assistant`,content:e.content||``,narrationChars:Math.max(0,Number(e.narrationChars)||0),reasoning:e.reasoning||``,reasoningMs:e.reasoningMs||0,elapsedMs:Number(e.elapsedMs)||0,toolCalls:Array.isArray(e.toolCalls)?e.toolCalls.map(t=>(e.status===`aborted`||e.status===`streaming`)&&t&&!t.error&&t.result==null?{...t,error:`已终止:该调用未拿到结果(轮次被中断)`}:t):[],attachments:Array.isArray(e.attachments)?e.attachments:[],events:Array.isArray(e.events)?e.events:[],error:e.error||``,errorCode:e.errorCode||``,trimmedArchive:e.trimmedArchive===!0,status:e.status||`done`,turnId:e.turnId||``,serverAuthored:e.serverAuthored===!0,budget:e.budget?.message?{reason:e.budget.reason||``,message:e.budget.message}:void 0,usage:e.usage||void 0,ts:e.ts||0}},persist(){this.cardId&&(this._dirtyFor=this.cardId,this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=setTimeout(()=>this.flushHistory(),500))},fitArchive(e){if(BP(e)<=4e6)return e;let t=UP(e,!1);return BP(t)>4e6&&(t=UP(t,!0)),this.archiveTrimmed=!0,t},async flushHistory(e=this.cardId,t=null){if(this._saveTimer&&=(clearTimeout(this._saveTimer),0),e){if(this._saving){this._saveTimer=setTimeout(()=>this.flushHistory(e,t),800);return}this._saving=!0;try{await pA(e,this.fitArchive(t||this.serialize())),this._dirtyFor===e&&(this._dirtyFor=null)}catch(e){this.notify(`warn`,`对话记录保存失败:${e.message||e}`)}finally{this._saving=!1}}},migrateCard(e,t){!e||!t||e===t||this.cardId===e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._cardRenamedTo=t,this._dirtyFor===e&&(this._dirtyFor=t))},discardCard(e){e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._dirtyFor===e&&(this._dirtyFor=null),(this._loadedCard===e||this.cardId===e)&&(this.busy&&this._abort&&this._abort.abort(),this.messages=[],this.draftAttachments=[],this.contextUsage=null,this._loadedCard=``))},askClear(){this.messages.length&&(this.confirmClear=!0)},async doClear(){this.confirmClear=!1;let e=this.cardId;this.messages=[],this.contextUsage=null,this._loadedCard=e,this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0);try{await mA(e),this.notify(`ok`,`已清空本卡片的对话记录`)}catch(e){this.notify(`warn`,`清空失败:${e.message||e}`)}},async onPick(e){try{let t=await oA(e);if(t.cancelled)return;for(let e of t.items||[])this.pushAttachment(e);t.items?.length||this.notify(`warn`,`未选到可用文件`)}catch(e){this.notify(`warn`,e.message||`无法调起系统选择器,可改用拖拽或粘贴路径`)}},async onAddPath(e){try{let t=await sA(e);this.pushAttachment(t)}catch(t){this.notify(`warn`,`路径不可用:${e}(${t.message||t})`)}},async onPasteImage(e){try{let t=await uA(e);this.pushAttachment(t,`粘贴的截图已存到本机 .cache/ai-attachments/`)}catch(e){this.notify(`warn`,`截图保存失败:${e.message||e}`)}},async onDropFiles(e){let t=Array.from(e.items||[]).map(e=>e.webkitGetAsEntry?e.webkitGetAsEntry():null).filter(Boolean),n=Array.from(e.files||[]),r=[];if(t.length)for(let e of t)r.push(this.resolveEntry(e));else for(let e of n)r.push(this.resolveFile(e));if(!r.length){this.notify(`warn`,`没有识别到可挂载的文件`);return}let i=(await Promise.all(r)).filter(e=>e!==`cancelled`&&!e).length;i&&this.notify(`warn`,`${i} 项未能定位本机路径,可改用「粘贴路径」添加`)},async resolveEntry(e){if(e.isDirectory){let t=await this.firstFileInDir(e);return this.resolveByName(e.name,e.fullPath||e.name,t?.size??-1,t?.name||``)}let t=await this.entryToFile(e);return t?this.resolveFile(t):this.resolveByName(e.name,e.fullPath||e.name,-1)},async resolveFile(e){return this.resolveByName(e.name,e.webkitRelativePath||e.name,e.size)},async resolveByName(e,t,n,r=``){let i={id:lF(`att`),path:``,name:e,isDir:!1,isImage:!1,pending:!0};this.draftAttachments=[...this.draftAttachments,i];try{let a=await lA(cA({name:e,relPath:t,size:n,child:r}),rF,`locate`);return i.removed?`cancelled`:(this.pushAttachment(a),a)}catch{return i.removed?`cancelled`:null}finally{this.draftAttachments=this.draftAttachments.filter(e=>e.id!==i.id)}},entryToFile(e){return new Promise(t=>{try{e.file(e=>t(e),()=>t(null))}catch{t(null)}})},firstFileInDir(e){return new Promise(t=>{try{e.createReader().readEntries(async e=>{for(let n of e||[])if(!n.isDirectory){let e=await this.entryToFile(n);if(e)return t(e)}t(null)},()=>t(null))}catch{t(null)}})},pushAttachment(e,t){e?.path&&(this.draftAttachments.some(t=>t.path===e.path)||(this.draftAttachments=[...this.draftAttachments,{...e,note:t}],t&&this.notify(`ok`,t)))},removeAttachment(e){if(!e)return;let t=this.draftAttachments.find(t=>(t.id||t.path)===e);t&&t.pending&&(t.removed=!0),this.draftAttachments=this.draftAttachments.filter(t=>(t.id||t.path)!==e)},cancelPendingLocates(){for(let e of this.draftAttachments)e.pending&&(e.removed=!0)},useSuggestion(e){this.$refs.composerEl?.setText(e.text),this.trackSuggest(e)},shuffleSuggestions(){let e=this.suggestBatch.length;e&&(this.suggestOffset=(this.suggestOffset+4)%e)},trackSuggest(e){if(!(!e||!e.id)){this.suggestStats[e.id]=(this.suggestStats[e.id]||0)+1;try{window.dispatchEvent(new CustomEvent(`cardbuddy:suggest`,{detail:{id:e.id,label:e.label,weight:e.weight,batch:this.suggestBatchKey}}))}catch{}}},async onSend({text:e,attachments:t}){if(this.busy||!await this.ensureConfig())return;this.notice=null;let n={id:lF(`u`),role:`user`,content:e,attachments:t.map(e=>({...e})),ts:Date.now()};this.messages.push(n),this.cancelPendingLocates(),this.draftAttachments=[],this.pinned=!0,await this.runTurn({retractMsgId:n.id,draft:{text:e,attachments:n.attachments}})},async ensureConfig(){return await this.refreshConfig(),this.configReady?!0:(this.modelListOpen=!0,this.loadModels(),this.notify(`warn`,`请先在模型库中添加并配置模型(Base URL / API Key / 模型名)`),!1)},onPickBoard(e){if(this.busy)return;let t=Ck(e,this.cardId);t&&this.onSend({text:t,attachments:[]})},onContinue(){this.busy||this.onSend({text:`继续`,attachments:[]})},async regenerate(e){if(this.busy)return;let t=this.messages.findIndex(t=>t.id===e.id);t>0&&(this.messages=this.messages.slice(0,t)),await this.runTurn()},async runTurn(e={}){this.messages.push({id:lF(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:Date.now()});let t=this.messages[this.messages.length-1],n=t.id;this.busy=!0,this.pinned=!0,this.startTurn();let r=new AbortController;this._abort=r;let i=!1,a=Date.now(),o=()=>{t.reasoning&&!t.reasoningMs&&(t.reasoningMs=Date.now()-a)};try{await gA({messages:this.toWire(this.messages.filter(e=>e.id!==n)),cardContext:this.cardId?{id:this.cardId}:void 0,attachments:this.lastAttachments(),signal:r.signal,onEvent:e=>this.onEvent(e,t,o)}),t.status===`streaming`&&(t.status=`done`)}catch(a){let s=r.signal.aborted||/abort/i.test(String(a?.message||a));o(),a?.code===`turn-in-flight`?(i=!0,this.messages=this.messages.filter(t=>t.id!==n&&t.id!==e.retractMsgId),e.draft&&(this.draftAttachments=(e.draft.attachments||[]).map(e=>({...e})),this.$refs.composerEl?.setText(e.draft.text||``)),this.notify(`warn`,String(a?.message||`这张卡片已有一个回合在跑:请先终止或等它结束,再发新消息`)),this.$nextTick(()=>this.checkResumableTurn())):s?t.status=`aborted`:await this.reattachAfterDrop(t,o)?this.pushEvent(t,{level:`info`,code:`stream-resumed`,message:`已接回本回合,继续跟随进度`}):(t.error=String(a?.message||a),t.errorCode=String(a?.code||``),t.status=`error`)}finally{o(),this.endTurn(t,{rejected:i})}},endTurn(e,{rejected:t=!1}={}){e.status===`streaming`&&(e.status=`done`),t||(e.elapsedMs=Math.max(0,Date.now()-this.turnStartedAt)),this.busy=!1,this._abort=null,this.stopTurnTimers(),this.persist(),this.$emit(`busy`,!1),t||this.$emit(`turn-finished`,{status:e.status,error:e.error||``,steps:this.turnStep,ms:Date.now()-this.turnStartedAt,startedAt:this.turnStartedAt,finishedAt:Date.now(),turnId:this.turnId||e.turnId||``}),this.$nextTick(()=>this.scrollToBottom())},async checkResumableTurn(){let e=this.cardId;if(!(!e||this.busy||this._resumeProbe)){this._resumeProbe=!0;try{let t;try{t=await _A(e)}catch{return}let n=t&&t.active;if(!n||!n.turnId||this.cardId!==e||this.busy)return;await this.attachToTurn({cardId:e,turnId:String(n.turnId),startedAt:Number(n.startedAt)||0,afterSeq:0,note:n.detached?`接回一个仍在服务端运行的回合(上次连接已中断,进度与已落盘产物都在)`:`接回本回合的实时进度`})}finally{this._resumeProbe=!1}}},async attachToTurn({cardId:e,turnId:t,startedAt:n=0,afterSeq:r=0,note:i=``}){let a=this.messages.find(e=>e.role===`assistant`&&e.turnId===t);a||=(this.messages.push({id:lF(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:n||Date.now(),turnId:t}),this.messages[this.messages.length-1]),a.content=``,a.reasoning=``,a.reasoningMs=0,a.toolCalls=[],a.events=[],a.error=``,a.errorCode=``,a.budget=void 0,a.status=`streaming`,a.turnId=t,this.busy=!0,this.pinned=!0,this.startTurn(),this.turnId=t,this.lastSeq=Number(r)||0,n&&(this.turnStartedAt=n,a.ts=n);let o=new AbortController;this._abort=o;let s=n||Date.now(),c=()=>{a.reasoning&&!a.reasoningMs&&(a.reasoningMs=Date.now()-s)};i&&this.notify(`warn`,i);try{this.lastSeq=await yA({cardId:e,turnId:t,afterSeq:this.lastSeq,signal:o.signal,onEvent:e=>this.onEvent(e,a,c)})}catch(e){o.signal.aborted||/abort/i.test(String(e?.message||e))||(a.error=String(e?.message||e),a.errorCode=String(e?.code||``),a.status=`error`)}finally{c(),this.endTurn(a)}},async reattachAfterDrop(e,t){let n=this.cardId,r=this.turnId||e.turnId,i=this._abort;if(!n||!r||!i||i.signal.aborted)return!1;try{return this.pushEvent(e,{level:`warn`,code:`stream-dropped`,message:`连接中断:正在按断点续订本回合(服务端仍在跑,已执行的写入不受影响)`}),this.lastSeq=await yA({cardId:n,turnId:r,afterSeq:this.lastSeq,signal:i.signal,onEvent:n=>this.onEvent(n,e,t)}),!0}catch{return!1}},onEvent(e,t,n){this.lastByteAt=Date.now();let r=Number(e.seq)||0;switch(r>this.lastSeq&&(this.lastSeq=r),e.type){case`turn-start`:e.turnId&&(this.turnId=String(e.turnId),t.turnId=String(e.turnId)),Number(e.startedAt)&&(this.turnStartedAt=Number(e.startedAt),t.ts=Number(e.startedAt));break;case`client-detached`:this.pushEvent(t,{level:`info`,code:`client-detached`,message:`连接曾中断,回合在服务端继续跑(事件已全部落日志)`});break;case`turn-end`:(e.status===`aborted`||e.status===`error`)&&(t.status=e.status),e.usage&&this.applyUsage(t,e.usage);break;case`usage`:this.applyUsage(t,e);break;case`reasoning-delta`:t.reasoning+=e.text||``;break;case`text-delta`:n(),t.content+=e.text||``;break;case`tool-call-start`:n(),t.content&&(t.narrationChars=t.content.length),this.findToolRow(t,e)||t.toolCalls.push({toolCallId:e.toolCallId||lF(`tc`),toolName:e.toolName,args:{},pending:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break;case`tool-call`:{n(),t.content&&(t.narrationChars=t.content.length);let r=this.findToolRow(t,e);r?(e.toolCallId&&(r.toolCallId=e.toolCallId),e.toolName&&(r.toolName=e.toolName),r.args=e.args||{},r.pending=!1):t.toolCalls.push({toolCallId:e.toolCallId||lF(`tc`),toolName:e.toolName,args:e.args||{},result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`tool-result`:{let n=t.toolCalls.find(t=>t.toolCallId===e.toolCallId||!e.toolCallId&&t.toolName===e.toolName&&t.result===void 0);n&&(n.result=e.result??``,n.truncated=!!e.truncated,e.error&&(n.error=String(e.error)),e.image&&(n.image=e.image),n.ms=Date.now()-(n.startedAt||Date.now())),this.persist();break}case`approval-request`:{let n=this.findToolRow(t,e)||t.toolCalls[t.toolCalls.length-1];n&&n.toolName===e.toolName&&n.result===void 0?(n.approvalId=e.approvalId,e.command&&(n.command=e.command),n.needsApproval=!0):t.toolCalls.push({toolCallId:e.toolCallId||lF(`tc`),toolName:e.toolName,args:e.args||{},command:e.command||``,approvalId:e.approvalId,needsApproval:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`approval-decided`:{let n=(t.toolCalls||[]).find(t=>t.approvalId===e.approvalId);n&&(n.needsApproval=!1,n.approvalNote=e.ok?e.scope===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:e.reason||`已拒绝执行`);break}case`approval-auto`:{let n=this.findToolRow(t,e)||[...t.toolCalls||[]].reverse().find(t=>t.toolName===e.toolName&&t.result===void 0);n&&(e.command&&(n.command=e.command),n.autoApproved=!0,n.approvalNote=`按设置免确认执行`);break}case`notice`:{let n=e.level===`info`||e.level===`error`?e.level:`warn`;this.pushEvent(t,{level:n,code:e.code||``,message:e.message||``}),n!==`info`&&this.notify(n===`error`?`danger`:`warn`,e.message||``);break}case`round-retry`:{let n=Number(e.dropReasoning)||0,r=Number(e.dropText)||0,i=Number(e.dropTools)||0;n>0&&(t.reasoning=t.reasoning.slice(0,Math.max(0,t.reasoning.length-n))),r>0&&(t.content=t.content.slice(0,Math.max(0,t.content.length-r))),i>0&&t.toolCalls.splice(Math.max(0,t.toolCalls.length-i),i),t.reasoning||(t.reasoningMs=0),this.pushEvent(t,{level:`warn`,code:`retry-${e.reason||`unknown`}`,message:e.message||``}),this.notify(`warn`,e.message||``);break}case`context-usage`:this.contextUsage={used:Number(e.used)||0,total:Number(e.total)||0,window:Number(e.window)||0};break;case`turn-ended`:t.budget={reason:String(e.reason||``),message:String(e.message||``)};break;case`error`:t.error=t.error?`${t.error}\n${e.message}`:String(e.message||``),e.code&&(t.errorCode=String(e.code)),t.status=`error`;break;case`aborted`:t.status=`aborted`}let i=t.toolCalls||[];this.turnStep=i.length;let a=i[i.length-1];if(a){this.turnToolLabel=`正在${XO(a.toolName)}…`;let e=rk(a);e&&(!this.turnStage||e.order>this.turnStage.order)&&(this.turnStage=e)}this.$nextTick(()=>this.scrollToBottom())},async onApproval({tc:e,ok:t,scope:n=`once`}){if(e?.approvalId){e.needsApproval=!1,e.approvalNote=t?n===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:`已拒绝执行`;try{await dA({approvalId:e.approvalId,ok:t,scope:n})}catch(e){this.notify(`warn`,`审批提交失败:${e.message}`)}}},findToolRow(e,t){let n=e.toolCalls||[];if(t.toolCallId){let e=n.find(e=>e.toolCallId===t.toolCallId);if(e)return e}return n.find(e=>e.pending&&e.toolName===t.toolName)||null},stop(){this.confirmStop=!1;let e=this._abort,t=this.cardId,n=this.turnId||``;t&&n&&vA(t).catch(e=>{e?.code!==`no-turn`&&this.notify(`warn`,`终止请求未送达:${e.message}`)}),e&&(e.abort(),this.notify(`ok`,`已终止本次生成`))},doStop(){this.stop()},onEscape(){if(this.confirmStop){this.confirmStop=!1;return}if(this.confirmDeleteModel){this.confirmDeleteModel=null;return}if(this.commonOpen){this.commonOpen=!1;return}if(this.modelListOpen||this.modelEditOpen){this.modelListOpen=!1,this.modelEditOpen=!1;return}if(this.busy){this.confirmStop=!0;return}this.$emit(`close`)},lastAttachments(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(t.role===`user`)return(t.attachments||[]).map(e=>({path:e.path,name:e.name,isDir:e.isDir,isImage:e.isImage}))}return[]},toWire(e){return e.map(e=>{if(e.role===`user`){let t=e.attachments||[],n=e.content||``;if(t.length){let e=t.map(e=>`- ${e.isDir?`文件夹`:e.isImage?`图片`:`文件`}:${e.path}`);n=`${n}${n?`
301
+ 分组展开后的成员行与平铺行走的是同一份标记,复制两遍必然漂移 `),U(`div`,{class:A([`aitool`,[`aitool--${a.state}`,{"is-open":a.open}]])},[U(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.open?`true`:`false`,onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[7]||=U(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),a.state===`running`||a.state===`pending`?(B(),V(`svg`,Fk,[...t[4]||=[U(`use`,{href:`#icon-loading`},null,-1)]])):a.state===`error`?(B(),V(`svg`,Ik,[...t[5]||=[U(`use`,{href:`#icon-alert-triangle`},null,-1)]])):(B(),V(`svg`,Lk,[...t[6]||=[U(`use`,{href:`#icon-check`},null,-1)]])),U(`span`,Rk,j(a.toolLabel(n.tc.toolName)),1),U(`code`,zk,j(n.tc.pending?`参数生成中…`:a.argSummary),1),K(` 时间三件套:这一步什么时候开始(墙钟)· 距回合起点多久(累计)· 自身耗时。
302
+ 长任务里「卡在哪一步、卡了多久」全靠这三个数互相对齐 `),a.clockText?(B(),V(`span`,{key:3,class:`aitool__clock`,title:a.clockTitle},j(a.clockText),9,Bk)):K(`v-if`,!0),a.msText?(B(),V(`span`,{key:4,class:`aitool__ms`,title:`本步耗时 ${a.msText}`},j(a.msText),9,Vk)):K(`v-if`,!0)],8,Pk),K(` 高危执行逐次确认:命令原文 + 允许一次 / 本回合不再询问 / 拒绝(Codex 审批的同款交互) `),n.tc.needsApproval?(B(),V(`div`,Hk,[t[8]||=U(`svg`,{class:`aitool__approve-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`code`,{class:`aitool__approve-cmd`,title:a.approvalCommand},j(a.approvalCommand),9,Uk),U(`span`,Wk,j(n.tc.toolName===`skill_exec`?`技能脚本,需要你确认`:`本地命令,需要你确认`),1),U(`button`,{type:`button`,class:`aitool__approve-btn`,onClick:t[1]||=q(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`once`}),[`stop`])},`允许一次`),U(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--ghost`,onClick:t[2]||=q(t=>e.$emit(`approval`,{tc:n.tc,ok:!0,scope:`turn`}),[`stop`])},`本回合不再询问`),U(`button`,{type:`button`,class:`aitool__approve-btn aitool__approve-btn--deny`,onClick:t[3]||=q(t=>e.$emit(`approval`,{tc:n.tc,ok:!1}),[`stop`])},`拒绝`)])):n.tc.approvalNote?(B(),V(z,{key:1},[K(` 免确认策略命中:没有审批条,但照样把「跑了什么命令」摆出来,免确认不等于无痕迹 `),U(`div`,{class:A([`aitool__approve-note`,{"is-auto":n.tc.autoApproved}])},[U(`span`,Gk,j(n.tc.approvalNote),1),n.tc.autoApproved&&n.tc.command?(B(),V(`code`,{key:0,class:`aitool__approve-cmd`,title:n.tc.command},j(n.tc.command),9,Kk)):K(`v-if`,!0)],2)],2112)):K(`v-if`,!0),I(U(`div`,qk,[K(` 画板清单点选:清单里是 1 起的板号、--indices 是 0 起,让用户/模型去换算,实测就是这么
303
+ 错一位建错画板的。点一下 = 把清单行尾那串原样的 --pick 直接发给模型,中间零翻译 `),a.boardPicks.length?(B(),V(`div`,Jk,[t[9]||=U(`div`,{class:`aitool__picks-hint`},`点一下直接建卡 = 照抄清单行尾的 --pick,不用换算序号;一板多卡已按张拆开:`,-1),(B(!0),V(z,null,R(a.boardPicks,t=>(B(),V(`button`,{key:t.pick,type:`button`,class:`aitool__pick`,title:`${t.name}(${t.size})→ parse_meaxure.py --pick ${t.pick}`,"aria-label":`建卡:画板 ${t.no} ${t.name}(${t.size})--pick ${t.pick}`,onClick:n=>e.$emit(`pick-board`,t)},[U(`span`,Xk,`第 `+j(t.no)+` 板`,1),U(`code`,Zk,j(t.token),1)],8,Yk))),128))])):K(`v-if`,!0),a.argsSource?(B(),H(o,{key:1,source:a.argsSource},null,8,[`source`])):K(`v-if`,!0),n.tc.image?(B(),V(`img`,{key:2,class:`aitool__shot`,src:`data:${n.tc.image.mime||`image/png`};base64,${n.tc.image.base64}`,alt:`卡片截图`},null,8,Qk)):K(`v-if`,!0),n.tc.error?(B(),V(`div`,$k,j(n.tc.error),1)):a.resultSource?(B(),H(o,{key:4,source:a.resultSource},null,8,[`source`])):K(`v-if`,!0)],512),[[Sc,a.open]])],2)],2112)}var tA=X(Nk,[[`render`,eA],[`__scopeId`,`data-v-c80ddf1d`],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatToolRow.vue`]]);function nA(e){return`${Fl()||``}/__ai/fs/raw?path=${encodeURIComponent(e)}`}async function rA(e){let t=await e.json().catch(()=>({}));if(!e.ok){let n=``;try{n=new URL(e.url).pathname}catch{}let r=(e.status===404||e.status===405)&&n.startsWith(`/__ai/`)?`本地开发服务仍在运行改造前的旧代码(缺少该接口),请重启 npm run dev(cardbuddy)后重试`:t.message||t.error||`HTTP ${e.status}`,i=Error(r);throw i.code=t.error,i.payload=t,i}return t}async function iA(e=!1){return rA(await J(`/__ai/config${e?`?reveal=1`:``}`))}async function aA(e){return rA(await J(`/__ai/config`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function oA(){return rA(await J(`/__ai/models`))}async function sA(){return rA(await J(`/__ai/cc-switch-providers`))}async function cA(e,t=!1){return rA(await J(`/__ai/models/${encodeURIComponent(e)}${t?`?reveal=1`:``}`))}async function lA(e){return rA(await J(`/__ai/models`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function uA(e,t){return rA(await J(`/__ai/models/${encodeURIComponent(e)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}))}async function dA(e){return rA(await J(`/__ai/models/${encodeURIComponent(e)}`,{method:`DELETE`}))}async function fA(e){return rA(await J(`/__ai/models/${encodeURIComponent(e)}/activate`,{method:`POST`}))}async function pA(e={}){let{baseUrl:t=``,apiKey:n=``,model:r=``}=e||{};return rA(await J(`/__ai/probe-maxtokens`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({baseUrl:t,apiKey:n,model:r})}))}async function mA(e){return rA(await J(`/__ai/ping`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)}))}async function hA(e=`image`){return rA(await J(`/__ai/fs/pick`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({kind:e,multiple:!0})}))}async function gA(e){return rA(await J(`/__ai/fs/stat?path=${encodeURIComponent(e)}`))}async function _A({name:e,relPath:t,size:n,child:r=``}){return rA(await J(`/__ai/fs/locate`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,relPath:t,size:n,child:r})}))}function vA(e,t,n=`request`){return new Promise((r,i)=>{let a=setTimeout(()=>{let e=Error(`${n}-timeout`);e.code=`timeout`,i(e)},t);e.then(e=>{clearTimeout(a),r(e)},e=>{clearTimeout(a),i(e)})})}async function yA(e){return rA(await J(`/__ai/fs/stash`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({dataUrl:e})}))}async function bA({approvalId:e,ok:t,scope:n=`once`}){return rA(await J(`/__ai/approve`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({approvalId:e,ok:t,scope:n})}))}async function xA(e){return e?rA(await J(`/__ai/history?cardId=${encodeURIComponent(e)}`)):{cardId:``,messages:[],updatedAt:0}}async function SA(e,t,n={}){return e?rA(await J(`/__ai/history`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e,messages:t}),keepalive:n.keepalive===!0})):{ok:!1,error:`missing-card-id`}}async function CA(e){return e?rA(await J(`/__ai/history?cardId=${encodeURIComponent(e)}`,{method:`DELETE`})):{ok:!1,error:`missing-card-id`}}async function wA(e,t){let n=e.body.getReader(),r=new TextDecoder,i=``,a=e=>{i+=e;let n=i.split(`
304
+ `);i=n.pop()||``;for(let e of n){let n=e.trim();if(!n.startsWith(`data:`))continue;let r=n.slice(5).trim();if(!r)continue;let i;try{i=JSON.parse(r)}catch{continue}if(t(i)===!0)return!0}return!1};try{for(;;){let{done:e,value:t}=await n.read();if(e||a(r.decode(t,{stream:!0})))break}a(r.decode())}finally{try{n.releaseLock?.()}catch{}}}async function TA({messages:e,cardContext:t,attachments:n=[],config:r={},signal:i,onEvent:a}){let o=await J(`/__ai/chat`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({messages:e,cardContext:t,attachments:n,config:r}),signal:i});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t.payload=e,t}await wA(o,e=>(a(e),e.type===`done`))}async function EA(e){return e?rA(await J(`/__ai/turns?cardId=${encodeURIComponent(e)}`)):{cardId:``,active:null,recent:[]}}async function DA(e){return e?rA(await J(`/__ai/stop`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})})):{ok:!1,error:`missing-card-id`}}async function OA({cardId:e,afterSeq:t=0,turnId:n=``,signal:r,onEvent:i}){if(!e){let e=Error(`缺少 cardId,无法续订回合`);throw e.code=`missing-card-id`,e}let a=new URLSearchParams({cardId:e,afterSeq:String(Number(t)||0)});n&&a.set(`turnId`,String(n));let o=await J(`/__ai/turn?${a}`,{signal:r});if(!o.ok||!o.body){let e=await o.json().catch(()=>({})),t=Error(e.message||e.error||`HTTP ${o.status}`);throw t.code=e.error||`http-${o.status}`,t.status=o.status,t}let s=Number(t)||0;return await wA(o,e=>{let t=Number(e.seq)||0;return t>s&&(s=t),i(e),!1}),s}function kA(e,t,n=300){let r=String(e??``),i=Math.max(0,Math.min(Number(t)||0,r.length));return i<Math.max(0,Number(n)||0)?{head:``,tail:r,folded:!1}:{head:r.slice(0,i),tail:r.slice(i),folded:!0}}var AA=3,jA={name:`ChatMessage`,components:{MarkdownBody:rk,ChatToolRow:tA},props:{msg:{type:Object,required:!0},streaming:{type:Boolean,default:!1},compact:{type:Boolean,default:!1},canRollback:{type:Boolean,default:!1},nowTs:{type:Number,default:0},canRegenerate:{type:Boolean,default:!1},pickOwner:{type:Object,default:null}},emits:[`regenerate`,`approval`,`continue`,`rollback`,`open-settings`,`show-all-steps`,`locate-node`,`pick-board`],data(){return{thinkOpen:!1,narrOpen:!1,eventsOpen:null,copied:!1,elapsed:0,openGroups:Object.create(null),errorCopied:!1,_tick:0}},computed:{budgetLabel(){return{loop:`死循环熔断`,timeout:`墙钟熔断`,steps:`步数硬顶`}[this.msg.budget?.reason]||`本轮收尾`},budgetHint(){return{loop:`连续多轮同工具同参数 = 拿不到新信息。回复「继续」前最好补一句新思路(换证据链 / 指定要改的字段),否则大概率原地再转一次。`,timeout:`本轮跑到墙钟上限(AI_TURN_TIMEOUT_MS 可调)。回复「继续」会带着完整上下文从中断处接着做。`,steps:`你在设置里配了「单轮步数上限」。留空即不限步数,失控由死循环 / 墙钟熔断兜住。`}[this.msg.budget?.reason]||`上下文已保留,回复「继续」可接着做。`},attachments(){return Array.isArray(this.msg.attachments)?this.msg.attachments:[]},toolCalls(){return Array.isArray(this.msg.toolCalls)?this.msg.toolCalls:[]},msgTs(){return Number(this.msg.ts)||0},turnClock(){let e=this.msgTs,t=Number(this.msg.elapsedMs)||0,n=e&&t>0?e+t:0;if(!n)for(let e of this.toolCalls)n=Math.max(n,dk(e,this.nowTs));return{stamp:lk(e),endStamp:n>e?lk(n):``,total:n>e?ck(n-e):``}},toolGroups(){let e=[],t=[],n=()=>{if(t.length>=AA)e.push({kind:`group`,key:`g-${t[0].toolCallId||e.length}`,toolName:t[0].toolName,rows:t.slice(),ms:t.reduce((e,t)=>e+(Number(t.ms)||0),0),failed:t.filter(e=>e.error).length,clock:this.groupClock(t)});else for(let n of t)e.push({kind:`row`,key:n.toolCallId||`r-${e.length}`,tc:n});t=[]};for(let e of this.toolCalls)if(!(this.compact&&!hk(e))){if(t.length&&t[0].toolName===e.toolName){t.push(e);continue}n(),t=[e]}return n(),e},hiddenSteps(){return this.compact?this.toolCalls.filter(e=>!hk(e)).length:0},summary(){return Sk(this.toolCalls)},showSummary(){if(this.streaming)return!1;let e=this.summary;return!!(e.writes||e.writeFails||e.gate||e.validate||e.failed||this.cacheBadge)},cacheBadge(){let e=this.msg.usage;if(!e||!Number(e.promptTokens))return null;let t=Number(e.promptTokens)||0,n=Number(e.cachedTokens)||0,r=Number(e.steps)||0,i=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e);if(!e.reported)return{label:`缓存未提供`,ok:!1,title:`本回合累计输入 ${i(t)} token(${r} 步):该网关未回缓存命中字段,无法统计命中率`};let a=Number(e.hitRate)||0;return{label:`缓存命中 ${a}%`,ok:a>=50,title:`本回合累计输入 ${i(t)} token(${r} 步,命中 ${i(n)} / 未命中 ${i(t-n)}):命中量按网关的 64 token 块对齐,未命中部分多为本轮新增的工具结果与收尾提示`}},validateIssues(){let e=this.summary.validate;return e&&Array.isArray(e.issues)?e.issues:[]},validateMore(){let e=this.summary.validate;return e?Math.max(0,(e.errors||0)+(e.warnings||0)-this.validateIssues.length):0},advice(){return this.msg.error?wk(this.msg.errorCode||``):{hint:``,action:``}},errorHint(){return this.advice.hint},errorAction(){return this.advice.action},events(){return Array.isArray(this.msg.events)?this.msg.events:[]},hasErrorEvent(){return this.events.some(e=>e.level===`error`)},eventsExpanded(){return this.eventsOpen===null?this.hasErrorEvent:this.eventsOpen},eventsLabel(){let e=this.events.filter(e=>e.level!==`info`).length;return e?`过程事件 ${this.events.length} 条(${e} 条需留意)`:`过程事件 ${this.events.length} 条`},bodyText(){return UO(this.bodySplit.tail.replace(/\n*\[\s*(?:任务完成|需用户确认)\s*\]\s*$/,``).trimEnd(),nA)},bodySplit(){return kA(this.msg.content,this.msg.narrationChars)},narrationText(){return this.bodySplit.head?UO(this.bodySplit.head,nA):``},narrationSize(){return this.bodySplit.head.length.toLocaleString(`zh-CN`)},thinking(){return!!(this.streaming&&!this.msg.content&&!this.toolCalls.length)},streamingText(){return!!(this.streaming&&this.msg.content)},waiting(){return!!(this.streaming&&!this.msg.reasoning&&!this.msg.content&&!this.toolCalls.length&&!this.msg.error)},thinkLabel(){return this.thinking?`思考中… ${this.fmtClock(this.elapsedMs)}`:`已思考 ${this.fmtClock(this.msg.reasoningMs||this.elapsedMs)}`},elapsedMs(){return this.thinking?this.elapsed:this.msg.reasoningMs||this.elapsed},peek(){let e=String(this.msg.reasoning||``).split(`
305
+ `).map(e=>e.trim()).filter(Boolean),t=e[e.length-1]||``;return t.length>72?`${t.slice(0,72)}…`:t}},watch:{streaming:{immediate:!0,handler(e){e?this.startTick():this.stopTick()}},thinking(e){e||this.stopTick()}},beforeUnmount(){this.stopTick()},updated(){let e=this.$refs.thinkPre;e&&this.thinkOpen&&this.thinking&&(e.scrollTop=e.scrollHeight)},methods:{startTick(){this.stopTick(),this.elapsed=0,this._tick=setInterval(()=>{this.elapsed+=250},250)},stopTick(){this._tick&&clearInterval(this._tick),this._tick=0},fmtStamp:lk,fmtClock:ck,evOff(e){let t=Number(e&&e.ts)||0;return t>this.msgTs?uk(t-this.msgTs):``},groupClock(e){let t=dk(e[e.length-1],this.nowTs),n=t>this.msgTs?uk(t-this.msgTs):``;return[lk(e[0]&&e[0].startedAt),n].filter(Boolean).join(` · `)},fileUrl(e){return nA(e)},attSub(e){return e.exists===!1?`路径不可读`:e.isDir?`${e.entryCount??e.entries?.length??0} 项`:this.formatSize(e.size)},formatSize(e){let t=Number(e||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(1)} KB`:`${(t/1024/1024).toFixed(1)} MB`:`0 B`},toolLabel:ak,msText(e){let t=Number(e)||0;return t?t<1e3?`${t}ms`:`${(t/1e3).toFixed(1)}s`:``},groupOpen(e){let t=this.openGroups[e.key];if(t!==void 0)return t;if(e.failed)return!0;let n=e.rows[e.rows.length-1];return!!(n&&n.result===void 0&&!n.error)},toggleGroup(e){this.openGroups={...this.openGroups,[e.key]:!this.groupOpen(e)}},onApproval(e){this.$emit(`approval`,e)},async copyError(){await op(`${this.msg.errorCode?`[${this.msg.errorCode}] `:``}${String(this.msg.error||``)}`)&&(this.errorCopied=!0,setTimeout(()=>{this.errorCopied=!1},1600))},async copyText(){await op(String(this.msg.content||``))&&(this.copied=!0,setTimeout(()=>{this.copied=!1},1600))}}},MA={key:0,class:`aimsg__files`},NA=[`title`],PA=[`src`,`alt`],FA={key:1,class:`aifile__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},IA=[`href`],LA={class:`aifile__meta`},RA={class:`aifile__name`},zA={class:`aifile__sub`},BA={key:1,class:`aimsg__bubble`},VA=[`aria-expanded`],HA={key:0,class:`aithink__spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},UA={key:1,class:`aithink__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},WA={class:`aithink__label`},GA={key:2,class:`aithink__peek`},KA={class:`aithink__body`},qA={key:1,class:`aiwait`},JA=[`aria-expanded`,`onClick`],YA={class:`aitool__status`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},XA=[`href`],ZA={class:`aitool__name`},QA={class:`aitool__count`},$A={class:`aitool__args`},ej=[`title`],tj=[`title`],nj={class:`aitool__groupbody`},rj=[`aria-expanded`],ij={class:`aiev__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},aj=[`href`],oj={class:`aiev__label`},sj={class:`aiev__body`},cj={class:`aiev__time`},lj={key:0,class:`aiev__off`,title:`距本轮开始的累计耗时`},uj={class:`aiev__msg`},dj=[`aria-expanded`,`title`],fj={class:`ainarr__label`},pj={class:`ainarr__hint`},mj={class:`ainarr__body`},hj={key:6,class:`aisum`},gj={class:`aisum__head`},_j=[`title`],vj={class:`aisum__chips`},yj={key:0,class:`aisum__chip aisum__chip--ok`},bj={key:1,class:`aisum__chip aisum__chip--danger`},xj={key:2,class:`aisum__chip`},Sj={key:4,class:`aisum__chip aisum__chip--warn`},Cj=[`title`],wj={key:1,class:`aisum__issues`},Tj={class:`aisum__issue-list`},Ej={class:`aisum__issue-text`},Dj=[`title`,`onClick`],Oj={key:0,class:`aisum__issues-more`},kj={key:7,class:`aimsg__error`},Aj={class:`aimsg__error-main`},jj={class:`aimsg__error-text`},Mj={key:0,class:`aimsg__error-hint`},Nj={key:1,class:`aimsg__error-time`},Pj={key:2,class:`aimsg__error-acts`},Fj={key:8,class:`aimsg__aborted`},Ij={key:0,class:`aimsg__aborted-time`},Lj=[`title`],Rj={class:`aimsg__budget-text`},zj={key:10,class:`aimsg__acts`},Bj=[`title`],Vj={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},Hj=[`href`];function Uj(e,t,n,r,i,a){let o=L(`ChatToolRow`),s=L(`MarkdownBody`);return B(),V(`article`,{class:A([`aimsg`,[`aimsg--${n.msg.role}`,{"aimsg--live":n.streaming}]])},[K(` ===== 用户消息:附件芯片 + 文本气泡 ===== `),n.msg.role===`user`?(B(),V(z,{key:0},[a.attachments.length?(B(),V(`div`,MA,[(B(!0),V(z,null,R(a.attachments,e=>(B(),V(`div`,{key:e.path,class:A([`aifile`,{"aifile--dir":e.isDir,"aifile--missing":e.exists===!1}]),title:e.path},[e.isImage?(B(),V(`img`,{key:0,class:`aifile__thumb`,src:a.fileUrl(e.path),alt:e.name,loading:`lazy`},null,8,PA)):(B(),V(`svg`,FA,[U(`use`,{href:e.isDir?`#icon-folder-plus`:`#icon-file-text`},null,8,IA)])),U(`span`,LA,[U(`span`,RA,j(e.name),1),U(`span`,zA,j(a.attSub(e)),1)])],10,NA))),128))])):K(`v-if`,!0),n.msg.content?(B(),V(`div`,BA,j(n.msg.content),1)):K(`v-if`,!0)],64)):(B(),V(z,{key:1},[K(` ===== 助手消息:思考 → 工具 → 正文(与 Codex 同序) ===== `),K(` 思考过程:默认折叠成一行,进行中给「计时 + 最新一行」预览,结束收成「已思考 N 秒」 `),n.msg.reasoning?(B(),V(`div`,{key:0,class:A([`aithink`,{"is-open":i.thinkOpen,"is-live":a.thinking}])},[U(`button`,{type:`button`,class:`aithink__head`,"aria-expanded":i.thinkOpen?`true`:`false`,onClick:t[0]||=e=>i.thinkOpen=!i.thinkOpen},[t[17]||=U(`svg`,{class:`aithink__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),a.thinking?(B(),V(`svg`,HA,[...t[15]||=[U(`use`,{href:`#icon-loading`},null,-1)]])):(B(),V(`svg`,UA,[...t[16]||=[U(`use`,{href:`#icon-sparkles`},null,-1)]])),U(`span`,WA,j(a.thinkLabel),1),a.thinking&&!i.thinkOpen?(B(),V(`span`,GA,j(a.peek),1)):K(`v-if`,!0)],8,VA),I(U(`div`,KA,[U(`pre`,{ref:`thinkPre`},j(n.msg.reasoning),513)],512),[[Sc,i.thinkOpen]])],2)):K(`v-if`,!0),K(` 首个 token 之前的等待态 `),a.waiting?(B(),V(`div`,qA,[...t[18]||=[U(`span`,{class:`aiwait__dot`},null,-1),U(`span`,{class:`aiwait__dot`},null,-1),U(`span`,{class:`aiwait__dot`},null,-1),U(`span`,{class:`aiwait__text`},`正在思考`,-1)]])):K(`v-if`,!0),K(` 工具调用:平铺单次调用;连续同名 ≥3 次折叠成分组行(长任务里几十次 card_read 不该刷屏)。
306
+ 行标记抽到 ChatToolRow:分组内成员与平铺行走同一份模板,两处不会漂移 `),(B(!0),V(z,null,R(a.toolGroups,r=>(B(),V(z,{key:r.key},[r.kind===`row`?(B(),H(o,{key:0,tc:r.tc,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[1]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`])):(B(),V(`div`,{key:1,class:A([`aitool aitool--group`,[r.failed?`aitool--error`:`aitool--done`,{"is-open":a.groupOpen(r)}]])},[U(`button`,{type:`button`,class:`aitool__head`,"aria-expanded":a.groupOpen(r)?`true`:`false`,onClick:e=>a.toggleGroup(r)},[t[19]||=U(`svg`,{class:`aitool__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),(B(),V(`svg`,YA,[U(`use`,{href:r.failed?`#icon-alert-triangle`:`#icon-check`},null,8,XA)])),U(`span`,ZA,j(a.toolLabel(r.toolName)),1),U(`span`,QA,`×`+j(r.rows.length),1),U(`code`,$A,j(r.failed?`${r.failed} 次失败,点开看原因`:`连续 ${r.rows.length} 次,点开逐条查看`),1),K(` 分组行同样给「首次调用时刻 · 累计到最后一次」:折叠不等于把时间线也折掉 `),r.clock?(B(),V(`span`,{key:0,class:`aitool__clock`,title:`首次调用 ${r.clock.split(` · `)[0]} · 距本轮开始的累计耗时(算到最后一次)`},j(r.clock),9,ej)):K(`v-if`,!0),r.ms?(B(),V(`span`,{key:1,class:`aitool__ms`,title:`${r.rows.length} 次调用合计耗时`},j(a.msText(r.ms)),9,tj)):K(`v-if`,!0)],8,JA),I(U(`div`,nj,[(B(!0),V(z,null,R(r.rows,r=>(B(),H(o,{key:r.toolCallId,tc:r,"turn-ts":a.msgTs,"now-ts":n.nowTs,"pick-owner":n.pickOwner,onApproval:a.onApproval,onPickBoard:t[2]||=t=>e.$emit(`pick-board`,t)},null,8,[`tc`,`turn-ts`,`now-ts`,`pick-owner`,`onApproval`]))),128))],512),[[Sc,a.groupOpen(r)]])],2))],64))),128)),K(` 紧凑视图折叠掉的读取类调用:留一行出口,一键回到全量视图(不必去面板头部找开关) `),a.hiddenSteps?(B(),V(`button`,{key:2,type:`button`,class:`aitool__hidden`,onClick:t[3]||=t=>e.$emit(`show-all-steps`)},[t[20]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-eye`})],-1),U(`span`,null,`紧凑视图已折叠 `+j(a.hiddenSteps)+` 次读取类调用,点这里显示全部步骤`,1)])):K(`v-if`,!0),K(` 过程事件时间线:后端 notice / round-retry 的持久落点。横幅只留最近一条且 6 秒即逝,
307
+ 「上下文折叠过几次 / 自动续跑过几次 / 网关重试过没有」这些线索全靠这里留存 `),a.events.length?(B(),V(`div`,{key:3,class:A([`aiev`,{"is-open":a.eventsExpanded}])},[U(`button`,{type:`button`,class:`aiev__head`,"aria-expanded":a.eventsExpanded?`true`:`false`,onClick:t[4]||=e=>i.eventsOpen=!a.eventsExpanded},[t[21]||=U(`svg`,{class:`aiev__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),(B(),V(`svg`,ij,[U(`use`,{href:a.hasErrorEvent?`#icon-alert-triangle`:`#icon-activity`},null,8,aj)])),U(`span`,oj,j(a.eventsLabel),1)],8,rj),I(U(`ol`,sj,[(B(!0),V(z,null,R(a.events,(e,t)=>(B(),V(`li`,{key:t,class:A([`aiev__row`,`aiev__row--${e.level}`])},[U(`span`,cj,j(a.fmtStamp(e.ts)),1),a.evOff(e)?(B(),V(`span`,lj,j(a.evOff(e)),1)):K(`v-if`,!0),U(`span`,uj,j(e.message),1)],2))),128))],512),[[Sc,a.eventsExpanded]])],2)):K(`v-if`,!0),K(` 过程性正文:模型把推理过程当正文写出来时(实测单回合 46.7 万字),
308
+ 把「最后一次工具调用之前」那段折成一行——收尾结论照常展开,记录不再是一堵墙 `),a.narrationText?(B(),V(`div`,{key:4,class:A([`ainarr`,{"is-open":i.narrOpen}])},[U(`button`,{type:`button`,class:`ainarr__head`,"aria-expanded":i.narrOpen?`true`:`false`,title:i.narrOpen?`收起过程说明`:`展开过程说明(模型在本轮工具调用前的推理正文)`,onClick:t[5]||=e=>i.narrOpen=!i.narrOpen},[t[22]||=U(`svg`,{class:`ainarr__chev`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron-right`})],-1),t[23]||=U(`svg`,{class:`ainarr__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-activity`})],-1),U(`span`,fj,`过程说明 `+j(a.narrationSize)+` 字`,1),U(`span`,pj,j(i.narrOpen?`收起`:`展开`),1)],8,dj),I(U(`div`,mj,[W(s,{source:a.narrationText},null,8,[`source`])],512),[[Sc,i.narrOpen]])],2)):K(`v-if`,!0),K(` 正文:Markdown(流式重渲染 + 代码块高亮 / 复制) `),a.bodyText?(B(),H(s,{key:5,class:A([`aimsg__md`,{"is-streaming":a.streamingText}]),source:a.bodyText,streaming:a.streamingText},null,8,[`class`,`source`,`streaming`])):K(`v-if`,!0),K(` 本次改动摘要:写入次数 / 校验错误 / 门禁结论都从工具行就地算——落盘记录里同样算得出来,
309
+ 所以重开面板、刷新之后这条摘要依然在,而不是只在当轮可见 `),a.showSummary?(B(),V(`div`,hj,[U(`span`,gj,[t[25]||=U(`svg`,{class:`aisum__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-activity`})],-1),t[26]||=U(`span`,{class:`aisum__title`},`本次改动`,-1),K(` 本轮的时间坐标:几点开始、一共跑了多久。摘要条是回合的收尾锚点,这两个数在这里最有用 `),a.turnClock.stamp?(B(),V(`span`,{key:0,class:`aisum__clock`,title:`本轮 ${a.turnClock.stamp} 开始${a.turnClock.endStamp?`,${a.turnClock.endStamp} 收尾`:``}`},[G(j(a.turnClock.stamp)+` 开始`,1),a.turnClock.total?(B(),V(z,{key:0},[G(` · 累计 `+j(a.turnClock.total),1)],64)):K(`v-if`,!0)],8,_j)):K(`v-if`,!0),U(`span`,vj,[a.summary.writes?(B(),V(`span`,yj,`写入 `+j(a.summary.writes)+` 次`,1)):K(`v-if`,!0),a.summary.writeFails?(B(),V(`span`,bj,`写入失败 `+j(a.summary.writeFails)+` 次`,1)):K(`v-if`,!0),a.summary.shots?(B(),V(`span`,xj,`截图自检 `+j(a.summary.shots)+` 次`,1)):K(`v-if`,!0),a.summary.validate?(B(),V(`span`,{key:3,class:A([`aisum__chip`,a.summary.validate.ok?`aisum__chip--ok`:`aisum__chip--danger`])},`校验 `+j(a.summary.validate.errors)+` 错 / `+j(a.summary.validate.warnings)+` 警`,3)):K(`v-if`,!0),a.summary.failed?(B(),V(`span`,Sj,j(a.summary.failed)+` 次调用报错`,1)):K(`v-if`,!0),a.cacheBadge?(B(),V(`span`,{key:5,class:A([`aisum__chip`,a.cacheBadge.ok?`aisum__chip--ok`:``]),title:a.cacheBadge.title},j(a.cacheBadge.label),11,Cj)):K(`v-if`,!0)]),n.canRollback&&a.summary.writes?(B(),V(`button`,{key:1,type:`button`,class:`aisum__rollback`,title:`取本轮第一次写入前的历史快照,回到 AI 动手之前的版本;回滚本身可再撤销,确认后仍需点「保存到本地」才落盘`,onClick:t[6]||=t=>e.$emit(`rollback`,n.msg)},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-undo`})],-1),U(`span`,null,`回滚到本轮之前`,-1)]])):K(`v-if`,!0)]),K(` 门禁结论原样透出:这是唯一的机器判定,不能被模型自述的「已通过」覆盖 `),a.summary.gate?(B(),V(`p`,{key:0,class:A([`aisum__verdict`,a.summary.gate.passed?`is-pass`:`is-fail`])},[U(`strong`,null,`收尾门禁`+j(a.summary.gate.passed?`通过`:`未通过`),1),a.summary.gate.verdict?(B(),V(z,{key:0},[G(`:`+j(a.summary.gate.verdict),1)],64)):K(`v-if`,!0)],2)):K(`v-if`,!0),K(` 校验问题可点定位(P2-14):校验器在每条消息末尾挂了 #componentId,点「定位」就在画布与
310
+ 组件结构里选中那个节点——不用再照着一句 "at depth 1[0]" 自己去树里翻 `),a.validateIssues.length?(B(),V(`div`,wj,[t[28]||=U(`p`,{class:`aisum__issues-head`},[G(`校验问题`),U(`span`,{class:`aisum__issues-hint`},`点图标跳到该节点`)],-1),U(`ul`,Tj,[(B(!0),V(z,null,R(a.validateIssues,(n,r)=>(B(),V(`li`,{key:r,class:A([`aisum__issue`,n.level===`error`?`is-error`:`is-warn`])},[U(`span`,Ej,j(n.text),1),n.cid?(B(),V(`button`,{key:0,type:`button`,class:`aisum__issue-go`,title:`在画布与组件结构中定位 `+n.cid,"aria-label":`定位该节点`,onClick:t=>e.$emit(`locate-node`,n.cid)},[...t[27]||=[U(`svg`,{class:`aisum__issue-go-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-locate`})],-1)]],8,Dj)):K(`v-if`,!0)],2))),128))]),a.validateMore?(B(),V(`p`,Oj,`另有 `+j(a.validateMore)+` 条:展开对应工具行看全部原文`,1)):K(`v-if`,!0)])):K(`v-if`,!0)])):K(`v-if`,!0),n.msg.error?(B(),V(`div`,kj,[t[29]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,Aj,[U(`span`,jj,j(n.msg.error),1),K(` 错误分级:后端给 code,这里给「怎么办」与对应的定向动作,不再只丢一句原文让人自己猜 `),a.errorHint?(B(),V(`span`,Mj,j(a.errorHint),1)):K(`v-if`,!0),K(` 失败也要有时刻与累计:报网关工单 / 对后端日志时,「几点失败、跑了多久」是第一句要交代的话 `),a.turnClock.endStamp?(B(),V(`span`,Nj,j(a.turnClock.endStamp)+` 失败 · 本轮已用 `+j(a.turnClock.total),1)):K(`v-if`,!0),n.streaming?K(`v-if`,!0):(B(),V(`span`,Pj,[a.errorAction===`settings`?(B(),V(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[7]||=t=>e.$emit(`open-settings`)},`打开设置`)):K(`v-if`,!0),n.canRegenerate?(B(),V(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[8]||=t=>e.$emit(`regenerate`,n.msg)},`重试本轮`)):K(`v-if`,!0),n.canRegenerate?(B(),V(`button`,{key:2,type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[9]||=t=>e.$emit(`continue`)},`从中断处继续`)):K(`v-if`,!0),U(`button`,{type:`button`,class:`aimsg__budget-go aimsg__budget-go--ghost`,onClick:t[10]||=(...e)=>a.copyError&&a.copyError(...e)},j(i.errorCopied?`已复制`:`复制错误`),1)]))])])):K(`v-if`,!0),K(` 手动终止同样给续跑入口:已落盘产物与上下文都还在,点一下就能接着做。
311
+ 此前只有熔断收尾(budget)分支有按钮,手滑终止后用户只能自己打字 `),n.msg.status===`aborted`?(B(),V(`div`,Fj,[t[30]||=U(`span`,{class:`aimsg__aborted-text`},`已终止生成`,-1),a.turnClock.endStamp?(B(),V(`span`,Ij,j(a.turnClock.endStamp)+` 终止 · 已用 `+j(a.turnClock.total),1)):K(`v-if`,!0),n.canRegenerate&&!n.streaming?(B(),V(`button`,{key:1,type:`button`,class:`aimsg__budget-go`,onClick:t[11]||=t=>e.$emit(`continue`)},`从中断处继续`)):K(`v-if`,!0)])):n.msg.budget?.message?(B(),V(`div`,{key:9,class:`aimsg__budget`,title:a.budgetHint},[t[31]||=U(`svg`,{class:`aimsg__budget-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,Rj,[U(`strong`,null,j(a.budgetLabel),1),G(`:`+j(n.msg.budget.message)+`(上下文已保留)`,1)]),n.canRegenerate&&!n.streaming?(B(),V(`button`,{key:0,type:`button`,class:`aimsg__budget-go`,onClick:t[12]||=t=>e.$emit(`continue`)},`继续这轮`)):K(`v-if`,!0)],8,Lj)):K(`v-if`,!0),K(` 悬停操作:复制 / 重新生成(仅最后一条助手消息可重发) `),n.msg.content||n.msg.error?(B(),V(`footer`,zj,[U(`button`,{type:`button`,class:`aimsg__act`,title:i.copied?`已复制`:`复制回答`,onClick:t[13]||=(...e)=>a.copyText&&a.copyText(...e)},[(B(),V(`svg`,Vj,[U(`use`,{href:i.copied?`#icon-check`:`#icon-copy-sm`},null,8,Hj)])),U(`span`,null,j(i.copied?`已复制`:`复制`),1)],8,Bj),n.canRegenerate&&!n.streaming?(B(),V(`button`,{key:0,type:`button`,class:`aimsg__act`,title:`丢弃这次回答并重新生成`,onClick:t[14]||=t=>e.$emit(`regenerate`,n.msg)},[...t[32]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1),U(`span`,null,`重新生成`,-1)]])):K(`v-if`,!0)])):K(`v-if`,!0)],64))],2)}var Wj=X(jA,[[`render`,Uj],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatMessage.vue`]]),Gj=106,Kj=.5,qj=`cardbuddy:ai-composer-height`,Jj={name:`ChatComposer`,props:{busy:{type:Boolean,default:!1},model:{type:String,default:``},attachments:{type:Array,default:()=>[]},placeholder:{type:String,default:`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`},context:{type:Object,default:null}},emits:[`send`,`stop`,`pick`,`add-path`,`remove-attachment`,`drop-files`,`paste-image`,`escape`],data(){return{text:``,attachOpen:!1,pathInputOpen:!1,pathText:``,dragOver:!1,heightPx:0,resizing:!1,_outside:null,_onWinResize:null}},computed:{canSend(){return!!(this.text.trim()||this.attachments.some(e=>!e.pending&&e.exists!==!1))},compStyle(){return this.heightPx>0?{height:`${this.heightPx}px`}:null},ctx(){let e=this.context;if(!e)return null;let t=Number(e.window)>0?Number(e.window):Number(e.total)>0?Number(e.total):0,n=Math.max(0,Number(e.used)||0);if(!(t>0))return null;let r=Math.min(1,n/t),i=2*Math.PI*8;return{pct:r,arc:(i*r).toFixed(2),circ:i.toFixed(2),pctLabel:`${Math.round(r*100)}%`,level:r>=.85?`danger`:r>=.6?`warn`:`ok`,used:n,total:t}},ctxTitle(){let e=this.ctx;if(!e)return``;let t=e=>e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Math.round(e)),n=Number(this.context?.window)>0?` · 网关窗口 ${t(Number(this.context.window))}`:``;return`上下文占用 ${t(e.used)} / ${t(e.total)} token(${e.pctLabel})${n};接近上限时后端会自动折叠早期工具结果`}},mounted(){this._outside=e=>{let t=this.$refs.attachEl;t&&!t.contains(e.target)&&(this.attachOpen=!1)},document.addEventListener(`mousedown`,this._outside),this.loadHeight(),this._onWinResize=()=>this.clampHeight(),window.addEventListener(`resize`,this._onWinResize),this.autoGrow()},beforeUnmount(){this._outside&&document.removeEventListener(`mousedown`,this._outside),this._onWinResize&&window.removeEventListener(`resize`,this._onWinResize)},methods:{focus(){this.$nextTick(()=>this.$refs.taEl?.focus())},setText(e){this.text=e,this.focus(),this.autoGrow()},fileUrl(e){return nA(e)},chipSub(e){if(e.exists===!1)return`不可读`;if(e.isDir)return`${e.entryCount??e.entries?.length??0} 项`;let t=Number(e.size||0);return t?t<1024?`${t} B`:t<1048576?`${(t/1024).toFixed(0)} KB`:`${(t/1024/1024).toFixed(1)} MB`:``},autoGrow(){let e=this.$refs.taEl;if(e){if(this.heightPx>0){e.style.height=``;return}e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,168)}px`}},heightLimits(){let e=this.$el?.closest(`.aichat`)?.clientHeight||window.innerHeight;return{min:Gj,max:Math.max(Gj,Math.floor(e*Kj))}},clampHeight(){if(!this.heightPx)return;let{min:e,max:t}=this.heightLimits();this.heightPx=Math.max(e,Math.min(t,this.heightPx))},loadHeight(){try{let e=localStorage.getItem(qj),t=e==null?0:parseInt(e,10);!Number.isNaN(t)&&t>=Gj&&(this.heightPx=t)}catch{}this.clampHeight()},saveHeight(){try{this.heightPx?localStorage.setItem(qj,String(Math.round(this.heightPx))):localStorage.removeItem(qj)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`row-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=this.$el.getBoundingClientRect().bottom,i=e=>{let{min:t,max:n}=this.heightLimits();this.heightPx=Math.max(t,Math.min(n,Math.round(r-e.clientY)))},a=()=>{t.removeEventListener(`pointermove`,i),t.removeEventListener(`pointerup`,a),t.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveHeight()};t.addEventListener(`pointermove`,i),t.addEventListener(`pointerup`,a),t.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},resetHeight(){this.heightPx=0,this.saveHeight(),this.$nextTick(this.autoGrow)},onKeydown(e){if(e.key===`Escape`){e.preventDefault(),this.$emit(`escape`);return}e.key===`Enter`&&(e.isComposing||e.keyCode===229||e.shiftKey||(e.preventDefault(),this.busy||this.submit()))},submit(){if(this.busy||!this.canSend)return;let e={text:this.text.trim(),attachments:this.attachments.filter(e=>!e.pending&&e.exists!==!1)};this.text=``,this.attachOpen=!1,this.$nextTick(this.autoGrow),this.$emit(`send`,e)},toggleAttach(){this.attachOpen=!this.attachOpen},pick(e){this.attachOpen=!1,this.$emit(`pick`,e)},openPathInput(){this.attachOpen=!1,this.pathInputOpen=!0,this.pathText=``,this.$nextTick(()=>this.$refs.pathEl?.focus())},closePathInput(){this.pathInputOpen=!1,this.pathText=``},confirmPath(){let e=this.pathText.trim();e&&(this.$emit(`add-path`,e),this.closePathInput())},onDragEnter(){this.dragOver=!0},onDragOver(){this.dragOver=!0},onDragLeave(){this.dragOver=!1},onDrop(e){this.dragOver=!1;let t=e.dataTransfer;t&&this.$emit(`drop-files`,t)},async onPaste(e){let t=e.clipboardData?.items;if(t){for(let n of t)if(n.type&&n.type.indexOf(`image/`)===0){let t=n.getAsFile();if(!t)continue;e.preventDefault();let r=await new Promise(e=>{let n=new FileReader;n.onload=()=>e(String(n.result||``)),n.onerror=()=>e(``),n.readAsDataURL(t)});r&&this.$emit(`paste-image`,r);return}}}}},Yj={key:0,class:`aicomp__files`},Xj=[`title`],Zj=[`src`,`alt`],Qj={key:1,class:`aichip__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},$j=[`href`],eM={class:`aichip__name`},tM={key:2,class:`aichip__sub`},nM=[`onClick`],rM={key:1,class:`aicomp__path`},iM=[`disabled`],aM=[`placeholder`],oM={class:`aicomp__bar`},sM={class:`aicomp__tools`},cM={class:`aicomp__attach`,ref:`attachEl`},lM={key:0,class:`aicomp__menu`,role:`menu`},uM={class:`aicomp__right`},dM=[`title`],fM={class:`aicomp__ctx-ring`,viewBox:`0 0 20 20`,"aria-hidden":`true`},pM=[`stroke-dasharray`],mM={class:`aicomp__ctx-pct`},hM=[`title`],gM=[`disabled`,`title`];function _M(e,t,n,r,i,a){return B(),V(`div`,{class:A([`aicomp`,{"is-busy":n.busy,"is-drag":i.dragOver,"is-manual":i.heightPx>0,"is-resizing":i.resizing}]),style:k(a.compStyle)},[K(` 上缘拖拽把手:调输入区高度(106px ~ 面板高度 50%,双击恢复自适应),与面板宽度把手同一套交互 `),U(`div`,{class:A([`aicomp__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整输入区高度(双击恢复自适应)`,onPointerdown:t[0]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=q((...e)=>a.resetHeight&&a.resetHeight(...e),[`prevent`])},null,34),K(` 已挂载的本地文件:只预览 + 传路径,不上传 `),n.attachments.length?(B(),V(`div`,Yj,[(B(!0),V(z,null,R(n.attachments,n=>(B(),V(`div`,{key:n.id||n.path,class:A([`aichip`,{"aichip--dir":n.isDir,"aichip--pending":n.pending,"aichip--missing":n.exists===!1}]),title:n.path},[n.isImage&&!n.pending?(B(),V(`img`,{key:0,class:`aichip__thumb`,src:a.fileUrl(n.path),alt:n.name,loading:`lazy`},null,8,Zj)):(B(),V(`svg`,Qj,[U(`use`,{href:n.pending?`#icon-loading`:n.isDir?`#icon-folder-plus`:n.isImage?`#icon-image`:`#icon-file-text`},null,8,$j)])),U(`span`,eM,j(n.pending?`解析路径中…`:n.name),1),n.pending?K(`v-if`,!0):(B(),V(`span`,tM,j(a.chipSub(n)),1)),U(`button`,{type:`button`,class:`aichip__rm`,title:`移除`,onClick:t=>e.$emit(`remove-attachment`,n.id||n.path)},[...t[22]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]],8,nM)],10,Xj))),128))])):K(`v-if`,!0),K(` 粘贴绝对路径(非 macOS / 拖拽反查失败时的兜底入口) `),i.pathInputOpen?(B(),V(`div`,rM,[I(U(`input`,{ref:`pathEl`,"onUpdate:modelValue":t[2]||=e=>i.pathText=e,class:`aicomp__path-input`,type:`text`,placeholder:`粘贴本地图片或文件夹的绝对路径,回车确认`,spellcheck:`false`,onKeydown:[t[3]||=vl(q((...e)=>a.confirmPath&&a.confirmPath(...e),[`prevent`]),[`enter`]),t[4]||=vl(q((...e)=>a.closePathInput&&a.closePathInput(...e),[`stop`,`prevent`]),[`esc`])]},null,544),[[il,i.pathText]]),U(`button`,{type:`button`,class:`aicomp__path-ok`,disabled:!i.pathText.trim(),onClick:t[5]||=(...e)=>a.confirmPath&&a.confirmPath(...e)},`添加`,8,iM),U(`button`,{type:`button`,class:`aicomp__path-no`,onClick:t[6]||=(...e)=>a.closePathInput&&a.closePathInput(...e)},`取消`)])):K(`v-if`,!0),U(`div`,{class:`aicomp__box`,onDragenter:t[18]||=q((...e)=>a.onDragEnter&&a.onDragEnter(...e),[`prevent`]),onDragover:t[19]||=q((...e)=>a.onDragOver&&a.onDragOver(...e),[`prevent`]),onDragleave:t[20]||=q((...e)=>a.onDragLeave&&a.onDragLeave(...e),[`prevent`]),onDrop:t[21]||=q((...e)=>a.onDrop&&a.onDrop(...e),[`prevent`])},[I(U(`textarea`,{ref:`taEl`,"onUpdate:modelValue":t[7]||=e=>i.text=e,class:`aicomp__ta`,placeholder:n.placeholder,rows:`1`,onInput:t[8]||=(...e)=>a.autoGrow&&a.autoGrow(...e),onKeydown:t[9]||=(...e)=>a.onKeydown&&a.onKeydown(...e),onPaste:t[10]||=(...e)=>a.onPaste&&a.onPaste(...e)},null,40,aM),[[il,i.text]]),U(`div`,oM,[U(`div`,sM,[U(`div`,cM,[U(`button`,{type:`button`,class:A([`aicomp__iconbtn`,{"is-open":i.attachOpen}]),title:`挂载本地图片 / 文件 / 文件夹`,onClick:t[11]||=(...e)=>a.toggleAttach&&a.toggleAttach(...e)},[...t[23]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-paperclip`})],-1)]],2),i.attachOpen?(B(),V(`div`,lM,[U(`button`,{type:`button`,role:`menuitem`,onClick:t[12]||=e=>a.pick(`image`)},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-image`})],-1),G(` 本地图片… `,-1)]]),U(`button`,{type:`button`,role:`menuitem`,onClick:t[13]||=e=>a.pick(`file`)},[...t[25]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-file-text`})],-1),G(` 本地文件… `,-1)]]),U(`button`,{type:`button`,role:`menuitem`,onClick:t[14]||=e=>a.pick(`folder`)},[...t[26]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-folder-plus`})],-1),G(` 本地文件夹… `,-1)]]),t[28]||=U(`div`,{class:`aicomp__menu-sep`},null,-1),U(`button`,{type:`button`,role:`menuitem`,onClick:t[15]||=(...e)=>a.openPathInput&&a.openPathInput(...e)},[...t[27]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-link`})],-1),G(` 粘贴路径… `,-1)]])])):K(`v-if`,!0)],512),t[29]||=U(`span`,{class:`aicomp__hint`},`拖拽文件 / 文件夹到此,或直接 ⌘V 粘贴截图`,-1)]),U(`div`,uM,[a.ctx?(B(),V(`span`,{key:0,class:A([`aicomp__ctx`,`is-${a.ctx.level}`]),title:a.ctxTitle},[(B(),V(`svg`,fM,[t[30]||=U(`circle`,{class:`aicomp__ctx-track`,cx:`10`,cy:`10`,r:`8`},null,-1),U(`circle`,{class:`aicomp__ctx-arc`,cx:`10`,cy:`10`,r:`8`,"stroke-dasharray":`${a.ctx.arc} ${a.ctx.circ}`,transform:`rotate(-90 10 10)`},null,8,pM)])),U(`span`,mM,j(a.ctx.pctLabel),1)],10,dM)):K(`v-if`,!0),n.model?(B(),V(`span`,{key:1,class:`aicomp__model`,title:`当前模型:${n.model}`},j(n.model),9,hM)):K(`v-if`,!0),n.busy?(B(),V(`button`,{key:2,type:`button`,class:`aicomp__send aicomp__send--stop`,title:`终止生成(Esc)`,onClick:t[16]||=t=>e.$emit(`stop`)},[...t[31]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"aria-hidden":`true`},[U(`use`,{href:`#icon-stop`})],-1)]])):(B(),V(`button`,{key:3,type:`button`,class:`aicomp__send`,disabled:!a.canSend,title:a.canSend?`发送(Enter)`:`输入内容后发送`,onClick:t[17]||=(...e)=>a.submit&&a.submit(...e)},[...t[32]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-send`})],-1)]],8,gM))])])],32)],6)}var vM=X(Jj,[[`render`,_M],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatComposer.vue`]]),yM={name:`AiSettings`,components:{NumberStepper:c_,Switch:Xw},props:{config:{type:Object,default:()=>({baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``})},modelId:{type:String,default:null},initialModel:{type:Object,default:null}},emits:[`close`,`saved`],data(){let e=this.modelId&&this.initialModel||{};return{form:{name:e.name||``,baseUrl:e.baseUrl||``,model:e.model||``,apiKey:``,thinking:e.thinking!==!1,vision:e.vision===!0,maxTokens:e.maxTokensAuto?0:Number(e.maxTokens)>0?Number(e.maxTokens):0},reveal:!1,saving:!1,testing:!1,probing:!1,ping:null,help:null,keyLoaded:!1,submitted:!1,touched:{}}},computed:{title(){return this.modelId?`编辑模型`:`添加模型`},errors(){let e={},t=this.form.baseUrl.trim(),n=this.form.model.trim();return t?/^https?:\/\/[^\s]+$/i.test(t)||(e.baseUrl=`Base URL 需以 http:// 或 https:// 开头`):e.baseUrl=`请填写 Base URL`,n||(e.model=`请填写模型名`),!this.keyLoaded&&!this.form.apiKey.trim()&&(e.apiKey=`请填写 API Key`),e},isValid(){return Object.keys(this.errors).length===0},knownCapLimit(){return(Number(this.config.maxTokensCap)>0?Number(this.config.maxTokensCap):0)||(Number(this.config.maxTokensWindow)>0?Number(this.config.maxTokensWindow):0)},maxTokensOver(){return this.knownCapLimit>0&&this.form.maxTokens>this.knownCapLimit},maxTokensPlaceholder(){let e=Number(this.config.maxTokens)>0?Number(this.config.maxTokens):0;return e>0?`留空 = 自动(当前按 ${e})`:`留空 = 自动`},keyPlaceholder(){return this.keyLoaded?this.form.apiKey?``:`已保存的密钥为空,请填写新密钥`:this.config.hasKey?`已保存(${this.config.apiKeyMasked||`••••`}),回显失败:留空沿用、填写覆盖`:`sk-…`}},created(){this.loadKey()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},showError(e){return!!this.errors[e]&&(this.submitted||this.touched[e])},markTouched(e){this.$set(this.touched,e,!0)},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onMaxTokens(e){let t=Number(String(e).trim());this.form.maxTokens=Number.isFinite(t)&&t>=0?Math.round(t):0},async probe(){let e=[];if(this.form.baseUrl.trim()||e.push(`Base URL`),this.form.apiKey.trim()||e.push(`API Key`),this.form.model.trim()||e.push(`模型名`),e.length){this.ping={ok:!1,text:`探测前请先填写:${e.join(` / `)}`};return}this.probing=!0,this.ping=null;try{let e=await pA({baseUrl:this.form.baseUrl,apiKey:this.form.apiKey,model:this.form.model}),t=Number(e.window)>0?Number(e.window):0,n=Number(e.cap)>0?Number(e.cap):0;if(n>0){this.form.maxTokens=n;let r=e.source===`models-meta`?`模型元数据`:e.source===`probe`?`二分试探`:e.source===`halved`?`减半回写`:e.source||`探测`,i=[`接受单次输出上限 ${n}`];t>0&&i.push(`上下文窗口 ${t}`),this.ping={ok:!0,text:`网关${i.join(`、`)}(来源:${r})→ 已填入 ${n};留空则走自动(取 min(上限, ${Number(e.ceiling)>0?e.ceiling:32768}) = ${Number(e.autoMax)>0?e.autoMax:n})`}}else{let n=[];t>0&&n.push(`上下文窗口 ${t}`),e.source===`fallback`?n.push(`网关未接受任何档位(可能是地址 / 密钥 / 模型名有误,或该网关不暴露上限)`):n.push(`未探到网关接受的单次输出上限`),this.ping={ok:!1,text:`${n.join(`;`)}。建议留空走自动:后端按默认值开跑,被网关拒绝时自动减半并记下真实上限`}}}catch(e){this.ping={ok:!1,text:`探测失败:${e.message||e}`}}finally{this.probing=!1}},async loadKey(){if(this.modelId)try{let e=await cA(this.modelId,!0),t=typeof e.apiKey==`string`?e.apiKey:``;t&&(this.form.apiKey=t,this.keyLoaded=!0),typeof e.name==`string`&&(this.form.name=e.name),typeof e.baseUrl==`string`&&(this.form.baseUrl=e.baseUrl),typeof e.model==`string`&&(this.form.model=e.model),this.form.maxTokens=e.maxTokensAuto||!(Number(e.maxTokens)>0)?0:Number(e.maxTokens),e.thinking!==void 0&&(this.form.thinking=e.thinking!==!1),e.vision!==void 0&&(this.form.vision=e.vision===!0)}catch{}},payload(){let e={name:this.form.name.trim(),baseUrl:this.form.baseUrl.trim(),model:this.form.model.trim(),thinking:!!this.form.thinking,vision:!!this.form.vision,maxTokens:Number(this.form.maxTokens)>0?Number(this.form.maxTokens):0};return(this.keyLoaded||this.form.apiKey.trim())&&(e.apiKey=this.form.apiKey.trim()),e},async test(){if(!this.isValid){this.submitted=!0,this.help=null,this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)再测试连接`};return}this.testing=!0,this.ping=null;try{let e=await mA(this.payload());this.ping=e.ok?{ok:!0,text:`连接正常 · ${e.model||this.form.model} · ${e.latencyMs}ms`}:{ok:!1,text:`连接失败${e.status?`(HTTP ${e.status})`:``}:${e.message||`未知错误`}`}}catch(e){this.ping={ok:!1,text:`测试失败:${e.message||e}`}}finally{this.testing=!1}},async save(){if(this.submitted=!0,!this.isValid){this.help=null;let e={baseUrl:`aiset-baseurl`,model:`aiset-model`,apiKey:`aiset-key`},t=Object.keys(this.errors)[0],n=t?this.$el.querySelector(`#${e[t]}`):null;n&&typeof n.focus==`function`&&n.focus(),this.ping={ok:!1,text:`请先补全必填项(Base URL / 模型名 / API Key)`};return}this.saving=!0;try{let e=this.modelId?await uA(this.modelId,this.payload()):await lA(this.payload());this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}},bM={class:`aiset__mask`},xM={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 模型设置`},SM={class:`aiset__head`},CM={class:`aiset__title`},wM={class:`aiset__body`},TM={class:`aiset__field`},EM={class:`aiset__field`},DM={class:`aiset__labelrow`},OM=[`aria-expanded`],kM=[`aria-invalid`],AM={key:0,class:`aiset__errline`},jM={key:1,class:`aiset__pop`},MM={class:`aiset__field`},NM={class:`aiset__labelrow`},PM=[`aria-expanded`],FM=[`aria-invalid`],IM={key:0,class:`aiset__errline`},LM={key:1,class:`aiset__pop`},RM={class:`aiset__field`},zM={class:`aiset__labelrow`},BM=[`aria-expanded`],VM={class:`aiset__keywrap`},HM=[`type`,`placeholder`,`aria-invalid`],UM=[`title`,`aria-pressed`],WM={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},GM=[`href`],KM={key:0,class:`aiset__errline`},qM={key:1,class:`aiset__pop`},JM={class:`aiset__field`},YM={class:`aiset__labelrow`},XM=[`aria-expanded`],ZM={class:`aiset__stepperrow`},QM=[`disabled`],$M={key:0,class:`aiset__warnline`},eN={key:1,class:`aiset__pop`},tN={class:`aiset__field`},nN={class:`aiset__labelrow`},rN=[`aria-expanded`],iN={key:0,class:`aiset__pop`},aN={class:`aiset__field`},oN={class:`aiset__labelrow`},sN=[`aria-expanded`],cN={key:0,class:`aiset__pop`},lN={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},uN=[`href`],dN={class:`aiset__foot`},fN=[`disabled`],pN={class:`aiset__btn-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},mN=[`href`],hN=[`disabled`],gN=[`disabled`];function _N(e,t,n,r,i,a){let o=L(`NumberStepper`),s=L(`Switch`);return B(),V(`div`,bM,[U(`section`,xM,[U(`header`,SM,[t[22]||=U(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[U(`use`,{href:`#icon-model`})],-1),U(`span`,CM,j(a.title),1),U(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[21]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),K(` 字段说明一律收进「?」浮层:面板只留标签 + 控件,需要时点开看详情 `),U(`div`,wM,[U(`div`,TM,[t[23]||=U(`div`,{class:`aiset__labelrow`},[U(`label`,{class:`aiset__label`,for:`aiset-name`},`名称`)],-1),I(U(`input`,{id:`aiset-name`,"onUpdate:modelValue":t[1]||=e=>i.form.name=e,class:`aiset__input`,type:`text`,placeholder:`模型显示名(如 GPT-4o / 我的 GLM)`,spellcheck:`false`,autocomplete:`off`},null,512),[[il,i.form.name]])]),U(`div`,EM,[U(`div`,DM,[t[25]||=U(`label`,{class:`aiset__label`,for:`aiset-baseurl`},[G(`Base URL`),U(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`baseUrl`}]),"aria-expanded":i.help===`baseUrl`,title:`查看说明`,onClick:t[2]||=q(e=>a.toggleHelp(`baseUrl`),[`stop`])},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,OM)]),I(U(`input`,{id:`aiset-baseurl`,"onUpdate:modelValue":t[3]||=e=>i.form.baseUrl=e,class:A([`aiset__input`,{"is-invalid":a.showError(`baseUrl`)}]),type:`text`,placeholder:`https://api.example.com/v1`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`baseUrl`)?`true`:`false`,onBlur:t[4]||=e=>a.markTouched(`baseUrl`)},null,42,kM),[[il,i.form.baseUrl]]),a.showError(`baseUrl`)?(B(),V(`p`,AM,j(a.errors.baseUrl),1)):K(`v-if`,!0),i.help===`baseUrl`?(B(),V(`p`,jM,[...t[26]||=[G(`OpenAI 兼容网关的基址,`,-1),U(`strong`,null,`不含`,-1),G(),U(`code`,null,`/chat/completions`,-1),G(` 后缀(后端会自己拼)。例:`,-1),U(`code`,null,`https://api.openai.com/v1`,-1),G(`。`,-1)]])):K(`v-if`,!0)]),U(`div`,MM,[U(`div`,NM,[t[28]||=U(`label`,{class:`aiset__label`,for:`aiset-model`},[G(`模型名`),U(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`model`}]),"aria-expanded":i.help===`model`,title:`查看说明`,onClick:t[5]||=q(e=>a.toggleHelp(`model`),[`stop`])},[...t[27]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,PM)]),I(U(`input`,{id:`aiset-model`,"onUpdate:modelValue":t[6]||=e=>i.form.model=e,class:A([`aiset__input`,{"is-invalid":a.showError(`model`)}]),type:`text`,placeholder:`gpt-4o / GLM-4.6 / deepseek-chat`,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`model`)?`true`:`false`,onBlur:t[7]||=e=>a.markTouched(`model`)},null,42,FM),[[il,i.form.model]]),a.showError(`model`)?(B(),V(`p`,IM,j(a.errors.model),1)):K(`v-if`,!0),i.help===`model`?(B(),V(`p`,LM,`必须与网关侧的模型标识完全一致。建卡这类多步工具调用建议用支持 function calling 的模型。`)):K(`v-if`,!0)]),U(`div`,RM,[U(`div`,zM,[t[30]||=U(`label`,{class:`aiset__label`,for:`aiset-key`},[G(`API Key`),U(`i`,{class:`aiset__req`,"aria-hidden":`true`},`*`)],-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`apiKey`}]),"aria-expanded":i.help===`apiKey`,title:`查看说明`,onClick:t[8]||=q(e=>a.toggleHelp(`apiKey`),[`stop`])},[...t[29]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,BM)]),U(`div`,VM,[I(U(`input`,{id:`aiset-key`,"onUpdate:modelValue":t[9]||=e=>i.form.apiKey=e,class:A([`aiset__input aiset__input--key`,{"is-invalid":a.showError(`apiKey`)}]),type:i.reveal?`text`:`password`,placeholder:a.keyPlaceholder,spellcheck:`false`,autocomplete:`off`,"aria-invalid":a.showError(`apiKey`)?`true`:`false`,onBlur:t[10]||=e=>a.markTouched(`apiKey`)},null,42,HM),[[fl,i.form.apiKey]]),U(`button`,{type:`button`,class:`aiset__eye`,title:i.reveal?`掩码显示密钥`:`明文显示密钥`,"aria-pressed":i.reveal,onClick:t[11]||=e=>i.reveal=!i.reveal},[(B(),V(`svg`,WM,[U(`use`,{href:i.reveal?`#icon-eye-off`:`#icon-eye`},null,8,GM)]))],8,UM)]),a.showError(`apiKey`)?(B(),V(`p`,KM,j(a.errors.apiKey),1)):K(`v-if`,!0),i.help===`apiKey`?(B(),V(`p`,qM,[...t[31]||=[G(` 密钥保存在项目根 `,-1),U(`code`,null,`.env.cb.local`,-1),G(`(个人覆盖层,已被 .gitignore 忽略,不会进版本库)。 打开面板自动回填已保存的密钥(默认掩码),点输入框尾部小眼睛切换明文;`,-1),U(`strong`,null,`清空后保存即删除`,-1),G(`已保存的密钥。 `,-1)]])):K(`v-if`,!0)]),U(`div`,JM,[U(`div`,YM,[t[33]||=U(`label`,{class:`aiset__label`},`单次输出上限`,-1),t[34]||=U(`span`,{class:`aiset__unit`},`max_tokens`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`maxTokens`}]),"aria-expanded":i.help===`maxTokens`,title:`查看说明`,onClick:t[12]||=q(e=>a.toggleHelp(`maxTokens`),[`stop`])},[...t[32]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,XM)]),U(`div`,ZM,[W(o,{id:`aiset-maxtok`,class:`aiset__stepper`,value:i.form.maxTokens>0?String(i.form.maxTokens):``,step:1024,min:0,max:262144,placeholder:a.maxTokensPlaceholder,onInput:a.onMaxTokens},null,8,[`value`,`placeholder`,`onInput`]),U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.probing||i.saving||i.testing,onClick:t[13]||=(...e)=>a.probe&&a.probe(...e)},j(i.probing?`探测中…`:`探测`),9,QM)]),a.maxTokensOver?(B(),V(`p`,$M,` 超过网关已知上限 `+j(a.knownCapLimit)+`:对话时会主动夹取到该值,建议留空走自动 `,1)):K(`v-if`,!0),i.help===`maxTokens`?(B(),V(`p`,eN,[t[35]||=U(`strong`,null,`普通用户不用管这一项:留空 = 自动`,-1),t[36]||=G(`。后端自己协商:先读网关 `,-1),t[37]||=U(`code`,null,`/v1/models`,-1),t[38]||=G(` 的上下文窗口(免费、毫秒级,最多等 2 秒,超时先用默认 24576 开跑), 拿到后取 `,-1),t[39]||=U(`code`,null,`min(窗口, 32768)`,-1),t[40]||=G(` 当作单次输出上限(输出预算 ≠ 上下文窗口,建卡一轮 32k 足够)。 读不到元数据也不会偷偷发试探请求;想知道窗口多大就点「探测」做一次二分试探(会产生一次真实补全,约十几秒)。 手填值超过网关接受上限时,对话开跑前会主动夹取并说明;真被 400 拒绝才会自动减半重试, 减半成功的值记为「接受上限」(**不是窗口**:窗口与输出上限是两回事,有网关窗口 262144 但 max_tokens 硬上限 131072)。 只有某轮明确报「被单次输出上限截断」才需要手填更大值。注意:推理模型的思考过程也算进这个上限。 `,-1),t[41]||=U(`br`,null,null,-1),t[42]||=U(`strong`,null,[G(`注意:`),U(`code`,null,`32768`),G(` 是自动模式的「封顶假设值」,不是网关能力上限。`)],-1),t[43]||=G(` 真实上限只能实测得到,请以「接受的单次输出上限」为准(如 qwen-max 实测仅 8192)。 `,-1),t[44]||=U(`br`,null,null,-1),t[45]||=G(`当前自动生效值:`,-1),U(`strong`,null,j(n.config.maxTokens>0?n.config.maxTokens:24576),1),G(`; 网关上下文窗口:`+j(n.config.maxTokensWindow>0?n.config.maxTokensWindow:`未拿到(网关可能不提供元数据)`)+`; 接受的单次输出上限:`+j(n.config.maxTokensCap>0?n.config.maxTokensCap:`未知(点「探测」,或撞过一次 400 后自动回写)`)+`。 `,1)])):K(`v-if`,!0)]),U(`div`,tN,[K(` 仅「勾选框 + 标题」包进 label:点说明 / 问号不应误触开关 `),U(`div`,nN,[t[47]||=U(`span`,{class:`aiset__label`},`深度思考`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`thinking`}]),"aria-expanded":i.help===`thinking`,title:`查看说明`,onClick:t[14]||=q(e=>a.toggleHelp(`thinking`),[`stop`])},[...t[46]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,rN),W(s,{modelValue:i.form.thinking,"onUpdate:modelValue":t[15]||=e=>i.form.thinking=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`thinking`?(B(),V(`p`,iN,[...t[48]||=[G(` 开启:模型先长篇推理再动手,规划更稳但慢很多、更费 token。关闭:直接出结果,实测同一网关快数倍。 关闭依赖网关支持 `,-1),U(`code`,null,`chat_template_kwargs.enable_thinking`,-1),G(`(vLLM / SGLang 系);网关不认时后端会自动回退成带思考并在对话里提示一次。 另外,`,-1),U(`strong`,null,`某一轮思考超时`,-1),G(`时后端会自动只在那一轮关闭深度思考并重试,逼出结果。 `,-1)]])):K(`v-if`,!0)]),U(`div`,aN,[U(`div`,oN,[t[50]||=U(`span`,{class:`aiset__label`},`多模态视觉`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`vision`}]),"aria-expanded":i.help===`vision`,title:`查看说明`,onClick:t[16]||=q(e=>a.toggleHelp(`vision`),[`stop`])},[...t[49]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,sN),W(s,{modelValue:i.form.vision,"onUpdate:modelValue":t[17]||=e=>i.form.vision=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`vision`?(B(),V(`p`,cN,[...t[51]||=[G(` 开启后首轮对话会`,-1),U(`strong`,null,`自动探测`,-1),G(`网关是否真支持图像(比较带图 / 不带图的 prompt_tokens):支持则把渲染截图、设计稿 vs 渲染并排对比图、你挂载的图片注入上下文,AI 可直接读图找差异; 不支持会自动降级为数值闭环(pixelDiff.match)并在对话里提示一次。注入前降采样到长边 ≤ 1024px / ≤ 900KB,每轮最多 2 张;对话记录落盘不含图像。 `,-1)]])):K(`v-if`,!0)]),i.ping?(B(),V(`div`,{key:0,class:A([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(B(),V(`svg`,lN,[U(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,uN)])),U(`span`,null,j(i.ping.text),1)],2)):K(`v-if`,!0)]),U(`footer`,dN,[U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.testing||i.saving,onClick:t[18]||=(...e)=>a.test&&a.test(...e)},[(B(),V(`svg`,pN,[U(`use`,{href:i.testing?`#icon-loading`:`#icon-activity`},null,8,mN)])),U(`span`,null,j(i.testing?`测试中…`:`测试连接`),1)],8,fN),t[52]||=U(`span`,{class:`aiset__foot-gap`},null,-1),U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[19]||=t=>e.$emit(`close`)},`取消`,8,hN),U(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving||i.testing,onClick:t[20]||=(...e)=>a.save&&a.save(...e)},j(i.saving?`保存中…`:`保存`),9,gN)])])])}var vN=X(yM,[[`render`,_N],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AiSettings.vue`]]),yN={name:`ModelList`,props:{models:{type:Array,default:()=>[]},activeId:{type:String,default:null},turnRunning:{type:Boolean,default:!1}},emits:[`add`,`edit`,`delete`,`activate`,`close`,`open-common`,`import-ccswitch`],methods:{locked(e){return!!(this.turnRunning&&e&&e.id===this.activeId)},hostOf(e){let t=String(e||``).trim();if(!t)return`未填地址`;try{return new URL(t).host}catch{return t.replace(/^https?:\/\//,``).replace(/\/+$/,``)||t}}}},bN={class:`aiset__mask`},xN={class:`aiset modellist`,role:`dialog`,"aria-modal":`true`,"aria-label":`模型选择`},SN={class:`aiset__head`},CN={class:`aiset__body ml__body`},wN={class:`ml__toolbar`},TN={key:0,class:`ml__lock`,role:`status`},EN={key:1,class:`empty-state`},DN={class:`ml__list`},ON=[`aria-disabled`,`onClick`],kN={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},AN={class:`ml__info`},jN={class:`ml__name`},MN={class:`ml__meta`},NN={class:`ml__model`},PN={class:`ml__host`},FN={key:0,class:`ml__key`,title:`已配置密钥`},IN={key:1,class:`ml__key ml__key--off`,title:`未配置密钥`},LN={key:2,class:`ml__key ml__key--lock`,title:`对话进行中,正在使用的模型已锁定`},RN={class:`ml__actions`},zN=[`disabled`,`title`,`onClick`],BN=[`disabled`,`title`,`onClick`],VN={class:`ml__foot`},HN={class:`ml__hint`};function UN(e,t,n,r,i,a){return B(),V(`div`,bN,[U(`section`,xN,[U(`header`,SN,[t[5]||=U(`svg`,{class:`aiset__head-icon is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[U(`use`,{href:`#icon-model`})],-1),t[6]||=U(`span`,{class:`aiset__title`},`模型`,-1),U(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[4]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,CN,[K(` 操作工具条:添加模型 / 从 cc-switch 导入,靠右对齐 `),U(`div`,wN,[U(`button`,{type:`button`,class:`ml__import`,title:`从 cc-switch 导入`,onClick:t[1]||=t=>e.$emit(`import-ccswitch`)},[...t[7]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-download`})],-1),U(`span`,null,`导入`,-1)]]),U(`button`,{type:`button`,class:`ml__add`,title:`添加模型`,onClick:t[2]||=t=>e.$emit(`add`)},[...t[8]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-plus`})],-1),U(`span`,null,`添加模型`,-1)]])]),K(` 对话进行中:正在使用的模型被锁,说明原因与解除方式,避免用户反复点却没反应 `),n.turnRunning?(B(),V(`div`,TN,[...t[9]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),U(`span`,null,`有对话正在进行:正在使用的模型已锁定,本轮结束后可切换或修改。其他模型仍可编辑。`,-1)]])):K(`v-if`,!0),K(` 空状态:与其他面板占位(图标 + 文字)同一语言 `),n.models.length?(B(),V(z,{key:2},[K(` 模型列表:参考 cc-switch 的 provider 列表——每条可编辑 / 删除,当前生效项高亮 `),U(`ul`,DN,[(B(!0),V(z,null,R(n.models,r=>(B(),V(`li`,{key:r.id,class:A([`ml__item`,{"is-active":r.id===n.activeId,"is-locked":a.locked(r)}]),"aria-disabled":a.locked(r)?`true`:`false`,onClick:t=>e.$emit(`activate`,r)},[U(`span`,{class:A([`ml__check`,{"is-on":r.id===n.activeId}]),"aria-hidden":`true`},[r.id===n.activeId?(B(),V(`svg`,kN,[...t[11]||=[U(`use`,{href:`#icon-check`},null,-1)]])):K(`v-if`,!0)],2),U(`span`,AN,[U(`span`,jN,j(r.name||r.model||`未命名模型`),1),U(`span`,MN,[U(`span`,NN,j(r.model||`未填模型名`),1),t[12]||=U(`span`,{class:`ml__dot`},`·`,-1),U(`span`,PN,j(a.hostOf(r.baseUrl)),1),r.hasKey?(B(),V(`span`,FN,`已配密钥`)):(B(),V(`span`,IN,`无密钥`)),a.locked(r)?(B(),V(`span`,LN,`运行中 · 锁定`)):K(`v-if`,!0)])]),U(`span`,RN,[U(`button`,{type:`button`,class:`ml__btn`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可编辑`:`编辑`,onClick:q(t=>e.$emit(`edit`,r),[`stop`])},[...t[13]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-edit`})],-1)]],8,zN),U(`button`,{type:`button`,class:`ml__btn ml__btn--danger`,disabled:a.locked(r),title:a.locked(r)?`对话进行中,正在使用的模型不可删除`:`删除`,onClick:q(t=>e.$emit(`delete`,r),[`stop`])},[...t[14]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],8,BN)])],10,ON))),128))])],2112)):(B(),V(`div`,EN,[...t[10]||=[as(`<span class="empty-state__badge" aria-hidden="true"><svg class="is-solid-icon" viewBox="0 0 1024 1024"><use href="#icon-model"></use></svg></span><p class="debug__empty">还没有模型</p><p class="empty-state__hint">点上方「添加模型」配置第一个 AI 模型(Base URL / API Key / 模型名),或「导入」从 cc-switch 拉取已有的 Codex 供应商。配置保存在项目根 .env.cb.local,不进版本库。</p>`,3)]]))]),U(`footer`,VN,[U(`span`,HN,j(n.turnRunning?`对话进行中:正在使用的模型已锁定,无法切换`:`点击任意模型即可切换为当前生效模型`),1),U(`button`,{type:`button`,class:`ml__common`,title:`通用设置(执行策略 / 环境参数,所有模型共享)`,onClick:t[3]||=t=>e.$emit(`open-common`)},[...t[15]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-settings`})],-1),U(`span`,null,`通用设置`,-1)]])])])])}var WN=X(yN,[[`render`,UN],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ModelList.vue`]]),GN=6e4,KN={name:`AiCommonSettings`,components:{NumberStepper:c_,Switch:Xw},emits:[`close`,`saved`],data(){return{form:{allowShell:!0,autoApprove:`all`,maxSteps:0,turnTimeoutMin:60,stallTimeoutMin:120,stallRetries:-1,reasoningTimeoutMin:600,autoContinueMax:-1},saving:!1,ping:null,help:null,adv:!1,approveOptions:[{value:`none`,label:`逐次确认`},{value:`skill`,label:`免技能`},{value:`all`,label:`全免确认`}]}},created(){this.loadConfig()},mounted(){document.addEventListener(`click`,this.onDocClick,!0),document.addEventListener(`keydown`,this.onKeydown)},beforeUnmount(){document.removeEventListener(`click`,this.onDocClick,!0),document.removeEventListener(`keydown`,this.onKeydown)},methods:{toggleHelp(e){this.help=this.help===e?null:e},onDocClick(e){if(!this.help)return;let t=e.target;t instanceof Element&&t.closest(`.aiset__pop, .aiset__help`)||(this.help=null)},onKeydown(e){e.key===`Escape`&&this.help&&(e.stopPropagation(),this.help=null)},onInt(e,t){let n=String(t).trim();if(!n){this.form[e]=e===`stallRetries`||e===`autoContinueMax`?-1:0;return}let r=Number(n);this.form[e]=Number.isFinite(r)?Math.round(r):0},async loadConfig(){try{let e=await iA();e.shellEnabled!==void 0&&(this.form.allowShell=e.shellEnabled!==!1),e.autoApprove&&(this.form.autoApprove=e.autoApprove),Number(e.maxSteps)>0&&(this.form.maxSteps=Number(e.maxSteps)),Number(e.turnTimeoutMs)>0&&(this.form.turnTimeoutMin=Math.round(Number(e.turnTimeoutMs)/GN)),Number(e.stallTimeoutMs)>0&&(this.form.stallTimeoutMin=Math.round(Number(e.stallTimeoutMs)/GN)),e.stallRetries!==void 0&&e.stallRetries>=0&&(this.form.stallRetries=Number(e.stallRetries)),Number(e.reasoningTimeoutMs)>0&&(this.form.reasoningTimeoutMin=Math.round(Number(e.reasoningTimeoutMs)/GN)),e.autoContinueMax!==void 0&&e.autoContinueMax>=0&&(this.form.autoContinueMax=Number(e.autoContinueMax))}catch{}},async save(){this.saving=!0,this.ping=null;try{let e=await aA({allowShell:!!this.form.allowShell,autoApprove:this.form.autoApprove,maxSteps:Number(this.form.maxSteps)>0?Number(this.form.maxSteps):0,turnTimeoutMs:Number(this.form.turnTimeoutMin)>0?Number(this.form.turnTimeoutMin)*GN:0,stallTimeoutMs:Number(this.form.stallTimeoutMin)>0?Number(this.form.stallTimeoutMin)*GN:0,stallRetries:Number(this.form.stallRetries)>=0?Number(this.form.stallRetries):-1,reasoningTimeoutMs:Number(this.form.reasoningTimeoutMin)>0?Number(this.form.reasoningTimeoutMin)*GN:0,autoContinueMax:Number(this.form.autoContinueMax)>=0?Number(this.form.autoContinueMax):-1});this.$emit(`saved`,e)}catch(e){this.ping={ok:!1,text:`保存失败:${e.message||e}`}}finally{this.saving=!1}}}},qN={class:`aiset__mask`},JN={class:`aiset`,role:`dialog`,"aria-modal":`true`,"aria-label":`AI 通用设置`},YN={class:`aiset__head`},XN={class:`aiset__body`},ZN={class:`aiset__field`},QN={class:`aiset__labelrow`},$N=[`aria-expanded`],eP={key:0,class:`aiset__pop`},tP={class:`aiset__field`},nP={class:`aiset__labelrow`},rP=[`aria-expanded`],iP={class:`aiset__seg`},aP=[`onClick`],oP={key:0,class:`aiset__pop`},sP={class:`aiset__adv`},cP=[`aria-expanded`],lP={class:`aiset__adv-hint`},uP={key:0,class:`aiset__adv-body`},dP={class:`aiset__field`},fP={class:`aiset__labelrow`},pP=[`aria-expanded`],mP={class:`aiset__stepperrow`},hP={key:0,class:`aiset__pop`},gP={class:`aiset__field`},_P={class:`aiset__labelrow`},vP=[`aria-expanded`],yP={class:`aiset__stepperrow`},bP={key:0,class:`aiset__pop`},xP={class:`aiset__field`},SP={class:`aiset__labelrow`},CP=[`aria-expanded`],wP={class:`aiset__stepperrow`},TP={key:0,class:`aiset__pop`},EP={class:`aiset__field`},DP={class:`aiset__labelrow`},OP=[`aria-expanded`],kP={class:`aiset__stepperrow`},AP={key:0,class:`aiset__pop`},jP={class:`aiset__field`},MP={class:`aiset__labelrow`},NP=[`aria-expanded`],PP={class:`aiset__stepperrow`},FP={key:0,class:`aiset__pop`},IP={class:`aiset__field`},LP={class:`aiset__labelrow`},RP=[`aria-expanded`],zP={class:`aiset__stepperrow`},BP={key:0,class:`aiset__pop`},VP={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},HP=[`href`],UP={class:`aiset__foot`},WP=[`disabled`],GP=[`disabled`];function KP(e,t,n,r,i,a){let o=L(`Switch`),s=L(`NumberStepper`);return B(),V(`div`,qN,[U(`section`,JN,[U(`header`,YN,[t[20]||=U(`svg`,{class:`aiset__head-icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-settings`})],-1),t[21]||=U(`span`,{class:`aiset__title`},`通用设置`,-1),U(`button`,{type:`button`,class:`aiset__x`,title:`关闭`,onClick:t[0]||=t=>e.$emit(`close`)},[...t[19]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])]),U(`div`,XN,[t[51]||=U(`p`,{class:`aiset__note`},[G(`以下为`),U(`strong`,null,`所有模型共享`),G(`的执行策略 / 环境参数,与具体模型无关,故不放在每个模型条目里。`)],-1),U(`div`,ZN,[U(`div`,QN,[t[23]||=U(`span`,{class:`aiset__label`},`本地命令执行`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`allowShell`}]),"aria-expanded":i.help===`allowShell`,title:`查看说明`,onClick:t[1]||=q(e=>a.toggleHelp(`allowShell`),[`stop`])},[...t[22]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,$N),W(o,{modelValue:i.form.allowShell,"onUpdate:modelValue":t[2]||=e=>i.form.allowShell=e,class:`aiset__switch`},null,8,[`modelValue`])]),i.help===`allowShell`?(B(),V(`p`,eP,[...t[24]||=[G(` 是否注册 `,-1),U(`code`,null,`shell_exec`,-1),G(` 本地命令执行。默认开(工具只监听 127.0.0.1,命令过白名单 + 全量审计)。 关掉后 AI 不能跑本地命令,但仍可执行技能脚本(由 `,-1),U(`code`,null,`autoApprove`,-1),G(` 控制是否逐次确认)。 `,-1)]])):K(`v-if`,!0)]),U(`div`,tP,[U(`div`,nP,[t[26]||=U(`span`,{class:`aiset__label`},`免确认执行策略`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`autoApprove`}]),"aria-expanded":i.help===`autoApprove`,title:`查看说明`,onClick:t[3]||=q(e=>a.toggleHelp(`autoApprove`),[`stop`])},[...t[25]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,rP)]),U(`div`,iP,[(B(!0),V(z,null,R(i.approveOptions,e=>(B(),V(`button`,{key:e.value,type:`button`,class:A([`aiset__seg-btn`,{"is-on":i.form.autoApprove===e.value}]),onClick:t=>i.form.autoApprove=e.value},j(e.label),11,aP))),128))]),i.help===`autoApprove`?(B(),V(`p`,oP,[...t[27]||=[U(`code`,null,`none`,-1),G(`=逐次弹审批;`,-1),U(`code`,null,`skill`,-1),G(`=只免技能脚本;`,-1),U(`code`,null,`all`,-1),G(`=技能脚本 + 本地命令都免确认(默认)。 建卡管线连跑十几次脚本 / 命令,`,-1),U(`code`,null,`all`,-1),G(` 避免每次等用户点「允许」。 `,-1)]])):K(`v-if`,!0)]),K(` 保活 / 预算阈值:实测调优出来的值,改只会变坏,故默认收起。
312
+ 全部有代码默认值,留空即走默认;折叠区保留可写入口,真要调时不用去翻 .env `),U(`div`,sP,[U(`button`,{type:`button`,class:`aiset__adv-head`,"aria-expanded":i.adv,onClick:t[4]||=e=>i.adv=!i.adv},[(B(),V(`svg`,{class:A([`aiset__adv-caret`,{"is-open":i.adv}]),viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[...t[28]||=[U(`use`,{href:`#icon-chevron-right`},null,-1)]],2)),t[29]||=U(`span`,{class:`aiset__adv-title`},`高级:保活与预算阈值`,-1),U(`span`,lP,j(i.adv?``:`默认值经实测调优,不建议修改`),1)],8,cP),i.adv?(B(),V(`div`,uP,[t[50]||=U(`p`,{class:`aiset__adv-note`},[G(` 这几项是长程任务的`),U(`strong`,null,`熔断与保活阈值`),G(`,数值由实测调优得出(如纯思考预算从 90s 放宽到 600s,因 240s 会误伤正常轮次)。 留空即走默认,`),U(`strong`,null,`没有明确理由不建议改动`),G(`。 `)],-1),U(`div`,dP,[U(`div`,fP,[t[31]||=U(`span`,{class:`aiset__label`},`单轮步数上限`,-1),t[32]||=U(`span`,{class:`aiset__unit`},`0 / 留空 = 不限`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`maxSteps`}]),"aria-expanded":i.help===`maxSteps`,title:`查看说明`,onClick:t[5]||=q(e=>a.toggleHelp(`maxSteps`),[`stop`])},[...t[30]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,pP)]),U(`div`,mP,[W(s,{id:`common-maxsteps`,class:`aiset__stepper`,value:i.form.maxSteps>0?String(i.form.maxSteps):``,step:8,min:0,max:1e3,placeholder:`留空 = 不限(推荐)`,onInput:t[6]||=e=>a.onInt(`maxSteps`,e)},null,8,[`value`])]),i.help===`maxSteps`?(B(),V(`p`,hP,[...t[33]||=[U(`strong`,null,`普通用户不用管:留空 = 不限`,-1),G(`。失控由三道精准熔断兜住(同参打转跳过 / 单轮墙钟到点收尾 / 每 24 步提醒)。 只有想硬性控成本时才填(>0 即恢复旧硬顶行为)。 `,-1)]])):K(`v-if`,!0)]),U(`div`,gP,[U(`div`,_P,[t[35]||=U(`span`,{class:`aiset__label`},`单轮墙钟上限`,-1),t[36]||=U(`span`,{class:`aiset__unit`},`分钟`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`turnTimeout`}]),"aria-expanded":i.help===`turnTimeout`,title:`查看说明`,onClick:t[7]||=q(e=>a.toggleHelp(`turnTimeout`),[`stop`])},[...t[34]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,vP)]),U(`div`,yP,[W(s,{id:`common-turn`,class:`aiset__stepper`,value:i.form.turnTimeoutMin>0?String(i.form.turnTimeoutMin):``,step:5,min:0,max:240,placeholder:`留空 = 60`,onInput:t[8]||=e=>a.onInt(`turnTimeoutMin`,e)},null,8,[`value`])]),i.help===`turnTimeout`?(B(),V(`p`,bP,` 单轮允许跑的最长时间(分钟)。到点收尾汇报、上下文不丢,回复「继续」接着做。默认 60 分钟,不限步数后的唯一兜底闸门。 `)):K(`v-if`,!0)]),U(`div`,xP,[U(`div`,SP,[t[38]||=U(`span`,{class:`aiset__label`},`网关静默阈值`,-1),t[39]||=U(`span`,{class:`aiset__unit`},`分钟`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`stall`}]),"aria-expanded":i.help===`stall`,title:`查看说明`,onClick:t[9]||=q(e=>a.toggleHelp(`stall`),[`stop`])},[...t[37]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,CP)]),U(`div`,wP,[W(s,{id:`common-stall`,class:`aiset__stepper`,value:i.form.stallTimeoutMin>0?String(i.form.stallTimeoutMin):``,step:1,min:0,max:120,placeholder:`留空 = 2`,onInput:t[10]||=e=>a.onInt(`stallTimeoutMin`,e)},null,8,[`value`])]),i.help===`stall`?(B(),V(`p`,TP,` 上游多少分钟不回任何字节算「网关静默」;静默自动重试本步而非整轮报废。默认 2 分钟(120 秒)。 `)):K(`v-if`,!0)]),U(`div`,EP,[U(`div`,DP,[t[41]||=U(`span`,{class:`aiset__label`},`静默重试次数`,-1),t[42]||=U(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`stallRetries`}]),"aria-expanded":i.help===`stallRetries`,title:`查看说明`,onClick:t[11]||=q(e=>a.toggleHelp(`stallRetries`),[`stop`])},[...t[40]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,OP)]),U(`div`,kP,[W(s,{id:`common-stallretries`,class:`aiset__stepper`,value:i.form.stallRetries>=0?String(i.form.stallRetries):``,step:1,min:-1,max:20,placeholder:`留空 / -1 = 3`,onInput:t[12]||=e=>a.onInt(`stallRetries`,e)},null,8,[`value`])]),i.help===`stallRetries`?(B(),V(`p`,AP,` 网关静默后的自动重试次数。0 = 回到「一次静默即报错」的旧行为;留空 / -1 = 用默认 3 次。 `)):K(`v-if`,!0)]),U(`div`,jP,[U(`div`,MP,[t[44]||=U(`span`,{class:`aiset__label`},`纯思考预算`,-1),t[45]||=U(`span`,{class:`aiset__unit`},`分钟`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`reasoning`}]),"aria-expanded":i.help===`reasoning`,title:`查看说明`,onClick:t[13]||=q(e=>a.toggleHelp(`reasoning`),[`stop`])},[...t[43]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,NP)]),U(`div`,PP,[W(s,{id:`common-reasoning`,class:`aiset__stepper`,value:i.form.reasoningTimeoutMin>0?String(i.form.reasoningTimeoutMin):``,step:1,min:0,max:300,placeholder:`留空 = 10`,onInput:t[14]||=e=>a.onInt(`reasoningTimeoutMin`,e)},null,8,[`value`])]),i.help===`reasoning`?(B(),V(`p`,FP,` 单轮「纯思考」(不调工具)的预算(分钟)。到点催促 + 关深度思考重试;催 3 次仍无产出则停该熔断,改墙钟兜底。默认 10 分钟(600 秒)。 `)):K(`v-if`,!0)]),U(`div`,IP,[U(`div`,LP,[t[47]||=U(`span`,{class:`aiset__label`},`自动续跑上限`,-1),t[48]||=U(`span`,{class:`aiset__unit`},`-1 = 默认`,-1),U(`button`,{type:`button`,class:A([`aiset__help`,{"is-on":i.help===`autoContinue`}]),"aria-expanded":i.help===`autoContinue`,title:`查看说明`,onClick:t[15]||=q(e=>a.toggleHelp(`autoContinue`),[`stop`])},[...t[46]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-help`})],-1)]],10,RP)]),U(`div`,zP,[W(s,{id:`common-autocont`,class:`aiset__stepper`,value:i.form.autoContinueMax>=0?String(i.form.autoContinueMax):``,step:1,min:-1,max:200,placeholder:`留空 / -1 = 12`,onInput:t[16]||=e=>a.onInt(`autoContinueMax`,e)},null,8,[`value`])]),i.help===`autoContinue`?(B(),V(`p`,BP,[...t[49]||=[G(` 模型没给收尾标记(`,-1),U(`code`,null,`[任务完成]`,-1),G(` / `,-1),U(`code`,null,`[需用户确认]`,-1),G(`)就停手时的自动续跑次数上限。0 = 关闭(等你手打「继续」);留空 / -1 = 用默认 12。 `,-1)]])):K(`v-if`,!0)])])):K(`v-if`,!0)]),i.ping?(B(),V(`div`,{key:0,class:A([`aiset__ping`,i.ping.ok?`is-ok`:`is-bad`])},[(B(),V(`svg`,VP,[U(`use`,{href:i.ping.ok?`#icon-check`:`#icon-alert-triangle`},null,8,HP)])),U(`span`,null,j(i.ping.text),1)],2)):K(`v-if`,!0)]),U(`footer`,UP,[t[52]||=U(`span`,{class:`aiset__foot-gap`},null,-1),U(`button`,{type:`button`,class:`aiset__btn`,disabled:i.saving,onClick:t[17]||=t=>e.$emit(`close`)},`取消`,8,WP),U(`button`,{type:`button`,class:`aiset__btn aiset__btn--primary`,disabled:i.saving,onClick:t[18]||=(...e)=>a.save&&a.save(...e)},j(i.saving?`保存中…`:`保存`),9,GP)])])])}var qP=X(KN,[[`render`,KP],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/AiCommonSettings.vue`]]),JP=2e3;function YP(e){try{let t=JSON.stringify(e);return t==null?0:t.length}catch{return 1/0}}function XP(e,t){let n=typeof e==`string`?e:e==null?``:JSON.stringify(e);return n.length<=t?e:`${n.slice(0,t)}\n…(历史归档已裁剪,完整内容以卡片与落盘产物为准)`}function ZP(e,t){if(!e||typeof e!=`object`)return e;let n={};for(let[r,i]of Object.entries(e))n[r]=typeof i==`string`||typeof i==`object`&&i?XP(i,t):i;return n}function QP(e,t=!1){let n=Array.isArray(e)?e:[],r=t?400:JP;return n.map(e=>{if(!e||!Array.isArray(e.toolCalls)||!e.toolCalls.length)return e;let n=!1,i=e.toolCalls.map(e=>{if(!e||typeof e!=`object`)return e;let i=ZP(e.args,r),a=t?e.result==null||e.result===``?e.result:`[历史归档已裁剪]`:XP(e.result,r);return(JSON.stringify(i)!==JSON.stringify(e.args)||String(a)!==String(e.result))&&(n=!0),{...e,args:i,result:a}});return n?{...e,toolCalls:i,trimmedArchive:!0}:e})}var $P={card_read:12e3,skill_read:1e4,card_grep:4e3,skill_exec:3e3,fs_read:4e3,fs_write:2e3,fs_list:2e3,fs_copy:1e3,ir_patch:2e3,card_patch:2e3,card_validate:4e3,card_render_status:6e3,card_node_models:4e3,card_screenshot:1e3},eF=6e3;function tF(e){return $P[e]||6e3}function nF(e,t){return(typeof t==`string`?t:String(t??``)).slice(0,tF(e))}Math.max(eF,...Object.values($P));var rF={pick:{id:`pick`,label:`选一张已有的卡`,hint:`从顶栏下拉里挑`,icon:`#icon-search`,weight:`read`,text:`列出仓库里现有的卡片,按用途分组,帮我挑一张适合修改的。`},scaffold:{id:`scaffold`,label:`新建一张卡`,hint:`从空白骨架开始`,icon:`#icon-folder-plus`,weight:`write`,text:`帮我新建一张卡片:先用 card_scaffold 生成骨架,再按我的需求补齐结构与示例内容,最后自检。`},spec:{id:`spec`,label:`按设计稿标注建卡`,hint:`先拖入 MeaXure 目录`,icon:`#icon-image-upload`,weight:`write`,attach:!0,text:`我会挂载一份 Sketch MeaXure 标注导出目录,请按标注生成卡片 schema 并自检。`},fromimage:{id:`fromimage`,label:`从参考图建卡`,hint:`拖一张设计图进来`,icon:`#icon-image`,weight:`write`,attach:!0,text:`我会拖入一张参考设计图(本机路径),请按图生成卡片 schema 并截图自检还原度。`},learn:{id:`learn`,label:`看已有卡学写法`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`列出仓库里结构最完整的几张卡片,读 1-2 张的关键片段,说明本仓库的建卡约定与常用范式。`},component:{id:`component`,label:`加一个常用组件`,hint:`列表 / 按钮 / 金额卡`,icon:`#icon-plus`,weight:`write`,text:`帮我给这张卡加一个常用组件(列表 / 按钮组 / 金额统计卡),按仓库范式写并自检。`},explain:{id:`explain`,label:`解释结构与数据来源`,hint:`只读,不改卡`,icon:`#icon-search`,weight:`read`,text:`读取当前卡片 schema,用中文解释它的结构、关键绑定与数据来源,指出可能的问题。`},bind:{id:`bind`,label:`把写死文案抽成变量`,hint:`绑定 data.json`,icon:`#icon-link`,weight:`write`,text:`把当前卡片里写死的动态值(金额 / 日期 / 名称等)抽成变量并绑定 data.json,保持展示文案与设计稿一致。`},fix:{id:`fix`,label:`校验并修复`,hint:`会改动卡片`,icon:`#icon-wrench`,weight:`write`,text:`对当前卡片执行校验,列出全部错误并按规则修复,修完再校验一次确认清零。`},shot:{id:`shot`,label:`截图自检还原度`,hint:`多尺寸预览比对`,icon:`#icon-images`,weight:`read`,text:`给当前卡片截图,检查布局、字号、间距与配色是否协调,指出需要调整的地方。`},interact:{id:`interact`,label:`加按钮点击行为`,hint:`customAction / 发消息`,icon:`#icon-send`,weight:`write`,text:`给当前卡片里的主按钮加点击行为(customAction 或发送一条消息),参照现有卡片的写法。`},diagnose:{id:`diagnose`,label:`定位并修复刚才的报错`,hint:`接上一轮`,icon:`#icon-alert-triangle`,weight:`write`,text:`上一轮失败了,请读取错误信息与上下文,定位原因并修复,修完再校验一次。`},resume:{id:`resume`,label:`从中断处继续`,hint:`不重做已完成部分`,icon:`#icon-redo`,weight:`write`,text:`上一轮被中断了,请按上下文里的中断标记从中断处继续,不要从零重做。`},rollback:{id:`rollback`,label:`回滚上一轮改动`,hint:`恢复到改动前`,icon:`#icon-undo`,weight:`write`,text:`把上一轮对卡片做的改动回滚到改动前,并说明回滚了什么。`}},iF={nocare:[`pick`,`scaffold`,`spec`,`learn`,`component`],empty:[`spec`,`fromimage`,`scaffold`,`component`,`learn`],card:[`explain`,`bind`,`fix`,`shot`,`interact`],error:[`diagnose`,`resume`,`rollback`,`explain`,`fix`]},aF={nocare:{title:`选择或新建一张卡`,desc:`先从顶栏选一张卡,或让 AI 新建一张;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`},empty:{title:`把这张空卡搭起来`,desc:`描述想要的效果,或拖入设计稿标注目录 / 参考图,AI 会按标注生成卡片并截图自检。`},error:{title:`接着上一轮往下做`,desc:`上一轮失败或被中断了:可以接着修、从中断处继续,或回滚到改动前。`},card:{title:`让 AI 直接改这张卡`,desc:`描述需求即可,AI 会调用卡片工具读改校验并截图自检;也可以把设计稿标注目录、参考图拖进来,只传本机路径不上传。`}};function oF(e){let t=Array.isArray(e)?e:[];for(let e=t.length-1;e>=0;--e){let n=t[e];if(n&&n.role===`assistant`)return n.status||`done`}return``}function sF({cardId:e,cardEmpty:t,messages:n}={}){if(!e)return`nocare`;if(t)return`empty`;let r=oF(n);return r===`error`||r===`aborted`?`error`:`card`}function cF(e){return(iF[e]||iF.card).map(e=>rF[e]).filter(Boolean)}function lF(e,t,n=4){let r=Array.isArray(e)?e:[];if(r.length<=n)return r.slice();let i=r.length,a=((Number(t)||0)%i+i)%i;return[...r.slice(a),...r.slice(0,a)].slice(0,n)}function uF(e,t=4){return(Array.isArray(e)?e:[]).slice(0,t)}var dF=`cardbuddy:ai-panel-width`,fF=2e4,pF=`cardbuddy:ai-compact-steps`,mF=380,hF=.5,gF=.33,_F=0;function vF(e=`m`){return _F+=1,`${e}${Date.now().toString(36)}-${_F}`}var yF=`有对话正在进行,无法修改正在使用的模型:请先等这一轮结束,或在输入区点「停止」`,bF={name:`ChatPanel`,components:{ChatMessage:Wj,ChatComposer:vM,AiSettings:vN,ModelList:WN,AiCommonSettings:qP,ConfirmDialog:_p},props:{visible:{type:Boolean,default:!1},cardId:{type:String,default:``},cardName:{type:String,default:``},cardEmpty:{type:Boolean,default:!1}},emits:[`close`,`busy`,`turn-progress`,`turn-finished`,`rollback-turn`,`locate-node`],data(){return{messages:[],draftAttachments:[],busy:!1,loadingHistory:!1,modelListOpen:!1,models:[],activeId:null,turnRunning:!1,modelEditOpen:!1,editModelId:null,editInitialModel:null,confirmDeleteModel:null,ccSwitchOpen:!1,ccSwitchProviders:[],ccSwitchLoading:!1,ccSwitchReason:``,ccSwitchSelected:{},commonOpen:!1,confirmClear:!1,notice:null,config:{baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``},widthPx:0,winW:typeof window<`u`?window.innerWidth:1280,resizing:!1,pinned:!0,contextUsage:null,compactSteps:!1,archiveTrimmed:!1,suggestOffset:0,suggestStats:{},confirmStop:!1,turnStep:0,turnStage:null,turnToolLabel:``,turnStartedAt:0,lastByteAt:0,turnId:``,lastSeq:0,_resumeProbe:!1,nowTs:0,_abort:null,_saveTimer:0,_loadedCard:``,_cardRenamedTo:``,_saving:!1,_liveTicker:0,_turnPersistTimer:0}},computed:{pickOwnerRow(){return jk(this.messages)},suggestBatchKey(){return sF({cardId:this.cardId,cardEmpty:this.cardEmpty,messages:this.messages})},suggestBatch(){return cF(this.suggestBatchKey)},suggestions(){return lF(this.suggestBatch,this.suggestOffset)},canShuffle(){return this.suggestBatch.length>4},quickChips(){return uF(this.suggestBatch)},emptyTitle(){return(aF[this.suggestBatchKey]||aF.card).title},emptyDesc(){return(aF[this.suggestBatchKey]||aF.card).desc},ccSwitchCheckedCount(){let e=this.ccSwitchSelected||{};return Object.keys(e).filter(t=>e[t]).length},ccSwitchDupCount(){return(this.ccSwitchProviders||[]).filter(e=>e.duplicate).length},configReady(){return!!(this.config.baseUrl&&this.config.model&&this.config.hasKey)},panelWidth(){let e=this.winW||1280,t=Math.max(mF,Math.floor(e*hF)),n=Math.round(e*gF),r=this.widthPx||n;return Math.max(mF,Math.min(t,r))},panelStyle(){return{width:`${this.panelWidth}px`}},stallLimitMs(){let e=Number(this.config.stallTimeoutMs)>0?Number(this.config.stallTimeoutMs):12e4;return Math.round(e*1.5)},idleMs(){return this.lastByteAt?Math.max(0,(this.nowTs||Date.now())-this.lastByteAt):0},stalled(){return!!(this.busy&&this.idleMs>this.stallLimitMs)},liveText(){if(!this.busy)return``;let e=[];return this.turnStartedAt&&e.push(`${lk(this.turnStartedAt)} 开始`),this.turnStep>0&&e.push(`第 ${this.turnStep} 步`),e.push(`已用 ${this.fmtClock(this.nowTs-this.turnStartedAt)}`),this.turnStage?e.push(`${this.turnStage.id} ${this.turnStage.label}`):this.turnToolLabel&&e.push(this.turnToolLabel),this.stalled?`${Math.round(this.idleMs/1e3)} 秒没收到任何数据,连接可能已中断(${e.join(` · `)})`:(e.push(`最近数据 ${Math.round(this.idleMs/1e3)} 秒前`),e.join(` · `))}},watch:{suggestBatchKey(){this.suggestOffset=0},visible(e){e?(this.refreshConfig(),this.ensureHistory().then(()=>this.checkResumableTurn()),this.$nextTick(()=>{this.scrollToBottom(!0),this.$refs.composerEl?.focus()})):this.busy&&this.flushHistory()},cardId(e,t){if(this._cardRenamedTo&&this._cardRenamedTo===e){this._cardRenamedTo=``,this._dirtyFor===t&&(this._dirtyFor=e),this._loadedCard===t?(this._loadedCard=e,this._dirtyFor===e&&this.flushHistory(e)):(this._loadedCard=``,this.ensureHistory());return}this._saveTimer&&=(clearTimeout(this._saveTimer),0);let n=this._dirtyFor===t?this.serialize():null;this._dirtyFor=null,this.draftAttachments=[],this.messages=[],n&&t&&this.flushHistory(t,n),this.ensureHistory()}},mounted(){this.loadWidth(),this.loadCompact(),window.addEventListener(`resize`,this.onWinResize),window.addEventListener(`pagehide`,this.onPagehide),this.refreshConfig(),this.ensureHistory()},beforeUnmount(){window.removeEventListener(`resize`,this.onWinResize),window.removeEventListener(`pagehide`,this.onPagehide),this.stopTurnTimers(),this.stopTickers(),this.flushHistory(),this._abort&&this._abort.abort()},methods:{onWinResize(){this.winW=window.innerWidth},onImageClick(e){let t=e.target&&e.target.closest?e.target.closest(`img`):null;if(!t||t.dataset.noZoom===`1`)return;let n=Array.from(this.$el.querySelectorAll(`img`)).filter(e=>e.dataset.noZoom!==`1`),r=n.indexOf(t);r<0||EC(n.map(e=>({src:e.currentSrc||e.src,alt:e.alt||``,title:e.getAttribute(`title`)||e.closest(`[title]`)?.getAttribute(`title`)||``})),r)},loadWidth(){try{let e=localStorage.getItem(dF);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=mF&&(this.widthPx=t)}}catch{}},saveWidth(){try{this.widthPx?localStorage.setItem(dF,String(Math.round(this.panelWidth))):localStorage.removeItem(dF)}catch{}},startResize(e){let t=e&&e.currentTarget;if(!t)return;this.resizing=!0,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e.pointerId;try{t.setPointerCapture(n)}catch{}let r=e=>{let t=Math.max(mF,Math.floor(window.innerWidth*hF));this.widthPx=Math.max(mF,Math.min(t,Math.round(window.innerWidth-e.clientX)))},i=()=>{t.removeEventListener(`pointermove`,r),t.removeEventListener(`pointerup`,i),t.removeEventListener(`pointercancel`,i),window.removeEventListener(`blur`,i);try{t.hasPointerCapture?.(n)&&t.releasePointerCapture(n)}catch{}this.resizing=!1,document.body.style.cursor=``,document.body.style.userSelect=``,this.saveWidth()};t.addEventListener(`pointermove`,r),t.addEventListener(`pointerup`,i),t.addEventListener(`pointercancel`,i),window.addEventListener(`blur`,i)},resetWidth(){this.widthPx=0,this.saveWidth()},async refreshConfig(){try{let e=await iA();this.config={...e,hasKey:!!(e.hasKey||e.apiKey)},e.turnRunning!==void 0&&(this.turnRunning=e.turnRunning===!0)}catch{this.config={baseUrl:``,model:``,hasKey:!1,apiKeyMasked:``}}},async loadModels(){try{let e=await oA();this.models=Array.isArray(e.models)?e.models:[],this.activeId=e.activeId||null,this.turnRunning=e.turnRunning===!0}catch{this.models=[],this.activeId=null}},openModelList(){this.modelListOpen=!0,this.loadModels(),this.refreshConfig()},closeModelList(){this.modelListOpen=!1},onModelAdd(){this.modelListOpen=!1,this.editModelId=null,this.editInitialModel=null,this.modelEditOpen=!0},onModelEdit(e){if(this.turnRunning&&e&&e.id===this.activeId)return this.notify(`warn`,yF);this.modelListOpen=!1,this.editModelId=e&&e.id?e.id:null,this.editInitialModel=e||null,this.modelEditOpen=!0},onModelEditClose(){this.modelEditOpen=!1,this.modelListOpen=!0},async onModelSaved(){this.modelEditOpen=!1,this.modelListOpen=!0,await this.loadModels(),await this.refreshConfig()},async onModelActivate(e){if(!(!e||!e.id)){if(this.turnRunning&&e.id!==this.activeId)return this.notify(`warn`,yF);try{await fA(e.id)}catch(e){this.notify(`warn`,`切换模型失败:${e.message||e}`)}await this.loadModels(),await this.refreshConfig()}},onModelDelete(e){if(!(!e||!e.id)){if(this.turnRunning&&e.id===this.activeId)return this.notify(`warn`,yF);this.confirmDeleteModel=e}},async doDeleteModel(){let e=this.confirmDeleteModel;if(this.confirmDeleteModel=null,!(!e||!e.id)){try{await dA(e.id)}catch(e){this.notify(`warn`,`删除失败:${e.message||e}`);return}await this.loadModels(),await this.refreshConfig(),this.notify(`ok`,`已删除模型「${e.name||e.model||e.id}」`)}},get deleteModelMessage(){let e=this.confirmDeleteModel;return`确定删除模型「${e?e.name||e.model||e.id:``}」吗?此操作不可撤销,配置将从 .env.cb.local 移除${e&&e.id===this.activeId?`。该模型当前为生效模型,删除后会自动回落到剩余模型中的第一条(若已无模型则需重新添加)。`:`。`}`},async onImportCcSwitch(){this.ccSwitchOpen=!0,this.ccSwitchLoading=!0,this.ccSwitchProviders=[],this.ccSwitchReason=``,this.ccSwitchSelected={};try{let e=await sA(),t=Array.isArray(e.providers)?e.providers:[],n=this.models.map(e=>e.model).filter(Boolean);t.forEach(e=>{e.duplicate=n.includes(e.model)}),this.ccSwitchProviders=t,t.length||(this.ccSwitchReason=e.reason||`cc-switch 中没有可导入的 Codex 类供应商`)}catch(e){this.ccSwitchReason=`读取 cc-switch 失败:${e&&e.message||e}`}finally{this.ccSwitchLoading=!1}},toggleCcSwitchItem(e){if(!e||e.duplicate)return;let t={...this.ccSwitchSelected};t[e.id]?delete t[e.id]:t[e.id]=!0,this.ccSwitchSelected=t},async confirmImportCcSwitch(){let e=this.ccSwitchProviders.filter(e=>this.ccSwitchSelected[e.id]&&!e.duplicate);if(!e.length)return;let t=0,n=0;for(let r of e)try{await lA({name:r.name||r.model,baseUrl:r.baseUrl,apiKey:r.apiKey||``,model:r.model,maxTokens:0,thinking:!1,vision:!1}),t++}catch(e){n++,console.error(`[cc-switch 导入失败]`,r.name,e)}this.ccSwitchOpen=!1,await this.loadModels(),await this.refreshConfig(),n?this.notify(`warn`,`导入完成:成功 ${t} 个、失败 ${n} 个`):this.notify(`ok`,`已从 cc-switch 导入 ${t} 个模型`)},openCommon(){this.modelListOpen=!1,this.commonOpen=!0},async onCommonSaved(){this.commonOpen=!1,await this.refreshConfig(),this.notify(`ok`,`通用设置已保存`)},async ensureHistory(){let e=this.cardId;if(!(!e||this._loadedCard===e)){this._loadedCard=e,this.loadingHistory=!0;try{let t=await xA(e);if(this.cardId!==e)return;let n=this.busy?this.turnId:``,r=(t.messages||[]).map(e=>this.revive(e)).filter(e=>!(n&&e.role===`assistant`&&e.turnId===n));this.archiveTrimmed=r.some(e=>e.trimmedArchive===!0);let i=new Set(r.map(e=>e.id)),a=this.messages.filter(e=>!i.has(e.id));this.messages=[...r,...a],this.contextUsage=null,this._dirtyFor=null,this.checkResumableTurn(),this.$nextTick(()=>this.scrollToBottom(!0))}catch{this.cardId===e&&(this.messages=[]),this._dirtyFor=null}finally{this.cardId===e&&(this.loadingHistory=!1)}}},serialize(){return this.messages.map(e=>{let t={id:e.id,role:e.role,content:e.content||``,ts:e.ts};return e.role===`assistant`?(t.reasoning=e.reasoning||``,t.reasoningMs=e.reasoningMs||0,t.error=e.error||``,e.errorCode&&(t.errorCode=e.errorCode),e.events?.length&&(t.events=e.events.map(e=>({ts:e.ts||0,level:e.level||`warn`,code:e.code||``,message:e.message||``}))),t.elapsedMs=e.elapsedMs||0,t.status=e.status===`streaming`?`aborted`:e.status||`done`,e.turnId&&(t.turnId=e.turnId),e.serverAuthored&&(t.serverAuthored=!0),e.budget?.message&&(t.budget={reason:e.budget.reason||``,message:e.budget.message}),e.usage&&(t.usage=e.usage),e.toolCalls?.length&&(t.toolCalls=e.toolCalls.map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:e.result,error:e.error||``,ms:e.ms||0,startedAt:e.startedAt||0,command:e.command||``,approvalNote:e.approvalNote||``,autoApproved:!!e.autoApproved,truncated:!!e.truncated})))):e.attachments?.length&&(t.attachments=e.attachments.map(e=>({path:e.path,name:e.name,isDir:!!e.isDir,isImage:!!e.isImage,size:e.size||0,entryCount:e.entryCount||0,exists:e.exists!==!1}))),t})},revive(e){return{id:e.id||vF(),role:e.role===`user`?`user`:`assistant`,content:e.content||``,narrationChars:Math.max(0,Number(e.narrationChars)||0),reasoning:e.reasoning||``,reasoningMs:e.reasoningMs||0,elapsedMs:Number(e.elapsedMs)||0,toolCalls:Array.isArray(e.toolCalls)?e.toolCalls.map(t=>(e.status===`aborted`||e.status===`streaming`)&&t&&!t.error&&t.result==null?{...t,error:`已终止:该调用未拿到结果(轮次被中断)`}:t):[],attachments:Array.isArray(e.attachments)?e.attachments:[],events:Array.isArray(e.events)?e.events:[],error:e.error||``,errorCode:e.errorCode||``,trimmedArchive:e.trimmedArchive===!0,status:e.status||`done`,turnId:e.turnId||``,serverAuthored:e.serverAuthored===!0,budget:e.budget?.message?{reason:e.budget.reason||``,message:e.budget.message}:void 0,usage:e.usage||void 0,ts:e.ts||0}},persist(){this.cardId&&(this._dirtyFor=this.cardId,this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=setTimeout(()=>this.flushHistory(),500))},fitArchive(e){if(YP(e)<=4e6)return e;let t=QP(e,!1);return YP(t)>4e6&&(t=QP(t,!0)),this.archiveTrimmed=!0,t},async flushHistory(e=this.cardId,t=null){if(this._saveTimer&&=(clearTimeout(this._saveTimer),0),e){if(this._saving){this._saveTimer=setTimeout(()=>this.flushHistory(e,t),800);return}this._saving=!0;try{await SA(e,this.fitArchive(t||this.serialize())),this._dirtyFor===e&&(this._dirtyFor=null)}catch(e){this.notify(`warn`,`对话记录保存失败:${e.message||e}`)}finally{this._saving=!1}}},migrateCard(e,t){!e||!t||e===t||this.cardId===e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._cardRenamedTo=t,this._dirtyFor===e&&(this._dirtyFor=t))},discardCard(e){e&&(this._saveTimer&&=(clearTimeout(this._saveTimer),0),this._dirtyFor===e&&(this._dirtyFor=null),(this._loadedCard===e||this.cardId===e)&&(this.busy&&this._abort&&this._abort.abort(),this.messages=[],this.draftAttachments=[],this.contextUsage=null,this._loadedCard=``))},askClear(){this.messages.length&&(this.confirmClear=!0)},async doClear(){this.confirmClear=!1;let e=this.cardId;this.messages=[],this.contextUsage=null,this._loadedCard=e,this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0);try{await CA(e),this.notify(`ok`,`已清空本卡片的对话记录`)}catch(e){this.notify(`warn`,`清空失败:${e.message||e}`)}},async onPick(e){try{let t=await hA(e);if(t.cancelled)return;for(let e of t.items||[])this.pushAttachment(e);t.items?.length||this.notify(`warn`,`未选到可用文件`)}catch(e){this.notify(`warn`,e.message||`无法调起系统选择器,可改用拖拽或粘贴路径`)}},async onAddPath(e){try{let t=await gA(e);this.pushAttachment(t)}catch(t){this.notify(`warn`,`路径不可用:${e}(${t.message||t})`)}},async onPasteImage(e){try{let t=await yA(e);this.pushAttachment(t,`粘贴的截图已存到本机 .cache/ai-attachments/`)}catch(e){this.notify(`warn`,`截图保存失败:${e.message||e}`)}},async onDropFiles(e){let t=Array.from(e.items||[]).map(e=>e.webkitGetAsEntry?e.webkitGetAsEntry():null).filter(Boolean),n=Array.from(e.files||[]),r=[];if(t.length)for(let e of t)r.push(this.resolveEntry(e));else for(let e of n)r.push(this.resolveFile(e));if(!r.length){this.notify(`warn`,`没有识别到可挂载的文件`);return}let i=(await Promise.all(r)).filter(e=>e!==`cancelled`&&!e).length;i&&this.notify(`warn`,`${i} 项未能定位本机路径,可改用「粘贴路径」添加`)},async resolveEntry(e){if(e.isDirectory){let t=await this.firstFileInDir(e);return this.resolveByName(e.name,e.fullPath||e.name,t?.size??-1,t?.name||``)}let t=await this.entryToFile(e);return t?this.resolveFile(t):this.resolveByName(e.name,e.fullPath||e.name,-1)},async resolveFile(e){return this.resolveByName(e.name,e.webkitRelativePath||e.name,e.size)},async resolveByName(e,t,n,r=``){let i={id:vF(`att`),path:``,name:e,isDir:!1,isImage:!1,pending:!0};this.draftAttachments=[...this.draftAttachments,i];try{let a=await vA(_A({name:e,relPath:t,size:n,child:r}),fF,`locate`);return i.removed?`cancelled`:(this.pushAttachment(a),a)}catch{return i.removed?`cancelled`:null}finally{this.draftAttachments=this.draftAttachments.filter(e=>e.id!==i.id)}},entryToFile(e){return new Promise(t=>{try{e.file(e=>t(e),()=>t(null))}catch{t(null)}})},firstFileInDir(e){return new Promise(t=>{try{e.createReader().readEntries(async e=>{for(let n of e||[])if(!n.isDirectory){let e=await this.entryToFile(n);if(e)return t(e)}t(null)},()=>t(null))}catch{t(null)}})},pushAttachment(e,t){e?.path&&(this.draftAttachments.some(t=>t.path===e.path)||(this.draftAttachments=[...this.draftAttachments,{...e,note:t}],t&&this.notify(`ok`,t)))},removeAttachment(e){if(!e)return;let t=this.draftAttachments.find(t=>(t.id||t.path)===e);t&&t.pending&&(t.removed=!0),this.draftAttachments=this.draftAttachments.filter(t=>(t.id||t.path)!==e)},cancelPendingLocates(){for(let e of this.draftAttachments)e.pending&&(e.removed=!0)},useSuggestion(e){this.$refs.composerEl?.setText(e.text),this.trackSuggest(e)},shuffleSuggestions(){let e=this.suggestBatch.length;e&&(this.suggestOffset=(this.suggestOffset+4)%e)},trackSuggest(e){if(!(!e||!e.id)){this.suggestStats[e.id]=(this.suggestStats[e.id]||0)+1;try{window.dispatchEvent(new CustomEvent(`cardbuddy:suggest`,{detail:{id:e.id,label:e.label,weight:e.weight,batch:this.suggestBatchKey}}))}catch{}}},async onSend({text:e,attachments:t}){if(this.busy||!await this.ensureConfig())return;this.notice=null;let n={id:vF(`u`),role:`user`,content:e,attachments:t.map(e=>({...e})),ts:Date.now()};this.messages.push(n),this.cancelPendingLocates(),this.draftAttachments=[],this.pinned=!0,await this.runTurn({retractMsgId:n.id,draft:{text:e,attachments:n.attachments}})},async ensureConfig(){return await this.refreshConfig(),this.configReady?!0:(this.modelListOpen=!0,this.loadModels(),this.notify(`warn`,`请先在模型库中添加并配置模型(Base URL / API Key / 模型名)`),!1)},onPickBoard(e){if(this.busy)return;let t=Mk(e,this.cardId);t&&this.onSend({text:t,attachments:[]})},onContinue(){this.busy||this.onSend({text:`继续`,attachments:[]})},async regenerate(e){if(this.busy)return;let t=this.messages.findIndex(t=>t.id===e.id);t>0&&(this.messages=this.messages.slice(0,t)),await this.runTurn()},async runTurn(e={}){this.messages.push({id:vF(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:Date.now()});let t=this.messages[this.messages.length-1],n=t.id;this.busy=!0,this.pinned=!0,this.startTurn();let r=new AbortController;this._abort=r;let i=!1,a=Date.now(),o=()=>{t.reasoning&&!t.reasoningMs&&(t.reasoningMs=Date.now()-a)};try{await TA({messages:this.toWire(this.messages.filter(e=>e.id!==n)),cardContext:this.cardId?{id:this.cardId}:void 0,attachments:this.lastAttachments(),signal:r.signal,onEvent:e=>this.onEvent(e,t,o)}),t.status===`streaming`&&(t.status=`done`)}catch(a){let s=r.signal.aborted||/abort/i.test(String(a?.message||a));o(),a?.code===`turn-in-flight`?(i=!0,this.messages=this.messages.filter(t=>t.id!==n&&t.id!==e.retractMsgId),e.draft&&(this.draftAttachments=(e.draft.attachments||[]).map(e=>({...e})),this.$refs.composerEl?.setText(e.draft.text||``)),this.notify(`warn`,String(a?.message||`这张卡片已有一个回合在跑:请先终止或等它结束,再发新消息`)),this.$nextTick(()=>this.checkResumableTurn())):s?t.status=`aborted`:await this.reattachAfterDrop(t,o)?this.pushEvent(t,{level:`info`,code:`stream-resumed`,message:`已接回本回合,继续跟随进度`}):(t.error=String(a?.message||a),t.errorCode=String(a?.code||``),t.status=`error`)}finally{o(),this.endTurn(t,{rejected:i})}},endTurn(e,{rejected:t=!1}={}){e.status===`streaming`&&(e.status=`done`),t||(e.elapsedMs=Math.max(0,Date.now()-this.turnStartedAt)),this.busy=!1,this._abort=null,this.stopTurnTimers(),this.persist(),this.$emit(`busy`,!1),t||this.$emit(`turn-finished`,{status:e.status,error:e.error||``,steps:this.turnStep,ms:Date.now()-this.turnStartedAt,startedAt:this.turnStartedAt,finishedAt:Date.now(),turnId:this.turnId||e.turnId||``}),this.$nextTick(()=>this.scrollToBottom())},async checkResumableTurn(){let e=this.cardId;if(!(!e||this.busy||this._resumeProbe)){this._resumeProbe=!0;try{let t;try{t=await EA(e)}catch{return}let n=t&&t.active;if(!n||!n.turnId||this.cardId!==e||this.busy)return;await this.attachToTurn({cardId:e,turnId:String(n.turnId),startedAt:Number(n.startedAt)||0,afterSeq:0,note:n.detached?`接回一个仍在服务端运行的回合(上次连接已中断,进度与已落盘产物都在)`:`接回本回合的实时进度`})}finally{this._resumeProbe=!1}}},async attachToTurn({cardId:e,turnId:t,startedAt:n=0,afterSeq:r=0,note:i=``}){let a=this.messages.find(e=>e.role===`assistant`&&e.turnId===t);a||=(this.messages.push({id:vF(`a`),role:`assistant`,content:``,narrationChars:0,reasoning:``,reasoningMs:0,toolCalls:[],events:[],error:``,status:`streaming`,ts:n||Date.now(),turnId:t}),this.messages[this.messages.length-1]),a.content=``,a.reasoning=``,a.reasoningMs=0,a.toolCalls=[],a.events=[],a.error=``,a.errorCode=``,a.budget=void 0,a.status=`streaming`,a.turnId=t,this.busy=!0,this.pinned=!0,this.startTurn(),this.turnId=t,this.lastSeq=Number(r)||0,n&&(this.turnStartedAt=n,a.ts=n);let o=new AbortController;this._abort=o;let s=n||Date.now(),c=()=>{a.reasoning&&!a.reasoningMs&&(a.reasoningMs=Date.now()-s)};i&&this.notify(`warn`,i);try{this.lastSeq=await OA({cardId:e,turnId:t,afterSeq:this.lastSeq,signal:o.signal,onEvent:e=>this.onEvent(e,a,c)})}catch(e){o.signal.aborted||/abort/i.test(String(e?.message||e))||(a.error=String(e?.message||e),a.errorCode=String(e?.code||``),a.status=`error`)}finally{c(),this.endTurn(a)}},async reattachAfterDrop(e,t){let n=this.cardId,r=this.turnId||e.turnId,i=this._abort;if(!n||!r||!i||i.signal.aborted)return!1;try{return this.pushEvent(e,{level:`warn`,code:`stream-dropped`,message:`连接中断:正在按断点续订本回合(服务端仍在跑,已执行的写入不受影响)`}),this.lastSeq=await OA({cardId:n,turnId:r,afterSeq:this.lastSeq,signal:i.signal,onEvent:n=>this.onEvent(n,e,t)}),!0}catch{return!1}},onEvent(e,t,n){this.lastByteAt=Date.now();let r=Number(e.seq)||0;switch(r>this.lastSeq&&(this.lastSeq=r),e.type){case`turn-start`:e.turnId&&(this.turnId=String(e.turnId),t.turnId=String(e.turnId)),Number(e.startedAt)&&(this.turnStartedAt=Number(e.startedAt),t.ts=Number(e.startedAt));break;case`client-detached`:this.pushEvent(t,{level:`info`,code:`client-detached`,message:`连接曾中断,回合在服务端继续跑(事件已全部落日志)`});break;case`turn-end`:(e.status===`aborted`||e.status===`error`)&&(t.status=e.status),e.usage&&this.applyUsage(t,e.usage);break;case`usage`:this.applyUsage(t,e);break;case`reasoning-delta`:t.reasoning+=e.text||``;break;case`text-delta`:n(),t.content+=e.text||``;break;case`tool-call-start`:n(),t.content&&(t.narrationChars=t.content.length),this.findToolRow(t,e)||t.toolCalls.push({toolCallId:e.toolCallId||vF(`tc`),toolName:e.toolName,args:{},pending:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break;case`tool-call`:{n(),t.content&&(t.narrationChars=t.content.length);let r=this.findToolRow(t,e);r?(e.toolCallId&&(r.toolCallId=e.toolCallId),e.toolName&&(r.toolName=e.toolName),r.args=e.args||{},r.pending=!1):t.toolCalls.push({toolCallId:e.toolCallId||vF(`tc`),toolName:e.toolName,args:e.args||{},result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`tool-result`:{let n=t.toolCalls.find(t=>t.toolCallId===e.toolCallId||!e.toolCallId&&t.toolName===e.toolName&&t.result===void 0);n&&(n.result=e.result??``,n.truncated=!!e.truncated,e.error&&(n.error=String(e.error)),e.image&&(n.image=e.image),n.ms=Date.now()-(n.startedAt||Date.now())),this.persist();break}case`approval-request`:{let n=this.findToolRow(t,e)||t.toolCalls[t.toolCalls.length-1];n&&n.toolName===e.toolName&&n.result===void 0?(n.approvalId=e.approvalId,e.command&&(n.command=e.command),n.needsApproval=!0):t.toolCalls.push({toolCallId:e.toolCallId||vF(`tc`),toolName:e.toolName,args:e.args||{},command:e.command||``,approvalId:e.approvalId,needsApproval:!0,result:void 0,error:``,startedAt:Date.now(),ms:0});break}case`approval-decided`:{let n=(t.toolCalls||[]).find(t=>t.approvalId===e.approvalId);n&&(n.needsApproval=!1,n.approvalNote=e.ok?e.scope===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:e.reason||`已拒绝执行`);break}case`approval-auto`:{let n=this.findToolRow(t,e)||[...t.toolCalls||[]].reverse().find(t=>t.toolName===e.toolName&&t.result===void 0);n&&(e.command&&(n.command=e.command),n.autoApproved=!0,n.approvalNote=`按设置免确认执行`);break}case`notice`:{let n=e.level===`info`||e.level===`error`?e.level:`warn`;this.pushEvent(t,{level:n,code:e.code||``,message:e.message||``}),n!==`info`&&this.notify(n===`error`?`danger`:`warn`,e.message||``);break}case`round-retry`:{let n=Number(e.dropReasoning)||0,r=Number(e.dropText)||0,i=Number(e.dropTools)||0;n>0&&(t.reasoning=t.reasoning.slice(0,Math.max(0,t.reasoning.length-n))),r>0&&(t.content=t.content.slice(0,Math.max(0,t.content.length-r))),i>0&&t.toolCalls.splice(Math.max(0,t.toolCalls.length-i),i),t.reasoning||(t.reasoningMs=0),this.pushEvent(t,{level:`warn`,code:`retry-${e.reason||`unknown`}`,message:e.message||``}),this.notify(`warn`,e.message||``);break}case`context-usage`:this.contextUsage={used:Number(e.used)||0,total:Number(e.total)||0,window:Number(e.window)||0};break;case`turn-ended`:t.budget={reason:String(e.reason||``),message:String(e.message||``)};break;case`error`:t.error=t.error?`${t.error}\n${e.message}`:String(e.message||``),e.code&&(t.errorCode=String(e.code)),t.status=`error`;break;case`aborted`:t.status=`aborted`}let i=t.toolCalls||[];this.turnStep=i.length;let a=i[i.length-1];if(a){this.turnToolLabel=`正在${ak(a.toolName)}…`;let e=fk(a);e&&(!this.turnStage||e.order>this.turnStage.order)&&(this.turnStage=e)}this.$nextTick(()=>this.scrollToBottom())},async onApproval({tc:e,ok:t,scope:n=`once`}){if(e?.approvalId){e.needsApproval=!1,e.approvalNote=t?n===`turn`?`已允许,本回合后续同类执行不再询问…`:`已允许,执行中…`:`已拒绝执行`;try{await bA({approvalId:e.approvalId,ok:t,scope:n})}catch(e){this.notify(`warn`,`审批提交失败:${e.message}`)}}},findToolRow(e,t){let n=e.toolCalls||[];if(t.toolCallId){let e=n.find(e=>e.toolCallId===t.toolCallId);if(e)return e}return n.find(e=>e.pending&&e.toolName===t.toolName)||null},stop(){this.confirmStop=!1;let e=this._abort,t=this.cardId,n=this.turnId||``;t&&n&&DA(t).catch(e=>{e?.code!==`no-turn`&&this.notify(`warn`,`终止请求未送达:${e.message}`)}),e&&(e.abort(),this.notify(`ok`,`已终止本次生成`))},doStop(){this.stop()},onEscape(){if(this.confirmStop){this.confirmStop=!1;return}if(this.confirmDeleteModel){this.confirmDeleteModel=null;return}if(this.commonOpen){this.commonOpen=!1;return}if(this.modelListOpen||this.modelEditOpen){this.modelListOpen=!1,this.modelEditOpen=!1;return}if(this.busy){this.confirmStop=!0;return}this.$emit(`close`)},lastAttachments(){for(let e=this.messages.length-1;e>=0;e--){let t=this.messages[e];if(t.role===`user`)return(t.attachments||[]).map(e=>({path:e.path,name:e.name,isDir:e.isDir,isImage:e.isImage}))}return[]},toWire(e){return e.map(e=>{if(e.role===`user`){let t=e.attachments||[],n=e.content||``;if(t.length){let e=t.map(e=>`- ${e.isDir?`文件夹`:e.isImage?`图片`:`文件`}:${e.path}`);n=`${n}${n?`
311
313
 
312
314
  `:``}[已挂载本地文件(仅本机路径,未上传;需要内容请用工具读取)]\n${e.join(`
313
- `)}`}return{role:`user`,content:n}}let t=(e.toolCalls||[]).filter(e=>e.result!==void 0||e.error).map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:typeof e.result==`string`?qP(e.toolName,e.result):e.result,error:e.error||``})),n=e.content||``;return e.status===`aborted`&&(n=n?`${n}\n\n[本轮生成被用户手动中止,以上为已完成部分;未完成的步骤没有执行,请从中断处继续。]`:`[上一轮被用户手动中止于思考/工具阶段,没有产出可用内容;请重新规划并继续完成用户的目标。]`),{role:`assistant`,content:n,toolCalls:t}})},onScroll(){let e=this.$refs.listEl;e&&(this.pinned=e.scrollHeight-e.scrollTop-e.clientHeight<48)},scrollToBottom(e=!1){let t=this.$refs.listEl;t&&(!e&&!this.pinned||(t.scrollTop=t.scrollHeight))},stopTickers(){this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=0},startTurn(){let e=Date.now();this.turnId=``,this.lastSeq=0,this.turnStep=0,this.turnStage=null,this.turnToolLabel=``,this.turnStartedAt=e,this.lastByteAt=e,this.nowTs=e,this.stopTurnTimers(),this._liveTicker=setInterval(()=>{this.nowTs=Date.now(),this.$emit(`turn-progress`,{steps:this.turnStep,startedAt:this.turnStartedAt,ms:this.nowTs-this.turnStartedAt,stage:this.turnStage?`${this.turnStage.id} ${this.turnStage.label}`:this.turnToolLabel,stalled:this.stalled})},1e3),this._turnPersistTimer=setInterval(()=>this.persist(),8e3),this.persist(),this.$emit(`busy`,!0)},stopTurnTimers(){this._liveTicker&&clearInterval(this._liveTicker),this._liveTicker=0,this._turnPersistTimer&&clearInterval(this._turnPersistTimer),this._turnPersistTimer=0},onPagehide(){let e=this.cardId;if(!e||!this.messages.length)return;let t=this.fitArchive(this.serialize());this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0),pA(e,t,{keepalive:!0}).catch(()=>{})},fmtClock:$O,pushEvent(e,t){let n=String(t&&t.message||``);!n||!e||(Array.isArray(e.events)||(e.events=[]),e.events.push({ts:Date.now(),level:t.level||`warn`,code:t.code||``,message:n}))},applyUsage(e,t){if(!e||!t)return;let n=e=>Number.isFinite(Number(e))?Number(e):0;e.usage={steps:n(t.steps),promptTokens:n(t.promptTokens),completionTokens:n(t.completionTokens),cachedTokens:n(t.cachedTokens),cacheMissTokens:n(t.cacheMissTokens),hitRate:n(t.hitRate),reported:t.reported!==!1}},loadCompact(){try{this.compactSteps=localStorage.getItem(iF)===`1`}catch{}},setCompact(e){let t=!!e;if(this.compactSteps!==t){this.compactSteps=t;try{t?localStorage.setItem(iF,`1`):localStorage.removeItem(iF)}catch{}this.$nextTick(()=>this.scrollToBottom())}},toggleCompact(){this.setCompact(!this.compactSteps)},onLocateNode(e){e&&this.$emit(`locate-node`,String(e))},onRollbackTurn(e){if(this.busy)return;let t=this.cardId;!t||!e||this.$emit(`rollback-turn`,{cardId:t,ts:Number(e.ts)||0,msgId:e.id})},notify(e,t){this.notice={type:e,text:t},this._noticeTimer&&clearTimeout(this._noticeTimer),this._noticeTimer=setTimeout(()=>{this.notice=null},6e3)}}},fF={class:`aichat__head`},pF={class:`aichat__titles`},mF={class:`aichat__sub`},hF={class:`aichat__acts`},gF=[`title`,`aria-pressed`],_F={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},vF=[`href`],yF=[`disabled`],bF={key:0,class:`aichat__banner`},xF={class:`aichat__scroll`},SF={key:0,class:`aichat__archnote`,title:`长对话记录超出落盘体积上限时,较早的工具参数与结果会被裁剪归档;正文、思考与过程事件都完整保留`},CF={key:1,class:`aichat__loading`},wF={key:2,class:`aichat__empty`},TF={class:`aichat__empty-title`},EF={class:`aichat__empty-desc`},DF={class:`aichat__suggests`},OF=[`title`,`data-suggest-id`,`onClick`],kF={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},AF=[`href`],jF={class:`aichat__suggest-text`},MF={class:`aichat__suggest-label`},NF={class:`aichat__suggest-hint`},PF={key:0,class:`aichat__suggest-badge`,title:`该操作会改动卡片`},FF={class:`aichat__live-text`},IF={key:1,class:`aichat__quick`},LF=[`title`,`data-suggest-id`,`onClick`],RF={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},zF=[`href`],BF={class:`ni-panel modal-card ccsw-dlg`,role:`dialog`,"aria-modal":`true`,"aria-label":`从 cc-switch 导入模型`},VF={class:`ni-head`},HF={class:`ni-body`},UF={class:`ni-scroll`},WF={key:0,class:`ccsw-dlg__msg`},GF={class:`ccsw-dlg__msg ccsw-dlg__msg--err`},KF={class:`ccsw-dlg__list`},qF=[`onClick`],JF={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},YF={class:`ccsw-dlg__info`},XF={class:`ccsw-dlg__name`},ZF={key:0,class:`ccsw-dlg__badge ccsw-dlg__badge--cur`,title:`cc-switch 中当前生效`},QF={key:1,class:`ccsw-dlg__badge ccsw-dlg__badge--dup`,title:`模型库中已存在同名模型`},$F={class:`ccsw-dlg__meta`},eI={class:`ccsw-dlg__model`},tI={class:`ccsw-dlg__host`},nI={class:`ni-foot`},rI={class:`ni-tip`},iI={class:`ni-foot-btns`},aI=[`disabled`];function oI(e,t,n,r,i,a){let o=L(`ChatMessage`),s=L(`ChatComposer`),c=L(`ModelList`),l=L(`AiSettings`),u=L(`ConfirmDialog`),d=L(`AiCommonSettings`);return B(),V(`aside`,{class:A([`aichat`,{"is-open":n.visible}]),style:k(a.panelStyle),role:`complementary`,"aria-label":`AI 开发助手`,onKeydown:t[21]||=vl((...e)=>a.onEscape&&a.onEscape(...e),[`esc`]),onClick:t[22]||=(...e)=>a.onImageClick&&a.onImageClick(...e)},[K(` 左缘拖拽把手:调宽(双击恢复默认 33%) `),U(`div`,{class:A([`aichat__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整宽度(双击恢复默认)`,onPointerdown:t[0]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=q((...e)=>a.resetWidth&&a.resetWidth(...e),[`prevent`])},null,34),K(` 头部:标题 + 当前卡片 / 模型 + 清空 / 设置 / 关闭 `),U(`header`,fF,[t[27]||=U(`span`,{class:`aichat__logo`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-sparkles`})])],-1),U(`span`,pF,[t[23]||=U(`span`,{class:`aichat__title`},`AI 开发助手`,-1),U(`span`,mF,[n.cardId?(B(),V(z,{key:0},[G(j(n.cardName||n.cardId),1)],64)):(B(),V(z,{key:1},[G(`未选择卡片`)],64)),i.config.model?(B(),V(z,{key:2},[G(` · `+j(i.config.model),1)],64)):K(`v-if`,!0)])]),U(`span`,hF,[K(` 紧凑视图(面板级):长任务里读取类调用能刷几十行,把写入与门禁挤到折叠线以下 `),U(`button`,{type:`button`,class:A([`aichat__iconbtn`,{"is-on":i.compactSteps}]),title:i.compactSteps?`紧凑视图已开启:已折叠读取类调用,点击显示全部步骤`:`只看关键步骤:折叠读取类调用(写入 / 跑脚本 / 报错始终显示)`,"aria-pressed":i.compactSteps?`true`:`false`,onClick:t[2]||=(...e)=>a.toggleCompact&&a.toggleCompact(...e)},[(B(),V(`svg`,_F,[U(`use`,{href:i.compactSteps?`#icon-eye-off`:`#icon-eye`},null,8,vF)]))],10,gF),U(`button`,{type:`button`,class:`aichat__iconbtn`,title:`清空本卡片对话记录`,disabled:!i.messages.length||i.busy,onClick:t[3]||=(...e)=>a.askClear&&a.askClear(...e)},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],8,yF),U(`button`,{type:`button`,class:`aichat__iconbtn`,title:`模型库`,onClick:t[4]||=(...e)=>a.openModelList&&a.openModelList(...e)},[...t[25]||=[U(`svg`,{class:`is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[U(`use`,{href:`#icon-model`})],-1)]]),U(`button`,{type:`button`,class:`aichat__iconbtn`,title:`关闭(Esc)`,onClick:t[5]||=t=>e.$emit(`close`)},[...t[26]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])])]),K(` 未配置模型:常驻提示条,一键打开设置 `),a.configReady?K(`v-if`,!0):(B(),V(`div`,bF,[t[28]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),t[29]||=U(`span`,null,`尚未配置模型,无法对话。`,-1),U(`button`,{type:`button`,class:`aichat__banner-btn`,onClick:t[6]||=(...e)=>a.openModelList&&a.openModelList(...e)},`去设置`)])),K(` 消息区:滚动容器与悬浮「回到底部」共处一个定位上下文,按钮只贴消息区底缘,
314
- 输入区拖高 / 反馈条出现都不会把它盖住或悬空 `),U(`div`,xF,[U(`div`,{ref:`listEl`,class:`aichat__list`,onScroll:t[10]||=(...e)=>a.onScroll&&a.onScroll(...e)},[K(` 体积治理痕迹:较早的工具结果被裁剪过就说清楚,别让人以为记录丢了 `),i.archiveTrimmed?(B(),V(`div`,SF,[...t[30]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-activity`})],-1),U(`span`,null,`较早的工具参数 / 结果已裁剪归档(对话正文与过程事件完整保留)`,-1)]])):K(`v-if`,!0),i.loadingHistory?(B(),V(`div`,CF,`正在加载对话记录…`)):i.messages.length?(B(),V(z,{key:3},[K(` compact = 面板级「只看关键步骤」;can-rollback 只对当前卡片、非流式中开放(切了卡再回滚会写错对象) `),(B(!0),V(z,null,R(i.messages,(e,r)=>(B(),H(o,{key:e.id,msg:e,streaming:i.busy&&r===i.messages.length-1,"can-regenerate":e.role===`assistant`&&r===i.messages.length-1,compact:i.compactSteps,"can-rollback":e.role===`assistant`&&!i.busy&&!!n.cardId,"now-ts":i.busy&&r===i.messages.length-1?i.nowTs:0,"pick-owner":a.pickOwnerRow,onRegenerate:a.regenerate,onApproval:a.onApproval,onContinue:a.onContinue,onRollback:a.onRollbackTurn,onOpenSettings:a.openModelList,onShowAllSteps:t[8]||=e=>a.setCompact(!1),onLocateNode:a.onLocateNode,onPickBoard:a.onPickBoard},null,8,[`msg`,`streaming`,`can-regenerate`,`compact`,`can-rollback`,`now-ts`,`pick-owner`,`onRegenerate`,`onApproval`,`onContinue`,`onRollback`,`onOpenSettings`,`onLocateNode`,`onPickBoard`]))),128)),K(` 面板级进度:步数 / 已用时长 / 建卡阶段 / 最近收到数据多久前。
315
- 长任务里「还活着吗」全靠这一行——旧版只有一句「生成中…」,网关静默与真在跑无从区分 `),i.busy?(B(),V(`div`,{key:0,class:A([`aichat__live`,{"is-stalled":a.stalled}]),role:`status`,"aria-live":`polite`},[t[33]||=U(`span`,{class:`aichat__live-dot`},null,-1),U(`span`,FF,j(a.liveText),1),a.stalled?(B(),V(`button`,{key:0,type:`button`,class:`aichat__live-act`,title:`连接可能已中断,终止本轮(已落盘的产物会保留)`,onClick:t[9]||=(...e)=>a.stop&&a.stop(...e)},` 终止 `)):K(`v-if`,!0)],2)):K(`v-if`,!0)],64)):(B(),V(`div`,wF,[t[32]||=U(`span`,{class:`aichat__empty-logo`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-sparkles`})])],-1),U(`p`,TF,j(a.emptyTitle),1),U(`p`,EF,j(a.emptyDesc),1),U(`div`,DF,[(B(!0),V(z,null,R(a.suggestions,e=>(B(),V(`button`,{key:e.id,type:`button`,class:A([`aichat__suggest`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(B(),V(`svg`,kF,[U(`use`,{href:e.icon},null,8,AF)])),U(`span`,jF,[U(`span`,MF,j(e.label),1),U(`span`,NF,j(e.hint),1)]),e.weight===`write`?(B(),V(`span`,PF,`改卡`)):K(`v-if`,!0)],10,OF))),128)),a.canShuffle?(B(),V(`button`,{key:0,type:`button`,class:`aichat__suggest-shuffle`,onClick:t[7]||=(...e)=>a.shuffleSuggestions&&a.shuffleSuggestions(...e)},[...t[31]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-refresh`})],-1),U(`span`,null,`换一批`,-1)]])):K(`v-if`,!0)])]))],544),K(` 回到底部:脱离底部吸附时出现 `),I(U(`button`,{type:`button`,class:`aichat__jump`,title:`回到底部`,onClick:t[11]||=e=>a.scrollToBottom(!0)},[...t[34]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-arrow-down`})],-1)]],512),[[Sc,!i.pinned&&i.messages.length]])]),K(` 常驻「常用」指令:有对话后空态建议区不再出现,这里保留一排轻量入口,随上下文同源 `),a.quickChips.length&&i.messages.length&&!i.busy?(B(),V(`div`,IF,[(B(!0),V(z,null,R(a.quickChips,e=>(B(),V(`button`,{key:e.id,type:`button`,class:A([`aichat__chip`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(B(),V(`svg`,RF,[U(`use`,{href:e.icon},null,8,zF)])),U(`span`,null,j(e.label),1)],10,LF))),128))])):K(`v-if`,!0),K(` 操作反馈(附件解析失败 / 历史保存失败等) `),i.notice?(B(),V(`div`,{key:2,class:A([`aichat__notice`,`aichat__notice--${i.notice.type}`])},[U(`span`,null,j(i.notice.text),1),U(`button`,{type:`button`,class:`aichat__notice-x`,title:`关闭`,onClick:t[12]||=e=>i.notice=null},[...t[35]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])],2)):K(`v-if`,!0),W(s,{ref:`composerEl`,busy:i.busy,model:i.config.model,attachments:i.draftAttachments,placeholder:a.configReady?`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`:`请先在设置中配置模型…`,context:i.contextUsage,onSend:a.onSend,onStop:a.stop,onPick:a.onPick,onAddPath:a.onAddPath,onRemoveAttachment:a.removeAttachment,onDropFiles:a.onDropFiles,onPasteImage:a.onPasteImage,onEscape:a.onEscape},null,8,[`busy`,`model`,`attachments`,`placeholder`,`context`,`onSend`,`onStop`,`onPick`,`onAddPath`,`onRemoveAttachment`,`onDropFiles`,`onPasteImage`,`onEscape`]),K(` 一级面板:模型库。从齿轮 / 横幅 / 消息内「去设置」进入 `),i.modelListOpen?(B(),H(c,{key:3,models:i.models,"active-id":i.activeId,"turn-running":i.turnRunning,onClose:a.closeModelList,onAdd:a.onModelAdd,onEdit:a.onModelEdit,onDelete:a.onModelDelete,onActivate:a.onModelActivate,onImportCcswitch:a.onImportCcSwitch,onOpenCommon:a.openCommon},null,8,[`models`,`active-id`,`turn-running`,`onClose`,`onAdd`,`onEdit`,`onDelete`,`onActivate`,`onImportCcswitch`,`onOpenCommon`])):K(`v-if`,!0),K(` 新增 / 编辑模型:复用 AiSettings(modelId 区分,initialModel 预填) `),i.modelEditOpen?(B(),H(l,{key:4,config:i.config,"model-id":i.editModelId,"initial-model":i.editInitialModel,onClose:a.onModelEditClose,onSaved:a.onModelSaved},null,8,[`config`,`model-id`,`initial-model`,`onClose`,`onSaved`])):K(`v-if`,!0),K(` 删除模型确认:二次确认后才真正落盘删除 `),W(u,{visible:!!i.confirmDeleteModel,"close-on-mask":!1,title:`删除模型`,message:a.deleteModelMessage,"confirm-text":`删除`,severity:`danger`,onConfirm:a.doDeleteModel,onCancel:t[13]||=e=>i.confirmDeleteModel=null},null,8,[`visible`,`message`,`onConfirm`]),K(` cc-switch 导入弹窗:列出 cc-switch 的 Codex 类供应商,勾选后批量导入模型库(按 model 去重) `),W(ic,{name:`modal`},{default:F(()=>[i.ccSwitchOpen?(B(),V(`div`,{key:0,class:`ni-overlay`,onClick:t[17]||=q(e=>i.ccSwitchOpen=!1,[`self`])},[U(`div`,BF,[U(`div`,VF,[t[36]||=U(`span`,{class:`ni-title`},`从 cc-switch 导入`,-1),U(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[14]||=e=>i.ccSwitchOpen=!1})]),U(`div`,HF,[U(`div`,UF,[K(` 加载中 `),i.ccSwitchLoading?(B(),V(`p`,WF,`正在读取 cc-switch 供应商…`)):i.ccSwitchReason?(B(),V(z,{key:1},[K(` 无可导入项 `),U(`p`,GF,j(i.ccSwitchReason),1)],2112)):(B(),V(z,{key:2},[K(` 供应商列表 `),U(`ul`,KF,[(B(!0),V(z,null,R(i.ccSwitchProviders,e=>(B(),V(`li`,{key:e.id,class:A([`ccsw-dlg__item`,{"is-active":i.ccSwitchSelected[e.id],"is-dup":e.duplicate}]),onClick:t=>a.toggleCcSwitchItem(e)},[U(`span`,{class:A([`ccsw-dlg__check`,{"is-on":i.ccSwitchSelected[e.id]}])},[i.ccSwitchSelected[e.id]?(B(),V(`svg`,JF,[...t[37]||=[U(`use`,{href:`#icon-check`},null,-1)]])):K(`v-if`,!0)],2),U(`span`,YF,[U(`span`,XF,[G(j(e.name||e.model)+` `,1),e.isCurrent?(B(),V(`span`,ZF,`当前`)):K(`v-if`,!0),e.duplicate?(B(),V(`span`,QF,`已存在`)):K(`v-if`,!0)]),U(`span`,$F,[U(`span`,eI,j(e.model),1),t[38]||=U(`span`,{class:`ccsw-dlg__dot`},`·`,-1),U(`span`,tI,j(e.baseUrl),1)])])],10,qF))),128))])],2112))])]),U(`div`,nI,[U(`span`,rI,j(a.ccSwitchDupCount>0?`已有 ${a.ccSwitchDupCount} 个重复模型被自动跳过`:`勾选要导入的供应商,批量加入模型库`),1),U(`div`,iI,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[15]||=e=>i.ccSwitchOpen=!1},`取消`),U(`button`,{class:`ni-btn`,type:`button`,disabled:i.ccSwitchLoading||!i.ccSwitchProviders.length||a.ccSwitchCheckedCount===0,onClick:t[16]||=(...e)=>a.confirmImportCcSwitch&&a.confirmImportCcSwitch(...e)},j(a.ccSwitchCheckedCount>0?`导入选中 ${a.ccSwitchCheckedCount} 项`:`导入`),9,aI)])])])])):K(`v-if`,!0)]),_:1}),K(` 通用设置:所有模型共享的执行策略 / 环境参数 `),i.commonOpen?(B(),H(d,{key:5,onClose:t[18]||=e=>i.commonOpen=!1,onSaved:a.onCommonSaved},null,8,[`onSaved`])):K(`v-if`,!0),W(u,{visible:i.confirmClear,"close-on-mask":!1,title:`清空对话记录`,message:`将删除卡片「${n.cardName||n.cardId||`当前卡片`}」的全部对话记录,此操作不可撤销。`,"confirm-text":`清空`,severity:`danger`,onConfirm:a.doClear,onCancel:t[19]||=e=>i.confirmClear=!1},null,8,[`visible`,`message`,`onConfirm`]),K(` 终止确认:生成中按 Esc 会走到这里。几十分钟的建卡被一次误按抹掉代价太大,故加一道确认 `),W(u,{visible:i.confirmStop,"close-on-mask":!1,title:`终止本次生成`,message:`已执行的写入与落盘产物都会保留,上下文也留在对话里,之后回复「继续」可从中断处接着做。确定现在终止?`,"confirm-text":`终止生成`,severity:`danger`,onConfirm:a.doStop,onCancel:t[20]||=e=>i.confirmStop=!1},null,8,[`visible`,`onConfirm`])],38)}var sI=X(dF,[[`render`,oI],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatPanel.vue`]]),cI=`/assets/site-icon-CFMif8z4.png`,lI={includeMocks:!0};function uI(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null}function dI(e){let t=uI(e);if(t&&t.dictionary&&Array.isArray(t.dictionary.inputParams)){let e=k_(t);for(let n of t.dictionary.inputParams)n&&typeof n==`object`&&!A_(e,n.key)&&(n.defaultValue=void 0)}return t}function fI(e,t){return!e||!t?e===t:JSON.stringify(dI(e))===JSON.stringify(dI(t))}function pI(e,t){return JSON.stringify(e)===JSON.stringify(t)}function mI(e,t){return!t||!e?!1:!fI(e,t)}function hI(e,t,n){return!t||!e?!1:!pI(e,n??O_(t,lI))}function gI(e,t,n,r){return!t||!e?!1:mI(e,t)||hI(n,t,r)}var _I={includeMocks:!0},vI=2500,yI=new eu,bI=au({},yI);typeof window<`u`&&(window.__rt=bI);var xI=188,SI=320,CI=200,wI=160,TI={name:`App`,components:{RenderTree:ap,DebugPanel:gb,ApiCallPanel:Mb,CardSelect:Xb,AlertCardLayer:ox,DeviceOverlay:Bx,PickerOverlay:Yx,DatePickerOverlay:uS,SelectionOverlay:mS,HoverGuides:bS,RemotePreview:cC,AppToast:hC,ImageLightbox:FC,ConfirmDialog:_p,CardGallery:nw,NewCardDialog:Sw,ComponentPalette:Lw,Switch:Vw,ChatPanel:sI},provide(){return{adapter:yI,cardRuntime:bI,customComponents:{}}},data(){return{adapter:yI,rt:bI,logoUrl:cI,appVersion:`0.60.0`,cardList:[],cardCount:0,galleryOpen:!1,cardDialog:{visible:!1,mode:`create`,cardId:``,cardDesc:``},selectedId:``,externalReloadNote:``,externalReloadTimer:null,selfSaveId:``,selfSaveAt:0,preview:null,chromeOff:!1,theme:`dark`,cardReady:!1,reloadToken:0,moveCollapseToken:0,refreshing:!1,loadingCard:!1,currentSchema:null,currentCard:null,cardImportMeta:null,localSchema:null,localData:null,selectedNodeId:``,activeTab:`vars`,apiPanelOpen:!0,addNodePanelOpen:!1,addNodeTarget:null,validateBadge:{state:`idle`,errors:0,warnings:0,renderOk:null,ts:0},validateTimer:null,savedCard:!1,savingCard:!1,saveTimer:null,coverBusy:!1,savingRemote:!1,savedRemote:!1,verifiedRemote:null,saveRemoteTimer:null,syncingRemote:!1,syncedRemote:!1,remotePreviewOpen:!1,syncTarget:null,syncTimer:null,uploadingSlices:!1,loginModal:!1,loginName:``,loginPassword:``,loginSubmitting:!1,loginError:``,confirm:{show:!1,title:``,message:``,confirmText:`继续`,cancelText:`取消`,severity:`primary`,onConfirm:null},past:[],future:[],baseline:null,_commitTimer:null,viewportHeight:700,canvasBg:`gray`,refreshing:!1,bgOptions:[{key:`checker`,label:`棋盘`},{key:`white`,label:`白色`},{key:`gray`,label:`浅灰`},{key:`black`,label:`黑色`}],_previewWidthPx:372,_apiPanelWidthPx:360,presetSizes:[{key:375,value:`375`},{key:430,value:`430`},{key:188,value:`188`}],stageWidth:typeof window<`u`?window.innerWidth:1280,colsWidth:0,stageHeight:typeof window<`u`?window.innerHeight-52:748,dragging:!1,apiDragging:!1,_stageObserver:null,devServiceOpen:!1,aiChatOpen:(()=>{try{return sessionStorage.getItem(`cardbuddy:ai-chat-open`)===`1`}catch{return!1}})(),chatBusy:!1,chatProgress:null,fab:{x:null,y:null,dragging:!1},fabDrag:null,fabSuppressClick:!1,devServiceForm:Nl(),apiBaseResolved:Fl(),devSvcLive:`unknown`,devSvcDown:!1,_unsubCardsChanged:null}},computed:{fabTitle(){if(this.aiChatOpen)return`AI 开发助手(已打开)`;if(!this.chatBusy)return`AI 开发助手`;let e=this.chatProgress,t=e&&e.startedAt?`${ek(e.startedAt)} 开始 · `:``;return`AI 开发助手正在生成(${e?`${t}第 ${e.steps} 步 · 已用 ${$O(e.ms)}${e.stage?` · ${e.stage}`:``}${e.stalled?` · 疑似断流`:``}`:``}),点击展开查看`},fabStyle(){return this.fab.x==null||this.fab.y==null?{}:{right:this.fab.x+`px`,bottom:this.fab.y+`px`,left:`auto`,top:`auto`,transition:this.fab.dragging?`none`:``}},currentBg(){return this.bgOptions.find(e=>e.key===this.canvasBg)||this.bgOptions[0]},cardIds(){return this.cardList.map(e=>e&&e.id).filter(Boolean)},canUndo(){return this.past.length>0},canRedo(){return this.future.length>0},devSvcBlockReason(){let e=this.devServiceForm||{};return String(e.baseUrl||``).trim()?e.enabled?null:`disabled`:`empty`},canPaste(){return!!Hu()},hasCardSource(){return!!(this.cardImportMeta&&this.cardImportMeta.source)},historyDirty(){return gI(this.currentSchema,this.localSchema,this.rt&&this.rt.rootScope,this.localData)},devSvcConn(){return this.apiBaseResolved===null?`unconfigured`:this.devSvcLive===`open`?`open`:this.devSvcDown?`closed`:`connecting`},devSvcTitle(){if(this.apiBaseResolved===null)return this.devSvcBlockReason===`disabled`?`已填地址但未开启用本地服务`:`未配置本地开发服务(部署态必填)`;let e=this.apiBaseResolved===``?`同源开发服务`:`本地开发服务`;return this.devSvcLive===`open`?e+`已连接`:this.devSvcDown?e+`已断开(连接失败或服务已停止,重连中…)`:e+`连接中 / 重连中…`},devSvcClass(){return this.apiBaseResolved===null?`app__btn--warn`:this.devSvcLive===`open`?`app__btn--connected`:this.devSvcDown?`app__btn--disconnected`:`app__btn--reconnecting`},devSvcLabel(){return this.apiBaseResolved===null?`未配置本地服务`:this.devSvcLive===`open`?`本地服务已连接`:this.devSvcDown?`本地服务已断开`:`本地服务连接中…`},badgeText(){return{idle:`待校验`,pending:`校验中…`,ok:`校验通过`,error:`校验未通过`,nopython:`未配置校验`,fail:`校验服务异常`}[this.validateBadge.state]||`待校验`},badgeTitle(){let e=this.validateBadge;if(e.state===`ok`)return`结构合法 + 渲染不抛错(不保证画得对,视觉正确性见截图)`;if(e.state===`error`){let t=[];return e.errors&&t.push(`契约错误 ${e.errors} 个`),e.renderOk===!1&&t.push(`渲染抛出异常`),`校验未通过:`+(t.join(`;`)||`详见 /__validate 与 /__render-status`)}return e.state===`nopython`?`未找到 python3/python,无法跑契约校验(请安装 Python 或设置 DSL_PYTHON)`:e.state===`fail`?`校验服务异常(dev server 未启动或端点不可用)`:``},previewWidth(){if(this.chromeOff)return this.stageWidth;let{min:e,max:t}=this.previewBounds,n=this._previewWidthPx||xI;return Math.max(e,Math.min(t,n))},viewportWidth(){return this.stageWidth,typeof window<`u`?window.innerWidth:1280},debugSoftWidth(){return Math.max(CI,Math.floor(this.viewportWidth/3))},previewBounds(){let e=this.stageWidth||0,t=Math.floor(e/2),n=e-SI-this.debugSoftWidth;return{min:xI,max:Math.max(xI,Math.min(t,n))}},debugMinWidth(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth);return Math.max(CI,Math.min(this.debugSoftWidth,Math.floor(e)-SI))},apiPanelBounds(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth),t=Math.max(wI,Math.floor(e)-this.debugMinWidth);return{min:Math.min(SI,t),max:t}},canvasW(){return Math.round(this.previewWidth||375)},selectedCardName(){let e=this.cardList.find(e=>e.id===this.selectedId);return e&&e.name||this.selectedId||``},cardEmpty(){let e=this.currentSchema;if(!e||!e.view)return!0;let t=e.view.components;return!Array.isArray(t)||t.length===0},apiPanelWidth(){let{min:e,max:t}=this.apiPanelBounds,n=this._apiPanelWidthPx||360;return Math.max(e,Math.min(t,n))},frameStyle(){return{}}},watch:{activeTab(e){e!==`structure`&&(this.selectedNodeId=``,_S())},aiChatOpen(e){try{sessionStorage.setItem(`cardbuddy:ai-chat-open`,e?`1`:`0`)}catch{}},theme(e){document.documentElement.dataset.theme=e},apiPanelOpen(e){try{localStorage.setItem(`cardbuddy:api-panel-open`,e?`1`:`0`)}catch{}}},beforeUnmount(){this.viewportObserver&&this.viewportObserver.disconnect(),this._stageObserver&&this._stageObserver.disconnect(),this.saveTimer&&clearTimeout(this.saveTimer),this.syncTimer&&clearTimeout(this.syncTimer),this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),window.removeEventListener(`keydown`,this.onKeydown)},mounted(){this.viewportObserver=new ResizeObserver(e=>{for(let t of e)this.viewportHeight=Math.round(t.contentRect.height)}),this.$refs.phoneViewport&&this.viewportObserver.observe(this.$refs.phoneViewport),this.loadPreviewWidth(),this.loadApiPanelWidth(),this._stageObserver=new ResizeObserver(e=>{for(let t of e){if(t.target===this.$refs.colsEl){this.colsWidth=Math.round(t.contentRect.width);continue}this.stageWidth=Math.round(t.contentRect.width),this.stageHeight=Math.round(t.contentRect.height)}}),this.$refs.stageEl&&this._stageObserver.observe(this.$refs.stageEl),this.$refs.colsEl&&this._stageObserver.observe(this.$refs.colsEl),window.addEventListener(`keydown`,this.onKeydown),this.fabInitPosition(),window.addEventListener(`resize`,this.onFabResize)},beforeDestroy(){window.removeEventListener(`resize`,this.onFabResize)},async created(){Ox(bI);let e=new URLSearchParams(location.search).get(`chrome`);this.chromeOff=e===`off`||e===``;try{let e=localStorage.getItem(`cardbuddy:theme`);(e===`light`||e===`dark`)&&(this.theme=e)}catch{}document.documentElement.dataset.theme=this.theme;try{localStorage.getItem(`cardbuddy:api-panel-open`)===`0`&&(this.apiPanelOpen=!1)}catch{}await this.fetchCardList();let t=new URLSearchParams(location.search).get(`card`),n=null;try{let e=localStorage.getItem(`cardbuddy:selected-card`);e&&this.cardList.some(t=>t.id===e)&&(n=e)}catch{}let r=t&&this.cardList.some(e=>e.id===t)?t:n||this.cardList[0]&&this.cardList[0].id;r&&(this.selectedId=r,await this.loadCard(this.selectedId)),this.$watch(()=>this.rt.rootScope,()=>{this.syncDataToSchema()},{deep:!0}),this.setupCardsChanged()},methods:{fabBounds(){let e=this.$refs.aiFab,t=e?e.offsetWidth:56,n=e?e.offsetHeight:56,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return{minX:0,minY:0,maxX:Math.max(0,r-t),maxY:Math.max(0,i-n)}},clampFab(e,t){let n=this.fabBounds();return[Math.min(Math.max(e,n.minX),n.maxX),Math.min(Math.max(t,n.minY),n.maxY)]},fabInitPosition(){let e=this.$refs.aiFab;if(!e)return;let t=this.loadFabPos(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i,a;if(t)[i,a]=this.clampFab(t.x,t.y);else{let t=e.getBoundingClientRect();[i,a]=this.clampFab(n-t.right,r-t.bottom)}this.fab.x=i,this.fab.y=a},loadFabPos(){try{let e=localStorage.getItem(`cardbuddy:ai-fab-pos`);if(!e)return null;let t=JSON.parse(e);if(typeof t.x==`number`&&typeof t.y==`number`&&isFinite(t.x)&&isFinite(t.y))return t}catch{}return null},saveFabPos(){try{localStorage.setItem(`cardbuddy:ai-fab-pos`,JSON.stringify({x:this.fab.x,y:this.fab.y}))}catch{}},onFabPointerDown(e){if(!this.aiChatOpen){this.fabSuppressClick=!1,this.fab.x??this.fabInitPosition(),this.fabDrag={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,originX:this.fab.x,originY:this.fab.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onFabPointerMove(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;if(!t.moved){if(Math.hypot(n,r)<4)return;t.moved=!0,this.fab.dragging=!0}let[i,a]=this.clampFab(t.originX-n,t.originY-r);this.fab.x=i,this.fab.y=a},onFabPointerUp(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId){this.fab.dragging=!1;return}try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}t.moved&&(this.fabSuppressClick=!0,this.saveFabPos()),this.fab.dragging=!1,this.fabDrag=null},onFabClick(){if(this.fabSuppressClick){this.fabSuppressClick=!1;return}this.aiChatOpen=!this.aiChatOpen},onFabResize(){if(this.fab.x==null)return;let[e,t]=this.clampFab(this.fab.x,this.fab.y);this.fab.x=e,this.fab.y=t},setupCardsChanged(){if(this._unsubCardsChanged){try{this._unsubCardsChanged()}catch{}this._unsubCardsChanged=null}this.devSvcLive=`connecting`,this._unsubCardsChanged=Vl(e=>this.onCardsChanged(e),e=>this.onDevServiceState(e))},onDevServiceState(e){let t=this.devSvcLive===`connecting`;this.devSvcLive=e,e===`open`?this.devSvcDown=!1:e===`closed`&&(this.devSvcDown=!0),e===`connecting`?!t&&!this._svcWatchdog&&(this._svcWatchdog=setTimeout(()=>{this.devSvcLive===`connecting`&&(this.devSvcLive=`closed`,this.devSvcDown=!0),this._svcWatchdog=null},8e3)):this._svcWatchdog&&=(clearTimeout(this._svcWatchdog),null)},saveDevService(){Pl(this.devServiceForm),this.apiBaseResolved=Fl(),this.setupCardsChanged(),this.devServiceOpen=!1,Z(`本地开发服务配置已保存`,`ok`),this.fetchCardList()},beginColumnDrag(e,t,n){let r=e&&e.currentTarget;if(!r)return;let i=e.pointerId;try{r.setPointerCapture(i)}catch{}let a=()=>{r.removeEventListener(`pointermove`,t),r.removeEventListener(`pointerup`,a),r.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{r.hasPointerCapture?.(i)&&r.releasePointerCapture(i)}catch{}document.body.style.cursor=``,document.body.style.userSelect=``,n()};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,r.addEventListener(`pointermove`,t),r.addEventListener(`pointerup`,a),r.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},startDrag(e){if(this.chromeOff)return;let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect().left;this.dragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(r,Math.round(e.clientX-n)))},()=>{this.dragging=!1,this.savePreviewWidth()})},startApiDrag(e){if(this.chromeOff||!this.apiPanelOpen)return;let t=this.$refs.colsEl;if(!t)return;let n=t.getBoundingClientRect().right;this.apiDragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.apiPanelBounds;this._apiPanelWidthPx=Math.max(t,Math.min(r,Math.round(n-e.clientX)))},()=>{this.apiDragging=!1,this.saveApiPanelWidth()})},loadPreviewWidth(){try{let e=localStorage.getItem(`cardbuddy:preview-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=188&&(this._previewWidthPx=t)}}catch{}},savePreviewWidth(){try{localStorage.setItem(`cardbuddy:preview-width`,String(Math.round(this._previewWidthPx)))}catch{}},setPresetWidth(e){if(this.chromeOff)return;let{min:t,max:n}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(n,e)),this.savePreviewWidth()},loadApiPanelWidth(){try{let e=localStorage.getItem(`cardbuddy:api-panel-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=320&&(this._apiPanelWidthPx=t)}}catch{}},saveApiPanelWidth(){try{localStorage.setItem(`cardbuddy:api-panel-width`,String(Math.round(this.apiPanelWidth)))}catch{}},chooseBg(e){this.canvasBg=e},onSelect(e){if(e!==this.selectedId){if(this.chatBusy){Z(`AI 正在生成「${this.selectedId}」:先点 ■ 停止,或等本轮结束后再切卡`,`err`,3600);return}this.loadingCard=!0,this.selectedId=e,this.loadCard(e,{clearAll:!0})}},selectCard(e){this.selectedId=e;try{localStorage.setItem(`cardbuddy:selected-card`,e)}catch{}},openGallery(){this.cardList.length&&(this.galleryOpen=!0)},openNewCard(){this.cardDialog.mode=`create`,this.cardDialog.cardId=``,this.cardDialog.cardDesc=``,this.cardDialog.visible=!0,this.fetchCardList()},openRenameCard(){this.selectedId&&(this.cardDialog.mode=`rename`,this.cardDialog.cardId=this.selectedId,this.cardDialog.cardDesc=this.currentSchema&&this.currentSchema.desc||``,this.cardDialog.visible=!0,this.fetchCardList())},async onCardRenamed({oldId:e,id:t}){if(this.cardDialog.visible=!1,Z(t===e?`已更新卡片描述`:`已重命名卡片 ${e} → ${t}`,`ok`),t!==e)return this.applyCardRename(e,t);await this.fetchCardList(),await this.loadCard(t)},async applyCardRename(e,t){if(!e||!t||e===t)return;let n=`${e}->${t}`;if(this._renameAppliedKey===n)return;this._renameAppliedKey=n,setTimeout(()=>{this._renameAppliedKey===n&&(this._renameAppliedKey=``)},1e3);let r=this.selectedId===e;if(this.$refs.chatPanel?.migrateCard(e,t),r&&this.selectCard(t),this.selfSaveId=t,this.selfSaveAt=Date.now(),await this.fetchCardList(),r){if(this.historyDirty&&!this.confirm.show){this.requestConfirm({title:`卡片已重命名`,message:`卡片「${e}」已重命名为「${t}」,而编辑器内还有未保存的改动。\n重新载入会放弃这些未保存改动并显示磁盘版本;保留改动则继续用当前编辑器内容(后续保存会写到新目录 ${t})。`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(t)});return}await this.loadCard(t)}},closeGallery(){this.galleryOpen=!1},async openCardFolder(){if(this.selectedId)try{let e=await J(`/__open-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:this.selectedId})}),t=(e.headers.get(`content-type`)||``).includes(`application/json`)?await e.json().catch(()=>({})):{};!e.ok||!t.ok?Z(t.error||`打开文件夹失败`,`err`):Z(`已打开卡片文件夹`,`ok`)}catch{Z(`无法连接本地开发服务,请确认已启动`,`err`)}},async refreshCard(){if(!(!this.selectedId||this.refreshing)){this.refreshing=!0;try{await this.loadCard(this.selectedId)}finally{this.refreshing=!1}}},toggleTheme(){this.theme=this.theme===`light`?`dark`:`light`;try{localStorage.setItem(`cardbuddy:theme`,this.theme)}catch{}},toggleApiPanel(){this.apiPanelOpen=!this.apiPanelOpen},async refreshValidateBadge(){let e=this.selectedId;if(!(!e||!this.preview)&&(this.validateTimer&&clearTimeout(this.validateTimer),this.validateBadge={...this.validateBadge,state:`pending`},await new Promise(e=>{this.validateTimer=setTimeout(e,120)}),this.selectedId===e))try{let[t,n]=await Promise.all([J(`/__validate/${encodeURIComponent(e)}`),J(`/__render-status/${encodeURIComponent(e)}`)]);if(!t.ok){this.validateBadge={...this.validateBadge,state:t.status===503?`nopython`:`fail`};return}let r=await t.json().catch(()=>null),i=n.ok?await n.json().catch(()=>null):null;if(!r){this.validateBadge={...this.validateBadge,state:`fail`};return}let a=!!r.ok,o=!i||!!i.renderOk,s=a&&o?`ok`:`error`,c=this.validateBadge.state!==s;this.validateBadge={state:s,errors:(r.errors||[]).length,warnings:(r.warnings||[]).length,renderOk:o,ts:Date.now()},c&&(s===`ok`||s===`error`)&&this.celebrateValidate(s)}catch{this.validateBadge={...this.validateBadge,state:`fail`}}},celebrateValidate(e=`ok`){let t=this.$refs.validateBadgeEl;if(!t||window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;t.classList.remove(`is-celebrating`),t.offsetWidth,t.classList.add(`is-celebrating`),setTimeout(()=>t.classList.remove(`is-celebrating`),600);let n=t.getBoundingClientRect(),r={ok:`--ok`,error:`--danger`,pending:`--warn`,fail:`--text-faint`,nopython:`--text-faint`}[e]||`--ok`,i={ok:`#52c41a`,error:`#F5222D`,pending:`#FAAD14`,fail:`#8c8c8c`,nopython:`#8c8c8c`}[e]||`#52c41a`,a=getComputedStyle(t).getPropertyValue(r).trim()||i,o=document.createElement(`div`);o.className=`app__confetti`,o.style.left=n.left+n.width/2+`px`,o.style.top=n.top+n.height/2+`px`;let s=[`polygon(50% 0%, 0% 100%, 100% 100%)`,`polygon(62% 0%, 100% 40%, 45% 100%, 0% 52%)`,`polygon(0% 0%, 100% 18%, 82% 100%, 12% 70%)`,`polygon(22% 0%, 100% 8%, 88% 100%, 0% 76%)`,`polygon(0% 32%, 100% 0%, 76% 100%, 18% 86%)`,`polygon(8% 0%, 100% 22%, 70% 100%, 0% 64%)`,`polygon(0% 12%, 100% 0%, 100% 78%, 30% 100%, 12% 55%)`],c=n.width/2,l=n.height/2;for(let e=0;e<22;e++){let e=document.createElement(`span`);e.className=`app__confetti-bit`;let t=Math.random()*4|0,n,r;t===0?(n=(Math.random()*2-1)*c,r=-l):t===1?(n=c,r=(Math.random()*2-1)*l):t===2?(n=(Math.random()*2-1)*c,r=l):(n=-c,r=(Math.random()*2-1)*l);let i=Math.hypot(n,r)||1,u=Math.atan2(r/i,n/i)+(Math.random()-.5)*.5,d=16+Math.random()*26;e.style.setProperty(`--sx`,n.toFixed(1)+`px`),e.style.setProperty(`--sy`,r.toFixed(1)+`px`),e.style.setProperty(`--tx`,(Math.cos(u)*d).toFixed(1)+`px`),e.style.setProperty(`--ty`,(Math.sin(u)*d).toFixed(1)+`px`),e.style.setProperty(`--rot`,(Math.random()*720-360).toFixed(0)+`deg`),e.style.setProperty(`--clip`,s[Math.random()*s.length|0]),e.style.setProperty(`--c`,a),e.style.setProperty(`--o`,(.68+Math.random()*.27).toFixed(2));let f=Math.random(),p,m;f<.35?(p=1.5+Math.random()*2,m=10+Math.random()*10):f<.75?(p=4+Math.random()*5,m=p*(.6+Math.random()*.8)):(p=2+Math.random()*2.5,m=p),e.style.width=p.toFixed(0)+`px`,e.style.height=m.toFixed(0)+`px`,o.appendChild(e)}document.body.appendChild(o),setTimeout(()=>o.remove(),800)},async loadCard(e,t={}){if(e){this.loadingCard=!0;try{let n=await J(`/__card/${encodeURIComponent(e)}`);if(!n.ok){this.rt.pushError(`loadCard`,`HTTP `+n.status);return}let r=await n.json();if(!r.schema){this.rt.pushError(`loadCard`,`schema 读取失败`);return}this.selectCard(e),t.clearAll?this.rt.clearErrors():this.rt.clearBindingErrors(),this.rt.clearApiCalls(),t.keepScope||this.rt.setRootScope(O_(r.schema,_I)),this.currentCard={schema:r.schema},this.currentSchema=r.schema,this.cardImportMeta=null,this.fetchImportMeta(e),this.localSchema=this.cloneSchema(r.schema),this.localData=this.cloneData(O_(r.schema,_I)),this.preview=Pu(r.schema),typeof window<`u`&&(window.__cardModel=Bu(r.schema)),this.cardReady=!1,this.$nextTick(()=>{this.cardReady=!0}),this.syncDataToSchema(),this.selectedNodeId=``,this.baseline={schema:this.cloneSchema(this.currentSchema)},this.reloadToken+=1,nx(),kx(),this.refreshValidateBadge(),await this.loadHistory(e)}finally{this.loadingCard=!1}}},cloneSchema(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null},cloneData(e){return e==null?e:JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t))},applySchemaSnapshot(e){if(!this.selectedId||!e)return;let t=e.schema||e,n=e.data==null?O_(t,_I):e.data;this.currentSchema=this.cloneSchema(t),this.rt.setRootScope(this.cloneData(n)),this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.reloadToken+=1,this.refreshValidateBadge()},commitHistory(){if(!this.currentSchema||!this.baseline||!gI(this.currentSchema,this.baseline.schema,this.rt.rootScope))return;let e={schema:this.baseline.schema};this.past.push(e),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(this.currentSchema)},this.persistSnapshot(e)},scheduleCommit(){this._commitTimer&&clearTimeout(this._commitTimer),this._commitTimer=setTimeout(()=>{this._commitTimer=null,this.commitHistory()},500)},persistSnapshot(e){let t=this.selectedId;if(!t)return;let n=e.schema||e;J(`/__history/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({schema:n},(e,t)=>e===`_schemaNode`?void 0:t,2)}).catch(e=>console.warn(`[历史快照落盘失败]`,e))},async loadHistory(e){this.past=[],this.future=[];try{let t=await J(`/__history/${encodeURIComponent(e)}`);if(!t.ok)return;let n=await t.json().catch(()=>null),r=n&&n.snapshots||[];this.past=r.slice(-30).map(e=>({schema:e.schema,data:e.data==null?O_(e.schema,_I):e.data}))}catch(e){console.warn(`[加载编辑历史失败]`,e)}},undo(){if(!this.canUndo)return;let e=this.past.pop();this.future.push(this.baseline),this.future.length>30&&this.future.shift(),this.baseline=e,this.applySchemaSnapshot(e)},redo(){if(!this.canRedo)return;let e=this.future.pop();this.past.push(this.baseline),this.past.length>30&&this.past.shift(),this.baseline=e,this.applySchemaSnapshot(e)},async applyHistoryToLocal(){this.loadingCard||!this.historyDirty||!this.preview||!this.selectedId||await this.saveCard()&&Z(`已将该版本保存到本地`,`ok`)},async generateCardCover(){if(!this.preview||!this.selectedId||this.coverBusy)return;if(this.historyDirty&&!await this.saveCard()){Z(`本地保存失败,已取消生成预览图`,`err`);return}let e=null;try{let t=await J(`/__card-image/`+encodeURIComponent(this.selectedId)+`?probe=1`),n=await t.json().catch(()=>({}));t.ok&&n.exists&&(e=n.file)}catch{}if(e){this.requestConfirm({title:`重新生成截图`,message:`该卡片已有截图(${e}),继续将覆盖它。确定重新生成吗?`,confirmText:`重新生成`,severity:`warn`,onConfirm:()=>this.doGenerateCover()});return}this.doGenerateCover()},async doGenerateCover(){this.coverBusy=!0;try{let e=await J(`/__card-image/`+encodeURIComponent(this.selectedId),{method:`POST`}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.message||`HTTP `+e.status);Z(`截图已生成(${t.width}×${t.height})→ ${t.file}`,`ok`,3e3)}catch(e){Z(`生成截图失败:`+String(e&&e.message||e),`err`,3600)}finally{this.coverBusy=!1}},onSchemaChanged(){!this.selectedId||!this.currentSchema||(this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``)},onSchemaCommit(){!this.selectedId||!this.currentSchema||(this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.commitHistory())},syncDataToSchema(){let e=this.currentSchema;if(!e||!e.dictionary||!Array.isArray(e.dictionary.inputParams))return;let t=this.rt&&this.rt.rootScope;if(!t||typeof t!=`object`)return;let n=e.dictionary.inputParams,r=k_(e);for(let e of Object.keys(t)){let i=n.find(t=>t&&(t.key===e||t.name===e));if(!i)continue;let a=JSON.parse(JSON.stringify(t[e],(e,t)=>e===`_schemaNode`?void 0:t));r&&Object.prototype.hasOwnProperty.call(r,e)?r[e]=a:i.defaultValue=a}},onSelectNode(e){this.selectedNodeId=e||``},findPreviewNodeById(e,t){if(!e||t==null)return null;let n=String(t),r=e=>{if(!e)return null;if(String(e.id)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(e)},copySelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(Wu(n.node,this.selectedId),Z(`已复制节点(含子节点)`,`ok`))},pasteNode(){let e=Hu();if(!e||!this.currentSchema)return;let t=Gu(e),n=[...new Set(t.filter(e=>!vu[e]))];if(n.length){Z(`粘贴失败:含未知组件类型 `+n.join(`、`),`err`);return}let r=JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t));Ku(r);let i=this.selectedNodeId&&this.selectedNodeId!==`_root`?this.findPreviewNodeById(this.preview.view,this.selectedNodeId):null,a=`root`;i&&(a=ju(i.className)?`into`:`after`),this.insertClone(r,i,a);let o=Uu();o&&o!==this.selectedId?Z(`已从卡片「${o}」跨卡片粘贴到「${this.selectedId}」`,`ok`):Z(`已粘贴节点(含子节点)`,`ok`)},duplicateNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);if(!n)return;let r=JSON.parse(JSON.stringify(n.node,(e,t)=>e===`_schemaNode`?void 0:t));Ku(r),n.parentArr.splice(n.index+1,0,r),this.afterStructuralEdit(r.componentId)},insertClone(e,t,n){let r=this.currentSchema;if(n===`root`)r.view.components||(r.view.components=[]),r.view.components.push(e);else if(n===`into`){let n=t&&t._schemaNode;if(!n){r.view.components||(r.view.components=[]),r.view.components.push(e),this.afterStructuralEdit(e.componentId);return}let i=Mu(t.className),a=(n.slots||[]).find(e=>e.slotKey===i);a||(n.slots||=[],a={slotKey:i,slotScope:!1,slotSwitch:`1`,components:[]},n.slots.push(a)),a.components||(a.components=[]),a.components.push(e)}else{let n=this.findSchemaNodeByComponentId(r.view,t.componentId);n?n.parentArr.splice(n.index+1,0,e):(r.view.components||(r.view.components=[]),r.view.components.push(e))}this.afterStructuralEdit(e.componentId)},afterStructuralEdit(e){let t=this.currentSchema;this.reloadToken+=1,this.preview=Pu(t),typeof window<`u`&&(window.__cardModel=Bu(t)),this.syncDataToSchema(),this.selectedNodeId=e&&this.findViewIdByComponentId(this.preview.view,e)||``,this.scheduleCommit()},deleteSelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(n.parentArr.splice(n.index,1),this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,_S(),this.scheduleCommit())},hasTextSelection(){if(typeof window>`u`||!window.getSelection)return!1;let e=window.getSelection();return!!e&&!e.isCollapsed&&e.toString().trim()!==``},hasNodeSelection(){return!!this.selectedNodeId&&this.selectedNodeId!==`_root`},isEditableTarget(e){let t=e.target;if(!t)return!1;let n=t.tagName;return!!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable)},onKeydown(e){if(this.chromeOff||!this.preview)return;let t=this.isEditableTarget(e),n=e.ctrlKey||e.metaKey,r=e.key;if(n&&(r===`c`||r===`C`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.copySelectedNode(),e.preventDefault();return}if(n&&(r===`v`||r===`V`)){if(t||this.hasTextSelection()||!this.hasNodeSelection()||!Hu())return;this.pasteNode(),e.preventDefault();return}if(n&&(r===`d`||r===`D`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.duplicateNode(),e.preventDefault();return}if(n&&(r===`z`||r===`Z`)){if(t)return;e.preventDefault(),e.shiftKey?this.redo():this.undo();return}if(n&&(r===`y`||r===`Y`)){if(t)return;e.preventDefault(),this.redo();return}if(r===`Delete`||r===`Backspace`){if(t||!this.selectedNodeId||this.selectedNodeId===`_root`)return;e.preventDefault(),this.deleteSelectedNode();return}if(r===`Escape`){this.selectedNodeId&&(this.selectedNodeId=``,e.preventDefault());return}},onHoverNode(e){if(!e){_S();return}if(e.leave){_S(e.id);return}let t=typeof document<`u`?document.querySelector(`.phone__screen`):null;if(!t){_S(e.id);return}let n=e=>window.CSS&&CSS.escape?CSS.escape(String(e)):String(e).replace(/["\\\]]/g,`\\$&`),r=null;e.componentId!=null&&(r=t.querySelector(`[data-cid="`+n(e.componentId)+`"]`)),!r&&e.id!=null&&(r=t.querySelector(`[data-cid="`+n(e.id)+`"]`)),r?gS(r,e.id):_S(e.id)},onCanvasClick(e){if(!e.ctrlKey&&!e.metaKey||this.chromeOff)return;let t=e.target&&e.target.closest?e.target.closest(`[data-cid]`):null;if(!t)return;let n=t.getAttribute(`data-cid`);if(!n)return;let r=this.findPreviewNodeByCid(n);r&&(this.activeTab=`structure`,this.selectedNodeId=r.id)},onAiLocateNode(e){let t=e?this.findPreviewNodeByCid(e):null;if(!t){Z(`没找到组件 ${e||``}:卡片可能已被改动,重新校验一次即可`,`err`);return}this.activeTab=`structure`,this.selectedNodeId=t.id},findPreviewNodeByCid(e){let t=this.preview&&this.preview.view;if(!t)return null;let n=String(e),r=e=>{if(!e)return null;if(String(e.componentId==null?e.id:e.componentId)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(t)},onAddNode(e){this.currentSchema&&(this.addNodeTarget=e||null,this.addNodePanelOpen=!0)},cancelAddNode(){this.addNodePanelOpen=!1,this.addNodeTarget=null},findSchemaLocation(e,t){let n=e=>{for(let r=0;r<e.length;r++){let i=e[r];if(i===t)return{containerArr:e,index:r};let a=i.slots||[];for(let e of a){let t=n(e.components||[]);if(t)return t}}return null};return n(e&&e.components||[])},findViewIdByComponentId(e,t){if(!e)return null;if(e.componentId===t)return e.id;let n=[];if(e.components&&n.push(...e.components),e.slots)for(let t of e.slots)t.components&&n.push(...t.components);for(let e of n){let n=this.findViewIdByComponentId(e,t);if(n)return n}return null},findSchemaNodeByComponentId(e,t){let n=(e,r)=>{for(let i=0;i<e.length;i++){let a=e[i];if(a.componentId===t)return{node:a,parentArr:e,index:i,owner:r};let o=a.slots||[];for(let e of o){let t=n(e.components||[],a);if(t)return t}}return null};return n(e&&e.components||[],`root`)},isDescendantCompId(e,t){if(!t||!t.componentId)return!1;if(t.componentId===e)return!0;let n=[];if(t.components&&n.push(...t.components),t.slots)for(let e of t.slots)e.components&&n.push(...e.components);for(let t of n)if(this.isDescendantCompId(e,t))return!0;return!1},moveNode(e,t,n){let r=this.currentSchema;if(!r||!r.view||e===t)return!1;let i=this.findSchemaNodeByComponentId(r.view,e);if(!i)return!1;let a=i.node;if(this.isDescendantCompId(t,a))return!1;let o,s;if(t===`__root__`)r.view.components||(r.view.components=[]),o=r.view.components,s=o.length;else{let e=this.findSchemaNodeByComponentId(r.view,t);if(!e)return!1;let i=e.node;if(n===`inside`){if(!ju(i.className))return!1;let e=Mu(i.className),t=(i.slots||[]).find(t=>t.slotKey===e);t||(i.slots||=[],t={slotKey:e,slotScope:!1,slotSwitch:`1`,components:[]},i.slots.push(t)),t.components||(t.components=[]),o=t.components,s=o.length}else o=e.parentArr,s=n===`before`?e.index:e.index+1}let c=o===i.parentArr&&i.index<s;return i.parentArr.splice(i.index,1),c&&--s,o.splice(s,0,a),a},onMoveNode({sourceCompId:e,targetCompId:t,position:n}){if(!this.currentSchema||!this.moveNode(e,t,n))return;this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema();let r=this.findViewIdByComponentId(this.preview.view,e);this.selectedNodeId=r||``,r&&(this.moveCollapseToken+=1)},onPickComponent(e){let t=this.addNodeTarget||{},n=t.node||null,r=t.mode||`auto`,i=this.currentSchema;if(!i){this.cancelAddNode();return}let a;try{a=Nu(e)}catch(e){console.error(`[创建组件节点失败]`,e),this.rt.pushError(`addNode`,String(e&&e.message)),this.cancelAddNode();return}let o=!n||n.className===`Root`;if((r===`before`||r===`after`)&&!o){let e=n._schemaNode,t=e?this.findSchemaLocation(i.view,e):null;if(!t)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=r===`before`?t.index:t.index+1;t.containerArr.splice(e,0,a)}}else if(o)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=n._schemaNode;if(!e){this.cancelAddNode();return}if(ju(n.className)){let t=Mu(n.className),r=(e.slots||[]).find(e=>e.slotKey===t);r||(e.slots||=[],r={slotKey:t,slotScope:!1,slotSwitch:`1`,components:[]},e.slots.push(r)),r.components||(r.components=[]),r.components.push(a)}else{let t=this.findSchemaLocation(i.view,e);t?t.containerArr.splice(t.index+1,0,a):(i.view.components||(i.view.components=[]),i.view.components.push(a))}}this.cancelAddNode(),this.reloadToken+=1,this.preview=Pu(i),typeof window<`u`&&(window.__cardModel=Bu(i)),this.syncDataToSchema();let s=this.findViewIdByComponentId(this.preview.view,a.componentId);this.selectedNodeId=s||``,this.scheduleCommit()},async runSync(e){if(!this.syncingRemote&&!(e&&!this.selectedId)){this.syncingRemote=!0,this.syncedRemote=!1,this.syncTarget=e?`selected`:`full`;try{let t=await J(`/__sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{cardCode:e}:{})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(n.needCredentials){this.openLoginModal();return}if(!n.success){let e=(n.failed||[]).map(e=>`${e.id}: ${e.error}`).join(`; `);throw Error(e||`同步失败`)}this.syncedRemote=!0,this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncedRemote=!1,this.syncTarget=null},1800),await this.onRefresh(),Z(this.syncTarget===`selected`?`已拉取最新卡到本地`:`拉取全部卡完成`,`ok`)}catch(e){console.error(`[同步远程数据失败]`,e),Z(`同步失败:`+(e&&e.message),`err`)}finally{this.syncingRemote=!1}}},syncRemote(){return this.runSync()},syncSelected(){return this.runSync(this.selectedId)},openLoginModal(){this.loginModal=!0,this.loginName=``,this.loginPassword=``,this.loginError=``},closeLoginModal(){this.loginSubmitting||(this.loginModal=!1,this.loginPassword=``,this.loginError=``)},async submitLogin(){if(this.loginSubmitting)return;let e=this.loginName.trim(),t=this.loginPassword;if(!e||!t){this.loginError=`账号与密码均不能为空`;return}this.loginSubmitting=!0,this.loginError=``;try{let n=await J(`/__login-credentials`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({loginName:e,loginPassword:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw Error(r.message||r.error||`HTTP `+n.status);this.loginModal=!1,this.loginPassword=``,Z(`凭据已保存,正在重试同步…`,`ok`),await this.runSync(this.syncTarget===`selected`?this.selectedId:void 0)}catch(e){this.loginError=`保存失败:`+(e&&e.message)}finally{this.loginSubmitting=!1}},chooseSync(e){if(e===`full`){if(this.syncingRemote)return;this.requestConfirm({title:`拉取全部卡`,message:`即将从远端 FinMall 拉取完整卡片列表,并逐张覆盖本地同名卡片。本地独有卡片会保留,但被覆盖卡片的未保存改动将丢失,且无法撤销。是否继续?`,confirmText:`继续同步`,severity:`warn`,onConfirm:()=>this.syncRemote()});return}!this.preview||!this.selectedId||this.syncingRemote||this.requestConfirm({title:`拉取最新卡`,message:`即将从远端 FinMall 拉取当前卡片「${this.selectedId}」的最新版本并覆盖本地。本地未保存的改动将丢失,且无法撤销。是否继续?`,confirmText:`继续同步`,onConfirm:()=>this.syncSelected()})},chooseRsave(e){if(e===`save`){if(!this.preview||!this.selectedId||this.savingRemote||!this.hasCardSource)return;this.requestConfirm({title:`推送当前卡`,message:`即将把本地卡片「${this.selectedId}」的当前版本推送并覆盖到远端 FinMall。线上版本会被立即更新,且该操作不可撤销。是否继续?`,confirmText:`继续推送`,severity:`warn`,onConfirm:()=>this.saveToRemote()});return}if(e===`slices`){if(!this.preview||!this.selectedId||this.uploadingSlices)return;this.requestConfirm({title:`当前卡切图上传`,message:`即将把当前卡片「${this.selectedId}」引用的本地切图(src/slices/)上传到 FinMall 图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…)。本地切图文件保留不动;内容未变的切图会直接复用已有线上地址,不重复上传。`+(this.historyDirty?`
315
+ `)}`}return{role:`user`,content:n}}let t=(e.toolCalls||[]).filter(e=>e.result!==void 0||e.error).map(e=>({toolCallId:e.toolCallId,toolName:e.toolName,args:e.args||{},result:typeof e.result==`string`?nF(e.toolName,e.result):e.result,error:e.error||``})),n=e.content||``;return e.status===`aborted`&&(n=n?`${n}\n\n[本轮生成被用户手动中止,以上为已完成部分;未完成的步骤没有执行,请从中断处继续。]`:`[上一轮被用户手动中止于思考/工具阶段,没有产出可用内容;请重新规划并继续完成用户的目标。]`),{role:`assistant`,content:n,toolCalls:t}})},onScroll(){let e=this.$refs.listEl;e&&(this.pinned=e.scrollHeight-e.scrollTop-e.clientHeight<48)},scrollToBottom(e=!1){let t=this.$refs.listEl;t&&(!e&&!this.pinned||(t.scrollTop=t.scrollHeight))},stopTickers(){this._saveTimer&&clearTimeout(this._saveTimer),this._saveTimer=0},startTurn(){let e=Date.now();this.turnId=``,this.lastSeq=0,this.turnStep=0,this.turnStage=null,this.turnToolLabel=``,this.turnStartedAt=e,this.lastByteAt=e,this.nowTs=e,this.stopTurnTimers(),this._liveTicker=setInterval(()=>{this.nowTs=Date.now(),this.$emit(`turn-progress`,{steps:this.turnStep,startedAt:this.turnStartedAt,ms:this.nowTs-this.turnStartedAt,stage:this.turnStage?`${this.turnStage.id} ${this.turnStage.label}`:this.turnToolLabel,stalled:this.stalled})},1e3),this._turnPersistTimer=setInterval(()=>this.persist(),8e3),this.persist(),this.$emit(`busy`,!0)},stopTurnTimers(){this._liveTicker&&clearInterval(this._liveTicker),this._liveTicker=0,this._turnPersistTimer&&clearInterval(this._turnPersistTimer),this._turnPersistTimer=0},onPagehide(){let e=this.cardId;if(!e||!this.messages.length)return;let t=this.fitArchive(this.serialize());this._dirtyFor=null,this._saveTimer&&=(clearTimeout(this._saveTimer),0),SA(e,t,{keepalive:!0}).catch(()=>{})},fmtClock:ck,pushEvent(e,t){let n=String(t&&t.message||``);!n||!e||(Array.isArray(e.events)||(e.events=[]),e.events.push({ts:Date.now(),level:t.level||`warn`,code:t.code||``,message:n}))},applyUsage(e,t){if(!e||!t)return;let n=e=>Number.isFinite(Number(e))?Number(e):0;e.usage={steps:n(t.steps),promptTokens:n(t.promptTokens),completionTokens:n(t.completionTokens),cachedTokens:n(t.cachedTokens),cacheMissTokens:n(t.cacheMissTokens),hitRate:n(t.hitRate),reported:t.reported!==!1}},loadCompact(){try{this.compactSteps=localStorage.getItem(pF)===`1`}catch{}},setCompact(e){let t=!!e;if(this.compactSteps!==t){this.compactSteps=t;try{t?localStorage.setItem(pF,`1`):localStorage.removeItem(pF)}catch{}this.$nextTick(()=>this.scrollToBottom())}},toggleCompact(){this.setCompact(!this.compactSteps)},onLocateNode(e){e&&this.$emit(`locate-node`,String(e))},onRollbackTurn(e){if(this.busy)return;let t=this.cardId;!t||!e||this.$emit(`rollback-turn`,{cardId:t,ts:Number(e.ts)||0,msgId:e.id})},notify(e,t){this.notice={type:e,text:t},this._noticeTimer&&clearTimeout(this._noticeTimer),this._noticeTimer=setTimeout(()=>{this.notice=null},6e3)}}},xF={class:`aichat__head`},SF={class:`aichat__titles`},CF={class:`aichat__sub`},wF={class:`aichat__acts`},TF=[`title`,`aria-pressed`],EF={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},DF=[`href`],OF=[`disabled`],kF={key:0,class:`aichat__banner`},AF={class:`aichat__scroll`},jF={key:0,class:`aichat__archnote`,title:`长对话记录超出落盘体积上限时,较早的工具参数与结果会被裁剪归档;正文、思考与过程事件都完整保留`},MF={key:1,class:`aichat__loading`},NF={key:2,class:`aichat__empty`},PF={class:`aichat__empty-title`},FF={class:`aichat__empty-desc`},IF={class:`aichat__suggests`},LF=[`title`,`data-suggest-id`,`onClick`],RF={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},zF=[`href`],BF={class:`aichat__suggest-text`},VF={class:`aichat__suggest-label`},HF={class:`aichat__suggest-hint`},UF={key:0,class:`aichat__suggest-badge`,title:`该操作会改动卡片`},WF={class:`aichat__live-text`},GF={key:1,class:`aichat__quick`},KF=[`title`,`data-suggest-id`,`onClick`],qF={viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},JF=[`href`],YF={class:`ni-panel modal-card ccsw-dlg`,role:`dialog`,"aria-modal":`true`,"aria-label":`从 cc-switch 导入模型`},XF={class:`ni-head`},ZF={class:`ni-body`},QF={class:`ni-scroll`},$F={key:0,class:`ccsw-dlg__msg`},eI={class:`ccsw-dlg__msg ccsw-dlg__msg--err`},tI={class:`ccsw-dlg__list`},nI=[`onClick`],rI={key:0,viewBox:`0 0 16 16`,fill:`none`,stroke:`currentColor`,"stroke-width":`1.8`,"stroke-linecap":`round`,"stroke-linejoin":`round`},iI={class:`ccsw-dlg__info`},aI={class:`ccsw-dlg__name`},oI={key:0,class:`ccsw-dlg__badge ccsw-dlg__badge--cur`,title:`cc-switch 中当前生效`},sI={key:1,class:`ccsw-dlg__badge ccsw-dlg__badge--dup`,title:`模型库中已存在同名模型`},cI={class:`ccsw-dlg__meta`},lI={class:`ccsw-dlg__model`},uI={class:`ccsw-dlg__host`},dI={class:`ni-foot`},fI={class:`ni-tip`},pI={class:`ni-foot-btns`},mI=[`disabled`];function hI(e,t,n,r,i,a){let o=L(`ChatMessage`),s=L(`ChatComposer`),c=L(`ModelList`),l=L(`AiSettings`),u=L(`ConfirmDialog`),d=L(`AiCommonSettings`);return B(),V(`aside`,{class:A([`aichat`,{"is-open":n.visible}]),style:k(a.panelStyle),role:`complementary`,"aria-label":`AI 开发助手`,onKeydown:t[21]||=vl((...e)=>a.onEscape&&a.onEscape(...e),[`esc`]),onClick:t[22]||=(...e)=>a.onImageClick&&a.onImageClick(...e)},[K(` 左缘拖拽把手:调宽(双击恢复默认 33%) `),U(`div`,{class:A([`aichat__grip`,{"is-dragging":i.resizing}]),title:`拖拽调整宽度(双击恢复默认)`,onPointerdown:t[0]||=q((...e)=>a.startResize&&a.startResize(...e),[`prevent`]),onDblclick:t[1]||=q((...e)=>a.resetWidth&&a.resetWidth(...e),[`prevent`])},null,34),K(` 头部:标题 + 当前卡片 / 模型 + 清空 / 设置 / 关闭 `),U(`header`,xF,[t[27]||=U(`span`,{class:`aichat__logo`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-sparkles`})])],-1),U(`span`,SF,[t[23]||=U(`span`,{class:`aichat__title`},`AI 开发助手`,-1),U(`span`,CF,[n.cardId?(B(),V(z,{key:0},[G(j(n.cardName||n.cardId),1)],64)):(B(),V(z,{key:1},[G(`未选择卡片`)],64)),i.config.model?(B(),V(z,{key:2},[G(` · `+j(i.config.model),1)],64)):K(`v-if`,!0)])]),U(`span`,wF,[K(` 紧凑视图(面板级):长任务里读取类调用能刷几十行,把写入与门禁挤到折叠线以下 `),U(`button`,{type:`button`,class:A([`aichat__iconbtn`,{"is-on":i.compactSteps}]),title:i.compactSteps?`紧凑视图已开启:已折叠读取类调用,点击显示全部步骤`:`只看关键步骤:折叠读取类调用(写入 / 跑脚本 / 报错始终显示)`,"aria-pressed":i.compactSteps?`true`:`false`,onClick:t[2]||=(...e)=>a.toggleCompact&&a.toggleCompact(...e)},[(B(),V(`svg`,EF,[U(`use`,{href:i.compactSteps?`#icon-eye-off`:`#icon-eye`},null,8,DF)]))],10,TF),U(`button`,{type:`button`,class:`aichat__iconbtn`,title:`清空本卡片对话记录`,disabled:!i.messages.length||i.busy,onClick:t[3]||=(...e)=>a.askClear&&a.askClear(...e)},[...t[24]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-trash`})],-1)]],8,OF),U(`button`,{type:`button`,class:`aichat__iconbtn`,title:`模型库`,onClick:t[4]||=(...e)=>a.openModelList&&a.openModelList(...e)},[...t[25]||=[U(`svg`,{class:`is-solid-icon`,viewBox:`0 0 1024 1024`,"aria-hidden":`true`},[U(`use`,{href:`#icon-model`})],-1)]]),U(`button`,{type:`button`,class:`aichat__iconbtn`,title:`关闭(Esc)`,onClick:t[5]||=t=>e.$emit(`close`)},[...t[26]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])])]),K(` 未配置模型:常驻提示条,一键打开设置 `),a.configReady?K(`v-if`,!0):(B(),V(`div`,kF,[t[28]||=U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-alert-triangle`})],-1),t[29]||=U(`span`,null,`尚未配置模型,无法对话。`,-1),U(`button`,{type:`button`,class:`aichat__banner-btn`,onClick:t[6]||=(...e)=>a.openModelList&&a.openModelList(...e)},`去设置`)])),K(` 消息区:滚动容器与悬浮「回到底部」共处一个定位上下文,按钮只贴消息区底缘,
316
+ 输入区拖高 / 反馈条出现都不会把它盖住或悬空 `),U(`div`,AF,[U(`div`,{ref:`listEl`,class:`aichat__list`,onScroll:t[10]||=(...e)=>a.onScroll&&a.onScroll(...e)},[K(` 体积治理痕迹:较早的工具结果被裁剪过就说清楚,别让人以为记录丢了 `),i.archiveTrimmed?(B(),V(`div`,jF,[...t[30]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-activity`})],-1),U(`span`,null,`较早的工具参数 / 结果已裁剪归档(对话正文与过程事件完整保留)`,-1)]])):K(`v-if`,!0),i.loadingHistory?(B(),V(`div`,MF,`正在加载对话记录…`)):i.messages.length?(B(),V(z,{key:3},[K(` compact = 面板级「只看关键步骤」;can-rollback 只对当前卡片、非流式中开放(切了卡再回滚会写错对象) `),(B(!0),V(z,null,R(i.messages,(e,r)=>(B(),H(o,{key:e.id,msg:e,streaming:i.busy&&r===i.messages.length-1,"can-regenerate":e.role===`assistant`&&r===i.messages.length-1,compact:i.compactSteps,"can-rollback":e.role===`assistant`&&!i.busy&&!!n.cardId,"now-ts":i.busy&&r===i.messages.length-1?i.nowTs:0,"pick-owner":a.pickOwnerRow,onRegenerate:a.regenerate,onApproval:a.onApproval,onContinue:a.onContinue,onRollback:a.onRollbackTurn,onOpenSettings:a.openModelList,onShowAllSteps:t[8]||=e=>a.setCompact(!1),onLocateNode:a.onLocateNode,onPickBoard:a.onPickBoard},null,8,[`msg`,`streaming`,`can-regenerate`,`compact`,`can-rollback`,`now-ts`,`pick-owner`,`onRegenerate`,`onApproval`,`onContinue`,`onRollback`,`onOpenSettings`,`onLocateNode`,`onPickBoard`]))),128)),K(` 面板级进度:步数 / 已用时长 / 建卡阶段 / 最近收到数据多久前。
317
+ 长任务里「还活着吗」全靠这一行——旧版只有一句「生成中…」,网关静默与真在跑无从区分 `),i.busy?(B(),V(`div`,{key:0,class:A([`aichat__live`,{"is-stalled":a.stalled}]),role:`status`,"aria-live":`polite`},[t[33]||=U(`span`,{class:`aichat__live-dot`},null,-1),U(`span`,WF,j(a.liveText),1),a.stalled?(B(),V(`button`,{key:0,type:`button`,class:`aichat__live-act`,title:`连接可能已中断,终止本轮(已落盘的产物会保留)`,onClick:t[9]||=(...e)=>a.stop&&a.stop(...e)},` 终止 `)):K(`v-if`,!0)],2)):K(`v-if`,!0)],64)):(B(),V(`div`,NF,[t[32]||=U(`span`,{class:`aichat__empty-logo`},[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-sparkles`})])],-1),U(`p`,PF,j(a.emptyTitle),1),U(`p`,FF,j(a.emptyDesc),1),U(`div`,IF,[(B(!0),V(z,null,R(a.suggestions,e=>(B(),V(`button`,{key:e.id,type:`button`,class:A([`aichat__suggest`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(B(),V(`svg`,RF,[U(`use`,{href:e.icon},null,8,zF)])),U(`span`,BF,[U(`span`,VF,j(e.label),1),U(`span`,HF,j(e.hint),1)]),e.weight===`write`?(B(),V(`span`,UF,`改卡`)):K(`v-if`,!0)],10,LF))),128)),a.canShuffle?(B(),V(`button`,{key:0,type:`button`,class:`aichat__suggest-shuffle`,onClick:t[7]||=(...e)=>a.shuffleSuggestions&&a.shuffleSuggestions(...e)},[...t[31]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-refresh`})],-1),U(`span`,null,`换一批`,-1)]])):K(`v-if`,!0)])]))],544),K(` 回到底部:脱离底部吸附时出现 `),I(U(`button`,{type:`button`,class:`aichat__jump`,title:`回到底部`,onClick:t[11]||=e=>a.scrollToBottom(!0)},[...t[34]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-arrow-down`})],-1)]],512),[[Sc,!i.pinned&&i.messages.length]])]),K(` 常驻「常用」指令:有对话后空态建议区不再出现,这里保留一排轻量入口,随上下文同源 `),a.quickChips.length&&i.messages.length&&!i.busy?(B(),V(`div`,GF,[(B(!0),V(z,null,R(a.quickChips,e=>(B(),V(`button`,{key:e.id,type:`button`,class:A([`aichat__chip`,`is-${e.weight}`]),title:e.text,"data-suggest-id":e.id,onClick:t=>a.useSuggestion(e)},[(B(),V(`svg`,qF,[U(`use`,{href:e.icon},null,8,JF)])),U(`span`,null,j(e.label),1)],10,KF))),128))])):K(`v-if`,!0),K(` 操作反馈(附件解析失败 / 历史保存失败等) `),i.notice?(B(),V(`div`,{key:2,class:A([`aichat__notice`,`aichat__notice--${i.notice.type}`])},[U(`span`,null,j(i.notice.text),1),U(`button`,{type:`button`,class:`aichat__notice-x`,title:`关闭`,onClick:t[12]||=e=>i.notice=null},[...t[35]||=[U(`svg`,{viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-x`})],-1)]])],2)):K(`v-if`,!0),W(s,{ref:`composerEl`,busy:i.busy,model:i.config.model,attachments:i.draftAttachments,placeholder:a.configReady?`描述你要改的卡片,Enter 发送 / Shift+Enter 换行`:`请先在设置中配置模型…`,context:i.contextUsage,onSend:a.onSend,onStop:a.stop,onPick:a.onPick,onAddPath:a.onAddPath,onRemoveAttachment:a.removeAttachment,onDropFiles:a.onDropFiles,onPasteImage:a.onPasteImage,onEscape:a.onEscape},null,8,[`busy`,`model`,`attachments`,`placeholder`,`context`,`onSend`,`onStop`,`onPick`,`onAddPath`,`onRemoveAttachment`,`onDropFiles`,`onPasteImage`,`onEscape`]),K(` 一级面板:模型库。从齿轮 / 横幅 / 消息内「去设置」进入 `),i.modelListOpen?(B(),H(c,{key:3,models:i.models,"active-id":i.activeId,"turn-running":i.turnRunning,onClose:a.closeModelList,onAdd:a.onModelAdd,onEdit:a.onModelEdit,onDelete:a.onModelDelete,onActivate:a.onModelActivate,onImportCcswitch:a.onImportCcSwitch,onOpenCommon:a.openCommon},null,8,[`models`,`active-id`,`turn-running`,`onClose`,`onAdd`,`onEdit`,`onDelete`,`onActivate`,`onImportCcswitch`,`onOpenCommon`])):K(`v-if`,!0),K(` 新增 / 编辑模型:复用 AiSettings(modelId 区分,initialModel 预填) `),i.modelEditOpen?(B(),H(l,{key:4,config:i.config,"model-id":i.editModelId,"initial-model":i.editInitialModel,onClose:a.onModelEditClose,onSaved:a.onModelSaved},null,8,[`config`,`model-id`,`initial-model`,`onClose`,`onSaved`])):K(`v-if`,!0),K(` 删除模型确认:二次确认后才真正落盘删除 `),W(u,{visible:!!i.confirmDeleteModel,"close-on-mask":!1,title:`删除模型`,message:a.deleteModelMessage,"confirm-text":`删除`,severity:`danger`,onConfirm:a.doDeleteModel,onCancel:t[13]||=e=>i.confirmDeleteModel=null},null,8,[`visible`,`message`,`onConfirm`]),K(` cc-switch 导入弹窗:列出 cc-switch 的 Codex 类供应商,勾选后批量导入模型库(按 model 去重) `),W(ic,{name:`modal`},{default:F(()=>[i.ccSwitchOpen?(B(),V(`div`,{key:0,class:`ni-overlay`,onClick:t[17]||=q(e=>i.ccSwitchOpen=!1,[`self`])},[U(`div`,YF,[U(`div`,XF,[t[36]||=U(`span`,{class:`ni-title`},`从 cc-switch 导入`,-1),U(`button`,{class:`ni-close`,type:`button`,title:`关闭`,onClick:t[14]||=e=>i.ccSwitchOpen=!1})]),U(`div`,ZF,[U(`div`,QF,[K(` 加载中 `),i.ccSwitchLoading?(B(),V(`p`,$F,`正在读取 cc-switch 供应商…`)):i.ccSwitchReason?(B(),V(z,{key:1},[K(` 无可导入项 `),U(`p`,eI,j(i.ccSwitchReason),1)],2112)):(B(),V(z,{key:2},[K(` 供应商列表 `),U(`ul`,tI,[(B(!0),V(z,null,R(i.ccSwitchProviders,e=>(B(),V(`li`,{key:e.id,class:A([`ccsw-dlg__item`,{"is-active":i.ccSwitchSelected[e.id],"is-dup":e.duplicate}]),onClick:t=>a.toggleCcSwitchItem(e)},[U(`span`,{class:A([`ccsw-dlg__check`,{"is-on":i.ccSwitchSelected[e.id]}])},[i.ccSwitchSelected[e.id]?(B(),V(`svg`,rI,[...t[37]||=[U(`use`,{href:`#icon-check`},null,-1)]])):K(`v-if`,!0)],2),U(`span`,iI,[U(`span`,aI,[G(j(e.name||e.model)+` `,1),e.isCurrent?(B(),V(`span`,oI,`当前`)):K(`v-if`,!0),e.duplicate?(B(),V(`span`,sI,`已存在`)):K(`v-if`,!0)]),U(`span`,cI,[U(`span`,lI,j(e.model),1),t[38]||=U(`span`,{class:`ccsw-dlg__dot`},`·`,-1),U(`span`,uI,j(e.baseUrl),1)])])],10,nI))),128))])],2112))])]),U(`div`,dI,[U(`span`,fI,j(a.ccSwitchDupCount>0?`已有 ${a.ccSwitchDupCount} 个重复模型被自动跳过`:`勾选要导入的供应商,批量加入模型库`),1),U(`div`,pI,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[15]||=e=>i.ccSwitchOpen=!1},`取消`),U(`button`,{class:`ni-btn`,type:`button`,disabled:i.ccSwitchLoading||!i.ccSwitchProviders.length||a.ccSwitchCheckedCount===0,onClick:t[16]||=(...e)=>a.confirmImportCcSwitch&&a.confirmImportCcSwitch(...e)},j(a.ccSwitchCheckedCount>0?`导入选中 ${a.ccSwitchCheckedCount} 项`:`导入`),9,mI)])])])])):K(`v-if`,!0)]),_:1}),K(` 通用设置:所有模型共享的执行策略 / 环境参数 `),i.commonOpen?(B(),H(d,{key:5,onClose:t[18]||=e=>i.commonOpen=!1,onSaved:a.onCommonSaved},null,8,[`onSaved`])):K(`v-if`,!0),W(u,{visible:i.confirmClear,"close-on-mask":!1,title:`清空对话记录`,message:`将删除卡片「${n.cardName||n.cardId||`当前卡片`}」的全部对话记录,此操作不可撤销。`,"confirm-text":`清空`,severity:`danger`,onConfirm:a.doClear,onCancel:t[19]||=e=>i.confirmClear=!1},null,8,[`visible`,`message`,`onConfirm`]),K(` 终止确认:生成中按 Esc 会走到这里。几十分钟的建卡被一次误按抹掉代价太大,故加一道确认 `),W(u,{visible:i.confirmStop,"close-on-mask":!1,title:`终止本次生成`,message:`已执行的写入与落盘产物都会保留,上下文也留在对话里,之后回复「继续」可从中断处接着做。确定现在终止?`,"confirm-text":`终止生成`,severity:`danger`,onConfirm:a.doStop,onCancel:t[20]||=e=>i.confirmStop=!1},null,8,[`visible`,`onConfirm`])],38)}var gI=X(bF,[[`render`,hI],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/ChatPanel.vue`]]),_I=`/assets/site-icon-CFMif8z4.png`,vI={includeMocks:!0};function yI(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null}function bI(e){let t=yI(e);if(t&&t.dictionary&&Array.isArray(t.dictionary.inputParams)){let e=k_(t);for(let n of t.dictionary.inputParams)n&&typeof n==`object`&&!A_(e,n.key)&&(n.defaultValue=void 0)}return t}function xI(e,t){return!e||!t?e===t:JSON.stringify(bI(e))===JSON.stringify(bI(t))}function SI(e,t){return JSON.stringify(e)===JSON.stringify(t)}function CI(e,t){return!t||!e?!1:!xI(e,t)}function wI(e,t,n){return!t||!e?!1:!SI(e,n??O_(t,vI))}function TI(e,t,n,r){return!t||!e?!1:CI(e,t)||wI(n,t,r)}var EI={includeMocks:!0},DI=2500,OI=new eu,kI=au({},OI);typeof window<`u`&&(window.__rt=kI);var AI=188,jI=320,MI=200,NI=160,PI={name:`App`,components:{RenderTree:ap,DebugPanel:Tb,ApiCallPanel:Vb,CardSelect:ax,AlertCardLayer:hx,DeviceOverlay:Yx,PickerOverlay:iS,DatePickerOverlay:yS,SelectionOverlay:CS,HoverGuides:kS,RemotePreview:_C,AppToast:wC,ImageLightbox:WC,ConfirmDialog:_p,CardGallery:dw,NewCardDialog:jw,ComponentPalette:Kw,Switch:Xw,ChatPanel:gI},provide(){return{adapter:OI,cardRuntime:kI,customComponents:{}}},data(){return{adapter:OI,rt:kI,logoUrl:_I,appVersion:`0.62.0`,cardList:[],cardCount:0,galleryOpen:!1,cardDialog:{visible:!1,mode:`create`,cardId:``,cardDesc:``},selectedId:``,externalReloadNote:``,externalReloadTimer:null,selfSaveId:``,selfSaveAt:0,preview:null,chromeOff:!1,theme:`dark`,cardReady:!1,reloadToken:0,moveCollapseToken:0,refreshing:!1,loadingCard:!1,currentSchema:null,currentCard:null,cardImportMeta:null,localSchema:null,localData:null,selectedNodeId:``,activeTab:`vars`,apiPanelOpen:!0,addNodePanelOpen:!1,addNodeTarget:null,validateBadge:{state:`idle`,errors:0,warnings:0,renderOk:null,ts:0},validateTimer:null,savedCard:!1,savingCard:!1,saveTimer:null,coverBusy:!1,savingRemote:!1,savedRemote:!1,verifiedRemote:null,saveRemoteTimer:null,syncingRemote:!1,syncedRemote:!1,remotePreviewOpen:!1,syncTarget:null,syncTimer:null,uploadingSlices:!1,publishing:!1,metaRefreshToken:0,loginModal:!1,loginName:``,loginPassword:``,loginSubmitting:!1,loginError:``,confirm:{show:!1,title:``,message:``,confirmText:`继续`,cancelText:`取消`,severity:`primary`,onConfirm:null},past:[],future:[],baseline:null,_commitTimer:null,viewportHeight:700,canvasBg:`gray`,refreshing:!1,bgOptions:[{key:`checker`,label:`棋盘`},{key:`white`,label:`白色`},{key:`gray`,label:`浅灰`},{key:`black`,label:`黑色`}],_previewWidthPx:372,_apiPanelWidthPx:360,presetSizes:[{key:375,value:`375`},{key:430,value:`430`},{key:188,value:`188`}],stageWidth:typeof window<`u`?window.innerWidth:1280,colsWidth:0,stageHeight:typeof window<`u`?window.innerHeight-52:748,dragging:!1,apiDragging:!1,_stageObserver:null,devServiceOpen:!1,aiChatOpen:(()=>{try{return sessionStorage.getItem(`cardbuddy:ai-chat-open`)===`1`}catch{return!1}})(),chatBusy:!1,chatProgress:null,fab:{x:null,y:null,dragging:!1},fabDrag:null,fabSuppressClick:!1,devServiceForm:Nl(),apiBaseResolved:Fl(),devSvcLive:`unknown`,devSvcDown:!1,_unsubCardsChanged:null}},computed:{fabTitle(){if(this.aiChatOpen)return`AI 开发助手(已打开)`;if(!this.chatBusy)return`AI 开发助手`;let e=this.chatProgress,t=e&&e.startedAt?`${lk(e.startedAt)} 开始 · `:``;return`AI 开发助手正在生成(${e?`${t}第 ${e.steps} 步 · 已用 ${ck(e.ms)}${e.stage?` · ${e.stage}`:``}${e.stalled?` · 疑似断流`:``}`:``}),点击展开查看`},fabStyle(){return this.fab.x==null||this.fab.y==null?{}:{right:this.fab.x+`px`,bottom:this.fab.y+`px`,left:`auto`,top:`auto`,transition:this.fab.dragging?`none`:``}},currentBg(){return this.bgOptions.find(e=>e.key===this.canvasBg)||this.bgOptions[0]},cardIds(){return this.cardList.map(e=>e&&e.id).filter(Boolean)},canUndo(){return this.past.length>0},canRedo(){return this.future.length>0},devSvcBlockReason(){let e=this.devServiceForm||{};return String(e.baseUrl||``).trim()?e.enabled?null:`disabled`:`empty`},canPaste(){return!!Hu()},hasCardSource(){return!!(this.cardImportMeta&&this.cardImportMeta.source)},historyDirty(){return TI(this.currentSchema,this.localSchema,this.rt&&this.rt.rootScope,this.localData)},devSvcConn(){return this.apiBaseResolved===null?`unconfigured`:this.devSvcLive===`open`?`open`:this.devSvcDown?`closed`:`connecting`},devSvcTitle(){if(this.apiBaseResolved===null)return this.devSvcBlockReason===`disabled`?`已填地址但未开启用本地服务`:`未配置本地开发服务(部署态必填)`;let e=this.apiBaseResolved===``?`同源开发服务`:`本地开发服务`;return this.devSvcLive===`open`?e+`已连接`:this.devSvcDown?e+`已断开(连接失败或服务已停止,重连中…)`:e+`连接中 / 重连中…`},devSvcClass(){return this.apiBaseResolved===null?`app__btn--warn`:this.devSvcLive===`open`?`app__btn--connected`:this.devSvcDown?`app__btn--disconnected`:`app__btn--reconnecting`},devSvcLabel(){return this.apiBaseResolved===null?`未配置本地服务`:this.devSvcLive===`open`?`本地服务已连接`:this.devSvcDown?`本地服务已断开`:`本地服务连接中…`},badgeText(){return{idle:`待校验`,pending:`校验中…`,ok:`校验通过`,error:`校验未通过`,nopython:`未配置校验`,fail:`校验服务异常`}[this.validateBadge.state]||`待校验`},badgeTitle(){let e=this.validateBadge;if(e.state===`ok`)return`结构合法 + 渲染不抛错(不保证画得对,视觉正确性见截图)`;if(e.state===`error`){let t=[];return e.errors&&t.push(`契约错误 ${e.errors} 个`),e.renderOk===!1&&t.push(`渲染抛出异常`),`校验未通过:`+(t.join(`;`)||`详见 /__validate 与 /__render-status`)}return e.state===`nopython`?`未找到 python3/python,无法跑契约校验(请安装 Python 或设置 DSL_PYTHON)`:e.state===`fail`?`校验服务异常(dev server 未启动或端点不可用)`:``},previewWidth(){if(this.chromeOff)return this.stageWidth;let{min:e,max:t}=this.previewBounds,n=this._previewWidthPx||AI;return Math.max(e,Math.min(t,n))},viewportWidth(){return this.stageWidth,typeof window<`u`?window.innerWidth:1280},debugSoftWidth(){return Math.max(MI,Math.floor(this.viewportWidth/3))},previewBounds(){let e=this.stageWidth||0,t=Math.floor(e/2),n=e-jI-this.debugSoftWidth;return{min:AI,max:Math.max(AI,Math.min(t,n))}},debugMinWidth(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth);return Math.max(MI,Math.min(this.debugSoftWidth,Math.floor(e)-jI))},apiPanelBounds(){let e=this.colsWidth||Math.max(0,(this.stageWidth||0)-this.previewWidth),t=Math.max(NI,Math.floor(e)-this.debugMinWidth);return{min:Math.min(jI,t),max:t}},canvasW(){return Math.round(this.previewWidth||375)},selectedCardName(){let e=this.cardList.find(e=>e.id===this.selectedId);return e&&e.name||this.selectedId||``},cardEmpty(){let e=this.currentSchema;if(!e||!e.view)return!0;let t=e.view.components;return!Array.isArray(t)||t.length===0},apiPanelWidth(){let{min:e,max:t}=this.apiPanelBounds,n=this._apiPanelWidthPx||360;return Math.max(e,Math.min(t,n))},frameStyle(){return{}}},watch:{activeTab(e){e!==`structure`&&(this.selectedNodeId=``,ES())},aiChatOpen(e){try{sessionStorage.setItem(`cardbuddy:ai-chat-open`,e?`1`:`0`)}catch{}},theme(e){document.documentElement.dataset.theme=e},apiPanelOpen(e){try{localStorage.setItem(`cardbuddy:api-panel-open`,e?`1`:`0`)}catch{}}},beforeUnmount(){this.viewportObserver&&this.viewportObserver.disconnect(),this._stageObserver&&this._stageObserver.disconnect(),this.saveTimer&&clearTimeout(this.saveTimer),this.syncTimer&&clearTimeout(this.syncTimer),this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),window.removeEventListener(`keydown`,this.onKeydown)},mounted(){this.viewportObserver=new ResizeObserver(e=>{for(let t of e)this.viewportHeight=Math.round(t.contentRect.height)}),this.$refs.phoneViewport&&this.viewportObserver.observe(this.$refs.phoneViewport),this.loadPreviewWidth(),this.loadApiPanelWidth(),this._stageObserver=new ResizeObserver(e=>{for(let t of e){if(t.target===this.$refs.colsEl){this.colsWidth=Math.round(t.contentRect.width);continue}this.stageWidth=Math.round(t.contentRect.width),this.stageHeight=Math.round(t.contentRect.height)}}),this.$refs.stageEl&&this._stageObserver.observe(this.$refs.stageEl),this.$refs.colsEl&&this._stageObserver.observe(this.$refs.colsEl),window.addEventListener(`keydown`,this.onKeydown),this.fabInitPosition(),window.addEventListener(`resize`,this.onFabResize)},beforeDestroy(){window.removeEventListener(`resize`,this.onFabResize)},async created(){Lx(kI);let e=new URLSearchParams(location.search).get(`chrome`);this.chromeOff=e===`off`||e===``;try{let e=localStorage.getItem(`cardbuddy:theme`);(e===`light`||e===`dark`)&&(this.theme=e)}catch{}document.documentElement.dataset.theme=this.theme;try{localStorage.getItem(`cardbuddy:api-panel-open`)===`0`&&(this.apiPanelOpen=!1)}catch{}await this.fetchCardList();let t=new URLSearchParams(location.search).get(`card`),n=null;try{let e=localStorage.getItem(`cardbuddy:selected-card`);e&&this.cardList.some(t=>t.id===e)&&(n=e)}catch{}let r=t&&this.cardList.some(e=>e.id===t)?t:n||this.cardList[0]&&this.cardList[0].id;r&&(this.selectedId=r,await this.loadCard(this.selectedId)),this.$watch(()=>this.rt.rootScope,()=>{this.syncDataToSchema()},{deep:!0}),this.setupCardsChanged()},methods:{fabBounds(){let e=this.$refs.aiFab,t=e?e.offsetWidth:56,n=e?e.offsetHeight:56,r=document.documentElement.clientWidth,i=document.documentElement.clientHeight;return{minX:0,minY:0,maxX:Math.max(0,r-t),maxY:Math.max(0,i-n)}},clampFab(e,t){let n=this.fabBounds();return[Math.min(Math.max(e,n.minX),n.maxX),Math.min(Math.max(t,n.minY),n.maxY)]},fabInitPosition(){let e=this.$refs.aiFab;if(!e)return;let t=this.loadFabPos(),n=document.documentElement.clientWidth,r=document.documentElement.clientHeight,i,a;if(t)[i,a]=this.clampFab(t.x,t.y);else{let t=e.getBoundingClientRect();[i,a]=this.clampFab(n-t.right,r-t.bottom)}this.fab.x=i,this.fab.y=a},loadFabPos(){try{let e=localStorage.getItem(`cardbuddy:ai-fab-pos`);if(!e)return null;let t=JSON.parse(e);if(typeof t.x==`number`&&typeof t.y==`number`&&isFinite(t.x)&&isFinite(t.y))return t}catch{}return null},saveFabPos(){try{localStorage.setItem(`cardbuddy:ai-fab-pos`,JSON.stringify({x:this.fab.x,y:this.fab.y}))}catch{}},onFabPointerDown(e){if(!this.aiChatOpen){this.fabSuppressClick=!1,this.fab.x??this.fabInitPosition(),this.fabDrag={pointerId:e.pointerId,startX:e.clientX,startY:e.clientY,originX:this.fab.x,originY:this.fab.y,moved:!1};try{e.currentTarget.setPointerCapture(e.pointerId)}catch{}}},onFabPointerMove(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId)return;let n=e.clientX-t.startX,r=e.clientY-t.startY;if(!t.moved){if(Math.hypot(n,r)<4)return;t.moved=!0,this.fab.dragging=!0}let[i,a]=this.clampFab(t.originX-n,t.originY-r);this.fab.x=i,this.fab.y=a},onFabPointerUp(e){let t=this.fabDrag;if(!t||t.pointerId!==e.pointerId){this.fab.dragging=!1;return}try{e.currentTarget.releasePointerCapture(e.pointerId)}catch{}t.moved&&(this.fabSuppressClick=!0,this.saveFabPos()),this.fab.dragging=!1,this.fabDrag=null},onFabClick(){if(this.fabSuppressClick){this.fabSuppressClick=!1;return}this.aiChatOpen=!this.aiChatOpen},onFabResize(){if(this.fab.x==null)return;let[e,t]=this.clampFab(this.fab.x,this.fab.y);this.fab.x=e,this.fab.y=t},setupCardsChanged(){if(this._unsubCardsChanged){try{this._unsubCardsChanged()}catch{}this._unsubCardsChanged=null}this.devSvcLive=`connecting`,this._unsubCardsChanged=Vl(e=>this.onCardsChanged(e),e=>this.onDevServiceState(e))},onDevServiceState(e){let t=this.devSvcLive===`connecting`;this.devSvcLive=e,e===`open`?this.devSvcDown=!1:e===`closed`&&(this.devSvcDown=!0),e===`connecting`?!t&&!this._svcWatchdog&&(this._svcWatchdog=setTimeout(()=>{this.devSvcLive===`connecting`&&(this.devSvcLive=`closed`,this.devSvcDown=!0),this._svcWatchdog=null},8e3)):this._svcWatchdog&&=(clearTimeout(this._svcWatchdog),null)},saveDevService(){Pl(this.devServiceForm),this.apiBaseResolved=Fl(),this.setupCardsChanged(),this.devServiceOpen=!1,Z(`本地开发服务配置已保存`,`ok`),this.fetchCardList()},beginColumnDrag(e,t,n){let r=e&&e.currentTarget;if(!r)return;let i=e.pointerId;try{r.setPointerCapture(i)}catch{}let a=()=>{r.removeEventListener(`pointermove`,t),r.removeEventListener(`pointerup`,a),r.removeEventListener(`pointercancel`,a),window.removeEventListener(`blur`,a);try{r.hasPointerCapture?.(i)&&r.releasePointerCapture(i)}catch{}document.body.style.cursor=``,document.body.style.userSelect=``,n()};document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`,r.addEventListener(`pointermove`,t),r.addEventListener(`pointerup`,a),r.addEventListener(`pointercancel`,a),window.addEventListener(`blur`,a)},startDrag(e){if(this.chromeOff)return;let t=this.$refs.stageEl;if(!t)return;let n=t.getBoundingClientRect().left;this.dragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(r,Math.round(e.clientX-n)))},()=>{this.dragging=!1,this.savePreviewWidth()})},startApiDrag(e){if(this.chromeOff||!this.apiPanelOpen)return;let t=this.$refs.colsEl;if(!t)return;let n=t.getBoundingClientRect().right;this.apiDragging=!0,this.beginColumnDrag(e,e=>{let{min:t,max:r}=this.apiPanelBounds;this._apiPanelWidthPx=Math.max(t,Math.min(r,Math.round(n-e.clientX)))},()=>{this.apiDragging=!1,this.saveApiPanelWidth()})},loadPreviewWidth(){try{let e=localStorage.getItem(`cardbuddy:preview-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=188&&(this._previewWidthPx=t)}}catch{}},savePreviewWidth(){try{localStorage.setItem(`cardbuddy:preview-width`,String(Math.round(this._previewWidthPx)))}catch{}},setPresetWidth(e){if(this.chromeOff)return;let{min:t,max:n}=this.previewBounds;this._previewWidthPx=Math.max(t,Math.min(n,e)),this.savePreviewWidth()},loadApiPanelWidth(){try{let e=localStorage.getItem(`cardbuddy:api-panel-width`);if(e!=null){let t=parseInt(e,10);!Number.isNaN(t)&&t>=320&&(this._apiPanelWidthPx=t)}}catch{}},saveApiPanelWidth(){try{localStorage.setItem(`cardbuddy:api-panel-width`,String(Math.round(this.apiPanelWidth)))}catch{}},chooseBg(e){this.canvasBg=e},onSelect(e){if(e!==this.selectedId){if(this.chatBusy){Z(`AI 正在生成「${this.selectedId}」:先点 ■ 停止,或等本轮结束后再切卡`,`err`,3600);return}this.loadingCard=!0,this.selectedId=e,this.loadCard(e,{clearAll:!0})}},selectCard(e){this.selectedId=e;try{localStorage.setItem(`cardbuddy:selected-card`,e)}catch{}},openGallery(){this.cardList.length&&(this.galleryOpen=!0)},openNewCard(){this.cardDialog.mode=`create`,this.cardDialog.cardId=``,this.cardDialog.cardDesc=``,this.cardDialog.visible=!0,this.fetchCardList()},openRenameCard(){this.selectedId&&(this.cardDialog.mode=`rename`,this.cardDialog.cardId=this.selectedId,this.cardDialog.cardDesc=this.currentSchema&&this.currentSchema.desc||``,this.cardDialog.visible=!0,this.fetchCardList())},async onCardRenamed({oldId:e,id:t}){if(this.cardDialog.visible=!1,Z(t===e?`已更新卡片描述`:`已重命名卡片 ${e} → ${t}`,`ok`),t!==e)return this.applyCardRename(e,t);await this.fetchCardList(),await this.loadCard(t)},async applyCardRename(e,t){if(!e||!t||e===t)return;let n=`${e}->${t}`;if(this._renameAppliedKey===n)return;this._renameAppliedKey=n,setTimeout(()=>{this._renameAppliedKey===n&&(this._renameAppliedKey=``)},1e3);let r=this.selectedId===e;if(this.$refs.chatPanel?.migrateCard(e,t),r&&this.selectCard(t),this.selfSaveId=t,this.selfSaveAt=Date.now(),await this.fetchCardList(),r){if(this.historyDirty&&!this.confirm.show){this.requestConfirm({title:`卡片已重命名`,message:`卡片「${e}」已重命名为「${t}」,而编辑器内还有未保存的改动。\n重新载入会放弃这些未保存改动并显示磁盘版本;保留改动则继续用当前编辑器内容(后续保存会写到新目录 ${t})。`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(t)});return}await this.loadCard(t)}},closeGallery(){this.galleryOpen=!1},async openCardFolder(){if(this.selectedId)try{let e=await J(`/__open-folder`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({id:this.selectedId})}),t=(e.headers.get(`content-type`)||``).includes(`application/json`)?await e.json().catch(()=>({})):{};!e.ok||!t.ok?Z(t.error||`打开文件夹失败`,`err`):Z(`已打开卡片文件夹`,`ok`)}catch{Z(`无法连接本地开发服务,请确认已启动`,`err`)}},async refreshCard(){if(!(!this.selectedId||this.refreshing)){this.refreshing=!0;try{await this.loadCard(this.selectedId)}finally{this.refreshing=!1}}},toggleTheme(){this.theme=this.theme===`light`?`dark`:`light`;try{localStorage.setItem(`cardbuddy:theme`,this.theme)}catch{}},toggleApiPanel(){this.apiPanelOpen=!this.apiPanelOpen},async refreshValidateBadge(){let e=this.selectedId;if(!(!e||!this.preview)&&(this.validateTimer&&clearTimeout(this.validateTimer),this.validateBadge={...this.validateBadge,state:`pending`},await new Promise(e=>{this.validateTimer=setTimeout(e,120)}),this.selectedId===e))try{let[t,n]=await Promise.all([J(`/__validate/${encodeURIComponent(e)}`),J(`/__render-status/${encodeURIComponent(e)}`)]);if(!t.ok){this.validateBadge={...this.validateBadge,state:t.status===503?`nopython`:`fail`};return}let r=await t.json().catch(()=>null),i=n.ok?await n.json().catch(()=>null):null;if(!r){this.validateBadge={...this.validateBadge,state:`fail`};return}let a=!!r.ok,o=!i||!!i.renderOk,s=a&&o?`ok`:`error`,c=this.validateBadge.state!==s;this.validateBadge={state:s,errors:(r.errors||[]).length,warnings:(r.warnings||[]).length,renderOk:o,ts:Date.now()},c&&(s===`ok`||s===`error`)&&this.celebrateValidate(s)}catch{this.validateBadge={...this.validateBadge,state:`fail`}}},celebrateValidate(e=`ok`){let t=this.$refs.validateBadgeEl;if(!t||window.matchMedia&&window.matchMedia(`(prefers-reduced-motion: reduce)`).matches)return;t.classList.remove(`is-celebrating`),t.offsetWidth,t.classList.add(`is-celebrating`),setTimeout(()=>t.classList.remove(`is-celebrating`),600);let n=t.getBoundingClientRect(),r={ok:`--ok`,error:`--danger`,pending:`--warn`,fail:`--text-faint`,nopython:`--text-faint`}[e]||`--ok`,i={ok:`#52c41a`,error:`#F5222D`,pending:`#FAAD14`,fail:`#8c8c8c`,nopython:`#8c8c8c`}[e]||`#52c41a`,a=getComputedStyle(t).getPropertyValue(r).trim()||i,o=document.createElement(`div`);o.className=`app__confetti`,o.style.left=n.left+n.width/2+`px`,o.style.top=n.top+n.height/2+`px`;let s=[`polygon(50% 0%, 0% 100%, 100% 100%)`,`polygon(62% 0%, 100% 40%, 45% 100%, 0% 52%)`,`polygon(0% 0%, 100% 18%, 82% 100%, 12% 70%)`,`polygon(22% 0%, 100% 8%, 88% 100%, 0% 76%)`,`polygon(0% 32%, 100% 0%, 76% 100%, 18% 86%)`,`polygon(8% 0%, 100% 22%, 70% 100%, 0% 64%)`,`polygon(0% 12%, 100% 0%, 100% 78%, 30% 100%, 12% 55%)`],c=n.width/2,l=n.height/2;for(let e=0;e<22;e++){let e=document.createElement(`span`);e.className=`app__confetti-bit`;let t=Math.random()*4|0,n,r;t===0?(n=(Math.random()*2-1)*c,r=-l):t===1?(n=c,r=(Math.random()*2-1)*l):t===2?(n=(Math.random()*2-1)*c,r=l):(n=-c,r=(Math.random()*2-1)*l);let i=Math.hypot(n,r)||1,u=Math.atan2(r/i,n/i)+(Math.random()-.5)*.5,d=16+Math.random()*26;e.style.setProperty(`--sx`,n.toFixed(1)+`px`),e.style.setProperty(`--sy`,r.toFixed(1)+`px`),e.style.setProperty(`--tx`,(Math.cos(u)*d).toFixed(1)+`px`),e.style.setProperty(`--ty`,(Math.sin(u)*d).toFixed(1)+`px`),e.style.setProperty(`--rot`,(Math.random()*720-360).toFixed(0)+`deg`),e.style.setProperty(`--clip`,s[Math.random()*s.length|0]),e.style.setProperty(`--c`,a),e.style.setProperty(`--o`,(.68+Math.random()*.27).toFixed(2));let f=Math.random(),p,m;f<.35?(p=1.5+Math.random()*2,m=10+Math.random()*10):f<.75?(p=4+Math.random()*5,m=p*(.6+Math.random()*.8)):(p=2+Math.random()*2.5,m=p),e.style.width=p.toFixed(0)+`px`,e.style.height=m.toFixed(0)+`px`,o.appendChild(e)}document.body.appendChild(o),setTimeout(()=>o.remove(),800)},async loadCard(e,t={}){if(e){this.loadingCard=!0;try{let n=await J(`/__card/${encodeURIComponent(e)}`);if(!n.ok){this.rt.pushError(`loadCard`,`HTTP `+n.status);return}let r=await n.json();if(!r.schema){this.rt.pushError(`loadCard`,`schema 读取失败`);return}this.selectCard(e),t.clearAll?this.rt.clearErrors():this.rt.clearBindingErrors(),this.rt.clearApiCalls(),t.keepScope||this.rt.setRootScope(O_(r.schema,EI)),this.currentCard={schema:r.schema},this.currentSchema=r.schema,this.cardImportMeta=null,this.fetchImportMeta(e),this.localSchema=this.cloneSchema(r.schema),this.localData=this.cloneData(O_(r.schema,EI)),this.preview=Pu(r.schema),typeof window<`u`&&(window.__cardModel=Bu(r.schema)),this.cardReady=!1,this.$nextTick(()=>{this.cardReady=!0}),this.syncDataToSchema(),this.selectedNodeId=``,this.baseline={schema:this.cloneSchema(this.currentSchema)},this.reloadToken+=1,dx(),Rx(),this.refreshValidateBadge(),await this.loadHistory(e)}finally{this.loadingCard=!1}}},cloneSchema(e){return e?JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t)):null},cloneData(e){return e==null?e:JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t))},applySchemaSnapshot(e){if(!this.selectedId||!e)return;let t=e.schema||e,n=e.data==null?O_(t,EI):e.data;this.currentSchema=this.cloneSchema(t),this.rt.setRootScope(this.cloneData(n)),this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.reloadToken+=1,this.refreshValidateBadge()},commitHistory(){if(!this.currentSchema||!this.baseline||!TI(this.currentSchema,this.baseline.schema,this.rt.rootScope))return;let e={schema:this.baseline.schema};this.past.push(e),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(this.currentSchema)},this.persistSnapshot(e)},scheduleCommit(){this._commitTimer&&clearTimeout(this._commitTimer),this._commitTimer=setTimeout(()=>{this._commitTimer=null,this.commitHistory()},500)},persistSnapshot(e){let t=this.selectedId;if(!t)return;let n=e.schema||e;J(`/__history/${encodeURIComponent(t)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({schema:n},(e,t)=>e===`_schemaNode`?void 0:t,2)}).catch(e=>console.warn(`[历史快照落盘失败]`,e))},async loadHistory(e){this.past=[],this.future=[];try{let t=await J(`/__history/${encodeURIComponent(e)}`);if(!t.ok)return;let n=await t.json().catch(()=>null),r=n&&n.snapshots||[];this.past=r.slice(-30).map(e=>({schema:e.schema,data:e.data==null?O_(e.schema,EI):e.data}))}catch(e){console.warn(`[加载编辑历史失败]`,e)}},undo(){if(!this.canUndo)return;let e=this.past.pop();this.future.push(this.baseline),this.future.length>30&&this.future.shift(),this.baseline=e,this.applySchemaSnapshot(e)},redo(){if(!this.canRedo)return;let e=this.future.pop();this.past.push(this.baseline),this.past.length>30&&this.past.shift(),this.baseline=e,this.applySchemaSnapshot(e)},async applyHistoryToLocal(){this.loadingCard||!this.historyDirty||!this.preview||!this.selectedId||await this.saveCard()&&Z(`已将该版本保存到本地`,`ok`)},async generateCardCover(){if(!this.preview||!this.selectedId||this.coverBusy)return;if(this.historyDirty&&!await this.saveCard()){Z(`本地保存失败,已取消生成预览图`,`err`);return}let e=null;try{let t=await J(`/__card-image/`+encodeURIComponent(this.selectedId)+`?probe=1`),n=await t.json().catch(()=>({}));t.ok&&n.exists&&(e=n.file)}catch{}if(e){this.requestConfirm({title:`重新生成截图`,message:`该卡片已有截图(${e}),继续将覆盖它。确定重新生成吗?`,confirmText:`重新生成`,severity:`warn`,onConfirm:()=>this.doGenerateCover()});return}this.doGenerateCover()},async doGenerateCover(){this.coverBusy=!0;try{let e=await J(`/__card-image/`+encodeURIComponent(this.selectedId),{method:`POST`}),t=await e.json().catch(()=>({}));if(!e.ok)throw Error(t.message||`HTTP `+e.status);Z(`截图已生成(${t.width}×${t.height})→ ${t.file}`,`ok`,3e3)}catch(e){Z(`生成截图失败:`+String(e&&e.message||e),`err`,3600)}finally{this.coverBusy=!1}},onSchemaChanged(){!this.selectedId||!this.currentSchema||(this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``)},onSchemaCommit(){!this.selectedId||!this.currentSchema||(this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,this.commitHistory())},syncDataToSchema(){let e=this.currentSchema;if(!e||!e.dictionary||!Array.isArray(e.dictionary.inputParams))return;let t=this.rt&&this.rt.rootScope;if(!t||typeof t!=`object`)return;let n=e.dictionary.inputParams,r=k_(e);for(let e of Object.keys(t)){let i=n.find(t=>t&&(t.key===e||t.name===e));if(!i)continue;let a=JSON.parse(JSON.stringify(t[e],(e,t)=>e===`_schemaNode`?void 0:t));r&&Object.prototype.hasOwnProperty.call(r,e)?r[e]=a:i.defaultValue=a}},onSelectNode(e){this.selectedNodeId=e||``},findPreviewNodeById(e,t){if(!e||t==null)return null;let n=String(t),r=e=>{if(!e)return null;if(String(e.id)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(e)},copySelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(Wu(n.node,this.selectedId),Z(`已复制节点(含子节点)`,`ok`))},pasteNode(){let e=Hu();if(!e||!this.currentSchema)return;let t=Gu(e),n=[...new Set(t.filter(e=>!vu[e]))];if(n.length){Z(`粘贴失败:含未知组件类型 `+n.join(`、`),`err`);return}let r=JSON.parse(JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t));Ku(r);let i=this.selectedNodeId&&this.selectedNodeId!==`_root`?this.findPreviewNodeById(this.preview.view,this.selectedNodeId):null,a=`root`;i&&(a=ju(i.className)?`into`:`after`),this.insertClone(r,i,a);let o=Uu();o&&o!==this.selectedId?Z(`已从卡片「${o}」跨卡片粘贴到「${this.selectedId}」`,`ok`):Z(`已粘贴节点(含子节点)`,`ok`)},duplicateNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);if(!n)return;let r=JSON.parse(JSON.stringify(n.node,(e,t)=>e===`_schemaNode`?void 0:t));Ku(r),n.parentArr.splice(n.index+1,0,r),this.afterStructuralEdit(r.componentId)},insertClone(e,t,n){let r=this.currentSchema;if(n===`root`)r.view.components||(r.view.components=[]),r.view.components.push(e);else if(n===`into`){let n=t&&t._schemaNode;if(!n){r.view.components||(r.view.components=[]),r.view.components.push(e),this.afterStructuralEdit(e.componentId);return}let i=Mu(t.className),a=(n.slots||[]).find(e=>e.slotKey===i);a||(n.slots||=[],a={slotKey:i,slotScope:!1,slotSwitch:`1`,components:[]},n.slots.push(a)),a.components||(a.components=[]),a.components.push(e)}else{let n=this.findSchemaNodeByComponentId(r.view,t.componentId);n?n.parentArr.splice(n.index+1,0,e):(r.view.components||(r.view.components=[]),r.view.components.push(e))}this.afterStructuralEdit(e.componentId)},afterStructuralEdit(e){let t=this.currentSchema;this.reloadToken+=1,this.preview=Pu(t),typeof window<`u`&&(window.__cardModel=Bu(t)),this.syncDataToSchema(),this.selectedNodeId=e&&this.findViewIdByComponentId(this.preview.view,e)||``,this.scheduleCommit()},deleteSelectedNode(){let e=this.selectedNodeId;if(!e||e===`_root`||!this.currentSchema||!this.preview)return;let t=this.findPreviewNodeById(this.preview.view,e);if(!t)return;let n=this.findSchemaNodeByComponentId(this.currentSchema.view,t.componentId);n&&(n.parentArr.splice(n.index,1),this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema(),this.selectedNodeId=``,ES(),this.scheduleCommit())},hasTextSelection(){if(typeof window>`u`||!window.getSelection)return!1;let e=window.getSelection();return!!e&&!e.isCollapsed&&e.toString().trim()!==``},hasNodeSelection(){return!!this.selectedNodeId&&this.selectedNodeId!==`_root`},isEditableTarget(e){let t=e.target;if(!t)return!1;let n=t.tagName;return!!(n===`INPUT`||n===`TEXTAREA`||n===`SELECT`||t.isContentEditable)},onKeydown(e){if(this.chromeOff||!this.preview)return;let t=this.isEditableTarget(e),n=e.ctrlKey||e.metaKey,r=e.key;if(n&&(r===`c`||r===`C`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.copySelectedNode(),e.preventDefault();return}if(n&&(r===`v`||r===`V`)){if(t||this.hasTextSelection()||!this.hasNodeSelection()||!Hu())return;this.pasteNode(),e.preventDefault();return}if(n&&(r===`d`||r===`D`)){if(t||this.hasTextSelection()||!this.hasNodeSelection())return;this.duplicateNode(),e.preventDefault();return}if(n&&(r===`z`||r===`Z`)){if(t)return;e.preventDefault(),e.shiftKey?this.redo():this.undo();return}if(n&&(r===`y`||r===`Y`)){if(t)return;e.preventDefault(),this.redo();return}if(r===`Delete`||r===`Backspace`){if(t||!this.selectedNodeId||this.selectedNodeId===`_root`)return;e.preventDefault(),this.deleteSelectedNode();return}if(r===`Escape`){this.selectedNodeId&&(this.selectedNodeId=``,e.preventDefault());return}},onHoverNode(e){if(!e){ES();return}if(e.leave){ES(e.id);return}let t=typeof document<`u`?document.querySelector(`.phone__screen`):null;if(!t){ES(e.id);return}let n=e=>window.CSS&&CSS.escape?CSS.escape(String(e)):String(e).replace(/["\\\]]/g,`\\$&`),r=null;e.componentId!=null&&(r=t.querySelector(`[data-cid="`+n(e.componentId)+`"]`)),!r&&e.id!=null&&(r=t.querySelector(`[data-cid="`+n(e.id)+`"]`)),r?TS(r,e.id):ES(e.id)},onCanvasClick(e){if(!e.ctrlKey&&!e.metaKey||this.chromeOff)return;let t=e.target&&e.target.closest?e.target.closest(`[data-cid]`):null;if(!t)return;let n=t.getAttribute(`data-cid`);if(!n)return;let r=this.findPreviewNodeByCid(n);r&&(this.activeTab=`structure`,this.selectedNodeId=r.id)},onAiLocateNode(e){let t=e?this.findPreviewNodeByCid(e):null;if(!t){Z(`没找到组件 ${e||``}:卡片可能已被改动,重新校验一次即可`,`err`);return}this.activeTab=`structure`,this.selectedNodeId=t.id},findPreviewNodeByCid(e){let t=this.preview&&this.preview.view;if(!t)return null;let n=String(e),r=e=>{if(!e)return null;if(String(e.componentId==null?e.id:e.componentId)===n)return e;let t=[];if(e.components&&t.push(...e.components),e.slots)for(let n of e.slots)n.components&&t.push(...n.components);for(let e of t){let t=r(e);if(t)return t}return null};return r(t)},onAddNode(e){this.currentSchema&&(this.addNodeTarget=e||null,this.addNodePanelOpen=!0)},cancelAddNode(){this.addNodePanelOpen=!1,this.addNodeTarget=null},findSchemaLocation(e,t){let n=e=>{for(let r=0;r<e.length;r++){let i=e[r];if(i===t)return{containerArr:e,index:r};let a=i.slots||[];for(let e of a){let t=n(e.components||[]);if(t)return t}}return null};return n(e&&e.components||[])},findViewIdByComponentId(e,t){if(!e)return null;if(e.componentId===t)return e.id;let n=[];if(e.components&&n.push(...e.components),e.slots)for(let t of e.slots)t.components&&n.push(...t.components);for(let e of n){let n=this.findViewIdByComponentId(e,t);if(n)return n}return null},findSchemaNodeByComponentId(e,t){let n=(e,r)=>{for(let i=0;i<e.length;i++){let a=e[i];if(a.componentId===t)return{node:a,parentArr:e,index:i,owner:r};let o=a.slots||[];for(let e of o){let t=n(e.components||[],a);if(t)return t}}return null};return n(e&&e.components||[],`root`)},isDescendantCompId(e,t){if(!t||!t.componentId)return!1;if(t.componentId===e)return!0;let n=[];if(t.components&&n.push(...t.components),t.slots)for(let e of t.slots)e.components&&n.push(...e.components);for(let t of n)if(this.isDescendantCompId(e,t))return!0;return!1},moveNode(e,t,n){let r=this.currentSchema;if(!r||!r.view||e===t)return!1;let i=this.findSchemaNodeByComponentId(r.view,e);if(!i)return!1;let a=i.node;if(this.isDescendantCompId(t,a))return!1;let o,s;if(t===`__root__`)r.view.components||(r.view.components=[]),o=r.view.components,s=o.length;else{let e=this.findSchemaNodeByComponentId(r.view,t);if(!e)return!1;let i=e.node;if(n===`inside`){if(!ju(i.className))return!1;let e=Mu(i.className),t=(i.slots||[]).find(t=>t.slotKey===e);t||(i.slots||=[],t={slotKey:e,slotScope:!1,slotSwitch:`1`,components:[]},i.slots.push(t)),t.components||(t.components=[]),o=t.components,s=o.length}else o=e.parentArr,s=n===`before`?e.index:e.index+1}let c=o===i.parentArr&&i.index<s;return i.parentArr.splice(i.index,1),c&&--s,o.splice(s,0,a),a},onMoveNode({sourceCompId:e,targetCompId:t,position:n}){if(!this.currentSchema||!this.moveNode(e,t,n))return;this.reloadToken+=1,this.preview=Pu(this.currentSchema),typeof window<`u`&&(window.__cardModel=Bu(this.currentSchema)),this.syncDataToSchema();let r=this.findViewIdByComponentId(this.preview.view,e);this.selectedNodeId=r||``,r&&(this.moveCollapseToken+=1)},onPickComponent(e){let t=this.addNodeTarget||{},n=t.node||null,r=t.mode||`auto`,i=this.currentSchema;if(!i){this.cancelAddNode();return}let a;try{a=Nu(e)}catch(e){console.error(`[创建组件节点失败]`,e),this.rt.pushError(`addNode`,String(e&&e.message)),this.cancelAddNode();return}let o=!n||n.className===`Root`;if((r===`before`||r===`after`)&&!o){let e=n._schemaNode,t=e?this.findSchemaLocation(i.view,e):null;if(!t)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=r===`before`?t.index:t.index+1;t.containerArr.splice(e,0,a)}}else if(o)i.view.components||(i.view.components=[]),i.view.components.push(a);else{let e=n._schemaNode;if(!e){this.cancelAddNode();return}if(ju(n.className)){let t=Mu(n.className),r=(e.slots||[]).find(e=>e.slotKey===t);r||(e.slots||=[],r={slotKey:t,slotScope:!1,slotSwitch:`1`,components:[]},e.slots.push(r)),r.components||(r.components=[]),r.components.push(a)}else{let t=this.findSchemaLocation(i.view,e);t?t.containerArr.splice(t.index+1,0,a):(i.view.components||(i.view.components=[]),i.view.components.push(a))}}this.cancelAddNode(),this.reloadToken+=1,this.preview=Pu(i),typeof window<`u`&&(window.__cardModel=Bu(i)),this.syncDataToSchema();let s=this.findViewIdByComponentId(this.preview.view,a.componentId);this.selectedNodeId=s||``,this.scheduleCommit()},async runSync(e){if(!this.syncingRemote&&!(e&&!this.selectedId)){this.syncingRemote=!0,this.syncedRemote=!1,this.syncTarget=e?`selected`:`full`;try{let t=await J(`/__sync`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e?{cardCode:e}:{})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(n.needCredentials){this.openLoginModal();return}if(!n.success){let e=(n.failed||[]).map(e=>`${e.id}: ${e.error}`).join(`; `);throw Error(e||`同步失败`)}this.syncedRemote=!0,this.syncTimer&&clearTimeout(this.syncTimer),this.syncTimer=setTimeout(()=>{this.syncedRemote=!1,this.syncTarget=null},1800),await this.onRefresh(),Z(this.syncTarget===`selected`?`已拉取最新卡到本地`:`拉取全部卡完成`,`ok`),this.persistRemoteVersion(this.selectedId,null)}catch(e){console.error(`[同步远程数据失败]`,e),Z(`同步失败:`+(e&&e.message),`err`)}finally{this.syncingRemote=!1}}},syncRemote(){return this.runSync()},syncSelected(){return this.runSync(this.selectedId)},openLoginModal(){this.loginModal=!0,this.loginName=``,this.loginPassword=``,this.loginError=``},closeLoginModal(){this.loginSubmitting||(this.loginModal=!1,this.loginPassword=``,this.loginError=``)},async submitLogin(){if(this.loginSubmitting)return;let e=this.loginName.trim(),t=this.loginPassword;if(!e||!t){this.loginError=`账号与密码均不能为空`;return}this.loginSubmitting=!0,this.loginError=``;try{let n=await J(`/__login-credentials`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({loginName:e,loginPassword:t})}),r=await n.json().catch(()=>({}));if(!n.ok||!r.ok)throw Error(r.message||r.error||`HTTP `+n.status);this.loginModal=!1,this.loginPassword=``,Z(`凭据已保存,正在重试同步…`,`ok`),await this.runSync(this.syncTarget===`selected`?this.selectedId:void 0)}catch(e){this.loginError=`保存失败:`+(e&&e.message)}finally{this.loginSubmitting=!1}},chooseSync(e){if(e===`full`){if(this.syncingRemote)return;this.requestConfirm({title:`拉取全部卡`,message:`即将从远端 FinMall 拉取完整卡片列表,并逐张覆盖本地同名卡片。本地独有卡片会保留,但被覆盖卡片的未保存改动将丢失,且无法撤销。是否继续?`,confirmText:`继续同步`,severity:`warn`,onConfirm:()=>this.syncRemote()});return}!this.preview||!this.selectedId||this.syncingRemote||this.requestConfirm({title:`拉取最新卡`,message:`即将从远端 FinMall 拉取当前卡片「${this.selectedId}」的最新版本并覆盖本地。本地未保存的改动将丢失,且无法撤销。是否继续?`,confirmText:`继续同步`,onConfirm:()=>this.syncSelected()})},chooseRsave(e){if(e===`save`){if(!this.preview||!this.selectedId||this.savingRemote||!this.hasCardSource)return;this.requestConfirm({title:`推送当前卡`,message:`即将把本地卡片「${this.selectedId}」的当前版本推送并覆盖到远端 FinMall。线上版本会被立即更新,且该操作不可撤销。是否继续?`,confirmText:`继续推送`,severity:`warn`,onConfirm:()=>this.saveToRemote()});return}if(e===`publish`){if(!this.preview||!this.selectedId||this.publishing||!this.hasCardSource)return;let e=this.historyDirty;this.requestConfirm({title:`卡片发布`,message:e?`当前卡片存在未保存到远端的改动,发布将使用远端「已保存」的版本(不含这些本地改动)。仍将以「最大版本号 +1」作为新版本号上线。确认继续?`:`即将取远端「${this.selectedId}」当前最大版本号并 +1,发布上线为新版本。发布的是远端已保存的卡片内容(建议先「推送当前卡」)。该操作不可撤销。确认继续?`,confirmText:`继续发布`,severity:e?`danger`:`warn`,onConfirm:()=>this.doPublish()});return}if(e===`slices`){if(!this.preview||!this.selectedId||this.uploadingSlices)return;this.requestConfirm({title:`当前卡切图上传`,message:`即将把当前卡片「${this.selectedId}」引用的本地切图(src/slices/)上传到 FinMall 图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…)。本地切图文件保留不动;内容未变的切图会直接复用已有线上地址,不重复上传。`+(this.historyDirty?`
316
318
  当前卡片有未保存的改动,会先保存到本地再执行,避免被随后的重载丢弃。`:``)+`
317
- 是否继续?`,confirmText:`继续上传`,onConfirm:()=>this.uploadCardSlices()});return}!this.preview||!this.selectedId||!this.hasCardSource||(this.remotePreviewOpen=!0)},requestConfirm({title:e,message:t,confirmText:n,cancelText:r,severity:i,onConfirm:a}){this.confirm={show:!0,title:e,message:t,confirmText:n||`继续`,cancelText:r||`取消`,severity:[`primary`,`warn`,`danger`].includes(i)?i:`primary`,onConfirm:a}},onConfirmDialog(){let e=this.confirm.onConfirm;this.confirm.show=!1,this.confirm.onConfirm=null,typeof e==`function`&&e()},onCancelDialog(){this.confirm.show=!1,this.confirm.onConfirm=null},async saveCard(){if(!this.preview||!this.selectedId)return;this.savingCard=!0;let e=this.selectedId;this.selfSaveId=e,this.selfSaveAt=Date.now();try{try{let e=await this.fetchDiskCard(this.selectedId);if(e&&e.schema){let t=e.schema,n=this.currentSchema;n&&(t.pageId&&(n.pageId=t.pageId),t.name&&(n.name=t.name),t.desc!==void 0&&(n.desc=t.desc))}}catch{}this.syncDataToSchema();let e={schema:this.currentSchema},t=JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t,2),n=await J(`/__card/${encodeURIComponent(this.selectedId)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||`HTTP `+n.status)}return this.currentCard={schema:e.schema},this.localSchema=this.cloneSchema(this.currentSchema),this.localData=this.cloneData(O_(this.currentSchema,_I)),this.savedCard=!0,this.refreshValidateBadge(),this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>{this.savedCard=!1},1800),!0}catch(e){return console.error(`[本地保存失败]`,e),this.rt.pushError(`saveCard`,String(e&&e.message)),this.selfSaveId=``,this.selfSaveAt=0,!1}finally{this.savingCard=!1}},async fetchDiskCard(e){let t=await J(`/__card/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`HTTP `+t.status);return t.json()},async fetchImportMeta(e){if(!e){this.cardImportMeta=null;return}try{let t=await J(`/__import-meta/${encodeURIComponent(e)}`);if(!t.ok){this.cardImportMeta=null;return}let n=await t.json().catch(()=>({}));this.cardImportMeta=n&&n.meta||null}catch{this.cardImportMeta=null}},async saveToRemote(){if(!(!this.preview||!this.selectedId||this.savingRemote)){this.savingRemote=!0,this.savedRemote=!1,this.verifiedRemote=null;try{try{let e=await this.fetchDiskCard(this.selectedId);e&&e.schema&&e.schema.pageId&&this.currentSchema&&(this.currentSchema.pageId=e.schema.pageId)}catch{}this.syncDataToSchema(),this.selfSaveId=this.selectedId,this.selfSaveAt=Date.now();let e=await J(`/__save`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:this.selectedId,schema:this.currentSchema},(e,t)=>e===`_schemaNode`?void 0:t,2)});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message||t.error||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.error||`远端保存失败`);if(this.verifiedRemote=t.verified?!!t.verified.ok:null,this.savedRemote=!0,this.verifiedRemote===!1){let e=t.verified||{};e.diff&&e.diff.length?``+e.diff.join(`;`):e.readBackError,console.warn(`[保存校验不符]`,e),Z(`已保存至远端,但读回校验未通过`,`err`)}else Z(`已保存至远端`,`ok`);this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),this.saveRemoteTimer=setTimeout(()=>{this.savedRemote=!1,this.verifiedRemote=null},2500)}catch(e){console.error(`[保存至远端失败]`,e),Z(`保存至远端失败:`+(e&&e.message),`err`),this.selfSaveId=``,this.selfSaveAt=0}finally{this.savingRemote=!1}}},async uploadCardSlices(){if(!this.preview||!this.selectedId||this.uploadingSlices)return;let e=this.selectedId;this.uploadingSlices=!0;try{if(this.historyDirty&&!await this.saveCard())throw Error(`本地保存失败,已中止切图上传`);this.selfSaveId=e,this.selfSaveAt=Date.now();let t=await J(`/__slice-upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(n.needCredentials){this.openLoginModal();return}if(this.selfSaveAt=Date.now(),!n.success){let e=(n.failed||[]).map(e=>`${e.name}: ${e.error}`).join(`; `);throw Error(e||`切图上传失败`)}await this.onRefresh();let r=(n.rewritten||[]).reduce((e,t)=>e+t.count,0);n.referenced?Z(`当前卡切图上传完成:新上传 ${n.uploaded.length} 张、复用 ${n.skipped.length} 张,替换引用 ${r} 处`,`ok`):Z(`当前卡片没有引用本地切图,无需上传`,`ok`),n.dangling&&n.dangling.length&&Z(`有 ${n.dangling.length} 处引用的切图在 src/slices 下不存在:${n.dangling.join(`、`)}`,`err`)}catch(e){console.error(`[切图上传失败]`,e),Z(`当前卡切图上传失败:`+(e&&e.message),`err`),this.selfSaveId=``,this.selfSaveAt=0}finally{this.uploadingSlices=!1}},async syncCardMeta(e){let t=await this.fetchCardMeta(e);if(!t)return;let n=this.cardList.findIndex(t=>t.id===e);n>=0?this.cardList.splice(n,1,t):this.cardList.push(t),this.cardCount=this.cardList.length},async fetchCardMeta(e){try{let t=await J(`/__card/`+encodeURIComponent(e)+`/meta`);return t.ok?await t.json():null}catch(e){return console.error(`[读取卡片列表项失败]`,e),null}},async fetchCardList(){try{let e=await J(`/__cards`);if(!e.ok)return;let t=await e.json(),n=t&&t.cards||[];this.cardList=n,this.cardCount=n.length}catch(e){console.error(`[加载卡片列表失败]`,e)}},async onGalleryDelete(e){try{let t=await J(`/__card/${encodeURIComponent(e)}`,{method:`DELETE`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n&&(n.message||n.error)||`HTTP ${t.status}`);if(Z(`已删除本地卡片 ${e}`,`ok`),this.$refs.chatPanel?.discardCard(e),await this.fetchCardList(),this.selectedId===e){let e=this.cardList[0];e?await this.loadCard(e.id):(this.selectedId=``,this.currentSchema=null,this.preview=null)}}catch(e){Z(`删除卡片失败:${e.message}`,`err`)}},async onNewCardCreated(e){if(this.cardDialog.visible=!1,Z(`已创建空白卡片 ${e}`,`ok`),await this.fetchCardList(),this.chatBusy){Z(`AI 正在生成「${this.selectedId}」:新卡 ${e} 已建好,本轮结束后再切过去`,`err`,3600);return}await this.loadCard(e)},async onRefresh(){let e=this.selectedId;if(!(!e||this.refreshing)){this.refreshing=!0;try{await this.loadCard(e),await this.syncCardMeta(e);let t=this.cardList.find(t=>t.id===e);t&&this.currentSchema&&this.currentSchema.name&&(t.name=this.currentSchema.name)}catch(e){console.error(`[刷新卡片失败]`,e),this.rt.pushError(`refresh`,String(e&&e.message))}finally{this.refreshing=!1}}},onChatTurnFinished(e){if(this.chatProgress=null,this.aiChatOpen)return;let t=e&&e.steps||0,n=$O(e&&e.ms||0),r=ek(e&&e.finishedAt||Date.now());if(e&&e.status===`error`){Z(`AI 助手本轮报错(${r} · ${t} 步 / ${n}),展开面板查看原因`,`err`);return}if(e&&e.status===`aborted`){Z(`AI 助手本轮已终止(${r} · ${t} 步):展开面板可「从中断处继续」`,`ok`);return}Z(`AI 助手已完成本轮(${r} · ${t} 步 / ${n})`,`ok`)},async onChatRollbackTurn(e){let t=e&&e.cardId||this.selectedId;if(!t||this.loadingCard)return;if(t!==this.selectedId){Z(`请先切换到那张卡片再回滚`,`err`);return}let n=[];try{let e=await J(`/__history/${encodeURIComponent(t)}`);if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json().catch(()=>null);n=r&&r.snapshots||[]}catch(e){Z(`读取历史快照失败:${e.message||e}`,`err`);return}let r=Number(e&&e.ts)||0,i=r?n.filter(e=>Number(e.ts)>=r-2e3):[],a=i.length?i[0]:n[n.length-1];if(!a||!a.schema){Z(`没找到本轮之前的历史快照(可能已被 30 张上限裁掉,或本轮没写入过卡片)`,`err`);return}let o=new Date(Number(a.ts)||Date.now()).toLocaleString(`zh-CN`,{hour12:!1});this.requestConfirm({title:`回滚到 AI 动手之前`,message:`将把卡片「${this.selectedCardName||t}」恢复到 ${o} 的版本,本轮及其后的 ${i.length||1} 张快照都会被撤销。回滚只改当前编辑态,可用 Ctrl+Z 撤回;确认无误后仍需点顶栏「保存到本地」才写盘。`,confirmText:`回滚`,severity:`warn`,onConfirm:()=>this.applyTurnRollback(a)})},applyTurnRollback(e){!this.currentSchema||!e||(this.past.push({schema:this.cloneSchema(this.currentSchema)}),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(e.schema)},this.applySchemaSnapshot({schema:e.schema,data:e.data}),Z(`已回滚到本轮之前的版本(未落盘,可撤销;确认后点「保存到本地」)`,`ok`))},onCardsChanged(e){let t=e&&e.file||``,n=e&&e.type||`change`;if(n===`rename`&&e.oldId&&e.id&&e.oldId!==e.id)return this.applyCardRename(e.oldId,e.id);if(/\.history[\\/]/.test(t)||/data\.json$/i.test(t))return;let r=t.match(/src[\\/]cards[\\/]([^\\/]+)[\\/]/),i=r?r[1]:null;this._ccIds||=new Set,this._ccTypes||={},i&&(this._ccIds.add(i),this._ccTypes[i]=n),!this._ccTimer&&(this._ccTimer=setTimeout(async()=>{this._ccTimer=null;let e=this._ccIds,t=this._ccTypes;if(this._ccIds=new Set,this._ccTypes={},!e.size)return;let n=Array.from(e),r=n[n.length-1];if(e.size===1&&r&&r===this.selectedId){if(this.selfSaveId===r&&Date.now()-this.selfSaveAt<vI){this.selfSaveId=``,this.selfSaveAt=0;return}if(this.historyDirty)this.promptExternalReload(r);else{let e=this.currentSchema&&this.currentSchema.name||r;this.showExternalReloadNote(this.chatBusy?`AI 助手已写入卡片「${e}」,预览已自动刷新`:`卡片「${e}」已在编辑器外被修改,已自动重新载入预览`),this.loadCard(this.selectedId)}return}if(e.size>1){await this.fetchCardList();return}if((t[r]||`change`)===`unlink`){let e=this.cardList.findIndex(e=>e.id===r);e>=0&&(this.cardList.splice(e,1),this.cardCount=this.cardList.length);return}let i=await this.fetchCardMeta(r);if(!i){await this.fetchCardList();return}let a=this.cardList.findIndex(e=>e.id===r);a>=0?this.cardList.splice(a,1,i):this.cardList.push(i),this.cardCount=this.cardList.length},120))},promptExternalReload(e){if(this.confirm.show)return;let t=this.currentSchema&&this.currentSchema.name||e;this.requestConfirm({title:`卡片已在编辑器外被修改`,message:`卡片「${t}」的 schema / data 在编辑器外发生了变更(例如 IDE 或其他工具覆盖了文件)。\n当前编辑器存在未保存的改动,是否放弃本地未保存改动并重新载入磁盘版本?`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(e)})},showExternalReloadNote(e){this.externalReloadNote=e,this.externalReloadTimer&&clearTimeout(this.externalReloadTimer),this.externalReloadTimer=setTimeout(()=>{this.externalReloadNote=``,this.externalReloadTimer=null},3500)}}},EI={class:`app__bar`},DI={class:`app__logo`},OI=[`src`],kI={class:`app__logo-version`},AI={class:`csel-combo`},jI={class:`app__btn-group`},MI=[`disabled`],NI=[`disabled`],PI=[`title`],FI={class:`app__badge-text`},II={class:`app__bar-actions`},LI={class:`app__op-group`,role:`group`,"aria-label":`编辑历史与本地操作`},RI=[`disabled`],zI=[`disabled`],BI=[`disabled`,`title`],VI=[`disabled`],HI=[`disabled`],UI={key:0,class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},WI={key:1,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},GI={key:2,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},KI={key:3,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},qI={class:`app__remote-pop dd__menu`,role:`menu`},JI=[`title`,`onClick`],YI=[`title`,`onClick`],XI=[`title`,`onClick`],ZI=[`onClick`],QI=[`onClick`],$I=[`title`,`aria-pressed`],eL=[`aria-checked`,`title`],tL={class:`theme-toggle__track`},nL={class:`theme-toggle__thumb`},rL={key:0,class:`theme-toggle__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},iL={key:1,class:`theme-toggle__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},aL={class:`app__dev-svc`},oL=[`title`],sL={class:`app__dev-svc-head`},cL={class:`app__dev-svc-body`},lL={class:`app__dev-svc-row`},uL={class:`app__dev-svc-row app__dev-svc-row--col`},dL={class:`app__dev-svc-row app__dev-svc-row--col`},fL={key:0,class:`app__dev-svc-hint`},pL={class:`app__dev-svc-actions`},mL={style:{display:`none`}},hL=[`title`,`aria-expanded`],gL={key:0,class:`app__nosvc-banner`},_L={key:1,class:`app__nosvc-banner app__nosvc-banner--disconnected`},vL={key:2,class:`app__nosvc-banner app__extreload-banner`},yL={class:`app__stage`,ref:`stageEl`},bL={class:`phone__scaler`},xL=[`title`],SL={class:`canvas-bar__txt`},CL={class:`canvas-bar__chip`,title:`画布宽度预设(高度随列高自适应)`},wL={class:`canvas-bar__txt`},TL={class:`canvas-bar__size`,title:`画布实际尺寸(宽 × 高,高度随窗口自适应)`},EL=[`disabled`],DL=[`data-card-ready`],OL={class:`workside`},kL={class:`workside__cols`,ref:`colsEl`},AL={class:`login-modal modal-card`,role:`dialog`,"aria-modal":`true`},jL={class:`login-modal__row`},ML=[`disabled`],NL={class:`login-modal__row`},PL=[`disabled`],FL={key:0,class:`login-modal__error`},IL={class:`login-modal__actions`},LL=[`disabled`],RL=[`disabled`];function zL(e,t,n,r,i,a){let o=L(`CardSelect`),s=L(`Dropdown`),c=L(`Switch`),l=L(`ChatPanel`),u=L(`RenderTree`),d=L(`SelectionOverlay`),f=L(`HoverGuides`),p=L(`AlertCardLayer`),m=L(`DeviceOverlay`),h=L(`PickerOverlay`),g=L(`DatePickerOverlay`),_=L(`DebugPanel`),v=L(`ApiCallPanel`),y=L(`RemotePreview`),b=L(`ComponentPalette`),x=L(`ConfirmDialog`),S=L(`CardGallery`),C=L(`NewCardDialog`),w=L(`AppToast`),ee=L(`ImageLightbox`);return B(),V(`div`,{class:A([`app`,{"app--chrome-off":i.chromeOff}]),style:k({"--preview-width":a.previewWidth+`px`,"--api-panel-width":a.apiPanelWidth+`px`,"--debug-min":a.debugMinWidth+`px`})},[I(U(`header`,EI,[U(`strong`,DI,[U(`img`,{class:`app__logo-icon`,src:i.logoUrl,alt:``},null,8,OI),t[41]||=G(` CardBuddy `,-1),U(`span`,kI,`v`+j(i.appVersion),1)]),U(`div`,AI,[W(o,{class:`csel--combo`,value:i.selectedId,options:i.cardList,onChange:a.onSelect},null,8,[`value`,`options`,`onChange`])]),K(` 卡片网格预览:图标按钮,打开本地全部卡片的缩略图墙,点击任一张载入工作台 `),U(`div`,jI,[U(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.cardList.length,onClick:t[0]||=(...e)=>a.openGallery&&a.openGallery(...e),title:`卡片网格预览`},[...t[42]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-grid`})],-1)]],8,MI),K(` 新增空白卡片:紧邻网格预览的图标按钮;弹窗收 ID(必填、本地重名前置拦截)+ 描述(选填),创建成功切换到新卡 `),U(`button`,{class:`app__btn app__btn--icon`,type:`button`,onClick:t[1]||=(...e)=>a.openNewCard&&a.openNewCard(...e),title:`新增空白卡片`},[...t[43]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-folder-plus`})],-1)]]),K(` 打开当前卡片所在文件夹:从卡片下拉里拆出,合并进本组作为第三位 `),U(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.selectedId,onClick:t[2]||=(...e)=>a.openCardFolder&&a.openCardFolder(...e),title:`在文件管理器中打开当前卡片所在文件夹`},[...t[44]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-folder`})],-1)]],8,NI)]),I(U(`div`,{ref:`validateBadgeEl`,class:A([`app__badge`,`app__badge--`+i.validateBadge.state]),title:a.badgeTitle},[t[45]||=U(`span`,{class:`app__badge-dot`},null,-1),U(`span`,FI,j(a.badgeText),1)],10,PI),[[Sc,!i.chromeOff]]),U(`div`,II,[U(`div`,LI,[K(` 撤销 / 重做:图标 + 文案;无可回退/重做版本时置灰 `),U(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canUndo,onClick:t[3]||=(...e)=>a.undo&&a.undo(...e),title:`后退一步(撤销)`},[...t[46]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-undo`})],-1),U(`span`,null,`撤销`,-1)]],8,RI),U(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canRedo,onClick:t[4]||=(...e)=>a.redo&&a.redo(...e),title:`前进一步(重做)`},[...t[47]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-redo`})],-1),U(`span`,null,`重做`,-1)]],8,zI),K(` 保存到本地:当前显示版本(撤销/重做导航到的历史版本,或编辑后未本地保存的版本)
319
+ 是否继续?`,confirmText:`继续上传`,onConfirm:()=>this.uploadCardSlices()});return}!this.preview||!this.selectedId||!this.hasCardSource||(this.remotePreviewOpen=!0)},requestConfirm({title:e,message:t,confirmText:n,cancelText:r,severity:i,onConfirm:a}){this.confirm={show:!0,title:e,message:t,confirmText:n||`继续`,cancelText:r||`取消`,severity:[`primary`,`warn`,`danger`].includes(i)?i:`primary`,onConfirm:a}},onConfirmDialog(){let e=this.confirm.onConfirm;this.confirm.show=!1,this.confirm.onConfirm=null,typeof e==`function`&&e()},onCancelDialog(){this.confirm.show=!1,this.confirm.onConfirm=null},async doPublish(){if(!(!this.preview||!this.selectedId||this.publishing||!this.hasCardSource)){this.publishing=!0;try{let e=await J(`/__publish`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({schema:this.currentSchema})});if(!e.ok){let t=await e.json().catch(()=>({}));if(t.needCredentials){this.openLoginModal();return}throw Error(t.message||t.error||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.message||`发布失败`);Z(`已发布版本 ${t.nextVersion}`,`ok`),this.persistRemoteVersion(this.selectedId,t.nextVersion)}catch(e){console.error(`[卡片发布失败]`,e),Z(`发布失败:`+(e&&e.message),`err`)}finally{this.publishing=!1}}},async persistRemoteVersion(e,t){if(e)try{let n=t==null?`{}`:JSON.stringify({version:t}),r=await J(`/__card-version/${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:n});if(!r.ok){let e=await r.json().catch(()=>({}));if(e.needCredentials)return;throw Error(e.message||`HTTP `+r.status)}}catch(e){console.warn(`[persistRemoteVersion 失败]`,e&&e.message)}},async saveCard(){if(!this.preview||!this.selectedId)return;this.savingCard=!0;let e=this.selectedId;this.selfSaveId=e,this.selfSaveAt=Date.now();try{try{let e=await this.fetchDiskCard(this.selectedId);if(e&&e.schema){let t=e.schema,n=this.currentSchema;n&&(t.pageId&&(n.pageId=t.pageId),t.name&&(n.name=t.name),t.desc!==void 0&&(n.desc=t.desc))}}catch{}this.syncDataToSchema();let e={schema:this.currentSchema},t=JSON.stringify(e,(e,t)=>e===`_schemaNode`?void 0:t,2),n=await J(`/__card/${encodeURIComponent(this.selectedId)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:t});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.message||`HTTP `+n.status)}return this.currentCard={schema:e.schema},this.localSchema=this.cloneSchema(this.currentSchema),this.localData=this.cloneData(O_(this.currentSchema,EI)),this.savedCard=!0,this.refreshValidateBadge(),this.saveTimer&&clearTimeout(this.saveTimer),this.saveTimer=setTimeout(()=>{this.savedCard=!1},1800),!0}catch(e){return console.error(`[本地保存失败]`,e),this.rt.pushError(`saveCard`,String(e&&e.message)),this.selfSaveId=``,this.selfSaveAt=0,!1}finally{this.savingCard=!1}},async fetchDiskCard(e){let t=await J(`/__card/${encodeURIComponent(e)}`);if(!t.ok)throw Error(`HTTP `+t.status);return t.json()},async fetchImportMeta(e){if(!e){this.cardImportMeta=null;return}try{let t=await J(`/__import-meta/${encodeURIComponent(e)}`);if(!t.ok){this.cardImportMeta=null;return}let n=await t.json().catch(()=>({}));this.cardImportMeta=n&&n.meta||null}catch{this.cardImportMeta=null}},async saveToRemote(){if(!(!this.preview||!this.selectedId||this.savingRemote)){this.savingRemote=!0,this.savedRemote=!1,this.verifiedRemote=null;try{try{let e=await this.fetchDiskCard(this.selectedId);e&&e.schema&&e.schema.pageId&&this.currentSchema&&(this.currentSchema.pageId=e.schema.pageId)}catch{}this.syncDataToSchema(),this.selfSaveId=this.selectedId,this.selfSaveAt=Date.now();let e=await J(`/__save`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({code:this.selectedId,schema:this.currentSchema},(e,t)=>e===`_schemaNode`?void 0:t,2)});if(!e.ok){let t=await e.json().catch(()=>({}));throw Error(t.message||t.error||`HTTP `+e.status)}let t=await e.json();if(!t.ok)throw Error(t.error||`远端保存失败`);if(this.verifiedRemote=t.verified?!!t.verified.ok:null,this.savedRemote=!0,this.verifiedRemote===!1){let e=t.verified||{};e.diff&&e.diff.length?``+e.diff.join(`;`):e.readBackError,console.warn(`[保存校验不符]`,e),Z(`已保存至远端,但读回校验未通过`,`err`)}else Z(`已保存至远端`,`ok`);this.metaRefreshToken++,this.saveRemoteTimer&&clearTimeout(this.saveRemoteTimer),this.saveRemoteTimer=setTimeout(()=>{this.savedRemote=!1,this.verifiedRemote=null},2500)}catch(e){console.error(`[保存至远端失败]`,e),Z(`保存至远端失败:`+(e&&e.message),`err`),this.selfSaveId=``,this.selfSaveAt=0}finally{this.savingRemote=!1}}},async uploadCardSlices(){if(!this.preview||!this.selectedId||this.uploadingSlices)return;let e=this.selectedId;this.uploadingSlices=!0;try{if(this.historyDirty&&!await this.saveCard())throw Error(`本地保存失败,已中止切图上传`);this.selfSaveId=e,this.selfSaveAt=Date.now();let t=await J(`/__slice-upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({cardId:e})});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.message||e.error||`HTTP `+t.status)}let n=await t.json();if(n.needCredentials){this.openLoginModal();return}if(this.selfSaveAt=Date.now(),!n.success){let e=(n.failed||[]).map(e=>`${e.name}: ${e.error}`).join(`; `);throw Error(e||`切图上传失败`)}await this.onRefresh();let r=(n.rewritten||[]).reduce((e,t)=>e+t.count,0);n.referenced?Z(`当前卡切图上传完成:新上传 ${n.uploaded.length} 张、复用 ${n.skipped.length} 张,替换引用 ${r} 处`,`ok`):Z(`当前卡片没有引用本地切图,无需上传`,`ok`),n.dangling&&n.dangling.length&&Z(`有 ${n.dangling.length} 处引用的切图在 src/slices 下不存在:${n.dangling.join(`、`)}`,`err`)}catch(e){console.error(`[切图上传失败]`,e),Z(`当前卡切图上传失败:`+(e&&e.message),`err`),this.selfSaveId=``,this.selfSaveAt=0}finally{this.uploadingSlices=!1}},async syncCardMeta(e){let t=await this.fetchCardMeta(e);if(!t)return;let n=this.cardList.findIndex(t=>t.id===e);n>=0?this.cardList.splice(n,1,t):this.cardList.push(t),this.cardCount=this.cardList.length},async fetchCardMeta(e){try{let t=await J(`/__card/`+encodeURIComponent(e)+`/meta`);return t.ok?await t.json():null}catch(e){return console.error(`[读取卡片列表项失败]`,e),null}},async fetchCardList(){try{let e=await J(`/__cards`);if(!e.ok)return;let t=await e.json(),n=t&&t.cards||[];this.cardList=n,this.cardCount=n.length}catch(e){console.error(`[加载卡片列表失败]`,e)}},async onGalleryDelete(e){try{let t=await J(`/__card/${encodeURIComponent(e)}`,{method:`DELETE`}),n=await t.json().catch(()=>null);if(!t.ok)throw Error(n&&(n.message||n.error)||`HTTP ${t.status}`);if(Z(`已删除本地卡片 ${e}`,`ok`),this.$refs.chatPanel?.discardCard(e),await this.fetchCardList(),this.selectedId===e){let e=this.cardList[0];e?await this.loadCard(e.id):(this.selectedId=``,this.currentSchema=null,this.preview=null)}}catch(e){Z(`删除卡片失败:${e.message}`,`err`)}},async onNewCardCreated(e){if(this.cardDialog.visible=!1,Z(`已创建空白卡片 ${e}`,`ok`),await this.fetchCardList(),this.chatBusy){Z(`AI 正在生成「${this.selectedId}」:新卡 ${e} 已建好,本轮结束后再切过去`,`err`,3600);return}await this.loadCard(e)},async onRefresh(){let e=this.selectedId;if(!(!e||this.refreshing)){this.refreshing=!0;try{await this.loadCard(e),await this.syncCardMeta(e);let t=this.cardList.find(t=>t.id===e);t&&this.currentSchema&&this.currentSchema.name&&(t.name=this.currentSchema.name)}catch(e){console.error(`[刷新卡片失败]`,e),this.rt.pushError(`refresh`,String(e&&e.message))}finally{this.refreshing=!1}}},onChatTurnFinished(e){if(this.chatProgress=null,this.aiChatOpen)return;let t=e&&e.steps||0,n=ck(e&&e.ms||0),r=lk(e&&e.finishedAt||Date.now());if(e&&e.status===`error`){Z(`AI 助手本轮报错(${r} · ${t} 步 / ${n}),展开面板查看原因`,`err`);return}if(e&&e.status===`aborted`){Z(`AI 助手本轮已终止(${r} · ${t} 步):展开面板可「从中断处继续」`,`ok`);return}Z(`AI 助手已完成本轮(${r} · ${t} 步 / ${n})`,`ok`)},async onChatRollbackTurn(e){let t=e&&e.cardId||this.selectedId;if(!t||this.loadingCard)return;if(t!==this.selectedId){Z(`请先切换到那张卡片再回滚`,`err`);return}let n=[];try{let e=await J(`/__history/${encodeURIComponent(t)}`);if(!e.ok)throw Error(`HTTP ${e.status}`);let r=await e.json().catch(()=>null);n=r&&r.snapshots||[]}catch(e){Z(`读取历史快照失败:${e.message||e}`,`err`);return}let r=Number(e&&e.ts)||0,i=r?n.filter(e=>Number(e.ts)>=r-2e3):[],a=i.length?i[0]:n[n.length-1];if(!a||!a.schema){Z(`没找到本轮之前的历史快照(可能已被 30 张上限裁掉,或本轮没写入过卡片)`,`err`);return}let o=new Date(Number(a.ts)||Date.now()).toLocaleString(`zh-CN`,{hour12:!1});this.requestConfirm({title:`回滚到 AI 动手之前`,message:`将把卡片「${this.selectedCardName||t}」恢复到 ${o} 的版本,本轮及其后的 ${i.length||1} 张快照都会被撤销。回滚只改当前编辑态,可用 Ctrl+Z 撤回;确认无误后仍需点顶栏「保存到本地」才写盘。`,confirmText:`回滚`,severity:`warn`,onConfirm:()=>this.applyTurnRollback(a)})},applyTurnRollback(e){!this.currentSchema||!e||(this.past.push({schema:this.cloneSchema(this.currentSchema)}),this.past.length>30&&this.past.shift(),this.future=[],this.baseline={schema:this.cloneSchema(e.schema)},this.applySchemaSnapshot({schema:e.schema,data:e.data}),Z(`已回滚到本轮之前的版本(未落盘,可撤销;确认后点「保存到本地」)`,`ok`))},onCardsChanged(e){let t=e&&e.file||``,n=e&&e.type||`change`;if(n===`rename`&&e.oldId&&e.id&&e.oldId!==e.id)return this.applyCardRename(e.oldId,e.id);if(/\.history[\\/]/.test(t)||/data\.json$/i.test(t)||/\.import-meta\.json(\.tmp)?$/i.test(t))return;let r=t.match(/src[\\/]cards[\\/]([^\\/]+)[\\/]/),i=r?r[1]:null;this._ccIds||=new Set,this._ccTypes||={},i&&(this._ccIds.add(i),this._ccTypes[i]=n),!this._ccTimer&&(this._ccTimer=setTimeout(async()=>{this._ccTimer=null;let e=this._ccIds,t=this._ccTypes;if(this._ccIds=new Set,this._ccTypes={},!e.size)return;let n=Array.from(e),r=n[n.length-1];if(e.size===1&&r&&r===this.selectedId){if(this.selfSaveId===r&&Date.now()-this.selfSaveAt<DI){this.selfSaveId=``,this.selfSaveAt=0;return}if(this.historyDirty)this.promptExternalReload(r);else{let e=this.currentSchema&&this.currentSchema.name||r;this.showExternalReloadNote(this.chatBusy?`AI 助手已写入卡片「${e}」,预览已自动刷新`:`卡片「${e}」已在编辑器外被修改,已自动重新载入预览`),this.loadCard(this.selectedId)}return}if(e.size>1){await this.fetchCardList();return}if((t[r]||`change`)===`unlink`){let e=this.cardList.findIndex(e=>e.id===r);e>=0&&(this.cardList.splice(e,1),this.cardCount=this.cardList.length);return}let i=await this.fetchCardMeta(r);if(!i){await this.fetchCardList();return}let a=this.cardList.findIndex(e=>e.id===r);a>=0?this.cardList.splice(a,1,i):this.cardList.push(i),this.cardCount=this.cardList.length},120))},promptExternalReload(e){if(this.confirm.show)return;let t=this.currentSchema&&this.currentSchema.name||e;this.requestConfirm({title:`卡片已在编辑器外被修改`,message:`卡片「${t}」的 schema / data 在编辑器外发生了变更(例如 IDE 或其他工具覆盖了文件)。\n当前编辑器存在未保存的改动,是否放弃本地未保存改动并重新载入磁盘版本?`,confirmText:`重新载入`,cancelText:`保留我的改动`,onConfirm:()=>this.loadCard(e)})},showExternalReloadNote(e){this.externalReloadNote=e,this.externalReloadTimer&&clearTimeout(this.externalReloadTimer),this.externalReloadTimer=setTimeout(()=>{this.externalReloadNote=``,this.externalReloadTimer=null},3500)}}},FI={class:`app__bar`},II={class:`app__logo`},LI=[`src`],RI={class:`app__logo-version`},zI={class:`csel-combo`},BI={class:`app__btn-group`},VI=[`disabled`],HI=[`disabled`],UI=[`title`],WI={class:`app__badge-text`},GI={class:`app__bar-actions`},KI={class:`app__op-group`,role:`group`,"aria-label":`编辑历史与本地操作`},qI=[`disabled`],JI=[`disabled`],YI=[`disabled`,`title`],XI=[`disabled`],ZI=[`disabled`],QI={key:0,class:`app__icon app__icon--spin`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},$I={key:1,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},eL={key:2,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},tL={key:3,class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},nL={class:`app__remote-pop dd__menu`,role:`menu`},rL=[`title`,`onClick`],iL=[`title`,`onClick`],aL=[`title`,`onClick`],oL=[`title`,`onClick`],sL=[`onClick`],cL=[`onClick`],lL=[`title`,`aria-pressed`],uL=[`aria-checked`,`title`],dL={class:`theme-toggle__track`},fL={class:`theme-toggle__thumb`},pL={key:0,class:`theme-toggle__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},mL={key:1,class:`theme-toggle__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},hL={class:`app__dev-svc`},gL=[`title`],_L={class:`app__dev-svc-head`},vL={class:`app__dev-svc-body`},yL={class:`app__dev-svc-row`},bL={class:`app__dev-svc-row app__dev-svc-row--col`},xL={class:`app__dev-svc-row app__dev-svc-row--col`},SL={key:0,class:`app__dev-svc-hint`},CL={class:`app__dev-svc-actions`},wL={style:{display:`none`}},TL=[`title`,`aria-expanded`],EL={key:0,class:`app__nosvc-banner`},DL={key:1,class:`app__nosvc-banner app__nosvc-banner--disconnected`},OL={key:2,class:`app__nosvc-banner app__extreload-banner`},kL={class:`app__stage`,ref:`stageEl`},AL={class:`phone__scaler`},jL=[`title`],ML={class:`canvas-bar__txt`},NL={class:`canvas-bar__chip`,title:`画布宽度预设(高度随列高自适应)`},PL={class:`canvas-bar__txt`},FL={class:`canvas-bar__size`,title:`画布实际尺寸(宽 × 高,高度随窗口自适应)`},IL=[`disabled`],LL=[`data-card-ready`],RL={class:`workside`},zL={class:`workside__cols`,ref:`colsEl`},BL={class:`login-modal modal-card`,role:`dialog`,"aria-modal":`true`},VL={class:`login-modal__row`},HL=[`disabled`],UL={class:`login-modal__row`},WL=[`disabled`],GL={key:0,class:`login-modal__error`},KL={class:`login-modal__actions`},qL=[`disabled`],JL=[`disabled`];function YL(e,t,n,r,i,a){let o=L(`CardSelect`),s=L(`Dropdown`),c=L(`Switch`),l=L(`ChatPanel`),u=L(`RenderTree`),d=L(`SelectionOverlay`),f=L(`HoverGuides`),p=L(`AlertCardLayer`),m=L(`DeviceOverlay`),h=L(`PickerOverlay`),g=L(`DatePickerOverlay`),_=L(`DebugPanel`),v=L(`ApiCallPanel`),y=L(`RemotePreview`),b=L(`ComponentPalette`),x=L(`ConfirmDialog`),S=L(`CardGallery`),C=L(`NewCardDialog`),w=L(`AppToast`),ee=L(`ImageLightbox`);return B(),V(`div`,{class:A([`app`,{"app--chrome-off":i.chromeOff}]),style:k({"--preview-width":a.previewWidth+`px`,"--api-panel-width":a.apiPanelWidth+`px`,"--debug-min":a.debugMinWidth+`px`})},[I(U(`header`,FI,[U(`strong`,II,[U(`img`,{class:`app__logo-icon`,src:i.logoUrl,alt:``},null,8,LI),t[41]||=G(` CardBuddy `,-1),U(`span`,RI,`v`+j(i.appVersion),1)]),U(`div`,zI,[W(o,{class:`csel--combo`,value:i.selectedId,options:i.cardList,onChange:a.onSelect},null,8,[`value`,`options`,`onChange`])]),K(` 卡片网格预览:图标按钮,打开本地全部卡片的缩略图墙,点击任一张载入工作台 `),U(`div`,BI,[U(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.cardList.length,onClick:t[0]||=(...e)=>a.openGallery&&a.openGallery(...e),title:`卡片网格预览`},[...t[42]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-grid`})],-1)]],8,VI),K(` 新增空白卡片:紧邻网格预览的图标按钮;弹窗收 ID(必填、本地重名前置拦截)+ 描述(选填),创建成功切换到新卡 `),U(`button`,{class:`app__btn app__btn--icon`,type:`button`,onClick:t[1]||=(...e)=>a.openNewCard&&a.openNewCard(...e),title:`新增空白卡片`},[...t[43]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-folder-plus`})],-1)]]),K(` 打开当前卡片所在文件夹:从卡片下拉里拆出,合并进本组作为第三位 `),U(`button`,{class:`app__btn app__btn--icon`,type:`button`,disabled:!i.selectedId,onClick:t[2]||=(...e)=>a.openCardFolder&&a.openCardFolder(...e),title:`在文件管理器中打开当前卡片所在文件夹`},[...t[44]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-folder`})],-1)]],8,HI)]),I(U(`div`,{ref:`validateBadgeEl`,class:A([`app__badge`,`app__badge--`+i.validateBadge.state]),title:a.badgeTitle},[t[45]||=U(`span`,{class:`app__badge-dot`},null,-1),U(`span`,WI,j(a.badgeText),1)],10,UI),[[Sc,!i.chromeOff]]),U(`div`,GI,[U(`div`,KI,[K(` 撤销 / 重做:图标 + 文案;无可回退/重做版本时置灰 `),U(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canUndo,onClick:t[3]||=(...e)=>a.undo&&a.undo(...e),title:`后退一步(撤销)`},[...t[46]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-undo`})],-1),U(`span`,null,`撤销`,-1)]],8,qI),U(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||!a.canRedo,onClick:t[4]||=(...e)=>a.redo&&a.redo(...e),title:`前进一步(重做)`},[...t[47]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-redo`})],-1),U(`span`,null,`重做`,-1)]],8,JI),K(` 保存到本地:当前显示版本(撤销/重做导航到的历史版本,或编辑后未本地保存的版本)
318
320
  与本地磁盘版本不一致时高亮可用;一致时置灰。点击把当前版本真正写回磁盘,
319
- 使下一次重新打开加载的是这个「真实版本」,而非任意历史记录。 `),U(`button`,{class:A([`app__btn app__btn--history-save`,{"is-dirty":a.historyDirty}]),type:`button`,disabled:!i.preview||!a.historyDirty||i.savingCard||i.loadingCard,onClick:t[5]||=(...e)=>a.applyHistoryToLocal&&a.applyHistoryToLocal(...e),title:a.historyDirty?`当前版本与本地不一致,点击将该版本保存到本地`:`当前版本已与本地一致`},[...t[48]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-save`})],-1),U(`span`,null,`保存`,-1)]],10,BI),K(` 生成预览图:无头渲染当前卡 → 透明底、与卡片实际尺寸 1:1 的 PNG → 覆盖写
321
+ 使下一次重新打开加载的是这个「真实版本」,而非任意历史记录。 `),U(`button`,{class:A([`app__btn app__btn--history-save`,{"is-dirty":a.historyDirty}]),type:`button`,disabled:!i.preview||!a.historyDirty||i.savingCard||i.loadingCard,onClick:t[5]||=(...e)=>a.applyHistoryToLocal&&a.applyHistoryToLocal(...e),title:a.historyDirty?`当前版本与本地不一致,点击将该版本保存到本地`:`当前版本已与本地一致`},[...t[48]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-save`})],-1),U(`span`,null,`保存`,-1)]],10,YI),K(` 生成预览图:无头渲染当前卡 → 透明底、与卡片实际尺寸 1:1 的 PNG → 覆盖写
320
322
  src/cards/<id>/<id>.png(手动搭建 / 生成卡片后补齐封面用)。
321
- 未保存改动先落盘:服务端渲染的是磁盘态,不先保存会截到旧版。 `),U(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||i.coverBusy||i.savingCard||i.loadingCard,onClick:t[6]||=(...e)=>a.generateCardCover&&a.generateCardCover(...e),title:`生成预览图:透明底、与卡片实际尺寸一致,写入 src/cards/<id>/<id>.png(已存在则覆盖)`},[...t[49]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-image`})],-1),U(`span`,null,`截图`,-1)]],8,VI)]),K(` 远端:合并「远端保存 / 远端预览 / 切图上传 / 全量同步 / 选中卡片同步」为一个分组,组名「远端」,云图标 `),W(s,{class:`app__remote-menu`,size:`md`,placement:`bottom-end`,disabled:i.savingRemote||i.syncingRemote||i.uploadingSlices,title:i.savingRemote?`正在保存至远端…`:i.syncingRemote?`同步中…`:i.uploadingSlices?`正在上传切图…`:`远端操作:推送 / 预览(真机)/ 拉取 / 拉取全部 / 切图上传`,"data-testid":`remote-group`},{trigger:F(({open:e})=>[U(`button`,{type:`button`,class:A([`app__btn app__btn--remote`,{"app__btn--warn":i.savedRemote&&i.verifiedRemote===!1,"app__remote-trigger--active":e,"is-processing":i.savingRemote||i.syncingRemote||i.uploadingSlices}]),disabled:i.savingRemote||i.syncingRemote||i.uploadingSlices},[i.savingRemote||i.syncingRemote||i.uploadingSlices?(B(),V(`svg`,UI,[...t[50]||=[U(`use`,{href:`#icon-loading`},null,-1)]])):i.savedRemote&&i.verifiedRemote!==!1?(B(),V(`svg`,WI,[...t[51]||=[U(`use`,{href:`#icon-cloud-check`},null,-1)]])):i.savedRemote&&i.verifiedRemote===!1?(B(),V(`svg`,GI,[...t[52]||=[U(`use`,{href:`#icon-cloud-alert`},null,-1)]])):(B(),V(`svg`,KI,[...t[53]||=[U(`use`,{href:`#icon-cloud`},null,-1)]])),t[55]||=U(`span`,null,`远端`,-1),(B(),V(`svg`,{class:A([`app__icon app__icon--chev`,{"app__icon--chev--open":e}]),viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`},[...t[54]||=[U(`use`,{href:`#icon-chevron`},null,-1)]],2))],10,HI)]),default:F(({close:e})=>[U(`ul`,qI,[U(`li`,{class:A([`app__remote-item`,{"is-disabled":!i.preview||!i.selectedId||!a.hasCardSource}]),title:a.hasCardSource?`预览当前卡:生成真机预览二维码(FinMall App 扫码)`:`该卡未经「同步远程」导入,无远端来源信息,无法生成真机预览二维码`,"data-testid":`remote-preview`,role:`menuitem`,onClick:t=>{a.chooseRsave(`preview`),e()}},[...t[56]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-device-mobile`})],-1),U(`span`,null,`真机预览`,-1)]],10,JI),K(` 切图上传:仅点击时执行,把「当前卡片引用到的」src/slices 切图上传到 FinMall 图片库
323
+ 未保存改动先落盘:服务端渲染的是磁盘态,不先保存会截到旧版。 `),U(`button`,{class:`app__btn app__btn--hist`,type:`button`,disabled:!i.preview||i.coverBusy||i.savingCard||i.loadingCard,onClick:t[6]||=(...e)=>a.generateCardCover&&a.generateCardCover(...e),title:`生成预览图:透明底、与卡片实际尺寸一致,写入 src/cards/<id>/<id>.png(已存在则覆盖)`},[...t[49]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-image`})],-1),U(`span`,null,`截图`,-1)]],8,XI)]),K(` 远端:合并「远端保存 / 远端预览 / 切图上传 / 全量同步 / 选中卡片同步」为一个分组,组名「远端」,云图标 `),W(s,{class:`app__remote-menu`,size:`md`,placement:`bottom-end`,disabled:i.savingRemote||i.syncingRemote||i.uploadingSlices||i.publishing,title:i.savingRemote?`正在保存至远端…`:i.syncingRemote?`同步中…`:i.uploadingSlices?`正在上传切图…`:i.publishing?`正在发布版本…`:`远端操作:推送 / 卡片发布 / 预览(真机)/ 拉取 / 拉取全部 / 切图上传`,"data-testid":`remote-group`},{trigger:F(({open:e})=>[U(`button`,{type:`button`,class:A([`app__btn app__btn--remote`,{"app__btn--warn":i.savedRemote&&i.verifiedRemote===!1,"app__remote-trigger--active":e,"is-processing":i.savingRemote||i.syncingRemote||i.uploadingSlices||i.publishing}]),disabled:i.savingRemote||i.syncingRemote||i.uploadingSlices||i.publishing},[i.savingRemote||i.syncingRemote||i.uploadingSlices||i.publishing?(B(),V(`svg`,QI,[...t[50]||=[U(`use`,{href:`#icon-loading`},null,-1)]])):i.savedRemote&&i.verifiedRemote!==!1?(B(),V(`svg`,$I,[...t[51]||=[U(`use`,{href:`#icon-cloud-check`},null,-1)]])):i.savedRemote&&i.verifiedRemote===!1?(B(),V(`svg`,eL,[...t[52]||=[U(`use`,{href:`#icon-cloud-alert`},null,-1)]])):(B(),V(`svg`,tL,[...t[53]||=[U(`use`,{href:`#icon-cloud`},null,-1)]])),t[55]||=U(`span`,null,`远端`,-1),(B(),V(`svg`,{class:A([`app__icon app__icon--chev`,{"app__icon--chev--open":e}]),viewBox:`0 0 16 16`,width:`12`,height:`12`,"aria-hidden":`true`},[...t[54]||=[U(`use`,{href:`#icon-chevron`},null,-1)]],2))],10,ZI)]),default:F(({close:e})=>[U(`ul`,nL,[U(`li`,{class:A([`app__remote-item`,{"is-disabled":!i.preview||!i.selectedId||!a.hasCardSource}]),title:a.hasCardSource?`预览当前卡:生成真机预览二维码(FinMall App 扫码)`:`该卡未经「同步远程」导入,无远端来源信息,无法生成真机预览二维码`,"data-testid":`remote-preview`,role:`menuitem`,onClick:t=>{a.chooseRsave(`preview`),e()}},[...t[56]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-device-mobile`})],-1),U(`span`,null,`真机预览`,-1)]],10,rL),K(` 切图上传:仅点击时执行,把「当前卡片引用到的」src/slices 切图上传到 FinMall 图片库
322
324
  (CC0000.do),并把该卡 schema/data 里的 /slices/ 引用改写为返回的 @filestore/ 线上地址。
323
325
  没有任何自动上传路径;共享切图若已上传过(sha256 命中 src/slices/manifest.json)直接复用地址。
324
- 不要求 hasCardSource:本地自建卡同样需要先把切图传上去,才能推版本 / 出真机预览。 `),U(`li`,{class:A([`app__remote-item app__remote-item--upload`,{"is-disabled":!i.preview||!i.selectedId||i.uploadingSlices}]),title:i.uploadingSlices?`正在上传切图…`:`当前卡切图上传:把当前卡片引用的本地切图(src/slices)上传到 FinMall 图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…);本地切图文件保留`,"data-testid":`slice-upload`,role:`menuitem`,onClick:t=>{a.chooseRsave(`slices`),e()}},[...t[57]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-image-upload`})],-1),U(`span`,null,`切图上传`,-1)]],10,YI),U(`li`,{class:A([`app__remote-item app__remote-item--save`,{"is-disabled":!i.preview||!i.selectedId||i.savingRemote||!a.hasCardSource}]),title:a.hasCardSource?`推送当前卡:把本地卡片版本覆盖到远端 FinMall`:`该卡未经「同步远程」导入,无远端来源信息,无法推送版本`,"data-testid":`save-remote`,role:`menuitem`,onClick:t=>{a.chooseRsave(`save`),e()}},[...t[58]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-git-push`})],-1),U(`span`,null,`推送`,-1)]],10,XI),U(`li`,{class:A([`app__remote-item app__remote-item--sync`,{"is-disabled":!i.preview||!i.selectedId||i.syncingRemote}]),"data-testid":`sync-selected`,role:`menuitem`,onClick:t=>{a.chooseSync(`selected`),e()}},[...t[59]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-git-pull`})],-1),U(`span`,null,`拉取`,-1)]],10,ZI),U(`li`,{class:A([`app__remote-item app__remote-item--sync`,{"is-disabled":i.syncingRemote}]),"data-testid":`sync-full`,role:`menuitem`,onClick:t=>{a.chooseSync(`full`),e()}},[...t[60]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-download`})],-1),U(`span`,null,`拉取全部`,-1)]],10,QI)])]),_:1},8,[`disabled`,`title`]),K(` 接口调用面板开关:右侧常驻面板的展开/收起,状态持久化 `),U(`button`,{class:A([`app__btn app__btn--icon`,{"app__btn--active":i.apiPanelOpen}]),type:`button`,title:i.apiPanelOpen?`收起接口调用面板`:`打开接口调用面板`,"aria-pressed":i.apiPanelOpen,onClick:t[7]||=(...e)=>a.toggleApiPanel&&a.toggleApiPanel(...e)},[...t[61]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-layout`})],-1)]],10,$I),K(` 主题切换:深色(当前)/ 浅色,复用同名 CSS 变量整体换肤,状态持久化 `),U(`button`,{class:`theme-toggle`,type:`button`,role:`switch`,"aria-checked":i.theme===`light`,title:i.theme===`light`?`切换到深色主题`:`切换到浅色主题`,onClick:t[8]||=(...e)=>a.toggleTheme&&a.toggleTheme(...e)},[U(`span`,tL,[U(`span`,nL,[i.theme===`light`?(B(),V(`svg`,rL,[...t[62]||=[U(`use`,{href:`#icon-sun`},null,-1)]])):(B(),V(`svg`,iL,[...t[63]||=[U(`use`,{href:`#icon-moon`},null,-1)]]))])])],8,eL),K(` 本地开发服务设置入口 `),U(`div`,aL,[U(`button`,{class:A([`app__btn app__btn--icon`,a.devSvcClass]),type:`button`,title:a.devSvcTitle,onClick:t[9]||=e=>i.devServiceOpen=!i.devServiceOpen},[...t[64]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-link`})],-1)]],10,oL),K(` 点遮罩关闭:与事件帮助气泡等轻量浮层同一交互 `),i.devServiceOpen?(B(),V(`div`,{key:0,class:`app__dev-svc-mask`,onClick:t[10]||=e=>i.devServiceOpen=!1})):K(`v-if`,!0),W(ic,{name:`pop`},{default:F(()=>[i.devServiceOpen?(B(),V(`div`,{key:0,class:`app__dev-svc-panel`,onClick:t[17]||=q(()=>{},[`stop`])},[U(`div`,sL,[t[65]||=U(`span`,{class:`app__dev-svc-title`},`本地开发服务`,-1),U(`button`,{class:`app__dev-svc-close`,type:`button`,title:`关闭`,onClick:t[11]||=e=>i.devServiceOpen=!1})]),U(`div`,cL,[U(`label`,lL,[t[66]||=U(`span`,null,`启用`,-1),W(c,{modelValue:i.devServiceForm.enabled,"onUpdate:modelValue":t[12]||=e=>i.devServiceForm.enabled=e},null,8,[`modelValue`])]),U(`label`,uL,[t[67]||=U(`span`,null,`服务地址`,-1),I(U(`input`,{type:`text`,"onUpdate:modelValue":t[13]||=e=>i.devServiceForm.baseUrl=e,placeholder:`http://127.0.0.1:8787`},null,512),[[il,i.devServiceForm.baseUrl]])]),U(`label`,dL,[t[68]||=U(`span`,null,`访问令牌(可选)`,-1),I(U(`input`,{type:`text`,"onUpdate:modelValue":t[14]||=e=>i.devServiceForm.token=e,placeholder:`留空则不校验`},null,512),[[il,i.devServiceForm.token]])]),i.apiBaseResolved===null?(B(),V(`p`,fL,[a.devSvcBlockReason===`disabled`?(B(),V(z,{key:0},[G(`已填写服务地址,但「启用」开关未打开。请开启「启用」开关并点击保存,本地开发服务才会生效。`)],64)):(B(),V(z,{key:1},[G(`请填写本机 cardbuddy 服务地址(默认 http://127.0.0.1:8787),打开「启用」开关并保存后,编辑功能才会生效。`)],64))])):K(`v-if`,!0),U(`div`,pL,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[15]||=e=>i.devServiceOpen=!1},`关闭`),U(`button`,{class:`ni-btn`,type:`button`,onClick:t[16]||=(...e)=>a.saveDevService&&a.saveDevService(...e)},`保存`)])])])):K(`v-if`,!0)]),_:1})])]),U(`span`,mL,j(i.rt.revision),1)],512),[[Sc,!i.chromeOff]]),K(` AI 开发助手悬浮入口:可拖拽圆形按钮(尺寸 / 配色走规范 Token,图标取自 sprite)。
325
- 拖动用 Pointer Events 统一鼠标 / 触摸;拖拽位移超阈值才判定为拖动,否则照常点击开合面板。 `),U(`button`,{ref:`aiFab`,class:A([`ai-fab`,{"ai-fab--active":i.aiChatOpen,"ai-fab--busy":i.chatBusy,"ai-fab--dragging":i.fab.dragging}]),type:`button`,title:a.fabTitle,"aria-expanded":i.aiChatOpen?`true`:`false`,"data-testid":`ai-fab`,style:k(a.fabStyle),onPointerdown:t[18]||=(...e)=>a.onFabPointerDown&&a.onFabPointerDown(...e),onPointermove:t[19]||=(...e)=>a.onFabPointerMove&&a.onFabPointerMove(...e),onPointerup:t[20]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onPointercancel:t[21]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onClick:t[22]||=(...e)=>a.onFabClick&&a.onFabClick(...e)},[...t[69]||=[U(`svg`,{class:`ai-fab__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-sparkles`})],-1)]],46,hL),K(` AI 开发助手对话面板:右侧抽屉,宽度可拖(320px ~ 视口 50%,默认 33%),对话记录按卡片落盘 `),W(l,{ref:`chatPanel`,visible:i.aiChatOpen,"card-id":i.selectedId,"card-name":a.selectedCardName,"card-empty":a.cardEmpty,onClose:t[23]||=e=>i.aiChatOpen=!1,onBusy:t[24]||=e=>i.chatBusy=e,onTurnProgress:t[25]||=e=>i.chatProgress=e,onTurnFinished:a.onChatTurnFinished,onRollbackTurn:a.onChatRollbackTurn,onLocateNode:a.onAiLocateNode},null,8,[`visible`,`card-id`,`card-name`,`card-empty`,`onTurnFinished`,`onRollbackTurn`,`onLocateNode`]),K(` 部署态但未配置本地开发服务:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved===null&&!i.chromeOff?(B(),V(`div`,gL,[a.devSvcBlockReason===`disabled`?(B(),V(z,{key:0},[G(` ⚠ 本地开发服务未生效:已填写地址,但未打开「启用」开关。请点击右上角 「连接」图标打开「本地开发服务」设置,开启「启用」开关并保存后,编辑功能才会生效。 `)],64)):(B(),V(z,{key:1},[G(` ⚠ 未配置本地开发服务:当前为部署态,编辑功能不可用。请点击右上角 「连接」图标打开「本地开发服务」设置,填写本机 cardbuddy 地址、打开「启用」开关并保存后,才能编辑卡片。 `)],64))])):K(`v-if`,!0),K(` 已配置本地服务但实时连接已断开:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved!==null&&i.devSvcDown&&!i.chromeOff?(B(),V(`div`,_L,` ⚠ 本地开发服务已断开:连接失败或服务已停止,编辑 / 同步功能暂不可用。请确认本地 cardbuddy 是否运行,或点击右上角「连接」图标重新保存配置。 `)):K(`v-if`,!0),K(` 外部改了当前卡、无未保存改动 → 自动重载后的非阻塞轻提示(chrome=off 截图模式不显示) `),i.externalReloadNote&&!i.chromeOff?(B(),V(`div`,vL,` ↻ `+j(i.externalReloadNote),1)):K(`v-if`,!0),U(`main`,yL,[U(`div`,{class:A([`phone`,{"phone--dragging":i.dragging}]),style:k({width:a.previewWidth+`px`})},[K(` 缩放外框:占满整列(宽高由 CSS flex 填满);画布不做 transform 缩放,直接按实际尺寸布局 `),U(`div`,{class:`phone__frame`,style:k(a.frameStyle)},[K(` 画布层:直接按实际列宽/列高布局(width/height 100%),不再使用 transform 缩放 `),U(`div`,bL,[K(` 画布工具条:原 device-bar(顶 28px)+ preview-statusbar(底 28px)合并为一条 32px,
326
+ 不要求 hasCardSource:本地自建卡同样需要先把切图传上去,才能推版本 / 出真机预览。 `),U(`li`,{class:A([`app__remote-item app__remote-item--upload`,{"is-disabled":!i.preview||!i.selectedId||i.uploadingSlices}]),title:i.uploadingSlices?`正在上传切图…`:`当前卡切图上传:把当前卡片引用的本地切图(src/slices)上传到 FinMall 图片库,并把卡片里的 /slices/ 引用替换为线上地址(@filestore/…);本地切图文件保留`,"data-testid":`slice-upload`,role:`menuitem`,onClick:t=>{a.chooseRsave(`slices`),e()}},[...t[57]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-image-upload`})],-1),U(`span`,null,`切图上传`,-1)]],10,iL),U(`li`,{class:A([`app__remote-item app__remote-item--save`,{"is-disabled":!i.preview||!i.selectedId||i.savingRemote||!a.hasCardSource}]),title:a.hasCardSource?`推送当前卡:把本地卡片版本覆盖到远端 FinMall`:`该卡未经「同步远程」导入,无远端来源信息,无法推送版本`,"data-testid":`save-remote`,role:`menuitem`,onClick:t=>{a.chooseRsave(`save`),e()}},[...t[58]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-git-push`})],-1),U(`span`,null,`推送`,-1)]],10,aL),K(` 卡片发布:取远端当前最大版本号 +1 后发布上线(IDC10004 → IDC10016);
327
+ 发布的是远端已保存的卡片内容,故应先「推送当前卡」把本地内容保存到远端。
328
+ 要求 hasCardSource(远端卡):本地自建卡无远端来源,禁止发布。 `),U(`li`,{class:A([`app__remote-item app__remote-item--publish`,{"is-disabled":!i.preview||!i.selectedId||i.publishing||!a.hasCardSource}]),title:a.hasCardSource?`卡片发布:取远端最大版本号 +1 后发布上线当前卡片(发布的是远端已保存内容,建议先「推送当前卡」)`:`该卡未经「同步远程」导入,无远端来源信息,无法发布版本`,"data-testid":`card-publish`,role:`menuitem`,onClick:t=>{a.chooseRsave(`publish`),e()}},[...t[59]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-rocket`})],-1),U(`span`,null,`卡片发布`,-1)]],10,oL),U(`li`,{class:A([`app__remote-item app__remote-item--sync`,{"is-disabled":!i.preview||!i.selectedId||i.syncingRemote}]),"data-testid":`sync-selected`,role:`menuitem`,onClick:t=>{a.chooseSync(`selected`),e()}},[...t[60]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-git-pull`})],-1),U(`span`,null,`拉取`,-1)]],10,sL),U(`li`,{class:A([`app__remote-item app__remote-item--sync`,{"is-disabled":i.syncingRemote}]),"data-testid":`sync-full`,role:`menuitem`,onClick:t=>{a.chooseSync(`full`),e()}},[...t[61]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-download`})],-1),U(`span`,null,`拉取全部`,-1)]],10,cL)])]),_:1},8,[`disabled`,`title`]),K(` 接口调用面板开关:右侧常驻面板的展开/收起,状态持久化 `),U(`button`,{class:A([`app__btn app__btn--icon`,{"app__btn--active":i.apiPanelOpen}]),type:`button`,title:i.apiPanelOpen?`收起接口调用面板`:`打开接口调用面板`,"aria-pressed":i.apiPanelOpen,onClick:t[7]||=(...e)=>a.toggleApiPanel&&a.toggleApiPanel(...e)},[...t[62]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-layout`})],-1)]],10,lL),K(` 主题切换:深色(当前)/ 浅色,复用同名 CSS 变量整体换肤,状态持久化 `),U(`button`,{class:`theme-toggle`,type:`button`,role:`switch`,"aria-checked":i.theme===`light`,title:i.theme===`light`?`切换到深色主题`:`切换到浅色主题`,onClick:t[8]||=(...e)=>a.toggleTheme&&a.toggleTheme(...e)},[U(`span`,dL,[U(`span`,fL,[i.theme===`light`?(B(),V(`svg`,pL,[...t[63]||=[U(`use`,{href:`#icon-sun`},null,-1)]])):(B(),V(`svg`,mL,[...t[64]||=[U(`use`,{href:`#icon-moon`},null,-1)]]))])])],8,uL),K(` 本地开发服务设置入口 `),U(`div`,hL,[U(`button`,{class:A([`app__btn app__btn--icon`,a.devSvcClass]),type:`button`,title:a.devSvcTitle,onClick:t[9]||=e=>i.devServiceOpen=!i.devServiceOpen},[...t[65]||=[U(`svg`,{class:`app__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-link`})],-1)]],10,gL),K(` 点遮罩关闭:与事件帮助气泡等轻量浮层同一交互 `),i.devServiceOpen?(B(),V(`div`,{key:0,class:`app__dev-svc-mask`,onClick:t[10]||=e=>i.devServiceOpen=!1})):K(`v-if`,!0),W(ic,{name:`pop`},{default:F(()=>[i.devServiceOpen?(B(),V(`div`,{key:0,class:`app__dev-svc-panel`,onClick:t[17]||=q(()=>{},[`stop`])},[U(`div`,_L,[t[66]||=U(`span`,{class:`app__dev-svc-title`},`本地开发服务`,-1),U(`button`,{class:`app__dev-svc-close`,type:`button`,title:`关闭`,onClick:t[11]||=e=>i.devServiceOpen=!1})]),U(`div`,vL,[U(`label`,yL,[t[67]||=U(`span`,null,`启用`,-1),W(c,{modelValue:i.devServiceForm.enabled,"onUpdate:modelValue":t[12]||=e=>i.devServiceForm.enabled=e},null,8,[`modelValue`])]),U(`label`,bL,[t[68]||=U(`span`,null,`服务地址`,-1),I(U(`input`,{type:`text`,"onUpdate:modelValue":t[13]||=e=>i.devServiceForm.baseUrl=e,placeholder:`http://127.0.0.1:8787`},null,512),[[il,i.devServiceForm.baseUrl]])]),U(`label`,xL,[t[69]||=U(`span`,null,`访问令牌(可选)`,-1),I(U(`input`,{type:`text`,"onUpdate:modelValue":t[14]||=e=>i.devServiceForm.token=e,placeholder:`留空则不校验`},null,512),[[il,i.devServiceForm.token]])]),i.apiBaseResolved===null?(B(),V(`p`,SL,[a.devSvcBlockReason===`disabled`?(B(),V(z,{key:0},[G(`已填写服务地址,但「启用」开关未打开。请开启「启用」开关并点击保存,本地开发服务才会生效。`)],64)):(B(),V(z,{key:1},[G(`请填写本机 cardbuddy 服务地址(默认 http://127.0.0.1:8787),打开「启用」开关并保存后,编辑功能才会生效。`)],64))])):K(`v-if`,!0),U(`div`,CL,[U(`button`,{class:`ni-btn ni-btn--ghost`,type:`button`,onClick:t[15]||=e=>i.devServiceOpen=!1},`关闭`),U(`button`,{class:`ni-btn`,type:`button`,onClick:t[16]||=(...e)=>a.saveDevService&&a.saveDevService(...e)},`保存`)])])])):K(`v-if`,!0)]),_:1})])]),U(`span`,wL,j(i.rt.revision),1)],512),[[Sc,!i.chromeOff]]),K(` AI 开发助手悬浮入口:可拖拽圆形按钮(尺寸 / 配色走规范 Token,图标取自 sprite)。
329
+ 拖动用 Pointer Events 统一鼠标 / 触摸;拖拽位移超阈值才判定为拖动,否则照常点击开合面板。 `),U(`button`,{ref:`aiFab`,class:A([`ai-fab`,{"ai-fab--active":i.aiChatOpen,"ai-fab--busy":i.chatBusy,"ai-fab--dragging":i.fab.dragging}]),type:`button`,title:a.fabTitle,"aria-expanded":i.aiChatOpen?`true`:`false`,"data-testid":`ai-fab`,style:k(a.fabStyle),onPointerdown:t[18]||=(...e)=>a.onFabPointerDown&&a.onFabPointerDown(...e),onPointermove:t[19]||=(...e)=>a.onFabPointerMove&&a.onFabPointerMove(...e),onPointerup:t[20]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onPointercancel:t[21]||=(...e)=>a.onFabPointerUp&&a.onFabPointerUp(...e),onClick:t[22]||=(...e)=>a.onFabClick&&a.onFabClick(...e)},[...t[70]||=[U(`svg`,{class:`ai-fab__icon`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-sparkles`})],-1)]],46,TL),K(` AI 开发助手对话面板:右侧抽屉,宽度可拖(320px ~ 视口 50%,默认 33%),对话记录按卡片落盘 `),W(l,{ref:`chatPanel`,visible:i.aiChatOpen,"card-id":i.selectedId,"card-name":a.selectedCardName,"card-empty":a.cardEmpty,onClose:t[23]||=e=>i.aiChatOpen=!1,onBusy:t[24]||=e=>i.chatBusy=e,onTurnProgress:t[25]||=e=>i.chatProgress=e,onTurnFinished:a.onChatTurnFinished,onRollbackTurn:a.onChatRollbackTurn,onLocateNode:a.onAiLocateNode},null,8,[`visible`,`card-id`,`card-name`,`card-empty`,`onTurnFinished`,`onRollbackTurn`,`onLocateNode`]),K(` 部署态但未配置本地开发服务:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved===null&&!i.chromeOff?(B(),V(`div`,EL,[a.devSvcBlockReason===`disabled`?(B(),V(z,{key:0},[G(` ⚠ 本地开发服务未生效:已填写地址,但未打开「启用」开关。请点击右上角 「连接」图标打开「本地开发服务」设置,开启「启用」开关并保存后,编辑功能才会生效。 `)],64)):(B(),V(z,{key:1},[G(` ⚠ 未配置本地开发服务:当前为部署态,编辑功能不可用。请点击右上角 「连接」图标打开「本地开发服务」设置,填写本机 cardbuddy 地址、打开「启用」开关并保存后,才能编辑卡片。 `)],64))])):K(`v-if`,!0),K(` 已配置本地服务但实时连接已断开:顶部提示条(chrome=off 截图模式不显示) `),i.apiBaseResolved!==null&&i.devSvcDown&&!i.chromeOff?(B(),V(`div`,DL,` ⚠ 本地开发服务已断开:连接失败或服务已停止,编辑 / 同步功能暂不可用。请确认本地 cardbuddy 是否运行,或点击右上角「连接」图标重新保存配置。 `)):K(`v-if`,!0),K(` 外部改了当前卡、无未保存改动 → 自动重载后的非阻塞轻提示(chrome=off 截图模式不显示) `),i.externalReloadNote&&!i.chromeOff?(B(),V(`div`,OL,` ↻ `+j(i.externalReloadNote),1)):K(`v-if`,!0),U(`main`,kL,[U(`div`,{class:A([`phone`,{"phone--dragging":i.dragging}]),style:k({width:a.previewWidth+`px`})},[K(` 缩放外框:占满整列(宽高由 CSS flex 填满);画布不做 transform 缩放,直接按实际尺寸布局 `),U(`div`,{class:`phone__frame`,style:k(a.frameStyle)},[K(` 画布层:直接按实际列宽/列高布局(width/height 100%),不再使用 transform 缩放 `),U(`div`,AL,[K(` 画布工具条:原 device-bar(顶 28px)+ preview-statusbar(底 28px)合并为一条 32px,
326
330
  竖向空间还给手机视口。左组=改变画布(背景 / 宽度预设),右组=画布现状与动作(尺寸读数 / 刷新);
327
- 预览列窄于 300px 时收起读数与文案只留图标(188 预设下仍单行可用)。 `),I(U(`div`,{class:A([`canvas-bar`,{"canvas-bar--tight":a.previewWidth<300}])},[K(` 画布背景:触发器带当前底色小样,不展开下拉也可见当前模式 `),W(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:i.canvasBg,options:i.bgOptions.map(e=>({key:e.key,value:e.label+`背景`})),onChange:a.chooseBg},{trigger:F(()=>[U(`span`,{class:`canvas-bar__chip`,title:`画布背景:`+a.currentBg.label},[U(`i`,{class:A([`canvas-bar__swatch`,`canvas-bar__swatch--`+i.canvasBg])},null,2),U(`span`,SL,j(a.currentBg.label)+`背景`,1),t[70]||=U(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron`})],-1)],8,xL)]),_:1},8,[`value`,`options`,`onChange`]),K(` 宽度预设:触发器直接显示当前宽度,省去独立的「宽度」标签 `),W(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:a.canvasW,options:i.presetSizes,onChange:a.setPresetWidth},{trigger:F(()=>[U(`span`,CL,[t[71]||=U(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-stretch`})],-1),U(`span`,wL,j(a.canvasW)+` px`,1),t[72]||=U(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron`})],-1)])]),_:1},8,[`value`,`options`,`onChange`]),t[74]||=U(`span`,{class:`canvas-bar__spacer`},null,-1),U(`span`,TL,j(a.canvasW)+` × `+j(i.viewportHeight),1),U(`button`,{class:A([`canvas-bar__iconbtn`,{"is-loading":i.refreshing}]),type:`button`,disabled:!i.selectedId||i.refreshing,title:`刷新卡片,重新加载`,onClick:t[26]||=(...e)=>a.refreshCard&&a.refreshCard(...e)},[...t[73]||=[U(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-rotate-cw`})],-1)]],10,EL)],2),[[Sc,!i.chromeOff]]),K(`
331
+ 预览列窄于 300px 时收起读数与文案只留图标(188 预设下仍单行可用)。 `),I(U(`div`,{class:A([`canvas-bar`,{"canvas-bar--tight":a.previewWidth<300}])},[K(` 画布背景:触发器带当前底色小样,不展开下拉也可见当前模式 `),W(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:i.canvasBg,options:i.bgOptions.map(e=>({key:e.key,value:e.label+`背景`})),onChange:a.chooseBg},{trigger:F(()=>[U(`span`,{class:`canvas-bar__chip`,title:`画布背景:`+a.currentBg.label},[U(`i`,{class:A([`canvas-bar__swatch`,`canvas-bar__swatch--`+i.canvasBg])},null,2),U(`span`,ML,j(a.currentBg.label)+`背景`,1),t[71]||=U(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron`})],-1)],8,jL)]),_:1},8,[`value`,`options`,`onChange`]),K(` 宽度预设:触发器直接显示当前宽度,省去独立的「宽度」标签 `),W(s,{borderless:``,size:`xs`,placement:`bottom-start`,value:a.canvasW,options:i.presetSizes,onChange:a.setPresetWidth},{trigger:F(()=>[U(`span`,NL,[t[72]||=U(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-stretch`})],-1),U(`span`,PL,j(a.canvasW)+` px`,1),t[73]||=U(`svg`,{class:`canvas-bar__chev`,viewBox:`0 0 16 16`,"aria-hidden":`true`},[U(`use`,{href:`#icon-chevron`})],-1)])]),_:1},8,[`value`,`options`,`onChange`]),t[75]||=U(`span`,{class:`canvas-bar__spacer`},null,-1),U(`span`,FL,j(a.canvasW)+` × `+j(i.viewportHeight),1),U(`button`,{class:A([`canvas-bar__iconbtn`,{"is-loading":i.refreshing}]),type:`button`,disabled:!i.selectedId||i.refreshing,title:`刷新卡片,重新加载`,onClick:t[26]||=(...e)=>a.refreshCard&&a.refreshCard(...e)},[...t[74]||=[U(`svg`,{class:`canvas-bar__icn`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,"stroke-width":`2`,"stroke-linecap":`round`,"stroke-linejoin":`round`,"aria-hidden":`true`},[U(`use`,{href:`#icon-rotate-cw`})],-1)]],10,IL)],2),[[Sc,!i.chromeOff]]),K(`
328
332
  固定视口:弹层(alertCard / alertDialog / toast)相对此容器 absolute inset:0 定位,
329
333
  不随内层 phone__screen 的卡片内容滚动,保证遮罩始终精确覆盖可视区域。
330
334
  `),U(`div`,{ref:`phoneViewport`,class:`phone-viewport`,onClick:t[27]||=(...e)=>a.onCanvasClick&&a.onCanvasClick(...e)},[U(`div`,{class:A([`phone__screen`,`phone__screen--bg-`+(i.chromeOff?`white`:i.canvasBg)]),style:k(i.chromeOff&&i.preview?{width:(i.preview.view.width||375)+`px`}:null),"data-card-ready":i.cardReady?`1`:null},[K(`
@@ -332,12 +336,12 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho
332
336
  等场景时强制 RenderTree 重新挂载,从而保证新卡片/新数据的「初始化动作」
333
337
  (onReady 等生命周期事件,如 assetOverview 计算 ratio)一定在 created 阶段
334
338
  执行,不会出现重载后 init 不跑、依赖字段为 undefined 而渲染成 NaN% 的问题。
335
- `),i.preview?(B(),H(u,{key:i.selectedId+`:`+i.reloadToken,node:i.preview.view,scope:i.rt.state,"selected-node-id":i.selectedNodeId},null,8,[`node`,`scope`,`selected-node-id`])):K(`v-if`,!0),K(` 节点选中遮罩覆盖层:作为滚动容器子节点,随内容滚动并精确贴合选中元素 `),W(d),K(` 结构树 hover 参考线:贯穿画布的荧光绿辅助线(左/右竖线、上/下横线),仅 hover 时显示 `),W(f)],14,DL),K(` 弹窗卡片图层:alertCard / closeAlertCard 的展现层(在预览区域内弹出) `),W(p,{"main-rt":i.rt},null,8,[`main-rt`]),K(` 设备级模拟 UI:alertDialog 对话框 / showToast 弱提示 / showPicker 选择器 / showDatePicker 日期选择器 `),W(m),W(h),W(g)],512)])],4)],6),K(` 左分隔条:预览列 | 工作区 接缝。底面板 / 状态栏的左缘即此缝(随预览宽度联动),
339
+ `),i.preview?(B(),H(u,{key:i.selectedId+`:`+i.reloadToken,node:i.preview.view,scope:i.rt.state,"selected-node-id":i.selectedNodeId},null,8,[`node`,`scope`,`selected-node-id`])):K(`v-if`,!0),K(` 节点选中遮罩覆盖层:作为滚动容器子节点,随内容滚动并精确贴合选中元素 `),W(d),K(` 结构树 hover 参考线:贯穿画布的荧光绿辅助线(左/右竖线、上/下横线),仅 hover 时显示 `),W(f)],14,LL),K(` 弹窗卡片图层:alertCard / closeAlertCard 的展现层(在预览区域内弹出) `),W(p,{"main-rt":i.rt},null,8,[`main-rt`]),K(` 设备级模拟 UI:alertDialog 对话框 / showToast 弱提示 / showPicker 选择器 / showDatePicker 日期选择器 `),W(m),W(h),W(g)],512)])],4)],6),K(` 左分隔条:预览列 | 工作区 接缝。底面板 / 状态栏的左缘即此缝(随预览宽度联动),
336
340
  故定位在 .app__stage 通到底部,全程可拖;右分隔条才收进两栏容器内。 `),I(U(`div`,{class:A([`splitter`,{"is-dragging":i.dragging}]),onPointerdown:t[28]||=q((...e)=>a.startDrag&&a.startDrag(...e),[`prevent`]),title:`拖拽调整预览区域宽度`},null,34),[[Sc,!i.chromeOff]]),K(` 中右工作区:上为「调试面板 + 接口调用面板」两栏,下为贯穿两栏的共同状态栏。
337
341
  状态栏与底部弹出面板(运行态 / 事件 / 变量绑定)均由 DebugPanel 内 Teleport 注入
338
342
  #app-workside-bar / #app-workside-panels,宽度贯穿中右两栏;Teleport 目标须在 DOM 中
339
- 先于面板挂载,故两个空容器写在前面,以 flex order 视觉置底。 `),I(U(`div`,OL,[t[75]||=U(`div`,{id:`app-workside-bar`,class:`workside__bar`},null,-1),t[76]||=U(`div`,{id:`app-workside-panels`,class:`workside__panels`},null,-1),U(`div`,kL,[K(` 拖拽分隔条:置于两栏容器内(定位上下文),只贯穿列区高度,不穿过底部弹出面板与状态栏 `),K(` 中右分隔条:调试面板 | 接口调用面板 接缝,拖动调整右栏宽度。
340
- 约束:中栏最小宽度 ≥ 屏宽 1/3,右栏最小宽度 ≥ 320px(见 startApiDrag) `),I(U(`div`,{class:A([`splitter splitter--api`,{"is-dragging":i.apiDragging}]),onPointerdown:t[29]||=q((...e)=>a.startApiDrag&&a.startApiDrag(...e),[`prevent`]),title:`拖拽调整接口调用面板宽度`},null,34),[[Sc,!i.chromeOff&&i.apiPanelOpen]]),W(_,{"chrome-off":i.chromeOff,rt:i.rt,preview:i.preview,schema:i.currentSchema,"card-id":i.selectedId,"reload-token":i.reloadToken,"card-count":i.cardCount,"selected-node-id":i.selectedNodeId,"move-collapse-token":i.moveCollapseToken,"active-tab":i.activeTab,onSchemaChanged:a.onSchemaChanged,onSchemaCommit:a.onSchemaCommit,onSelectNode:a.onSelectNode,"onUpdate:activeTab":t[30]||=e=>i.activeTab=e,onAddNode:a.onAddNode,onMoveNode:a.onMoveNode,onHoverNode:a.onHoverNode,onCopySelected:a.copySelectedNode,onPaste:a.pasteNode,onDuplicate:a.duplicateNode,onDeleteSelected:a.deleteSelectedNode,onRenameCard:a.openRenameCard,onResetImport:a.onRefresh,"dev-svc-class":a.devSvcClass,"dev-svc-title":a.devSvcTitle,"dev-svc-label":a.devSvcLabel,"dev-svc-conn":a.devSvcConn},null,8,`chrome-off.rt.preview.schema.card-id.reload-token.card-count.selected-node-id.move-collapse-token.active-tab.onSchemaChanged.onSchemaCommit.onSelectNode.onAddNode.onMoveNode.onHoverNode.onCopySelected.onPaste.onDuplicate.onDeleteSelected.onRenameCard.onResetImport.dev-svc-class.dev-svc-title.dev-svc-label.dev-svc-conn`.split(`.`)),K(` 右侧常驻「接口调用」面板:与预览列 / 调试面板呈左中右布局,
341
- 展开/收起由顶栏按钮与面板内 ✕ 控制,初始状态持久化 `),i.apiPanelOpen?(B(),H(v,{key:0,rt:i.rt,onClose:t[31]||=e=>i.apiPanelOpen=!1},null,8,[`rt`])):K(`v-if`,!0)],512)],512),[[Sc,!i.chromeOff]])],512),K(` 远端预览二维码弹层:点击顶栏「远端预览」按钮打开,手机(FinMall App)扫码真机查看 `),W(y,{visible:i.remotePreviewOpen,"page-id":i.currentSchema?i.currentSchema.pageId:``,schema:i.currentSchema,onClose:t[32]||=e=>i.remotePreviewOpen=!1},null,8,[`visible`,`page-id`,`schema`]),K(` 登录凭据弹窗:远程同步检测到缺凭据时弹出,填写账号密码(MD5 后)写入 .local/credentials.json `),W(ic,{name:`modal`},{default:F(()=>[i.loginModal?(B(),V(`div`,{key:0,class:`login-mask`,onClick:t[39]||=q((...e)=>a.closeLoginModal&&a.closeLoginModal(...e),[`self`])},[U(`div`,AL,[t[79]||=U(`div`,{class:`login-modal__title`},`FinMall 登录凭据`,-1),t[80]||=U(`div`,{class:`login-modal__desc`},` 本地登录凭据缺失,请填写账号与密码。密码仅做 MD5 后保存,不落明文。 `,-1),U(`label`,jL,[t[77]||=U(`span`,{class:`login-modal__label`},`账号`,-1),I(U(`input`,{class:`login-modal__input`,type:`text`,"onUpdate:modelValue":t[33]||=e=>i.loginName=e,placeholder:`FinMall 登录账号`,disabled:i.loginSubmitting,onKeyup:t[34]||=vl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,ML),[[il,i.loginName]])]),U(`label`,NL,[t[78]||=U(`span`,{class:`login-modal__label`},`密码`,-1),I(U(`input`,{class:`login-modal__input`,type:`password`,"onUpdate:modelValue":t[35]||=e=>i.loginPassword=e,placeholder:`FinMall 登录密码`,disabled:i.loginSubmitting,onKeyup:t[36]||=vl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,PL),[[il,i.loginPassword]])]),i.loginError?(B(),V(`div`,FL,j(i.loginError),1)):K(`v-if`,!0),U(`div`,IL,[U(`button`,{class:`login-modal__btn login-modal__btn--ghost`,type:`button`,disabled:i.loginSubmitting,onClick:t[37]||=(...e)=>a.closeLoginModal&&a.closeLoginModal(...e)},` 取消 `,8,LL),U(`button`,{class:`login-modal__btn login-modal__btn--primary`,type:`button`,disabled:i.loginSubmitting,onClick:t[38]||=(...e)=>a.submitLogin&&a.submitLogin(...e)},j(i.loginSubmitting?`保存中…`:`保存并同步`),9,RL)])])])):K(`v-if`,!0)]),_:1}),K(` 组件选择面板:点击结构树每行的「+」后弹出,选择类型即插入对应节点 `),W(ic,{name:`modal`},{default:F(()=>[i.addNodePanelOpen?(B(),H(b,{key:0,onPick:a.onPickComponent,onClose:a.cancelAddNode},null,8,[`onPick`,`onClose`])):K(`v-if`,!0)]),_:1}),K(` 二次确认弹窗:版本推送 / 当前同步 / 全量同步 等写/覆盖类操作前弹出,确认后才执行 `),W(x,{visible:i.confirm.show,title:i.confirm.title,message:i.confirm.message,"confirm-text":i.confirm.confirmText,"cancel-text":i.confirm.cancelText,severity:i.confirm.severity,onConfirm:a.onConfirmDialog,onCancel:a.onCancelDialog},null,8,[`visible`,`title`,`message`,`confirm-text`,`cancel-text`,`severity`,`onConfirm`,`onCancel`]),K(` 卡片网格预览弹窗:点击顶栏「网格预览」图标按钮打开,选择卡片即载入工作台 `),W(S,{visible:i.galleryOpen,cards:i.cardList,"selected-id":i.selectedId,onSelect:a.onSelect,onClose:a.closeGallery,onDelete:a.onGalleryDelete},null,8,[`visible`,`cards`,`selected-id`,`onSelect`,`onClose`,`onDelete`]),K(` 卡片表单弹窗(新增空白卡片 / 卡片重命名 共用一个弹窗):成功后关弹窗 + 刷列表 + 加载目标卡;existing-ids 供 ID 重名前置判定 `),W(C,{visible:i.cardDialog.visible,mode:i.cardDialog.mode,"card-id":i.cardDialog.cardId,"card-desc":i.cardDialog.cardDesc,"existing-ids":a.cardIds,onClose:t[40]||=e=>i.cardDialog.visible=!1,onCreated:a.onNewCardCreated,onRenamed:a.onCardRenamed},null,8,[`visible`,`mode`,`card-id`,`card-desc`,`existing-ids`,`onCreated`,`onRenamed`]),K(` App 级弱提示:顶栏异步操作(远端保存 / 同步)完成反馈,浮于 App 外壳顶部居中 `),W(w),K(` 对话图片大图查看器:AI 面板里点预览图后全屏缩放查看,Teleport 到 body `),W(ee)],6)}var BL=X(TI,[[`render`,zL],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/App.vue`]]),VL={name:`SetText`,props:{...l_,multiline:{type:Boolean,default:!1}},emits:u_,computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},rows(){let e=this.options.autosize;return e&&typeof e==`object`&&e.minRows?e.minRows:4}},methods:{onInput(e){this.$emit(`input`,e)}}},HL=[`rows`,`placeholder`,`disabled`,`value`],UL=[`placeholder`,`disabled`,`value`];function WL(e,t,n,r,i,a){return n.multiline?(B(),V(`textarea`,{key:0,class:`st-textarea`,rows:a.rows,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,HL)):(B(),V(`input`,{key:1,class:`ni-input`,type:`text`,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[2]||=e=>a.onInput(e.target.value),onChange:t[3]||=t=>e.$emit(`change`)},null,40,UL))}var GL=X(VL,[[`render`,WL],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetText.vue`]]),KL={integer:/^-?(0|[1-9][0-9]*)?$/,"+integer":/^(0|[1-9][0-9]*)?$/,"-integer":/^(0|-[1-9]?[0-9]*)?$/,float:/^-?([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"+float":/^([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"-float":/^(0|-[0-9]*|-(0|[1-9][0-9]*)\.[0-9]*)?$/},qL={name:`SetNumber`,props:l_,emits:u_,data(){return{inputValue:``,sugOpen:!1}},computed:{suggestions(){return this.options.iParamList||[]},pattern(){return KL[this.options.type]||KL.integer}},watch:{value:{immediate:!0,handler(e){this.inputValue=e==null?``:String(e)}}},methods:{onInput(e){if(!this.pattern.test(e)){this.$refs.field.value=this.inputValue;return}this.inputValue=e,this.$emit(`input`,e)},step(e){let t=parseFloat(this.inputValue),n=String((Number.isNaN(t)?0:t)+e);this.pattern.test(n)&&(this.inputValue=n,this.$emit(`input`,n),this.emitChange())},pick(e){this.sugOpen=!1,this.inputValue=String(e.key),this.$emit(`input`,this.inputValue),this.emitChange()},closeSug(){setTimeout(()=>this.sugOpen=!1,0)},emitChange(){this.$emit(`change`)}}},JL={class:`st-number-wrap`},YL={class:`st-number`},XL=[`placeholder`,`disabled`,`value`],ZL={key:0,class:`st-number__symbol st-number__symbol--btn`},QL={key:1,class:`st-number__symbol`},$L={key:0,class:`st-pop st-pop--sug`},eR=[`onMousedown`];function tR(e,t,n,r,i,a){return B(),V(`div`,JL,[U(`div`,YL,[U(`input`,{ref:`field`,class:`st-number__field`,type:`text`,placeholder:e.options.placeholder||`请输入`,disabled:e.disabled,value:i.inputValue,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=e=>a.emitChange(),onKeydown:[t[2]||=vl(q(e=>a.step(1),[`prevent`]),[`up`]),t[3]||=vl(q(e=>a.step(-1),[`prevent`]),[`down`])],onBlur:t[4]||=e=>a.closeSug()},null,40,XL),e.$slots.symbol?(B(),V(`span`,ZL,[Qi(e.$slots,`symbol`)])):e.options.symbol&&e.options.symbol!==!0?(B(),V(`span`,QL,j(e.options.symbol),1)):K(`v-if`,!0),a.suggestions.length?(B(),V(`span`,{key:2,class:`st-number__caret`,title:`预设值`,onMousedown:t[5]||=q(e=>i.sugOpen=!i.sugOpen,[`prevent`])},`▾`,32)):K(`v-if`,!0)]),K(` 预设值浮层:移出 .st-number,避免被 overflow:hidden 裁切 `),i.sugOpen&&a.suggestions.length?(B(),V(`div`,$L,[(B(!0),V(z,null,R(a.suggestions,e=>(B(),V(`div`,{key:e.key,class:A([`st-pop__item`,{"st-pop__item--on":String(e.key)===String(i.inputValue)}]),onMousedown:q(t=>a.pick(e),[`prevent`])},j(e.value),43,eR))),128))])):K(`v-if`,!0)])}var nR=X(qL,[[`render`,tR],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetNumber.vue`]]),rR={name:`SetSelect`,props:l_,emits:u_,computed:{list(){return this.options.iParamList||this.options.iTypeList||[]},placeholder(){return this.options.placeholder||`请选择`},optionList(){return this.list.map(e=>({key:String(e.key),value:e.value}))},current(){return this.value===void 0||this.value===null?``:String(this.value)}},methods:{onChange(e){this.$emit(`input`,e),this.$emit(`change`)}}};function iR(e,t,n,r,i,a){let o=L(`Dropdown`);return B(),H(o,{value:a.current,options:a.optionList,placeholder:a.placeholder,clearable:``,size:`sm`,block:``,disabled:e.disabled,onInput:a.onChange},null,8,[`value`,`options`,`placeholder`,`disabled`,`onInput`])}var aR=X(rR,[[`render`,iR],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetSelect.vue`]]),oR={name:`SetSwitch`,props:{...l_,boolean:{type:Boolean,default:!1}},emits:u_,computed:{activeValue(){return this.options.activeValue===void 0?this.boolean?!0:`1`:this.options.activeValue},inactiveValue(){return this.options.inactiveValue===void 0?!this.boolean&&`0`:this.options.inactiveValue},on(){return this.value===this.activeValue},activeText(){return this.options.activeText||`开`},inactiveText(){return this.options.inactiveText||`关`}},methods:{toggle(){this.disabled||(this.$emit(`input`,this.on?this.inactiveValue:this.activeValue),this.$emit(`change`))}}},sR={class:`st-switch__text`};function cR(e,t,n,r,i,a){return B(),V(`div`,{class:A([`st-switch`,{"st-switch--on":a.on}]),onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[1]||=U(`span`,{class:`st-switch__track`},[U(`span`,{class:`st-switch__knob`})],-1),U(`span`,sR,j(a.on?a.activeText:a.inactiveText),1)],2)}var lR=X(oR,[[`render`,cR],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetSwitch.vue`]]);function uR(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>`u`)){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var dR=function(e,t){let{componentPrefix:n=``}=t||{};e.component(`${n}${this.name}`,this)},fR={},pR={name:`Checkboard`,props:{size:{type:[Number,String],default:8},white:{type:String,default:`#fff`},grey:{type:String,default:`#e6e6e6`}},computed:{bgStyle(){return{"background-image":`url(${hR(this.white,this.grey,this.size)})`}}}};function mR(e,t,n){if(typeof document>`u`)return null;let r=document.createElement(`canvas`);r.width=r.height=n*2;let i=r.getContext(`2d`);return i?(i.fillStyle=e,i.fillRect(0,0,r.width,r.height),i.fillStyle=t,i.fillRect(0,0,n,n),i.translate(n,n),i.fillRect(0,0,n,n),r.toDataURL()):null}function hR(e,t,n){let r=`${e},${t},${n}`;if(fR[r])return fR[r];let i=mR(e,t,n);return fR[r]=i,i}function gR(e,t,n,r,i,a){return B(),V(`div`,{class:`vc-checkerboard`,style:k(a.bgStyle)},null,4)}uR(`.vc-checkerboard{background-size:contain;bottom:0;left:0;position:absolute;right:0;top:0}`),pR.render=gR,pR.__file=`src/components/checkboard/checkboard.vue`,pR.install=dR;var _R={name:`Alpha`,components:{Checkboard:pR},props:{value:Object,onChange:Function},computed:{colors(){return this.value},gradientColor(){let{rgba:e}=this.colors,t=[e.r,e.g,e.b].join(`,`);return`linear-gradient(to right, rgba(${t}, 0) 0%, rgba(${t}, 1) 100%)`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.getBoundingClientRect().left+window.pageXOffset,a=(e.pageX||(e.touches?e.touches[0].pageX:0))-i,o;o=a<0?0:a>r?1:Math.round(a*100/r)/100,this.colors.a!==o&&this.$emit(`change`,{h:this.colors.hsl.h,s:this.colors.hsl.s,l:this.colors.hsl.l,a:o,source:`rgba`})},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},vR={class:`vc-alpha`},yR={class:`vc-alpha-checkboard-wrap`},bR=[U(`div`,{class:`vc-alpha-picker`},null,-1)];function xR(e,t,n,r,i,a){let o=L(`Checkboard`);return B(),V(`div`,vR,[U(`div`,yR,[W(o)]),U(`div`,{class:`vc-alpha-gradient`,style:k({background:a.gradientColor})},null,4),U(`div`,{ref:`container`,class:`vc-alpha-container`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[U(`div`,{class:`vc-alpha-pointer`,style:k({left:`${a.colors.a*100}%`})},bR,4)],544)])}uR(`.vc-alpha,.vc-alpha-checkboard-wrap{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-checkboard-wrap{overflow:hidden}.vc-alpha-gradient{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-container{cursor:pointer;height:100%;margin:0 3px;position:relative;z-index:2}.vc-alpha-pointer{position:absolute;z-index:2}.vc-alpha-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),_R.render=xR,_R.__file=`src/components/alpha/alpha.vue`,_R.install=dR;function SR(e,t){wR(e)&&(e=`100%`);var n=TR(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(e=t===360?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t)),e)}function CR(e){return Math.min(1,Math.max(0,e))}function wR(e){return typeof e==`string`&&e.indexOf(`.`)!==-1&&parseFloat(e)===1}function TR(e){return typeof e==`string`&&e.indexOf(`%`)!==-1}function ER(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function DR(e){return e<=1?`${Number(e)*100}%`:e}function OR(e){return e.length===1?`0`+e:String(e)}function kR(e,t,n){return{r:SR(e,255)*255,g:SR(t,255)*255,b:SR(n,255)*255}}function AR(e,t,n){e=SR(e,255),t=SR(t,255),n=SR(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=0,s=(r+i)/2;if(r===i)o=0,a=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4}a/=6}return{h:a,s:o,l:s}}function jR(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function MR(e,t,n){var r,i,a;if(e=SR(e,360),t=SR(t,100),n=SR(n,100),t===0)i=n,a=n,r=n;else{var o=n<.5?n*(1+t):n+t-n*t,s=2*n-o;r=jR(s,o,e+1/3),i=jR(s,o,e),a=jR(s,o,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function NR(e,t,n){e=SR(e,255),t=SR(t,255),n=SR(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=r,s=r-i,c=r===0?0:s/r;if(r===i)a=0;else{switch(r){case e:a=(t-n)/s+(t<n?6:0);break;case t:a=(n-e)/s+2;break;case n:a=(e-t)/s+4}a/=6}return{h:a,s:c,v:o}}function PR(e,t,n){e=SR(e,360)*6,t=SR(t,100),n=SR(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function FR(e,t,n,r){var i=[OR(Math.round(e).toString(16)),OR(Math.round(t).toString(16)),OR(Math.round(n).toString(16))];return r&&i[0].startsWith(i[0].charAt(1))&&i[1].startsWith(i[1].charAt(1))&&i[2].startsWith(i[2].charAt(1))?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function IR(e,t,n,r,i){var a=[OR(Math.round(e).toString(16)),OR(Math.round(t).toString(16)),OR(Math.round(n).toString(16)),OR(LR(r))];return i&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))&&a[3].startsWith(a[3].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function LR(e){return Math.round(parseFloat(e)*255).toString(16)}function RR(e){return zR(e)/255}function zR(e){return parseInt(e,16)}function BR(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var VR={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,goldenrod:`#daa520`,gold:`#ffd700`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavenderblush:`#fff0f5`,lavender:`#e6e6fa`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`};function HR(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;return typeof e==`string`&&(e=qR(e)),typeof e==`object`&&(JR(e.r)&&JR(e.g)&&JR(e.b)?(t=kR(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):JR(e.h)&&JR(e.s)&&JR(e.v)?(r=DR(e.s),i=DR(e.v),t=PR(e.h,r,i),o=!0,s=`hsv`):JR(e.h)&&JR(e.s)&&JR(e.l)&&(r=DR(e.s),a=DR(e.l),t=MR(e.h,r,a),o=!0,s=`hsl`),Object.prototype.hasOwnProperty.call(e,`a`)&&(n=e.a)),n=ER(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var UR=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,WR=`[\\s|\\(]+(${UR})[,|\\s]+(${UR})[,|\\s]+(${UR})\\s*\\)?`,GR=`[\\s|\\(]+(${UR})[,|\\s]+(${UR})[,|\\s]+(${UR})[,|\\s]+(${UR})\\s*\\)?`,KR={CSS_UNIT:new RegExp(UR),rgb:RegExp(`rgb`+WR),rgba:RegExp(`rgba`+GR),hsl:RegExp(`hsl`+WR),hsla:RegExp(`hsla`+GR),hsv:RegExp(`hsv`+WR),hsva:RegExp(`hsva`+GR),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function qR(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(VR[e])e=VR[e],t=!0;else if(e===`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n=KR.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=KR.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=KR.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=KR.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=KR.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=KR.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=KR.hex8.exec(e),n?{r:zR(n[1]),g:zR(n[2]),b:zR(n[3]),a:RR(n[4]),format:t?`name`:`hex8`}:(n=KR.hex6.exec(e),n?{r:zR(n[1]),g:zR(n[2]),b:zR(n[3]),format:t?`name`:`hex`}:(n=KR.hex4.exec(e),n?{r:zR(n[1]+n[1]),g:zR(n[2]+n[2]),b:zR(n[3]+n[3]),a:RR(n[4]+n[4]),format:t?`name`:`hex8`}:(n=KR.hex3.exec(e),n?{r:zR(n[1]+n[1]),g:zR(n[2]+n[2]),b:zR(n[3]+n[3]),format:t?`name`:`hex`}:!1)))))))))}function JR(e){return!!KR.CSS_UNIT.exec(String(e))}var YR=function(){function e(t,n){if(t===void 0&&(t=``),n===void 0&&(n={}),t instanceof e)return t;typeof t==`number`&&(t=BR(t)),this.originalInput=t;var r=HR(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=n.format??r.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t,n,r,i=e.r/255,a=e.g/255,o=e.b/255;return t=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,n=a<=.03928?a/12.92:((a+.055)/1.055)**2.4,r=o<=.03928?o/12.92:((o+.055)/1.055)**2.4,.2126*t+.7152*n+.0722*r},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=ER(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return this.toHsl().s===0},e.prototype.toHsv=function(){var e=NR(this.r,this.g,this.b);return{h:e.h*360,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=NR(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this.a===1?`hsv(${t}, ${n}%, ${r}%)`:`hsva(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHsl=function(){var e=AR(this.r,this.g,this.b);return{h:e.h*360,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=AR(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this.a===1?`hsl(${t}, ${n}%, ${r}%)`:`hsla(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHex=function(e){return e===void 0&&(e=!1),FR(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return e===void 0&&(e=!1),`#`+this.toHex(e)},e.prototype.toHex8=function(e){return e===void 0&&(e=!1),IR(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return e===void 0&&(e=!1),`#`+this.toHex8(e)},e.prototype.toHexShortString=function(e){return e===void 0&&(e=!1),this.a===1?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return this.a===1?`rgb(${e}, ${t}, ${n})`:`rgba(${e}, ${t}, ${n}, ${this.roundA})`},e.prototype.toPercentageRgb=function(){var e=function(e){return`${Math.round(SR(e,255)*100)}%`};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(SR(e,255)*100)};return this.a===1?`rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)`:`rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`},e.prototype.toName=function(){if(this.a===0)return`transparent`;if(this.a<1)return!1;for(var e=`#`+FR(this.r,this.g,this.b,!1),t=0,n=Object.entries(VR);t<n.length;t++){var r=n[t],i=r[0];if(e===r[1])return i}return!1},e.prototype.toString=function(e){var t=!!e;e??=this.format;var n=!1,r=this.a<1&&this.a>=0;return!t&&r&&(e.startsWith(`hex`)||e===`name`)?e===`name`&&this.a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=CR(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=CR(n.l),new e(n)},e.prototype.tint=function(e){return e===void 0&&(e=10),this.mix(`white`,e)},e.prototype.shade=function(e){return e===void 0&&(e=10),this.mix(`black`,e)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=CR(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=CR(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var r=this.toRgb(),i=new e(t).toRgb(),a=n/100;return new e({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var r=this.toHsl(),i=360/n,a=[this];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(new e(r));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(new e({h:r,s:i,v:a})),a=(a+s)%1;return o},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb(),i=n.a+r.a*(1-n.a);return new e({r:(n.r*n.a+r.r*r.a*(1-n.a))/i,g:(n.g*n.a+r.g*r.a*(1-n.a))/i,b:(n.b*n.a+r.b*r.a*(1-n.a))/i,a:i})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,i=[this],a=360/t,o=1;o<t;o++)i.push(new e({h:(r+o*a)%360,s:n.s,l:n.l}));return i},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function XR(...e){return new YR(...e)}function ZR(e,t){let n=e&&e.a,r;r=e&&e.hsl?XR(e.hsl):e&&e.hex&&e.hex.length>0?XR(e.hex):e&&e.hsv?XR(e.hsv):e&&e.rgba?XR(e.rgba):e&&e.rgb?XR(e.rgb):XR(e),r&&(r._a===void 0||r._a===null)&&r.setAlpha(n||r.getAlpha());let i=r.toHsl(),a=r.toHsv();return i.s===0&&(a.h=i.h=e.h||e.hsl&&e.hsl.h||t||0),a.v<.0164&&(a.h=e.h||e.hsv&&e.hsv.h||0,a.s=e.s||e.hsv&&e.hsv.s||0),i.l<.01&&(i.h=e.h||e.hsl&&e.hsl.h||0,i.s=e.s||e.hsl&&e.hsl.s||0),{hsl:i,hex:r.toHexString().toUpperCase(),hex8:r.toHex8String().toUpperCase(),rgba:r.toRgb(),hsv:a,oldHue:e.h||t||i.h,source:e.source,a:r.getAlpha()}}var QR={model:{prop:`modelValue`,event:`update:modelValue`},props:[`modelValue`],data(){return{val:ZR(this.modelValue)}},computed:{colors:{get(){return this.val},set(e){this.val=e,this.$emit(`update:modelValue`,e)}}},watch:{modelValue(e){this.val=ZR(e)}},methods:{colorChange(e,t){this.oldHue=this.colors.hsl.h,this.colors=ZR(e,t||this.oldHue)},isValidHex(e){return XR(e).isValid},simpleCheckForValidColor(e){let t=[`r`,`g`,`b`,`a`,`h`,`s`,`l`,`v`],n=0,r=0;for(let i=0;i<t.length;i++){let a=t[i];e[a]&&(n++,isNaN(e[a])||r++)}if(n===r)return e},paletteUpperCase(e){return e.map(e=>e.toUpperCase())},isTransparent(e){return XR(e).getAlpha()===0}}},$R={name:`EditableInput`,props:{label:String,labelText:String,desc:String,value:[String,Number],max:Number,min:Number,arrowOffset:{type:Number,default:1}},computed:{val:{get(){return this.value},set(e){if(this.max!==void 0&&+e>this.max)this.$refs.input.value=this.max;else return e}},labelId(){return`input__label__${this.label}__${Math.random().toString().slice(2,5)}`},labelSpanText(){return this.labelText||this.label}},methods:{update(e){this.handleChange(e.target.value)},handleChange(e){let t={};t[this.label]=e,(t.hex===void 0&&t[`#`]===void 0||e.length>5)&&this.$emit(`change`,t)},handleKeyDown(e){let{val:t}=this,n=Number(t);if(n){let r=this.arrowOffset||1;e.keyCode===38&&(t=n+r,this.handleChange(t),e.preventDefault()),e.keyCode===40&&(t=n-r,this.handleChange(t),e.preventDefault())}}}},ez={class:`vc-editable-input`},tz=[`aria-labelledby`],nz=[`id`,`for`],rz={class:`vc-input__desc`};function iz(e,t,n,r,i,a){return B(),V(`div`,ez,[I(U(`input`,{ref:`input`,"onUpdate:modelValue":t[0]||=e=>a.val=e,"aria-labelledby":a.labelId,class:`vc-input__input`,onKeydown:t[1]||=(...e)=>a.handleKeyDown&&a.handleKeyDown(...e),onInput:t[2]||=(...e)=>a.update&&a.update(...e)},null,40,tz),[[il,a.val]]),U(`span`,{id:a.labelId,for:n.label,class:`vc-input__label`},j(a.labelSpanText),9,nz),U(`span`,rz,j(n.desc),1)])}uR(`.vc-editable-input{position:relative}.vc-input__input{border:0;outline:none;padding:0}.vc-input__label{text-transform:capitalize}`),$R.render=iz,$R.__file=`src/components/editable-input/editable-input.vue`,$R.install=dR;function az(e,t,n){return t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}var oz={name:`Saturation`,props:{value:Object},computed:{colors(){return this.value},bgColor(){return`hsl(${this.colors.hsv.h}, 100%, 50%)`},pointerTop(){return`${-(this.colors.hsv.v*100)+1+100}%`},pointerLeft(){return`${this.colors.hsv.s*100}%`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=az(s-a,0,r),u=az(c-o,0,i),d=l/r,f=az(-(u/i)+1,0,1);this.onChange({h:this.colors.hsv.h,s:d,v:f,a:this.colors.hsv.a,source:`hsva`})},onChange(e){this.$emit(`change`,e)},handleMouseDown(e){window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},sz=U(`div`,{class:`vc-saturation--white`},null,-1),cz=U(`div`,{class:`vc-saturation--black`},null,-1),lz=[U(`div`,{class:`vc-saturation-circle`},null,-1)];function uz(e,t,n,r,i,a){return B(),V(`div`,{ref:`container`,class:`vc-saturation`,style:k({background:a.bgColor}),onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[sz,cz,U(`div`,{class:`vc-saturation-pointer`,style:k({top:a.pointerTop,left:a.pointerLeft})},lz,4)],36)}uR(`.vc-saturation,.vc-saturation--black,.vc-saturation--white{bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0}.vc-saturation--white{background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.vc-saturation--black{background:linear-gradient(0deg,#000,transparent)}.vc-saturation-pointer{cursor:pointer;position:absolute}.vc-saturation-circle{border-radius:50%;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px rgba(0,0,0,.3),0 0 1px 2px rgba(0,0,0,.4);cursor:head;height:4px;transform:translate(-2px,-2px);width:4px}`),oz.render=uz,oz.__file=`src/components/saturation/saturation.vue`,oz.install=dR;var dz={name:`Hue`,props:{value:Object,direction:{type:String,default:`horizontal`}},data(){return{oldHue:0,pullDirection:``}},computed:{colors(){return this.value},directionClass(){return{"vc-hue--horizontal":this.direction===`horizontal`,"vc-hue--vertical":this.direction===`vertical`}},pointerTop(){return this.direction===`vertical`?this.colors.hsl.h===0&&this.pullDirection===`right`?0:`${-(this.colors.hsl.h*100/360)+100}%`:0},pointerLeft(){return this.direction===`vertical`?0:this.colors.hsl.h===0&&this.pullDirection===`right`?`100%`:`${this.colors.hsl.h*100/360}%`}},watch:{value:{handler(e,t){let{h:n}=e.hsl;n!==0&&n-this.oldHue>0&&(this.pullDirection=`right`),n!==0&&n-this.oldHue<0&&(this.pullDirection=`left`),this.oldHue=n},deep:!0,immediate:!0}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=s-a,u=c-o,d,f;this.direction===`vertical`?(u<0?d=360:u>i?d=0:(f=-(u*100/i)+100,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`})):(l<0?d=0:l>r?d=360:(f=l*100/r,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`}))},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},fz=[`aria-valuenow`],pz=[U(`div`,{class:`vc-hue-picker`},null,-1)];function mz(e,t,n,r,i,a){return B(),V(`div`,{class:A([`vc-hue`,[a.directionClass]])},[U(`div`,{ref:`container`,class:`vc-hue-container`,role:`slider`,"aria-valuenow":a.colors.hsl.h,"aria-valuemin":`0`,"aria-valuemax":`360`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[U(`div`,{class:`vc-hue-pointer`,style:k({top:a.pointerTop,left:a.pointerLeft}),role:`presentation`},pz,4)],40,fz)],2)}uR(`.vc-hue{border-radius:2px;bottom:0;left:0;position:absolute;right:0;top:0}.vc-hue--horizontal{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue--vertical{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue-container{cursor:pointer;height:100%;margin:0 2px;position:relative}.vc-hue-pointer{position:absolute;z-index:2}.vc-hue-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),dz.render=mz,dz.__file=`src/components/hue/hue.vue`,dz.install=dR;var hz=[`#D0021B`,`#F5A623`,`#F8E71C`,`#8B572A`,`#7ED321`,`#417505`,`#BD10E0`,`#9013FE`,`#4A90E2`,`#50E3C2`,`#B8E986`,`#000000`,`#4A4A4A`,`#9B9B9B`,`#FFFFFF`,`rgba(0,0,0,0)`],gz={name:`Sketch`,components:{Saturation:oz,Hue:dz,Alpha:_R,EdIn:$R,Checkboard:pR},mixins:[QR],props:{presetColors:{type:Array,default(){return hz}},disableAlpha:{type:Boolean,default:!1},disableFields:{type:Boolean,default:!1}},computed:{hex(){let e;return e=this.colors.a<1?this.colors.hex8:this.colors.hex,e.replace(`#`,``)},activeColor(){let{rgba:e}=this.colors;return`rgba(${[e.r,e.g,e.b,e.a].join(`,`)})`}},methods:{handlePreset(e){this.colorChange(e)},childChange(e){this.colorChange(e)},inputChange(e){e&&(e.hex?this.isValidHex(e.hex)&&this.colorChange({hex:e.hex,source:`hex`}):(e.r||e.g||e.b||e.a)&&this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:`rgba`}))}}},_z={class:`vc-sketch-saturation-wrap`},vz={class:`vc-sketch-controls`},yz={class:`vc-sketch-sliders`},bz={class:`vc-sketch-hue-wrap`},xz={key:0,class:`vc-sketch-alpha-wrap`},Sz={class:`vc-sketch-color-wrap`},Cz=[`aria-label`],wz={key:0,class:`vc-sketch-field`},Tz={class:`vc-sketch-field--double`},Ez={class:`vc-sketch-field--single`},Dz={class:`vc-sketch-field--single`},Oz={class:`vc-sketch-field--single`},kz={key:0,class:`vc-sketch-field--single`},Az={class:`vc-sketch-presets`,role:`group`,"aria-label":`A color preset, pick one to set as current color`},jz=[`aria-label`,`onClick`],Mz=[`aria-label`,`onClick`];function Nz(e,t,n,r,i,a){let o=L(`Saturation`),s=L(`Hue`),c=L(`Alpha`),l=L(`Checkboard`),u=L(`EdIn`);return B(),V(`div`,{role:`application`,"aria-label":`Sketch color picker`,class:A([`vc-sketch`,[n.disableAlpha?`vc-sketch__disable-alpha`:``]])},[U(`div`,_z,[W(o,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),U(`div`,vz,[U(`div`,yz,[U(`div`,bz,[W(s,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),n.disableAlpha?K(`v-if`,!0):(B(),V(`div`,xz,[W(c,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]))]),U(`div`,Sz,[U(`div`,{"aria-label":`Current color is ${a.activeColor}`,class:`vc-sketch-active-color`,style:k({background:a.activeColor})},null,12,Cz),W(l)])]),n.disableFields?K(`v-if`,!0):(B(),V(`div`,wz,[K(` rgba `),U(`div`,Tz,[W(u,{label:`hex`,value:a.hex,onChange:a.inputChange},null,8,[`value`,`onChange`])]),U(`div`,Ez,[W(u,{label:`r`,value:e.colors.rgba.r,onChange:a.inputChange},null,8,[`value`,`onChange`])]),U(`div`,Dz,[W(u,{label:`g`,value:e.colors.rgba.g,onChange:a.inputChange},null,8,[`value`,`onChange`])]),U(`div`,Oz,[W(u,{label:`b`,value:e.colors.rgba.b,onChange:a.inputChange},null,8,[`value`,`onChange`])]),n.disableAlpha?K(`v-if`,!0):(B(),V(`div`,kz,[W(u,{label:`a`,value:e.colors.a,"arrow-offset":.01,max:1,onChange:a.inputChange},null,8,[`value`,`arrow-offset`,`onChange`])]))])),U(`div`,Az,[(B(!0),V(z,null,R(n.presetColors,t=>(B(),V(z,null,[e.isTransparent(t)?(B(),V(`div`,{key:t,"aria-label":`Color:${t}`,class:`vc-sketch-presets-color`,onClick:e=>a.handlePreset(t)},[W(l)],8,Mz)):(B(),V(`div`,{key:`!${t}`,class:`vc-sketch-presets-color`,"aria-label":`Color:${t}`,style:k({background:t}),onClick:e=>a.handlePreset(t)},null,12,jz))],64))),256))])],2)}uR(`.vc-sketch{background:#fff;border-radius:4px;box-shadow:0 0 0 1px rgba(0,0,0,.15),0 8px 16px rgba(0,0,0,.15);box-sizing:initial;padding:10px 10px 0;position:relative;width:200px}.vc-sketch-saturation-wrap{overflow:hidden;padding-bottom:75%;position:relative;width:100%}.vc-sketch-controls{display:flex}.vc-sketch-sliders{flex:1;padding:4px 0}.vc-sketch-sliders .vc-alpha-gradient,.vc-sketch-sliders .vc-hue{border-radius:2px}.vc-sketch-alpha-wrap,.vc-sketch-hue-wrap{height:10px;position:relative}.vc-sketch-alpha-wrap{margin-top:4px;overflow:hidden}.vc-sketch-color-wrap{border-radius:3px;height:24px;margin-left:4px;margin-top:4px;position:relative;width:24px}.vc-sketch-active-color{border-radius:2px;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),inset 0 0 4px rgba(0,0,0,.25);left:0;position:absolute;right:0;top:0;z-index:2}.vc-sketch-color-wrap .vc-checkerboard{background-size:auto}.vc-sketch-field{display:flex;padding-top:4px}.vc-sketch-field .vc-input__input{border:none;box-shadow:inset 0 0 0 1px #ccc;font-size:10px;padding:4px 0 3px 10%;width:90%}.vc-sketch-field .vc-input__label{color:#222;display:block;font-size:11px;padding-bottom:4px;padding-top:3px;text-align:center;text-transform:capitalize}.vc-sketch-field--single{flex:1;padding-left:6px}.vc-sketch-field--double{flex:2}.vc-sketch-presets{border-top:1px solid #eee;margin-left:-10px;margin-right:-10px;padding-left:10px;padding-top:10px}.vc-sketch-presets-color{cursor:pointer;display:inline-block;height:16px;margin:0 10px 10px 0;overflow:hidden;position:relative;vertical-align:top;width:16px}.vc-sketch-presets-color,.vc-sketch-presets-color .vc-checkerboard{border-radius:3px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}.vc-sketch__disable-alpha .vc-sketch-color-wrap{height:10px}`),gz.render=Nz,gz.__file=`src/components/sketch/sketch.vue`,gz.install=dR;function Pz(e){let t=String(e||``).trim();if(!t)return null;let n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:1};if(n=t.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i),n){let e=e=>parseInt(e+e,16);return{r:e(n[1]),g:e(n[2]),b:e(n[3]),a:1}}if(n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i),n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:parseInt(n[4],16)/255};if(n=t.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/i),n){let e=n[4]===void 0?1:parseFloat(n[4]);return{r:Math.round(parseFloat(n[1])),g:Math.round(parseFloat(n[2])),b:Math.round(parseFloat(n[3])),a:e}}return null}function Fz(e){if(!e)return`#000000`;let t=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`);return`#`+t(e.r)+t(e.g)+t(e.b)}function Iz(e){return e?e.a>=1?Fz(e):`rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)}, ${+e.a.toFixed(2)})`:``}var Lz={name:`SetColor`,components:{Sketch:gz},props:l_,emits:u_,data(){return{_rgb:null,popOpen:!1,popW:240,popStyle:{position:`fixed`,left:`0px`,top:`0px`}}},computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},parsed(){return Pz(this.text)||{r:0,g:0,b:0,a:1}},pickerValue(){return this.text||`#000000`},alpha(){return this.parsed.a},displayColor(){return Iz(this.parsed)}},watch:{text(){this._rgb=Pz(this.text)}},beforeUnmount(){this.removeDocListener()},methods:{onTextInput(e){this._rgb=Pz(e),this.$emit(`input`,e)},onAlphaChange(e){let t=Math.max(0,Math.min(1,parseInt(e,10)/100)),n={...this._rgb||this.parsed,a:t};this._rgb=n,this.$emit(`input`,Iz(n)),this.$emit(`change`)},onPicker(e){let t=e&&e.rgba,n,r,i,a;if(Array.isArray(t))[n,r,i,a]=t;else if(t)n=t.r,r=t.g,i=t.b,a=t.a;else{let t=Pz(e.hex)||{r:0,g:0,b:0,a:1};n=t.r,r=t.g,i=t.b,a=t.a}a??=1;let o=e.hex||Fz({r:n,g:r,b:i,a:1});this._rgb={r:n,g:r,b:i,a},this.$emit(`input`,a>=1?o:`rgba(${Math.round(n)}, ${Math.round(r)}, ${Math.round(i)}, ${+a.toFixed(2)})`),this.$emit(`change`)},clear(){this.disabled||(this._rgb=null,this.closePop(),this.$emit(`input`,``),this.$emit(`change`))},togglePop(){this.disabled||(this.popOpen?this.closePop():this.openPop())},openPop(){let e=this.$refs.swatch;if(!e)return;let t=e.getBoundingClientRect(),n=this.$refs.top&&this.$refs.top.getBoundingClientRect()||t,r=Math.max(220,Math.min(Math.round(n.width),400)),i=window.innerWidth,a=window.innerHeight,o=n.left,s=t.bottom+6;o+r>i-8&&(o=Math.max(8,i-r-8)),s+320>a-8&&(s=Math.max(8,t.top-320-6)),this.popW=r,this.popStyle={position:`fixed`,left:o+`px`,top:s+`px`,width:r+`px`,zIndex:4e3},this.popOpen=!0,this.$nextTick(()=>{document.addEventListener(`mousedown`,this.onDocClick,!0)})},closePop(){this.popOpen&&(this.popOpen=!1,this.removeDocListener())},removeDocListener(){document.removeEventListener(`mousedown`,this.onDocClick,!0)},onDocClick(e){let t=this.$refs.pop,n=this.$refs.swatch;t&&t.contains(e.target)||n&&n.contains(e.target)||this.closePop()}}},Rz={class:`st-color`},zz={class:`st-color__top`,ref:`top`},Bz=[`title`,`disabled`],Vz=[`disabled`,`value`],Hz=[`disabled`],Uz={key:0,class:`st-color__alpha-row`},Wz=[`disabled`,`value`],Gz={class:`st-color__alpha-val`};function Kz(e,t,n,r,i,a){let o=L(`Sketch`);return B(),V(`div`,Rz,[K(` 色块预览 + 文本输入 + 重置(顶行) `),U(`div`,zz,[U(`button`,{ref:`swatch`,class:`st-color__swatch`,type:`button`,title:a.text||`未设置`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.togglePop&&a.togglePop(...e)},[t[7]||=U(`span`,{class:`st-color__checker`},null,-1),U(`span`,{class:`st-color__fill`,style:k({background:a.displayColor||`transparent`})},null,4)],8,Bz),U(`input`,{class:`ni-input st-color__text`,type:`text`,placeholder:`如 #333333 / rgba(0,0,0,.5)`,disabled:e.disabled,value:a.text,onInput:t[1]||=e=>a.onTextInput(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,Vz),U(`button`,{class:`st-color__clear`,type:`button`,title:`重置(清空颜色)`,disabled:e.disabled,onClick:t[3]||=(...e)=>a.clear&&a.clear(...e)},[...t[8]||=[U(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1)]],8,Hz)],512),K(` 透明度滑块(仅当颜色值非空时显示),作为快捷调节 `),a.text?(B(),V(`div`,Uz,[t[9]||=U(`span`,{class:`st-color__alpha-label`},`透明度`,-1),U(`input`,{class:`st-color__alpha-slider`,type:`range`,min:`0`,max:`100`,disabled:e.disabled,value:Math.round(a.alpha*100),onInput:t[4]||=e=>a.onAlphaChange(e.target.value),onChange:t[5]||=t=>e.$emit(`change`)},null,40,Wz),U(`span`,Gz,j(Math.round(a.alpha*100))+`%`,1)])):K(`v-if`,!0),K(` 第三方颜色选择器弹层(挂载到 body,避免被滚动容器裁切) `),(B(),H(ai,{to:`body`},[i.popOpen?(B(),V(`div`,{key:0,ref:`pop`,class:`st-color__pop`,style:k(i.popStyle),onMousedown:t[6]||=q(()=>{},[`stop`])},[W(o,{"model-value":a.pickerValue,"disable-alpha":!1,"onUpdate:modelValue":a.onPicker},null,8,[`model-value`,`onUpdate:modelValue`])],36)):K(`v-if`,!0)]))])}var qz=X(Lz,[[`render`,Kz],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetColor.vue`]]),Jz={name:`SetIconSelect`,components:{SvgSymbols:xd},props:l_,emits:u_,data(){return{open:!1}},computed:{list(){return this.options.iIconList||[]}},methods:{pick(e){this.disabled||(this.open=!1,this.$emit(`input`,e.key),this.$emit(`change`))}}},Yz={class:`st-iconsel-wrap`},Xz={class:`st-iconsel`},Zz={class:`st-iconsel__preview`},Qz={key:1,style:{"font-size":`11px`,color:`var(--text-faint)`}},$z=[`disabled`,`value`],eB={key:0,class:`st-iconsel__grid`},tB=[`title`,`onClick`],nB={key:0,class:`st-list__empty`};function rB(e,t,n,r,i,a){let o=L(`SvgSymbols`);return B(),V(`div`,Yz,[U(`div`,Xz,[U(`span`,Zz,[e.value?(B(),H(o,{key:0,icon:String(e.value),color:`currentColor`},null,8,[`icon`])):(B(),V(`span`,Qz,`无`))]),U(`input`,{class:`ni-input`,type:`text`,placeholder:`图标 key`,disabled:e.disabled,value:e.value||``,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,$z),U(`button`,{class:`st-minibtn`,type:`button`,onClick:t[2]||=e=>i.open=!i.open},j(i.open?`收起`:`选择`),1)]),i.open?(B(),V(`div`,eB,[(B(!0),V(z,null,R(a.list,t=>(B(),V(`span`,{key:t.key,class:A([`st-iconsel__cell`,{"st-iconsel__cell--on":t.key===e.value}]),title:t.name||t.value||t.key,onClick:e=>a.pick(t)},[W(o,{icon:t.key,color:`currentColor`},null,8,[`icon`])],10,tB))),128)),a.list.length?K(`v-if`,!0):(B(),V(`p`,nB,`该组件未提供图标列表`))])):K(`v-if`,!0)])}var iB=X(Jz,[[`render`,rB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetIconSelect.vue`]]);Prism.languages.javascript=Prism.languages.extend(`clike`,{"class-name":[Prism.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),Prism.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined(`script`,`javascript`),Prism.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),Prism.languages.js=Prism.languages.javascript,D_.default.languages.javascript&&!D_.default.languages.javascript[`binding-var`]&&D_.default.languages.insertBefore(`javascript`,`keyword`,{"binding-var":/\$[A-Za-z_$][\w$]*/});var aB={name:`SetExpr`,props:{...l_,placeholder:{type:String,default:``}},emits:u_,data(){return{code:``}},computed:{lines(){return this.code?this.code.split(`
342
- `).length:0},chars(){return this.code.length}},watch:{value(e){this.syncFromValue(e)}},mounted(){this.code=this.readValue(this.value),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readValue(e){return e==null?``:typeof e==`string`?e:String(e)},syncFromValue(e){let t=this.readValue(e);if(t===this.code)return;let n=this.$refs.editor;n&&document.activeElement===n||(this.code=t,this._jar&&this._jar.updateCode(t))},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.javascript,`javascript`)};this._jar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){this.disabled||(this.code=e,this.$emit(`input`,e),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400))}}},oB={key:0,class:`st-expr__ph`},sB={class:`st-expr__foot`},cB={class:`st-expr__hint`};function lB(e,t,n,r,i,a){return B(),V(`div`,{class:A([`st-expr`,{"st-expr--disabled":e.disabled}])},[U(`div`,{ref:`editor`,class:A([`st-expr__editor`,{"is-disabled":e.disabled}])},null,2),n.placeholder&&!i.code?(B(),V(`span`,oB,j(n.placeholder),1)):K(`v-if`,!0),U(`div`,sB,[U(`span`,cB,j(a.lines)+` 行 · `+j(a.chars)+` 字符`,1)])],2)}var uB=X(aB,[[`render`,lB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetExpr.vue`]]),dB={name:`SetIfForm`,components:{SetExpr:uB},props:l_,emits:u_,computed:{obj(){return this.value&&typeof this.value==`object`?this.value:{}},expression(){return this.obj.expression||``},name(){return this.obj.name||``}},methods:{setExpression(e){let t=!this.name||this.name===this.expression;this.$emit(`input`,{name:t?e:this.name,expression:e})},setName(e){this.$emit(`input`,{name:e,expression:this.expression})}}},fB={class:`st-ifform`},pB=[`disabled`,`value`];function mB(e,t,n,r,i,a){let o=L(`SetExpr`);return B(),V(`div`,fB,[W(o,{value:a.expression,disabled:e.disabled,placeholder:`表达式,如 $singleMode 或 $data.count > 0`,onInput:a.setExpression,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),U(`input`,{class:`ni-input`,type:`text`,placeholder:`显示名(留空跟随表达式)`,disabled:e.disabled,value:a.name,onInput:t[1]||=e=>a.setName(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,pB)])}var hB=X(dB,[[`render`,mB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetIfForm.vue`]]),gB=[{key:`number`,value:`px`},{key:`percent`,value:`%`},{key:`auto`,value:`@`}],_B={name:`SetNumberStyle`,components:{SetNumber:nR},props:l_,emits:u_,data(){return{unit:`number`,numValue:``,menuOpen:!1}},computed:{unitList(){return this.options.iTypeList||gB},unitLabel(){let e=this.unitList.filter(e=>e.key===this.unit)[0];return e?e.value:`px`},isAuto(){return this.unit===`auto`},numberOptions(){return{...this.options,type:this.unit===`percent`?`integer`:`float`,placeholder:this.options.placeholder||``,symbol:!0}}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=this.value;/%$/.test(String(e))?(this.unit=`percent`,this.numValue=String(e).replace(/%/g,``)):e===`auto`?(this.unit=`auto`,this.numValue=`auto`):(this.unit=`number`,this.numValue=e===0?`0`:e==null?``:String(e))},onNum(e){this.numValue=e,this.emit()},pickUnit(e){this.menuOpen=!1,this.unit=e,this.numValue=e===`percent`?`100`:e===`auto`?`auto`:``,this.emit(),this.$emit(`change`)},emit(){this.unit===`percent`&&this.numValue?this.$emit(`input`,this.numValue+`%`):this.$emit(`input`,this.numValue)}}},vB={class:`st-numberstyle`},yB={key:1,class:`st-pop st-pop--unit`},bB=[`onMousedown`];function xB(e,t,n,r,i,a){let o=L(`SetNumber`);return B(),V(`div`,vB,[W(o,{value:i.numValue,options:a.numberOptions,disabled:e.disabled||a.isAuto,onInput:a.onNum,onChange:t[1]||=t=>e.$emit(`change`)},{symbol:F(()=>[U(`span`,{class:`st-unit`,onMousedown:t[0]||=q(e=>i.menuOpen=!i.menuOpen,[`prevent`])},j(a.unitLabel),33)]),_:1},8,[`value`,`options`,`disabled`,`onInput`]),K(` 单位切换浮层:移到 .st-number 之外,避免被 overflow:hidden 裁切 `),i.menuOpen?(B(),V(`div`,{key:0,class:`st-pop-mask`,onMousedown:t[2]||=q(e=>i.menuOpen=!1,[`prevent`])},null,32)):K(`v-if`,!0),i.menuOpen?(B(),V(`div`,yB,[(B(!0),V(z,null,R(a.unitList,e=>(B(),V(`div`,{key:e.key,class:A([`st-pop__item`,{"st-pop__item--on":e.key===i.unit}]),onMousedown:q(t=>a.pickUnit(e.key),[`prevent`])},j(e.value),43,bB))),128))])):K(`v-if`,!0)])}var SB=X(_B,[[`render`,xB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetNumberStyle.vue`]]),CB={name:`SetPadding`,components:{SetNumber:nR},props:l_,emits:u_,data(){return{form:{top:``,right:``,bottom:``,left:``}}},computed:{brackets(){return this.options.brackets||[`{`,`}`]},seperator(){return this.options.seperator||`,`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``);this.brackets.length&&(e=e.replace(RegExp(`[${this.brackets.join(``)}]`,`g`),``));let t=e.split(this.seperator);this.form=this.options.normal?{top:t[0]||``,right:t[1]||``,bottom:t[2]||``,left:t[3]||``}:{top:t[0]||``,left:t[1]||``,bottom:t[2]||``,right:t[3]||``}},opt(e){return{type:`integer`,symbol:e,placeholder:`0`}},set(e,t){this.form[e]=t,this.emitValue()},emitValue(){let e=this.form,t=(this.options.normal?[e.top,e.right,e.bottom,e.left]:[e.top,e.left,e.bottom,e.right]).map(e=>e===``||e===void 0?`0`:e).join(this.seperator),[n,r]=this.brackets.length?this.brackets:[``,``];this.$emit(`input`,`${n||``}${t}${r||``}`)},emitOut(){this.$emit(`change`)}}},wB={class:`st-pad`};function TB(e,t,n,r,i,a){let o=L(`SetNumber`);return B(),V(`div`,wB,[W(o,{value:i.form.top,options:a.opt(`上`),disabled:e.disabled,onInput:t[0]||=e=>a.set(`top`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),W(o,{value:i.form.right,options:a.opt(`右`),disabled:e.disabled,onInput:t[1]||=e=>a.set(`right`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),W(o,{value:i.form.bottom,options:a.opt(`下`),disabled:e.disabled,onInput:t[2]||=e=>a.set(`bottom`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),W(o,{value:i.form.left,options:a.opt(`左`),disabled:e.disabled,onInput:t[3]||=e=>a.set(`left`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`])])}var EB=X(CB,[[`render`,TB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetPadding.vue`]]),DB=[{key:`TopLeft`,value:`上左`},{key:`TopCenter`,value:`上中`},{key:`TopRight`,value:`上右`},{key:`CenterLeft`,value:`中左`},{key:`Center`,value:`中间`},{key:`CenterRight`,value:`中右`},{key:`BottomLeft`,value:`下左`},{key:`BottomCenter`,value:`下中`},{key:`BottomRight`,value:`下右`}],OB=[{key:`0% 0%`,value:`左上对齐`},{key:`50% 0%`,value:`中上对齐`},{key:`100% 0%`,value:`右上对齐`},{key:`0% 50%`,value:`左中对齐`},{key:`50% 50%`,value:`居中对齐`},{key:`100% 50%`,value:`右中对齐`},{key:`0% 100%`,value:`左下对齐`},{key:`50% 100%`,value:`中下对齐`},{key:`100% 100%`,value:`右下对齐`}],kB={name:`SetGrid9`,props:{...l_,kind:{type:String,default:`PositionStyle`}},emits:u_,computed:{cells(){return this.kind===`BackgroundPositionStyle`?OB:DB}},methods:{pick(e){this.disabled||(this.$emit(`input`,e.key),this.$emit(`change`))}}},AB={class:`st-grid9`},jB=[`title`,`onClick`];function MB(e,t,n,r,i,a){return B(),V(`div`,AB,[(B(!0),V(z,null,R(a.cells,n=>(B(),V(`div`,{key:n.key,class:A([`st-grid9__cell`,{"st-grid9__cell--on":String(n.key)===String(e.value)}]),title:n.value,onClick:e=>a.pick(n)},[...t[0]||=[U(`span`,{class:`st-grid9__dot`},null,-1)]],10,jB))),128))])}var NB=X(kB,[[`render`,MB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetGrid9.vue`]]),PB=[{key:`number`,value:`px`},{key:`percent`,value:`%`}],FB={name:`SetBgPosition`,components:{SetGrid9:NB,SetNumberStyle:SB},props:l_,emits:u_,data(){return{x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).split(/\s+/);this.x=e[0]||``,this.y=e[1]||``},numOptions(e){return{placeholder:e,iTypeList:PB}},pickGrid(e){this.$emit(`input`,e)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){this.$emit(`input`,`${this.x||`0`} ${this.y||`0`}`)},emitOut(){this.$emit(`change`)}}},IB={class:`st-bgpos`},LB={class:`st-bgpos__xy`};function RB(e,t,n,r,i,a){let o=L(`SetGrid9`),s=L(`SetNumberStyle`);return B(),V(`div`,IB,[W(o,{kind:`BackgroundPositionStyle`,value:e.value,disabled:e.disabled,onInput:a.pickGrid,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),U(`div`,LB,[W(s,{value:i.x,options:a.numOptions(`X`),disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`]),W(s,{value:i.y,options:a.numOptions(`Y`),disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`])])])}var zB=X(FB,[[`render`,RB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetBgPosition.vue`]]),BB=[{key:`cover`,desc:`cover:保持纵横比,缩放到完全覆盖背景定位区域的最小尺寸`},{key:`contain`,desc:`contain:保持纵横比,缩放到能放进背景定位区域的最大尺寸`}],VB={name:`SetBgSize`,components:{SetNumberStyle:SB,Dropdown:e_},computed:{bgOptions(){return[{key:``,value:`自定义`}].concat(this.TYPES.map(e=>({key:e.key,value:e.key})))}},props:l_,emits:u_,data(){return{TYPES:BB,preset:``,x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``),t=BB.map(e=>e.key);this.preset=t.includes(e)?e:``;let n=e.split(/\s+/);n.length>=2?(this.x=n[0]||``,this.y=n[1]||``):(this.x=``,this.y=``)},pickPreset(e){this.preset=e,e||(this.x=`auto`,this.y=`auto`),this.emitValue(),this.$emit(`change`)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){let e=this.preset?this.preset:`${this.x||`auto`} ${this.y||`auto`}`;this.$emit(`input`,e)},emitOut(){this.$emit(`change`)}}},HB={class:`st-bgsize`},UB={key:0,class:`st-bgsize__xy`};function WB(e,t,n,r,i,a){let o=L(`Dropdown`),s=L(`SetNumberStyle`);return B(),V(`div`,HB,[W(o,{value:i.preset,options:a.bgOptions,size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.pickPreset(e)},null,8,[`value`,`options`,`disabled`]),i.preset?K(`v-if`,!0):(B(),V(`div`,UB,[W(s,{value:i.x,options:{placeholder:`宽`},disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),W(s,{value:i.y,options:{placeholder:`高`},disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`])]))])}var GB=X(VB,[[`render`,WB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetBgSize.vue`]]),KB=[{key:`to bottom`,desc:`从上到下`},{key:`to top`,desc:`从下到上`},{key:`to left`,desc:`从右到左`},{key:`to right`,desc:`从左到右`},{key:`to bottom right`,desc:`从左上到右下`},{key:`to bottom left`,desc:`从右上到左下`},{key:`to top left`,desc:`从右下到左上`},{key:`to top right`,desc:`从左下到右上`}];function qB(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t.filter(e=>e!==``)}var JB={name:`SetGradient`,components:{SetColor:qz,Dropdown:e_},props:l_,emits:u_,data(){return{DIRECTIONS:KB,direction:`to bottom`,stops:[]}},computed:{preview(){if(!this.stops.length)return`transparent`;let e=this.stops.map(e=>e.color).filter(Boolean);return e.length<2?e[0]||`transparent`:`linear-gradient(${this.direction}, ${e.join(`, `)})`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).trim().match(/linear-gradient\((.+)\)$/);if(!e){this.direction=this.options.defaultDirection||KB[0].key,this.stops=[];return}let t=qB(e[1]);this.direction=(t[0]||``).toLowerCase()||KB[0].key,this.stops=t.slice(1).map(e=>({color:e}))},setDirection(e){this.direction=e,this.emitValue(),this.$emit(`change`)},setStop(e,t){this.stops[e].color=t,this.emitValue()},addStop(){this.disabled||(this.stops.push({color:`#ffffff`}),this.emitValue(),this.$emit(`change`))},removeStop(e){this.disabled||(this.stops.splice(e,1),this.emitValue(),this.$emit(`change`))},emitValue(){let e=this.stops.map(e=>e.color).filter(e=>e!==``&&e!==void 0);this.$emit(`input`,e.length?`linear-gradient(${this.direction}, ${e.join(`, `)})`:``)},emitOut(){this.$emit(`change`)}}},YB={class:`st-gradient`},XB=[`onClick`],ZB=[`disabled`];function QB(e,t,n,r,i,a){let o=L(`Dropdown`),s=L(`SetColor`);return B(),V(`div`,YB,[U(`div`,{class:`st-gradient__preview`,style:k({background:a.preview})},null,4),W(o,{value:i.direction,options:i.DIRECTIONS.map(e=>({key:e.key,value:e.desc})),size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.setDirection(e)},null,8,[`value`,`options`,`disabled`]),(B(!0),V(z,null,R(i.stops,(t,n)=>(B(),V(`div`,{key:`stop`+n,class:`st-gradient__stop`},[W(s,{value:t.color,disabled:e.disabled,onInput:e=>a.setStop(n,e),onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),U(`button`,{class:`st-gradient__del`,type:`button`,title:`删除该渐变色`,onClick:e=>a.removeStop(n)},`✕`,8,XB)]))),128)),U(`button`,{class:`st-minibtn`,type:`button`,disabled:e.disabled,onClick:t[1]||=(...e)=>a.addStop&&a.addStop(...e)},`+ 新增渐变色`,8,ZB)])}var $B=X(JB,[[`render`,QB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetGradient.vue`]]),eV=new Set([`width`,`height`,`lineHeight`,`marginRight`,`cursor`,`textAlign`]),tV={name:`SetCustomSelect`,props:l_,emits:[...u_,`sync`],computed:{list(){return this.options.list||[]}},methods:{normalizeStyle(e){if(!e||typeof e!=`object`)return{};let t={};for(let n in e)eV.has(n)||(t[n]=e[n]);return t},apply(e){if(this.disabled)return;let t=e.sync||{};Object.keys(t).length&&this.$emit(`sync`,t)}}},nV={class:`st-customsel`},rV=[`title`,`onClick`],iV={key:0},aV={key:0,class:`st-list__empty`};function oV(e,t,n,r,i,a){return B(),V(`div`,nV,[(B(!0),V(z,null,R(a.list,(e,t)=>(B(),V(`div`,{key:t,class:`st-customsel__item`,style:k(a.normalizeStyle(e.style)),title:`应用:`+Object.keys(e.sync||{}).join(`、`),onClick:t=>a.apply(e)},[(B(!0),V(z,null,R(e.list||[],(e,t)=>(B(),V(`span`,{key:t,style:k(a.normalizeStyle(e.style))},j(e.innerText),5))),128)),(e.list||[]).length?K(`v-if`,!0):(B(),V(`span`,iV,j(e.innerText||`样式`+(t+1)),1))],12,rV))),128)),a.list.length?K(`v-if`,!0):(B(),V(`p`,aV,`未配置常用样式`))])}var sV=X(tV,[[`render`,oV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetCustomSelect.vue`]]),cV={name:`SetList`,props:l_,emits:u_,computed:{list(){let e=this.itemInfo;return e&&e.itemList||[]},addText(){return this.options&&this.options.btnText||`添加项`}},methods:{displayName(e){let t=e.itemName||e.itemKey||``;return{fontStyle:`字体风格`,textDecoration:`文字装饰`}[e.itemKey]||t},add(){if(this.disabled)return;let e=this.itemInfo,t=this.list[0],n;n=t?new du(t.properties.map(e=>({itemId:e.itemId,itemKey:e.itemKey,itemName:e.itemName,itemType:e.itemType,itemOption:e.itemOption,itemParam:e.itemParam,itemDefaultValue:e.itemDefaultValue,itemDesc:e.itemDesc,itemTypeRange:e.itemTypeRange,itemValueFrom:`0`,itemValue:``})),{}):new du((this.options&&this.options.iFieldList||[]).map(e=>({itemId:e.key,itemKey:e.key,itemName:e.value||e.key,itemType:`Input`,itemValueFrom:`0`,itemValue:``})),{}),e.itemList.push(n),this.$emit(`change`)},remove(e){this.disabled||(this.itemInfo.removeAt(e),this.$emit(`change`))},move(e,t){this.disabled||(this.itemInfo.moveItem(e,e+t),this.$emit(`change`))}}},lV={class:`st-list`},uV={class:`st-list__head`},dV={class:`st-list__idx`},fV=[`disabled`,`onClick`],pV=[`disabled`,`onClick`],mV=[`disabled`,`onClick`],hV={class:`st-list__body`},gV=[`title`],_V={class:`st-list__control`},vV={key:0,class:`st-list__empty`},yV={key:0,class:`st-list__empty`},bV=[`disabled`];function xV(e,t,n,r,i,a){let o=L(`prop-control`);return B(),V(`div`,lV,[(B(!0),V(z,null,R(a.list,(n,r)=>(B(),V(`div`,{key:n.id,class:`st-list__item`},[U(`div`,uV,[U(`span`,dV,`#`+j(r+1),1),t[4]||=U(`span`,{class:`st-list__head-spacer`},null,-1),U(`button`,{class:`st-list__op`,type:`button`,title:`上移`,disabled:e.disabled||r===0,onClick:e=>a.move(r,-1)},`↑`,8,fV),U(`button`,{class:`st-list__op`,type:`button`,title:`下移`,disabled:e.disabled||r===a.list.length-1,onClick:e=>a.move(r,1)},`↓`,8,pV),U(`button`,{class:`st-list__op st-list__op--del`,type:`button`,title:`删除`,disabled:e.disabled,onClick:e=>a.remove(r)},[...t[3]||=[U(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[U(`use`,{href:`#icon-delete`})],-1)]],8,mV)]),U(`div`,hV,[(B(!0),V(z,null,R(n.properties,n=>I((B(),V(`div`,{key:n.itemId,class:`st-list__row`},[U(`label`,{class:`st-list__label`,title:n.itemDesc||a.displayName(n)},j(a.displayName(n)),9,gV),U(`div`,_V,[W(o,{property:n,disabled:e.disabled,onChange:t[0]||=t=>e.$emit(`change`),onSync:t[1]||=t=>e.$emit(`sync`,t)},null,8,[`property`,`disabled`])])])),[[Sc,n.itemVisible]])),128)),n.properties.length?K(`v-if`,!0):(B(),V(`p`,vV,`该项无字段`))])]))),128)),a.list.length?K(`v-if`,!0):(B(),V(`p`,yV,`暂无项`)),U(`button`,{class:`st-minibtn st-list__add`,type:`button`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.add&&a.add(...e)},j(a.addText),9,bV)])}var SV=X(cV,[[`render`,xV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetList.vue`]]),CV={name:`SetImage`,props:l_,emits:u_,methods:{clear(){this.disabled||(this.$emit(`input`,``),this.$emit(`change`))}}},wV={class:`st-image`},TV={class:`st-image__row`},EV=[`disabled`,`value`],DV=[`disabled`];function OV(e,t,n,r,i,a){return B(),V(`div`,wV,[U(`div`,TV,[U(`input`,{class:`ni-input`,type:`text`,disabled:e.disabled,value:e.value||``,placeholder:`图片路径,如 @filestore/...png 或 https://...`,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,EV),e.value?(B(),V(`button`,{key:0,class:`st-image__clear`,type:`button`,title:`清空`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.clear&&a.clear(...e)},[...t[3]||=[U(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1)]],8,DV)):K(`v-if`,!0)])])}var kV=X(CV,[[`render`,OV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetImage.vue`]]),AV={name:`SetCode`,props:l_,emits:u_,data(){return{code:``,bridge:null}},computed:{codeKey(){return this.options.codeKey||`code`},lines(){return this.code?this.code.split(`
343
- `).length:0},chars(){return this.code.length}},mounted(){this.code=this.readCode(),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this.teardownBridge(!0),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readCode(){let e=this.value;return e==null?``:typeof e==`string`?e:String(typeof e==`object`?e[this.codeKey]||``:e)},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.javascript,`javascript`)};this._jar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){if(this.disabled||this.bridge)return;this.code=e;let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},toggleBridge(){this.bridge?this.teardownBridge(!0):this.setupBridge()},async setupBridge(){if(this.disabled||this.bridge)return;let e=this.itemInfo&&this.itemInfo.itemKey?String(this.itemInfo.itemKey):``;try{let t=await Gl(this.code,e);this.bridge={id:t.id,file:t.file}}catch(e){console.error(`[VSCode 桥接建立失败]`,e);return}this.setEditorEditable(!1),this._hb=setInterval(()=>{this.bridge&&ql(this.bridge.id).catch(()=>{})},5e3),this._bridgeUnsub=Hl(e=>{if(!(!this.bridge||!e||e.id!==this.bridge.id)){if(e.reason)return this.teardownBridge(!1);this.pullBridgeCode()}})},async pullBridgeCode(){if(!this.bridge)return;let e;try{e=await Kl(this.bridge.id)}catch{return}let t=String(e.code==null?``:e.code);t!==this.code&&this.applyExternalCode(t)},applyExternalCode(e){this.code=e,this._jar&&this._jar.updateCode(e,!1);let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},teardownBridge(e){let t=this.bridge;this.bridge=null,this._hb&&=(clearInterval(this._hb),null),this._bridgeUnsub&&=(this._bridgeUnsub(),null),this.setEditorEditable(!0),t&&e&&Jl(t.id).catch(()=>{})},setEditorEditable(e){let t=this.$refs.editor;t&&t.setAttribute(`contenteditable`,e?`true`:`false`)}}},jV={class:`st-code`},MV={class:`st-code__foot`},NV={class:`st-code__hint`},PV={class:`st-code__foot-actions`},FV=[`title`],IV=[`title`,`disabled`],LV={key:0,class:`st-code__vscode-label`};function RV(e,t,n,r,i,a){return B(),V(`div`,jV,[U(`div`,{ref:`editor`,class:A([`st-code__editor`,{"is-disabled":e.disabled,"is-bridged":!!i.bridge}])},null,2),K(` 右上角语言标签:弱化的只读标识,不参与交互 `),t[2]||=U(`span`,{class:`st-code__lang`,"aria-hidden":`true`},`JS`,-1),U(`div`,MV,[U(`span`,NV,j(a.lines)+` 行 · `+j(a.chars)+` 字符`,1),K(` VSCode 代码桥:生成临时 js 用外部编辑器编辑,保存实时回写;断开即删临时文件 `),U(`span`,PV,[i.bridge?(B(),V(`span`,{key:0,class:`st-code__bridge-tag`,title:i.bridge.file},`VSCode 同步中`,8,FV)):K(`v-if`,!0),U(`button`,{type:`button`,class:A([`st-code__vscode`,{"is-on":!!i.bridge}]),title:i.bridge?`断开 VSCode 桥接并删除临时文件`:`在 VSCode 中编辑:保存实时同步回编辑区,断开后清除临时文件`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.toggleBridge&&a.toggleBridge(...e)},[K(` 图标左侧小字:未桥接时是动作说明;桥接后由状态徽标接替,避免两段文字挤一行 `),i.bridge?K(`v-if`,!0):(B(),V(`span`,LV,`在编辑器中打开`)),t[1]||=U(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,"aria-hidden":`true`},[U(`path`,{fill:`currentColor`,d:`M23.15 2.587 18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`})],-1)],10,IV)])])])}var zV=X(AV,[[`render`,RV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetCode.vue`]]),BV={0:`常量`,1:`变量`,2:`图片`},VV={const:`0`,var:`1`,image:`2`};function HV(e){switch(e){case`InputNumber`:return{comp:nR};case`Color`:return{comp:qz};case`Select`:return{comp:aR};case`TabSelect`:return{comp:w_,kind:`TabSelect`};case`Input`:return{comp:GL};case`Textarea`:return{comp:GL,multiline:!0};case`Switcher`:return{comp:lR};case`BooleanForm`:return{comp:lR,boolean:!0};case`PaddingStyle`:return{comp:EB};case`NumberStyle`:return{comp:SB};case`PositionStyle`:return{comp:NB,kind:`PositionStyle`};case`BackgroundPositionStyle`:return{comp:zB};case`BackgroundSizeStyle`:return{comp:GB};case`GradientStyle`:return{comp:$B};case`FontStyle`:return{comp:w_,kind:`FontStyle`};case`TextDecorationStyle`:return{comp:w_,kind:`TextDecorationStyle`};case`JustifyContentStyle`:return{comp:w_,kind:`JustifyContentStyle`};case`AlignItemsStyle`:return{comp:w_,kind:`AlignItemsStyle`};case`IconSelect`:return{comp:iB};case`CustomSelect`:return{comp:sV};case`List`:return{comp:SV};case`IfForm`:return{comp:hB};case`Code`:return{comp:zV};default:return{comp:GL}}}var UV={name:`PropControl`,components:{SetText:GL,SetNumber:nR,SetSelect:aR,SetSegment:w_,SetSwitch:lR,SetColor:qz,SetIconSelect:iB,SetIfForm:hB,SetNumberStyle:SB,SetPadding:EB,SetGrid9:NB,SetBgPosition:zB,SetBgSize:GB,SetGradient:$B,SetCustomSelect:sV,SetList:SV,SetImage:kV,SetCode:zV,SetExpr:uB},props:{property:{type:Object,required:!0},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0}},emits:[`change`,`sync`],computed:{itemType(){return this.property&&this.property.itemType||``},sources(){let e=this.property&&this.property.itemTypeRange||`const`,t=String(e).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>({key:VV[e],label:BV[VV[e]]})).filter(e=>e.key),n=String(this.property.itemValueFrom);return/^[012]$/.test(n)&&!t.some(e=>e.key===n)&&(t=t.concat([{key:n,label:BV[n]||`来源`+n}])),t},setterComp(){return HV(this.itemType)}},methods:{onInput(e){this.property.itemValue=e,this.$emit(`change`)},onChange(){this.$emit(`change`)},onSync(e){this.$emit(`sync`,e)},setSource(e){if(this.disabled)return;let t=this.property,n=String(e);t.itemValueFrom!==n&&(t._valuesByFrom||={0:void 0,1:void 0,2:void 0},t._valuesByFrom[t.itemValueFrom]=t.itemValue,t.itemValueFrom=n,t._valuesByFrom[n]===void 0?n===`0`?(t.itemValue=t.itemDefaultValue??this.defaultFor(),t._valuesByFrom[n]=t.itemValue):(t.itemValue=``,t._valuesByFrom[n]=``):t.itemValue=t._valuesByFrom[n],this.$emit(`change`))},defaultFor(){switch(this.itemType){case`Color`:return`#000000`;case`InputNumber`:return 0;case`Switcher`:return`0`;case`BooleanForm`:return!1;case`TabSelect`:case`Select`:{let e=this.property.itemOption||{},t=e.iParamList||e.iTypeList||[];return t.length?t[0].key:``}default:return``}}}},WV={key:0,class:`pc-srcs`},GV=[`disabled`,`onClick`],KV={class:`pc-body`};function qV(e,t,n,r,i,a){let o=L(`SetImage`),s=L(`SetExpr`);return B(),V(`div`,{class:A([`pc`,{"pc--readonly":n.disabled}])},[K(` 值来源切换(仅当 meta 声明了多于一种来源 且 允许切换时显示) `),a.sources.length>1&&n.bExchange?(B(),V(`div`,WV,[(B(!0),V(z,null,R(a.sources,e=>(B(),V(`button`,{key:e.key,type:`button`,class:A([`pc-src`,{"is-active":n.property.itemValueFrom===e.key}]),disabled:n.disabled,onClick:t=>a.setSource(e.key)},j(e.label),11,GV))),128))])):K(`v-if`,!0),U(`div`,KV,[K(` 图片素材来源 `),n.property.itemValueFrom===`2`?(B(),H(o,{key:0,value:n.property.itemValue,options:n.property.itemOption,"item-info":n.property,disabled:n.disabled,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`options`,`item-info`,`disabled`,`onInput`,`onChange`])):n.property.itemValueFrom===`1`?(B(),V(z,{key:1},[K(` 变量 / 表达式来源:带语法高亮、可拖拽调高度 `),W(s,{value:n.property.itemValue,disabled:n.disabled,"item-info":n.property,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`disabled`,`item-info`,`onInput`,`onChange`])],2112)):(B(),V(z,{key:2},[K(` 常量来源:按 itemType 分派 `),(B(),H(Yi(a.setterComp.comp),{value:n.property.itemValue,options:n.property.itemOption,watches:n.watches,"item-info":n.property,disabled:n.disabled,kind:a.setterComp.kind,multiline:a.setterComp.multiline,boolean:a.setterComp.boolean,onInput:a.onInput,onChange:a.onChange,onSync:a.onSync},null,40,[`value`,`options`,`watches`,`item-info`,`disabled`,`kind`,`multiline`,`boolean`,`onInput`,`onChange`,`onSync`]))],2112))])],2)}var JV=X(UV,[[`render`,qV],[`__scopeId`,`data-v-910daa70`],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/PropControl.vue`]]),YV={name:`PropTree`,props:{properties:{type:Array,default:()=>[]},mode:{type:String,default:`property`},depth:{type:Number,default:1},chain:{type:Array,default:()=>[]},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0},plain:{type:Boolean,default:!1}},emits:[`leaf-change`,`leaf-sync`],data(){return{openMap:{}}},methods:{isGroup(e){if(!e)return!1;if(e.itemType===`group`)return!0;let t=e.itemChildren&&e.itemChildren.properties;return!!(t&&t.length)},childCount(e){let t=e.itemChildren&&e.itemChildren.properties;return t?t.length:0},isBlock(e){return e&&e.itemType===`Code`},groupVisible(e){if(e.itemVisible===!1)return!1;let t=e.itemChildren&&e.itemChildren.properties;return!t||!t.length||t.some(e=>e.itemVisible===!1?!1:!this.isGroup(e)||this.groupVisible(e))},isOpen(e){return this.openMap[e.itemId]!==!1},toggle(e){this.openMap[e.itemId]=this.openMap[e.itemId]===!1,this.openMap=Object.assign({},this.openMap)},onLeaf(e){this.$emit(`leaf-change`,this.chain.concat(e))},onSync(e){this.$emit(`leaf-sync`,e)}}},XV={key:0,class:`ptree__group`},ZV=[`onClick`],QV={class:`ptree__group-name`},$V={class:`ptree__group-body`},eH=[`title`],tH={class:`ptree__control`};function nH(e,t,n,r,i,a){let o=L(`prop-tree`,!0),s=L(`prop-control`);return B(),V(`div`,{class:A([`ptree`,{"ptree--plain":n.plain}])},[(B(!0),V(z,null,R(n.properties,r=>(B(),V(z,{key:r.itemId},[K(` 分组(自身可见 且 存在可见后代才渲染,避免空分组) `),a.isGroup(r)&&a.groupVisible(r)?(B(),V(`div`,XV,[U(`div`,{class:`ptree__group-head`,type:`button`,onClick:e=>a.toggle(r)},[U(`span`,{class:A([`ptree__caret`,{"is-open":a.isOpen(r)}])},`▸`,2),U(`span`,QV,j(r.itemName||r.itemKey),1)],8,ZV),I(U(`div`,$V,[r.itemChildren&&r.itemChildren.properties.length?(B(),H(o,{key:0,properties:r.itemChildren.properties,mode:n.mode,depth:n.depth+1,chain:n.chain.concat(r),watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,plain:n.plain,onLeafChange:t[0]||=t=>e.$emit(`leaf-change`,t),onLeafSync:t[1]||=t=>e.$emit(`leaf-sync`,t)},null,8,[`properties`,`mode`,`depth`,`chain`,`watches`,`disabled`,`b-exchange`,`plain`])):K(`v-if`,!0)],512),[[Sc,a.isOpen(r)]])])):r.itemVisible===!1?K(`v-if`,!0):(B(),V(z,{key:1},[K(` 叶子(itemCondition 判定为不可见时不渲染,与线上编辑器一致) `),U(`div`,{class:A([`ptree__row`,{"ptree__row--disabled":n.disabled,"ptree__row--block":a.isBlock(r)}])},[U(`label`,{class:`ptree__label`,title:r.itemDesc||r.itemName||r.itemKey},j(r.itemName||r.itemKey||r.itemType||`字段`),9,eH),U(`div`,tH,[W(s,{property:r,watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,onChange:e=>a.onLeaf(r),onSync:a.onSync},null,8,[`property`,`watches`,`disabled`,`b-exchange`,`onChange`,`onSync`])])],2)],2112))],64))),128))],2)}var rH=X(YV,[[`render`,nH],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/PropTree.vue`]]),iH=Sl(BL);iH.component(`prop-control`,JV),iH.component(`prop-tree`,rH),iH.component(`Dropdown`,e_),iH.config.errorHandler=(e,t,n)=>{console.error(`[render error]`,n,e),window.__cardDebug&&window.__cardDebug.pushError(`render`,`${n}: ${e.message}`)},iH.mount(`#app`);
343
+ 先于面板挂载,故两个空容器写在前面,以 flex order 视觉置底。 `),I(U(`div`,RL,[t[76]||=U(`div`,{id:`app-workside-bar`,class:`workside__bar`},null,-1),t[77]||=U(`div`,{id:`app-workside-panels`,class:`workside__panels`},null,-1),U(`div`,zL,[K(` 拖拽分隔条:置于两栏容器内(定位上下文),只贯穿列区高度,不穿过底部弹出面板与状态栏 `),K(` 中右分隔条:调试面板 | 接口调用面板 接缝,拖动调整右栏宽度。
344
+ 约束:中栏最小宽度 ≥ 屏宽 1/3,右栏最小宽度 ≥ 320px(见 startApiDrag) `),I(U(`div`,{class:A([`splitter splitter--api`,{"is-dragging":i.apiDragging}]),onPointerdown:t[29]||=q((...e)=>a.startApiDrag&&a.startApiDrag(...e),[`prevent`]),title:`拖拽调整接口调用面板宽度`},null,34),[[Sc,!i.chromeOff&&i.apiPanelOpen]]),W(_,{"chrome-off":i.chromeOff,rt:i.rt,preview:i.preview,schema:i.currentSchema,"card-id":i.selectedId,"reload-token":i.reloadToken,"meta-refresh-token":i.metaRefreshToken,"card-count":i.cardCount,"selected-node-id":i.selectedNodeId,"move-collapse-token":i.moveCollapseToken,"active-tab":i.activeTab,onSchemaChanged:a.onSchemaChanged,onSchemaCommit:a.onSchemaCommit,onSelectNode:a.onSelectNode,"onUpdate:activeTab":t[30]||=e=>i.activeTab=e,onAddNode:a.onAddNode,onMoveNode:a.onMoveNode,onHoverNode:a.onHoverNode,onCopySelected:a.copySelectedNode,onPaste:a.pasteNode,onDuplicate:a.duplicateNode,onDeleteSelected:a.deleteSelectedNode,onRenameCard:a.openRenameCard,onResetImport:a.onRefresh,"dev-svc-class":a.devSvcClass,"dev-svc-title":a.devSvcTitle,"dev-svc-label":a.devSvcLabel,"dev-svc-conn":a.devSvcConn},null,8,`chrome-off.rt.preview.schema.card-id.reload-token.meta-refresh-token.card-count.selected-node-id.move-collapse-token.active-tab.onSchemaChanged.onSchemaCommit.onSelectNode.onAddNode.onMoveNode.onHoverNode.onCopySelected.onPaste.onDuplicate.onDeleteSelected.onRenameCard.onResetImport.dev-svc-class.dev-svc-title.dev-svc-label.dev-svc-conn`.split(`.`)),K(` 右侧常驻「接口调用」面板:与预览列 / 调试面板呈左中右布局,
345
+ 展开/收起由顶栏按钮与面板内 ✕ 控制,初始状态持久化 `),i.apiPanelOpen?(B(),H(v,{key:0,rt:i.rt,onClose:t[31]||=e=>i.apiPanelOpen=!1},null,8,[`rt`])):K(`v-if`,!0)],512)],512),[[Sc,!i.chromeOff]])],512),K(` 远端预览二维码弹层:点击顶栏「远端预览」按钮打开,手机(FinMall App)扫码真机查看 `),W(y,{visible:i.remotePreviewOpen,"page-id":i.currentSchema?i.currentSchema.pageId:``,schema:i.currentSchema,onClose:t[32]||=e=>i.remotePreviewOpen=!1},null,8,[`visible`,`page-id`,`schema`]),K(` 登录凭据弹窗:远程同步检测到缺凭据时弹出,填写账号密码(MD5 后)写入 .local/credentials.json `),W(ic,{name:`modal`},{default:F(()=>[i.loginModal?(B(),V(`div`,{key:0,class:`login-mask`,onClick:t[39]||=q((...e)=>a.closeLoginModal&&a.closeLoginModal(...e),[`self`])},[U(`div`,BL,[t[80]||=U(`div`,{class:`login-modal__title`},`FinMall 登录凭据`,-1),t[81]||=U(`div`,{class:`login-modal__desc`},` 本地登录凭据缺失,请填写账号与密码。密码仅做 MD5 后保存,不落明文。 `,-1),U(`label`,VL,[t[78]||=U(`span`,{class:`login-modal__label`},`账号`,-1),I(U(`input`,{class:`login-modal__input`,type:`text`,"onUpdate:modelValue":t[33]||=e=>i.loginName=e,placeholder:`FinMall 登录账号`,disabled:i.loginSubmitting,onKeyup:t[34]||=vl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,HL),[[il,i.loginName]])]),U(`label`,UL,[t[79]||=U(`span`,{class:`login-modal__label`},`密码`,-1),I(U(`input`,{class:`login-modal__input`,type:`password`,"onUpdate:modelValue":t[35]||=e=>i.loginPassword=e,placeholder:`FinMall 登录密码`,disabled:i.loginSubmitting,onKeyup:t[36]||=vl((...e)=>a.submitLogin&&a.submitLogin(...e),[`enter`])},null,40,WL),[[il,i.loginPassword]])]),i.loginError?(B(),V(`div`,GL,j(i.loginError),1)):K(`v-if`,!0),U(`div`,KL,[U(`button`,{class:`login-modal__btn login-modal__btn--ghost`,type:`button`,disabled:i.loginSubmitting,onClick:t[37]||=(...e)=>a.closeLoginModal&&a.closeLoginModal(...e)},` 取消 `,8,qL),U(`button`,{class:`login-modal__btn login-modal__btn--primary`,type:`button`,disabled:i.loginSubmitting,onClick:t[38]||=(...e)=>a.submitLogin&&a.submitLogin(...e)},j(i.loginSubmitting?`保存中…`:`保存并同步`),9,JL)])])])):K(`v-if`,!0)]),_:1}),K(` 组件选择面板:点击结构树每行的「+」后弹出,选择类型即插入对应节点 `),W(ic,{name:`modal`},{default:F(()=>[i.addNodePanelOpen?(B(),H(b,{key:0,onPick:a.onPickComponent,onClose:a.cancelAddNode},null,8,[`onPick`,`onClose`])):K(`v-if`,!0)]),_:1}),K(` 二次确认弹窗:版本推送 / 当前同步 / 全量同步 等写/覆盖类操作前弹出,确认后才执行 `),W(x,{visible:i.confirm.show,title:i.confirm.title,message:i.confirm.message,"confirm-text":i.confirm.confirmText,"cancel-text":i.confirm.cancelText,severity:i.confirm.severity,onConfirm:a.onConfirmDialog,onCancel:a.onCancelDialog},null,8,[`visible`,`title`,`message`,`confirm-text`,`cancel-text`,`severity`,`onConfirm`,`onCancel`]),K(` 卡片网格预览弹窗:点击顶栏「网格预览」图标按钮打开,选择卡片即载入工作台 `),W(S,{visible:i.galleryOpen,cards:i.cardList,"selected-id":i.selectedId,onSelect:a.onSelect,onClose:a.closeGallery,onDelete:a.onGalleryDelete},null,8,[`visible`,`cards`,`selected-id`,`onSelect`,`onClose`,`onDelete`]),K(` 卡片表单弹窗(新增空白卡片 / 卡片重命名 共用一个弹窗):成功后关弹窗 + 刷列表 + 加载目标卡;existing-ids 供 ID 重名前置判定 `),W(C,{visible:i.cardDialog.visible,mode:i.cardDialog.mode,"card-id":i.cardDialog.cardId,"card-desc":i.cardDialog.cardDesc,"existing-ids":a.cardIds,onClose:t[40]||=e=>i.cardDialog.visible=!1,onCreated:a.onNewCardCreated,onRenamed:a.onCardRenamed},null,8,[`visible`,`mode`,`card-id`,`card-desc`,`existing-ids`,`onCreated`,`onRenamed`]),K(` App 级弱提示:顶栏异步操作(远端保存 / 同步)完成反馈,浮于 App 外壳顶部居中 `),W(w),K(` 对话图片大图查看器:AI 面板里点预览图后全屏缩放查看,Teleport 到 body `),W(ee)],6)}var XL=X(PI,[[`render`,YL],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/App.vue`]]),ZL={name:`SetText`,props:{...l_,multiline:{type:Boolean,default:!1}},emits:u_,computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},rows(){let e=this.options.autosize;return e&&typeof e==`object`&&e.minRows?e.minRows:4}},methods:{onInput(e){this.$emit(`input`,e)}}},QL=[`rows`,`placeholder`,`disabled`,`value`],$L=[`placeholder`,`disabled`,`value`];function eR(e,t,n,r,i,a){return n.multiline?(B(),V(`textarea`,{key:0,class:`st-textarea`,rows:a.rows,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,QL)):(B(),V(`input`,{key:1,class:`ni-input`,type:`text`,placeholder:e.options.placeholder||``,disabled:e.disabled,value:a.text,onInput:t[2]||=e=>a.onInput(e.target.value),onChange:t[3]||=t=>e.$emit(`change`)},null,40,$L))}var tR=X(ZL,[[`render`,eR],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetText.vue`]]),nR={integer:/^-?(0|[1-9][0-9]*)?$/,"+integer":/^(0|[1-9][0-9]*)?$/,"-integer":/^(0|-[1-9]?[0-9]*)?$/,float:/^-?([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"+float":/^([0-9]*|(0|[1-9][0-9]*)\.[0-9]*)?$/,"-float":/^(0|-[0-9]*|-(0|[1-9][0-9]*)\.[0-9]*)?$/},rR={name:`SetNumber`,props:l_,emits:u_,data(){return{inputValue:``,sugOpen:!1}},computed:{suggestions(){return this.options.iParamList||[]},pattern(){return nR[this.options.type]||nR.integer}},watch:{value:{immediate:!0,handler(e){this.inputValue=e==null?``:String(e)}}},methods:{onInput(e){if(!this.pattern.test(e)){this.$refs.field.value=this.inputValue;return}this.inputValue=e,this.$emit(`input`,e)},step(e){let t=parseFloat(this.inputValue),n=String((Number.isNaN(t)?0:t)+e);this.pattern.test(n)&&(this.inputValue=n,this.$emit(`input`,n),this.emitChange())},pick(e){this.sugOpen=!1,this.inputValue=String(e.key),this.$emit(`input`,this.inputValue),this.emitChange()},closeSug(){setTimeout(()=>this.sugOpen=!1,0)},emitChange(){this.$emit(`change`)}}},iR={class:`st-number-wrap`},aR={class:`st-number`},oR=[`placeholder`,`disabled`,`value`],sR={key:0,class:`st-number__symbol st-number__symbol--btn`},cR={key:1,class:`st-number__symbol`},lR={key:0,class:`st-pop st-pop--sug`},uR=[`onMousedown`];function dR(e,t,n,r,i,a){return B(),V(`div`,iR,[U(`div`,aR,[U(`input`,{ref:`field`,class:`st-number__field`,type:`text`,placeholder:e.options.placeholder||`请输入`,disabled:e.disabled,value:i.inputValue,onInput:t[0]||=e=>a.onInput(e.target.value),onChange:t[1]||=e=>a.emitChange(),onKeydown:[t[2]||=vl(q(e=>a.step(1),[`prevent`]),[`up`]),t[3]||=vl(q(e=>a.step(-1),[`prevent`]),[`down`])],onBlur:t[4]||=e=>a.closeSug()},null,40,oR),e.$slots.symbol?(B(),V(`span`,sR,[Qi(e.$slots,`symbol`)])):e.options.symbol&&e.options.symbol!==!0?(B(),V(`span`,cR,j(e.options.symbol),1)):K(`v-if`,!0),a.suggestions.length?(B(),V(`span`,{key:2,class:`st-number__caret`,title:`预设值`,onMousedown:t[5]||=q(e=>i.sugOpen=!i.sugOpen,[`prevent`])},`▾`,32)):K(`v-if`,!0)]),K(` 预设值浮层:移出 .st-number,避免被 overflow:hidden 裁切 `),i.sugOpen&&a.suggestions.length?(B(),V(`div`,lR,[(B(!0),V(z,null,R(a.suggestions,e=>(B(),V(`div`,{key:e.key,class:A([`st-pop__item`,{"st-pop__item--on":String(e.key)===String(i.inputValue)}]),onMousedown:q(t=>a.pick(e),[`prevent`])},j(e.value),43,uR))),128))])):K(`v-if`,!0)])}var fR=X(rR,[[`render`,dR],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetNumber.vue`]]),pR={name:`SetSelect`,props:l_,emits:u_,computed:{list(){return this.options.iParamList||this.options.iTypeList||[]},placeholder(){return this.options.placeholder||`请选择`},optionList(){return this.list.map(e=>({key:String(e.key),value:e.value}))},current(){return this.value===void 0||this.value===null?``:String(this.value)}},methods:{onChange(e){this.$emit(`input`,e),this.$emit(`change`)}}};function mR(e,t,n,r,i,a){let o=L(`Dropdown`);return B(),H(o,{value:a.current,options:a.optionList,placeholder:a.placeholder,clearable:``,size:`sm`,block:``,disabled:e.disabled,onInput:a.onChange},null,8,[`value`,`options`,`placeholder`,`disabled`,`onInput`])}var hR=X(pR,[[`render`,mR],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetSelect.vue`]]),gR={name:`SetSwitch`,props:{...l_,boolean:{type:Boolean,default:!1}},emits:u_,computed:{activeValue(){return this.options.activeValue===void 0?this.boolean?!0:`1`:this.options.activeValue},inactiveValue(){return this.options.inactiveValue===void 0?!this.boolean&&`0`:this.options.inactiveValue},on(){return this.value===this.activeValue},activeText(){return this.options.activeText||`开`},inactiveText(){return this.options.inactiveText||`关`}},methods:{toggle(){this.disabled||(this.$emit(`input`,this.on?this.inactiveValue:this.activeValue),this.$emit(`change`))}}},_R={class:`st-switch__text`};function vR(e,t,n,r,i,a){return B(),V(`div`,{class:A([`st-switch`,{"st-switch--on":a.on}]),onClick:t[0]||=(...e)=>a.toggle&&a.toggle(...e)},[t[1]||=U(`span`,{class:`st-switch__track`},[U(`span`,{class:`st-switch__knob`})],-1),U(`span`,_R,j(a.on?a.activeText:a.inactiveText),1)],2)}var yR=X(gR,[[`render`,vR],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetSwitch.vue`]]);function bR(e,t){t===void 0&&(t={});var n=t.insertAt;if(!(!e||typeof document>`u`)){var r=document.head||document.getElementsByTagName(`head`)[0],i=document.createElement(`style`);i.type=`text/css`,n===`top`&&r.firstChild?r.insertBefore(i,r.firstChild):r.appendChild(i),i.styleSheet?i.styleSheet.cssText=e:i.appendChild(document.createTextNode(e))}}var xR=function(e,t){let{componentPrefix:n=``}=t||{};e.component(`${n}${this.name}`,this)},SR={},CR={name:`Checkboard`,props:{size:{type:[Number,String],default:8},white:{type:String,default:`#fff`},grey:{type:String,default:`#e6e6e6`}},computed:{bgStyle(){return{"background-image":`url(${TR(this.white,this.grey,this.size)})`}}}};function wR(e,t,n){if(typeof document>`u`)return null;let r=document.createElement(`canvas`);r.width=r.height=n*2;let i=r.getContext(`2d`);return i?(i.fillStyle=e,i.fillRect(0,0,r.width,r.height),i.fillStyle=t,i.fillRect(0,0,n,n),i.translate(n,n),i.fillRect(0,0,n,n),r.toDataURL()):null}function TR(e,t,n){let r=`${e},${t},${n}`;if(SR[r])return SR[r];let i=wR(e,t,n);return SR[r]=i,i}function ER(e,t,n,r,i,a){return B(),V(`div`,{class:`vc-checkerboard`,style:k(a.bgStyle)},null,4)}bR(`.vc-checkerboard{background-size:contain;bottom:0;left:0;position:absolute;right:0;top:0}`),CR.render=ER,CR.__file=`src/components/checkboard/checkboard.vue`,CR.install=xR;var DR={name:`Alpha`,components:{Checkboard:CR},props:{value:Object,onChange:Function},computed:{colors(){return this.value},gradientColor(){let{rgba:e}=this.colors,t=[e.r,e.g,e.b].join(`,`);return`linear-gradient(to right, rgba(${t}, 0) 0%, rgba(${t}, 1) 100%)`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.getBoundingClientRect().left+window.pageXOffset,a=(e.pageX||(e.touches?e.touches[0].pageX:0))-i,o;o=a<0?0:a>r?1:Math.round(a*100/r)/100,this.colors.a!==o&&this.$emit(`change`,{h:this.colors.hsl.h,s:this.colors.hsl.s,l:this.colors.hsl.l,a:o,source:`rgba`})},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},OR={class:`vc-alpha`},kR={class:`vc-alpha-checkboard-wrap`},AR=[U(`div`,{class:`vc-alpha-picker`},null,-1)];function jR(e,t,n,r,i,a){let o=L(`Checkboard`);return B(),V(`div`,OR,[U(`div`,kR,[W(o)]),U(`div`,{class:`vc-alpha-gradient`,style:k({background:a.gradientColor})},null,4),U(`div`,{ref:`container`,class:`vc-alpha-container`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[U(`div`,{class:`vc-alpha-pointer`,style:k({left:`${a.colors.a*100}%`})},AR,4)],544)])}bR(`.vc-alpha,.vc-alpha-checkboard-wrap{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-checkboard-wrap{overflow:hidden}.vc-alpha-gradient{bottom:0;left:0;position:absolute;right:0;top:0}.vc-alpha-container{cursor:pointer;height:100%;margin:0 3px;position:relative;z-index:2}.vc-alpha-pointer{position:absolute;z-index:2}.vc-alpha-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),DR.render=jR,DR.__file=`src/components/alpha/alpha.vue`,DR.install=xR;function MR(e,t){PR(e)&&(e=`100%`);var n=FR(e);return e=t===360?e:Math.min(t,Math.max(0,parseFloat(e))),n&&(e=parseInt(String(e*t),10)/100),Math.abs(e-t)<1e-6?1:(e=t===360?(e<0?e%t+t:e%t)/parseFloat(String(t)):e%t/parseFloat(String(t)),e)}function NR(e){return Math.min(1,Math.max(0,e))}function PR(e){return typeof e==`string`&&e.indexOf(`.`)!==-1&&parseFloat(e)===1}function FR(e){return typeof e==`string`&&e.indexOf(`%`)!==-1}function IR(e){return e=parseFloat(e),(isNaN(e)||e<0||e>1)&&(e=1),e}function LR(e){return e<=1?`${Number(e)*100}%`:e}function RR(e){return e.length===1?`0`+e:String(e)}function zR(e,t,n){return{r:MR(e,255)*255,g:MR(t,255)*255,b:MR(n,255)*255}}function BR(e,t,n){e=MR(e,255),t=MR(t,255),n=MR(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=0,s=(r+i)/2;if(r===i)o=0,a=0;else{var c=r-i;switch(o=s>.5?c/(2-r-i):c/(r+i),r){case e:a=(t-n)/c+(t<n?6:0);break;case t:a=(n-e)/c+2;break;case n:a=(e-t)/c+4}a/=6}return{h:a,s:o,l:s}}function VR(e,t,n){return n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*(6*n):n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e}function HR(e,t,n){var r,i,a;if(e=MR(e,360),t=MR(t,100),n=MR(n,100),t===0)i=n,a=n,r=n;else{var o=n<.5?n*(1+t):n+t-n*t,s=2*n-o;r=VR(s,o,e+1/3),i=VR(s,o,e),a=VR(s,o,e-1/3)}return{r:r*255,g:i*255,b:a*255}}function UR(e,t,n){e=MR(e,255),t=MR(t,255),n=MR(n,255);var r=Math.max(e,t,n),i=Math.min(e,t,n),a=0,o=r,s=r-i,c=r===0?0:s/r;if(r===i)a=0;else{switch(r){case e:a=(t-n)/s+(t<n?6:0);break;case t:a=(n-e)/s+2;break;case n:a=(e-t)/s+4}a/=6}return{h:a,s:c,v:o}}function WR(e,t,n){e=MR(e,360)*6,t=MR(t,100),n=MR(n,100);var r=Math.floor(e),i=e-r,a=n*(1-t),o=n*(1-i*t),s=n*(1-(1-i)*t),c=r%6,l=[n,o,a,a,s,n][c],u=[s,n,n,o,a,a][c],d=[a,a,s,n,n,o][c];return{r:l*255,g:u*255,b:d*255}}function GR(e,t,n,r){var i=[RR(Math.round(e).toString(16)),RR(Math.round(t).toString(16)),RR(Math.round(n).toString(16))];return r&&i[0].startsWith(i[0].charAt(1))&&i[1].startsWith(i[1].charAt(1))&&i[2].startsWith(i[2].charAt(1))?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join(``)}function KR(e,t,n,r,i){var a=[RR(Math.round(e).toString(16)),RR(Math.round(t).toString(16)),RR(Math.round(n).toString(16)),RR(qR(r))];return i&&a[0].startsWith(a[0].charAt(1))&&a[1].startsWith(a[1].charAt(1))&&a[2].startsWith(a[2].charAt(1))&&a[3].startsWith(a[3].charAt(1))?a[0].charAt(0)+a[1].charAt(0)+a[2].charAt(0)+a[3].charAt(0):a.join(``)}function qR(e){return Math.round(parseFloat(e)*255).toString(16)}function JR(e){return YR(e)/255}function YR(e){return parseInt(e,16)}function XR(e){return{r:e>>16,g:(e&65280)>>8,b:e&255}}var ZR={aliceblue:`#f0f8ff`,antiquewhite:`#faebd7`,aqua:`#00ffff`,aquamarine:`#7fffd4`,azure:`#f0ffff`,beige:`#f5f5dc`,bisque:`#ffe4c4`,black:`#000000`,blanchedalmond:`#ffebcd`,blue:`#0000ff`,blueviolet:`#8a2be2`,brown:`#a52a2a`,burlywood:`#deb887`,cadetblue:`#5f9ea0`,chartreuse:`#7fff00`,chocolate:`#d2691e`,coral:`#ff7f50`,cornflowerblue:`#6495ed`,cornsilk:`#fff8dc`,crimson:`#dc143c`,cyan:`#00ffff`,darkblue:`#00008b`,darkcyan:`#008b8b`,darkgoldenrod:`#b8860b`,darkgray:`#a9a9a9`,darkgreen:`#006400`,darkgrey:`#a9a9a9`,darkkhaki:`#bdb76b`,darkmagenta:`#8b008b`,darkolivegreen:`#556b2f`,darkorange:`#ff8c00`,darkorchid:`#9932cc`,darkred:`#8b0000`,darksalmon:`#e9967a`,darkseagreen:`#8fbc8f`,darkslateblue:`#483d8b`,darkslategray:`#2f4f4f`,darkslategrey:`#2f4f4f`,darkturquoise:`#00ced1`,darkviolet:`#9400d3`,deeppink:`#ff1493`,deepskyblue:`#00bfff`,dimgray:`#696969`,dimgrey:`#696969`,dodgerblue:`#1e90ff`,firebrick:`#b22222`,floralwhite:`#fffaf0`,forestgreen:`#228b22`,fuchsia:`#ff00ff`,gainsboro:`#dcdcdc`,ghostwhite:`#f8f8ff`,goldenrod:`#daa520`,gold:`#ffd700`,gray:`#808080`,green:`#008000`,greenyellow:`#adff2f`,grey:`#808080`,honeydew:`#f0fff0`,hotpink:`#ff69b4`,indianred:`#cd5c5c`,indigo:`#4b0082`,ivory:`#fffff0`,khaki:`#f0e68c`,lavenderblush:`#fff0f5`,lavender:`#e6e6fa`,lawngreen:`#7cfc00`,lemonchiffon:`#fffacd`,lightblue:`#add8e6`,lightcoral:`#f08080`,lightcyan:`#e0ffff`,lightgoldenrodyellow:`#fafad2`,lightgray:`#d3d3d3`,lightgreen:`#90ee90`,lightgrey:`#d3d3d3`,lightpink:`#ffb6c1`,lightsalmon:`#ffa07a`,lightseagreen:`#20b2aa`,lightskyblue:`#87cefa`,lightslategray:`#778899`,lightslategrey:`#778899`,lightsteelblue:`#b0c4de`,lightyellow:`#ffffe0`,lime:`#00ff00`,limegreen:`#32cd32`,linen:`#faf0e6`,magenta:`#ff00ff`,maroon:`#800000`,mediumaquamarine:`#66cdaa`,mediumblue:`#0000cd`,mediumorchid:`#ba55d3`,mediumpurple:`#9370db`,mediumseagreen:`#3cb371`,mediumslateblue:`#7b68ee`,mediumspringgreen:`#00fa9a`,mediumturquoise:`#48d1cc`,mediumvioletred:`#c71585`,midnightblue:`#191970`,mintcream:`#f5fffa`,mistyrose:`#ffe4e1`,moccasin:`#ffe4b5`,navajowhite:`#ffdead`,navy:`#000080`,oldlace:`#fdf5e6`,olive:`#808000`,olivedrab:`#6b8e23`,orange:`#ffa500`,orangered:`#ff4500`,orchid:`#da70d6`,palegoldenrod:`#eee8aa`,palegreen:`#98fb98`,paleturquoise:`#afeeee`,palevioletred:`#db7093`,papayawhip:`#ffefd5`,peachpuff:`#ffdab9`,peru:`#cd853f`,pink:`#ffc0cb`,plum:`#dda0dd`,powderblue:`#b0e0e6`,purple:`#800080`,rebeccapurple:`#663399`,red:`#ff0000`,rosybrown:`#bc8f8f`,royalblue:`#4169e1`,saddlebrown:`#8b4513`,salmon:`#fa8072`,sandybrown:`#f4a460`,seagreen:`#2e8b57`,seashell:`#fff5ee`,sienna:`#a0522d`,silver:`#c0c0c0`,skyblue:`#87ceeb`,slateblue:`#6a5acd`,slategray:`#708090`,slategrey:`#708090`,snow:`#fffafa`,springgreen:`#00ff7f`,steelblue:`#4682b4`,tan:`#d2b48c`,teal:`#008080`,thistle:`#d8bfd8`,tomato:`#ff6347`,turquoise:`#40e0d0`,violet:`#ee82ee`,wheat:`#f5deb3`,white:`#ffffff`,whitesmoke:`#f5f5f5`,yellow:`#ffff00`,yellowgreen:`#9acd32`};function QR(e){var t={r:0,g:0,b:0},n=1,r=null,i=null,a=null,o=!1,s=!1;return typeof e==`string`&&(e=rz(e)),typeof e==`object`&&(iz(e.r)&&iz(e.g)&&iz(e.b)?(t=zR(e.r,e.g,e.b),o=!0,s=String(e.r).substr(-1)===`%`?`prgb`:`rgb`):iz(e.h)&&iz(e.s)&&iz(e.v)?(r=LR(e.s),i=LR(e.v),t=WR(e.h,r,i),o=!0,s=`hsv`):iz(e.h)&&iz(e.s)&&iz(e.l)&&(r=LR(e.s),a=LR(e.l),t=HR(e.h,r,a),o=!0,s=`hsl`),Object.prototype.hasOwnProperty.call(e,`a`)&&(n=e.a)),n=IR(n),{ok:o,format:e.format||s,r:Math.min(255,Math.max(t.r,0)),g:Math.min(255,Math.max(t.g,0)),b:Math.min(255,Math.max(t.b,0)),a:n}}var $R=`(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)`,ez=`[\\s|\\(]+(${$R})[,|\\s]+(${$R})[,|\\s]+(${$R})\\s*\\)?`,tz=`[\\s|\\(]+(${$R})[,|\\s]+(${$R})[,|\\s]+(${$R})[,|\\s]+(${$R})\\s*\\)?`,nz={CSS_UNIT:new RegExp($R),rgb:RegExp(`rgb`+ez),rgba:RegExp(`rgba`+tz),hsl:RegExp(`hsl`+ez),hsla:RegExp(`hsla`+tz),hsv:RegExp(`hsv`+ez),hsva:RegExp(`hsva`+tz),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/};function rz(e){if(e=e.trim().toLowerCase(),e.length===0)return!1;var t=!1;if(ZR[e])e=ZR[e],t=!0;else if(e===`transparent`)return{r:0,g:0,b:0,a:0,format:`name`};var n=nz.rgb.exec(e);return n?{r:n[1],g:n[2],b:n[3]}:(n=nz.rgba.exec(e),n?{r:n[1],g:n[2],b:n[3],a:n[4]}:(n=nz.hsl.exec(e),n?{h:n[1],s:n[2],l:n[3]}:(n=nz.hsla.exec(e),n?{h:n[1],s:n[2],l:n[3],a:n[4]}:(n=nz.hsv.exec(e),n?{h:n[1],s:n[2],v:n[3]}:(n=nz.hsva.exec(e),n?{h:n[1],s:n[2],v:n[3],a:n[4]}:(n=nz.hex8.exec(e),n?{r:YR(n[1]),g:YR(n[2]),b:YR(n[3]),a:JR(n[4]),format:t?`name`:`hex8`}:(n=nz.hex6.exec(e),n?{r:YR(n[1]),g:YR(n[2]),b:YR(n[3]),format:t?`name`:`hex`}:(n=nz.hex4.exec(e),n?{r:YR(n[1]+n[1]),g:YR(n[2]+n[2]),b:YR(n[3]+n[3]),a:JR(n[4]+n[4]),format:t?`name`:`hex8`}:(n=nz.hex3.exec(e),n?{r:YR(n[1]+n[1]),g:YR(n[2]+n[2]),b:YR(n[3]+n[3]),format:t?`name`:`hex`}:!1)))))))))}function iz(e){return!!nz.CSS_UNIT.exec(String(e))}var az=function(){function e(t,n){if(t===void 0&&(t=``),n===void 0&&(n={}),t instanceof e)return t;typeof t==`number`&&(t=XR(t)),this.originalInput=t;var r=QR(t);this.originalInput=t,this.r=r.r,this.g=r.g,this.b=r.b,this.a=r.a,this.roundA=Math.round(100*this.a)/100,this.format=n.format??r.format,this.gradientType=n.gradientType,this.r<1&&(this.r=Math.round(this.r)),this.g<1&&(this.g=Math.round(this.g)),this.b<1&&(this.b=Math.round(this.b)),this.isValid=r.ok}return e.prototype.isDark=function(){return this.getBrightness()<128},e.prototype.isLight=function(){return!this.isDark()},e.prototype.getBrightness=function(){var e=this.toRgb();return(e.r*299+e.g*587+e.b*114)/1e3},e.prototype.getLuminance=function(){var e=this.toRgb(),t,n,r,i=e.r/255,a=e.g/255,o=e.b/255;return t=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,n=a<=.03928?a/12.92:((a+.055)/1.055)**2.4,r=o<=.03928?o/12.92:((o+.055)/1.055)**2.4,.2126*t+.7152*n+.0722*r},e.prototype.getAlpha=function(){return this.a},e.prototype.setAlpha=function(e){return this.a=IR(e),this.roundA=Math.round(100*this.a)/100,this},e.prototype.isMonochrome=function(){return this.toHsl().s===0},e.prototype.toHsv=function(){var e=UR(this.r,this.g,this.b);return{h:e.h*360,s:e.s,v:e.v,a:this.a}},e.prototype.toHsvString=function(){var e=UR(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.v*100);return this.a===1?`hsv(${t}, ${n}%, ${r}%)`:`hsva(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHsl=function(){var e=BR(this.r,this.g,this.b);return{h:e.h*360,s:e.s,l:e.l,a:this.a}},e.prototype.toHslString=function(){var e=BR(this.r,this.g,this.b),t=Math.round(e.h*360),n=Math.round(e.s*100),r=Math.round(e.l*100);return this.a===1?`hsl(${t}, ${n}%, ${r}%)`:`hsla(${t}, ${n}%, ${r}%, ${this.roundA})`},e.prototype.toHex=function(e){return e===void 0&&(e=!1),GR(this.r,this.g,this.b,e)},e.prototype.toHexString=function(e){return e===void 0&&(e=!1),`#`+this.toHex(e)},e.prototype.toHex8=function(e){return e===void 0&&(e=!1),KR(this.r,this.g,this.b,this.a,e)},e.prototype.toHex8String=function(e){return e===void 0&&(e=!1),`#`+this.toHex8(e)},e.prototype.toHexShortString=function(e){return e===void 0&&(e=!1),this.a===1?this.toHexString(e):this.toHex8String(e)},e.prototype.toRgb=function(){return{r:Math.round(this.r),g:Math.round(this.g),b:Math.round(this.b),a:this.a}},e.prototype.toRgbString=function(){var e=Math.round(this.r),t=Math.round(this.g),n=Math.round(this.b);return this.a===1?`rgb(${e}, ${t}, ${n})`:`rgba(${e}, ${t}, ${n}, ${this.roundA})`},e.prototype.toPercentageRgb=function(){var e=function(e){return`${Math.round(MR(e,255)*100)}%`};return{r:e(this.r),g:e(this.g),b:e(this.b),a:this.a}},e.prototype.toPercentageRgbString=function(){var e=function(e){return Math.round(MR(e,255)*100)};return this.a===1?`rgb(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%)`:`rgba(${e(this.r)}%, ${e(this.g)}%, ${e(this.b)}%, ${this.roundA})`},e.prototype.toName=function(){if(this.a===0)return`transparent`;if(this.a<1)return!1;for(var e=`#`+GR(this.r,this.g,this.b,!1),t=0,n=Object.entries(ZR);t<n.length;t++){var r=n[t],i=r[0];if(e===r[1])return i}return!1},e.prototype.toString=function(e){var t=!!e;e??=this.format;var n=!1,r=this.a<1&&this.a>=0;return!t&&r&&(e.startsWith(`hex`)||e===`name`)?e===`name`&&this.a===0?this.toName():this.toRgbString():(e===`rgb`&&(n=this.toRgbString()),e===`prgb`&&(n=this.toPercentageRgbString()),(e===`hex`||e===`hex6`)&&(n=this.toHexString()),e===`hex3`&&(n=this.toHexString(!0)),e===`hex4`&&(n=this.toHex8String(!0)),e===`hex8`&&(n=this.toHex8String()),e===`name`&&(n=this.toName()),e===`hsl`&&(n=this.toHslString()),e===`hsv`&&(n=this.toHsvString()),n||this.toHexString())},e.prototype.toNumber=function(){return(Math.round(this.r)<<16)+(Math.round(this.g)<<8)+Math.round(this.b)},e.prototype.clone=function(){return new e(this.toString())},e.prototype.lighten=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l+=t/100,n.l=NR(n.l),new e(n)},e.prototype.brighten=function(t){t===void 0&&(t=10);var n=this.toRgb();return n.r=Math.max(0,Math.min(255,n.r-Math.round(255*-(t/100)))),n.g=Math.max(0,Math.min(255,n.g-Math.round(255*-(t/100)))),n.b=Math.max(0,Math.min(255,n.b-Math.round(255*-(t/100)))),new e(n)},e.prototype.darken=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.l-=t/100,n.l=NR(n.l),new e(n)},e.prototype.tint=function(e){return e===void 0&&(e=10),this.mix(`white`,e)},e.prototype.shade=function(e){return e===void 0&&(e=10),this.mix(`black`,e)},e.prototype.desaturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s-=t/100,n.s=NR(n.s),new e(n)},e.prototype.saturate=function(t){t===void 0&&(t=10);var n=this.toHsl();return n.s+=t/100,n.s=NR(n.s),new e(n)},e.prototype.greyscale=function(){return this.desaturate(100)},e.prototype.spin=function(t){var n=this.toHsl(),r=(n.h+t)%360;return n.h=r<0?360+r:r,new e(n)},e.prototype.mix=function(t,n){n===void 0&&(n=50);var r=this.toRgb(),i=new e(t).toRgb(),a=n/100;return new e({r:(i.r-r.r)*a+r.r,g:(i.g-r.g)*a+r.g,b:(i.b-r.b)*a+r.b,a:(i.a-r.a)*a+r.a})},e.prototype.analogous=function(t,n){t===void 0&&(t=6),n===void 0&&(n=30);var r=this.toHsl(),i=360/n,a=[this];for(r.h=(r.h-(i*t>>1)+720)%360;--t;)r.h=(r.h+i)%360,a.push(new e(r));return a},e.prototype.complement=function(){var t=this.toHsl();return t.h=(t.h+180)%360,new e(t)},e.prototype.monochromatic=function(t){t===void 0&&(t=6);for(var n=this.toHsv(),r=n.h,i=n.s,a=n.v,o=[],s=1/t;t--;)o.push(new e({h:r,s:i,v:a})),a=(a+s)%1;return o},e.prototype.splitcomplement=function(){var t=this.toHsl(),n=t.h;return[this,new e({h:(n+72)%360,s:t.s,l:t.l}),new e({h:(n+216)%360,s:t.s,l:t.l})]},e.prototype.onBackground=function(t){var n=this.toRgb(),r=new e(t).toRgb(),i=n.a+r.a*(1-n.a);return new e({r:(n.r*n.a+r.r*r.a*(1-n.a))/i,g:(n.g*n.a+r.g*r.a*(1-n.a))/i,b:(n.b*n.a+r.b*r.a*(1-n.a))/i,a:i})},e.prototype.triad=function(){return this.polyad(3)},e.prototype.tetrad=function(){return this.polyad(4)},e.prototype.polyad=function(t){for(var n=this.toHsl(),r=n.h,i=[this],a=360/t,o=1;o<t;o++)i.push(new e({h:(r+o*a)%360,s:n.s,l:n.l}));return i},e.prototype.equals=function(t){return this.toRgbString()===new e(t).toRgbString()},e}();function oz(...e){return new az(...e)}function sz(e,t){let n=e&&e.a,r;r=e&&e.hsl?oz(e.hsl):e&&e.hex&&e.hex.length>0?oz(e.hex):e&&e.hsv?oz(e.hsv):e&&e.rgba?oz(e.rgba):e&&e.rgb?oz(e.rgb):oz(e),r&&(r._a===void 0||r._a===null)&&r.setAlpha(n||r.getAlpha());let i=r.toHsl(),a=r.toHsv();return i.s===0&&(a.h=i.h=e.h||e.hsl&&e.hsl.h||t||0),a.v<.0164&&(a.h=e.h||e.hsv&&e.hsv.h||0,a.s=e.s||e.hsv&&e.hsv.s||0),i.l<.01&&(i.h=e.h||e.hsl&&e.hsl.h||0,i.s=e.s||e.hsl&&e.hsl.s||0),{hsl:i,hex:r.toHexString().toUpperCase(),hex8:r.toHex8String().toUpperCase(),rgba:r.toRgb(),hsv:a,oldHue:e.h||t||i.h,source:e.source,a:r.getAlpha()}}var cz={model:{prop:`modelValue`,event:`update:modelValue`},props:[`modelValue`],data(){return{val:sz(this.modelValue)}},computed:{colors:{get(){return this.val},set(e){this.val=e,this.$emit(`update:modelValue`,e)}}},watch:{modelValue(e){this.val=sz(e)}},methods:{colorChange(e,t){this.oldHue=this.colors.hsl.h,this.colors=sz(e,t||this.oldHue)},isValidHex(e){return oz(e).isValid},simpleCheckForValidColor(e){let t=[`r`,`g`,`b`,`a`,`h`,`s`,`l`,`v`],n=0,r=0;for(let i=0;i<t.length;i++){let a=t[i];e[a]&&(n++,isNaN(e[a])||r++)}if(n===r)return e},paletteUpperCase(e){return e.map(e=>e.toUpperCase())},isTransparent(e){return oz(e).getAlpha()===0}}},lz={name:`EditableInput`,props:{label:String,labelText:String,desc:String,value:[String,Number],max:Number,min:Number,arrowOffset:{type:Number,default:1}},computed:{val:{get(){return this.value},set(e){if(this.max!==void 0&&+e>this.max)this.$refs.input.value=this.max;else return e}},labelId(){return`input__label__${this.label}__${Math.random().toString().slice(2,5)}`},labelSpanText(){return this.labelText||this.label}},methods:{update(e){this.handleChange(e.target.value)},handleChange(e){let t={};t[this.label]=e,(t.hex===void 0&&t[`#`]===void 0||e.length>5)&&this.$emit(`change`,t)},handleKeyDown(e){let{val:t}=this,n=Number(t);if(n){let r=this.arrowOffset||1;e.keyCode===38&&(t=n+r,this.handleChange(t),e.preventDefault()),e.keyCode===40&&(t=n-r,this.handleChange(t),e.preventDefault())}}}},uz={class:`vc-editable-input`},dz=[`aria-labelledby`],fz=[`id`,`for`],pz={class:`vc-input__desc`};function mz(e,t,n,r,i,a){return B(),V(`div`,uz,[I(U(`input`,{ref:`input`,"onUpdate:modelValue":t[0]||=e=>a.val=e,"aria-labelledby":a.labelId,class:`vc-input__input`,onKeydown:t[1]||=(...e)=>a.handleKeyDown&&a.handleKeyDown(...e),onInput:t[2]||=(...e)=>a.update&&a.update(...e)},null,40,dz),[[il,a.val]]),U(`span`,{id:a.labelId,for:n.label,class:`vc-input__label`},j(a.labelSpanText),9,fz),U(`span`,pz,j(n.desc),1)])}bR(`.vc-editable-input{position:relative}.vc-input__input{border:0;outline:none;padding:0}.vc-input__label{text-transform:capitalize}`),lz.render=mz,lz.__file=`src/components/editable-input/editable-input.vue`,lz.install=xR;function hz(e,t,n){return t<n?e<t?t:e>n?n:e:e<n?n:e>t?t:e}var gz={name:`Saturation`,props:{value:Object},computed:{colors(){return this.value},bgColor(){return`hsl(${this.colors.hsv.h}, 100%, 50%)`},pointerTop(){return`${-(this.colors.hsv.v*100)+1+100}%`},pointerLeft(){return`${this.colors.hsv.s*100}%`}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=hz(s-a,0,r),u=hz(c-o,0,i),d=l/r,f=hz(-(u/i)+1,0,1);this.onChange({h:this.colors.hsv.h,s:d,v:f,a:this.colors.hsv.a,source:`hsva`})},onChange(e){this.$emit(`change`,e)},handleMouseDown(e){window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},_z=U(`div`,{class:`vc-saturation--white`},null,-1),vz=U(`div`,{class:`vc-saturation--black`},null,-1),yz=[U(`div`,{class:`vc-saturation-circle`},null,-1)];function bz(e,t,n,r,i,a){return B(),V(`div`,{ref:`container`,class:`vc-saturation`,style:k({background:a.bgColor}),onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[_z,vz,U(`div`,{class:`vc-saturation-pointer`,style:k({top:a.pointerTop,left:a.pointerLeft})},yz,4)],36)}bR(`.vc-saturation,.vc-saturation--black,.vc-saturation--white{bottom:0;cursor:pointer;left:0;position:absolute;right:0;top:0}.vc-saturation--white{background:linear-gradient(90deg,#fff,hsla(0,0%,100%,0))}.vc-saturation--black{background:linear-gradient(0deg,#000,transparent)}.vc-saturation-pointer{cursor:pointer;position:absolute}.vc-saturation-circle{border-radius:50%;box-shadow:0 0 0 1.5px #fff,inset 0 0 1px 1px rgba(0,0,0,.3),0 0 1px 2px rgba(0,0,0,.4);cursor:head;height:4px;transform:translate(-2px,-2px);width:4px}`),gz.render=bz,gz.__file=`src/components/saturation/saturation.vue`,gz.install=xR;var xz={name:`Hue`,props:{value:Object,direction:{type:String,default:`horizontal`}},data(){return{oldHue:0,pullDirection:``}},computed:{colors(){return this.value},directionClass(){return{"vc-hue--horizontal":this.direction===`horizontal`,"vc-hue--vertical":this.direction===`vertical`}},pointerTop(){return this.direction===`vertical`?this.colors.hsl.h===0&&this.pullDirection===`right`?0:`${-(this.colors.hsl.h*100/360)+100}%`:0},pointerLeft(){return this.direction===`vertical`?0:this.colors.hsl.h===0&&this.pullDirection===`right`?`100%`:`${this.colors.hsl.h*100/360}%`}},watch:{value:{handler(e,t){let{h:n}=e.hsl;n!==0&&n-this.oldHue>0&&(this.pullDirection=`right`),n!==0&&n-this.oldHue<0&&(this.pullDirection=`left`),this.oldHue=n},deep:!0,immediate:!0}},methods:{handleChange(e,t){!t&&e.preventDefault();let{container:n}=this.$refs;if(!n)return;let r=n.clientWidth,i=n.clientHeight,a=n.getBoundingClientRect().left+window.pageXOffset,o=n.getBoundingClientRect().top+window.pageYOffset,s=e.pageX||(e.touches?e.touches[0].pageX:0),c=e.pageY||(e.touches?e.touches[0].pageY:0),l=s-a,u=c-o,d,f;this.direction===`vertical`?(u<0?d=360:u>i?d=0:(f=-(u*100/i)+100,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`})):(l<0?d=0:l>r?d=360:(f=l*100/r,d=360*f/100),this.colors.hsl.h!==d&&this.$emit(`change`,{h:d,s:this.colors.hsl.s,l:this.colors.hsl.l,a:this.colors.hsl.a,source:`hsl`}))},handleMouseDown(e){this.handleChange(e,!0),window.addEventListener(`mousemove`,this.handleChange),window.addEventListener(`mouseup`,this.handleChange),window.addEventListener(`mouseup`,this.handleMouseUp)},handleMouseUp(e){this.unbindEventListeners()},unbindEventListeners(){window.removeEventListener(`mousemove`,this.handleChange),window.removeEventListener(`mouseup`,this.handleChange),window.removeEventListener(`mouseup`,this.handleMouseUp)}}},Sz=[`aria-valuenow`],Cz=[U(`div`,{class:`vc-hue-picker`},null,-1)];function wz(e,t,n,r,i,a){return B(),V(`div`,{class:A([`vc-hue`,[a.directionClass]])},[U(`div`,{ref:`container`,class:`vc-hue-container`,role:`slider`,"aria-valuenow":a.colors.hsl.h,"aria-valuemin":`0`,"aria-valuemax":`360`,onMousedown:t[0]||=(...e)=>a.handleMouseDown&&a.handleMouseDown(...e),onTouchmove:t[1]||=(...e)=>a.handleChange&&a.handleChange(...e),onTouchstart:t[2]||=(...e)=>a.handleChange&&a.handleChange(...e)},[U(`div`,{class:`vc-hue-pointer`,style:k({top:a.pointerTop,left:a.pointerLeft}),role:`presentation`},Cz,4)],40,Sz)],2)}bR(`.vc-hue{border-radius:2px;bottom:0;left:0;position:absolute;right:0;top:0}.vc-hue--horizontal{background:linear-gradient(90deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue--vertical{background:linear-gradient(0deg,red 0,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red)}.vc-hue-container{cursor:pointer;height:100%;margin:0 2px;position:relative}.vc-hue-pointer{position:absolute;z-index:2}.vc-hue-picker{background:#fff;border-radius:1px;box-shadow:0 0 2px rgba(0,0,0,.6);cursor:pointer;height:8px;margin-top:1px;transform:translateX(-2px);width:4px}`),xz.render=wz,xz.__file=`src/components/hue/hue.vue`,xz.install=xR;var Tz=[`#D0021B`,`#F5A623`,`#F8E71C`,`#8B572A`,`#7ED321`,`#417505`,`#BD10E0`,`#9013FE`,`#4A90E2`,`#50E3C2`,`#B8E986`,`#000000`,`#4A4A4A`,`#9B9B9B`,`#FFFFFF`,`rgba(0,0,0,0)`],Ez={name:`Sketch`,components:{Saturation:gz,Hue:xz,Alpha:DR,EdIn:lz,Checkboard:CR},mixins:[cz],props:{presetColors:{type:Array,default(){return Tz}},disableAlpha:{type:Boolean,default:!1},disableFields:{type:Boolean,default:!1}},computed:{hex(){let e;return e=this.colors.a<1?this.colors.hex8:this.colors.hex,e.replace(`#`,``)},activeColor(){let{rgba:e}=this.colors;return`rgba(${[e.r,e.g,e.b,e.a].join(`,`)})`}},methods:{handlePreset(e){this.colorChange(e)},childChange(e){this.colorChange(e)},inputChange(e){e&&(e.hex?this.isValidHex(e.hex)&&this.colorChange({hex:e.hex,source:`hex`}):(e.r||e.g||e.b||e.a)&&this.colorChange({r:e.r||this.colors.rgba.r,g:e.g||this.colors.rgba.g,b:e.b||this.colors.rgba.b,a:e.a||this.colors.rgba.a,source:`rgba`}))}}},Dz={class:`vc-sketch-saturation-wrap`},Oz={class:`vc-sketch-controls`},kz={class:`vc-sketch-sliders`},Az={class:`vc-sketch-hue-wrap`},jz={key:0,class:`vc-sketch-alpha-wrap`},Mz={class:`vc-sketch-color-wrap`},Nz=[`aria-label`],Pz={key:0,class:`vc-sketch-field`},Fz={class:`vc-sketch-field--double`},Iz={class:`vc-sketch-field--single`},Lz={class:`vc-sketch-field--single`},Rz={class:`vc-sketch-field--single`},zz={key:0,class:`vc-sketch-field--single`},Bz={class:`vc-sketch-presets`,role:`group`,"aria-label":`A color preset, pick one to set as current color`},Vz=[`aria-label`,`onClick`],Hz=[`aria-label`,`onClick`];function Uz(e,t,n,r,i,a){let o=L(`Saturation`),s=L(`Hue`),c=L(`Alpha`),l=L(`Checkboard`),u=L(`EdIn`);return B(),V(`div`,{role:`application`,"aria-label":`Sketch color picker`,class:A([`vc-sketch`,[n.disableAlpha?`vc-sketch__disable-alpha`:``]])},[U(`div`,Dz,[W(o,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),U(`div`,Oz,[U(`div`,kz,[U(`div`,Az,[W(s,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]),n.disableAlpha?K(`v-if`,!0):(B(),V(`div`,jz,[W(c,{value:e.colors,onChange:a.childChange},null,8,[`value`,`onChange`])]))]),U(`div`,Mz,[U(`div`,{"aria-label":`Current color is ${a.activeColor}`,class:`vc-sketch-active-color`,style:k({background:a.activeColor})},null,12,Nz),W(l)])]),n.disableFields?K(`v-if`,!0):(B(),V(`div`,Pz,[K(` rgba `),U(`div`,Fz,[W(u,{label:`hex`,value:a.hex,onChange:a.inputChange},null,8,[`value`,`onChange`])]),U(`div`,Iz,[W(u,{label:`r`,value:e.colors.rgba.r,onChange:a.inputChange},null,8,[`value`,`onChange`])]),U(`div`,Lz,[W(u,{label:`g`,value:e.colors.rgba.g,onChange:a.inputChange},null,8,[`value`,`onChange`])]),U(`div`,Rz,[W(u,{label:`b`,value:e.colors.rgba.b,onChange:a.inputChange},null,8,[`value`,`onChange`])]),n.disableAlpha?K(`v-if`,!0):(B(),V(`div`,zz,[W(u,{label:`a`,value:e.colors.a,"arrow-offset":.01,max:1,onChange:a.inputChange},null,8,[`value`,`arrow-offset`,`onChange`])]))])),U(`div`,Bz,[(B(!0),V(z,null,R(n.presetColors,t=>(B(),V(z,null,[e.isTransparent(t)?(B(),V(`div`,{key:t,"aria-label":`Color:${t}`,class:`vc-sketch-presets-color`,onClick:e=>a.handlePreset(t)},[W(l)],8,Hz)):(B(),V(`div`,{key:`!${t}`,class:`vc-sketch-presets-color`,"aria-label":`Color:${t}`,style:k({background:t}),onClick:e=>a.handlePreset(t)},null,12,Vz))],64))),256))])],2)}bR(`.vc-sketch{background:#fff;border-radius:4px;box-shadow:0 0 0 1px rgba(0,0,0,.15),0 8px 16px rgba(0,0,0,.15);box-sizing:initial;padding:10px 10px 0;position:relative;width:200px}.vc-sketch-saturation-wrap{overflow:hidden;padding-bottom:75%;position:relative;width:100%}.vc-sketch-controls{display:flex}.vc-sketch-sliders{flex:1;padding:4px 0}.vc-sketch-sliders .vc-alpha-gradient,.vc-sketch-sliders .vc-hue{border-radius:2px}.vc-sketch-alpha-wrap,.vc-sketch-hue-wrap{height:10px;position:relative}.vc-sketch-alpha-wrap{margin-top:4px;overflow:hidden}.vc-sketch-color-wrap{border-radius:3px;height:24px;margin-left:4px;margin-top:4px;position:relative;width:24px}.vc-sketch-active-color{border-radius:2px;bottom:0;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15),inset 0 0 4px rgba(0,0,0,.25);left:0;position:absolute;right:0;top:0;z-index:2}.vc-sketch-color-wrap .vc-checkerboard{background-size:auto}.vc-sketch-field{display:flex;padding-top:4px}.vc-sketch-field .vc-input__input{border:none;box-shadow:inset 0 0 0 1px #ccc;font-size:10px;padding:4px 0 3px 10%;width:90%}.vc-sketch-field .vc-input__label{color:#222;display:block;font-size:11px;padding-bottom:4px;padding-top:3px;text-align:center;text-transform:capitalize}.vc-sketch-field--single{flex:1;padding-left:6px}.vc-sketch-field--double{flex:2}.vc-sketch-presets{border-top:1px solid #eee;margin-left:-10px;margin-right:-10px;padding-left:10px;padding-top:10px}.vc-sketch-presets-color{cursor:pointer;display:inline-block;height:16px;margin:0 10px 10px 0;overflow:hidden;position:relative;vertical-align:top;width:16px}.vc-sketch-presets-color,.vc-sketch-presets-color .vc-checkerboard{border-radius:3px;box-shadow:inset 0 0 0 1px rgba(0,0,0,.15)}.vc-sketch__disable-alpha .vc-sketch-color-wrap{height:10px}`),Ez.render=Uz,Ez.__file=`src/components/sketch/sketch.vue`,Ez.install=xR;function Wz(e){let t=String(e||``).trim();if(!t)return null;let n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i);if(n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:1};if(n=t.match(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i),n){let e=e=>parseInt(e+e,16);return{r:e(n[1]),g:e(n[2]),b:e(n[3]),a:1}}if(n=t.match(/^#([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2})$/i),n)return{r:parseInt(n[1],16),g:parseInt(n[2],16),b:parseInt(n[3],16),a:parseInt(n[4],16)/255};if(n=t.match(/^rgba?\(\s*([\d.]+)\s*,\s*([\d.]+)\s*,\s*([\d.]+)(?:\s*,\s*([\d.]+))?\s*\)$/i),n){let e=n[4]===void 0?1:parseFloat(n[4]);return{r:Math.round(parseFloat(n[1])),g:Math.round(parseFloat(n[2])),b:Math.round(parseFloat(n[3])),a:e}}return null}function Gz(e){if(!e)return`#000000`;let t=e=>Math.max(0,Math.min(255,Math.round(e))).toString(16).padStart(2,`0`);return`#`+t(e.r)+t(e.g)+t(e.b)}function Kz(e){return e?e.a>=1?Gz(e):`rgba(${Math.round(e.r)}, ${Math.round(e.g)}, ${Math.round(e.b)}, ${+e.a.toFixed(2)})`:``}var qz={name:`SetColor`,components:{Sketch:Ez},props:l_,emits:u_,data(){return{_rgb:null,popOpen:!1,popW:240,popStyle:{position:`fixed`,left:`0px`,top:`0px`}}},computed:{text(){return this.value===void 0||this.value===null?``:String(this.value)},parsed(){return Wz(this.text)||{r:0,g:0,b:0,a:1}},pickerValue(){return this.text||`#000000`},alpha(){return this.parsed.a},displayColor(){return Kz(this.parsed)}},watch:{text(){this._rgb=Wz(this.text)}},beforeUnmount(){this.removeDocListener()},methods:{onTextInput(e){this._rgb=Wz(e),this.$emit(`input`,e)},onAlphaChange(e){let t=Math.max(0,Math.min(1,parseInt(e,10)/100)),n={...this._rgb||this.parsed,a:t};this._rgb=n,this.$emit(`input`,Kz(n)),this.$emit(`change`)},onPicker(e){let t=e&&e.rgba,n,r,i,a;if(Array.isArray(t))[n,r,i,a]=t;else if(t)n=t.r,r=t.g,i=t.b,a=t.a;else{let t=Wz(e.hex)||{r:0,g:0,b:0,a:1};n=t.r,r=t.g,i=t.b,a=t.a}a??=1;let o=e.hex||Gz({r:n,g:r,b:i,a:1});this._rgb={r:n,g:r,b:i,a},this.$emit(`input`,a>=1?o:`rgba(${Math.round(n)}, ${Math.round(r)}, ${Math.round(i)}, ${+a.toFixed(2)})`),this.$emit(`change`)},clear(){this.disabled||(this._rgb=null,this.closePop(),this.$emit(`input`,``),this.$emit(`change`))},togglePop(){this.disabled||(this.popOpen?this.closePop():this.openPop())},openPop(){let e=this.$refs.swatch;if(!e)return;let t=e.getBoundingClientRect(),n=this.$refs.top&&this.$refs.top.getBoundingClientRect()||t,r=Math.max(220,Math.min(Math.round(n.width),400)),i=window.innerWidth,a=window.innerHeight,o=n.left,s=t.bottom+6;o+r>i-8&&(o=Math.max(8,i-r-8)),s+320>a-8&&(s=Math.max(8,t.top-320-6)),this.popW=r,this.popStyle={position:`fixed`,left:o+`px`,top:s+`px`,width:r+`px`,zIndex:4e3},this.popOpen=!0,this.$nextTick(()=>{document.addEventListener(`mousedown`,this.onDocClick,!0)})},closePop(){this.popOpen&&(this.popOpen=!1,this.removeDocListener())},removeDocListener(){document.removeEventListener(`mousedown`,this.onDocClick,!0)},onDocClick(e){let t=this.$refs.pop,n=this.$refs.swatch;t&&t.contains(e.target)||n&&n.contains(e.target)||this.closePop()}}},Jz={class:`st-color`},Yz={class:`st-color__top`,ref:`top`},Xz=[`title`,`disabled`],Zz=[`disabled`,`value`],Qz=[`disabled`],$z={key:0,class:`st-color__alpha-row`},eB=[`disabled`,`value`],tB={class:`st-color__alpha-val`};function nB(e,t,n,r,i,a){let o=L(`Sketch`);return B(),V(`div`,Jz,[K(` 色块预览 + 文本输入 + 重置(顶行) `),U(`div`,Yz,[U(`button`,{ref:`swatch`,class:`st-color__swatch`,type:`button`,title:a.text||`未设置`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.togglePop&&a.togglePop(...e)},[t[7]||=U(`span`,{class:`st-color__checker`},null,-1),U(`span`,{class:`st-color__fill`,style:k({background:a.displayColor||`transparent`})},null,4)],8,Xz),U(`input`,{class:`ni-input st-color__text`,type:`text`,placeholder:`如 #333333 / rgba(0,0,0,.5)`,disabled:e.disabled,value:a.text,onInput:t[1]||=e=>a.onTextInput(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,Zz),U(`button`,{class:`st-color__clear`,type:`button`,title:`重置(清空颜色)`,disabled:e.disabled,onClick:t[3]||=(...e)=>a.clear&&a.clear(...e)},[...t[8]||=[U(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1)]],8,Qz)],512),K(` 透明度滑块(仅当颜色值非空时显示),作为快捷调节 `),a.text?(B(),V(`div`,$z,[t[9]||=U(`span`,{class:`st-color__alpha-label`},`透明度`,-1),U(`input`,{class:`st-color__alpha-slider`,type:`range`,min:`0`,max:`100`,disabled:e.disabled,value:Math.round(a.alpha*100),onInput:t[4]||=e=>a.onAlphaChange(e.target.value),onChange:t[5]||=t=>e.$emit(`change`)},null,40,eB),U(`span`,tB,j(Math.round(a.alpha*100))+`%`,1)])):K(`v-if`,!0),K(` 第三方颜色选择器弹层(挂载到 body,避免被滚动容器裁切) `),(B(),H(ai,{to:`body`},[i.popOpen?(B(),V(`div`,{key:0,ref:`pop`,class:`st-color__pop`,style:k(i.popStyle),onMousedown:t[6]||=q(()=>{},[`stop`])},[W(o,{"model-value":a.pickerValue,"disable-alpha":!1,"onUpdate:modelValue":a.onPicker},null,8,[`model-value`,`onUpdate:modelValue`])],36)):K(`v-if`,!0)]))])}var rB=X(qz,[[`render`,nB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetColor.vue`]]),iB={name:`SetIconSelect`,components:{SvgSymbols:xd},props:l_,emits:u_,data(){return{open:!1}},computed:{list(){return this.options.iIconList||[]}},methods:{pick(e){this.disabled||(this.open=!1,this.$emit(`input`,e.key),this.$emit(`change`))}}},aB={class:`st-iconsel-wrap`},oB={class:`st-iconsel`},sB={class:`st-iconsel__preview`},cB={key:1,style:{"font-size":`11px`,color:`var(--text-faint)`}},lB=[`disabled`,`value`],uB={key:0,class:`st-iconsel__grid`},dB=[`title`,`onClick`],fB={key:0,class:`st-list__empty`};function pB(e,t,n,r,i,a){let o=L(`SvgSymbols`);return B(),V(`div`,aB,[U(`div`,oB,[U(`span`,sB,[e.value?(B(),H(o,{key:0,icon:String(e.value),color:`currentColor`},null,8,[`icon`])):(B(),V(`span`,cB,`无`))]),U(`input`,{class:`ni-input`,type:`text`,placeholder:`图标 key`,disabled:e.disabled,value:e.value||``,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,lB),U(`button`,{class:`st-minibtn`,type:`button`,onClick:t[2]||=e=>i.open=!i.open},j(i.open?`收起`:`选择`),1)]),i.open?(B(),V(`div`,uB,[(B(!0),V(z,null,R(a.list,t=>(B(),V(`span`,{key:t.key,class:A([`st-iconsel__cell`,{"st-iconsel__cell--on":t.key===e.value}]),title:t.name||t.value||t.key,onClick:e=>a.pick(t)},[W(o,{icon:t.key,color:`currentColor`},null,8,[`icon`])],10,dB))),128)),a.list.length?K(`v-if`,!0):(B(),V(`p`,fB,`该组件未提供图标列表`))])):K(`v-if`,!0)])}var mB=X(iB,[[`render`,pB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetIconSelect.vue`]]);Prism.languages.javascript=Prism.languages.extend(`clike`,{"class-name":[Prism.languages.clike[`class-name`],{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$A-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\.(?:constructor|prototype))/,lookbehind:!0}],keyword:[{pattern:/((?:^|\})\s*)catch\b/,lookbehind:!0},{pattern:/(^|[^.]|\.\.\.\s*)\b(?:as|assert(?=\s*\{)|async(?=\s*(?:function\b|\(|[$\w\xA0-\uFFFF]|$))|await|break|case|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally(?=\s*(?:\{|$))|for|from(?=\s*(?:['"]|$))|function|(?:get|set)(?=\s*(?:[#\[$\w\xA0-\uFFFF]|$))|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)\b/,lookbehind:!0}],function:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*(?:\.\s*(?:apply|bind|call)\s*)?\()/,number:{pattern:RegExp(`(^|[^\\w$])(?:NaN|Infinity|0[bB][01]+(?:_[01]+)*n?|0[oO][0-7]+(?:_[0-7]+)*n?|0[xX][\\dA-Fa-f]+(?:_[\\dA-Fa-f]+)*n?|\\d+(?:_\\d+)*n|(?:\\d+(?:_\\d+)*(?:\\.(?:\\d+(?:_\\d+)*)?)?|\\.\\d+(?:_\\d+)*)(?:[Ee][+-]?\\d+(?:_\\d+)*)?)(?![\\w$])`),lookbehind:!0},operator:/--|\+\+|\*\*=?|=>|&&=?|\|\|=?|[!=]==|<<=?|>>>?=?|[-+*/%&|^!=<>]=?|\.{3}|\?\?=?|\?\.?|[~:]/}),Prism.languages.javascript[`class-name`][0].pattern=/(\b(?:class|extends|implements|instanceof|interface|new)\s+)[\w.\\]+/,Prism.languages.insertBefore(`javascript`,`keyword`,{regex:{pattern:RegExp(`((?:^|[^$\\w\\xA0-\\uFFFF."'\\])\\s]|\\b(?:return|yield))\\s*)\\/(?:(?:\\[(?:[^\\]\\\\\\r\\n]|\\\\.)*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}|(?:\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.|\\[(?:[^[\\]\\\\\\r\\n]|\\\\.)*\\])*\\])*\\]|\\\\.|[^/\\\\\\[\\r\\n])+\\/[dgimyus]{0,7}v[dgimyus]{0,7})(?=(?:\\s|\\/\\*(?:[^*]|\\*(?!\\/))*\\*\\/)*(?:$|[\\r\\n,.;:})\\]]|\\/\\/))`),lookbehind:!0,greedy:!0,inside:{"regex-source":{pattern:/^(\/)[\s\S]+(?=\/[a-z]*$)/,lookbehind:!0,alias:`language-regex`,inside:Prism.languages.regex},"regex-delimiter":/^\/|\/$/,"regex-flags":/^[a-z]+$/}},"function-variable":{pattern:/#?(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*[=:]\s*(?:async\s*)?(?:\bfunction\b|(?:\((?:[^()]|\([^()]*\))*\)|(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)\s*=>))/,alias:`function`},parameter:[{pattern:/(function(?:\s+(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*)?\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\))/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(^|[^$\w\xA0-\uFFFF])(?!\s)[_$a-z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*=>)/i,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/(\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*=>)/,lookbehind:!0,inside:Prism.languages.javascript},{pattern:/((?:\b|\s|^)(?!(?:as|async|await|break|case|catch|class|const|continue|debugger|default|delete|do|else|enum|export|extends|finally|for|from|function|get|if|implements|import|in|instanceof|interface|let|new|null|of|package|private|protected|public|return|set|static|super|switch|this|throw|try|typeof|undefined|var|void|while|with|yield)(?![$\w\xA0-\uFFFF]))(?:(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*\s*)\(\s*|\]\s*\(\s*)(?!\s)(?:[^()\s]|\s+(?![\s)])|\([^()]*\))+(?=\s*\)\s*\{)/,lookbehind:!0,inside:Prism.languages.javascript}],constant:/\b[A-Z](?:[A-Z_]|\dx?)*\b/}),Prism.languages.insertBefore(`javascript`,`string`,{hashbang:{pattern:/^#!.*/,greedy:!0,alias:`comment`},"template-string":{pattern:/`(?:\\[\s\S]|\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}|(?!\$\{)[^\\`])*`/,greedy:!0,inside:{"template-punctuation":{pattern:/^`|`$/,alias:`string`},interpolation:{pattern:/((?:^|[^\\])(?:\\{2})*)\$\{(?:[^{}]|\{(?:[^{}]|\{[^}]*\})*\})+\}/,lookbehind:!0,inside:{"interpolation-punctuation":{pattern:/^\$\{|\}$/,alias:`punctuation`},rest:Prism.languages.javascript}},string:/[\s\S]+/}},"string-property":{pattern:/((?:^|[,{])[ \t]*)(["'])(?:\\(?:\r\n|[\s\S])|(?!\2)[^\\\r\n])*\2(?=\s*:)/m,lookbehind:!0,greedy:!0,alias:`property`}}),Prism.languages.insertBefore(`javascript`,`operator`,{"literal-property":{pattern:/((?:^|[,{])[ \t]*)(?!\s)[_$a-zA-Z\xA0-\uFFFF](?:(?!\s)[$\w\xA0-\uFFFF])*(?=\s*:)/m,lookbehind:!0,alias:`property`}}),Prism.languages.markup&&(Prism.languages.markup.tag.addInlined(`script`,`javascript`),Prism.languages.markup.tag.addAttribute(`on(?:abort|blur|change|click|composition(?:end|start|update)|dblclick|error|focus(?:in|out)?|key(?:down|up)|load|mouse(?:down|enter|leave|move|out|over|up)|reset|resize|scroll|select|slotchange|submit|unload|wheel)`,`javascript`)),Prism.languages.js=Prism.languages.javascript,D_.default.languages.javascript&&!D_.default.languages.javascript[`binding-var`]&&D_.default.languages.insertBefore(`javascript`,`keyword`,{"binding-var":/\$[A-Za-z_$][\w$]*/});var hB={name:`SetExpr`,props:{...l_,placeholder:{type:String,default:``}},emits:u_,data(){return{code:``}},computed:{lines(){return this.code?this.code.split(`
346
+ `).length:0},chars(){return this.code.length}},watch:{value(e){this.syncFromValue(e)}},mounted(){this.code=this.readValue(this.value),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readValue(e){return e==null?``:typeof e==`string`?e:String(e)},syncFromValue(e){let t=this.readValue(e);if(t===this.code)return;let n=this.$refs.editor;n&&document.activeElement===n||(this.code=t,this._jar&&this._jar.updateCode(t))},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.javascript,`javascript`)};this._jar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){this.disabled||(this.code=e,this.$emit(`input`,e),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400))}}},gB={key:0,class:`st-expr__ph`},_B={class:`st-expr__foot`},vB={class:`st-expr__hint`};function yB(e,t,n,r,i,a){return B(),V(`div`,{class:A([`st-expr`,{"st-expr--disabled":e.disabled}])},[U(`div`,{ref:`editor`,class:A([`st-expr__editor`,{"is-disabled":e.disabled}])},null,2),n.placeholder&&!i.code?(B(),V(`span`,gB,j(n.placeholder),1)):K(`v-if`,!0),U(`div`,_B,[U(`span`,vB,j(a.lines)+` 行 · `+j(a.chars)+` 字符`,1)])],2)}var bB=X(hB,[[`render`,yB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetExpr.vue`]]),xB={name:`SetIfForm`,components:{SetExpr:bB},props:l_,emits:u_,computed:{obj(){return this.value&&typeof this.value==`object`?this.value:{}},expression(){return this.obj.expression||``},name(){return this.obj.name||``}},methods:{setExpression(e){let t=!this.name||this.name===this.expression;this.$emit(`input`,{name:t?e:this.name,expression:e})},setName(e){this.$emit(`input`,{name:e,expression:this.expression})}}},SB={class:`st-ifform`},CB=[`disabled`,`value`];function wB(e,t,n,r,i,a){let o=L(`SetExpr`);return B(),V(`div`,SB,[W(o,{value:a.expression,disabled:e.disabled,placeholder:`表达式,如 $singleMode 或 $data.count > 0`,onInput:a.setExpression,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),U(`input`,{class:`ni-input`,type:`text`,placeholder:`显示名(留空跟随表达式)`,disabled:e.disabled,value:a.name,onInput:t[1]||=e=>a.setName(e.target.value),onChange:t[2]||=t=>e.$emit(`change`)},null,40,CB)])}var TB=X(xB,[[`render`,wB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetIfForm.vue`]]),EB=[{key:`number`,value:`px`},{key:`percent`,value:`%`},{key:`auto`,value:`@`}],DB={name:`SetNumberStyle`,components:{SetNumber:fR},props:l_,emits:u_,data(){return{unit:`number`,numValue:``,menuOpen:!1}},computed:{unitList(){return this.options.iTypeList||EB},unitLabel(){let e=this.unitList.filter(e=>e.key===this.unit)[0];return e?e.value:`px`},isAuto(){return this.unit===`auto`},numberOptions(){return{...this.options,type:this.unit===`percent`?`integer`:`float`,placeholder:this.options.placeholder||``,symbol:!0}}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=this.value;/%$/.test(String(e))?(this.unit=`percent`,this.numValue=String(e).replace(/%/g,``)):e===`auto`?(this.unit=`auto`,this.numValue=`auto`):(this.unit=`number`,this.numValue=e===0?`0`:e==null?``:String(e))},onNum(e){this.numValue=e,this.emit()},pickUnit(e){this.menuOpen=!1,this.unit=e,this.numValue=e===`percent`?`100`:e===`auto`?`auto`:``,this.emit(),this.$emit(`change`)},emit(){this.unit===`percent`&&this.numValue?this.$emit(`input`,this.numValue+`%`):this.$emit(`input`,this.numValue)}}},OB={class:`st-numberstyle`},kB={key:1,class:`st-pop st-pop--unit`},AB=[`onMousedown`];function jB(e,t,n,r,i,a){let o=L(`SetNumber`);return B(),V(`div`,OB,[W(o,{value:i.numValue,options:a.numberOptions,disabled:e.disabled||a.isAuto,onInput:a.onNum,onChange:t[1]||=t=>e.$emit(`change`)},{symbol:F(()=>[U(`span`,{class:`st-unit`,onMousedown:t[0]||=q(e=>i.menuOpen=!i.menuOpen,[`prevent`])},j(a.unitLabel),33)]),_:1},8,[`value`,`options`,`disabled`,`onInput`]),K(` 单位切换浮层:移到 .st-number 之外,避免被 overflow:hidden 裁切 `),i.menuOpen?(B(),V(`div`,{key:0,class:`st-pop-mask`,onMousedown:t[2]||=q(e=>i.menuOpen=!1,[`prevent`])},null,32)):K(`v-if`,!0),i.menuOpen?(B(),V(`div`,kB,[(B(!0),V(z,null,R(a.unitList,e=>(B(),V(`div`,{key:e.key,class:A([`st-pop__item`,{"st-pop__item--on":e.key===i.unit}]),onMousedown:q(t=>a.pickUnit(e.key),[`prevent`])},j(e.value),43,AB))),128))])):K(`v-if`,!0)])}var MB=X(DB,[[`render`,jB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetNumberStyle.vue`]]),NB={name:`SetPadding`,components:{SetNumber:fR},props:l_,emits:u_,data(){return{form:{top:``,right:``,bottom:``,left:``}}},computed:{brackets(){return this.options.brackets||[`{`,`}`]},seperator(){return this.options.seperator||`,`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``);this.brackets.length&&(e=e.replace(RegExp(`[${this.brackets.join(``)}]`,`g`),``));let t=e.split(this.seperator);this.form=this.options.normal?{top:t[0]||``,right:t[1]||``,bottom:t[2]||``,left:t[3]||``}:{top:t[0]||``,left:t[1]||``,bottom:t[2]||``,right:t[3]||``}},opt(e){return{type:`integer`,symbol:e,placeholder:`0`}},set(e,t){this.form[e]=t,this.emitValue()},emitValue(){let e=this.form,t=(this.options.normal?[e.top,e.right,e.bottom,e.left]:[e.top,e.left,e.bottom,e.right]).map(e=>e===``||e===void 0?`0`:e).join(this.seperator),[n,r]=this.brackets.length?this.brackets:[``,``];this.$emit(`input`,`${n||``}${t}${r||``}`)},emitOut(){this.$emit(`change`)}}},PB={class:`st-pad`};function FB(e,t,n,r,i,a){let o=L(`SetNumber`);return B(),V(`div`,PB,[W(o,{value:i.form.top,options:a.opt(`上`),disabled:e.disabled,onInput:t[0]||=e=>a.set(`top`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),W(o,{value:i.form.right,options:a.opt(`右`),disabled:e.disabled,onInput:t[1]||=e=>a.set(`right`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),W(o,{value:i.form.bottom,options:a.opt(`下`),disabled:e.disabled,onInput:t[2]||=e=>a.set(`bottom`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`]),W(o,{value:i.form.left,options:a.opt(`左`),disabled:e.disabled,onInput:t[3]||=e=>a.set(`left`,e),onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onChange`])])}var IB=X(NB,[[`render`,FB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetPadding.vue`]]),LB=[{key:`TopLeft`,value:`上左`},{key:`TopCenter`,value:`上中`},{key:`TopRight`,value:`上右`},{key:`CenterLeft`,value:`中左`},{key:`Center`,value:`中间`},{key:`CenterRight`,value:`中右`},{key:`BottomLeft`,value:`下左`},{key:`BottomCenter`,value:`下中`},{key:`BottomRight`,value:`下右`}],RB=[{key:`0% 0%`,value:`左上对齐`},{key:`50% 0%`,value:`中上对齐`},{key:`100% 0%`,value:`右上对齐`},{key:`0% 50%`,value:`左中对齐`},{key:`50% 50%`,value:`居中对齐`},{key:`100% 50%`,value:`右中对齐`},{key:`0% 100%`,value:`左下对齐`},{key:`50% 100%`,value:`中下对齐`},{key:`100% 100%`,value:`右下对齐`}],zB={name:`SetGrid9`,props:{...l_,kind:{type:String,default:`PositionStyle`}},emits:u_,computed:{cells(){return this.kind===`BackgroundPositionStyle`?RB:LB}},methods:{pick(e){this.disabled||(this.$emit(`input`,e.key),this.$emit(`change`))}}},BB={class:`st-grid9`},VB=[`title`,`onClick`];function HB(e,t,n,r,i,a){return B(),V(`div`,BB,[(B(!0),V(z,null,R(a.cells,n=>(B(),V(`div`,{key:n.key,class:A([`st-grid9__cell`,{"st-grid9__cell--on":String(n.key)===String(e.value)}]),title:n.value,onClick:e=>a.pick(n)},[...t[0]||=[U(`span`,{class:`st-grid9__dot`},null,-1)]],10,VB))),128))])}var UB=X(zB,[[`render`,HB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetGrid9.vue`]]),WB=[{key:`number`,value:`px`},{key:`percent`,value:`%`}],GB={name:`SetBgPosition`,components:{SetGrid9:UB,SetNumberStyle:MB},props:l_,emits:u_,data(){return{x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).split(/\s+/);this.x=e[0]||``,this.y=e[1]||``},numOptions(e){return{placeholder:e,iTypeList:WB}},pickGrid(e){this.$emit(`input`,e)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){this.$emit(`input`,`${this.x||`0`} ${this.y||`0`}`)},emitOut(){this.$emit(`change`)}}},KB={class:`st-bgpos`},qB={class:`st-bgpos__xy`};function JB(e,t,n,r,i,a){let o=L(`SetGrid9`),s=L(`SetNumberStyle`);return B(),V(`div`,KB,[W(o,{kind:`BackgroundPositionStyle`,value:e.value,disabled:e.disabled,onInput:a.pickGrid,onChange:t[0]||=t=>e.$emit(`change`)},null,8,[`value`,`disabled`,`onInput`]),U(`div`,qB,[W(s,{value:i.x,options:a.numOptions(`X`),disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`]),W(s,{value:i.y,options:a.numOptions(`Y`),disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`options`,`disabled`,`onInput`,`onChange`])])])}var YB=X(GB,[[`render`,JB],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetBgPosition.vue`]]),XB=[{key:`cover`,desc:`cover:保持纵横比,缩放到完全覆盖背景定位区域的最小尺寸`},{key:`contain`,desc:`contain:保持纵横比,缩放到能放进背景定位区域的最大尺寸`}],ZB={name:`SetBgSize`,components:{SetNumberStyle:MB,Dropdown:e_},computed:{bgOptions(){return[{key:``,value:`自定义`}].concat(this.TYPES.map(e=>({key:e.key,value:e.key})))}},props:l_,emits:u_,data(){return{TYPES:XB,preset:``,x:``,y:``}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``),t=XB.map(e=>e.key);this.preset=t.includes(e)?e:``;let n=e.split(/\s+/);n.length>=2?(this.x=n[0]||``,this.y=n[1]||``):(this.x=``,this.y=``)},pickPreset(e){this.preset=e,e||(this.x=`auto`,this.y=`auto`),this.emitValue(),this.$emit(`change`)},setX(e){this.x=e,this.emitValue()},setY(e){this.y=e,this.emitValue()},emitValue(){let e=this.preset?this.preset:`${this.x||`auto`} ${this.y||`auto`}`;this.$emit(`input`,e)},emitOut(){this.$emit(`change`)}}},QB={class:`st-bgsize`},$B={key:0,class:`st-bgsize__xy`};function eV(e,t,n,r,i,a){let o=L(`Dropdown`),s=L(`SetNumberStyle`);return B(),V(`div`,QB,[W(o,{value:i.preset,options:a.bgOptions,size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.pickPreset(e)},null,8,[`value`,`options`,`disabled`]),i.preset?K(`v-if`,!0):(B(),V(`div`,$B,[W(s,{value:i.x,options:{placeholder:`宽`},disabled:e.disabled,onInput:a.setX,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),W(s,{value:i.y,options:{placeholder:`高`},disabled:e.disabled,onInput:a.setY,onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`])]))])}var tV=X(ZB,[[`render`,eV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetBgSize.vue`]]),nV=[{key:`to bottom`,desc:`从上到下`},{key:`to top`,desc:`从下到上`},{key:`to left`,desc:`从右到左`},{key:`to right`,desc:`从左到右`},{key:`to bottom right`,desc:`从左上到右下`},{key:`to bottom left`,desc:`从右上到左下`},{key:`to top left`,desc:`从右下到左上`},{key:`to top right`,desc:`从左下到右上`}];function rV(e){let t=[],n=0,r=0;for(let i=0;i<e.length;i++){let a=e[i];a===`(`?n++:a===`)`?n--:a===`,`&&n===0&&(t.push(e.slice(r,i).trim()),r=i+1)}return t.push(e.slice(r).trim()),t.filter(e=>e!==``)}var iV={name:`SetGradient`,components:{SetColor:rB,Dropdown:e_},props:l_,emits:u_,data(){return{DIRECTIONS:nV,direction:`to bottom`,stops:[]}},computed:{preview(){if(!this.stops.length)return`transparent`;let e=this.stops.map(e=>e.color).filter(Boolean);return e.length<2?e[0]||`transparent`:`linear-gradient(${this.direction}, ${e.join(`, `)})`}},watch:{value:{immediate:!0,handler(){this.parse()}}},methods:{parse(){let e=String(this.value||``).trim().match(/linear-gradient\((.+)\)$/);if(!e){this.direction=this.options.defaultDirection||nV[0].key,this.stops=[];return}let t=rV(e[1]);this.direction=(t[0]||``).toLowerCase()||nV[0].key,this.stops=t.slice(1).map(e=>({color:e}))},setDirection(e){this.direction=e,this.emitValue(),this.$emit(`change`)},setStop(e,t){this.stops[e].color=t,this.emitValue()},addStop(){this.disabled||(this.stops.push({color:`#ffffff`}),this.emitValue(),this.$emit(`change`))},removeStop(e){this.disabled||(this.stops.splice(e,1),this.emitValue(),this.$emit(`change`))},emitValue(){let e=this.stops.map(e=>e.color).filter(e=>e!==``&&e!==void 0);this.$emit(`input`,e.length?`linear-gradient(${this.direction}, ${e.join(`, `)})`:``)},emitOut(){this.$emit(`change`)}}},aV={class:`st-gradient`},oV=[`onClick`],sV=[`disabled`];function cV(e,t,n,r,i,a){let o=L(`Dropdown`),s=L(`SetColor`);return B(),V(`div`,aV,[U(`div`,{class:`st-gradient__preview`,style:k({background:a.preview})},null,4),W(o,{value:i.direction,options:i.DIRECTIONS.map(e=>({key:e.key,value:e.desc})),size:`sm`,block:``,disabled:e.disabled,onInput:t[0]||=e=>a.setDirection(e)},null,8,[`value`,`options`,`disabled`]),(B(!0),V(z,null,R(i.stops,(t,n)=>(B(),V(`div`,{key:`stop`+n,class:`st-gradient__stop`},[W(s,{value:t.color,disabled:e.disabled,onInput:e=>a.setStop(n,e),onChange:a.emitOut},null,8,[`value`,`disabled`,`onInput`,`onChange`]),U(`button`,{class:`st-gradient__del`,type:`button`,title:`删除该渐变色`,onClick:e=>a.removeStop(n)},`✕`,8,oV)]))),128)),U(`button`,{class:`st-minibtn`,type:`button`,disabled:e.disabled,onClick:t[1]||=(...e)=>a.addStop&&a.addStop(...e)},`+ 新增渐变色`,8,sV)])}var lV=X(iV,[[`render`,cV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetGradient.vue`]]),uV=new Set([`width`,`height`,`lineHeight`,`marginRight`,`cursor`,`textAlign`]),dV={name:`SetCustomSelect`,props:l_,emits:[...u_,`sync`],computed:{list(){return this.options.list||[]}},methods:{normalizeStyle(e){if(!e||typeof e!=`object`)return{};let t={};for(let n in e)uV.has(n)||(t[n]=e[n]);return t},apply(e){if(this.disabled)return;let t=e.sync||{};Object.keys(t).length&&this.$emit(`sync`,t)}}},fV={class:`st-customsel`},pV=[`title`,`onClick`],mV={key:0},hV={key:0,class:`st-list__empty`};function gV(e,t,n,r,i,a){return B(),V(`div`,fV,[(B(!0),V(z,null,R(a.list,(e,t)=>(B(),V(`div`,{key:t,class:`st-customsel__item`,style:k(a.normalizeStyle(e.style)),title:`应用:`+Object.keys(e.sync||{}).join(`、`),onClick:t=>a.apply(e)},[(B(!0),V(z,null,R(e.list||[],(e,t)=>(B(),V(`span`,{key:t,style:k(a.normalizeStyle(e.style))},j(e.innerText),5))),128)),(e.list||[]).length?K(`v-if`,!0):(B(),V(`span`,mV,j(e.innerText||`样式`+(t+1)),1))],12,pV))),128)),a.list.length?K(`v-if`,!0):(B(),V(`p`,hV,`未配置常用样式`))])}var _V=X(dV,[[`render`,gV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetCustomSelect.vue`]]),vV={name:`SetList`,props:l_,emits:u_,computed:{list(){let e=this.itemInfo;return e&&e.itemList||[]},addText(){return this.options&&this.options.btnText||`添加项`}},methods:{displayName(e){let t=e.itemName||e.itemKey||``;return{fontStyle:`字体风格`,textDecoration:`文字装饰`}[e.itemKey]||t},add(){if(this.disabled)return;let e=this.itemInfo,t=this.list[0],n;n=t?new du(t.properties.map(e=>({itemId:e.itemId,itemKey:e.itemKey,itemName:e.itemName,itemType:e.itemType,itemOption:e.itemOption,itemParam:e.itemParam,itemDefaultValue:e.itemDefaultValue,itemDesc:e.itemDesc,itemTypeRange:e.itemTypeRange,itemValueFrom:`0`,itemValue:``})),{}):new du((this.options&&this.options.iFieldList||[]).map(e=>({itemId:e.key,itemKey:e.key,itemName:e.value||e.key,itemType:`Input`,itemValueFrom:`0`,itemValue:``})),{}),e.itemList.push(n),this.$emit(`change`)},remove(e){this.disabled||(this.itemInfo.removeAt(e),this.$emit(`change`))},move(e,t){this.disabled||(this.itemInfo.moveItem(e,e+t),this.$emit(`change`))}}},yV={class:`st-list`},bV={class:`st-list__head`},xV={class:`st-list__idx`},SV=[`disabled`,`onClick`],CV=[`disabled`,`onClick`],wV=[`disabled`,`onClick`],TV={class:`st-list__body`},EV=[`title`],DV={class:`st-list__control`},OV={key:0,class:`st-list__empty`},kV={key:0,class:`st-list__empty`},AV=[`disabled`];function jV(e,t,n,r,i,a){let o=L(`prop-control`);return B(),V(`div`,yV,[(B(!0),V(z,null,R(a.list,(n,r)=>(B(),V(`div`,{key:n.id,class:`st-list__item`},[U(`div`,bV,[U(`span`,xV,`#`+j(r+1),1),t[4]||=U(`span`,{class:`st-list__head-spacer`},null,-1),U(`button`,{class:`st-list__op`,type:`button`,title:`上移`,disabled:e.disabled||r===0,onClick:e=>a.move(r,-1)},`↑`,8,SV),U(`button`,{class:`st-list__op`,type:`button`,title:`下移`,disabled:e.disabled||r===a.list.length-1,onClick:e=>a.move(r,1)},`↓`,8,CV),U(`button`,{class:`st-list__op st-list__op--del`,type:`button`,title:`删除`,disabled:e.disabled,onClick:e=>a.remove(r)},[...t[3]||=[U(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[U(`use`,{href:`#icon-delete`})],-1)]],8,wV)]),U(`div`,TV,[(B(!0),V(z,null,R(n.properties,n=>I((B(),V(`div`,{key:n.itemId,class:`st-list__row`},[U(`label`,{class:`st-list__label`,title:n.itemDesc||a.displayName(n)},j(a.displayName(n)),9,EV),U(`div`,DV,[W(o,{property:n,disabled:e.disabled,onChange:t[0]||=t=>e.$emit(`change`),onSync:t[1]||=t=>e.$emit(`sync`,t)},null,8,[`property`,`disabled`])])])),[[Sc,n.itemVisible]])),128)),n.properties.length?K(`v-if`,!0):(B(),V(`p`,OV,`该项无字段`))])]))),128)),a.list.length?K(`v-if`,!0):(B(),V(`p`,kV,`暂无项`)),U(`button`,{class:`st-minibtn st-list__add`,type:`button`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.add&&a.add(...e)},j(a.addText),9,AV)])}var MV=X(vV,[[`render`,jV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetList.vue`]]),NV={name:`SetImage`,props:l_,emits:u_,methods:{clear(){this.disabled||(this.$emit(`input`,``),this.$emit(`change`))}}},PV={class:`st-image`},FV={class:`st-image__row`},IV=[`disabled`,`value`],LV=[`disabled`];function RV(e,t,n,r,i,a){return B(),V(`div`,PV,[U(`div`,FV,[U(`input`,{class:`ni-input`,type:`text`,disabled:e.disabled,value:e.value||``,placeholder:`图片路径,如 @filestore/...png 或 https://...`,onInput:t[0]||=t=>e.$emit(`input`,t.target.value),onChange:t[1]||=t=>e.$emit(`change`)},null,40,IV),e.value?(B(),V(`button`,{key:0,class:`st-image__clear`,type:`button`,title:`清空`,disabled:e.disabled,onClick:t[2]||=(...e)=>a.clear&&a.clear(...e)},[...t[3]||=[U(`svg`,{viewBox:`0 0 16 16`,class:`st-ic`,"aria-hidden":`true`},[U(`use`,{href:`#icon-reset`})],-1)]],8,LV)):K(`v-if`,!0)])])}var zV=X(NV,[[`render`,RV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetImage.vue`]]),BV={name:`SetCode`,props:l_,emits:u_,data(){return{code:``,bridge:null}},computed:{codeKey(){return this.options.codeKey||`code`},lines(){return this.code?this.code.split(`
347
+ `).length:0},chars(){return this.code.length}},mounted(){this.code=this.readCode(),this.$nextTick(()=>this.initJar())},beforeUnmount(){this._t&&clearTimeout(this._t),this.teardownBridge(!0),this._jar&&this._jar.destroy&&this._jar.destroy()},methods:{readCode(){let e=this.value;return e==null?``:typeof e==`string`?e:String(typeof e==`object`?e[this.codeKey]||``:e)},initJar(){let e=this.$refs.editor;if(!e)return;let t=e=>{e.innerHTML=D_.default.highlight(e.textContent,D_.default.languages.javascript,`javascript`)};this._jar=E_(e,t,{tab:` `,indentOn:/[({[]$/,addClosing:!0,history:!0}),this._jar.updateCode(this.code),this._jar.onUpdate(e=>this.onCode(e))},onCode(e){if(this.disabled||this.bridge)return;this.code=e;let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},toggleBridge(){this.bridge?this.teardownBridge(!0):this.setupBridge()},async setupBridge(){if(this.disabled||this.bridge)return;let e=this.itemInfo&&this.itemInfo.itemKey?String(this.itemInfo.itemKey):``;try{let t=await Gl(this.code,e);this.bridge={id:t.id,file:t.file}}catch(e){console.error(`[VSCode 桥接建立失败]`,e);return}this.setEditorEditable(!1),this._hb=setInterval(()=>{this.bridge&&ql(this.bridge.id).catch(()=>{})},5e3),this._bridgeUnsub=Hl(e=>{if(!(!this.bridge||!e||e.id!==this.bridge.id)){if(e.reason)return this.teardownBridge(!1);this.pullBridgeCode()}})},async pullBridgeCode(){if(!this.bridge)return;let e;try{e=await Kl(this.bridge.id)}catch{return}let t=String(e.code==null?``:e.code);t!==this.code&&this.applyExternalCode(t)},applyExternalCode(e){this.code=e,this._jar&&this._jar.updateCode(e,!1);let t=this.value&&typeof this.value==`object`?Object.assign({},this.value):{};t[this.codeKey]=e,this.$emit(`input`,t),this._t&&clearTimeout(this._t),this._t=setTimeout(()=>this.$emit(`change`),400)},teardownBridge(e){let t=this.bridge;this.bridge=null,this._hb&&=(clearInterval(this._hb),null),this._bridgeUnsub&&=(this._bridgeUnsub(),null),this.setEditorEditable(!0),t&&e&&Jl(t.id).catch(()=>{})},setEditorEditable(e){let t=this.$refs.editor;t&&t.setAttribute(`contenteditable`,e?`true`:`false`)}}},VV={class:`st-code`},HV={class:`st-code__foot`},UV={class:`st-code__hint`},WV={class:`st-code__foot-actions`},GV=[`title`],KV=[`title`,`disabled`],qV={key:0,class:`st-code__vscode-label`};function JV(e,t,n,r,i,a){return B(),V(`div`,VV,[U(`div`,{ref:`editor`,class:A([`st-code__editor`,{"is-disabled":e.disabled,"is-bridged":!!i.bridge}])},null,2),K(` 右上角语言标签:弱化的只读标识,不参与交互 `),t[2]||=U(`span`,{class:`st-code__lang`,"aria-hidden":`true`},`JS`,-1),U(`div`,HV,[U(`span`,UV,j(a.lines)+` 行 · `+j(a.chars)+` 字符`,1),K(` VSCode 代码桥:生成临时 js 用外部编辑器编辑,保存实时回写;断开即删临时文件 `),U(`span`,WV,[i.bridge?(B(),V(`span`,{key:0,class:`st-code__bridge-tag`,title:i.bridge.file},`VSCode 同步中`,8,GV)):K(`v-if`,!0),U(`button`,{type:`button`,class:A([`st-code__vscode`,{"is-on":!!i.bridge}]),title:i.bridge?`断开 VSCode 桥接并删除临时文件`:`在 VSCode 中编辑:保存实时同步回编辑区,断开后清除临时文件`,disabled:e.disabled,onClick:t[0]||=(...e)=>a.toggleBridge&&a.toggleBridge(...e)},[K(` 图标左侧小字:未桥接时是动作说明;桥接后由状态徽标接替,避免两段文字挤一行 `),i.bridge?K(`v-if`,!0):(B(),V(`span`,qV,`在编辑器中打开`)),t[1]||=U(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,"aria-hidden":`true`},[U(`path`,{fill:`currentColor`,d:`M23.15 2.587 18.21.21a1.494 1.494 0 0 0-1.705.29l-9.46 8.63-4.12-3.128a.999.999 0 0 0-1.276.057L.327 7.261A1 1 0 0 0 .326 8.74L3.899 12 .326 15.26a1 1 0 0 0 .001 1.479L1.65 17.94a.999.999 0 0 0 1.276.057l4.12-3.128 9.46 8.63a1.492 1.492 0 0 0 1.704.29l4.942-2.377A1.5 1.5 0 0 0 24 20.06V3.939a1.5 1.5 0 0 0-.85-1.352zm-5.146 14.861L10.826 12l7.178-5.448v10.896z`})],-1)],10,KV)])])])}var YV=X(BV,[[`render`,JV],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/setters/SetCode.vue`]]),XV={0:`常量`,1:`变量`,2:`图片`},ZV={const:`0`,var:`1`,image:`2`};function QV(e){switch(e){case`InputNumber`:return{comp:fR};case`Color`:return{comp:rB};case`Select`:return{comp:hR};case`TabSelect`:return{comp:w_,kind:`TabSelect`};case`Input`:return{comp:tR};case`Textarea`:return{comp:tR,multiline:!0};case`Switcher`:return{comp:yR};case`BooleanForm`:return{comp:yR,boolean:!0};case`PaddingStyle`:return{comp:IB};case`NumberStyle`:return{comp:MB};case`PositionStyle`:return{comp:UB,kind:`PositionStyle`};case`BackgroundPositionStyle`:return{comp:YB};case`BackgroundSizeStyle`:return{comp:tV};case`GradientStyle`:return{comp:lV};case`FontStyle`:return{comp:w_,kind:`FontStyle`};case`TextDecorationStyle`:return{comp:w_,kind:`TextDecorationStyle`};case`JustifyContentStyle`:return{comp:w_,kind:`JustifyContentStyle`};case`AlignItemsStyle`:return{comp:w_,kind:`AlignItemsStyle`};case`IconSelect`:return{comp:mB};case`CustomSelect`:return{comp:_V};case`List`:return{comp:MV};case`IfForm`:return{comp:TB};case`Code`:return{comp:YV};default:return{comp:tR}}}var $V={name:`PropControl`,components:{SetText:tR,SetNumber:fR,SetSelect:hR,SetSegment:w_,SetSwitch:yR,SetColor:rB,SetIconSelect:mB,SetIfForm:TB,SetNumberStyle:MB,SetPadding:IB,SetGrid9:UB,SetBgPosition:YB,SetBgSize:tV,SetGradient:lV,SetCustomSelect:_V,SetList:MV,SetImage:zV,SetCode:YV,SetExpr:bB},props:{property:{type:Object,required:!0},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0}},emits:[`change`,`sync`],computed:{itemType(){return this.property&&this.property.itemType||``},sources(){let e=this.property&&this.property.itemTypeRange||`const`,t=String(e).split(`,`).map(e=>e.trim()).filter(Boolean).map(e=>({key:ZV[e],label:XV[ZV[e]]})).filter(e=>e.key),n=String(this.property.itemValueFrom);return/^[012]$/.test(n)&&!t.some(e=>e.key===n)&&(t=t.concat([{key:n,label:XV[n]||`来源`+n}])),t},setterComp(){return QV(this.itemType)}},methods:{onInput(e){this.property.itemValue=e,this.$emit(`change`)},onChange(){this.$emit(`change`)},onSync(e){this.$emit(`sync`,e)},setSource(e){if(this.disabled)return;let t=this.property,n=String(e);t.itemValueFrom!==n&&(t._valuesByFrom||={0:void 0,1:void 0,2:void 0},t._valuesByFrom[t.itemValueFrom]=t.itemValue,t.itemValueFrom=n,t._valuesByFrom[n]===void 0?n===`0`?(t.itemValue=t.itemDefaultValue??this.defaultFor(),t._valuesByFrom[n]=t.itemValue):(t.itemValue=``,t._valuesByFrom[n]=``):t.itemValue=t._valuesByFrom[n],this.$emit(`change`))},defaultFor(){switch(this.itemType){case`Color`:return`#000000`;case`InputNumber`:return 0;case`Switcher`:return`0`;case`BooleanForm`:return!1;case`TabSelect`:case`Select`:{let e=this.property.itemOption||{},t=e.iParamList||e.iTypeList||[];return t.length?t[0].key:``}default:return``}}}},eH={key:0,class:`pc-srcs`},tH=[`disabled`,`onClick`],nH={class:`pc-body`};function rH(e,t,n,r,i,a){let o=L(`SetImage`),s=L(`SetExpr`);return B(),V(`div`,{class:A([`pc`,{"pc--readonly":n.disabled}])},[K(` 值来源切换(仅当 meta 声明了多于一种来源 且 允许切换时显示) `),a.sources.length>1&&n.bExchange?(B(),V(`div`,eH,[(B(!0),V(z,null,R(a.sources,e=>(B(),V(`button`,{key:e.key,type:`button`,class:A([`pc-src`,{"is-active":n.property.itemValueFrom===e.key}]),disabled:n.disabled,onClick:t=>a.setSource(e.key)},j(e.label),11,tH))),128))])):K(`v-if`,!0),U(`div`,nH,[K(` 图片素材来源 `),n.property.itemValueFrom===`2`?(B(),H(o,{key:0,value:n.property.itemValue,options:n.property.itemOption,"item-info":n.property,disabled:n.disabled,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`options`,`item-info`,`disabled`,`onInput`,`onChange`])):n.property.itemValueFrom===`1`?(B(),V(z,{key:1},[K(` 变量 / 表达式来源:带语法高亮、可拖拽调高度 `),W(s,{value:n.property.itemValue,disabled:n.disabled,"item-info":n.property,onInput:a.onInput,onChange:a.onChange},null,8,[`value`,`disabled`,`item-info`,`onInput`,`onChange`])],2112)):(B(),V(z,{key:2},[K(` 常量来源:按 itemType 分派 `),(B(),H(Yi(a.setterComp.comp),{value:n.property.itemValue,options:n.property.itemOption,watches:n.watches,"item-info":n.property,disabled:n.disabled,kind:a.setterComp.kind,multiline:a.setterComp.multiline,boolean:a.setterComp.boolean,onInput:a.onInput,onChange:a.onChange,onSync:a.onSync},null,40,[`value`,`options`,`watches`,`item-info`,`disabled`,`kind`,`multiline`,`boolean`,`onInput`,`onChange`,`onSync`]))],2112))])],2)}var iH=X($V,[[`render`,rH],[`__scopeId`,`data-v-910daa70`],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/PropControl.vue`]]),aH={name:`PropTree`,props:{properties:{type:Array,default:()=>[]},mode:{type:String,default:`property`},depth:{type:Number,default:1},chain:{type:Array,default:()=>[]},watches:{type:Object,default:()=>({})},disabled:{type:Boolean,default:!1},bExchange:{type:Boolean,default:!0},plain:{type:Boolean,default:!1}},emits:[`leaf-change`,`leaf-sync`],data(){return{openMap:{}}},methods:{isGroup(e){if(!e)return!1;if(e.itemType===`group`)return!0;let t=e.itemChildren&&e.itemChildren.properties;return!!(t&&t.length)},childCount(e){let t=e.itemChildren&&e.itemChildren.properties;return t?t.length:0},isBlock(e){return e&&e.itemType===`Code`},groupVisible(e){if(e.itemVisible===!1)return!1;let t=e.itemChildren&&e.itemChildren.properties;return!t||!t.length||t.some(e=>e.itemVisible===!1?!1:!this.isGroup(e)||this.groupVisible(e))},isOpen(e){return this.openMap[e.itemId]!==!1},toggle(e){this.openMap[e.itemId]=this.openMap[e.itemId]===!1,this.openMap=Object.assign({},this.openMap)},onLeaf(e){this.$emit(`leaf-change`,this.chain.concat(e))},onSync(e){this.$emit(`leaf-sync`,e)}}},oH={key:0,class:`ptree__group`},sH=[`onClick`],cH={class:`ptree__group-name`},lH={class:`ptree__group-body`},uH=[`title`],dH={class:`ptree__control`};function fH(e,t,n,r,i,a){let o=L(`prop-tree`,!0),s=L(`prop-control`);return B(),V(`div`,{class:A([`ptree`,{"ptree--plain":n.plain}])},[(B(!0),V(z,null,R(n.properties,r=>(B(),V(z,{key:r.itemId},[K(` 分组(自身可见 且 存在可见后代才渲染,避免空分组) `),a.isGroup(r)&&a.groupVisible(r)?(B(),V(`div`,oH,[U(`div`,{class:`ptree__group-head`,type:`button`,onClick:e=>a.toggle(r)},[U(`span`,{class:A([`ptree__caret`,{"is-open":a.isOpen(r)}])},`▸`,2),U(`span`,cH,j(r.itemName||r.itemKey),1)],8,sH),I(U(`div`,lH,[r.itemChildren&&r.itemChildren.properties.length?(B(),H(o,{key:0,properties:r.itemChildren.properties,mode:n.mode,depth:n.depth+1,chain:n.chain.concat(r),watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,plain:n.plain,onLeafChange:t[0]||=t=>e.$emit(`leaf-change`,t),onLeafSync:t[1]||=t=>e.$emit(`leaf-sync`,t)},null,8,[`properties`,`mode`,`depth`,`chain`,`watches`,`disabled`,`b-exchange`,`plain`])):K(`v-if`,!0)],512),[[Sc,a.isOpen(r)]])])):r.itemVisible===!1?K(`v-if`,!0):(B(),V(z,{key:1},[K(` 叶子(itemCondition 判定为不可见时不渲染,与线上编辑器一致) `),U(`div`,{class:A([`ptree__row`,{"ptree__row--disabled":n.disabled,"ptree__row--block":a.isBlock(r)}])},[U(`label`,{class:`ptree__label`,title:r.itemDesc||r.itemName||r.itemKey},j(r.itemName||r.itemKey||r.itemType||`字段`),9,uH),U(`div`,dH,[W(s,{property:r,watches:n.watches,disabled:n.disabled,"b-exchange":n.bExchange,onChange:e=>a.onLeaf(r),onSync:a.onSync},null,8,[`property`,`watches`,`disabled`,`b-exchange`,`onChange`,`onSync`])])],2)],2112))],64))),128))],2)}var pH=X(aH,[[`render`,fH],[`__file`,`/Users/owlaford/Workspace/dsl-card/card-editor/components/PropTree.vue`]]),mH=Sl(XL);mH.component(`prop-control`,iH),mH.component(`prop-tree`,pH),mH.component(`Dropdown`,e_),mH.config.errorHandler=(e,t,n)=>{console.error(`[render error]`,n,e),window.__cardDebug&&window.__cardDebug.pushError(`render`,`${n}: ${e.message}`)},mH.mount(`#app`);