`}function e4(t,e){e||(e=w1());const n=`
`;function i(){let r=document.createElement("div");return r.firstElementChild.outerHTML=n,r.firstElementChild}return{id:e,html:n,getDiv:i}}function fy(t,e=""){return t||(t=W1()),`
`}function dy(t,e,n){return t||(t=W1()),`
`}function t3(t,e,n){return t||(t=W1()),`
`}function Or(t="",...e){const n=document.createElement("div");n.setAttribute(u1,W1()),n.setAttribute(I1,ne.NODE_PARAGRAPH),n.classList.add("p");const i=n.appendChild(document.createElement("div"));return i.setAttribute(Mr,"true"),i.setAttribute("spellcheck","false"),e||(e=[]),e.splice(0,0,document.createTextNode(t)),My(e,()=>document.createTextNode(" ")).forEach(r=>i.append(r)),n.appendChild(n3()),n}function ES(){const t=document.createElement("div");return t.classList.add("protyle-action"),t.setAttribute("draggable","true"),t.appendChild(document.createElement("svg")).appendChild(document.createElement("use")).setAttribute("xlink:href","#iconDot"),t}function n3(){const t=document.createElement("div");return t.classList.add("protyle-attr"),t.setAttribute(Mr,"false"),t.textContent=P6,t}class i3{constructor(){z0(this,"_container",document.createElement("div"));z0(this,"_id",W1());this.container.setAttribute(u1,this.id)}append(...e){return e.forEach(n=>this.container.appendChild(n)),this}build(){return this.container.appendChild(n3()),this.container}cloneDiv(){return ai(this.container)}setAttrs(e){return Object.entries(e).forEach(([n,i])=>this.setAttr(n,i)),this}setAttr(e,n){return this.container.setAttribute(e,n),this}get container(){return this._container}get id(){return this._id}setID(e){return this._id=e,this.container.setAttribute(u1,e),this}}class hf extends i3{constructor(){super(),this.container.classList.add("list"),this.container.setAttribute(I1,ne.NODE_LIST),this.container.setAttribute(Bn,"u")}append2FirstItem(e){const n=this.container.firstElementChild;return n?(e.removeAttribute(UM),n.lastElementChild.insertAdjacentElement("beforebegin",e)):this.append(e),this}newList(e){const n=new hf;return this.append(e,n.container),n}append(...e){e.forEach(i=>i.removeAttribute(UM));const n=document.createElement("div");return n.setAttribute("data-marker","*"),n.setAttribute(Bn,"u"),n.setAttribute(u1,W1()),n.setAttribute(I1,ne.NODE_LIST_ITEM),n.classList.add("li"),n.appendChild(ES()),e.forEach(i=>n.appendChild(i)),n.appendChild(n3()),this.container.append(n),this}}async function NS(t,e){const n=[];e&&n.push(...t.map(r=>e.match(r.textContent)).flat().map(r=>{const o=document.createElement("span");return o.setAttribute(I1,"block-ref"),o.setAttribute(Bn,"d"),o.setAttribute(Ge,r.id),o.textContent=r.content,o})),n.push(...await xS(t));const i=new Map;return n.forEach(r=>{r!=null&&r.getAttribute&&i.set(r.getAttribute(Ge),r)}),[...i.values()]}async function xS(t,e=!0){const n=t.map(r=>[...r.querySelectorAll('span[data-type="virtual-block-ref"]')].map(o=>o.textContent)).flat(),i=t.map(r=>[...r.querySelectorAll('span[data-type="block-ref"]')].map(o=>{const s=o.textContent.trim();if(s=="*"||s=="@"||s=="+"||s=="&")return;const A=o.cloneNode(!0);if(e){o.setAttribute(I1,"a"),o.removeAttribute(Bn);const a=o.getAttribute(Ge);o.removeAttribute(Ge),o.setAttribute("data-href",`siyuan://blocks/${a}`)}return A})).flat();if((n==null?void 0:n.length)>0){const r=n.map(s=>`"${s}"`).join(","),o=await L.sql(`select id,content from blocks where type='d' and content in (${r})`).then(s=>s.map(A=>{const a=document.createElement("span");return a.textContent=A.content,a.setAttribute(I1,$r),a.setAttribute(Bn,"d"),a.setAttribute(Ge,A.id),a}));i.push(...o)}return i}class FS extends hf{constructor(n,i=!0){super();z0(this,"supBuilder");this.supBuilder=new Rc,i&&this.append2FirstItem(Or("refs:",...n)),this.append2FirstItem(this.supBuilder.container)}appendSup(...n){var i;return(i=this.supBuilder)==null||i.append(...n),this}addBottomLine(){this.setAttr("custom-super-list","1")}}class Rc extends i3{constructor(e="row"){super(),this.container.classList.add("sb"),this.container.setAttribute(I1,ne.NODE_SUPER_BLOCK),this.container.setAttribute("data-sb-layout",e)}}class IS extends i3{constructor(){super();z0(this,"_avID",W1());z0(this,"_db");z0(this,"avContainer",document.createElement("div"));this.container.classList.add("av"),this.container.setAttribute(I1,ne.NODE_ATTRIBUTE_VIEW),this.container.setAttribute(Mr,"false"),this.container.setAttribute("data-av-type","table"),this.container.setAttribute("data-page-size","50"),this.container.setAttribute("data-render","true"),this.container.appendChild(this.avContainer),this.avContainer.classList.add("av__container"),this.avContainer.style.setProperty("--av-background","var(--b3-theme-background)")}get avID(){return this._avID}get db(){return this._db}async init(){this._db=await L.renderAttributeView(this.avID),this.container.setAttribute(PM,this.avID),this.addHeader(),this.addScroll()}addScroll(){const n=this.db.view.columns[0].id,i=this.db.view.columns[1].id,r=this.avContainer.appendChild(document.createElement("div"));r.outerHTML=`
`;function i(){let r=document.createElement("div");return r.firstElementChild.outerHTML=n,r.firstElementChild}return{id:e,html:n,getDiv:i}}function Sy(t,e=""){return t||(t=w1()),`
`}function Ty(t,e,n){return t||(t=w1()),`
`}function u3(t,e,n){return t||(t=w1()),`
`}function mr(t="",...e){const n=document.createElement("div");n.setAttribute(p1,w1()),n.setAttribute(D1,ne.NODE_PARAGRAPH),n.classList.add("p");const i=n.appendChild(document.createElement("div"));return i.setAttribute(zr,"true"),i.setAttribute("spellcheck","false"),e||(e=[]),e.splice(0,0,document.createTextNode(t)),Ey(e,()=>document.createTextNode(" ")).forEach(r=>i.append(r)),n.appendChild(p3()),n}function t9(){const t=document.createElement("div");return t.classList.add("protyle-action"),t.setAttribute("draggable","true"),t.appendChild(document.createElement("svg")).appendChild(document.createElement("use")).setAttribute("xlink:href","#iconDot"),t}function p3(){const t=document.createElement("div");return t.classList.add("protyle-attr"),t.setAttribute(zr,"false"),t.textContent=sB,t}class f3{constructor(){z0(this,"_container",document.createElement("div"));z0(this,"_id",w1());this.container.setAttribute(p1,this.id)}append(...e){return e.forEach(n=>this.container.appendChild(n)),this}build(){return this.container.appendChild(p3()),this.container}cloneDiv(){return li(this.container)}setAttrs(e){return Object.entries(e).forEach(([n,i])=>this.setAttr(n,i)),this}setAttr(e,n){return this.container.setAttribute(e,n),this}get container(){return this._container}get id(){return this._id}setID(e){return this._id=e,this.container.setAttribute(p1,e),this}}class Wf extends f3{constructor(){super(),this.container.classList.add("list"),this.container.setAttribute(D1,ne.NODE_LIST),this.container.setAttribute(Bn,"u")}append2FirstItem(e){const n=this.container.firstElementChild;return n?(e.removeAttribute(ZM),n.lastElementChild.insertAdjacentElement("beforebegin",e)):this.append(e),this}newList(e){const n=new Wf;return this.append(e,n.container),n}append(...e){e.forEach(i=>i.removeAttribute(ZM));const n=document.createElement("div");return n.setAttribute("data-marker","*"),n.setAttribute(Bn,"u"),n.setAttribute(p1,w1()),n.setAttribute(D1,ne.NODE_LIST_ITEM),n.classList.add("li"),n.appendChild(t9()),e.forEach(i=>n.appendChild(i)),n.appendChild(p3()),this.container.append(n),this}}async function n9(t,e){const n=[];e&&n.push(...t.map(r=>e.match(r.textContent)).flat().map(r=>{const o=document.createElement("span");return o.setAttribute(D1,"block-ref"),o.setAttribute(Bn,"d"),o.setAttribute(Ge,r.id),o.textContent=r.content,o})),n.push(...await i9(t));const i=new Map;return n.forEach(r=>{r!=null&&r.getAttribute&&i.set(r.getAttribute(Ge),r)}),[...i.values()]}async function i9(t,e=!0){const n=t.map(r=>[...r.querySelectorAll('span[data-type="virtual-block-ref"]')].map(o=>o.textContent)).flat(),i=t.map(r=>[...r.querySelectorAll('span[data-type="block-ref"]')].map(o=>{const s=o.textContent.trim();if(s=="*"||s=="@"||s=="+"||s=="&")return;const A=o.cloneNode(!0);if(e){o.setAttribute(D1,"a"),o.removeAttribute(Bn);const a=o.getAttribute(Ge);o.removeAttribute(Ge),o.setAttribute("data-href",`siyuan://blocks/${a}`)}return A})).flat();if((n==null?void 0:n.length)>0){const r=n.map(s=>`"${s}"`).join(","),o=await L.sql(`select id,content from blocks where type='d' and content in (${r})`).then(s=>s.map(A=>{const a=document.createElement("span");return a.textContent=A.content,a.setAttribute(D1,to),a.setAttribute(Bn,"d"),a.setAttribute(Ge,A.id),a}));i.push(...o)}return i}class r9 extends Wf{constructor(n,i=!0){super();z0(this,"supBuilder");this.supBuilder=new xc,i&&this.append2FirstItem(mr("refs:",...n)),this.append2FirstItem(this.supBuilder.container)}appendSup(...n){var i;return(i=this.supBuilder)==null||i.append(...n),this}addBottomLine(){this.setAttr("custom-super-list","1")}}class xc extends f3{constructor(e="row"){super(),this.container.classList.add("sb"),this.container.setAttribute(D1,ne.NODE_SUPER_BLOCK),this.container.setAttribute("data-sb-layout",e)}}class o9 extends f3{constructor(){super();z0(this,"_avID",w1());z0(this,"_db");z0(this,"avContainer",document.createElement("div"));this.container.classList.add("av"),this.container.setAttribute(D1,ne.NODE_ATTRIBUTE_VIEW),this.container.setAttribute(zr,"false"),this.container.setAttribute("data-av-type","table"),this.container.setAttribute("data-page-size","50"),this.container.setAttribute("data-render","true"),this.container.appendChild(this.avContainer),this.avContainer.classList.add("av__container"),this.avContainer.style.setProperty("--av-background","var(--b3-theme-background)")}get avID(){return this._avID}get db(){return this._db}async init(){this._db=await L.renderAttributeView(this.avID),this.container.setAttribute(th,this.avID),this.addHeader(),this.addScroll()}addScroll(){const n=this.db.view.columns[0].id,i=this.db.view.columns[1].id,r=this.avContainer.appendChild(document.createElement("div"));r.outerHTML=`